diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-09-10 21:26:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-09-10 21:29:31 +0300 |
commit | 0d568e4186f2d2791d87539c11d10d4aa5d9e246 (patch) | |
tree | 35750016482b775c8584becf81f1dad19a4544cf | |
parent | 54daeb185ff914c38728721eea41ac96f9813d0f (diff) |
Fix T46048: Custom properties UI redraw issue
Adding/removing custom properties didn't refresh elsewhere in the UI.
-rw-r--r-- | release/scripts/modules/rna_prop_ui.py | 5 | ||||
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 21 |
2 files changed, 23 insertions, 3 deletions
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index 44722fa7162..195b5767189 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -39,6 +39,11 @@ def rna_idprop_ui_del(item): pass +def rna_idprop_ui_prop_update(item, prop): + prop_rna = item.path_resolve("[\"%s\"]" % prop.replace("\"", "\\\""), False) + prop_rna.update() + + def rna_idprop_ui_prop_get(item, prop, create=True): rna_ui = rna_idprop_ui_get(item, create) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index edf60aa40e7..c228e33965f 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1132,7 +1132,11 @@ class WM_OT_properties_edit(Operator): ) def execute(self, context): - from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear + from rna_prop_ui import ( + rna_idprop_ui_prop_get, + rna_idprop_ui_prop_clear, + rna_idprop_ui_prop_update, + ) data_path = self.data_path value = self.value @@ -1164,6 +1168,9 @@ class WM_OT_properties_edit(Operator): exec_str = "item[%r] = %s" % (prop, repr(value_eval)) # print(exec_str) exec(exec_str) + + rna_idprop_ui_prop_update(item, prop) + self._last_prop[:] = [prop] prop_type = type(item[prop]) @@ -1245,7 +1252,10 @@ class WM_OT_properties_add(Operator): data_path = rna_path def execute(self, context): - from rna_prop_ui import rna_idprop_ui_prop_get + from rna_prop_ui import ( + rna_idprop_ui_prop_get, + rna_idprop_ui_prop_update, + ) data_path = self.data_path item = eval("context.%s" % data_path) @@ -1263,6 +1273,7 @@ class WM_OT_properties_add(Operator): prop = unique_name(item.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) @@ -1298,10 +1309,14 @@ class WM_OT_properties_remove(Operator): property = rna_property def execute(self, context): - from rna_prop_ui import rna_idprop_ui_prop_clear + from rna_prop_ui import ( + rna_idprop_ui_prop_clear, + rna_idprop_ui_prop_update, + ) data_path = self.data_path item = eval("context.%s" % data_path) prop = self.property + rna_idprop_ui_prop_update(item, prop) del item[prop] rna_idprop_ui_prop_clear(item, prop) |