Graphics

 View Only
  • 1.  GetMaterial quietly failing... sometimes

    Posted 10-06-2015 01:31
    Hello! I'm in the middle of making a new graphics package for my broadcast team, and I've noticed a weird quirk in XPression. I have two scenes. In the first scene, there are four quads named "Quad1" through "Quad4". I have two scene directors. The first scene director is the main scene director for the first scene. The second scene director has a script in position 1 with the code:

    ' Get Scene 2 found on layer 2 of framebuffer 1

    dim framebuff1 as xpOutputFrameBuffer

    dim scene2 as xpScene

    if(Engine.GetOutputFrameBuffer(0, framebuff1))

    if(not framebuff1.GetSceneOnLayer(2, scene2))

    ' Scene 2 is not online

    Engine.DebugMessage("Scene2 is offline", 1)

    end if

    else

    Engine.DebugMessage("Framebuffer not found!", 2)

    end if

    ' Update the text

    dim scene2text1 as xpTextObject

    if(scene2.GetObjectByName("Text1", scene2text1))

    scene2text1.Text = "True"

    else

    Engine.DebugMessage("scene2text1 not found!", 2)

    end if


    The first scene has this script in the OnSceneOnline:

    dim scenedirector2 as xpSceneDirector

    if(Self.GetSceneDirectorByName("SceneDirector2", scenedirector2))

    scenedirector2.PlayRange(0,2)

    else

    Engine.DebugMessage("scenedirector 2 not found!", 2)

    end if


    The second scene has four quads named "Quad1" through "Quad4" with published materials in a group with no visibility. There is a text object named "Text1" with this script in the OnSetText:

    ' Get Scene 1 found on layer 1 of framebuffer 1

    dim framebuff1 as xpOutputFrameBuffer

    dim scene1 as xpScene

    if(Engine.GetOutputFrameBuffer(0, framebuff1))

    if(not framebuff1.GetSceneOnLayer(1, scene1))

    ' If the scene is not online, take this scene offline

    Engine.DebugMessage("Scene1 is offline", 1)

    Self.Offline()

    end if

    else

    Engine.DebugMessage("Framebuffer not found!", 2)

    end if

    ' Set up the variables

    dim quad1 as xpQuadObject

    dim quad2 as xpQuadObject

    dim quad3 as xpQuadObject

    dim quad4 as xpQuadObject

    dim mat1 as xpMaterial

    dim mat2 as xpMaterial

    dim mat3 as xpMaterial

    dim mat4 as xpMaterial

    dim scene1quad1 as xpQuadObject

    dim scene1quad2 as xpQuadObject

    dim scene1quad3 as xpQuadObject

    dim scene1quad4 as xpQuadObject

    ' Get the first quad object in the scene

    if(Scene.GetObjectByName("Quad1", quad1))

    quad1.GetMaterial(0, mat1)

    ' Find the quad on scene 1 and push the material

    if(scene1.GetObjectByName("Quad1", scene1quad1))

    scene1quad1.SetMaterial(0, mat1)

    else

    Engine.DebugMessage("scene1quad1 not found!", 1)

    end if

    else

    Engine.DebugMessage("quad1 not found!", 2)

    end if

    if(Scene.GetObjectByName("Quad2", quad2))

    quad2.GetMaterial(0, mat2)

    ' Find the quad on scene 1 and push the material

    if(scene1.GetObjectByName("Quad2", scene1quad2))

    scene1quad2.SetMaterial(0, mat2)

    else

    Engine.DebugMessage("scene1quad2 not found!", 1)

    end if

    else

    Engine.DebugMessage("quad2 not found!", 2)

    end if

    if(Scene.GetObjectByName("Quad3", quad3))

    quad3.GetMaterial(0, mat3)

    ' Find the quad on scene 1 and push the material

    if(scene1.GetObjectByName("Quad3", scene1quad3))

    scene1quad3.SetMaterial(0, mat3)

    else

    Engine.DebugMessage("scene1quad3 not found!", 1)

    end if

    else

    Engine.DebugMessage("quad3 not found!", 2)

    end if

    if(Scene.GetObjectByName("Quad4", quad4))

    quad4.GetMaterial(0, mat4)

    ' Find the quad on scene 1 and push the material

    if(scene1.GetObjectByName("Quad4", scene1quad4))

    scene1quad4.SetMaterial(0, mat4)

    else

    Engine.DebugMessage("scene1quad4 not found!", 1)

    end if

    else

    Engine.DebugMessage("quad4 not found!", 2)

    end if


    The first scene is on layer 1, and the second scene is on layer 2. Basically what should be happening is the first scene goes online and waits for another scene to come online. When it does, it fires SceneDirector2 which executes a script to update the text in the second scene. When the text is updated in the second scene, it gets the materials of all four quads and then sets the materials of the four quads in the first scene.

    In the sequencer list, I have one copy of the first scene and two copies of the second scene with different colors for each quad in both of the scenes. If I put the first scene online then put the first copy of the second scene online, everything works the way it should. If I then take the first copy of the second scene offline then put the second copy of the second scene online, everything still works correctly. However, If I put the first scene online, put the first copy of the second scene online, and then take the second copy of the second scene online (taking the first copy of the second scene offline since they are on the same layers), only the first quad gets its material updated. Even weirder, if I repeat taking the second copy of the second scene offline then online, the quads update their materials one at a time.

    I've put Engine.DebugMessages all around my code and the script seems to just stop at the GetMaterial command. No errors are thrown. I am running XPression 6.0 build 3318. Is there anything I am doing wrong or is this a bug in XPression? If it is a bug in XPression, how do I report it?

    Let me know if I need to upload my project.

    Thank you!


  • 2.  RE: GetMaterial quietly failing... sometimes

    Posted 10-06-2015 19:28
    `Self.Offline()` does not look correct.. In OnSetText, doesn't Self represent the text object? There is no function called Offline().

    #XPression


  • 3.  RE: GetMaterial quietly failing... sometimes

    Posted 10-25-2015 03:29
    Hi Brian,

    Thanks for your quick reply. Sorry my reply has taken so long.

    I have changed Self.Offline() to Scene.Offline() and my problem still persists. Any other ideas?

    Thanks again!

    #XPression


  • 4.  RE: GetMaterial quietly failing... sometimes

    Posted 10-25-2015 14:04
    There is no function called Offline(). It should be SetOffline(). There might be more wrong too, that's just what caught my eye at first.

    #XPression