diff --git a/release/scripts/console.py b/release/scripts/console.py index b0c7628d6e7..7306d6d8dca 100644 --- a/release/scripts/console.py +++ b/release/scripts/console.py @@ -53,7 +53,6 @@ import Blender from Blender import * import sys as python_sys import StringIO -import types # Constants __DELIMETERS__ = '. ,=+-*/%<>&~][{}():\t' @@ -189,17 +188,24 @@ def insertCmdData(cmdBuffer): COLLECTED_VAR_NAMES = {} # a list of keys, each key has a list of absolute paths # Pain and simple recursice dir(), accepts a string +unused_types = str, dict, list, float, int, str, type, tuple, type(dir), type(None) def rdir(dirString, depth=0): - + #print ' ' * depth, dirString # MAX DEPTH SET HERE - if depth > 4: - print 'maxdepoth reached.' + if depth > 5: + # print 'maxdepoth reached.' return global COLLECTED_VAR_NAMES dirStringSplit = dirString.split('.') - exec('dirList = dir(%s)' % dirString) + exec('value=' + dirString) + + if type(value) in unused_types: + # print 'bad type' + return + dirList = dir(value) + for dirItem in dirList: if dirItem.startswith('_'): continue @@ -212,16 +218,26 @@ def rdir(dirString, depth=0): except: # Dont bother with this data. continue + #print 'HEY', dirData, dirItem + #if type(dirItem) != str: + # print dirItem, type(dirItem) - if type(dirItem) != types.StringType: - print dirItem, type(dirItem) - - if dirItem not in COLLECTED_VAR_NAMES.keys(): + if dirItem not in COLLECTED_VAR_NAMES: # .keys() COLLECTED_VAR_NAMES[dirItem] = [] # Add the string - splitD = dirString.split('"')[-2] + # splitD = dirString.split('"')[-2] + + # Example of dirString + # __CONSOLE_VAR_DICT__["Main"].scenes.active.render + + # Works but can be faster + # splitD = dirString.replace('__CONSOLE_VAR_DICT__["', '').replace('"]', '') + + splitD = dirString[22:].replace('"]', '') + if splitD not in COLLECTED_VAR_NAMES[dirItem]: + print dirItem, dirString, splitD, COLLECTED_VAR_NAMES[dirItem].append(splitD) @@ -230,16 +246,7 @@ def rdir(dirString, depth=0): #if type(dirData) == types.ClassType or \ # type(dirData) == types.ModuleType: type_dirData = type(dirData) - if type_dirData != types.StringType and\ - type_dirData != types.DictType and\ - type_dirData != types.DictionaryType and\ - type_dirData != types.FloatType and\ - type_dirData != types.IntType and\ - type_dirData != types.NoneType and\ - type_dirData != types.StringTypes and\ - type_dirData != types.TypeType and\ - type_dirData != types.TupleType and\ - type_dirData != types.BuiltinFunctionType: + if type_dirData not in unused_types: # print type(dirData), dirItem # Dont loop up dirs for strings ints etc. if dirItem not in dirStringSplit: @@ -255,7 +262,7 @@ def rdir(dirString, depth=0): def recursive_dir(): global COLLECTED_VAR_NAMES - for name in __CONSOLE_VAR_DICT__.keys(): + for name in __CONSOLE_VAR_DICT__: # .keys() if not name.startswith('_'): # Dont pick names like __name__ rdir('__CONSOLE_VAR_DICT__["%s"]' % name) #print COLLECTED_VAR_NAMES @@ -472,7 +479,7 @@ def handle_event(evt, val): if editVar: possibilities = [] - for __TMP_VAR_NAME__ in RECURSIVE_DIR.keys(): + for __TMP_VAR_NAME__ in RECURSIVE_DIR: #.keys(): #print '\t', __TMP_VAR_NAME__ if __TMP_VAR_NAME__ == editVar: # print 'ADITVAR IS A VAR' @@ -500,14 +507,13 @@ def handle_event(evt, val): # Account for non absolute (variables for eg.) if usage: # not '' absName = '%s.%s' % (usage, __TMP_VAR_NAME__) - if absName.find('.'+editVar) != -1 or\ - absName.startswith(editVar) or\ - __TMP_VAR_NAME__.startswith(editVar): - #print editVar, 'found in', absName + + if __TMP_VAR_NAME__.startswith(editVar): menuList.append( # Used for names and can be entered when pressing shift. (absName, # Absolute name __TMP_VAR_NAME__) # Relative name, non shift ) + #else: # if absName.find(editVar) != -1: # menuList.append((__TMP_VAR_NAME__, __TMP_VAR_NAME__)) # Used for names and can be entered when pressing shift. diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c index 403abf4059d..ed6f43067bb 100644 --- a/source/blender/python/api2_2x/Image.c +++ b/source/blender/python/api2_2x/Image.c @@ -1247,11 +1247,11 @@ static PyGetSetDef BPy_Image_getseters[] = { {"fields", (getter)Image_getFlag, (setter)Image_setFlag, "image fields toggle", (void *)IMA_FIELDS }, {"fields_odd", (getter)Image_getFlag, (setter)Image_setFlag, - "image fields toggle", (void *)IMA_STD_FIELD }, + "image odd fields toggle", (void *)IMA_STD_FIELD }, {"antialias", (getter)Image_getFlag, (setter)Image_setFlag, - "image fields toggle", (void *)IMA_ANTIALI }, + "image antialiasing toggle", (void *)IMA_ANTIALI }, {"reflect", (getter)Image_getFlag, (setter)Image_setFlag, - "image fields toggle", (void *)IMA_REFLECT }, + "image reflect toggle", (void *)IMA_REFLECT }, {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ }; diff --git a/source/blender/python/api2_2x/Types.c b/source/blender/python/api2_2x/Types.c index c714df8ab0a..32bb8f80c3e 100644 --- a/source/blender/python/api2_2x/Types.c +++ b/source/blender/python/api2_2x/Types.c @@ -66,6 +66,7 @@ extern PyTypeObject Modifier_Type, ModSeq_Type; extern PyTypeObject EditBone_Type; extern PyTypeObject ThemeSpace_Type; extern PyTypeObject ThemeUI_Type; +extern PyTypeObject TimeLine_Type; char M_Types_doc[] = "The Blender Types module\n\n\ This module is a dictionary of all Blender Python types"; @@ -120,6 +121,7 @@ void types_InitAll( void ) Text_Type.ob_type = &PyType_Type; Text3d_Type.ob_type = &PyType_Type; Texture_Type.ob_type = &PyType_Type; + TimeLine_Type.ob_type = &PyType_Type; World_Type.ob_type = &PyType_Type; buffer_Type.ob_type = &PyType_Type; constant_Type.ob_type = &PyType_Type;