diff options
author | Julian Eisel <julian@blender.org> | 2022-09-09 14:44:55 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-09-09 15:04:27 +0300 |
commit | 860c3dce1b7ff201eccf17ef39114be65df45a07 (patch) | |
tree | a43c2c700f176d54069d7cbd20dafe0149003351 /release/scripts/startup | |
parent | 04ae0fe46ba1f08ef141a051187bea3763afda8d (diff) |
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.
Diffstat (limited to 'release/scripts/startup')
-rw-r--r-- | release/scripts/startup/bl_ui/space_outliner.py | 9 |
1 files changed, 9 insertions, 0 deletions
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 |