4 Replies Latest reply on Aug 4, 2017 8:07 AM by Mike_Abbott

    Expression to change text in precomposed comp from main timeline

    Lachlan D Level 1

      If I have a pre-composed animated comp for some lower thirds, is it possible to set it in a way that the text inside it can be changed from the main timeline?

       

      I would like to be able to place the the lower thirds comp on the timeline, then change an expression on it for the string used for source text, without having to modify the precomp's contents.

       

      Will need to use the precomp multiple times, so I would like to avoid having to duplicate it each time I need to change the text in it.

        • 1. Re: Expression to change text in precomposed comp from main timeline
          Mike_Abbott Adobe Community Professional

          Short answer : No.

          Every time you drag a pre-comp into your main timeline you are creating an instance or 'clone' of that pre-comp. If you did change the text in the pre-comp it would change for ALL instances of that pre-comp, wherever they where used in your project, which I'm assuming you wouldn't want : )

          Depending on the design and animation of your lower third you may be able to extract the text element(s) so you could have a pre-comp of the common animated elements and place the text visually on top of them in your main comp.

          • 2. Re: Expression to change text in precomposed comp from main timeline
            ericsten Level 1

            There is a way to do this using Markers and Marker Comments.

             

            Effectively in your Master Comp, you need to decide where you want to add your Markers, I suggest on an adjustment layer or guide layer (ie. named "Names and Titles"). Place your Markers where your Lower3rds will start and then add your "Name | Title" in the comment field by double clicking on the markers. You need some sort of separator, I use " | " myself.

             

            Once you have your Markers set up, you can go into your Lower3rd SubComp and in the Source Text field for each add:

             

            A=comp("Comp 1").layer("Names and Titles").marker.nearestKey(time).comment; //This pulls the nearest keyframe's comment info//

            A.split(" | ")[0]  //This Splits the string of text at the separator and pulls either the first part [0] second part [1] or etc [2] [3] ....depending on how many separators you have//

             

             

            Quick warning though, your Lower3rds will change when they reach the halfway distance between markers!

            • 3. Re: Expression to change text in precomposed comp from main timeline
              ericsten Level 1

              Actually it bothered me that it would change at halfway so I rewrote it a bit.

               

              L=comp("Comp 1").layer("Names and Titles");  // Change this to whatever layer you have your markers on //

               

              A=L.marker.nearestKey(time).time; //nearest Markers time//

              B=L.marker.nearestKey(time).index; //nearest Markers index//

               

              A2=L.marker.nearestKey(time); //nearest Marker//

              B2=L.marker.nearestKey(B-1); //previous Marker//

               

              if (A > time) [C=B2] else [C=A2] //Compares nearest markers time to comp time, if in the future pull the previous keyframe, if in the past pull nearest//

               

              D=C.comment; //gets the comment information from selected marker//

              D.split(" | ")[0] //splits the comment string at the separator [0] for first part [1] for second [2] for third ....//

              1 person found this helpful
              • 4. Re: Expression to change text in precomposed comp from main timeline
                Mike_Abbott Adobe Community Professional

                Funny... I was just about to post to say - "good idea" and was working on a hold type upgrade myself : )

                 

                ...anyway - "good idea" !