[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28108] trunk/blender/release/scripts/ modules/rna_info.py: dont document parent classes funcs and properties
Campbell Barton
ideasman42 at gmail.com
Fri Apr 9 22:04:37 CEST 2010
Revision: 28108
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28108
Author: campbellbarton
Date: 2010-04-09 22:04:37 +0200 (Fri, 09 Apr 2010)
Log Message:
-----------
dont document parent classes funcs and properties
Modified Paths:
--------------
trunk/blender/release/scripts/modules/rna_info.py
Modified: trunk/blender/release/scripts/modules/rna_info.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_info.py 2010-04-09 15:47:12 UTC (rev 28107)
+++ trunk/blender/release/scripts/modules/rna_info.py 2010-04-09 20:04:37 UTC (rev 28108)
@@ -26,6 +26,25 @@
script_paths = bpy.utils.script_paths()
+def _get_direct_attr(rna_type, attr):
+ props = getattr(rna_type, attr)
+ base = rna_type.base
+
+ if not base:
+ return props
+ else:
+ props_base = getattr(base, attr).values()
+ return dict([(prop.identifier, prop) for prop in props if prop not in props_base])
+
+
+def get_direct_properties(rna_type):
+ return _get_direct_attr(rna_type, "properties")
+
+
+def get_direct_functions(rna_type):
+ return _get_direct_attr(rna_type, "functions")
+
+
def range_str(val):
if val < -10000000:
return '-inf'
@@ -67,8 +86,8 @@
def build(self):
rna_type = self.bl_rna
parent_id = self.identifier
- self.properties[:] = [GetInfoPropertyRNA(rna_prop, parent_id) for rna_id, rna_prop in rna_type.properties.items() if rna_id != "rna_type"]
- self.functions[:] = [GetInfoFunctionRNA(rna_prop, parent_id) for rna_prop in rna_type.functions.values()]
+ self.properties[:] = [GetInfoPropertyRNA(rna_prop, parent_id) for rna_id, rna_prop in get_direct_properties(rna_type).items() if rna_id != "rna_type"]
+ self.functions[:] = [GetInfoFunctionRNA(rna_prop, parent_id) for rna_prop in get_direct_functions(rna_type).values()]
def get_bases(self):
bases = []
@@ -426,7 +445,7 @@
rna_full_path_dict[identifier] = full_rna_struct_path(rna_struct)
# Store a list of functions, remove inherited later
- rna_functions_dict[identifier] = list(rna_struct.functions)
+ rna_functions_dict[identifier] = get_direct_functions(rna_struct)
# fill in these later
@@ -438,12 +457,6 @@
print("Ignoring", rna_type_name)
- # Sucks but we need to copy this so we can check original parent functions
- rna_functions_dict__copy = {}
- for key, val in rna_functions_dict.items():
- rna_functions_dict__copy[key] = val[:]
-
-
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
@@ -478,41 +491,26 @@
# precalc vars to avoid a lot of looping
for (rna_base, identifier, rna_struct) in structs:
- if rna_base:
- rna_base_prop_keys = rna_struct_dict[rna_base].properties.keys() # could cache
- rna_base_func_keys = [f.identifier for f in rna_struct_dict[rna_base].functions]
- else:
- rna_base_prop_keys = []
- rna_base_func_keys = []
-
# rna_struct_path = full_rna_struct_path(rna_struct)
rna_struct_path = rna_full_path_dict[identifier]
- for rna_prop_identifier, rna_prop in rna_struct.properties.items():
+ for rna_prop_identifier, rna_prop in get_direct_properties(rna_struct).items():
- if rna_prop_identifier == 'RNA' or \
- rna_id_ignore(rna_prop_identifier) or \
- rna_prop_identifier in rna_base_prop_keys:
+ if rna_prop_identifier == 'RNA' or rna_id_ignore(rna_prop_identifier):
continue
-
for rna_prop_ptr in (getattr(rna_prop, "fixed_type", None), getattr(rna_prop, "srna", None)):
# Does this property point to me?
if rna_prop_ptr:
rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_prop_identifier))
- for rna_func in rna_struct.functions:
+ for rna_func in get_direct_functions(rna_struct).values():
for rna_prop_identifier, rna_prop in rna_func.parameters.items():
- if rna_prop_identifier == 'RNA' or \
- rna_id_ignore(rna_prop_identifier) or \
- rna_prop_identifier in rna_base_func_keys:
+ if rna_prop_identifier == 'RNA' or rna_id_ignore(rna_prop_identifier):
continue
- try:
- rna_prop_ptr = rna_prop.fixed_type
- except AttributeError:
- rna_prop_ptr = None
+ rna_prop_ptr = getattr(rna_prop, "fixed_type", None)
# Does this property point to me?
if rna_prop_ptr:
@@ -525,16 +523,6 @@
rna_children_dict[nested.identifier].append(rna_struct)
- if rna_base:
- rna_funcs = rna_functions_dict[identifier]
- if rna_funcs:
- # Remove inherited functions if we have any
- rna_base_funcs = rna_functions_dict__copy[rna_base]
- rna_funcs[:] = [f for f in rna_funcs if f not in rna_base_funcs]
-
- rna_functions_dict__copy.clear()
- del rna_functions_dict__copy
-
# Sort the refs, just reads nicer
for rna_refs in rna_references_dict.values():
rna_refs.sort()
More information about the Bf-blender-cvs
mailing list