Graphics

 View Only
  • 1.  Scripting Examples?

    Posted 02-10-2012 20:34
    Does anybody have a script to change the AutoSqueezeWidth? I'm working on a scoreboard that has team ranks and names. However, if the team ranks are null, the width can increase. I thought I had it but I'm not sure if the script is part of one of the text containers or if it exists in a parent group.

    Thanks!

    Brian


  • 2.  RE: Scripting Examples?

    Posted 02-14-2012 04:03
    Brian,

    Download this example:

    Conditional Autosqueeze

    I'm using OnSetText for this example, so you'll find it by right clicking on the text box inside the viewport, and click "Edit Script Events"

    This script depends on the fact that both the Team Name and the Rank text box are in the same group. It also depends on the fact that the ranking is the object immediately below the team name.

    In the sequencer, you'll find 2 take items, showing that it works. Hope this helps.

    Chris Kelly

    #XPression


  • 3.  RE: Scripting Examples?

    Posted 02-14-2012 15:36
    Thanks Chris. I was so close before - at least I was on the right track!

    #XPression


  • 4.  RE: Scripting Examples?

    Posted 02-14-2012 16:19
    Yup. I first tried making the rank text box a child of the team name, and doing a GetParent. However, AutoSqueeze uses Transform-Scale to shrink. So when the team name squeezed, so did the ranking. That's why I had to split them apart.

    Chris

    #XPression


  • 5.  RE: Scripting Examples?

    Posted 02-14-2012 22:34
    Ok, I've got another one for you...how can a script call a text field alignment? I see the procedure SetTabAlign - I just don't know how to translate it. For my purposes, I have a script that if the text value is "0", then the alignment is left, and if the text value is "1", then the alignment is center.

    Thanks!

    Brian

    #XPression


  • 6.  RE: Scripting Examples?

    Posted 02-15-2012 06:35
    It's very similar to what I posted earlier. Essentially it's:

    If Text = 0 then

    Self.SetTabAlign(0, 0)

    Else If Text = 1 then

    Self.SetTabAlign(0, 2)

    End if

    SetTabAlign is a method for the TextObject. The first value is the tab that you're referencing. Remember, you can have multiple tabs in a text box. Also remember that the first item in a list is generally indexed at 0, rather than 1. So the first tab is 0. The second value is the alignment. 0 = left, 1 = right, and 2 = center. So by putting 0 and 0 in the parenthesis, you're saying the first tab should be left. 0 and 2 is first tab center.

    Hope that helps,

    Chris

    #XPression


  • 7.  RE: Scripting Examples?

    Posted 02-15-2012 13:36
    Chris - that helps a lot. Looking at the SDK help file I can see what methods are available but I don't know how they translate to a script. Now that I see the example(s), it definitely makes sense.

    Thanks again!

    Brian

    #XPression