Fix #142767 - glTF exporter: Fix crash with shader node group traversal
Make sure to pass group_path by value in recursive function
This commit is contained in:
@@ -7,7 +7,7 @@ bl_info = {
|
||||
# This is now displayed as the maintainer, so show the foundation.
|
||||
# "author": "Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein", # Original Authors
|
||||
'author': "Blender Foundation, Khronos Group",
|
||||
"version": (5, 0, 18),
|
||||
"version": (5, 0, 19),
|
||||
'blender': (4, 4, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
||||
@@ -95,7 +95,7 @@ def from_socket(start_socket: NodeTreeSearchResult,
|
||||
|
||||
if linked_node.type == "GROUP_INPUT":
|
||||
socket = [sock for sock in group_path[-1].inputs if sock.name == link.from_socket.name][0]
|
||||
linked_results = __search_from_socket(socket, shader_node_filter, search_path + [link], group_path[:-1])
|
||||
linked_results = __search_from_socket(socket, shader_node_filter, search_path + [link], group_path[:-1].copy())
|
||||
if linked_results:
|
||||
# add the link to the current path
|
||||
search_path.append(link)
|
||||
@@ -104,7 +104,7 @@ def from_socket(start_socket: NodeTreeSearchResult,
|
||||
|
||||
# check if the node matches the filter
|
||||
if shader_node_filter(linked_node):
|
||||
results.append(NodeTreeSearchResult(linked_node, search_path + [link], group_path))
|
||||
results.append(NodeTreeSearchResult(linked_node, search_path + [link], group_path.copy()))
|
||||
# traverse into inputs of the node
|
||||
for input_socket in linked_node.inputs:
|
||||
linked_results = __search_from_socket(
|
||||
@@ -123,7 +123,7 @@ def from_socket(start_socket: NodeTreeSearchResult,
|
||||
if shader_node_filter(start_socket.socket.node):
|
||||
return [NodeTreeSearchResult(start_socket.socket.node, [], start_socket.group_path.copy())]
|
||||
|
||||
return __search_from_socket(start_socket.socket, shader_node_filter, [], start_socket.group_path)
|
||||
return __search_from_socket(start_socket.socket, shader_node_filter, [], start_socket.group_path.copy())
|
||||
|
||||
|
||||
@cached
|
||||
|
||||
Reference in New Issue
Block a user