diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-06-17 09:45:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-06-17 09:45:46 +0400 |
commit | 7cbc4c0dd7cf5c69eb74b36cd01c8321ad1a085f (patch) | |
tree | c26ea63790369630896a174700e3f79e38bd490d /release/scripts/modules/rna_prop_ui.py | |
parent | ac089ddd15c0d5400274076dd857f0c22c460a54 (diff) |
IDProperty python module update
- add support for IDProp array slicing, but not resizing.
- rename array attribute type to typecode and use chars 'f', 'd', 'i' which match pythons array module. (was using int's which only have a meaning internally).
- rename function 'convert_to_pyobject' to 'to_dict' and 'to_list' for IDProp group and array types respectively.
- remove 'len' array attribute, calling len(array) is fine.
Diffstat (limited to 'release/scripts/modules/rna_prop_ui.py')
-rw-r--r-- | release/scripts/modules/rna_prop_ui.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index 9311987e2e7..b0fb3b66d0a 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -111,12 +111,16 @@ def draw(layout, context, context_member, property_type, use_edit=True): continue row = layout.row() - convert_to_pyobject = getattr(val, "convert_to_pyobject", None) + to_dict = getattr(val, "to_dict", None) + to_list = getattr(val, "to_list", None) val_orig = val - if convert_to_pyobject: - val_draw = val = val.convert_to_pyobject() - val_draw = str(val_draw) + if to_dict: + val = to_dict() + val_draw = str(val) + elif to_list: + val = to_list() + val_draw = str(val) else: val_draw = val @@ -131,7 +135,7 @@ def draw(layout, context, context_member, property_type, use_edit=True): row.label(text=key) # explicit exception for arrays - if convert_to_pyobject and not hasattr(val_orig, "len"): + if to_dict or to_list: row.label(text=val_draw) else: if key in rna_properties: |