← All ideas
  • Published 14 Apr 2023

Geometry Nodes Python API

Because I need a lot of functions in my actual work, but it seems that other users and developers are not interested, but these function requests are very important to our studio.

I need to make functions about geometric nodes. I have downloaded the Blender source code, which is very difficult for me to edit.

I need some of the following API and related cases, all of which I want to implement in Python scripts:

  1. Use a script to replace the selected node with another node and keep the connection.
  2. Use a script to create an operation, such as adding a specified node group and connecting it upstream or downstream.
  3. Use scripts to modify constant values entered by nodes, including ways to modify drop-down menus.

I don't know how to check whether PythonAPI has these features. I hope some developers can turn similar requirements into open cases for reference by other users who want to make plug-ins.

I feel lonely about some improvement requirements that have to modify the source code, because no developer seems to be interested in my requirements, such as using "drop-down menu" or "structure" as the node's input and output interface, which is very difficult to define. So I chose not to learn the source code for the time being.

50%

Development Status: Open

Upvote 2 Downvote 2
sensarice1
14 Apr 2023

6 Comments

Lauloque

I might be wrong, but I think BPY can interact with Geometry Nodes the same way it already does with Compositing and Shader nodes. I suspect the only real different is the data path to access the nodes, as any other thing. The classes seem to exist for geometry nodes, so I think 1 and 2 can already be done if you want to:

GeometryNode(NodeInternal) — Blender Python API

And you can take example from the addon Node Wrangler, which already does exactly 1 and 2.

As for 3, since it's about editing a node, I haven't heard that to be supported by BPY, people who wanted to create their own nodes so far either made what they could with nodegroups or built their own Blender and wrote their nodes in C/C++.

1
andrej730

I think all that is achievable. Sometimes it's hard to find good example just from documentation so my suggestion would to find some addon(s) that do similar thing to what you're looking for and learn from their code. There are plenty of those, for example you can check out geometry script that seems to be doing a lot of node graphs manipulations.

Btw it's seems that all blender node graphs works very similar - so if you have some example from other type of graph you can still learn from it too.

Either way it all comes down to opening python console and "info" panel to see what blender is executing with each your action and finding your way around.

Ref:

modormoder

For some reason it seems to me that you are asking for something that already exists

sensarice1 Author

If you think these are the only three features I'm asking for, at least come up with examples to prove that they already exist. If I search for "node operations" in the web version of API, I get a separate description of each function, not how to use it together. At present, I can't find the official "typical case collection". I only occasionally see some third-party developers using python to make plug-ins in other third-party forums.

testure

sounds like what you actually want is additional documentation

Lauloque

If I search for "node operations" in the web version of API, I get a separate description of each function, not how to use it together. At present, I can't find the official "typical case collection".

Yes, unfortunately Blender's python documentation doesn't provide a lot of usage examples. I wish the BF organizes a documentation marathon some day to boost up both their user manual and developper wikis.

That being said, you have templates in Blender's script editor, and plenty of addons and scripts online to get inspired from, and lots of people ready to help on forums like blenderartists.org , Blender Stack Exchange and devtalk.blender.org