Fix more image editor Python errors after switching workspaces.
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user