Graphics

 View Only
  • 1.  Dynamic Materials not resolving path

    Posted 05-15-2025 07:15

    Hi guys,

    I'm trying to have a quad object take the texture of  a icon, depending on what number a widget is set to. So basically I have 4 Icons which are named Icon1_IMAGE, Icon2_IMAGE, Icon3_IMAGE and Icon4_IMAGE. I wanted to use dynamic materials linked to a widget so that it can be changed by just changing the number of the counter widget. All of the icons are imported into the file so what I tried to do is have the dynamic material look for Icon@COUNTER@_IMAGE. But this does not return anything. I can force it to change when changing the @COUNTER@ to one of the numbers to resolve the filepath but thats about it. Also I'd like to have the icons update on air just the way a counter widget would.



    ------------------------------
    Thanks in advance and best wishes,
    Johannes
    ------------------------------


  • 2.  RE: Dynamic Materials not resolving path

    Posted 05-16-2025 11:41

    When I do this using dynamic material I also have to have the file type suffix. (.png, .jpg, .psd) That is the only thing I see missing. You're basically just declaring a file path by using the various text macros. Another way could be done using visual logic. Since you only have 4 icons you could use the sort input block to change the materials. 



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 3.  RE: Dynamic Materials not resolving path

    Posted 05-16-2025 15:48

    As Malcolm says, make sure you are using the type suffix, or you could do it via visual logic if you only have so many choices.

    You do mention updating on-air, I don't know if just me but I find that if you put the path as a dynamic material it won't update live, but just every time you take the scene offline/online again.

    I have solved it in the past by using volatile textures.

    For example, in this case I would make a hidden text object linked to your widget. Then in the script events of the text object I would add the following:

    dim icon as xpQuadObject
    scene.GetObjectByName("Icon", icon)
    icon.SetVolatileTextureFile(0,"C:\Your Filepath\Icon" + Text + "_IMAGE.png")



    ------------------------------
    Jake Lew
    Access Communications Co-Operative Limited
    Regina Canada
    ------------------------------



  • 4.  RE: Dynamic Materials not resolving path

    Posted 05-16-2025 19:19

    Since there are only 4 icons, you could also use a little scripting to make objects visible or not. Make 4 objects that are in the same position. You would place this script on a hidden text object that is tied to the counter for 1 thru 4. This would update live even if you are on line.

    dim Icon1, Icon2, Icon3, Icon4 as xpbaseobject

    scene.getobjectbynanme("Icon 1",Icon1)

    scene.getobjectbyname("Icon 2", Icon2)

    scene.getobjectbyname("Icon 3", Icon3)

    scene.getobjectbyname("Icon4", Icon4)

    if text = "1" then

    icon1.visible=true

    Icon2.visible=false

    Icon3.visible=false

    icon4.visible=false

    if text = "2" then

    icon1.visible=false

    Icon2.visible=true

    Icon3.visible=false

    icon4.visible=false

    elseif

    if text = "3" then

    icon1.visible=false

    Icon2.visible=false

    Icon3.visible=true

    icon4.visible=false

    else if

    if text = "4" then

    icon1.visible=false

    Icon2.visible=false

    Icon3.visible=false

    icon4.visible=true

    end if

    (I didnt type this on an xpression so double check for spelling/object matches if this doesn't work for you)



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 5.  RE: Dynamic Materials not resolving path

    Posted 05-17-2025 11:23

    Couple of things to note

    Dynamic materials can resolve to project materials (Icon1_IMAGE), file paths (D:\Icons\Icon1.png) or relative file paths to your.xpf location (\Images\Icon1.png), among a few others, so both Johanne and Malcom's material path should resolve correctly.

    Jake's OnSetText script works because it runs after the text object is set. If dynamic material paths aren't updating on-air, it's because the dynamic material is resolving BEFORE the text object get set, including when set from a widget.

    Visual Logic is the last thing that runs each frame, so if you use visual logic to set your material based on a text widget, it will update on-air

    That said, you can get a Dynamic Material Path to update live on-air by adding an OnSetText script with a simple "scene.RefreshDynamicMaterials" command to your text object. This way, after the widget updates the text object, the scene will refresh any Dynamic Material paths based on the updated text.



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



  • 6.  RE: Dynamic Materials not resolving path

    Posted 05-17-2025 11:34

    "That said, you can get a Dynamic Material Path to update live on-air by adding an OnSetText script with a simple "scene.RefreshDynamicMaterials" command to your text object. This way, after the widget updates the text object, the scene will refresh any Dynamic Material paths based on the updated text."

    Serious information here. Adding it to my tool box. I didn't know about this one. Thanks Jeff.



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 7.  RE: Dynamic Materials not resolving path

    Posted 06-30-2025 05:19

    But if I had a dyanmic material with a material path that looks something like this: "allymonsterslaying_@COUNTER_LEFT1@_Image". Shouldn't the result of this be "allymonsterslaying_0_Image"/, "allymonsterslaying_1_Image, (...) and as such resolve to a file path within the material manager or am I overseeing something?

    Yes, I'd still need to add the script for the material to update on-air. But if I have a disabled textobject with the counter with the onsettext script running that should do the trick I think.



    ------------------------------
    Best wishes,
    Johannes
    ------------------------------