Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Reynish <billreynish>2018-12-17 23:54:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-12-18 00:12:11 +0300
commit7312e48ae43e32f4d7c95a6d170861abbf03190d (patch)
tree5d21101b90f0d72d10fe055e41a29b43d0cc83f9 /release/scripts/startup/bl_ui/space_node.py
parent54f9e142dfd38948b670acba9bf2e8571ab88d4a (diff)
UI: Extend context menu to check current selection
- This extends context menus, checking the selection in some cases to conditionally show operators. - When nothing is selected, add, paste .. etc are added to the menu. - Use columns when mixed mesh modes are used (vert/edge/face). - Move armature naming operators into sub-menu. See D4043
Diffstat (limited to 'release/scripts/startup/bl_ui/space_node.py')
-rw-r--r--release/scripts/startup/bl_ui/space_node.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 750c01d28e5..c5718df3b92 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -331,22 +331,35 @@ class NODE_MT_specials(Menu):
def draw(self, context):
layout = self.layout
+ # If nothing is selected
+ selected_nodes_len = len(context.selected_nodes)
+ if selected_nodes_len == 0:
+ layout.operator_context = 'INVOKE_DEFAULT'
+ layout.menu("NODE_MT_add")
+ layout.operator("node.clipboard_paste", text="Paste")
+ return
+
+ # If something is selected
layout.operator_context = 'INVOKE_DEFAULT'
layout.operator("node.duplicate_move")
layout.operator("node.delete")
+ layout.operator("node.clipboard_copy", text="Copy")
+ layout.operator("node.clipboard_paste", text="Paste")
layout.operator_context = 'EXEC_DEFAULT'
layout.operator("node.delete_reconnect")
- layout.separator()
+ if selected_nodes_len > 1:
+ layout.separator()
- layout.operator("node.link_make").replace = False
- layout.operator("node.link_make", text="Make and Replace Links").replace = True
- layout.operator("node.links_detach")
+ layout.operator("node.link_make").replace = False
+ layout.operator("node.link_make", text="Make and Replace Links").replace = True
+ layout.operator("node.links_detach")
- layout.separator()
+ layout.separator()
+
+ layout.operator("node.group_make", text="Group")
- layout.operator("node.group_make", text="Group")
layout.operator("node.group_ungroup", text="Ungroup")
layout.operator("node.group_edit").exit = False