[Bf-blender-cvs] [6f544f635b7] blender2.8: UI: fix toolbar groups w/ data_blocks

Campbell Barton noreply at git.blender.org
Sun Apr 29 16:38:42 CEST 2018


Commit: 6f544f635b7f3e8083350a9121132b385983124e
Author: Campbell Barton
Date:   Sun Apr 29 16:24:40 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB6f544f635b7f3e8083350a9121132b385983124e

UI: fix toolbar groups w/ data_blocks

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

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

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index d5d921a64bc..02722614a30 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -183,9 +183,11 @@ class ToolSelectPanelHelper:
     def _tool_vars_from_active_with_index(context):
         workspace = context.workspace
         return (
-            (workspace.tool_keymap or None,
-             workspace.tool_manipulator_group or None,
-             workspace.tool_data_block or None),
+            (
+                workspace.tool_keymap or None,
+                workspace.tool_manipulator_group or None,
+                workspace.tool_data_block or None,
+            ),
             workspace.tool_index,
         )
 
@@ -193,7 +195,11 @@ class ToolSelectPanelHelper:
     def _tool_vars_from_button_with_index(context):
         props = context.button_operator
         return (
-            (props.keymap or None or None, props.manipulator_group or None),
+            (
+                props.keymap or None or None,
+                props.manipulator_group or None,
+                props.data_block,
+            ),
             props.index,
         )
 
@@ -477,16 +483,15 @@ class WM_MT_toolsystem_submenu(Menu):
         )
         if cls is not None:
             tool_def_button, index_button = cls._tool_vars_from_button_with_index(context)
-
-            for item_items in cls.tools_from_context(context):
-                for item_group in item_items:
-                    if type(item_group) is tuple:
-                        if index_button < len(item_group):
-                            item = item_group[index_button]
-                            tool_def, icon_name = cls._tool_vars_from_def(item, context_mode)
-                            is_active = (tool_def == tool_def_button)
-                            if is_active:
-                                return cls, item_group, index_button
+            for item_group in cls.tools_from_context(context):
+                if type(item_group) is tuple:
+                    if index_button < len(item_group):
+                        item = item_group[index_button]
+                        tool_def, icon_name = cls._tool_vars_from_def(item, context_mode)
+                        is_active = (tool_def == tool_def_button)
+                        print(tool_def, tool_def_button)
+                        if is_active:
+                            return cls, item_group, index_button
         return None, None, -1
 
     def draw(self, context):



More information about the Bf-blender-cvs mailing list