Forum Replies Created

Page 1 of 2
  • Thanks, now it makes a little more sense! I’ll try to keep this in mind.
    I kind of subconsciously figured out when to expect this hidden group to be there, but I was curious for a more reasoned answer to why it was there in the first place!

    Cheers.

  • Hi.

    I finally got the code to do what I needed it to be (which was slightly different from baking the expression for the whole length of the layer), and I thought I’d share it. Let me know what you think!

    /*
    Freeze expression at inPoint

    This script goes through the layers of the comps selected in the project panel and identifies all Text Layers.
    If the Source Text property is being evaluated via expression, a keyframe is created at inPoint for the expression-driven value.
    After creating such keyframe, the expression is disabled.

    This can be useful to save a lot of rendertime if the expression is not used to change the value across time but only to get
    it from another source (.txt file, comp name, another text layer).
    */

    {
    function manipulateTextLayers(comp){
    var totLayers = comp.numLayers; // Store the length of the input argument 'comp'

    for (j = 1; j <= totLayers; j++){
    var myLayer = comp.layer(j); // Store the layer object in a var

    // Check if the layer is a Text layer, then proceed
    if(myLayer instanceof TextLayer){
    var myProperty = myLayer.property("sourceText"); // Store property of interest in var

    // Check an expression is currently applied
    if (myProperty.expressionEnabled){
    var inPoint = myLayer.inPoint; // Store the inPoint time for the layer in var
    var valAtInPoint = myProperty.valueAtTime(inPoint, false); // Store the value of the property at inPoint
    // NOTE: Using 'false' as the second argument, any applied expression is NOT ignored

    myProperty.setValueAtTime(inPoint, valAtInPoint); // Create a keyframe inPoint with the expression-driven value
    myProperty.expressionEnabled = false; // Disable the expression
    }
    }
    }
    }

    app.beginUndoGroup("Freeze expressions at inPoint"); // Set the undo group

    // $.write("\n=============\n"); // Debug line of text

    // Store the selection. The selection attribute returns an array
    var selection = app.project.selection;

    // Run through the selected items and invoke function only for comps
    for (i = 0;i < selection.length; i++){
    if ( selection[i] instanceof CompItem){
    $.write(selection[i].name + "\n"); // Debug

    // Invoke function
    manipulateTextLayers(selection[i]);
    }else{
    $.write(selection[i].name + " is selected but not a comp!\n");
    }
    }

    }

  • Thanks for taking the time to look at the code. Hope you don’t mind, but I’m going to focus on the third point, which is the most important to me. I’m on a deadline and I’d like to focus on that for now. The rest of the code is exactly what Dan Ebberts wrote and it works, so I’ll leave it as is for the time being.

    I’ll let you know how it goes!

    Thanks again.

  • Gabriele Bartoli

    December 3, 2015 at 4:48 pm in reply to: txt file to text layer problems

    If I had to bet, I’d say your problem lies with the “” inside the txt file. Try to retype them or make sure they are the proper character.

    The code itself works for me, I just pasted it as source text in a new project and I obviously get “MISSING” because I don’t have the txt file on my desktop.

    Hope this helps 🙂

  • Update: today I opened the project after turning on my machine, and the path shown above was not working anymore. I assume it was working yesterday because I somehow managed to declare the myPath variable as a global variable. I tried to recreate the conditions but I can’t seem to be able to do that. Oh well, too bad. 🙁

  • Thanks. I have another fun question coming your way, but I’ll make a new topic. 🙂

  • Thanks! I actually got it working last night 🙂

    Cheers

  • Gabriele Bartoli

    November 14, 2015 at 4:52 pm in reply to: Aspect Ratio

    Well, you could export everything in 4096 × 2304 and letterbox them. You shouldn’t have to convert the comps to do that, just change the output module crop settings to the proper negative values (which should be -72). Make sure the comps bg color is black though.
    Even better, queue everything in Media Encoder and create a preset there.

    Not an elegant solution though, so I would probably go with Unknown and specify the 1.90 ratio if there is an option to add comments or notes.

  • Ok, thanks!

    So, what it does is simply reading a string and then treat it as an expression, nothing more. Good to know. Kudos!

  • Never mind, I found another post where you suggested to use triple quotations, and that worked out fine. But since we’re here, can I ask you where I can find a little more info regarding the eval() function?

    Cheers and thanks a lot

Page 1 of 2

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