Forum Replies Created

Page 56 of 65
  • Well, it was introduced in cc13. I don’t know of any other way. Sorry for the missunderstanding.

    Andrei
    My Envato portfolio.

  • I don’t think that the if/else is the problem. You should call the selection by pixel_size.selection. However, when i have multiple choices, i usually use a switch statement. Easier to follow for me.

    Andrei
    My Envato portfolio.

  • I think this was posted before. I think what you are looking for is
    myTextLayer.sourceRectAtTime(time,false).width

    Andrei
    My Envato portfolio.

  • You should put this into the position of the icon
    textLayer = thisComp.layer("textLayer");//replace it with the name of your text layer
    textPosition = textLayer.transform.position;
    tempX = textPosition[0]+textLayer.sourceRectAtTime(time,true).left;
    [tempX ,value[1]]

    If you want to add some distance between the text layer and the icon, just move the anchor point of the icon to the left for the desired amount.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    March 22, 2018 at 8:08 am in reply to: Selecting specific Function depending on two sliders

    You need the ease or you want to make the expression. Because if what you are looking for is an easy way to ease(omg, how this sounds :))) you can check this out. It’s “name your own price”, so you can download it free, and then pay the author if you feel like they made your life easier(i think this script will). Plus, this script is not binary encrypted, so you can also see the code. Maybe you can find your answer(or maybe more than what you are looking for) in his code. I have seen it, very clean and well commented.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    March 21, 2018 at 4:25 pm in reply to: Check if any of selected layers is not a ShapeLayer

    Found your problem. applyPresset applies to all selected layers. So you should deselect them all after saving your numLayer variable, and select each one when needed, then deselect it again. I ran into this problem before. I have a function that i sometimes use . So i think this should solve your problem.
    {
    app.beginUndoGroup("Link Stroke Color");
    var myComp = app.project.activeItem;
    var numLayer = myComp.selectedLayers;
    var colorExp = '(expression placeholder - for code length reasons :D)"';
    deselectEverything();

    for (var a = 0; a < numLayer.length; a++) {
    if (numLayer[a] instanceof ShapeLayer){
    //it is a shape layer
    scanPropGroupProperties(numLayer[a]);
    } else {
    //its not a shape layer
    alert(numLayer[a].name + " is not a Shape Layer!");
    numLayer[a].selected = true;
    numLayer[a].applyPreset(File("D:\\fill.ffx"));
    numLayer[a].selected=false;
    }
    }

    //==============================================================================
    function scanPropGroupProperties(propGroup){ //scans the proprieties and adds expressions to the strokes
    var i, prop;
    // Iterate over the specified property group's properties
    for (i = 1; i <= propGroup.numProperties; i++){
    prop = propGroup.property(i);
    if (prop.propertyType === PropertyType.PROPERTY && prop.name === 'Color' && propGroup.canSetEnabled && prop.parentProperty.name.slice(0, 6) === 'Stroke'){ // Found a property
    prop.expression = colorExp;
    } else if ((prop.propertyType === PropertyType.INDEXED_GROUP) || (prop.propertyType === PropertyType.NAMED_GROUP)) {
    // Found an indexed or named group, so check its nested properties
    scanPropGroupProperties(prop);
    }
    }
    }
    app.endUndoGroup();
    }
    //==============================================================================
    //Go through the current active composition and deselect everything
    function deselectEverything() {
    var myActiveComp = app.project.activeItem;
    for (i = 1; i <= myActiveComp.numLayers; i++){
    myActiveComp.layer(i).selected = false;
    }
    }

    But i still don’t know why applyPreset acts this way.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    March 21, 2018 at 3:44 pm in reply to: Check if any of selected layers is not a ShapeLayer

    I did not test this piece of code. Now i did. Only problem i have is applying the preset. I need to use File(“\\fill.ffx”); Do you have any other code than this? Is this part of a bigger script? I can’t seem to figure out what is wrong. You are running this code inside extendscript? Or with file>script>run script?

    Andrei
    My Envato portfolio.

  • Andrei Popa

    March 21, 2018 at 3:08 pm in reply to: Check if any of selected layers is not a ShapeLayer

    I missed a character there, and i don’t know if you can edit your post here. So here we go again:
    {
    app.beginUndoGroup("Link Stroke Color");
    var myComp = app.project.activeItem;
    var numLayer = myComp.selectedLayers;
    var colorExp = '(expression placeholder - for code length reasons :D)"';

    for (var a = 0; a < numLayer.length; a++) {
    if (numLayer[a] instanceof ShapeLayer){
    //it is a shape layer
    scanPropGroupProperties(numLayer[a]);
    } else {
    //its not a shape layer
    alert(numLayer[a].name + " is not a Shape Layer!");
    numLayer[a].applyPreset(File("\fill.ffx"));
    }
    }

    //==============================================================================
    function scanPropGroupProperties(propGroup){ //scans the proprieties and adds expressions to the strokes
    var i, prop;
    // Iterate over the specified property group's properties
    for (i = 1; i <= propGroup.numProperties; i++){
    prop = propGroup.property(i);
    if (prop.propertyType === PropertyType.PROPERTY && prop.name === 'Color' && propGroup.canSetEnabled && prop.parentProperty.name.slice(0, 6) === 'Stroke'){ // Found a property
    prop.expression = colorExp;
    } else if ((prop.propertyType === PropertyType.INDEXED_GROUP) || (prop.propertyType === PropertyType.NAMED_GROUP)) {
    // Found an indexed or named group, so check its nested properties
    scanPropGroupProperties(prop);
    }
    }
    }
    app.endUndoGroup();
    }

    Andrei
    My Envato portfolio.

  • Andrei Popa

    March 21, 2018 at 3:00 pm in reply to: get property of layer by index

    You mean like this?
    First child:
    thisComp.layer(index-1).transform.position
    Second child:
    thisComp.layer(index-2).transform.position

    Andrei
    My Envato portfolio.

  • Andrei Popa

    March 21, 2018 at 2:56 pm in reply to: Check if any of selected layers is not a ShapeLayer

    The line that applies the preset should only be executed at the same time with the alert. I can’t think of a reason for it to be executed more(aka even on the shape layers). But i will give you some hints on your code, things that i don’t really know if create this confusion or not. First of all, do not create the function in the middle of your script. Its so confusing when reading it. Put it on the end. It does not matter where it is written, only where it is called. Second, you used 2 for loops for going through the selected layers. I think that confusion is due to the function being placed there. So here is what i came up with. Tell me how it works.
    {
    app.beginUndoGroup("Link Stroke Color");
    var myComp = app.project.activeItem;
    var numLayer = myComp.selectedLayers;
    var colorExp = '(expression placeholder - for code length reasons :D)"';

    for (var a = 0; a < numLayer.length; a++) {
    if (numLayer[a] instanceof ShapeLayer){
    //it is a shape layer
    scanPropGroupProperties(numLayer[i]);
    } else {
    //its not a shape layer
    alert(numLayer[a].name + " is not a Shape Layer!");
    numLayer[a].applyPreset(File("\fill.ffx"));
    }
    }

    //==============================================================================
    function scanPropGroupProperties(propGroup){ //scans the proprieties and adds expressions to the strokes
    var i, prop;
    // Iterate over the specified property group's properties
    for (i = 1; i <= propGroup.numProperties; i++){
    prop = propGroup.property(i);
    if (prop.propertyType === PropertyType.PROPERTY && prop.name === 'Color' && propGroup.canSetEnabled && prop.parentProperty.name.slice(0, 6) === 'Stroke'){ // Found a property
    prop.expression = colorExp;
    } else if ((prop.propertyType === PropertyType.INDEXED_GROUP) || (prop.propertyType === PropertyType.NAMED_GROUP)) {
    // Found an indexed or named group, so check its nested properties
    scanPropGroupProperties(prop);
    }
    }
    }
    app.endUndoGroup();
    }

    Andrei
    My Envato portfolio.

Page 56 of 65

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy