diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/space_toolsystem_common.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_common.py | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index 09826c6f887..7b0a769ae62 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -218,49 +218,27 @@ class ToolSelectPanelHelper: @staticmethod def _tools_flatten(tools): - """ - Flattens, skips None and calls generators. - """ for item in tools: - if item is None: - yield None - elif type(item) is tuple: - for sub_item in item: - if sub_item is None: - yield None - elif _item_is_fn(sub_item): - yield from sub_item(context) - else: - yield sub_item + if type(item) is tuple: + yield from item else: - if _item_is_fn(item): - yield from item(context) - else: - yield item + # May be None. + yield item @staticmethod def _tools_flatten_with_tool_index(tools): for item in tools: - if item is None: - yield None, -1 - elif type(item) is tuple: + if type(item) is tuple: i = 0 for sub_item in item: if sub_item is None: yield None, -1 - elif _item_is_fn(sub_item): - for item_dyn in sub_item(context): - yield item_dyn, i - i += 1 else: yield sub_item, i i += 1 else: - if _item_is_fn(item): - for item_dyn in item(context): - yield item_dyn, -1 - else: - yield item, -1 + # May be None. + yield item, -1 @classmethod def _tool_get_active(cls, context, space_type, mode, with_icon=False): |