Fix more image editor Python errors after switching workspaces.

This commit is contained in:
Brecht Van Lommel
2018-08-17 13:09:59 +02:00
parent ba60e5d41b
commit fa70826167
2 changed files with 6 additions and 3 deletions

View File

@@ -280,7 +280,10 @@ class ToolSelectPanelHelper:
elif space_type == 'IMAGE_EDITOR':
space_data = context.space_data
if mode is None:
mode = space_data.mode
if space_data is None:
mode = 'VIEW'
else:
mode = space_data.mode
tool = context.workspace.tools.from_space_image_mode(mode, create)
if tool is not None:
tool.refresh_from_context()

View File

@@ -1395,9 +1395,9 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
def tools_from_context(cls, context, mode=None):
if mode is None:
if context.space_data is None:
mode = context.space_data.mode
else:
mode = 'VIEW'
else:
mode = context.space_data.mode
for tools in (cls._tools[None], cls._tools.get(mode, ())):
for item in tools:
if not (type(item) is ToolDef) and callable(item):