Hi gays!
Is there an easy way to check if there is any animation on the object (scale, position, rotation)?
How to check if there is animation on an object?
I saw it, but for some reason it doesn’t work for me.
Of course I will try again, maybe I missed something
because there was some typo
this should be ok for your needs
clearlistener()
(
local aCurrentSelection = getCurrentSelection()
for itemNode in aCurrentSelection do
(
local aControllers = #(itemNode.position.controller,itemNode.rotation.controller,itemNode.scale.controller)
for itemController in aControllers do
(
for itemKey in itemController.keys do
(
format "Name: % Key : % Time : % \n" itemNode.name itemKey itemKey.Time
)
)
)
)
i just fixed and added name property in the format so credits to Nysuatro in the previous post
Yes, it works now, thanks a lot!
One more question, along the way,
how can i remove all animation from an object?
I tried using
for o in selection do deletekeys o #allkeys
But when keys are removed,somtimes objects move (rotate)
if you don’t care about modifiers, names or handles you can use this
for o in selection do snapshot o ; delete selection
this will copy the objects without keyframes in the current state
macros.run “Animation Tools” “DeleteSelectedAnimation”
Select object/s -> Alt + RMB click -> Delete Selected Animation
the question is not precisely posed, and therefore it is difficult to answer it …
The point is, what counts as an animated controller … for example, is the script controller animated?
or for example an orientation constraint … it may not have keys, but is driven by an animated target
I tried this
Sometimes everything is ok
Sometimes objects change position when deleted.
it looks like the objects are in the middle of the animation,
which was deleted
I tried this
Sometimes everything is ok
Sometimes objects change position when deleted.
it looks like the objects are in the middle of the animation,
which was deleted
it sounds like you already know what nodes need to be cleaned from animation. In this case it’s easier to replace transform controller with a new default instance of PRS controller:
-- let's do it for one selected node
animate off, redraw off, at time 0
(
tm = $.transform
$.transform.controller = createinstance prs
$.transform = tm
)
don’t specify the time if you want to clear the animation at the current time.