Closed prubini87 closed 4 years ago
I think it is already possible to write an add-on that extends Animation Nodes. Haven't tried that before though, so I will give it a try, see what we need and get back to you.
Ok. So this is already possible. You just need to ensure Animation Nodes was loaded using addon_utils
then you can define your nodes through absolute imports from the animation_nodes
module.
We can write a guide and provide a skeleton code for those interested in writing extensions.
That's awesome news! Thanks @OmarEmaraDev, always providing quick feedback! 👍 It would be superb if there was a guide on how to do it. Perhaps we could add that to the official manual? Along the lines of "extending Animation Nodes"...
We published a preliminary guide in https://github.com/JacquesLucke/animation_nodes_manual/commit/e49de0fabbce72f6206ed8c68e936fa51e1a79b6. Should be deployed in a moment. Let us know if you have any feedback.
Is it possible to extend datastructures and sockets?
@harisreedhar You may define your own sockets just like in Animation Nodes. Create a directory named sockets
with an empty __init__.py
file, and add your socket definition there.
What do you mean by extending data structures? Do you want to add more methods to FloatList
for instance?
I mean my own datastructure. Like actions for example
For example if i want to create a datastructure Vector4DList
is it possible?
It is possible, albeit hard at the moment. I will consider adding this to the guide. I wounder if shipping the headers with Animation Nodes will be enough to make this work, I will get back to you.
Thanks @OmarEmaraDev One more thing, In the documention i saw custom cython functions are currently not supported. If we ship dependant files like datastructures, algorithms etc will it be possible to write cython functions ?
To clarify, you may write your own custom Cython functions, I just haven't described that in the documentation yet. I will probably do that at some point. However, the complication here is that you can't use the structures defined by Animation Nodes inside your Cython functions. To do that, you would need the pxd
header files in Animation Nodes. So we first need to find a way to release those files to be used by developers.
@harisreedhar I added support for Cython extensions. Consult the documentation for more information: https://docs.animation-nodes.com/developer_guide/extensions/introduction/
Please let me know if you have any feedback.
@harisreedhar I added support for Cython extensions. Consult the documentation for more information: https://docs.animation-nodes.com/developer_guide/extensions/introduction/
Please let me know if you have any feedback.
Hi, I need help. I got an error.
My addon path: /home/hari/Desktop/test_AN_code/an_bluefox_extension
header path: /home/hari/Desktop/animation_nodes_headers
conf.json file:
{
"Copy Target" : "/home/hari/.config/blender/2.92/scripts/addons",
"Cython Include Paths" : ["/home/hari/Desktop/animation_nodes_headers"]
}
a test cython file:
@harisreedhar Seems like you have an old version of the cythonize.py
file. Did you download that from latest master?
@harisreedhar Seems like you have an old version of the
cythonize.py
file. Did you download that from latest master?
You're right. I downloaded files directly from master branch and it is working now. Thanks a lot for this.
@harisreedhar How did it go with the extension? Are you planning to release an extension containing your nodes?
@harisreedhar How did it go with the extension? Are you planning to release an extension containing your nodes?
I have ported some custom nodes i created earlier as extension [link]. It is working fine. Headers are imported and Cython files are successfully compiled. The documentation was really helpful. One thing i didn't find is making custom socket types. Can you add that to documentation as well? It would be very helpful.
Yes i would like to release extension someday.
@harisreedhar That's good to hear. Custom sockets types are not special, just add a directory sockets
like the nodes
directory and add you sockets there. I just added that to the documentation anyway.
By the way, @3DSinghVFX was working on the workflow file to make it possible to grab the headers during compilation. Maybe you can as him for that so as not to add the headers to your extension's repository.
@OmarEmaraDev Thank you. So no need to add headers on repository? That is cool. I'll ask him.
@OmarEmaraDev and @harisreedhar Here is the worflow for Animation Nodes' extension that grab the headers of Animation Nodes during compilation https://github.com/3DSinghVFX/an_extra_nodes/blob/master/.github/workflows/build.yml. Add these lines to the existing workflow to grab the headers and extract them,
- name: Download Animation Nodes' Headers
uses: i3h/download-release-asset@v1
with:
owner: JacquesLucke
repo: animation_nodes
tag: master-cd-build
file: animation_nodes_headers.zip
- name: Extract Headers
run: python -m zipfile -e animation_nodes_headers.zip ./
Thanks @3DSinghVFX!
@OmarEmaraDev and @harisreedhar Here is the worflow for Animation Nodes' extension that grab the headers of Animation Nodes during compilation https://github.com/3DSinghVFX/an_extra_nodes/blob/master/.github/workflows/build.yml. Add these lines to the existing workflow to grab the headers and extract them,
- name: Download Animation Nodes' Headers uses: i3h/download-release-asset@v1 with: owner: JacquesLucke repo: animation_nodes tag: master-cd-build file: animation_nodes_headers.zip - name: Extract Headers run: python -m zipfile -e animation_nodes_headers.zip ./
Thank you✌️
@harisreedhar I missed something about sockets and have since update the documentation. You should update your __init__.py
accordingly.
@harisreedhar I missed something about sockets and have since update the documentation. You should update your
__init__.py
accordingly.
Now it is working thank you Omar
Hi, I've been watching videos of people who have created custom nodes and have (re)built AN with said nodes, however, I was wondering if there's a way to make AN "extendable" in a simplified manner. I think it would be great if people could download compressed (zip) files containing other people's nodes and install them on top of AN existing nodes... That might eliminate the need to keep adding nodes to the existing repertoire, keeping AN very minimal, clean and solid, much like a framework, leaving all nodes that are too specific outside the core bundle, I guess, but close at hand for whoever wants to install extra nodes on the fly! I can already see an amazing repository of extra nodes of all sorts dream.
Has anybody been thinking about that? What are the current options for extending AN without making custom builds?
Those are thoughts and not at all a bug in AN. I couldn't find any other way to share them other than here. Please let me know if there's a better place!
Peace!