Graphics

 View Only
  • 1.  Image Replacement Scripting

    Posted 05-08-2012 00:36
    I am trying to incorporate some image replacement in my Sports graphics. I have some scripting received during Xpression training:

    dim name1 as xpTextObject

    dim pic1 as xpBaseObject

    dim teampic1 as xpMaterial

    dim picshader1 as xpBaseShader

    dim FilePath1 as String

    Self.GetObjectByName("name1", name1)

    FilePath1 = "D:XPRS ProjectsNEWSSports" & name1.Text & ".tif"

    Self.GetObjectByName("pic1", pic1)

    pic1.GetMaterial(0, teampic1)

    teampic1.GetShader(0, picshader1)

    picshader1.SetFileName(FilePath1)

    It works perfectly, with one exception. When I have multiple instances of the same scene in a row, a misspelled filename on a scene will end up displaying the logo in that particular place from the previous scene. For example: In the first scene, I would have a Minnesota Twins logo. In the next a New York Yankees logo in the corresponding object in the scene. However if Yankees is misspelled as Yankkes, the file isn't found, and the Twins logo is displayed again.

    What I would like to do, is if a file can't be found, then I would like it to bring up a specific generic image. My scripting knowledge is limited at best, and I can't figure out how to do this, or even if it can be done. Any help would be appreciated.


  • 2.  RE: Image Replacement Scripting

    Posted 05-09-2012 22:29
    Try this (replace your last line with) :

    if picshader1.SetFileName(FilePath1) = false then

    picshader1.SetFileName("Path to generic image")

    end if

    #XPression


  • 3.  RE: Image Replacement Scripting

    Posted 05-10-2012 01:26
    Thanks! That worked perfectly

    #XPression


  • 4.  RE: Image Replacement Scripting

    Posted 05-10-2012 21:52
    You're welcome

    #XPression