Graphics

 View Only
  • 1.  OnOffLine How to describe material shader so I can delete

    MalThePal
    Posted 08-10-2022 16:28
    Working on a project that sets a material to a 3d imported object (basically a school color) based on teams Code "WYO, USU" I have the set shader working great. Now I am having trouble describing the shader, in the material, on the base object so that I delete that shader for the next time the scene goes on line. 

    Shoutout to Jeff Reitman who really helped me out with the scripting to set materials. 

    Thanks in advance.

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


  • 2.  RE: OnOffLine How to describe material shader so I can delete

    Ross Staff
    Posted 08-10-2022 16:44
    What do you mean by describing the shader?

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



  • 3.  RE: OnOffLine How to describe material shader so I can delete

    MalThePal
    Posted 08-10-2022 16:51
    I was adding a shader to an existing material so that I could set a file to that shader. It worked great. But each time I ran the script it would add another shader. So I was trying to figure out the syntax of deleting a shader from a material applied to an object in the scene using an OnOffline script. I decided to go a different route. I just added a shader to my material and then in the script I just got that shader and changed the file attached to it. So now I don't have to delete it.

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



  • 4.  RE: OnOffLine How to describe material shader so I can delete

    Ross Staff
    Posted 08-10-2022 16:55
    Ah very good, I assume you're wrote something like this (which I am putting here incase people come reading the thread). 

    engine.GetMaterialByName("Material1", mat)

    mat.GetShader(1, shad)

    shad.SetFileName("D:\_Xpression Projects\mProject\Images\myImage.png")

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



  • 5.  RE: OnOffLine How to describe material shader so I can delete

    Ross Staff
    Posted 08-10-2022 17:04
    You can also delete shaders by index number for example.

    dim mat as xpMaterial

    engine.GetMaterialByName("Material8", mat)

    mat.DeleteShaderByIndex(0)

    Would remove the first shader. 

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