You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Blender 4.1 introduces some breaking changes with NodeSockets that complicates things a little bit here.
In previous versions of Blender it was necessary to use the index of the node socket for setting defaults or linking sockets together, usually because the node would have multiple sockets of the same name, but different types. This was annoying and somewhat illegible.
In Blender 4.0, they introduced changes intended to make string lookups the primary way of accessing node sockets, but indexing was kept backwards compatible.
With Blender 4.1, several nodes now use dynamic declaration, and sockets no longer necessarily have the same indices as in previous versions, and previous scripts aren't forward compatible if using indexing.
Indices aren't reliable going from 4.1 to previous versions. Really, string lookups are necessary in both cases, only Blender will handle it for us post-4.0, getting us something like
ifbpy.app.version< (4, 0, 0):
for (key, socket) innode.[in/out]puts.items():
ifkey==nameandsocket.type==type:
#use this socketelse:
ifsocket.enabled:
# just use regular string lookup# otherwise don't generate
Defaults for unavailable sockets wouldn't be forwards-compatible, but this seems like an unlikely use case. NodeToPython probably shouldn't even be generating code for these unavailable sockets anyways
NodeTree
interfacesThe text was updated successfully, but these errors were encountered: