Graphics

 View Only
  • 1.  [Question] How do you affect a live scene via api?

    Posted 04-05-2018 18:25
    Hello,

    I've been running into a few problems with xpression API.

    I'm attempting to change the values of different objects in a scene, but it seems like I'm not able to affect the scene when it's taken, but I can change some things in the layout view.

    Specifically, I'm trying to play out an xpAnimController from excel. Nothing seems to work (but if I place the script in a scene director, it seems to work?)

    My code:

    Public Sub PlayAnimRange(Name As String, scenename As String, scene As xpScene, RangeStart As Double, RangeEnd As Double)
    'Plays an already existing xpAnimController by name
    Dim anim As xpAnimController
    Engine.GetSceneByName scenename, scene, False
    scene.GetAnimControllerByName Name, anim
    Engine.DebugMessage anim.Name, mt_Notify
    anim.PlayRange RangeStart, RangeEnd
    anim.Play
    Engine.DebugMessage RangeEnd, mt_Notify
    End Sub

    This is being called via macro in excel
    Debugmessage confirms that I can grab objects, but neither anim.Play or anim.PlayRange seems to do anything.
    ditto for scene directors, and updating text.

    I know I can accomplish this if I do something like dashboard or datalinq (trigger script via onset text), but I'm attempting to bypass datalinq entirely (we're testing all excel workflows).
    It seems like if I call methods outside of certain areas of xPression, they seem to not work? Why is this the case?
    Is there no way to affect data directly outside of XPression via script?


  • 2.  RE: [Question] How do you affect a live scene via api?

    Posted 04-05-2018 19:14

    I do a similar thing by triggering scene directors when scenes are online. To affect an online scene you have to get the online scene by calling the framebuffer, then layer, then get scene. I created a loop awhile back which searches through both Framebuffers and layers -5 - 5 and check if it is a LowerThird by comparing the scene name to my known Lower third naming convention.
    Not sure exactly what you're going for, but this works for me. You may want to comment it out a bit more with debugmessages if it isnt working. Also, I have the following code in a GPI.

    Hope this helps.


    dim Output as xpOutputFrameBuffer
    dim Scene as xpScene
    dim IsScene as boolean
    IsScene = False

    for i as integer = 0 to 1
    if engine.GetOutputFrameBuffer(i,Output) = true then
    for o as integer = -5 to 5
    if Output.GetSceneOnLayer(o,Scene) = true then
    ' check if it is the scene name you are looking for
    if not Scene.Name.Contains("LowerThird-") then
    continue for
    else
    IsScene = True
    exit for
    end if
    end if
    next
    end if
    ' If Scene is true, we can exit
    if IsScene = True then
    Exit for
    end if
    next

    ' If we have no Scene, leave the Sub
    if IsScene = false then
    Exit Sub
    end if
    ' if we do have a scene, you can now access scene directors and animation controller through the Scene object

    #XPression


  • 3.  RE: [Question] How do you affect a live scene via api?

    Posted 04-05-2018 20:14
    I do a similar thing by triggering scene directors when scenes are online. To affect an online scene you have to get the online scene by calling the framebuffer, then layer, then get scene. I created a loop awhile back which searches through both Framebuffers and layers -5 - 5 and check if it is a LowerThird by comparing the scene name to my known Lower third naming convention.
    Not sure exactly what you're going for, but this works for me. You may want to comment it out a bit more with debugmessages if it isnt working. Also, I have the following code in a GPI.

    Hope this helps.


    dim Output as xpOutputFrameBuffer
    dim Scene as xpScene
    dim IsScene as boolean
    IsScene = False

    for i as integer = 0 to 1
    if engine.GetOutputFrameBuffer(i,Output) = true then
    for o as integer = -5 to 5
    if Output.GetSceneOnLayer(o,Scene) = true then
    ' check if it is the scene name you are looking for
    if not Scene.Name.Contains("LowerThird-") then
    continue for
    else
    IsScene = True
    exit for
    end if
    end if
    next
    end if
    ' If Scene is true, we can exit
    if IsScene = True then
    Exit for
    end if
    next

    ' If we have no Scene, leave the Sub
    if IsScene = false then
    Exit Sub
    end if
    ' if we do have a scene, you can now access scene directors and animation controller through the Scene object

    Hi Mike,

    Brilliant. Never occured to me that I had to access the framebuffer to access the scene. Thanks!
    #XPression