[Bf-blender-cvs] [3e2edb160f3] blender2.8: UI: update tool docstring

Campbell Barton noreply at git.blender.org
Thu Apr 26 08:09:17 CEST 2018


Commit: 3e2edb160f32737038f99c9d2962161633b93f05
Author: Campbell Barton
Date:   Thu Apr 26 07:39:15 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB3e2edb160f32737038f99c9d2962161633b93f05

UI: update tool docstring

Also assert on invalid tool definitions.

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

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 4b0577729bd..b7f50eb1d77 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -41,13 +41,15 @@ class ToolSelectPanelHelper:
     - tools_from_context(context):
       Returns tools available in this context.
 
-    Each tool is a triplet:
-      ``(tool_name, manipulator_group_idname, keymap_actions)``
+    Each tool is a dict:
+      ``(text=tool_name, icon=icon_name, widget=manipulator_group_idname, keymap=keymap_actions)``
     For a separator in the toolbar, use ``None``.
 
       Where:
       ``tool_name``
         is the name to display in the interface.
+      ``icon_name``
+        is the name of the icon to use (found in ``release/datafiles/icons``).
       ``manipulator_group_idname``
         is an optional manipulator group to activate when the tool is set.
       ``keymap_actions``
@@ -96,6 +98,9 @@ class ToolSelectPanelHelper:
 
     @classmethod
     def _tool_vars_from_def(cls, item):
+        # For now be strict about whats in this dict
+        # prevent accidental adding unknown keys.
+        assert(len(item) == 4)
         text = item["text"]
         icon_name = item["icon"]
         mp_idname = item["widget"]



More information about the Bf-blender-cvs mailing list