3
$\begingroup$

I need to set Geometry Nodes strings to certain dates so that I can then create Text objects with those dates. I know how to get the current date using Python. Is it possible to use a Python script to determine the value of a string in the Geometry Nodes?

$\endgroup$

1 Answer 1

3
$\begingroup$

Yes, you can set the values of geometry nodes using a python script that looks something like this:

    import bpy

    bpy.data.node_groups['Geometry Nodes'].nodes['String'].string = "Test"

This sets the string value of the node named "String" in the node group named "Geometry Nodes" to Test.

$\endgroup$
3
  • $\begingroup$ Thanks! This is helpful. I assume there is no way to execute a Python script directly in the node tree (so this has to be in a separate python file)? $\endgroup$
    – user44109
    Apr 22, 2022 at 18:53
  • $\begingroup$ As far as I'm aware there's no way to execute a script directly in the node tree, you'd have to add a script in the text editor window and run it manually. Hopefully one day there will be some kind of script node. $\endgroup$
    – Stoat Paws
    Apr 22, 2022 at 18:57
  • $\begingroup$ I tried this, but geometry nodes didn't trigger an update. Solved it by running "bpy.ops.object.editmode_toggle()" twice, so the mesh gets recaluclated $\endgroup$
    – soerensc_
    Jan 5 at 13:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .