diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-03-21 09:55:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-03-21 09:55:30 +0300 |
commit | 6ab2d7ad659606cbf2a315ef9a576c364e6ec9bb (patch) | |
tree | 56250d1706115c5e4fd5aa8157a8dda91b8d950a /source/blender/python/epy_doc_gen.py | |
parent | b4209c56565660c20718fc2e1ad74d4257683a3e (diff) |
- lazy subtype initialization rna, was initializing every type in bpy.types at startup, which is slow and doesn't allow access to dynamically added types.
- bpy.types isnt a module anymore, defined as its own PyType, getattr looks up the rna collection each time.
- refcounting fixes
- fixe epydoc generation with undefined values
Diffstat (limited to 'source/blender/python/epy_doc_gen.py')
-rw-r--r-- | source/blender/python/epy_doc_gen.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/python/epy_doc_gen.py b/source/blender/python/epy_doc_gen.py index 75d9f88b6db..b6e5a7d0243 100644 --- a/source/blender/python/epy_doc_gen.py +++ b/source/blender/python/epy_doc_gen.py @@ -41,8 +41,6 @@ def get_array_str(length): def rna2epy(target_path): - - def write_struct(rna_struct, structs, ident): identifier = rna_struct.identifier @@ -131,8 +129,11 @@ def rna2epy(target_path): for rna_type_name in dir(bpy.types): rna_type = getattr(bpy.types, rna_type_name) if hasattr(rna_type, '__rna__'): + #if not rna_type_name.startswith('__'): rna_struct = rna_type.__rna__ structs.append( (base_id(rna_struct), rna_struct.identifier, rna_struct) ) + else: + print("Ignoring", rna_type_name) @@ -160,7 +161,7 @@ def rna2epy(target_path): i+=1 if not ok: - print('Dependancy "%s"could not be found for "%s"' % (identifier, rna_base)) + print('Dependancy "%s" could not be found for "%s"' % (identifier, rna_base)) break @@ -199,7 +200,9 @@ def op2epy(target_path): kw_args = [] # "foo = 1", "bar=0.5", "spam='ENUM'" kw_arg_attrs = [] # "@type mode: int" - rna = getattr(bpy.types, op).__rna__ + # rna = getattr(bpy.types, op).__rna__ + rna = bpy.ops.__rna__(op) + rna_struct = rna.rna_type # print (dir(rna)) # print (dir(rna_struct)) @@ -217,14 +220,18 @@ def op2epy(target_path): try: val = getattr(rna, rna_prop_identifier) + val_error = False except: - val = '<UNDEFINED>' + val = "'<UNDEFINED>'" + val_error = True kw_type_str= "@type %s: %s%s" % (rna_prop_identifier, rna_prop_type, array_str) kw_param_str= "@param %s: %s" % (rna_prop_identifier, rna_prop.description) kw_param_set = False - if rna_prop_type=='float': + if val_error: + val_str = val + elif rna_prop_type=='float': if length==0: val_str= '%g' % val if '.' not in val_str: |