Graphics

 View Only
  • 1.  Replace material with script

    Posted 05-15-2018 17:47

    I read in this forum (https://discussions.rossvideo.com/forum/default-forum-gc1/vision-production-switchers-gc15/1081-datalinq-with-material) how to replace the image from a material according to numerical or code value from datalinq. I tried to do it like hi shows there but remaking the code to work with conditional, but it doesn't work. I don't use the function for, i use if for every candidate.
    This is my script:

    --------

    dim Nombre1, Nombre2, Nombre3, Nombre4, Nombre5, Apellido1 as xptextobject

    dim Slab1 as xpBaseObject [I]'Slab1 is the name my empty slab[/I]
    dim Slab1Mat as xpMaterial
    dim Slab1Shad as xpBaseShader
    dim FilePath as String
    FilePath = Engine.ProjectPath

    self.getobjectbyname("Nombre1" ,Nombre1)
    self.getobjectbyname("Apellido1" ,Apellido1)
    self.getobjectbyname("Nombre2" ,Nombre2)
    self.getobjectbyname("Nombre3" ,Nombre3)
    self.getobjectbyname("Nombre4" ,Nombre4)
    self.getobjectbyname("Nombre5" ,Nombre5)
    Self.GetObjectByName("Slab1 " , Slab1) [I]'Here i call my slab[/I]


    [I]'Casilla 1 - Candidate 1[/I]

    if Nombre1.text = "001" then
    Nombre1.text = replace(Nombre1.text, "001", "Gustavo Petro")
    [I] 'So, inside this conditional i execute the function.[/I]
    Slab1.GetMaterial(1, Slab1Mat)
    Slab1Mat.GetShader(1, Slab1Shad)
    Slab1Shad.SetFileName(FilePath + "Candidatos" + Nombre1.Text + ".png")

    end if



    ------------------------


    I think that the layer inside material needs to be called.

    But, how i put the image inside material. I have Xpression 6.5.


    Thanks for your help and sorry for my english .



  • 2.  RE: Replace material with script

    Posted 05-15-2018 19:23

    Hi Harios,

    I recommend putting some debug message in the script to make sure its completing fine; depending on how you want to control the object face, instead of getting the material and its shader; you could set a volatile texture.

    i'll make the change below to show you; if you enable inside your Preferences --> Advance you will be able to see these debug messages inside the XPression Debug Monitor, if you don't see the "End" message at the end then the script failed to complete


    [I]'[/I]************************************************************************************************


    Engine.DebugMessage("Start",0)

    dim Nombre1, Nombre2, Nombre3, Nombre4, Nombre5, Apellido1 as xptextobject

    dim Slab1 as xpBaseObject [I]'Slab1 is the name my empty slab[/I]
    dim FilePath as String
    FilePath = Engine.ProjectPath

    Engine.DebugMessage("Done Dim",0)

    self.getobjectbyname("Nombre1" ,Nombre1)
    self.getobjectbyname("Apellido1" ,Apellido1)
    self.getobjectbyname("Nombre2" ,Nombre2)
    self.getobjectbyname("Nombre3" ,Nombre3)
    self.getobjectbyname("Nombre4" ,Nombre4)
    self.getobjectbyname("Nombre5" ,Nombre5)
    Self.GetObjectByName("Slab1 " , Slab1) [I]'Here i call my slab[/I]

    Engine.DebugMessage("Done Get",0)


    [I]'Casilla 1 - Candidate 1[/I]

    if Nombre1.text = "001" then
    Nombre1.text = replace(Nombre1.text, "001", "Gustavo Petro")

    Engine.DebugMessage("Done Replace",0)

    [I]'So, inside this conditional i execute the function.[/I]
    Slab1.SetVolatileTextureFile(FilePath + "Candidatos" + Nombre1.Text + ".png")

    Engine.DebugMessage("Done Shad",0)

    end if

    Engine.DebugMessage("End",0)

    #XPression