diff options
author | Hans Goudey <h.goudey@me.com> | 2021-08-31 06:21:11 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-08-31 06:21:11 +0300 |
commit | 29590eec6e21a4e1a2d45221e6dbb5733c354969 (patch) | |
tree | 0ad9cb86f5a2c51cb2b7492ee7358dffdbf273dd /release | |
parent | c758b87c5e1dbad174779d69340ad1983a94198c (diff) |
Fix T91054: List of strings custom property cannot be edited
This commit fixes editing the value of a list of strings custom property
with the "Custom Property Edit" operator. This sort of custom property
isn't very well supported in general, but editing the values should
work properly anyway.
Differential Revision: https://developer.blender.org/D12348
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 989c067efec..f975176a1e2 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1429,10 +1429,8 @@ class WM_OT_properties_edit(Operator): prop_type_new = type(prop_value) prop_type, is_array = rna_idprop_value_item_type(prop_value) - ui_data = item.id_properties_ui(prop) - ui_data.update(subtype=self.subtype, description=self.description) - if prop_type == int: + ui_data = item.id_properties_ui(prop) if type(default_eval) == str: self.report({'WARNING'}, "Could not evaluate number from default value") default_eval = None @@ -1444,8 +1442,11 @@ class WM_OT_properties_edit(Operator): soft_min=int(round(self.soft_min)), soft_max=int(round(self.soft_max)), default=default_eval, + subtype=self.subtype, + description=self.description ) elif prop_type == float: + ui_data = item.id_properties_ui(prop) if type(default_eval) == str: self.report({'WARNING'}, "Could not evaluate number from default value") default_eval = None @@ -1455,9 +1456,16 @@ class WM_OT_properties_edit(Operator): soft_min=self.soft_min, soft_max=self.soft_max, default=default_eval, + subtype=self.subtype, + description=self.description + ) + elif prop_type == str and not is_array: # String arrays do not support UI data. + ui_data = item.id_properties_ui(prop) + ui_data.update( + default=self.default, + subtype=self.subtype, + description=self.description ) - elif prop_type == str: - ui_data.update(default=self.default) # If we have changed the type of the property, update its potential anim curves! if prop_type_old != prop_type_new: @@ -1531,10 +1539,10 @@ class WM_OT_properties_edit(Operator): self.default = "" # setup defaults - ui_data = item.id_properties_ui(prop) - rna_data = ui_data.as_dict() - self.subtype = rna_data["subtype"] if prop_type in {int, float}: + ui_data = item.id_properties_ui(prop) + rna_data = ui_data.as_dict() + self.subtype = rna_data["subtype"] self.min = rna_data["min"] self.max = rna_data["max"] self.soft_min = rna_data["soft_min"] @@ -1543,7 +1551,11 @@ class WM_OT_properties_edit(Operator): self.min != self.soft_min or self.max != self.soft_max ) - if prop_type in {int, float, str}: + self.default = str(rna_data["default"]) + if prop_type == str and not is_array: # String arrays do not support UI data. + ui_data = item.id_properties_ui(prop) + rna_data = ui_data.as_dict() + self.subtype = rna_data["subtype"] self.default = str(rna_data["default"]) self._init_subtype(prop_type, is_array, self.subtype) |