Graphics

 View Only
  • 1.  Script Pivot Center

    Posted 09-23-2013 17:51
    Is there a function or a way to execute the centering of a text objects pivot on all or certain axis?

    I'm pulling data from cells in a spreadsheet and I'd like to have a script run that automatically centers the text object on the screen. The height of the text object varies as word wrap is enabled. So, center Y pivot (or all) then set Y pos to 0 (text object is in a group) I understand the basics of the scripting just lacking the syntax knowledge to accomplish this.

    Any help would be awesome sauce.

    thanks!


  • 2.  RE: Script Pivot Center

    Posted 09-23-2013 19:17
    Chris,

    Can't you use a center aligned tab on the text object?

    Although I think I'm misinterpreting your question, sounds like your trying to do something pretty cool :)

    #XPression


  • 3.  RE: Script Pivot Center

    Posted 09-23-2013 19:30
    Tabs obviously are great for horizontal alignment. I want the text object to be centered vertically on the screen automatically depending how many lines of text there are. Make sense? I'm trying to do something like this but I know I'm wrong somewhere.

    dim text1 as xpBaseObject

    dim height

    scene.GetObjectByName ("Message1",text1)

    height = text1.GetTextHeight(text)

    If Len(text) > 0 then

    text1.PivotY = height/2

    text1.PosY = 0

    end if

    #XPression


  • 4.  RE: Script Pivot Center

    Posted 09-23-2013 19:56
    Hey Chris this should do it.

    You will want to paste this script onOnline and onPreview render.

    you will want to replace the text object name with your object name and you may want to change the 540 value to a value that represents the center of your scene since it may not be 1080.

    dim text as xpTextObject

    dim height as integer

    Self.GetObjectByName("Text1", text)

    height = text.boundingbox.height

    text.posY = height / 2 + 540

    #XPression


  • 5.  RE: Script Pivot Center

    Posted 09-23-2013 20:29
    Chris

    Just looking back at the thread. do you need this to react on air? Is the text changing while the scene is online? We may need to do this differently if that is the case.

    #XPression


  • 6.  RE: Script Pivot Center

    Posted 09-23-2013 20:33
    No this is assembled before putting to air. I had to change the 540 because the text is parented to a group so the coords are different. This should work nicely though! There will be aprox 30 text objects in the scene so I just have to do some copy and paste.

    #XPression


  • 7.  RE: Script Pivot Center

    Posted 09-23-2013 20:34
    you got it!

    #XPression


  • 8.  RE: Script Pivot Center

    Posted 10-02-2013 15:30
    I wanted to use this script

    It worked on my development system (preview and virtual output)

    But when I brought to Studio (with BlackMagic video card) it worked on preview not on Blackmagic

    Any ideas

    #XPression