Graphics

 View Only
Expand all | Collapse all

Animate 3D Object Live In Framebuffer

  • 1.  Animate 3D Object Live In Framebuffer

    Posted 08-23-2023 16:35

    Hello!

    I was wondering if anyone knew how to control a scene's Animation Controller from the Sequencer side of Xpression. I'd like to take a 3D model online to Framebuffer 1, then using scripts or Visual Logic, trigger certain parts of the animation such as rotating 90 degrees on the x-axis. I was able to get the below VL built, but unfortunately the model doesn't animate between the 6 rotations, it just jumps to them.

    I then made an Animation Controller to spin the model around, but I can't figure out how to affect "AnimController1" with a script on the Sequencer side of things.


    ------------------------------
    [Nick] [Kubinski]
    [Studio Production Specialist]
    [Sysmex America Inc.]
    [Vernon Hills] [USA]
    ------------------------------


  • 2.  RE: Animate 3D Object Live In Framebuffer
    Best Answer

    Ross Staff
    Posted 08-23-2023 17:14

    I would have a single scene director with the entire animation and then from scripts trigger the parts of the scene director you wish to trigger.

    For example.

    Dim sd as xpSceneDirector

    Scene.GetSceneDirectorByName("Spin", sd)

    sd.playrange(30, 90)

    which would play frames between 30 and 90. 

    let me know if you need logic beyond that and I can help. 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 3.  RE: Animate 3D Object Live In Framebuffer

    Posted 08-28-2023 15:46

    Thanks for the help Simon!

    I was able to get some additional control over the animation via the PlayDirection and Track.Enabled properties. I'm a little stuck with the PlayState and Continue properties though. I'm trying to use the same keyboard shortcut/GPI to continue the animation after it has hit the Pause event in the Scene Director. I know there's a Resume Channel function, but I won't be able to pair that with the reverse play direction.

    dim scene as xpScene
    dim sd as xpSceneDirector
    dim track as xpSceneDirectorTrack
    dim playState as PlayState
    engine.GetSceneByName("Scene1", scene)
    scene.GetSceneDirectorByName("Front to Front", sd)
    sd.GetTrackByName("90 Rotation", track)
    scene.SetOnline(0)
    sd.PlayDirection = 0
    track.Enabled = 1
    sd.PlayState()
    sd.Continue


    ------------------------------
    [Nick] [Kubinski]
    [Studio Production Specialist]
    [Sysmex America Inc.]
    [Vernon Hills] [USA]
    ------------------------------



  • 4.  RE: Animate 3D Object Live In Framebuffer

    Ross Staff
    Posted 08-29-2023 05:03

    personally I wouldn't use pause and resumes and things with scripting.

    I would create triggers for each part of the animation and just use playrange and trigger as required. 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 5.  RE: Animate 3D Object Live In Framebuffer

    Posted 08-29-2023 15:57

    Thanks Simon! Ok, so just using Playrange to trigger the various sections of the animation, here's what I've got.

    dim scene as xpScene
    dim sd as xpSceneDirector
    engine.GetSceneByName("Scene1", scene)
    scene.GetSceneDirectorByName("Cube Spin", sd)
    sd.PlayRange(0,50)
    scene.SetOnline(0)

    Also, I didn't know that PlayRange works in reverse too if you switch up the 2 values. I was able to delete the redundant "sd.Playdirection = 0" bit of code.



    ------------------------------
    [Nick] [Kubinski]
    [Studio Production Specialist]
    [Sysmex America Inc.]
    [Vernon Hills] [USA]
    ------------------------------



  • 6.  RE: Animate 3D Object Live In Framebuffer

    Ross Staff
    Posted 08-30-2023 04:21

    looks good, if the scene is already online you wouldn't need to set it online, you can pull it from the frame buffer instead. Let me know if that would be of interest. 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 7.  RE: Animate 3D Object Live In Framebuffer

    Posted 08-30-2023 11:41

    That would definitely be of interest. I tried removing "scene.SetOnline(0)" from any subsequent scripts, but then I don't see the animation play out in the Framebuffer.



    ------------------------------
    [Nick] [Kubinski]
    [Studio Production Specialist]
    [Sysmex America Inc.]
    [Vernon Hills] [USA]
    ------------------------------



  • 8.  RE: Animate 3D Object Live In Framebuffer

    Ross Staff
    Posted 08-30-2023 11:46

    yeah what your current script is doing is taking the original template online each time.

    What you can do instead is this, which would get a scene on layer 0 from your first framebuffer (0). This assume there is a scene online FB 1, layer 0. 

    dim channel as xpOutputFrameBuffer

    dim scene as xpScene

     

    Engine.GetOutputFrameBuffer(0, channel)

    channel.GetSceneOnLayer(0, scene)



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 9.  RE: Animate 3D Object Live In Framebuffer

    Posted 08-30-2023 14:26

    That works perfectly Simon. Thank you very much for all the help!

    dim scene as xpScene
    dim sd as xpSceneDirector
    dim channel as xpOutputFrameBuffer
    engine.GetOutputFrameBuffer(0, channel)
    engine.GetSceneByName("XN-550", scene)
    channel.GetSceneOnLayer(0, scene)
    scene.GetSceneDirectorByName("550 Spin", sd)
    sd.PlayRange(0,200)


    ------------------------------
    [Nick] [Kubinski]
    [Studio Production Specialist]
    [Sysmex America Inc.]
    [Vernon Hills] [USA]
    ------------------------------



  • 10.  RE: Animate 3D Object Live In Framebuffer

    Ross Staff
    Posted 08-30-2023 14:44

    you can lose this line. 

    engine.GetSceneByName("XN-550", scene)


    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 11.  RE: Animate 3D Object Live In Framebuffer

    Posted 08-31-2023 12:46

    Ah ok, because we're already calling up the SceneDirector attached to that scene.



    ------------------------------
    [Nick] [Kubinski]
    [Studio Production Specialist]
    [Sysmex America Inc.]
    [Vernon Hills] [USA]
    ------------------------------



  • 12.  RE: Animate 3D Object Live In Framebuffer

    Ross Staff
    Posted 09-01-2023 04:16

    you're getting a copy of the scene from the buffer here;

    channel.GetSceneOnLayer(0, scene)

    and calling it the same so you are grabbing the template with this

    engine.GetSceneByName("XN-550", scene)

    but then straight after you get the copy from the buffer and also called it "scene" so you're replacing it anyway. 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------