diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-03-30 12:53:39 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-04-16 16:49:00 +0300 |
commit | 40dd91561d462999eae4636d6e6ec0b76788eed4 (patch) | |
tree | ef27630a84d8647cf8b08cd6d90948ad8c01a12c /release/scripts/startup/bl_operators/wm.py | |
parent | d5a76451c016530dbb0aadcbb4053b8933066d50 (diff) |
Python: add a utility function for creating custom properties.
Creating a fully functional custom property requires also setting up
its limits, description, default value and static override status.
It is complex enough to warrant providing an official utility.
Currently boolean properties are technically int, but the utility
pretends they are separate in case that eventually they are.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D4620
Diffstat (limited to 'release/scripts/startup/bl_operators/wm.py')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index de811d42e00..e22f50dedbd 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1322,8 +1322,7 @@ class WM_OT_properties_add(Operator): def execute(self, context): from rna_prop_ui import ( - rna_idprop_ui_prop_get, - rna_idprop_ui_prop_update, + rna_idprop_ui_create, ) data_path = self.data_path @@ -1344,13 +1343,7 @@ class WM_OT_properties_add(Operator): *type(item).bl_rna.properties.keys(), }) - item[prop] = 1.0 - rna_idprop_ui_prop_update(item, prop) - - # not essential, but without this we get [#31661] - prop_ui = rna_idprop_ui_prop_get(item, prop) - prop_ui["soft_min"] = prop_ui["min"] = 0.0 - prop_ui["soft_max"] = prop_ui["max"] = 1.0 + rna_idprop_ui_create(item, prop, 1.0) return {'FINISHED'} |