Deniz Böttcher
Deniz Böttcher

Reputation: 9

Adding a Keyframe to a Specific Geometry Node in Blender Using Python

I am new to both Python and Blender. I am trying to add or change a keyframe on a specific geometry node within Blender. I found a code snippet that demonstrates how to keyframe a general property within Geometry Nodes, but I am unsure how to apply this to a specific node, such as a Value node.

Here’s the code snippet I found:

bpy.data.objects["Cube"].modifiers["GeometryNodes"]["Input_2"] = 2
bpy.data.objects["Cube"].modifiers["GeometryNodes"].keyframe_insert(data_path='["Input_2"]', frame=1)

However, I need to keyframe a specific node like the Value node for "Sound to Sample" or what used to be referred to as "bake to f-curve". I'm struggling to understand how to target this specific geometry node and apply a keyframe to it.

Upvotes: 0

Views: 134

Answers (1)

Deniz Böttcher
Deniz Böttcher

Reputation: 9

If you're using only one keyframe, add a keyframe to the geometry node, do this in Blender, and use bpy.ops.graph.sound_to_samples(filepath=mp3Path) for this scenario. For handling multiple geometry nodes, please refer to this comprehensive answer: Adding a Keyframe to a Specific Geometry Node in Blender Using Python.

Upvotes: 0

Related Questions