Graphics

 View Only
  • 1.  Assigning a Video Material to a Quad through Scripting

    Posted 5 hours ago

    Hey there! I'm trying assign a video material using a quad through a script. The scene that I've built shows the headshots of players in the starting lineup. I've been able to set everything up through datalinq and visual logic, and the last thing I need is to do is take the player's numbers, and call upon their associated material. I have already accomplished this through Dynamic Materials, however, there was typically a second or two where my placeholder clip would show up on air, before hard cutting to the correct material. I think this is happening because of Xpression's order of operations (i.e. Visual logic doesn't run until the scene is online, so by the time it reassigns my text object with the jersey number in it, then get's sent over to the Dynamic Material path with the text object macro in it, it's already too late and it hard cuts to a different vid on air). Because of this, I resorted to trying to assign the materials through scripting in the OnPrepare event, in an attempt to load up the headshots before the scene even hits the framebuffer.

    The issue I've been running into now, is that my scene just shows nothing in the framebuffer; a blank quad. I tried putting my placeholder material back onto the quad, and it just shows the placeholder. I've included my script below, but please feel free to let me know if you have any suggestions! Thanks!

    Dim P1Num as xpTextObject
    Dim P2Num as xpTextObject
    Dim P3Num as xpTextObject
    Dim P4Num as xpTextObject
    Dim P5Num as xpTextObject
    Dim dbg as xpTextObject
    
    Dim P1Vid as xpBaseObject
    Dim P2Vid as xpBaseObject
    Dim P3Vid as xpBaseObject
    Dim P4Vid as xpBaseObject
    Dim P5Vid as xpBaseObject
    
    Dim mat1 as xpMaterial
    Dim mat2 as xpMaterial
    Dim mat3 as xpMaterial
    Dim mat4 as xpMaterial
    Dim mat5 as xpMaterial
    
    Self.GetObjectByName("P1 Num", P1Num)
    Self.GetObjectByName("P2 Num", P2Num)
    Self.GetObjectByName("P3 Num", P3Num)
    Self.GetObjectByName("P4 Num", P4Num)
    Self.GetObjectByName("P5 Num", P5Num)
    
    Self.GetObjectByName("P1 Vid", P1Vid)
    Self.GetObjectByName("P2 Vid", P2Vid)
    Self.GetObjectByName("P3 Vid", P3Vid)
    Self.GetObjectByName("P4 Vid", P4Vid)
    Self.GetObjectByName("P5 Vid", P5Vid)
    
    Self.GetObjectByName("DEBUG", dbg)
    
    dbg.Text = "START"
    
    Engine.GetMaterialByName(P1Num.Text & "_Video", mat1)
    Engine.GetMaterialByName(P2Num.Text & "_Video", mat2)
    Engine.GetMaterialByName(P3Num.Text & "_Video", mat3)
    Engine.GetMaterialByName(P4Num.Text & "_Video", mat4)
    Engine.GetMaterialByName(P5Num.Text & "_Video", mat5)
    
    dbg.Text = "Vid Assign"
    
    If Not P1Vid Is Nothing AndAlso Not mat1 Is Nothing Then P1Vid.SetMaterial(0, mat1)
    If Not P2Vid Is Nothing AndAlso Not mat2 Is Nothing Then P2Vid.SetMaterial(0, mat2)
    If Not P3Vid Is Nothing AndAlso Not mat3 Is Nothing Then P3Vid.SetMaterial(0, mat3)
    If Not P4Vid Is Nothing AndAlso Not mat4 Is Nothing Then P4Vid.SetMaterial(0, mat4)
    If Not P5Vid Is Nothing AndAlso Not mat5 Is Nothing Then P5Vid.SetMaterial(0, mat5)
    
    dbg.Text = "Mat Assign"
    dbg.Text = "DONE"


    ------------------------------
    John Spitznagel
    Motion and Match Day Designer
    Minnesota United FC
    ------------------------------


  • 2.  RE: Assigning a Video Material to a Quad through Scripting

    Posted 4 hours ago

    Are you using debug monitor? 



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



  • 3.  RE: Assigning a Video Material to a Quad through Scripting

    Posted 4 hours ago

    Hey Simon! Currently no, I'm not using the debug monitor. I was using an extra textbox that I had made to accomplish a similar result, logging messages depending on where it got to in the script. It took a couple different iterations, but this was the first script that got all the way down to my "DONE" debug line

    I can swap out my "custom" debug lines for the real syntax if you believe that would be beneficial. The syntax for the debug monitor is this, correct?

    Engine.DebugMessage("START", 0)

    I've already flipped the setting on in Preferences >> Advanced



    ------------------------------
    John Spitznagel
    Motion and Match Day Designer
    Minnesota United FC
    ------------------------------



  • 4.  RE: Assigning a Video Material to a Quad through Scripting

    Posted 3 hours ago

    that's the correct syntax but you will also get more info such as missing objects :)



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