Graphics

 View Only
  • 1.  XPression Events not fired

    Posted 06-03-2016 14:11
    Hello,

    I posted this question first on stackoverflow.com, but I'd like to ask here too. I'm trying to add listeners to a scene in a Ross XPression project. When I press the '+' button on my keyboard while selecting a scene in XPression Developer I expect something to be written to the console.
    Here's the output from console:
    scene.Name == Opener
    scene.AnimControllerCount == 2
    animController.Name == AnimController1
    animController.Name == Rotate


    And here is my code:

    using System;
    using System.Windows;
    using XPression;

    namespace mynamespace
    {
    public partial class MainWindow : Window
    {
    private xpEngine engine;
    private xpProject project;
    private xpScene scene;
    private xpAnimController animController1;
    private xpAnimController animController2;
    public MainWindow()
    {
    InitializeComponent();
    engine = new xpEngine();
    project = engine.ActiveProject;
    if (project.GetSceneByName("Opener",out scene))
    {
    Console.WriteLine("scene.Name == " + scene.Name);
    scene.OnSceneState += Scene_OnSceneState;
    scene.SceneDirector.OnSceneDirectorState += SceneDirector_OnSceneDirectorState;

    Console.WriteLine("scene.AnimControllerCount == " + scene.AnimControllerCount);
    if (scene.GetAnimController(0, out animController1))
    {
    Console.WriteLine("animController.Name == " + animController1.Name);
    animController1.OnStateChange += AnimController_OnStateChange;
    }
    if (scene.GetAnimController(1, out animController2))
    {
    Console.WriteLine("animController.Name == " + animController2.Name);
    animController2.OnStateChange += AnimController_OnStateChange;
    }
    }

    }

    private void SceneDirector_OnSceneDirectorState(xpSceneDirector Director, SceneDirectorState State)
    {
    Console.WriteLine("Director: " + Director.Name + " State: " + State);
    }

    private void Scene_OnSceneState(xpScene Scene, int State)
    {
    Console.WriteLine("Scene: " + Scene.Name + " State: " + State);
    }

    private void AnimController_OnStateChange(xpAnimController Controller, PlayState State)
    {
    Console.WriteLine("Controller: " + Controller.Name + " State: " + State);
    }

    }
    }


    As you can see from the output, the events are not fired. Why is that? I would appreciate any help.


  • 2.  RE: XPression Events not fired

    Posted 06-04-2016 03:27
    How are you putting the scene online? The sequencer makes it's own copy of the scene so that will not be the one you registered your events on.
    Also, the GetSceneByName makes its own copy of the scene (unless you pass False as the third parameter), so again the one you register the events on is probably not the same one you are putting online.

    In your code after GetSceneByName, try putting it online right then and there with scene.SetOnline() and then after registering your events on it try playing that scenes main scene director and you should see your event fire.
    #XPression


  • 3.  RE: XPression Events not fired

    Posted 06-04-2016 09:49
    Thank you bford for your reply! I am using the sequencer in XPression Developer. By selecting the scene and pressing '+' I activate it. As you mention, the sequencer makes its own copy of the scene, so that means that I can not listen for events using this approach. What I want to achieve is write a .NET app that listens for state changes in the scenes in the sequencer. I know about the 'asrun' logs, but this is not good enough because these logs are not written as they happen.
    #XPression


  • 4.  RE: XPression Events not fired

    Posted 06-04-2016 12:49
    There is an event you can hook up to in xpOutputFramebuffer which should tell you any time a scene goes on-air. That may be able to achieve what you are looking for.

    #XPression


  • 5.  RE: XPression Events not fired

    Posted 06-06-2016 07:00

    What event is that? No members of xpOutputFrameBuffer are Events: 


    #XPression


  • 6.  RE: XPression Events not fired

    Posted 06-06-2016 07:22
    What version are you with ? There are 2 events that are [I]OnClear[/I] and [I]OnSceneState.[/I]
    #XPression


  • 7.  RE: XPression Events not fired

    Posted 06-06-2016 07:27

    This is what's in the About window in Ross XPression Developer: 


    #XPression


  • 8.  RE: XPression Events not fired

    Posted 06-06-2016 07:40
    Since version 6.1 build 3406 :

    • [implemented] xpOutputFrameBuffer objects can now trigger the OnSceneState event when scene going on/offline
    • [implemented] xpOutputFrameBuffer objects can now trigger the OnClear event when the framebuffer is cleared

    I would recommend contacting techsupport@rossvideo.com.

    #XPression


  • 9.  RE: XPression Events not fired

    Posted 06-06-2016 08:46
    Thank you very much! My code works: using System;
    using System.Windows;
    using XPression;

    namespace mynamespace
    {
    public partial class MainWindow : Window
    {
    private xpEngine engine;
    private xpOutputFrameBuffer outputFrameBuffer;
    public MainWindow()
    {
    InitializeComponent();
    engine = new xpEngine();
    if (engine.GetOutputFrameBuffer(0, out outputFrameBuffer))
    {
    outputFrameBuffer.OnSceneState += OutputFrameBuffer_OnSceneState;
    }
    }

    private void OutputFrameBuffer_OnSceneState(xpScene Scene, int State)
    {
    Console.WriteLine("Scene: " + Scene.Name + " State: " + State);
    }
    }
    }


    Output:
    Scene: Opener State: 0
    Scene: Opener State: 1

    #XPression


  • 10.  RE: XPression Events not fired

    Posted 06-06-2016 18:56
    Yeah ! :)
    #XPression