Hello,
I write a VB application which can get the current take item from Sequencer, preview it and update the material and text directly. I've done all most every features, but I failed to update the material from take item.
I've checked the new material has been created in Xpression, but the Texture 2D image seems not setup properly. Could any one help to look into my code and give me some advice for creating a material and update it back to Take item?
The following is the process the following code does:
a. Get the take item reference from take ID.
b. Create a new material.
c. Create a new Shader and
d. Get the published image object from take item.
e. Set Property of published image object.
If engine.Sequencer.GetTakeItemByID(SmallWindowTakeID(SmallWindowListBox.SelectedIndex), takeItem) Then
Dim newMat As xpMaterial
Dim shader As xpBaseShader
Dim tmpPublishedObjImage As New xpPublishedObject
newMat = engine.CreateMaterial()
newMat.Name = tmpFileName + "_Image"
newMat.AddShader("Texture2D", 0, shader)
shader.SetFileName(tmpFilePath)
If takeItem.GetPublishedObject(1, tmpPublishedObjImage) Then
If tmpPublishedObjImage.SetPropertyString(0, newMat.Name) Then
Debug.Print("Set Image Material " + newMat.Name.ToString() + " successfully")
Else
Debug.Print("Set Image Material " + newMat.Name.ToString() + " failed")
End If
End If
Thank you!!