Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link ordering #99

Merged
merged 4 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion geometry/node_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,9 @@
],

'FunctionNodeRotateEuler' : [
NTPNodeSetting("rotation_type", ST.ENUM, min_version = (4, 1, 0)),
NTPNodeSetting("space", ST.ENUM),
NTPNodeSetting("type", ST.ENUM)
NTPNodeSetting("type", ST.ENUM, max_version = (4, 1, 0))
],

'FunctionNodeRotateVector' : [],
Expand Down
14 changes: 12 additions & 2 deletions ntp_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ def _create_node(self, node: Node, node_tree_var: str) -> str:
if node.mute:
self._write(f"{node_var}.mute = True")

# hide
if node.hide:
self._write(f"{node_var}.hide = True")
return node_var

def _set_settings_defaults(self, node: Node) -> None:
Expand All @@ -292,14 +295,18 @@ def _set_settings_defaults(self, node: Node) -> None:
attr_name = setting.name
st = setting.st

is_version_valid = (bpy.app.version >= setting.min_version and
bpy.app.version < setting.max_version)
if not hasattr(node, attr_name):
if (bpy.app.version >= setting.min_version and
bpy.app.version < setting.max_version):
if is_version_valid:
self.report({'WARNING'},
f"NodeToPython: Couldn't find attribute "
f"\"{attr_name}\" for node {node.name} of type "
f"{node.bl_idname}")
continue
elif not is_version_valid:
continue

attr = getattr(node, attr_name, None)
if attr is None:
continue
Expand Down Expand Up @@ -1168,6 +1175,9 @@ def _init_links(self, node_tree: NodeTree) -> None:
links = node_tree.links
if links:
self._write(f"#initialize {nt_var} links")
if hasattr(links[0], "multi_input_sort_id"):
# generate links in the correct order for multi input sockets
links = sorted(links, key=lambda link: link.multi_input_sort_id)

for link in links:
in_node_var = self._node_vars[link.from_node]
Expand Down