Graphics

 View Only
  • 1.  Auto-Squeeze: Needing to match the sizes.

    Posted 12-31-2018 16:42
    Hey, everyone! Happy New Year's Eve!

    Got a problem I've been trying to solve in the visual logic editor...

    I have a dual lower third with set constraints for the size of the text. If one name is longer, it will shrink, If the other is shorter, it'll remain the same size. Trying to get both of these to match regardless of the individual sizes if one of the fields happens to hit that auto-squeeze cap.

    Would appreciate any guidance! Thanks!

    -JJ


  • 2.  RE: Auto-Squeeze: Needing to match the sizes.

    Posted 01-23-2019 18:46
    bump!
    #XPression


  • 3.  RE: Auto-Squeeze: Needing to match the sizes.

    Posted 01-24-2019 11:56
    are they on 2 differents scenes ?
    #XPression


  • 4.  RE: Auto-Squeeze: Needing to match the sizes.

    Posted 01-24-2019 16:00

    Nope. Same scene. Here is a pic of one of my lower thirds. Amanda's name has had many "spaces" added on the end of it to scale it down to MacLeod. The bounding boxes are set and if I were not doing this, Amanda's name would appear much larger as it is not as long. My crew would like this to happen automatically as they don't enjoy needing to add spaces to dual lower thirds that are not preset such as this one.


    #XPression


  • 5.  RE: Auto-Squeeze: Needing to match the sizes.

    Posted 02-12-2019 18:56

    Hi,
    Interesting question as it's not a common thing ;-)

    Usually when you put two lines of text in a textfield where one line is longer than the other, everything scales when using the autosqueeze-function which is not always what you want.

    However, in this case I see what you mean and I understand why you want to do it.

    In order to make this happen, we actually can't use the autosqueeze function in XPression and we need to build our own autosqueeze function, so make sure you disable the autosqueeze.

    In the attached image you will see the visual logic for it.

    Just some explanation on the principle of what we need to do:

    First we need to specify the maximum width that the text is allowed to be.
    Then we need to put in the text in the two textfields and see if one (or both) of the texts are exceeding the maximum width. Now you can do that by checking if the size is larger than the maximum width and then add logic to specify which one is longer etc...
    However you can take a shortcut by just dividing the maximum width by the actual width of the text.
    This will give you a value which is actually the scale that you would need to match the maximum width. When the scale is smaller then 1, the text is longer than the maximum textwidth and should be squeezed. When the scale is bigger than 1, then the text is shorter and should remain as it is.

    By calculating the scale for both texts, you can then determine which is the longest text (to which the other text-field should adapt). This text will have the smallest scale.
    So by applying the smallest scale to both of the textfields, both texts will be equal in height.

    However there is a problem, because when both texts are smaller than the maximum textwidth, the scales will be larger than 1, which would mean that the texts are made bigger to match the maximum text width. So to avoid that we need to implement a condition that says that the scale can only be applied when the scale is smaller than 1. When it's bigger than 1, the scale should remain 1.

    So with that information you can now have a look at the Visual Logic below.



    Description:
    BoundingBox.Width: this block gets the actual size of the text which we need to compare against the maximum textwidth allowed

    Value: this is where I specify the maximum width which is allowed for the text

    Divide: I use this block to calculate the scale for both textfields (MAX TEXT WIDTH / ACTUAL TEXT WIDTH) When the value is smaller than 1, the ACTUAL TEXT WIDTH is larger than the allowed text width.

    Smaller Than-block: Since we need to adjust to the longest text, I need to find the smallest scale of the two texts. In this case, by using the Smaller Than-block, I can check if the second text-scale is smaller then the first text-scale. If this is the case the output of the Smaller Than-block will be 1. If it's not the case, the output will be 0.

    Input Selector: Using the output of the Smaller Than block I can determine which scale should be used. So if the ouput of the Smaller Than block is 0 (meaning the first textfield is the longest), the scale of the first textfield will be sent to the output of the Input Selector. If the output of the Smaller Than block is 1, the scale of the second textfield will be sent to the output of the Input Selector.
    This output could be sent directly to the X&Y-scale of both text-fields but when both texts are smaller than the maximum textwidth, it would increase the size of the text.
    This is why there is another part in the Visual Logic that controls when the textfields should be scaled.

    Value: this block holds the default value of the text-scale for when the text is smaller than the maximum width. This should be 1.

    Smaller Than-block: By using this block, I can check if the scale coming out of the Input Selector is smaller than the default value (1). If this is the case, then the output of the Smaller Than-block will be 1. If not, the output will be 0.

    Input Selector: Using the output of the Smaller Than block I can determine which scale should be used. So if the ouput of the Smaller Than block is 0 (meaning the scale is bigger than 1), the default scale will be sent to the output of the Input Selector. If the output of the Smaller Than block is 1, then the calculated scale of the Input Selector on the top will be sent to the output of the Input Selector.

    The output of the Input Selector is then sent to the X&Y-scales of both text-fields.

    Good luck!

    Kenneth


    #XPression


  • 6.  RE: Auto-Squeeze: Needing to match the sizes.

    Posted 02-12-2019 21:32
    Hey, Kenneth!

    Thanks so much, man. I couldn't figure this out for the life of me.

    Everything works up until when I push it into my sequencer. The lower third starts glitching out. I can't take a capture of it, because it is flickering between being scaled down, and being a normal size. But, that is exactly what is happening. It is shaking between the two forms, every frame. Likely a bug with Ross as your logic works fine when I'm building. But, nevertheless... Any suggestions?
    #XPression


  • 7.  RE: Auto-Squeeze: Needing to match the sizes.

    Posted 02-12-2019 23:31
    good work cainnech !

    @icingo44 : are you using boudingbox.WidthScaled instead of boudingbox.Width ? This can explain the flicker each frame.
    #XPression


  • 8.  RE: Auto-Squeeze: Needing to match the sizes.

    Posted 02-13-2019 14:37
    That was exactly my problem, Amignon. Thanks a ton!

    Kenneth, you rule. I owe you!
    #XPression