LibOverride: tweaks to custom props UI.
For now, do not allow to add custom props to overriding IDs (this should be possible in the future, by getting basic correct behavior here is already fairly hard, no reason to complicate things even more). Also, properly disallow editing of existing custom props in overriding IDs.
This commit is contained in:
parent
1c624a1219
commit
7b83ea5c6d
|
@ -231,13 +231,15 @@ def draw(layout, context, context_member, property_type, use_edit=True):
|
|||
|
||||
if rna_item.id_data.library is not None:
|
||||
use_edit = False
|
||||
is_lib_override = rna_item.id_data.override_library and rna_item.id_data.override_library.reference
|
||||
|
||||
assert(isinstance(rna_item, property_type))
|
||||
|
||||
items = rna_item.items()
|
||||
items.sort()
|
||||
|
||||
if use_edit:
|
||||
# TODO: Allow/support adding new custom props to overrides.
|
||||
if use_edit and not is_lib_override:
|
||||
row = layout.row()
|
||||
props = row.operator("wm.properties_add", text="Add")
|
||||
props.data_path = context_member
|
||||
|
@ -303,6 +305,9 @@ def draw(layout, context, context_member, property_type, use_edit=True):
|
|||
|
||||
if use_edit:
|
||||
row = split.row(align=True)
|
||||
# Do not allow editing of overridden properties (we cannot use a poll function of the operators here
|
||||
# since they's have no access to the specific property...).
|
||||
row.enabled = not(is_lib_override and key in rna_item.id_data.override_library.reference)
|
||||
if not is_rna:
|
||||
props = row.operator("wm.properties_edit", text="Edit")
|
||||
assign_props(props, val_draw, key)
|
||||
|
|
Loading…
Reference in New Issue