[Solved] Access to shader name

I'm trying to find a way to access the shader name as displayed on the Surfaces panel. I need to distinguish between different shaders that are all DzBrickMaterials. It looked like from another example I could do material.GetShader(), but that's coming back undefined. Help?

Screen Shot 2015-12-21 at 1.06.49 PM.png
634 x 416 - 55K
Post edited by Jack of Spades on

Comments

  • You use GetMaterialName() on DzMaterial.  The following code will iterate through the surfaces of the selected item and give you their Shader names:

    var oNode = Scene.getPrimarySelection();var oObj = oNode.getObject();var oShape = oObj.getCurrentShape();var nMat = oShape.getNumMaterials();for (var k=0; k < nMat; k++) {	var oMat = oShape.getMaterial(k);	var sName = oMat.getName();	var oShader = oMat.getMaterialName();		print( sName + ": " + oShader );}

     

  • Thank you Cayman! That's exactly what I needed.

Sign In or Register to comment.