diff options
Diffstat (limited to 'release/scripts/startup/bl_ui')
-rw-r--r-- | release/scripts/startup/bl_ui/space_node.py | 13 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_common.py | 6 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_toolbar.py | 97 |
3 files changed, 103 insertions, 13 deletions
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 789fc1b0a31..6ec264ff699 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -553,18 +553,6 @@ class NODE_PT_grease_pencil_tools(GreasePencilToolsPanel, Panel): # toolbar, but which may not necessarily be open -# Tool Shelf ------------------ - - -# Grease Pencil drawing tools -class NODE_PT_tools_grease_pencil_draw(AnnotationDrawingToolsPanel, Panel): - bl_space_type = 'NODE_EDITOR' - bl_region_type = 'TOOLS' - - -# ----------------------------- - - def node_draw_tree_view(layout, context): pass @@ -587,7 +575,6 @@ classes = ( NODE_UL_interface_sockets, NODE_PT_grease_pencil, NODE_PT_grease_pencil_tools, - NODE_PT_tools_grease_pencil_draw, ) diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index 2ff5c9692ec..9349f776c99 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -293,6 +293,12 @@ class ToolSelectPanelHelper: if tool is not None: tool.refresh_from_context() return tool + elif space_type == 'NODE_EDITOR': + space_data = context.space_data + tool = context.workspace.tools.from_space_node(create=create) + if tool is not None: + tool.refresh_from_context() + return tool return None @staticmethod diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 1f2b4ca47ee..cefc900b8b3 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -1164,6 +1164,49 @@ class _defs_gpencil_weight: ) +class _defs_node_select: + + @ToolDef.from_fn + def select(): + def draw_settings(context, layout, tool): + pass + return dict( + text="Select", + icon="ops.generic.select", + widget=None, + keymap="Node Tool: Select", + draw_settings=draw_settings, + ) + + @ToolDef.from_fn + def box(): + def draw_settings(context, layout, tool): + props = tool.operator_properties("node.select_box") + layout.prop(props, "deselect") + pass + return dict( + text="Select Box", + icon="ops.generic.select_box", + widget=None, + keymap="Node Tool: Select Box", + draw_settings=draw_settings, + ) + + @ToolDef.from_fn + def lasso(): + def draw_settings(context, layout, tool): + props = tool.operator_properties("node.select_lasso") + layout.prop(props, "deselect") + pass + return dict( + text="Select Lasso", + icon="ops.generic.select_lasso", + widget=None, + keymap="Node Tool: Select Lasso", + draw_settings=draw_settings, + ) + + class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'TOOLS' @@ -1243,6 +1286,59 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel): } +class NODE_PT_tools_active(ToolSelectPanelHelper, Panel): + bl_space_type = 'NODE_EDITOR' + bl_region_type = 'TOOLS' + bl_label = "Tools" # not visible + bl_options = {'HIDE_HEADER'} + + # Satisfy the 'ToolSelectPanelHelper' API. + keymap_prefix = "Node Editor Tool:" + + @classmethod + def tools_from_context(cls, context, mode=None): + if mode is None: + if context.space_data is None: + mode = None + else: + mode = context.space_data.tree_type + for tools in (cls._tools[None], cls._tools.get(mode, ())): + for item in tools: + if not (type(item) is ToolDef) and callable(item): + yield from item(context) + else: + yield item + + @classmethod + def tools_all(cls): + yield from cls._tools.items() + + _tools_select = ( + ( + _defs_node_select.select, + _defs_node_select.box, + _defs_node_select.lasso, + ), + ) + + _tools_annotate = ( + ( + _defs_annotate.scribble, + _defs_annotate.line, + _defs_annotate.poly, + _defs_annotate.eraser, + ), + ) + + _tools = { + None: [ + *_tools_select, + None, + *_tools_annotate, + ], + } + + class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'TOOLS' @@ -1507,6 +1603,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): classes = ( IMAGE_PT_tools_active, + NODE_PT_tools_active, VIEW3D_PT_tools_active, ) |