when adding a Value node through the geometry node tree editor I can enter#frame in the value field to have it synced up with the animation frame index (for procedural animation etc.)
However, I haven't found a way to add this kind of node with python. I was expecting to be able to do something like this:
modifier.node_group.nodes["Value"].outputs[0].default_value = "#frame"But then I just get
TypeError: bpy_struct: item.attr = val: NodeSocketFloat.default_value expected a float type, not strIs there any way to make use of this feature using only scripting?
1 Answer1
Add a driver from nodes
import bpymd = bpy.context.object.modifiers["GeometryNodes"]dr = md.node_group.nodes["Value"].outputs[0].driver_add("default_value")dr.driver.expression = "frame"bpy.context.view_layer.update()- $\begingroup$thanks! For some reason driver_add doesn't show up in
node_group.nodes["Value"].outputs[0].__dir__()so I was unable to find it$\endgroup$Linus– Linus2022-06-26 08:18:59 +00:00CommentedJun 26, 2022 at 8:18
You mustlog in to answer this question.
Explore related questions
See similar questions with these tags.

