Fix T38778: Properties from bpy.props could be edited as custom props

This commit is contained in:
Campbell Barton 2014-02-25 17:01:46 +11:00
parent 24e1ce25d1
commit bb62f9a582
Notes: blender-bot 2023-02-14 20:10:51 +01:00
Referenced by issue blender/blender-addons#38778, Custom Properties Edit popup clears bpy.types properties if value is set to different type (string / int / float / list)
1 changed files with 8 additions and 3 deletions

View File

@ -140,18 +140,23 @@ def draw(layout, context, context_member, property_type, use_edit=True):
row.label(text=key, translate=False)
# explicit exception for arrays
is_rna = (key in rna_properties)
if to_dict or to_list:
row.label(text=val_draw, translate=False)
else:
if key in rna_properties:
if is_rna:
row.prop(rna_item, key, text="")
else:
row.prop(rna_item, '["%s"]' % escape_identifier(key), text="")
if use_edit:
row = split.row(align=True)
props = row.operator("wm.properties_edit", text="Edit")
assign_props(props, val_draw, key)
if not is_rna:
props = row.operator("wm.properties_edit", text="Edit")
assign_props(props, val_draw, key)
else:
row.label(text="API Defined")
props = row.operator("wm.properties_remove", text="", icon='ZOOMOUT')
assign_props(props, val_draw, key)