Fix T46048: Custom properties UI redraw issue

Adding/removing custom properties didn't refresh elsewhere in the UI.
This commit is contained in:
Campbell Barton 2015-09-11 04:26:30 +10:00
parent 54daeb185f
commit 0d568e4186
Notes: blender-bot 2023-02-14 08:41:35 +01:00
Referenced by issue #46048, Cutom Properties
2 changed files with 23 additions and 3 deletions

View 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)

View 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)