Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-09-07 19:17:42 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-07 19:17:42 +0400
commit115b25673832049b746835357d63d8d2dbee5229 (patch)
treeca36db0fe4063108ca5820e1d76ae0496fb88f15 /release/scripts/modules/rna_info.py
parente53bbc7ab7568e315dc3cf06dd5e989300c98786 (diff)
ran through pep8 checker
Diffstat (limited to 'release/scripts/modules/rna_info.py')
-rw-r--r--release/scripts/modules/rna_info.py41
1 files changed, 14 insertions, 27 deletions
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':