Blender V2.61 - r43446

simple_enum_gen.py

Go to the documentation of this file.
00001  # ***** BEGIN GPL LICENSE BLOCK *****
00002  #
00003  # This program is free software; you can redistribute it and/or
00004  # modify it under the terms of the GNU General Public License
00005  # as published by the Free Software Foundation; either version 2
00006  # of the License, or (at your option) any later version.
00007  #
00008  # This program is distributed in the hope that it will be useful,
00009  # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  # GNU General Public License for more details.
00012  #
00013  # You should have received a copy of the GNU General Public License
00014  # along with this program; if not, write to the Free Software Foundation,
00015  # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00016  #
00017  # Contributor(s): Campbell Barton
00018  #
00019  # #**** END GPL LICENSE BLOCK #****
00020 
00021 defs = """
00022     SPACE_EMPTY,
00023     SPACE_VIEW3D,
00024     SPACE_IPO,
00025     SPACE_OUTLINER,
00026     SPACE_BUTS,
00027     SPACE_FILE,
00028     SPACE_IMAGE,
00029     SPACE_INFO,
00030     SPACE_SEQ,
00031     SPACE_TEXT,
00032     SPACE_IMASEL, #Deprecated
00033     SPACE_SOUND, #Deprecated
00034     SPACE_ACTION,
00035     SPACE_NLA,
00036     SPACE_SCRIPT, #Deprecated
00037     SPACE_TIME,
00038     SPACE_NODE,
00039     SPACEICONMAX
00040 """
00041 
00042 print '\tmod = PyModule_New("dummy");'
00043 print '\tPyModule_AddObject( submodule, "key", mod );'
00044 
00045 for d in defs.split('\n'):
00046 
00047     d = d.replace(',', ' ')
00048     w = d.split()
00049 
00050     if not w:
00051         continue
00052 
00053     try:        w.remove("#define")
00054     except: pass
00055 
00056     # print w
00057 
00058     val = w[0]
00059     py_val = w[0]
00060 
00061     print '\tPyModule_AddObject( mod, "%s", PyLong_FromSize_t(%s) );' % (val, py_val)
00062 
00063 
00064 
00065