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

Object has no attribute 'interface' in Blender 3.6 #94

Closed
hkunz opened this issue Mar 8, 2024 · 6 comments
Closed

Object has no attribute 'interface' in Blender 3.6 #94

hkunz opened this issue Mar 8, 2024 · 6 comments

Comments

@hkunz
Copy link

hkunz commented Mar 8, 2024

The script generated is incorrect. It uses an attribute 'interface' that does not exist in blender.

geometry_socket = voxelize.interface.new_socket

Notice that there is a misplaced 'interface' attribute that blender does not recognize.

Python: Traceback (most recent call last):
File "\Text", line 202, in
File "\Text", line 11, in voxelpositions_node_group
AttributeError: 'GeometryNodeTree' object has no attribute 'interface'

@BrendanParmer
Copy link
Owner

Hi @hkunz. It seems like your script was generated with the Blender 4.0 NodeTree structure, which uses a new API with an interface attribute for creation of new sockets and panels.

Currently scripts generated by NTP with Blender versions before v4.0 aren't forwards compatible with versions after v4.0, and scripts generated after v4.0 aren't backwards compatible with versions before v4.0. At some point I'd like to introduce a feature to allow for optional backwards/forwards compatibility, so that (unless editing node tree sockets) you wouldn't have to maintain code in two spots; I might prioritize this for NTP v3.1.

As a workaround right now, you can do something like

if bpy.app.version < (4, 0, 0):
    # Pasted script generated before Blender v4.0
    ...
else:
    # Pasted script generated after Blender v4.0
    ...

@hkunz
Copy link
Author

hkunz commented Mar 8, 2024

ohh yeah i generated it from 4.0 and then used it in 3.6. which addon do you use for 3.6 to generate forward compatible to 4.0?

@BrendanParmer
Copy link
Owner

You can still use NodeToPython 3.0.x to generate scripts for Blender pre-4.0, but they won't have forward compatibility to 4.0+ without doing the workaround. I'm not aware of any projects that generate truly cross-compatible Python scripts from node groups currently

@BrendanParmer
Copy link
Owner

Cross-compatibility to be added with #95

@hkunz
Copy link
Author

hkunz commented Mar 8, 2024

hey thank you very much. btw great stuff you made. i was thinking of making something like this then i realized there are probably libraries already out there and oh yes i found this!

@hkunz
Copy link
Author

hkunz commented Mar 8, 2024

Thanks alot it works perfectly. but i think there is a bug but im not exactly sure what it is. its related to this thread https://blender.stackexchange.com/questions/314386/python-generated-geonodes-setup-not-behaving-the-same-with-the-original-geonode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants