Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_toolsystem_common.py
| Show First 20 Lines • Show All 329 Lines • ▼ Show 20 Lines | def _tool_get_by_index(context, space_type, tool_index): | ||||
| else: | else: | ||||
| index = -1 | index = -1 | ||||
| return (cls, item, index) | return (cls, item, index) | ||||
| i += 1 | i += 1 | ||||
| return None, None, -1 | return None, None, -1 | ||||
| @staticmethod | @staticmethod | ||||
| def _tool_active_from_context(context, space_type, mode=None, create=False): | def _tool_active_from_context(context, space_type, mode=None, create=False): | ||||
| if space_type == 'VIEW_3D': | if space_type in ('VIEW_3D', 'PROPERTIES'): | ||||
| if mode is None: | if mode is None: | ||||
| mode = context.mode | mode = context.mode | ||||
| tool = context.workspace.tools.from_space_view3d_mode(mode, create=create) | tool = context.workspace.tools.from_space_view3d_mode(mode, create=create) | ||||
| if tool is not None: | if tool is not None: | ||||
| tool.refresh_from_context() | tool.refresh_from_context() | ||||
| return tool | return tool | ||||
| elif space_type == 'IMAGE_EDITOR': | elif space_type == 'IMAGE_EDITOR': | ||||
| space_data = context.space_data | space_data = context.space_data | ||||
| ▲ Show 20 Lines • Show All 505 Lines • Show Last 20 Lines | |||||