Fix: nodewrangler error accessing space.node_tree when not available

Revert part of rBAad1966474ed2 in nw_check() which was giving no benefit
afaict (and instead tried to access space.node_tree for Spaces other
than the Node Editor, spamming the console with errors).

Differential Revision: https://developer.blender.org/D15770
This commit is contained in:
Philipp Oeser 2022-08-24 11:14:17 +02:00
parent e0d33461ce
commit 0e3978e17a
1 changed files with 5 additions and 4 deletions

View File

@ -830,12 +830,13 @@ class NWNodeWrangler(bpy.types.AddonPreferences):
def nw_check(context):
space = context.space_data
editor_is_valid = space.type == 'NODE_EDITOR'
valid_trees = ["ShaderNodeTree", "CompositorNodeTree", "TextureNodeTree", "GeometryNodeTree"]
tree_is_valid = space.node_tree is not None and space.tree_type in valid_trees
return editor_is_valid and tree_is_valid
valid = False
if space.type == 'NODE_EDITOR' and space.node_tree is not None and space.tree_type in valid_trees:
valid = True
return valid
class NWBase:
@classmethod