Graphics

 View Only
  • 1.  Visual Logic and Datalinq materials

    Posted 09-28-2020 13:29

    Hi, I have a scene in which I would like a default silhouette image to be visible only if a datalinq image returns empty.

    So, I have two quads, one default image, and one with a datalinq material which points to a path/filename, and if Xpression can find the corresponding image file, it shows, and if not it's left blank. So far, so good. But I just can't figure out how to build a visual logic to show the default image only when the datalinq image is empty.

    Any suggestions?



  • 2.  RE: Visual Logic and Datalinq materials

    Posted 09-28-2020 13:59

    Below is a simplified version of what I'm using to accomplish this...

     

    'This is a script to determine if file actually exists.

    dim path as xpTextObject

    Scene.GetObjectByName("PATH", path)

    Dim fs As Object = CreateObject("Scripting.FileSystemObject")
    Dim defaultImagePath As String = path.Text & "MISC\Default_Player.png"
    Dim imagePath As String
    imagePath = path.Text & triCode.Text & "\" & lname.Text & "_" & fname.Text & ".png"
    If Not(fs.FileExists(imagePath)) And fs.FileExists(defaultImagePath) Then
    engine.DebugMessage("Headshot " & imagePath & " doesn't exist. Setting to default player photo instead.", 1)
    imagePath = defaultImagePath
    End If

    'set Volatile Texture

    dim HS as xpBaseObject

    Scene.GetObjectByName("Headshot", HS)
    HS.SetVolatileTextureFile(0, imagePath)


    #XPression


  • 3.  RE: Visual Logic and Datalinq materials

    Posted 10-19-2020 10:33

    Hi, thanks for this!
    So, do you run the script on the whole scene, or on the image (quad), or something else?


    #XPression


  • 4.  RE: Visual Logic and Datalinq materials

    Posted 10-19-2020 12:59

    In this case, the script is located on the default scene director.


    #XPression