Graphics

 View Only
Expand all | Collapse all

Matching frame in animation

  • 1.  Matching frame in animation

    Posted 02-14-2013 19:22
    Does anyone know how to do this?

    I have an animation that runs in a template. When I call up a second template, the same animation is on that template as well. I need the second template to match the point in the animation that the first template is at when the second template goes online so there isn't a jump in the animation. I'm confident this can be done, but I'm not sure how to do it.

    Thanks for any input.


  • 2.  RE: Matching frame in animation

    Posted 02-14-2013 19:31
    Hi,

    It definitely can be done:

    Dim MyScene1 as xpScene

    Dim MyScene2 as xpScene

    Engine.getSceneByName("Scene1", MyScene1)

    Engine.getSceneByName("Scene2", MyScene2)

    MyScene2.SceneDirector.Position = MyScene1.SceneDirector.Position

    MyScene2.SceneDirector.Play

    Best regards,

    Kenneth

    #XPression


  • 3.  RE: Matching frame in animation

    Posted 02-14-2013 19:50
    Thank you!

    #XPression


  • 4.  RE: Matching frame in animation

    Posted 02-14-2013 23:57
    Ok, that works when I know what the scene is going to be that's online. How do I make it variable? The online scene might one of several scenes using the same animation, or it may even be the same scene being used again back-to-back. That probably makes it a bit more complicated, and I should have been more clear in my original post, but I wasn't thinking through the different possibilities.

    Thanks!

    #XPression


  • 5.  RE: Matching frame in animation

    Posted 02-15-2013 01:41
    It's not that complicated as you might think.

    I changed the names of the Scenes of the above example to make it more understandable.

    Dim Fb As xpOutputFrameBuffer

    Dim OnairScene as xpScene

    Dim NewScene as xpScene

    Engine.GetOutputFrameBuffer 0, Fb 'replace the 0 with the number of your framebuffer

    Fb.GetSceneOnLayer 0, OnairScene 'replace the 0 with the number of the layer where the first scene is on

    Engine.getSceneByName("Scene2"³, NewScene)

    NewScene.SceneDirector.Position = OnairScene.SceneDirector.Position

    NewScene.SceneDirector.Play

    Best regards,

    Kenneth

    #XPression


  • 6.  RE: Matching frame in animation

    Posted 02-20-2013 19:26
    This is what I have in the script. It's still not working. Each time I launch the scene, the animation starts over at the beginning. Any ideas on what I'm doing wrong?

    Dim Fb As xpOutputFrameBuffer

    Dim OnairScene as xpScene

    Dim NewScene as xpScene

    Engine.GetOutputFrameBuffer(1,Fb)

    Fb.GetSceneOnLayer(0, OnairScene)

    Engine.getSceneByName("Sidebar Left Still", NewScene)

    NewScene.SceneDirector.Position = OnairScene.SceneDirector.Position

    NewScene.SceneDirector.Play

    #XPression


  • 7.  RE: Matching frame in animation

    Posted 02-20-2013 19:50
    Hi,

    Are you getting any error messages when you compile the script?

    I'm asking because I see that in the example that I sent you I've put GetOutputFrameBuffer(), and the first letter should be lowercase; so getOutputFrameBuffer(). The same applies to getSceneOnLayer().

    However, I don't think that's the problem.

    When I get home, I'll give it a try and see what happens.

    #XPression


  • 8.  RE: Matching frame in animation

    Posted 02-20-2013 22:01
    I do not get an error message when compiling the script. Changing it to lowercase doesn't have any effect on it either.

    #XPression


  • 9.  RE: Matching frame in animation

    Posted 02-20-2013 23:07
    Where do you write this code ?

    If it's in the script editor, please use "self" :

    Remove :

    Engine.getSceneByName("Sidebar Left Still", NewScene)

    And change

    NewScene.SceneDirector.Position = OnairScene.SceneDirector.Position

    With :

    Self.SceneDirector.Position = OnairScene.SceneDirector.Position

    #XPression


  • 10.  RE: Matching frame in animation

    Posted 02-20-2013 23:29
    I am putting the script in the Script Editor, under OnOnline.

    I made the changes you suggested, and it still doesn't work properly. The animation continues to restart back at the beginning when the scene is launched.

    #XPression


  • 11.  RE: Matching frame in animation

    Posted 02-21-2013 13:48
    If I understand your code, you have a Xpression Studio with 2 fill... And "OnairScene" is on second fill. Is right ?

    #XPression


  • 12.  RE: Matching frame in animation

    Posted 02-21-2013 19:00
    Vincent was right, it's better to use the self instead of declaring the engine and the scene seperately.

    However, it seems that the built in Scriptingengine only performs the methods when the scene is already online.

    So in other words, because the scene itself is already online, it's starting your scenedirector from zero every time again. Because the former scene is already unloaded.

    Basically we would need an OnBeforeOnline-event where we could put in this code for it to work.

    So sorry for the bad news.

    Note that this code will work if you are using the API, but I'm not sure if that is a possibility?

    Kind regards,

    Kenneth

    #XPression