[Bf-blender-cvs] [27881e99486] blender2.8: Fix Add menu issue when there are no collections to instance

Vuk Gardašević noreply at git.blender.org
Fri Jun 1 15:28:09 CEST 2018


Commit: 27881e9948610c97ce4c844856d97ddc3e545b09
Author: Vuk Gardašević
Date:   Fri Jun 1 15:07:32 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB27881e9948610c97ce4c844856d97ddc3e545b09

Fix Add menu issue when there are no collections to instance

Differential Revision: https://developer.blender.org/D3453

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

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

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

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",



More information about the Bf-blender-cvs mailing list