Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-11-08 16:25:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-11-08 16:25:46 +0300
commitc55d0ebea541ff8c265306af052b0cd738d6a16a (patch)
tree077fb7bd95bfd51c8f023f080f4799627067708f /release/scripts/startup/bl_ui/space_toolsystem_common.py
parentd6e22109353cf9920284f3f84dee9b8cfd125669 (diff)
parentcd8350764b881fbf75b1a0d0ee0f46cd798d17ae (diff)
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'release/scripts/startup/bl_ui/space_toolsystem_common.py')
-rw-r--r--release/scripts/startup/bl_ui/space_toolsystem_common.py34
1 files changed, 31 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index 55e124912a1..c66690030d2 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -202,13 +202,41 @@ class ToolSelectPanelHelper:
- keymap_prefix:
The text prefix for each key-map for this spaces tools.
- tools_all():
- Returns (context_mode, tools) tuple pair for all tools defined.
+ Generator (context_mode, tools) tuple pairs for all tools defined.
- tools_from_context(context, mode=None):
- Returns tools available in this context.
+ A generator for all tools available in the current context.
- Each tool is a 'ToolDef' or None for a separator in the toolbar, use ``None``.
+ Tool Sequence Structure
+ =======================
+
+ Sequences of tools as returned by tools_all() and tools_from_context() are comprised of:
+
+ - A `ToolDef` instance (representing a tool that can be activated).
+ - None (a visual separator in the tool list).
+ - A tuple of `ToolDef` or None values
+ (representing a group of tools that can be selected between using a click-drag action).
+ Note that only a single level of nesting is supported (groups cannot contain sub-groups).
+ - A callable which takes a single context argument and returns a tuple of values described above.
+ When the context is None, all potential tools must be returned.
"""
+ @classmethod
+ def tools_all(cls):
+ """
+ Return all tools for this toolbar, this must include all available tools ignoring the current context.
+ The value is must be a sequence of (mode, tool_list) pairs, where mode may be object-mode edit-mode etc.
+ The mode may be None for tool-bars that don't make use of sub-modes.
+ """
+ raise Exception("Sub-class %r must implement this method!" % cls)
+
+ @classmethod
+ def tools_from_context(cls, context, mode=None):
+ """
+ Return all tools for the current context,
+ this result is used at run-time and may filter out tools to display.
+ """
+ raise Exception("Sub-class %r must implement this method!" % cls)
+
@staticmethod
def _tool_class_from_space_type(space_type):
return next(