What you have written should just address the first shader.
I was just checking the SDK and there is another option.
You could name the shaders and then get them by name instead.
I think something like;
dim pictag as xpTextObject
dim pic as xpBaseObject
dim picmat as xpMaterial
dim picshad as xpBaseShader
dim filepath as String
dim i as Integer
for i = 1 to 3
Self.GetObjectByName("Pic Tag " & i, pictag)
filepath="X:\!Election\Pictures\FINAL\" & pictag.Text & ".png"
Self.GetObjectByName("Pic " & i, pic)
pic.GetMaterial(0, picmat)
picmat.GetShaderByName("Texture", picshad)
picshad.SetFileName(filepath)
next i
Should work although I wouldn't just use the default name like Texture, I would edit the shader and give it a specific name.
------------------------------
Simon Redmile
Senior Graphic Programmer & Designer
Ross Video
Bristol United Kingdom
------------------------------
Original Message:
Sent: 07-01-2022 13:23
From: Dan Jensen
Subject: Using Visual Logic to load images based on DataLinq
We pull all of our elections data through DataLinq from an xml generated by our data provider. One of the pieces of data is an picture identifier, which is four letters long (typically from the beginning of the candidate's last name). That system uses that info to find the associated .png file to use on other platforms (web and app), but we'd like to use that to load images into XPression, as well.
The four letter code comes in and is assigned via visual logic to that candidate's "Pic Tag" text file, named "Pic Tag 1", "Pic Tag 2", and "Pic Tag 3".
I currently have a template with three different objects assigned to three different materials.The materials are "Pic_1", "Pic_2," and "Pic_3", which are all .png files that are transparent. Here's what I've come up with in the script editor, but it is assigning the image to not just the first, but all three shaders:
dim pictag as xpTextObjectdim pic as xpBaseObjectdim picmat as xpMaterialdim picshad as xpBaseShaderdim filepath as Stringdim i as Integerfor i = 1 to 3Self.GetObjectByName("Pic Tag " & i, pictag)filepath="X:\!Election\Pictures\FINAL\" & pictag.Text & ".png"Self.GetObjectByName("Pic " & i, pic)pic.GetMaterial(0, picmat)picmat.GetShader(0, picshad)picshad.SetFileName(filepath)next i
Is there a better way to do this via Visual Logic where the rest of the scene's logic lives and works?
------------------------------
Dan Jensen
Operations Director
WREX-TV
------------------------------