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 7eda9d8dda.
This commit is contained in:
Julian Eisel 2022-09-09 13:44:55 +02:00
parent 04ae0fe46b
commit 860c3dce1b
1 changed files with 9 additions and 0 deletions

View File

@ -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