Graphics

 View Only
  • 1.  Changing Material/Texture URL based on Datalinq

    Posted 05-09-2022 12:03
    I am looking to change the texture of a material on a quad based on a value from a datalinq. I have a list of names and I'd like to change an image based on those names. The datalinq does not include a filepath for those images.

    For Example:
    If I have "JOHNSMITH" as the value from my Datalinq, then how to change the image to "P:\GRAPHICS\JOHNATHANSMITH.png"

    I know materials can read a filepath from a datalinq, but is there a way to supply it through scripting? Or do I need to make a bunch of materials and set them based on the name value? Thanks!

    ------------------------------
    Nathan S.
    ------------------------------


  • 2.  RE: Changing Material/Texture URL based on Datalinq

    Posted 05-09-2022 12:34
    At its most basic you can do something like this onOnline. 

    dim plyrImg as xpBaseObject

    self.GetObjectByName("Img1", plyrImg)
    plyrImg.SetVolatileTextureFile(0, P:\GRAPHICS\JOHNATHANSMITH.png")


    If you want to add variables to it you can do something like. 

    dim plyrImg as xpBaseObject

    dim tricode, filepath, first, last, uni as xpTextObject

    self.GetObjectByName("FirstName", first)
    self.GetObjectByName("LastName", last)
    self.GetObjectByName("Tricode", tricode)
    self.GetObjectByName("FilePath", filepath)
    self.GetObjectByName("UNI", uni)

    self.GetObjectByName("Img1", plyrImg)
    plyrImg.SetVolatileTextureFile(0,filepath.Text & tricode.Text & "\" & tricode.Text & "_" & last.Text & "_" & first.Text & "_GS_" & uni.Text & "_Img.png")

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



  • 3.  RE: Changing Material/Texture URL based on Datalinq

    Posted 07-11-2022 14:54
    You should now be able to do this via Dynamic Materials.
    Make a hidden text field that is fed by datalinq, for example Name1, then your dynamic material has the filepath to the folder and references @Name1@.png
    Hope this makes sense!​
    -m

    ------------------------------
    Michelle Owczarski
    ------------------------------



  • 4.  RE: Changing Material/Texture URL based on Datalinq

    Posted 07-12-2022 01:35

    Can Dynamic Material update the image when the scene is online state? 

    I am not able to achieve that. So a way around I found was to use datalinq on the image and then use 'Prepend & Append' to enter the image path. 



    ------------------------------
    GAURAV SODHANI
    Freelancer
    ------------------------------



  • 5.  RE: Changing Material/Texture URL based on Datalinq

    Posted 07-12-2022 04:10
    They can if you use macros for the path such as @Text1@ and that text object is linked to data. ​

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



  • 6.  RE: Changing Material/Texture URL based on Datalinq

    Posted 07-12-2022 18:23
    Make sure to check the "Requery scene datalinqs on data change" box in the Datalinq properties of your Text Object if you plan to use it as a @TextObject@ macro on another object. This way if your data changes while the scene is on the air, the macros in other Datalinq or Dynamic Material paths will update as well.



    ------------------------------
    Jeff Mayer
    Ross Video
    ------------------------------