Get and set LayeredTextures in DAZ Script

LuckyVRealLuckyVReal Posts: 10

Hallo,

I have a challenge working with layered texture maps in DAZ Script.
Creating layers/masks and adding them to the diffuse map (pbrSkin MDL, Genesis 9) works fine, but I just can't find a way to read out existing layers so that I can edit them.

The assignment only seems to work via a Dz material. To read it, just getAllMaps(), which then only outputs the name of the resulting map, but not the individual layers and masks. In addition, the name of the resulting map is not always unique and can change.
Further I can only find the function setColorMap(DzTexture Image) to set the ready map it, and this one only take the Base (Diffuse) Map.

Could it be that I have a mistake in thinking here? The creation of the LayeredTexture is done via DzImageMgr, maybe you have to go through it somehow?
I used the samples as a guide, but they no longer help me for this purpose.

I hope I was able to describe it clearly. Does anyone have an idea or a tip on how I could proceed?

Post edited by Richard Haseltine on

Comments

  • Richard HaseltineRichard Haseltine Posts: 96,933
    edited November 2023

    Moving this to the scripting SDK forum where it will get more useful views, perhaps.

    See http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/images/create_layered_image_backdrop/start for a sample working with Layered Images, and http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/layeredtexture_dz for the reference on their object type. Remember that each object type inherits the propeties and methods of its parent, unless they are given an override.

    Post edited by Richard Haseltine on
  • LuckyVRealLuckyVReal Posts: 10
    edited November 2023

    Thank you Richard.
    I used these Sites, but they don´t help with everything.

    At least I've found a way to read the Layered Textures:
    var aAllMaps = oMaterial.getAllMaps ();
    for(i=0;i<aAllMaps.length;i++){
       uMap = aAllMaps[i].assetUri;
    aLayeredTexture = oImageMgr.findLayeredTexture ( uMap);}

    So I need the Uri of the Map to find the LayeredTexture for this way. But these Uris from the Material of the whole Node like "Head" do not give me any universal information about which property which map belongs to (Diffuse, Metallic, Bump,...). I would also have the the property, and its path like /Base/Diffuse/Reflection, but I can't get the Uri extracted from it which is nessesary for getting the LayeredTexture.

    So I'm still missing an intermediate step. I would really appreciate some help.

    Post edited by LuckyVReal on
  • LuckyVReal said:

    Thank you Richard.
    I used these Sites, but they don´t help with everything.

    At least I've found a way to read the Layered Textures:
    var aAllMaps = oMaterial.getAllMaps ();
    for(i=0;i<aAllMaps.length;i++){
       uMap = aAllMaps[i].assetUri;
    aLayeredTexture = oImageMgr.findLayeredTexture ( uMap);}

    So I need the Uri of the Map to find the LayeredTexture for this way. But these Uris from the Material of the whole Node like "Head" do not give me any universal information about which property which map belongs to (Diffuse, Metallic, Bump,...). I would also have the the property, and its path like /Base/Diffuse/Reflection, but I can't get the Uri extracted from it which is nessesary for getting the LayeredTexture.

    So I'm still missing an intermediate step. I would really appreciate some help.

    The layered Image is just that, an image - it isn't inherentl associatd with a property, for that I think you need to iterate over the materials proeprties checking to see if they are mappable, have a map, and if the map is a layered image.

  • Hi Richard,
    I found a solution to the problem.
    I didn´t know anything to do with your tip at first, but in retrospect it was the right one.
    Ultimately I found the solution based on the sample http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/interface/action/index/dzmaterialassetfilteraction/start.

    My Problem was, that I didn´t know that I can use a Method of a upwards inherinted class in some times, so to use a DzNumericProperty Method on a DzProperty Object and use .isMappable(), isMapped() and finally getMapValue() on the oProperty.
    I actually always thought that inheritance could only be done downwards and that's why I spent lot of time looking in other classes for a function that would return a DzTexture or something similar.
    But I didnt code for years, perhaps I lost some skills. Gets better by doing ;)
    Thanks again Richard, the discussion can be closed.

Sign In or Register to comment.