How to read or set the Ambient Strength of a Material
3dOutlaw
Posts: 2,471
This is where I got...but missing the way to read or set the value (like 0.1 or 10%)
if(!(node = Scene.getPrimarySelection())){ return;};print ("node= "+node.name);shellObject = node.getObject();print ("Object= "+shellObject.name);shape = shellObject.getCurrentShape();print ("Shape= "+shape.name);var iMat = shape.getNumMaterials(); for( j = 0; j < iMat; j++){ mMaterial = shape.getMaterial ( j); print ("Material= "+mMaterial.name); oProperty = mMaterial.findProperty( "Ambient Strength" ); print ("Property= "+oProperty.name); oProperty.setValue = ( 0.12 ); print("Value= " + oProperty.value); };
...but oProperty.value appears to be the wrong thing. Tried name, getValue , as well...the last two lines to read or set the value don't seem to work.
What am I missing, or where in the docs am I missing it? :)
Comments
Same code with minor corrections:
HTH
It's the little syntax overlooks that get me. I literally had to paste your setValue line next to mine to notice the equal sign. My mind had obfuscated it, lol :)
Thanks so much!
This sample should help http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/properties/material_properties/start
Also bear in mind that not all shaders have Ambient Strength as a property.
OK, thanks! I was not actually interested in that particular property (it was a decoy), but "how" to do it. The actual stuff I am working on is top secret