0
$\begingroup$

I have a sequence that consists on switching on and off gravity over time on my animation.

enter image description here

When I change the speed of my simulation, the sequence differs from before. But now I have the new sequence over the last one.

enter image description here

I'm trying

bpy.ops.anim.channels_select_all() 

or

bpy.data.actions['SceneAction.007'].animation_data_clear() 

but I encounter context error or nothing happens.

I want to select and then delete on my scene the "SceneAction.007" that animates "Global Gravity" channel at the start of my script.

$\endgroup$

1 Answer 1

0
$\begingroup$

you can change global gravity with this statement:

bpy.data.scenes["Scene"].use_gravity = True

or

bpy.data.scenes["Scene"].use_gravity = False
$\endgroup$
4
  • $\begingroup$ I already use this to keyframe insert gravity on/off whenever I want, but when I run my code with a different speed. This means that on/off occurs on different keyframes than before and I still have older on/off keyframes on top of my new ones. $\endgroup$ Commented Nov 18, 2021 at 8:59
  • $\begingroup$ What I want is to select the channel of the scene that has gravity and delete everytime I run my code $\endgroup$ Commented Nov 18, 2021 at 9:00
  • $\begingroup$ Hi Sergio, I am sorry, but I still don’t get it what you really want. In your question you wrote nothing about keyframes, there you just wrote that you want to toggle gravity. Maybe you should edit your question and add an example what you really want. And maybe you show us your script so we understand what you are trying to do. $\endgroup$
    – Chris
    Commented Nov 18, 2021 at 9:53
  • $\begingroup$ Ok, I'll try again. Thanks for helping me out. :D $\endgroup$ Commented Nov 18, 2021 at 10:26

You must log in to answer this question.

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