diff options
author | Vuk Gardašević <lijenstina> | 2018-06-01 16:07:32 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-01 16:27:18 +0300 |
commit | 27881e9948610c97ce4c844856d97ddc3e545b09 (patch) | |
tree | a090e5b76923a775dfa2b49d258479f1d90e487e | |
parent | 13ca63d2adad0da7b73ed3e38da53363e1de3428 (diff) |
Fix Add menu issue when there are no collections to instance
Differential Revision: https://developer.blender.org/D3453
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 542e003c4a9..b93e24da87a 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1328,15 +1328,19 @@ class INFO_MT_add(Menu): layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_FORCE_FIELD') layout.separator() - if len(bpy.data.collections) > 10: - layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator( + has_collections = bool(bpy.data.collections) + col = layout.column() + col.enabled = has_collections + + if not has_collections or len(bpy.data.collections) > 10: + col.operator_context = 'INVOKE_REGION_WIN' + col.operator( "object.collection_instance_add", - text="Collection Instance...", + text="Collection Instance..." if has_collections else "No Collections to Instance", icon='OUTLINER_OB_GROUP_INSTANCE', ) else: - layout.operator_menu_enum( + col.operator_menu_enum( "object.collection_instance_add", "collection", text="Collection Instance", |