[Bf-blender-cvs] [7b83ea5c6d1] master: LibOverride: tweaks to custom props UI.

Bastien Montagne noreply at git.blender.org
Wed Sep 25 14:28:17 CEST 2019


Commit: 7b83ea5c6d1e9b24d2b3f65a69504e16a1a42d67
Author: Bastien Montagne
Date:   Tue Sep 24 17:31:21 2019 +0200
Branches: master
https://developer.blender.org/rB7b83ea5c6d1e9b24d2b3f65a69504e16a1a42d67

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.

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

M	release/scripts/modules/rna_prop_ui.py

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

diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 2ff6c3fc1b0..202fd865723 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -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)



More information about the Bf-blender-cvs mailing list