Skip to content

Commit

Permalink
fix: shader node upgrade error from 4.0 or earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
saturday06 committed Jul 24, 2024
1 parent ca813e8 commit 3a09a9e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/io_scene_vrm/common/shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,7 @@ def copy_node_tree_interface(from_node_tree: NodeTree, to_node_tree: NodeTree) -
else:
continue

translated_from_socket_type = from_socket_type
if bpy.app.version >= (4, 1):
for (
socket_type,
Expand All @@ -1254,7 +1255,7 @@ def copy_node_tree_interface(from_node_tree: NodeTree, to_node_tree: NodeTree) -
if not socket_names:
continue
if from_item.name in socket_names:
from_socket_type = socket_type
translated_from_socket_type = socket_type
break

to_socket: Optional[NodeTreeInterfaceSocket] = None
Expand All @@ -1264,7 +1265,8 @@ def copy_node_tree_interface(from_node_tree: NodeTree, to_node_tree: NodeTree) -
to_item.item_type != "SOCKET"
or not isinstance(to_item, NodeTreeInterfaceSocket)
or to_item.in_out != from_item.in_out
or to_item.socket_type != from_socket_type
or to_item.socket_type
not in [from_socket_type, translated_from_socket_type]
):
to_node_tree.interface.remove(to_item)
continue
Expand All @@ -1280,7 +1282,7 @@ def copy_node_tree_interface(from_node_tree: NodeTree, to_node_tree: NodeTree) -
from_item.name,
description=from_item.description,
in_out=from_item.in_out,
socket_type=from_socket_type,
socket_type=translated_from_socket_type,
)

copy_node_tree_interface_socket(from_item, to_socket)
Expand Down

0 comments on commit 3a09a9e

Please sign in to comment.