BrendanParmer / NodeToPython

Convert Blender node groups to a Python add-on
MIT License
247 stars 23 forks source link

Exporting Collections of Nodes? #120

Closed zachcp closed 3 months ago

zachcp commented 3 months ago

Hi @BrendanParmer ,

Thanks for this wonderful tool. I've recently been playing with @BradyAJohnston 's fantastic MolecularNodes, which is implemented as a set of domain-specific GeometryNodes for making beautiful scientific illustrations. I have been interested in building some visualizations on top of MN but have found the devcycle to be a bit tricky and have therefore been exploring using NodeToPython to export his Nodes as python classes with the idea that I would be able to build up higher-level nodes in the GUI but then save and manipulate them via the python API.

I've got a working example of looping through all of the Nodes in his package and exporting them individually as files. The repo is here: molnodes-utils. Theres a few questions I would love to ask your opinion on:

  1. Would it be straightforward to export collections of Nodes instead of one-at-a time? I am currently hacking my way around your export system.
  2. Would it be possible to extend the export system to add imports for custom nodes? For example the MN_units class creates and uses an MN_world_scale Node which is defined in a seperate class/file. It would be nice to add that to the __init__.py that is exported
  3. I wrote a conversion script that loops across Nodes files and outputs each Class as a python file. Its a bit hacky and I would love suggestions/feedback you might have.
  4. I am interested in your opinion on the best workflow for how to develop on top of your code - e.g. do you have a recommended cycle of building and deploying? MN build and deposits a .blend file but it would be wonderful to have a full CI/CD system for iterating new features.

In short, you have developed a wonderful tool that I would like to use and would appreciate you input on and of the above problems. Note that to get nodetopython to work I did fork it so I could use pip to install/use your v3.2 branch as a library (git coords here)

Thanks again, zach cp

BrendanParmer commented 3 months ago

Hi @zachcp,

Thanks for your feedback!

1-2.) I like the idea of being able to export multiple node groups into one add-on. The hacky way to do this right now would be to include them all into one meta node group and export that, but having built-in support so they all go in their own files could be really nice.

3.) Skimming through your script it looks alright to me. At some point I'll probably add a feature that allows you to export the addon unzipped. Only thing I'd recommend is to make sure that you're following the terms of the licensing, specifically in regards to converting the node group assets to Python. I'm not a lawyer and this shouldn't be considered legal advice, but from what I can tell it seems like it could be a bit of a legal gray area. To remove any ambiguity, it's probably best to reach out to Brady and make sure what you're doing with his assets is okay.

4.) Right now I unfortunately don't have a lot of suggestions in terms of the development process. Script mode exports are nice for playing around with the Python side without leaving Blender, and if you use VSCode, Jacque Lucke's Blender Development extension is really helpful for developing add-ons. I'm very interested in feedback on what pain points people encounter and what features or improvements they'd like to see.

zachcp commented 3 months ago

Thank you @BrendanParmer . I will make sure to stay in contact with Brady RE the use of his assets. Thanks again for your great package and your feedback.

BrendanParmer commented 3 months ago

Tracking https://github.com/BrendanParmer/NodeToPython/issues/122