Skip to main content
Inspiring
December 14, 2010
Question

Duplicate and Move a Layer

  • December 14, 2010
  • 1 reply
  • 1050 views

Is there a good way to duplicate a layer in one composition and then move it to another composition? I'm very new to the SDK so I apologize if there is an obvious answer.

Thanks,

Jesse

This topic has been closed for replies.

1 reply

Community Expert
December 15, 2010

dude, you have no idea how problematic that simple thing you asked is.

you can duplicate effects, layers and masks using the c++ api, but you can't move them as they are to a new target.

this not-so-helpful thread is a good example: http://forums.adobe.com/message/1799202#1799202

but not all hope is lost!

you have a few options:

1. do it yourslef.

get the source footage of the layer you wish to copy, put that source in the new comp.

then copy that layer's properties one by one, and it's effects... one by one, and their params.....  one by one...

it's a hassle to program, but once you're done it's good for all eternity.

2. try to mimic copy/paste.

you can use AEGP_DoCommand() to force AE to use it's own copy and paste methods.

the command numbers are: copy 19, paste 20

i never tried doing that, so it's all theory.

and you'll need to be able to tell AE what comp to paste into, which i can't remember how to do (if at all possible) off the top of my head.

3. java.

if you can do that using java script, you can run java code from within you effect.

AEGP_ExecuteScript() will do the trick.

notice that it doesn't run an external jsx file. it runs the code you feed it via a char* array.

that's all i can think of right now.

sorry... no swift solution. (unless my brain has shriveled and the simple solution is right under our nose)