Precompose the layers after duplication

I am an artist, not a writer, so you don't have to excuse my lack of understanding.

That said, I have a fairly repetitive task that appears with each animation I make for my work. That being the case, I decided to write a script to automate this small part. The goal is to select a layer and duplicate twice. The new layers together the behind track matte to luma, and then add an effect of hue and curves than above. Once everything is done the two duplicated layers are then précomposés.

So far, I have everything works fine until I need to you need to precompose the two new layers. For the life of my I can't analyze how app.project.item (index).layers.precompose (layerIndicies, name, moveAllAttributes) is supposed to work. Here is the code I have so far:

var theComp = app.project.activeItem;
var theLayer = theComp.selectedLayers[0];


app.beginUndoGroup("Luma Matte");

lumaMatte();


function lumaMatte(){
for (i = 1; i <= 2; i++){
    var dupeLayer = theLayer.duplicate();
     if (i == 1){
        dupeLayer.name = theLayer.name + "_TINT";
        dupeLayer.property("Effects").addProperty("ADBE Tint");
        dupeLayer.property("Effects").addProperty("Curves");
        } else if (i == 2){
                dupeLayer.name = theLayer.name + "_LUMA";
                dupeLayer.trackMatteType = TrackMatteType.LUMA;
                }
    }
}
    


app.endUndoGroup();

Everything I try spit return an error "undefined is not an object. Where I think I'm lost is how to find the layerIndicies. Thanks to a table? In my view, that it should be through a table as the index of the layers will change from project to project. Any price. Thanks to all who can help.

var theComp = app.project.activeItem;
var theLayer = theComp.selectedLayers[0];
var precompLayers = []; // our array with layer indexes

app.beginUndoGroup("Luma Matte");  

lumaMatte();  

function lumaMatte(){  

for (i = 1; i <= 2; i++){
    var dupeLayer = theLayer.duplicate();

    precompLayers.push(dupeLayer.index); // add duplicated layer index

     if (i == 1){
        dupeLayer.name = theLayer.name + "_TINT";
        dupeLayer.property("Effects").addProperty("ADBE Tint");
        dupeLayer.property("Effects").addProperty("Curves");
        } else if (i == 2){
                dupeLayer.name = theLayer.name + "_LUMA";
                dupeLayer.trackMatteType = TrackMatteType.LUMA;
                }
    }  

precompLayers.push(theLayer.index); // finally add first layer index

theComp.layers.precompose(precompLayers, "Precomp", true); // precompose layers

}  

app.endUndoGroup();

Tags: After Effects

