diff options
author | Peter Kim <pk15950@gmail.com> | 2022-06-17 11:28:06 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2022-06-17 11:28:06 +0300 |
commit | ec84e3294593e2e26475f18c81e847bf00dc201e (patch) | |
tree | a9c52b070d2ec514e4d5fe434a91709a4b79dfbd /node_wrangler.py | |
parent | 633e707c40ad94d75a5f0c23ad5f5df0514fc92d (diff) | |
parent | aa353e127c2be0a31e10f8b3621fc418bcf6d6ef (diff) |
Merge branch 'master' into xr-dev
Diffstat (limited to 'node_wrangler.py')
-rw-r--r-- | node_wrangler.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/node_wrangler.py b/node_wrangler.py index f2280f2c..1a815dc6 100644 --- a/node_wrangler.py +++ b/node_wrangler.py @@ -1165,7 +1165,8 @@ class NWNodeWrangler(bpy.types.AddonPreferences): hotkey_list_filter: StringProperty( name=" Filter by Name", default="", - description="Show only hotkeys that have this text in their name" + description="Show only hotkeys that have this text in their name", + options={'TEXTEDIT_UPDATE'} ) show_principled_lists: BoolProperty( name="Show Principled naming tags", @@ -3747,7 +3748,7 @@ class NWLinkToOutputNode(Operator): @classmethod def poll(cls, context): valid = False - if nw_check(context) and context.space_data.tree_type != 'GeometryNodeTree': + if nw_check(context): if context.active_node is not None: for out in context.active_node.outputs: if is_visible_socket(out): @@ -3761,11 +3762,14 @@ class NWLinkToOutputNode(Operator): output_node = None output_index = None tree_type = context.space_data.tree_type - output_types_shaders = [x[1] for x in shaders_output_nodes_props] - output_types_compo = ['COMPOSITE'] - output_types_blender_mat = ['OUTPUT'] - output_types_textures = ['OUTPUT'] - output_types = output_types_shaders + output_types_compo + output_types_blender_mat + if tree_type == 'ShaderNodeTree': + output_types = [x[1] for x in shaders_output_nodes_props] + ['OUTPUT'] + elif tree_type == 'CompositorNodeTree': + output_types = ['COMPOSITE'] + elif tree_type == 'TextureNodeTree': + output_types = ['OUTPUT'] + elif tree_type == 'GeometryNodeTree': + output_types = ['GROUP_OUTPUT'] for node in nodes: if node.type in output_types: output_node = node @@ -3773,11 +3777,16 @@ class NWLinkToOutputNode(Operator): if not output_node: bpy.ops.node.select_all(action="DESELECT") if tree_type == 'ShaderNodeTree': - output_node = nodes.new('ShaderNodeOutputMaterial') + if context.space_data.shader_type == 'OBJECT': + output_node = nodes.new('ShaderNodeOutputMaterial') + elif context.space_data.shader_type == 'WORLD': + output_node = nodes.new('ShaderNodeOutputWorld') elif tree_type == 'CompositorNodeTree': output_node = nodes.new('CompositorNodeComposite') elif tree_type == 'TextureNodeTree': output_node = nodes.new('TextureNodeOutput') + elif tree_type == 'GeometryNodeTree': + output_node = nodes.new('NodeGroupOutput') output_node.location.x = active.location.x + active.dimensions.x + 80 output_node.location.y = active.location.y if (output_node and active.outputs): @@ -3796,6 +3805,9 @@ class NWLinkToOutputNode(Operator): out_input_index = 1 elif active.outputs[output_index].type != 'SHADER': # connect to displacement if not a shader out_input_index = 2 + elif tree_type == 'GeometryNodeTree': + if active.outputs[output_index].type != 'GEOMETRY': + return {'CANCELLED'} links.new(active.outputs[output_index], output_node.inputs[out_input_index]) force_update(context) # viewport render does not update |