Graphics

 View Only
Expand all | Collapse all

Previewing a script and visual logic on the same text line

  • 1.  Previewing a script and visual logic on the same text line

    Posted 08-06-2021 02:02
      |   view attached
    I have a full screen graphic with 2 separate text fields.  On the first text field, I'm using a script to automatically add parenthesis - a very simple text = "(" & text & ")".  Then I'm using visual logic for the second text field to auto follow the first text field depending on its bounding box width.

    In layout mode, I see the visual logic work and the spacing is correct.  In the sequence mode preview window, and in Inception preview, the visual logic does not show.  It is fine when I play it out and I know it will work.  However, when a producer is using this template, they sometimes add spaces to adjust it in preview which makes it incorrect when played out.

    I know I can use the Concatenate blocks to add the parenthesis and have everything in visual logic, but I was wondering if there is an easy way to use both a script and visual logic and see how it will play out in the preview window.  I attached a png of some of the items to help illustrate my point.  Thank you in advance for any help.

    ------------------------------
    Mark Stasiowski
    ------------------------------


  • 2.  RE: Previewing a script and visual logic on the same text line

    Posted 08-06-2021 04:10
    My guess is that the visual logic is running before the script, so on the output it looks fine bit in preview where it only renders once you're seeing this issue.

    You might be best doing the spacing in script as well. 

    You also don't need that multiply box btw since you are multiplying by 1 that's not actually doing anything.

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    United Kingdom
    ------------------------------



  • 3.  RE: Previewing a script and visual logic on the same text line

    Posted 08-06-2021 08:19
    Might also be worth trying checking this box off to see if that helps before you move it all to script. 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    United Kingdom
    ------------------------------



  • 4.  RE: Previewing a script and visual logic on the same text line

    Posted 08-06-2021 15:32
    Red -
    Thank you for your response.  I eliminated the multiplier block.  I didn't even realize that it was set at 1 (I know this has nothing to do with the issue I'm trying to solve).  I also tried unchecking the Timing box as you suggested, but that didn't work.  I really don't know much about scripting so I don't use it often.  Do you (or anyone else) know the script for spacing?  I'm willing to give that a shot to see if I like it any better.  My final solution would be to just change everything back to visual logic by replacing the script with the concatenate blocks.  Thank you again for responding.

    ------------------------------
    Mark Stasiowski
    ------------------------------



  • 5.  RE: Previewing a script and visual logic on the same text line

    Posted 08-07-2021 09:30
    I have added spacing using the same technique you used for the parentheses. Spaces are added inside the " "

    final.text = "(" & first.text & ") " & second.text 


    ------------------------------
    Malcolm Thorpe
    TV Syndicate/Icon Fitness
    ------------------------------



  • 6.  RE: Previewing a script and visual logic on the same text line

    Posted 08-09-2021 01:35
    MalThePal -
    Would this go on the first line of the Object Manager (the scene name) or in the text line?  Again, forgive my ignorance, but I'm not very informed when it comes to using scripts.  Thank you for your response.

    ------------------------------
    Mark Stasiowski
    ------------------------------



  • 7.  RE: Previewing a script and visual logic on the same text line

    Posted 08-09-2021 01:42
    I would normally have a "first.text" text object and a "second.text" object. these would not be visible. The actual script would be on a "final.text" object that would be visible. It would combine the two text objects and make this combination the text for the visible "final.text". I will load up my Xpression tomorrow morning and get a quick script together for you.

    ------------------------------
    Malcolm Thorpe
    TV Syndicate/Icon Fitness
    ------------------------------



  • 8.  RE: Previewing a script and visual logic on the same text line

    Posted 08-09-2021 12:11
    ok, this script would go on the scene itself. Basically on the very top "object". I would put it on "on set text"

    dim nam, loc, final as xpTextObject

    self.getObjectByName("DATA_Name", nam)
    self.getObjectByName("DATA_Location", loc)
    self.getObjectByName("TXT_name&location", final)

    final.text = "- " & nam.text & ", "  loc.text

    This assumes there are two hidden data text fields (name  and location) plus one final text output (name&location)

    The final output takes a "-" followed by a space, then the name followed by a comma and space then the location. It then sends these to the final visible text object "name%location". This text object is now subject to auto scaling and any other text operations for formatting. I hope this helps.

    ------------------------------
    Malcolm Thorpe
    TV Syndicate/Icon Fitness
    ------------------------------



  • 9.  RE: Previewing a script and visual logic on the same text line

    Posted 08-12-2021 01:19
    MalThePal -
    Thank you for the time & effort put into this.  Unfortunately, I can't seem to make this work.  I'm sure it's something I'm doing wrong.  Along your theory with the hidden data, I remade my text fields into Company Symbol (hidden text), Company Name (hidden text), then Final (where I believe the hidden text is supposed to show.
    Here is my Object Manager:

    And here is the script:

    What did I do wrong?


    ------------------------------
    Mark Stasiowski
    ------------------------------



  • 10.  RE: Previewing a script and visual logic on the same text line

    Posted 08-12-2021 01:25
    Looking at your project, the script should go at the very top element. "API SCRIPT TEST1". I gave you the wrong information on one of my previous posts. 


    ------------------------------
    Malcolm Thorpe
    TV Syndicate/Icon Fitness
    ------------------------------



  • 11.  RE: Previewing a script and visual logic on the same text line

    Posted 08-12-2021 01:41
    MalThePal -
    It works!  Thank you again!  Scripting is definitely a nice option to have sometimes instead of Visual Logic, I just have to learn more about it.

    ------------------------------
    Mark Stasiowski
    ------------------------------



  • 12.  RE: Previewing a script and visual logic on the same text line

    Posted 08-12-2021 10:01
    Woohoo. I'm glad you got it. For me, scripting adds a lot of flexibility. You can turn things on and off based on the value of a text field, you can place a script on a scene director so that it fires at an exact time, it's pretty much limited by your imagination. Congratulations.

    ------------------------------
    Malcolm Thorpe
    TV Syndicate/Icon Fitness
    ------------------------------



  • 13.  RE: Previewing a script and visual logic on the same text line

    Posted 08-07-2021 12:00
    Mark-

    What version of XPression are you using? I tried to recreate your scene on my system (v10 build 5250) and all seemed to work as you intended both in the Sequencer and Plugin preview, and online.

    That being said, you can do this all in a script, although I had to place it on the Scene object (in both the OnOnline and OnPreviewRender events,) not the Text Object, in order to move the X Position of the Company Name text object.


    The script for spacing would just be CoName.PosX = CoSymbol.BoundingBox.Width to which you can add your offset. Also, since your visual logic was using the BoundingBox.WidthScaled, you can use the Math.Min function to account for any Auto Squeeze you have set on your Symbol Text object. 


    A quick note if you try to go the Visual Logic route...you can also use the FormatString block (added in v 6.7), which in this case might be a bit cleaner than using Concatenate. 




    ------------------------------
    Jeff Mayer
    Ross Video
    ------------------------------



  • 14.  RE: Previewing a script and visual logic on the same text line

    Posted 08-09-2021 01:39
    Jeff -
    Thank you for your detailed response.  I am using v9.0 build 4842.  Now when I try using all visual logic, it's not working in preview either.  I know it was working with just visual logic before I changed it to the script (and I did remove the script as well).

    I have to re-visit using your script option tomorrow.  I entered the script as you have it, but it won't change the company symbol.  I'll give it another shot and let you know how it works.

    ------------------------------
    Mark Stasiowski
    ------------------------------



  • 15.  RE: Previewing a script and visual logic on the same text line

    Posted 08-09-2021 13:29
    Mark-

    Did the script compile correctly (you get the green check mark when you click the Fire icon) when you added it to the OnOnline and OnPreviewRender events? I based the Text Object names off your visual logic screen capture, so if not, you might want to double check those names.

    When you tried switching back visual logic again, any chance you unchecked the Enable button on your visual logic tab when working with the script? That catches me from time to time going back and forth.

    ------------------------------
    Jeff Mayer
    Ross Video
    ------------------------------



  • 16.  RE: Previewing a script and visual logic on the same text line

    Posted 08-12-2021 01:23
    Jeff -
    I got this to work but I'm hung up on the spacing part.  It looks like I have to have a multiplier along with my offset.  How can I have both to adjust the spacing and x position of the company name?

    Thank you again for your help.

    ------------------------------
    Mark Stasiowski
    ------------------------------



  • 17.  RE: Previewing a script and visual logic on the same text line

    Posted 08-12-2021 02:44
    Mark -

    You can add * 1 to the script to act as your multiplier that matches your visual logic, but like Simon mentioned above, multiplying by 1 gives you the same number, so it's really not necessary (sometimes we'll multiply by -1 if we're working to move the Y Position down the scene, but in this case, moving your X Position to the right you don't need to.)


    Also Remember your Order of Operation from math anytime you do need to use more than one operator. Division is calculated before addition, so down the road if you need to add two values, then multiply that result, you'd need to use parenthesis to script that (a +b) * c.

    ------------------------------
    Jeff Mayer
    Ross Video
    ------------------------------