Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_node.py
| Show First 20 Lines • Show All 427 Lines • ▼ Show 20 Lines | class NODE_MT_node_color_context_menu(Menu): | ||||
| bl_label = "Node Color Specials" | bl_label = "Node Color Specials" | ||||
| def draw(self, _context): | def draw(self, _context): | ||||
| layout = self.layout | layout = self.layout | ||||
| layout.operator("node.node_copy_color", icon='COPY_ID') | layout.operator("node.node_copy_color", icon='COPY_ID') | ||||
| class NODE_MT_context_menu_show_hide_menu(Menu): | |||||
| bl_label = "Show/Hide" | |||||
| def draw(self, context): | |||||
| snode = context.space_data | |||||
| is_compositor = snode.tree_type == 'CompositorNodeTree' | |||||
| layout = self.layout | |||||
| layout.operator("node.mute_toggle", text="Mute") | |||||
| # Node previews are only available in the Compositor. | |||||
| if is_compositor: | |||||
| layout.operator("node.preview_toggle", text="Node Preview") | |||||
| layout.operator("node.options_toggle", text="Node Options") | |||||
| layout.separator() | |||||
| layout.operator("node.hide_socket_toggle", text="Unconnected Sockets") | |||||
| layout.operator("node.hide_toggle", text="Collapse") | |||||
| layout.operator("node.collapse_hide_unused_toggle") | |||||
| class NODE_MT_context_menu_select_menu(Menu): | |||||
| bl_label = "Select" | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| layout.operator("node.select_grouped", text="Select Grouped...").extend = False | |||||
| layout.separator() | |||||
| layout.operator("node.select_linked_from") | |||||
| layout.operator("node.select_linked_to") | |||||
| layout.separator() | |||||
| layout.operator("node.select_same_type_step", text="Activate Same Type Previous").prev = True | |||||
| layout.operator("node.select_same_type_step", text="Activate Same Type Next").prev = False | |||||
| class NODE_MT_context_menu(Menu): | class NODE_MT_context_menu(Menu): | ||||
| bl_label = "Node Context Menu" | bl_label = "Node Context Menu" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | snode = context.space_data | ||||
| is_nested = (len(snode.path) > 1) | |||||
| is_geometrynodes = snode.tree_type == 'GeometryNodeTree' | |||||
| selected_nodes_len = len(context.selected_nodes) | selected_nodes_len = len(context.selected_nodes) | ||||
| active_node = context.active_node | |||||
| layout = self.layout | |||||
| # If nothing is selected | # If no nodes are selected. | ||||
| # (disabled for now until it can be made more useful). | |||||
| ''' | |||||
| if selected_nodes_len == 0: | if selected_nodes_len == 0: | ||||
| layout.operator_context = 'INVOKE_DEFAULT' | layout.operator_context = 'INVOKE_DEFAULT' | ||||
| layout.menu("NODE_MT_add") | layout.menu("NODE_MT_add", icon="ADD") | ||||
| layout.operator("node.clipboard_paste", text="Paste") | layout.operator("node.clipboard_paste", text="Paste", icon="PASTEDOWN") | ||||
| layout.separator() | |||||
| layout.operator("node.find_node", text="Find...", icon="VIEWZOOM") | |||||
| layout.separator() | |||||
| if is_geometrynodes: | |||||
| layout.operator_context = 'INVOKE_DEFAULT' | |||||
| layout.operator("node.select", text="Clear Viewer", icon="HIDE_ON").clear_viewer = True | |||||
| layout.operator("node.links_cut") | |||||
| layout.operator("node.links_mute") | |||||
| if is_nested: | |||||
| layout.separator() | |||||
| layout.operator("node.tree_path_parent", text="Exit Group", icon='FILE_PARENT') | |||||
| return | return | ||||
| ''' | |||||
| # If something is selected | if is_geometrynodes: | ||||
| layout.operator_context = 'INVOKE_DEFAULT' | layout.operator_context = 'INVOKE_DEFAULT' | ||||
| layout.operator("node.duplicate_move") | layout.operator("node.link_viewer", text="Link to Viewer", icon="HIDE_OFF") | ||||
| props = layout.operator("wm.call_panel", text="Rename...") | |||||
| props.name = "TOPBAR_PT_name" | |||||
| props.keep_open = False | |||||
| layout.operator("node.delete") | |||||
| layout.operator("node.clipboard_copy", text="Copy") | |||||
| layout.operator("node.clipboard_paste", text="Paste") | |||||
| layout.operator_context = 'EXEC_REGION_WIN' | |||||
| layout.operator("node.delete_reconnect") | layout.separator() | ||||
| layout.operator("node.clipboard_copy", text="Copy", icon="COPYDOWN") | |||||
| layout.operator("node.clipboard_paste", text="Paste", icon="PASTEDOWN") | |||||
| layout.operator_context = 'INVOKE_DEFAULT' | |||||
| layout.operator("node.duplicate_move", icon="DUPLICATE") | |||||
| layout.separator() | |||||
| layout.operator("node.delete", icon="X") | |||||
| layout.operator_context = 'EXEC_REGION_WIN' | |||||
| layout.operator("node.delete_reconnect", text="Dissolve") | |||||
| if selected_nodes_len > 1: | if selected_nodes_len > 1: | ||||
| layout.separator() | layout.separator() | ||||
| layout.operator("node.link_make").replace = False | layout.operator("node.link_make").replace = False | ||||
| layout.operator("node.link_make", text="Make and Replace Links").replace = True | layout.operator("node.link_make", text="Make and Replace Links").replace = True | ||||
| layout.operator("node.links_detach") | layout.operator("node.links_detach") | ||||
| layout.separator() | layout.separator() | ||||
| layout.operator("node.group_make", text="Group") | layout.operator("node.group_make", text="Make Group", icon="NODETREE") | ||||
| layout.operator("node.group_insert", text="Insert Into Group") | |||||
| if active_node and active_node.type == 'GROUP': | |||||
| layout.operator("node.group_edit", text="Edit").exit = False | |||||
| layout.operator("node.group_ungroup", text="Ungroup") | layout.operator("node.group_ungroup", text="Ungroup") | ||||
| layout.operator("node.group_edit").exit = False | |||||
| if is_nested: | |||||
| layout.operator("node.tree_path_parent", text="Exit Group", icon='FILE_PARENT') | |||||
| layout.separator() | layout.separator() | ||||
| layout.operator("node.hide_toggle") | layout.operator("node.join", text="Join in New Frame") | ||||
| layout.operator("node.mute_toggle") | layout.operator("node.detach", text="Remove from Frame") | ||||
| layout.operator("node.preview_toggle") | |||||
| layout.operator("node.hide_socket_toggle") | layout.separator() | ||||
| layout.operator("node.options_toggle") | |||||
| layout.operator("node.collapse_hide_unused_toggle") | props = layout.operator("wm.call_panel", text="Rename...") | ||||
| props.name = "TOPBAR_PT_name" | |||||
| props.keep_open = False | |||||
| layout.separator() | |||||
| layout.menu("NODE_MT_context_menu_select_menu") | |||||
| layout.menu("NODE_MT_context_menu_show_hide_menu") | |||||
| class NODE_PT_active_node_generic(Panel): | class NODE_PT_active_node_generic(Panel): | ||||
| bl_space_type = 'NODE_EDITOR' | bl_space_type = 'NODE_EDITOR' | ||||
| bl_region_type = 'UI' | bl_region_type = 'UI' | ||||
| bl_category = "Node" | bl_category = "Node" | ||||
| bl_label = "Node" | bl_label = "Node" | ||||
| ▲ Show 20 Lines • Show All 386 Lines • ▼ Show 20 Lines | |||||
| classes = ( | classes = ( | ||||
| NODE_HT_header, | NODE_HT_header, | ||||
| NODE_MT_editor_menus, | NODE_MT_editor_menus, | ||||
| NODE_MT_add, | NODE_MT_add, | ||||
| NODE_MT_view, | NODE_MT_view, | ||||
| NODE_MT_select, | NODE_MT_select, | ||||
| NODE_MT_node, | NODE_MT_node, | ||||
| NODE_MT_node_color_context_menu, | NODE_MT_node_color_context_menu, | ||||
| NODE_MT_context_menu_show_hide_menu, | |||||
| NODE_MT_context_menu_select_menu, | |||||
| NODE_MT_context_menu, | NODE_MT_context_menu, | ||||
| NODE_MT_view_pie, | NODE_MT_view_pie, | ||||
| NODE_PT_material_slots, | NODE_PT_material_slots, | ||||
| NODE_PT_node_color_presets, | NODE_PT_node_color_presets, | ||||
| NODE_PT_active_node_generic, | NODE_PT_active_node_generic, | ||||
| NODE_PT_active_node_color, | NODE_PT_active_node_color, | ||||
| NODE_PT_active_node_properties, | NODE_PT_active_node_properties, | ||||
| NODE_PT_texture_mapping, | NODE_PT_texture_mapping, | ||||
| Show All 21 Lines | |||||