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
------------------------------