Forum Replies Created

Page 29 of 32
  • Xavier Gomez

    December 24, 2012 at 12:49 pm in reply to: ScriptUI problem

    I’m no expert, there is a very nice guide here: https://www.kahrel.plus.com/indesign/scriptui-2-0.pdf, but here are few comments:

    in line 4, replace: “statictext by: “statictext”.

    At this point your function createUI builds a palette but doesnt show it nor return it. You need a Window.show() somewhere. That’s the strict minimum, but there are other options (see the guide for that).

    1- You can either write a line

    ventana.show();

    just before the end of your function. In that case, when you call createUI(thisObj), it will build then automatically show the palette.
    But you will be in trouble accessing the palette data (for instance: nLayers).

    2- or you can make the function return the whole palette. Instead of vendana.show() you write:

    return(ventana);

    In that case, to build and show the palette you write

    var ventana = createUI(this);
    ventana.show();

    now ventana is a Window object in your script and you can access its properties. Actually since you didnt explicitely name the palette properties it’s not so easy. To read the nLayers value you’ll have to do:

    var x = parseInt(vendana.children[0].children[1].text);
    x = (isNaN(x) || x<1) ? 1 : x; //etc

    To make things easier you can name the palette properties upon creation (the ones that you will need to access), like this:

    function createUI(thisObj)
    {
    var ventana = (thisObj instanceof Panel) ? thisObj : new Window("palette", "mi Script", undefined, {resizeable:true});

    var grupoTexto1=ventana.add("group");
    grupoTexto1.add("statictext",undefined,"Nro de Layers");
    var nLayers=grupoTexto1.add("edittext",undefined,"1");
    nLayers.characters=4; nLayers.active=true;

    ventana.nLayers = nLayers;

    ventana.nLayers.onChange = function()
    {
    var x=parseInt(this.text);
    this.text = (isNaN(x) || x&lt;1) ? 1 : x;
    }

    return(ventana);
    }

    var pal = createUI(this);
    pal.show();

    var x = parseInt(pal.nLayers.text);//etc

  • Xavier Gomez

    December 13, 2012 at 12:26 pm in reply to: Bounding box and scripts

    If the mask is open, or if it is not in ADD mode, it won’t work though.

    Few times i also would have liked to access the mask bounding box/default anchor point too and it has no corresponding script property. Recalculating it from mask data is possible but requires some knowledge on bezier things.

    This could be a new scripting feature request.

    Xavier

  • Xavier Gomez

    December 13, 2012 at 12:09 pm in reply to: Free Expressions to share?

    Firstly there is Dan Ebberts’ site : https://www.motionscript.com/
    Additionnally there you can learn how it works.

    Also: https://jjgifford.com/expressions/basics/index.html

    There are MANY sites where you can find expressions (inside tutorials for instance), but they are not necessarily organized as the two above (which are dedicated to expressions).
    Most well-known: videoCopilot.net, see also its forum: https://www.videocopilot.net/forum/ (section PostProduction > After Effects Expressions).

    And there are few scripts with expressions libraries on https://aescripts.com/ but they are not free (Eaze and Wizz, iExpressions).

    Xavier

  • Xavier Gomez

    December 4, 2012 at 5:41 pm in reply to: Elegant Expresion Writing

    1- To start with, you dont need to use “if else” to use or not use decay since the formula that takes decay into account is valid for no decay as well (Math.exp(0) = 1).
    Similarly you dont need to do sin(x) —> cos(x+Pi/2) to get the – sign. Multiply by (-1) directly.
    Also, i dont understand why you need both an amplitude and a multiplicador since they have the same affect…

    2- To shorten the length of the expression and make it easier to read, you could define functions.
    For instance, at the beginning of the expression you define a function

    function oscFunction1(t, multiplicador,desfase, frecuencia, amplitud, rozamiento, invertir)
    {
    var sign = (invertir) ? -1 : +1;
    return(sign * multiplicador * amplitud * Math.sin(desfase+ t *(frecuencia))/Math.exp(rozamiento*t));
    }

    then you can call that function anytime with the appropriate parameters, for instance the first block of your code (Eje X) reads:

    oscilacion_x= oscFunction1(time, multiplicador_x,desfase_x, frecuencia_x, amplitud_x, rozamiento_x,invertir_x);

    You can do similarly for the y oscillations. I didnt look in details but basically you can probably write a single function that works for all cases.

    3- You can also replace “dimension = 3; try… try…” by

    try{dimension = value.length;}
    catch(e){dimension = 1;}

    4- the last part of your code is a bit strange: you ask the expression to calculate oscilacion_x and oscilation_y and at the end you check if you actually need these calculations. For instance if your variables x and y are both 0, then you have calculated lots of things to return… [value[0], value[1]].
    You could do:

    a) estimate the dimension
    b) osc_x = (x==0) ? 0 : oscilacion_x (calculate osc_x only in the second case);
    c) if (dimension >= 2) osc_y = (y==0) ? 0 : oscilacion_y (calculate osc_y only in the second case);
    d) return the result:
    switch (dimension)
    {
    case 1 : value + osc_x; break;
    case 2 : [value[0]+osc_x,value[1]+osc_y]; break;
    default : [value[0]+osc_x,value[1]+osc_y, value[2]];
    }

    Xavier

  • Xavier Gomez

    November 30, 2012 at 12:40 am in reply to: Decay sinusoidal between 2 values

    It is a misprint, you misplaced a parenthesis:

    case 0:
    if (… == 0) >>> ok
    else >>> not ok : replace (opacidad_maxima-opacidad_minima /2) by (opacidad_maxima-opacidad_minima)/2

    But even if you do that you will get a value of opacity = opacidad_maxima (80) at time=0;
    Apparently you want opacity = opacidad_minima at t=0, so set the phase at 180° and push up opacidad_maxim (to ~89) otherwise the opacity will never reach 80.

    Xavier

  • OK… i just realised that

    app.executeCommand(app.findMenuCommandId(“Smoother”));

    (or app.executeCommand(5017);)

    does open the Smoother palette.
    But how to pass a tolerance value to that window and simulate an onClick() event on the apply button ?

    Xavier

  • OK… i just realised that

    app.executeCommand(app.findMenuCommandId(“Smoother”));

    (or app.executeCommand(5017);)

    does open the Smoother palette.
    But how to pass a tolerance value to that window and simulate an onClick() event on the apply button ?

  • Hello,
    i’ve been trying to ask this question on AE enhancers for few days but registration is quite a long process there so i’ll jump on this bus.

    Is it possible for a script to launch a particular window (i’m thinking of the Smoother window) and run an action within than window (set smooth to, say, 3 and then aplly the smooth to the selected layer) ?

    i’ve tried :

    var smoothPal = Window.find(“palette”, “Smoother”);
    if (smoothPal instanceof Window){smoothPal.center();smoothPal.show();}
    else{smoothPal.layout.layout(true);}

    Unsurprisingly, nothing happens… and even if the smoother palette happened to show itself, i wouldnt know what to do then since i dont know the property/methods used by this palette. The AE scripting guide doesnt say anything about it, so it might not be available to scripting… ?

    Any idea welcome.

    Xavier

  • Xavier Gomez

    November 28, 2012 at 10:30 pm in reply to: Transform a 3D motion path

    hmm, answer much appreciated!!! Glad that i asked.

    I was feeling uncomfortable with those axis manipulations so i’d almost never use them…(!)

    Thank you,
    Xavier

    (beside this, i still have the feeling that it requires a lot of preparation work to be able to transform a 3D motion path in AE, and really, it could be improved).

  • Xavier Gomez

    November 28, 2012 at 10:50 am in reply to: Transform a 3D motion path

    I’m using CS5.5, but i’m surprised you can do that in cs6. How do you do that ?

    Usually when several layers are selected (child parent or not), changing a Transform property of one changes the corresponding Transform property of all at once. (If the change is made by entering a value using the keyboard, all layers are given the same value, and if the change is made by scrolling, they are all offset by the same value).
    It’s a nice feature for group move, but in the situation i describe above it’s not, since one needs to select the child layer to monitor the changes of its motion path, but dont want to add keys.

    Xavier

Page 29 of 32

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