[Bf-blender-cvs] [0d568e4] master: Fix T46048: Custom properties UI redraw issue

Campbell Barton noreply at git.blender.org
Thu Sep 10 20:35:45 CEST 2015


Commit: 0d568e4186f2d2791d87539c11d10d4aa5d9e246
Author: Campbell Barton
Date:   Fri Sep 11 04:26:30 2015 +1000
Branches: master
https://developer.blender.org/rB0d568e4186f2d2791d87539c11d10d4aa5d9e246

Fix T46048: Custom properties UI redraw issue

Adding/removing custom properties didn't refresh elsewhere in the UI.

===================================================================

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

===================================================================

diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 44722fa..195b576 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 edf60aa..c228e33 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)




More information about the Bf-blender-cvs mailing list