[Bf-blender-cvs] [e254d8867d6] master: Outliner: Hide library overrdies context menu when no IDs are selected

Julian Eisel noreply at git.blender.org
Fri Sep 9 14:05:08 CEST 2022


Commit: e254d8867d666846fa8455ac8415763127eb48b6
Author: Julian Eisel
Date:   Fri Sep 9 13:52:51 2022 +0200
Branches: master
https://developer.blender.org/rBe254d8867d666846fa8455ac8415763127eb48b6

Outliner: Hide library overrdies context menu when no IDs are selected

The library overrides context menu operators only make sense when at
least one ID is selected in the Outliner. So don't show them unless
that's the case. This also means the menu items don't show up anymore
for things like RNA properties, or the overridden properties in the
Library Overrides Properties view.

Also see 7eda9d8dda59 and the previous commit.

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

M	release/scripts/startup/bl_ui/space_outliner.py

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

diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index 4354f4fbf77..5c488748db8 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -323,17 +323,20 @@ class OUTLINER_MT_object(Menu):
         OUTLINER_MT_context_menu.draw_common_operators(layout)
 
 
+def has_selected_ids_in_context(context):
+    if hasattr(context, "id"):
+        return True
+    if len(context.selected_ids) > 0:
+        return True
+
+    return False
+
 class OUTLINER_MT_asset(Menu):
     bl_label = "Assets"
 
     @classmethod
     def poll(cls, context):
-        if hasattr(context, "id"):
-            return True
-        if len(context.selected_ids) > 0:
-            return True
-
-        return False
+        return has_selected_ids_in_context(context)
 
     def draw(self, _context):
         layout = self.layout
@@ -346,6 +349,10 @@ class OUTLINER_MT_asset(Menu):
 class OUTLINER_MT_liboverride(Menu):
     bl_label = "Library Override"
 
+    @classmethod
+    def poll(cls, context):
+        return has_selected_ids_in_context(context)
+
     def draw(self, _context):
         layout = self.layout



More information about the Bf-blender-cvs mailing list