Setting UVs on a material

I was wondering... is there a way to set UVs on a material by its name? Setting it by its index works:

var baseUV=myMaterial.findPropertyByLabel("UV Set")
                baseUV.setValue(2);

But on different figures, the UV map matching such index may not be the same...

Comments

  • meipemeipe Posts: 101

    Thanks a lot! :)

     

    So, the solution is:

     

    1-Get the name of source UV set:

     

    var myUVName = oSrcMaterial.getUVSetControl().getStringValue();

     

    2-Iterate in the destination UV set, getting one by one the UV sets names, checking for a match and grabbing its index number;

     

    3- if there is a match, setting the destination UV set:

     

    var tgtUV=oTgtMaterial.findPropertyByLabel("UV Set")tgtUV.setValue(myIndexNumber);

     

Sign In or Register to comment.