Fix T46048: Custom properties UI redraw issue
authorCampbell Barton <ideasman42@gmail.com>
Thu, 10 Sep 2015 18:26:30 +0000 (04:26 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 10 Sep 2015 18:29:31 +0000 (04:29 +1000)
Adding/removing custom properties didn't refresh elsewhere in the UI.

release/scripts/modules/rna_prop_ui.py
release/scripts/startup/bl_operators/wm.py

index 44722fa7162fec95ff40328ab97fc4540aed8bda..195b5767189dd6cd33721a32f2ca6e486da38694 100644 (file)
@@ -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)
index edf60aa40e7d927cfb2d0715429736aaf4fd1520..c228e33965f447958550c5099026b03350a3bd61 100644 (file)
@@ -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)