Forum Replies Created

Page 8 of 32
  • Xavier Gomez

    August 15, 2016 at 6:32 pm in reply to: Get path to property of a layer

    instanceof won’t work because not all layers have the same constructor (can’t remember the exact names, but i think text layers are instanceof TextLayer, shape layers of ShapeLayer, layers with source of AVLayer, etc, something like that, and they also have distinct matchNames).
    while (prop.parentProperty) is completely fine.
    You could also replace by : while (prop.propertyDepth>0) (that’s what i use, but it’s not better).

    For the path itself, i think that for children of a named group, using propertyIndex or matchName makes no difference.
    For children of an indexed group, it really depends on the usage of your script, because matchName can’t work (most of the time all children have the same matchName, so it can’t be a reliable identifier), and between the time you identify the property and the time you use the path, the user may have changed its position in the property stack, hence propertyIndex can also be unreliable.

    Last tip: you should use try{}catch(){} around the eval, because the property may be gone/invalid.
    You could also avoid the use of eval by saving the path as an array of identifiers, not a string, and looping over the array entries to recover the property. Then no need of try/catch.

    Hope that helps.

    Xavier.

  • Xavier Gomez

    August 15, 2016 at 9:54 am in reply to: Get path to property of a layer

    Be careful with “prop.name” as it is often not a reliable enough identifier.
    Some properties in the same group can share the same name, as in indexed groups, or in effects (in later versions, some properties names of Adobe’s effects have been changed so that they don’t have the same name, but in earlier versions you could have several time the same property name in a given effect).

    Xavier

  • Xavier Gomez

    August 13, 2016 at 2:22 pm in reply to: Get path to property of a layer

    Sorry , in the before last line, i meant Ellipse Path 1 (which is in the content of the group), not Ellipse 1 (which is the group itself)

  • Xavier Gomez

    August 13, 2016 at 2:19 pm in reply to: Get path to property of a layer

    Shape layers and shape groups within them have a “Contents” property.
    The shape layer’s content is not elided (see propertyGroup.elided attribute in the scripting guide) and has matchName “ADBE Roots Vector Group”.
    A shape group’s content is elided (does not appear in GUI) and has matchName “ADBE Vectors Group”.

    The parent of Ellipse 1 is not the “contents” of the shape but the contents of the group.
    It might look a bit convoluted at start, but once you have understood these two differences it’s fine.

    Xavier

  • Xavier Gomez

    June 11, 2016 at 5:52 am in reply to: Triggering RAM Preview via script

    From beginning to end of the workbar area:

    myComp.ramPreviewTest(checkerboards, zoom, exposure);

    (returns a string).

    To play the ram preview with the same settings as the ones in the current viewer:

    var i = app.activeViewer.activeViewIndex;
    var options = app.activeViewer.views[i].options;

    then use view.checkerboards (boolean), view.zoom (number), and view.exposure (number) as arguments.

    Xavier

  • Xavier Gomez

    June 5, 2016 at 8:15 am in reply to: refresh UI

    To change a text in a text widget, simply do theTextWidget.text = newText;
    There is no need to relayout, the text will be changed.
    But… you have to specify the new text. In your case, this means retrieving theTextLayer.text.sourceText.value for every pair text layer/text widget that you have.

    Xavier

  • Writing a function for that won’t make it slower.
    Most scripts samples you find on the net are in user-to-user forums, hence written in a way everybody can understand. If on your side you want to write it differently, feel free. In the end, you’ll still need to handle the case where the active item (or whatever input the script requires) is what it is expected to be, and the other case(s).

    Xavier

  • The argument to setValue should be the index of the layer (or 0 for ‘None’):

    focuslayer.property("Layer").setValue(doflayer.index);

    Xavier

  • Xavier Gomez

    May 24, 2016 at 4:22 pm in reply to: Wiggle write-on with sawtooth type line

    Here’s is a possibility for regularly spaced samples along the x-axis (controlled by the quantity called DX: spacing in pixels between samples).
    I can’t check the expression because i’m not in front of AE, hopefully there is no bug:

    t0 = 0; // reference time
    x0 = 0; // reference x (x position of the cursor at time t0);
    speedX = 100; // "cursor" will move to the right at 100px/sec
    DX = 50; // one sample for y every 50 px (along x-axis)

    yprop = effect("y").slider; // slider control with a wiggle expression (for y position of the cursor)
    y0 = 0.5*thisLayer.height; // reference y

    //===============================================

    dx = (time-t0)*speedX;
    u = dx/DX;
    n = Math.floor(u);
    DT = DX/speedX;

    [x0 + dx, y0 + linear(u, n, n+1, yprop.valueAtTime(t0+n*DT), yprop.valueAtTime(t0+(n+1)*DT))];

    Xavier

  • Hmmm, i tried to edit because in the first post the link to stackoverflow didnt work… Strange result.

Page 8 of 32

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