Fix error loading external shader styles

Mentioned in logs from #5820
Turned out, `area.spaces` also contain all other spaces this area used (e.g. it used be view3d before it became a nodegraph) leading to errors. Simplifying it with `area.spaces.active`.
This commit is contained in:
Andrej730
2024-12-04 16:58:13 +05:00
parent 00a509aa0b
commit bb441ade3f
+2 -1
View File
@@ -323,7 +323,8 @@ class Blender(bonsai.core.tool.Blender):
for screen in bpy.data.screens: for screen in bpy.data.screens:
for area in screen.areas: for area in screen.areas:
if area.type == "NODE_EDITOR": if area.type == "NODE_EDITOR":
for space in area.spaces: space = area.spaces.active
assert isinstance(space, bpy.types.SpaceNodeEditor)
if space.tree_type == "ShaderNodeTree": if space.tree_type == "ShaderNodeTree":
context_override = {"area": area, "space": space, "screen": screen} context_override = {"area": area, "space": space, "screen": screen}
return context_override return context_override