Graphics

 View Only
  • 1.  Querying bounding boxes via scripting

    Posted 05-20-2025 18:16

    Hello there!

    I'm trying to fetch a text object's Bounding Box Width through the scripting interface.

    Currently, I'm circumventing that using Visual Logic by plugging that to a dummy text object called "test". But I want to avoid making those dummy texts for a type of data that I think I should be able to get from the scripting interface itself.

    I saw a "dispatch interface" on the documentation named IxpBoundingBox that may be a part of the puzzle, but I have no idea how to approach it. This is what I got so far:

    The highlighted line is where the code dies, even though it compiles.

    Thanks in advance!



    ------------------------------
    Victor Alexis
    São Paulo Brazil
    ------------------------------


  • 2.  RE: Querying bounding boxes via scripting

    Posted 05-21-2025 09:49

    The xpBoundingBox object has Height, Depth and Width members, so the property you'd be looking for would be BoundingBox.width. 

    You can also use OnlineBoundingBox.width to return the same value as WidthScaled when you're using word wrap, auto squeeze, etc.. This matches the BoundingBox.WidthScaled property in Visual logic.

    For your script, you shouldn't need the "num as double" variable. You can use query.OnlineBoundingBox.width wherever you'd need that value as a double.



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



  • 3.  RE: Querying bounding boxes via scripting

    Posted 05-21-2025 12:46

    That worked perfectly, thank you!
    I'm now moving on to another step and just hit another wall if you'd be so kind to share some thoughts as well.

    I have two different scenes set on transition logic to use a specific in/out scene director with a matching condition.

    That said, I'm creating keyframes using both scene's OnBeforeOnline using the width of the bounding boxes to define start/end keyframes.

    I would love to be able to fetch the first scene's Text.BoundingBox.Width and use that to set the initial keyframes of the incoming second scene. I'm struggling to be find a way to reach the first scene, given that it could be a lot of options and can't necessarily lock a scene name to the script.

    I can maybe illustrate what I'm trying to achieve better if that's not clear.

    Thanks once again!



    ------------------------------
    Victor Alexis
    São Paulo Brazil
    ------------------------------



  • 4.  RE: Querying bounding boxes via scripting

    Posted 05-21-2025 14:44

    Since you're using the OnBeforeOnline event, the script will have knowledge of the FramebufferIndex and Layer. You can use those values get the current scene already in that layer.

    Here's a script I've used to fetch the text object of the online scene, no matter its name:

    'Get Scene on Output
    Dim FB as xpOutputFrameBuffer
    Dim OnlineScene as xpScene
    Engine.GetOutputFrameBuffer(FramebufferIndex,FB)
    FB.GetSceneOnLayer(Layer,OnlineScene)
    
    'Get Online Scene's Bar Group and L3 Text
    Dim OnlineText as xpTextObject
    OnlineScene.GetObjectByName("Text1",OnlineText)
    
    



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



  • 5.  RE: Querying bounding boxes via scripting

    Posted 05-22-2025 11:38

    Hey everyone!
     Jeff, I would add a couple of lines to your script to check if any scene is running on the current layer and if so, whether the online scene and the startup scene are the same (so that the script doesn't crash).

            'Get Scene on Output
            Dim FB As xpOutputFrameBuffer
            Dim OnlineScene As xpScene
            engine.GetOutputFrameBuffer(FramebufferIndex, FB)
            If FB.GetSceneOnLayer(Layer, OnlineScene) Then
                If self.Name = OnlineScene.Name Then
                    'Get Online Scene's Bar Group and L3 Text
                    Dim OnlineText As xpTextObject
                    OnlineScene.GetObjectByName("Text1", OnlineText)
                End If
            End If



    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------