diff options
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/add_object_utils.py | 5 | ||||
-rwxr-xr-x | release/scripts/modules/blend_render_info.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/bpy/__init__.py | 1 | ||||
-rw-r--r-- | release/scripts/modules/bpy/ops.py | 6 | ||||
-rw-r--r-- | release/scripts/modules/bpy/path.py | 79 | ||||
-rw-r--r-- | release/scripts/modules/bpy/utils.py | 26 | ||||
-rw-r--r-- | release/scripts/modules/bpy_types.py | 29 | ||||
-rw-r--r-- | release/scripts/modules/bpyml.py | 24 | ||||
-rw-r--r-- | release/scripts/modules/bpyml_ui.py | 6 | ||||
-rw-r--r-- | release/scripts/modules/graphviz_export.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/io_utils.py | 12 | ||||
-rw-r--r-- | release/scripts/modules/rna_info.py | 41 | ||||
-rw-r--r-- | release/scripts/modules/rna_prop_ui.py | 1 |
13 files changed, 114 insertions, 124 deletions
diff --git a/release/scripts/modules/add_object_utils.py b/release/scripts/modules/add_object_utils.py index eaa97512f89..44efc8f2ada 100644 --- a/release/scripts/modules/add_object_utils.py +++ b/release/scripts/modules/add_object_utils.py @@ -60,7 +60,6 @@ def add_object_data(context, obdata, operator=None): if context.space_data and context.space_data.type == 'VIEW_3D': base.layers_from_view(context.space_data) - obj_new.matrix_world = add_object_align_init(context, operator) obj_act = scene.objects.active @@ -69,10 +68,10 @@ def add_object_data(context, obdata, operator=None): bpy.ops.object.mode_set(mode='OBJECT') obj_act.select = True - scene.update() # apply location + scene.update() # apply location #scene.objects.active = obj_new - bpy.ops.object.join() # join into the active. + bpy.ops.object.join() # join into the active. bpy.ops.object.mode_set(mode='EDIT') else: diff --git a/release/scripts/modules/blend_render_info.py b/release/scripts/modules/blend_render_info.py index dcd1f9cbee3..43820e82340 100755 --- a/release/scripts/modules/blend_render_info.py +++ b/release/scripts/modules/blend_render_info.py @@ -40,7 +40,7 @@ def read_blend_rend_chunk(path): head = blendfile.read(7) - if head[0:2] == b'\x1f\x8b': # gzip magic + if head[0:2] == b'\x1f\x8b': # gzip magic import gzip blendfile.close() blendfile = gzip.open(path, 'rb') @@ -57,7 +57,7 @@ def read_blend_rend_chunk(path): is_big_endian = (blendfile.read(1) == b'V') # Now read the bhead chunk!!! - blendfile.read(3) # skip the version + blendfile.read(3) # skip the version scenes = [] diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index 5b7d5a76336..cba85d935ae 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -50,7 +50,6 @@ def _main(): pydoc.Helper.getline = lambda self, prompt: None pydoc.TextDoc.use_bold = lambda self, text: text - # if "-d" in sys.argv: # Enable this to measure startup speed if 0: import cProfile diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py index 223a5a89471..7a824ce2e68 100644 --- a/release/scripts/modules/bpy/ops.py +++ b/release/scripts/modules/bpy/ops.py @@ -164,7 +164,7 @@ class bpy_ops_submodule_op(object): if 'FINISHED' in ret: import bpy scene = bpy.context.scene - if scene: # None in backgroud mode + if scene: # None in backgroud mode scene.update() else: for scene in bpy.data.scenes: @@ -178,14 +178,14 @@ class bpy_ops_submodule_op(object): ''' return op_get_rna(self.idname()) - def __repr__(self): # useful display, repr(op) + def __repr__(self): # useful display, repr(op) import bpy idname = self.idname() as_string = op_as_string(idname) descr = getattr(bpy.types, idname).bl_rna.description return as_string + "\n" + descr - def __str__(self): # used for print(...) + def __str__(self): # used for print(...) return "<function bpy.ops.%s.%s at 0x%x'>" % \ (self.module, self.func, id(self)) diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index 63149f2fce8..423fdb7aaab 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -26,6 +26,7 @@ functions for dealing with paths in Blender. import bpy as _bpy import os as _os + def abspath(path): """ Returns the absolute path relative to the current blend file using the "//" prefix. @@ -99,58 +100,58 @@ def display_name(name): def resolve_ncase(path): - """ - Resolve a case insensitive path on a case sensitive system, - returning a string with the path if found else return the original path. - """ + """ + Resolve a case insensitive path on a case sensitive system, + returning a string with the path if found else return the original path. + """ - import os + import os - def _ncase_path_found(path): - if path=='' or os.path.exists(path): - return path, True + def _ncase_path_found(path): + if path == "" or os.path.exists(path): + return path, True - filename = os.path.basename(path) # filename may be a directory or a file - dirpath = os.path.dirname(path) + filename = os.path.basename(path) # filename may be a directory or a file + dirpath = os.path.dirname(path) - suffix = "" - if not filename: # dir ends with a slash? - if len(dirpath) < len(path): - suffix = path[:len(path)-len(dirpath)] + suffix = "" + if not filename: # dir ends with a slash? + if len(dirpath) < len(path): + suffix = path[:len(path) - len(dirpath)] - filename = os.path.basename(dirpath) - dirpath = os.path.dirname(dirpath) + filename = os.path.basename(dirpath) + dirpath = os.path.dirname(dirpath) - if not os.path.exists(dirpath): - dirpath, found = _ncase_path_found(dirpath) + if not os.path.exists(dirpath): + dirpath, found = _ncase_path_found(dirpath) - if not found: - return path, False + if not found: + return path, False - # at this point, the directory exists but not the file + # at this point, the directory exists but not the file - # we are expecting 'dirpath' to be a directory, but it could be a file - if os.path.isdir(dirpath): - files = os.listdir(dirpath) - else: - return path, False + # we are expecting 'dirpath' to be a directory, but it could be a file + if os.path.isdir(dirpath): + files = os.listdir(dirpath) + else: + return path, False - filename_low = filename.lower() - f_iter_nocase = None + filename_low = filename.lower() + f_iter_nocase = None - for f_iter in files: - if f_iter.lower() == filename_low: - f_iter_nocase = f_iter - break + for f_iter in files: + if f_iter.lower() == filename_low: + f_iter_nocase = f_iter + break - if f_iter_nocase: - return os.path.join(dirpath, f_iter_nocase) + suffix, True - else: - # cant find the right one, just return the path as is. - return path, False + if f_iter_nocase: + return os.path.join(dirpath, f_iter_nocase) + suffix, True + else: + # cant find the right one, just return the path as is. + return path, False - ncase_path, found = _ncase_path_found(path) - return ncase_path if found else path + ncase_path, found = _ncase_path_found(path) + return ncase_path if found else path def ensure_ext(filepath, ext, case_sensitive=False): diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index 7cfe476c2e7..21453f06648 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -30,6 +30,7 @@ import sys as _sys from _bpy import blend_paths from _bpy import script_paths as _bpy_script_paths + def _test_import(module_name, loaded_modules): import traceback import time @@ -49,7 +50,7 @@ def _test_import(module_name, loaded_modules): if _bpy.app.debug: print("time %s %.4f" % (module_name, time.time() - t)) - loaded_modules.add(mod.__name__) # should match mod.__name__ too + loaded_modules.add(mod.__name__) # should match mod.__name__ too return mod @@ -83,9 +84,10 @@ def modules_from_path(path, loaded_modules): modules.append(mod) return modules - -_global_loaded_modules = [] # store loaded module names for reloading. -import bpy_types as _bpy_types # keep for comparisons, never ever reload this. + + +_global_loaded_modules = [] # store loaded module names for reloading. +import bpy_types as _bpy_types # keep for comparisons, never ever reload this. def load_scripts(reload_scripts=False, refresh_scripts=False): @@ -109,7 +111,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): if refresh_scripts: original_modules = _sys.modules.values() - + if reload_scripts: _bpy_types.TypeMap.clear() _bpy_types.PropertiesMap.clear() @@ -135,7 +137,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): traceback.print_exc() def sys_path_ensure(path): - if path not in _sys.path: # reloading would add twice + if path not in _sys.path: # reloading would add twice _sys.path.insert(0, path) def test_reload(mod): @@ -191,7 +193,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): continue if user_path != base_path and path_subdir == "": - continue # avoid loading 2.4x scripts + continue # avoid loading 2.4x scripts for mod in modules_from_path(path, loaded_modules): test_register(mod) @@ -212,10 +214,8 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): if _bpy.app.debug: print("Python Script Load Time %.4f" % (time.time() - t_main)) - - _bpy_types._register_immediate = True - + _bpy_types._register_immediate = True # base scripts @@ -265,7 +265,7 @@ def script_paths(subdir=None, user=True): return script_paths -_presets = _os.path.join(_scripts[0], "presets") # FIXME - multiple paths +_presets = _os.path.join(_scripts[0], "presets") # FIXME - multiple paths def preset_paths(subdir): @@ -295,10 +295,10 @@ def smpte_from_seconds(time, fps=None): else: neg = "" - if time >= 3600.0: # hours + if time >= 3600.0: # hours hours = int(time / 3600.0) time = time % 3600.0 - if time >= 60.0: # mins + if time >= 60.0: # mins minutes = int(time / 60.0) time = time % 60.0 diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 84d05a7a48d..0ef1e490f53 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -251,7 +251,7 @@ class _GenericBone: bones = id_data.pose.bones elif id_data_type == bpy_types.Armature: bones = id_data.edit_bones - if not bones: # not in editmode + if not bones: # not in editmode bones = id_data.bones return bones @@ -368,7 +368,7 @@ class Mesh(bpy_types.ID): return a list of edge vertex index lists """ - OTHER_INDEX = 2, 3, 0, 1 # opposite face index + OTHER_INDEX = 2, 3, 0, 1 # opposite face index if faces is None: faces = self.faces @@ -389,7 +389,7 @@ class Mesh(bpy_types.ID): edge_loops = [] for edkey, ed_adj in edges.items(): - if 0 < len(ed_adj) < 3: # 1 or 2 + if 0 < len(ed_adj) < 3: # 1 or 2 # Seek the first edge context_loop = [edkey, ed_adj[0]] edge_loops.append(context_loop) @@ -407,11 +407,11 @@ class Mesh(bpy_types.ID): ed_adj = edges[context_loop[-1]] if len(ed_adj) != 2: - if other_dir and flipped == False: # the original edge had 2 other edges - flipped = True # only flip the list once + if other_dir and flipped == False: # the original edge had 2 other edges + flipped = True # only flip the list once context_loop.reverse() ed_adj[:] = [] - context_loop.append(other_dir) # save 1 lookiup + context_loop.append(other_dir) # save 1 lookiup ed_adj = edges[context_loop[-1]] if len(ed_adj) != 2: @@ -427,7 +427,6 @@ class Mesh(bpy_types.ID): # Dont look at this again ed_adj[:] = [] - return edge_loops def edge_loops_from_edges(self, edges=None): @@ -556,6 +555,7 @@ PropertiesMap = {} # registers moduals instantly. _register_immediate = True + def _unregister_module(module, free=True): for t in TypeMap.get(module, ()): try: @@ -568,7 +568,6 @@ def _unregister_module(module, free=True): if free == True and module in TypeMap: del TypeMap[module] - for t in PropertiesMap.get(module, ()): try: bpy_types.unregister(t) @@ -595,7 +594,7 @@ class RNAMeta(type): @classmethod def _register_immediate(cls): return _register_immediate - + def __new__(cls, name, bases, classdict, **args): result = type.__new__(cls, name, bases, classdict) if bases and bases[0] != StructRNA: @@ -606,21 +605,23 @@ class RNAMeta(type): # Register right away if needed if cls._register_immediate(): bpy_types.register(result) - ClassMap = PropertiesMap + ClassMap = PropertiesMap # first part of packages only if "." in module: module = module[:module.index(".")] - + ClassMap.setdefault(module, []).append(result) return result + class RNAMetaRegister(RNAMeta): @classmethod def _register_immediate(cls): return True + class OrderedMeta(RNAMeta): def __init__(cls, name, bases, attributes): @@ -630,6 +631,7 @@ class OrderedMeta(RNAMeta): def __prepare__(name, bases, **kwargs): return collections.OrderedDict() + # Only defined so operators members can be used by accessing self.order class Operator(StructRNA, metaclass=OrderedMeta): __slots__ = () @@ -644,13 +646,16 @@ class Macro(StructRNA, metaclass=OrderedMeta): def define(self, opname): from _bpy import ops return ops.macro_define(self, opname) - + + class IDPropertyGroup(StructRNA, metaclass=RNAMetaRegister): __slots__ = () + class RenderEngine(StructRNA, metaclass=RNAMeta): __slots__ = () + class _GenericUI: __slots__ = () diff --git a/release/scripts/modules/bpyml.py b/release/scripts/modules/bpyml.py index a2ba9ec8006..f1f72d50fd2 100644 --- a/release/scripts/modules/bpyml.py +++ b/release/scripts/modules/bpyml.py @@ -37,6 +37,8 @@ or simple python blender/ui function calls. """ TAG, ARGS, CHILDREN = range(3) + + class ReturnStore(tuple): def __getitem__(self, key): @@ -94,7 +96,6 @@ def toxml(py_data, indent=" "): def _to_xml_iter(xml_parent, data_ls): for py_item in data_ls: xml_node = newdoc.createElement(py_item[TAG]) - # ok if its empty _to_xml_iter(xml_node, py_item[CHILDREN]) @@ -114,8 +115,7 @@ def fromxml(data): for key, value in xml_node.attributes.items(): kwargs[key] = value return kwargs - - + def _fromxml(xml_node): py_item = (xml_node.tagName, _fromxml_kwargs(xml_node), []) #_fromxml_iter(py_item, xml_node.childNodes) @@ -130,15 +130,15 @@ def fromxml(data): def topretty_py(py_data, indent=" "): - + if len(py_data) != 1: raise Exception("Expected a list with one member") lines = [] - + def _to_kwargs(kwargs): return ", ".join([("%s=%s" % (key, repr(value))) for key, value in sorted(kwargs.items())]) - + def _topretty(py_item, indent_ctx, last): if py_item[CHILDREN]: lines.append("%s%s(%s) [" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS]))) @@ -148,14 +148,14 @@ def topretty_py(py_data, indent=" "): lines.append("%s]%s" % (indent_ctx, ("" if last else ","))) else: lines.append("%s%s(%s)%s" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS]), ("" if last else ","))) - + _topretty(py_data[0], "", True) return "\n".join(lines) if __name__ == "__main__": # testing code. - + tag_module("bpyml_test", ("ui", "prop", "row", "column", "active", "separator", "split")) from bpyml_test import * @@ -192,13 +192,13 @@ if __name__ == "__main__": ] xml_data = toxml(draw) - print(xml_data) # xml version + print(xml_data) # xml version py_data = fromxml(xml_data) - print(py_data) # converted back to py + print(py_data) # converted back to py xml_data = toxml(py_data) - print(xml_data) # again back to xml + print(xml_data) # again back to xml - py_data = fromxml(xml_data) # pretty python version + py_data = fromxml(xml_data) # pretty python version print(topretty_py(py_data)) diff --git a/release/scripts/modules/bpyml_ui.py b/release/scripts/modules/bpyml_ui.py index ad68d1b0d7e..2462dd60e3e 100644 --- a/release/scripts/modules/bpyml_ui.py +++ b/release/scripts/modules/bpyml_ui.py @@ -32,7 +32,7 @@ _uilayout_tags = ["ui"] + \ # these need to be imported directly # >>> from bpyml_ui.locals import * -locals = bpyml.tag_module("%s.locals" % __name__ , _uilayout_tags) +locals = bpyml.tag_module("%s.locals" % __name__, _uilayout_tags) def _parse_rna(prop, value): @@ -72,12 +72,12 @@ def _call_recursive(context, base, py_node): value = eval(value, {"context": _bpy.context}) setattr(base, py_node[TAG], value) else: - value = py_node[ARGS]['value'] # have to have this + value = py_node[ARGS]['value'] # have to have this setattr(base, name, value) else: args = _parse_rna_args(base, py_node) func_new = getattr(base, py_node[TAG]) - base_new = func_new(**args) # call blender func + base_new = func_new(**args) # call blender func if base_new is not None: for py_node_child in py_node[CHILDREN]: _call_recursive(context, base_new, py_node_child) diff --git a/release/scripts/modules/graphviz_export.py b/release/scripts/modules/graphviz_export.py index 2389e1f9020..b60952a2f88 100644 --- a/release/scripts/modules/graphviz_export.py +++ b/release/scripts/modules/graphviz_export.py @@ -43,7 +43,6 @@ def compat_str(text, line_length=0): text_ls.append(text) text = '\n '.join(text_ls) - #text = text.replace('.', '.\n') #text = text.replace(']', ']\n') text = text.replace("\n", "\\n") @@ -88,7 +87,6 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr else: opts.append("fillcolor=white") - fw('"%s" [%s];\n' % (bone.name, ','.join(opts))) fw('\n\n# Hierarchy:\n') @@ -162,7 +160,7 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr pbone_target = rna_path_as_pbone(target.data_path) rna_path_target = target.data_path if pbone_target: - opts = ['dir=forward', "weight=1", "arrowhead=normal", "arrowtail=none", "constraint=false", 'color="blue"', "labelfontsize=4"] # , + opts = ['dir=forward', "weight=1", "arrowhead=normal", "arrowtail=none", "constraint=false", 'color="blue"', "labelfontsize=4"] display_source = rna_path.replace("pose.bones", "") display_target = rna_path_target.replace("pose.bones", "") if XTRA_INFO: diff --git a/release/scripts/modules/io_utils.py b/release/scripts/modules/io_utils.py index 5150b5153c0..64062ed697f 100644 --- a/release/scripts/modules/io_utils.py +++ b/release/scripts/modules/io_utils.py @@ -21,8 +21,9 @@ import bpy from bpy.props import * + class ExportHelper: - filepath = StringProperty(name="File Path", description="Filepath used for exporting the file", maxlen= 1024, default= "", subtype='FILE_PATH') + filepath = StringProperty(name="File Path", description="Filepath used for exporting the file", maxlen=1024, default="", subtype='FILE_PATH') check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'}) def invoke(self, context, event): @@ -35,7 +36,7 @@ class ExportHelper: class ImportHelper: - filepath = StringProperty(name="File Path", description="Filepath used for importing the file", maxlen= 1024, default= "", subtype='FILE_PATH') + filepath = StringProperty(name="File Path", description="Filepath used for importing the file", maxlen=1024, default="", subtype='FILE_PATH') def invoke(self, context, event): context.window_manager.add_fileselect(self) @@ -78,14 +79,15 @@ def free_derived_objects(ob): def unpack_list(list_of_tuples): flat_list = [] - flat_list_extend = flat_list.extend # a tich faster + flat_list_extend = flat_list.extend # a tich faster for t in list_of_tuples: flat_list_extend(t) return flat_list + # same as above except that it adds 0 for triangle faces def unpack_face_list(list_of_tuples): - # allocate the entire list + #allocate the entire list flat_ls = [0] * (len(list_of_tuples) * 4) i = 0 @@ -93,7 +95,7 @@ def unpack_face_list(list_of_tuples): if len(t) == 3: if t[2] == 0: t = t[1], t[2], t[0] - else: # assuem quad + else: # assuem quad if t[3] == 0 or t[2] == 0: t = t[2], t[3], t[0], t[1] diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py index 0a93121c559..b2b8558b988 100644 --- a/release/scripts/modules/rna_info.py +++ b/release/scripts/modules/rna_info.py @@ -77,7 +77,7 @@ def range_str(val): def float_as_string(f): val_str = "%g" % f - if '.' not in val_str and '-' not in val_str: # value could be 1e-05 + if '.' not in val_str and '-' not in val_str: # value could be 1e-05 val_str += '.0' return val_str @@ -194,20 +194,18 @@ class InfoPropertyRNA: self.type = rna_prop.type.lower() fixed_type = getattr(rna_prop, "fixed_type", "") if fixed_type: - self.fixed_type = GetInfoStructRNA(fixed_type) # valid for pointer/collections + self.fixed_type = GetInfoStructRNA(fixed_type) # valid for pointer/collections else: self.fixed_type = None if self.type == "enum": self.enum_items[:] = rna_prop.items.keys() - if self.array_length: self.default = tuple(getattr(rna_prop, "default_array", ())) else: self.default = getattr(rna_prop, "default", None) - self.default_str = "" # fallback - + self.default_str = "" # fallback if self.type == "pointer": # pointer has no default, just set as None @@ -231,7 +229,7 @@ class InfoPropertyRNA: else: self.default_str = str(self.default) - self.srna = GetInfoStructRNA(rna_prop.srna) # valid for pointer/collections + self.srna = GetInfoStructRNA(rna_prop.srna) # valid for pointer/collections def get_arg_default(self, force=True): default = self.default_str @@ -275,7 +273,7 @@ class InfoPropertyRNA: elif as_arg: if not self.is_required: type_info.append("optional") - else: # readonly is only useful for selfs, not args + else: # readonly is only useful for selfs, not args if self.is_readonly: type_info.append("readonly") @@ -414,10 +412,10 @@ def BuildRNAInfo(): # Use for faster lookups # use rna_struct.identifier as the key for each dict rna_struct_dict = {} # store identifier:rna lookups - rna_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct) - rna_children_dict = {} # store all rna_structs nested from here - rna_references_dict = {} # store a list of rna path strings that reference this type - # rna_functions_dict = {} # store all functions directly in this type (not inherited) + rna_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct) + rna_children_dict = {} # store all rna_structs nested from here + rna_references_dict = {} # store a list of rna path strings that reference this type + # rna_functions_dict = {} # store all functions directly in this type (not inherited) def full_rna_struct_path(rna_struct): ''' @@ -434,7 +432,7 @@ def BuildRNAInfo(): try: return rna_struct.base.identifier except: - return "" # invalid id + return "" # invalid id #structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()] ''' @@ -466,17 +464,13 @@ def BuildRNAInfo(): # NOT USED YET ## rna_functions_dict[identifier] = get_direct_functions(rna_struct) - # fill in these later rna_children_dict[identifier] = [] rna_references_dict[identifier] = [] - - else: print("Ignoring", rna_type_name) - - structs.sort() # not needed but speeds up sort below, setting items without an inheritance first + structs.sort() # not needed but speeds up sort below, setting items without an inheritance first # Arrange so classes are always defined in the correct order deps_ok = False @@ -494,7 +488,7 @@ def BuildRNAInfo(): ok = False while i < len(structs): if structs[i][1] == rna_base: - structs.insert(i + 1, data) # insert after the item we depend on. + structs.insert(i + 1, data) # insert after the item we depend on. ok = True break i += 1 @@ -506,7 +500,6 @@ def BuildRNAInfo(): # Done ordering structs - # precalc vars to avoid a lot of looping for (rna_base, identifier, rna_struct) in structs: @@ -536,18 +529,15 @@ def BuildRNAInfo(): if rna_prop_ptr: rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_func.identifier)) - # Store nested children nested = rna_struct.nested if nested: rna_children_dict[nested.identifier].append(rna_struct) - # Sort the refs, just reads nicer for rna_refs in rna_references_dict.values(): rna_refs.sort() - info_structs = [] for (rna_base, identifier, rna_struct) in structs: #if rna_struct.nested: @@ -590,7 +580,6 @@ def BuildRNAInfo(): if default < prop.min or default > prop.max: print("\t %s.%s, %s not in [%s - %s]" % (rna_info.identifier, prop.identifier, default, prop.min, prop.max)) - # now for operators op_mods = dir(bpy.ops) @@ -616,10 +605,8 @@ def BuildRNAInfo(): for rna_prop in rna_info.args: rna_prop.build() - #for rna_info in InfoStructRNA.global_lookup.values(): # print(rna_info) - return InfoStructRNA.global_lookup, InfoFunctionRNA.global_lookup, InfoOperatorRNA.global_lookup, InfoPropertyRNA.global_lookup @@ -628,11 +615,11 @@ if __name__ == "__main__": struct = rna_info.BuildRNAInfo()[0] data = [] for struct_id, v in sorted(struct.items()): - struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id) + struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id) for base in v.get_bases(): struct_id_str = base.identifier + "|" + struct_id_str - + props = [(prop.identifier, prop) for prop in v.properties] for prop_id, prop in sorted(props): # if prop.type == 'boolean': diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index 4a9460d8271..0afe79e4829 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -143,4 +143,3 @@ class PropertyPanel(): def draw(self, context): draw(self.layout, context, self._context_path) - |