[Closed] Copy/Paste Animation with Relative Values
I’ve been trying to find an answer to this for quite some time but no luck.
Let’s say I have a hundred cubes. They are in different random positions. All of these cubes move 100 units -z in 5 frames, then 50 units +x in 10 frames and goes like this. They all have identical animation but all of them start animating at different frames. At the moment I’m manually keying every single object. It’s ok for couple of objects but when you’re keying hundreds of them, it becomes pain.
Is there any way to make this task easier? I know I can duplicate the first object after animating it and offset its keys, that sure will be easier but since I have all my objects copied and positioned in place, so this is not an option. Also copy/paste animation will not work because it copies absolute values. I’d like to copy/paste it with relative values.
I have a script idea. This script will have 2 buttons. First button will copy animation of the selected object (including keys in visibility channel if they exist). Second button will paste that copied animation to the selected object starting at current frame. So I will select my animated object, press copy button, then select 2nd object, move time slider to desired position, press paste button, then select 3rd object and paste, etc.
I have no scripting experience so I dont know if it does make sense and easy to do. Any help is much appreciated, thanks in advance.
Let me know if it works out for you:
global rl_copyPasteAnim
try(destroyDialog rl_copyPasteAnim) catch()
rollout rl_copyPasteAnim "Copy and Paste Animation"
(
global theController
button btn_copyAnim "COPY ANIMATION"
button btn_pasteAnim "PASTE ANIMATION"
on btn_copyAnim pressed do
(
if selection[1] != undefined and selection[1].controller != undefined then (theController = selection[1].controller)
else (messagebox "Please select an animated object")
)
on btn_pasteAnim pressed do
(
if theController != undefined then
(
theTime = sliderTime - animationRange.start
with animate off
(
for s in selection do
(
theTM = s.transform
s.controller = copy theController
inserttime s.controller animationrange.start theTime
s.transform = theTM
)
slidertime = slidertime+1
slidertime = slidertime-1
)
)
else (messagebox "Please copy an animation")
)
on rl_copyPasteAnim close do
(
theController = undefined
)
)
createDialog rl_copyPasteAnim
It works perfectly, thank you so much!!! One little thing, how can I copy also visibility keys? This script doesnt seem to paste visibility only transform works.
Thanks again.
Here ya go. . .
global rl_copyPasteAnim
try(destroyDialog rl_copyPasteAnim) catch()
rollout rl_copyPasteAnim "Copy and Paste Animation"
(
global theController, theVisController
button btn_copyAnim "COPY ANIMATION"
button btn_pasteAnim "PASTE ANIMATION"
on btn_copyAnim pressed do
(
theController = theVisController = undefined
if selection[1] != undefined and selection[1].controller != undefined then
(
theController = selection[1].controller
if selection[1][1].controller != undefined then (theVisController = selection[1].visibility.controller)
)
else (messagebox "Please select an animated object")
)
on btn_pasteAnim pressed do
(
if theController != undefined then
(
theTime = sliderTime - animationRange.start
with animate off
(
for s in selection do
(
theTM = s.transform
s.controller = copy theController
inserttime s.controller animationrange.start theTime
if theVisController != undefined then
(
if s[1].controller == undefined then s.visibility = bezier_float()
s.visibility.controller = (copy theVisController)
inserttime s.visibility.controller animationrange.start theTime
)
s.transform = theTM
)
slidertime = slidertime+1
slidertime = slidertime-1
)
)
else (messagebox "Please copy an animation")
)
on rl_copyPasteAnim close do
(
theController = theVisController = undefined
)
)
createDialog rl_copyPasteAnim
jonlauf it’s working. Much appreciated, god bless you and your family.