diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-16 19:59:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-16 20:04:29 +0300 |
commit | f6601e2deb9e4a26708c6114024acd391f274788 (patch) | |
tree | c947fdc6d43b4b73471beec0f80dd9b3933dc732 /release | |
parent | 9abb4b555a38abcd81c3fc7d109dbcffb364d318 (diff) |
Tool System: pass space type when setting tool
Internal change only, needed because object mode is now in top-bar.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 2 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_common.py | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index f48cf69d1c9..a9d766b29e2 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -2338,7 +2338,7 @@ class WM_OT_tool_set_by_name(Operator): def execute(self, context): from bl_ui.space_toolsystem_common import activate_by_name - if activate_by_name(context, self.name): + if activate_by_name(context, context.space_data.type, self.name): return {'FINISHED'} else: self.report({'WARNING'}, f"Tool {self.name!r} not found.") diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index ed683bcc312..b58bff7cf32 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -253,11 +253,11 @@ class ToolSelectPanelHelper: return None, 0 @staticmethod - def _tool_get_by_name(context, text): + def _tool_get_by_name(context, space_type, text): """ Return the active Python tool definition and index (if in sub-group, else -1). """ - cls = ToolSelectPanelHelper._tool_class_from_space_type(context.space_data.type) + cls = ToolSelectPanelHelper._tool_class_from_space_type(space_type) if cls is not None: context_mode = context.mode for item, index in ToolSelectPanelHelper._tools_flatten_with_tool_index(cls.tools_from_context(context)): @@ -556,15 +556,15 @@ class WM_MT_toolsystem_submenu(Menu): continue tool_def, icon_name = ToolSelectPanelHelper._tool_vars_from_def(item, context_mode) icon_value = ToolSelectPanelHelper._icon_value_from_icon_handle(icon_name) - props = layout.operator( + layout.operator( "wm.tool_set_by_name", text=item.text, icon_value=icon_value, ).name = item.text -def activate_by_name(context, text): - item, index = ToolSelectPanelHelper._tool_get_by_name(context, text) +def activate_by_name(context, space_type, text): + item, index = ToolSelectPanelHelper._tool_get_by_name(context, space_type, text) if item is not None: context_mode = context.mode tool_def, icon_name = ToolSelectPanelHelper._tool_vars_from_def(item, context_mode) |