[Bf-blender-cvs] [b98311f8474] blender2.8: Cleanup: avoid direct access to private class

Campbell Barton noreply at git.blender.org
Thu Apr 26 14:55:51 CEST 2018


Commit: b98311f847434d4d5b7557fdca98dfff398a2d99
Author: Campbell Barton
Date:   Thu Apr 26 14:43:32 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb98311f847434d4d5b7557fdca98dfff398a2d99

Cleanup: avoid direct access to private class

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

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

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index c2c300140de..d680d711d67 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -37,7 +37,7 @@ class ToolSelectPanelHelper:
     - keymap_prefix:
       The text prefix for each key-map for this spaces tools.
     - tools_all():
-      Returns all tools defined.
+      Returns (context_mode, tools) tuple pair for all tools defined.
     - tools_from_context(context):
       Returns tools available in this context.
 
@@ -178,7 +178,7 @@ class ToolSelectPanelHelper:
         if kc is None:
             return
 
-        for context_mode, tools in cls._tools.items():
+        for context_mode, tools in cls.tools_all():
             for item_parent in tools:
                 if item_parent is None:
                     continue
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 8cffc49b68e..227c4ac59ac 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -47,7 +47,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
 
     @classmethod
     def tools_all(cls):
-        return [t for t_list in cls._tools.values() for t in t_list]
+        yield from cls._tools.items()
 
     # Internal Data



More information about the Bf-blender-cvs mailing list