[Bf-blender-cvs] [860c3dce1b7] master: Outliner: Don't show asset context menu when no IDs are selected

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


Commit: 860c3dce1b7ff201eccf17ef39114be65df45a07
Author: Julian Eisel
Date:   Fri Sep 9 13:44:55 2022 +0200
Branches: master
https://developer.blender.org/rB860c3dce1b7ff201eccf17ef39114be65df45a07

Outliner: Don't show asset context menu when no IDs are selected

The asset 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.

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

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 ec0ad401f5a..4354f4fbf77 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -326,6 +326,15 @@ class OUTLINER_MT_object(Menu):
 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
+
     def draw(self, _context):
         layout = self.layout



More information about the Bf-blender-cvs mailing list