Similar Questions

  • How to change the layers After Effects CS6?

    Hi all!
    I am completely new to After Effects. I have a clip where the person walks from left to right and enters the building. In the background, there is a banner of a company to be there and I tried to change this banner to another that is already created and was placed there in Premiere Pro. The only problem is that the person passes in front of the banner. Y at - it an option to cut, paste the banner and paste the person? How to do this?

    Thank you very much

    Józef Ementaler

    Rotoscoping.

    It is not fun.

    But there are ways to make it easier. See this resource.

  • Keep the layers with Group/Ungroup CS5

    I hope I missed a box hidden somewhere in illustrator.

    I work with complex figures and often use the group to move the sections and align the panels. Unfortunately, this process flattens all objects in a single layer; which is ok when I move the group, but NOT OK when I need ungroup and modify objects in layers separated again.

    For example:

    Graphic overlay, text, highlight behind the text.

    One use is when I make a model, distributing the work to occupy the available space, then going back in and update text and highlights, etc.

    I'm dealing with too many objects to manually reassign the layers after dissociation.

    Thank you.

    N ° this feature never existed in artificial intelligence and still does today. Layer affinity is not an attribute of the object, it's just the opposite, so any object that is grouped together with those on other layers is engulfed in the dominant layer, which is usually the first object belonged to.

    Mylenium

  • Mac OS 10.6.8 - Photoshop CS5.1 after years of perfect use, suddenly I'm unable to select a layer by clicking on the image and select it in the layers palette.  Solve this problem for me and I'll buy you a new car.  With our thanks, David Heidelberge

    Mac OS 10.6.8 - Photoshop CS5.1

    After years of perfect use, suddenly I can't select a layer by clicking on the image and select it in the layers palette.

    Solve this problem for me and I'll buy you a new car.

    With our thanks, David Heidelberger

    Hi David

    Have you checked your settings to automatic selection in the upper left of the workspace?

  • Need help with custom script to rename the layers

    Hello world.

    I need help to write a custom script (because I suck at it) that will allow me to go through all the layers and sous-calques for a specific name ('X') and give it a new specific name ('Y').

    I have had success using the script below, but it does not work on any text layers names where the text layer was previously particularly well-known in 'X' and now changed needs.

    Any help is greatly appreciated.

    * Note: this script was originally used to find any layer with 'Copy' in its name and remove with anything after (to correct the problem of duplication of layers by adding this text).

    This is why the function is named removeCopy. It works for renaming layers also - just not a layer of text unfortunately.

    #target illustrator

    function removeCopy() {}
    If (app.documents.length == 0) return;
    var app.activeDocument = docRef;
    recurseLayers (docRef.layers);
    }
    removeCopy();
    function recurseLayers (objArray) {}
    for (var i = 0; i < objArray.length; i ++) {}
    ObjArr [i] .name = ObjArr [i].name.replace (/ \s*current name\s*\d*/, 'new name');
    If (objArray [i] .layers) recurseLayers (. layers.length > 0 ObjArr [i]);
    }
    }

    I finally found something after searching forums for a week. My confusion was related to the way Illustrator treats real layers against text/path/object "layers." Instead of layers, I had to use the pageItems in the script. The code below works. Thanks to Gustavo for his answer in another thread and Carlos I thank you for this looking too good! You're great to be ready to help models do more advanced things with Illustrator.

    var doc = app.activeDocument;
    var items = doc.pageItems;
    for (var g = 0; g)
        elements [g] .name = elements [g].name.replace ('Century Schoolbook text line', ' MonogramText: Century Schoolbook ");
    };
    App.Redraw ();
  • Is it possible after duplication of tracks to merge automatically?

    After duplication and slide on a track I always have to pick up the pieces, and then move the duplicate above so that it matches the original in piano roll. Is there a way in a double track to get automatically merge in time with the original? There is always a gap between the original and the copy, and I have to manually move the notes in piano mode so that it matches the original. Even if make a loop by dragging the region there is a space between the original and the copy. For me is not really a loop if there is a break between the original and the loop before it repeats. Thanks in advance for your help. I have searched but can't find the answer I was looking for.

    The notes should be moved is continuous.

  • retrieve the layers in psd

    I saved my four day work on photoshop, with about 25 layers, last night. When I opened the morning, there is only one layer containing only the final image. all I remember about the things that I did my job last night is that I made a copy of the original psd file and then saved in a jpg file 8000 * 6000 pixels, in CMYK mode, then converted to RGB apple, save as jpg, convert it to rgb 1998 save in jpg format, then save in psd, then the copy of the original psd reduced to 640 * 480 and save as jpg. I think that I closed two files after that... now, when I opened the morning both the copy and the original have only a layer that says "layer 11' my saved jpg images are on the beach from 15 to 20 MB. and both the psd are 240 MB, I suppose I still have layers hidden inside the psd file... Please help me get back the layers...

    Thanks in advance...

    snkats wrote:

    is it possible to flatten or merge or something while changing color profiles? who gave birth to this problem?

    Yes, going to flatten an evolution of the default color profile. There is a checkbox convert without flattening.

    The reason is that converts the RGB values of the changes, if adjustment layers will have different effects according to the color space. Flattening is the only way to preserve the appearance.

  • Photoshop script to copy all the layers of close PSD to open the current document

    Hi, I have very limited capacity script so this task is above my pay grade

    I'm looking for a script to read and copy all the layers in a PSD saved file and copy them into the current active document. The two documents have the same size and I need to be able to change text layers after copying. Anyone has any advice or examples of how I might be able to do this?

    Thank you in advance for any help you can offer.

    Kind regards

    Marcus

    Try the script in entry below. You must open the destination file, and you must put in the path and name where your source file. It will not choose a layer from background from the source file.

    #target photoshop
    var sFile = new File('~/desktop/template.psd');//change path to template file
    var doc = activeDocument;
    var sDoc = open(sFile);
    
    var idselectAllLayers = stringIDToTypeID( "selectAllLayers" );
        var desc2 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref1 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref1.putEnumerated( idLyr, idOrdn, idTrgt );
        desc2.putReference( idnull, ref1 );
    executeAction( idselectAllLayers, desc2, DialogModes.NO );
    
    var idDplc = charIDToTypeID( "Dplc" );
        var desc5 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref2 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref2.putEnumerated( idLyr, idOrdn, idTrgt );
        desc5.putReference( idnull, ref2 );
        var idT = charIDToTypeID( "T  " );
            var ref3 = new ActionReference();
            var idDcmn = charIDToTypeID( "Dcmn" );
            ref3.putName( idDcmn, doc.name );
        desc5.putReference( idT, ref3 );
        var idVrsn = charIDToTypeID( "Vrsn" );
        desc5.putInteger( idVrsn, 5 );
        var idIdnt = charIDToTypeID( "Idnt" );
            var list1 = new ActionList();
            list1.putInteger( 3 );
            list1.putInteger( 4 );
        desc5.putList( idIdnt, list1 );
    executeAction( idDplc, desc5, DialogModes.NO );
    
  • Illustrator 2015.3 - cannot select objects in the layers palette

    After having upgraded to 2015.3 this morning, I can not select the layers to reorganize in the layers palette. The file is one I created before the update - but even a newly created file has this same problem.

    He puts the light color to the right of the object in the layers palette, but refused to move the object upward or down in the stack.

    Has anyone else had this problem and solved?

    Mac Yosemite 10.10.5.

    Thank you

    Beth

    Thanks Mike - I found my answer: decouple, decouple, dissociate. I who appears when objects are grouped a few times it can not be moved until it was separated.

  • Design of a Web site on the layers

    I'm trying to deign one page website 100% width / height of 100%. In regards to the time 100% height is not available in Muse, I do it manually in the CSS after that I exported the Web site.

    I have 6 layers, I have 6 sections of menu. The sections of the menu have the same name as the layers.

    For example, the layer 'home' is the name of menu home, layer 'contact' is the name of the Contact menu.

    I keep looking for a solution to the layers of trigger to hide on click/release and display only the layer with the same name.

    Anchor points solution works but all layers are visible on the other.

    If I was not clear enough, or if you have suggestions, comments, questions, feel free to post them.

    Also, if it is not possible in Muse, I am happy to try coding CSS hollow

    And it's so sloooow!

    Photo galleries appear only after a long wait...

    But I must say that the navigation is not so hard to imitate.

    One of the causes of the long wait could be that although the links point to different URLS, the scripts behind the screens are probably downloading all the pictures initially. Is not a good approach in this situation. I think that it is better not to put all your material to display in a page, or even a widget!

    Developers can create everything you ask. It is their goal and the challenge.

    But as a designer, he must be careful with what you are trying to reach and what are the consequences on the outcome of the experiment. Muse is perhaps not able to create anything you might be visually wishing for, but it will keep you on a relatively safer track in design and construction technically your own Web site.

  • Management of the problems after the update 27/01/2016 of the files

    I edit in PS after LR on most files.

    I often put feathers masks extremely on in my files.

    Everything was fine until today, after the update.

    Now, after recording in PS go back to LR, LR watch preview masks also moulted hard lines.

    It does not resemble it in PS, as LR. And it exports with the hard lines of LR.

    I tried to update the previews, I toggled and saved with the layers on and outside. This is definitley the layers and it's certainly the way LR is their reading.

    Any ideas?

    Official Adobe Forum to report bugs:Photoshop community customer family

    Already, there may be a thread here on this issue. If so, you can add your vote. If this isn't the case, you can start your own.

    HAL

  • Duplicate the layers of a plan of work on another file

    I am having some problems of duplication of layers to a Committee of art on another photoshop file.
    Whenever I try to reproduce it sticks to the first Board of the art of the document. I'm trying to stick to the third Chamber of art in the document.

    Can someone give me an idea on how to place it on a specific Board?

    Thank you
    Shawn

    (Long answer, see shorter answer below)

    There are a few known issues when transferring content between two work plans in two different documents.

    1. we do not keep the relative xy position within the artboard when you drag layers in an old plan of work in an old document to a new work plan in a new document. The self-positioning code currently only works in the same document.

    2. When you drag layers from one document to another, if the destination layer is in a work plan, we adjust the destination to the top of the layers stack.

    The rationale for (2) is a complex: fall of layers added xy by position in the center of the view, regardless of the layer order insertion point. If we inserted just the layers in the order you choose, depending on the location of xy of the artboard (edge of the view, or even out of sight), the layers added wraps being entirely hidden outside the boundaries of the artboard (Hey! I dropped something in my document and nothing happened). It is a very bad behavior and it has side effects, as the layers come out of the artboard unexpectedly at a later time during editing. So we put the layers newly added at the top of the layer stack and let auto-nid - drop layers in different existing work plans. If the work plan of destination is located in the center of the view, the new layers would fall in this work plan. In the upper part.

    We could certainly better on (2) and have them inserted above the selected layer if they would be always visible, but we should solve also (1) first, and there are many cases that we need to worry.

    These two problems are currently on our list of work and should be considered bugs.

  • help edit the layers of starter model

    Hi I have a client that I chose to use the photo adobe Starter model. How to change the home page titled expose? I want to tell it like it is the layers panel. the Toronto show the following

    Page, footer menu

    How to change or merge in the next layers?

    Master of the House,

    I also want to separate the page sign in what follows. I noticed the layout of the phone is on the layout.  which is the same as the layout of office. as he muse configuration confuses me. I was told that its best to each layout on its own layer.  but I'm afraid I can screw up the entire site.

    other than the site is great. only I don't get a design page layouts. its so different after trial to white.

    problem has been resolved. I was playing with layers and discovered there's a movement to the layer in the object Panel. I created a new layer and called it the menu phone. then in the menu, I moved everything under this new layer. That's what I was trying to separate the layers without messing up the layout of the site.

    Thank you

  • loop through the layers defining the lock and visibility

    I need to loop through the layers in the active document and the value of the properties of the layer is false or true.  I tried to create a loop using a method 'for', but it doesn't seem to work. I have renounced the method 'for' because I kept running into a problem.  I have set all layers with these settings just the odd ones (2,4,6, etc.). Here is sample if it was written.

    myLayer = myDoc.layers var [2];

    myLayer.visible = false;

    myLayer.locked = true;

    myLayer = myDoc.layers var [4];

    myLayer.visible = false;

    myLayer.locked = true;

    myLayer = myDoc.layers var [6];

    myLayer.visible = false;

    myLayer.locked = true;

    myLayer = myDoc.layers var [8];

    myLayer.visible = false;

    myLayer.locked = true;

    I have 208 layers, so doing it this way would be way to long. Any help would be appreciated.

    Illustrator CC 2014 running.

    After I wrote this and tested, I saw that Carlos had already answered, but I thought that I would post it anyway. Carlos KNOWS how much I love JS... ;-)

    One difference is that, since it was not clear to me which layer you talk like layer #1, I started at the bottom of the scale.  I hope this helps.  -TT

    var aDoc = app.activeDocument;
    var lc = aDoc.layers.length;
    for (var i = 2; i <= lc; i+=2) {
        var curLayer = lc - i
        aDoc.layers[curLayer].visible = false;
        aDoc.layers[curLayer].locked = true;
    }
    
  • Is there anyway to keep the layers in Photoshop Elements when recording in format .jpg?

    I am new to the use of PES and I like their concept of layers so that the original photo is not altered, however, my preference is to save all my files using .jpg.  I actually discovered yesterday that after 3 weeks of scanning in very old family photos, then using PSE11 and using layers and then backup to .jpg, now when I open it again these files in EPS that the layers created have disappeared.  Help, please!

    Thanks for the recommendation on Googling PSD to JPEG conversion that I'll look in.  My plan is I think the first scenario that you mentioned.  I spent a week off the coast during Christmas pictures old many sorting that I inherited and have since bought an Epson V600 Scanner that came with Photoshop Elements.  I spent a number of weeks of research on the best practices to use with the Epson scanner analysis, then an equal amount of time familiarizing myself with Photoshop Elements I've ever used before.  In particular, compared to the other I used photo editing tools, I really like the ability to retouch PSE and localized sharpening / Brush tool for a lot of old photos that aren't in the best of shape.  To change things (just if I'm not scanning for a year and then touching up for another year +), I'm scanning a group of photos I've sorted by theme and then spending time using Photoshop on these, and most of the time I'm scanning only pictures of people that I know to be members of the family or friends of family nearby. Once this batch is finished, I was moving to the next batch of scanning and treatment with PSE.

    Funny you should mention the kodacolor the slides that you have scanned.  I did this same work (approx. 5000 slides that my dad had in his lifetime) about 7 years ago with a slide scanner that I bought at the time.  Like you, I've scanned everything and then using a tool (Zoombrowser) editing of Canon, I hit only these slides scanned with meaning for me.  Now the phase 2 (7 years later) is scanning in all my photos of old parents, and I've already sorted on the pictures, I think no family, so now are using PSE, I expect I'll do some sort of button until most of them.  Sorry for the lengthy response, but I enjoyed reading of your recommendations and appreciate the help and guidance you provided.  Thanks for all your help and your time.

    Rob

Maybe you are looking for