I’ve finally found and hacked a working way to have a script apply a single shader across multiple surfaces in DAZ. Many hours of searching and testing finally surfaced Mcasual’s free mcjSelectTheseMats. This will do the job in DAZ 4.12.x, with a few custom adjustments. I’m amazed no-one has made such a script for this basic task, until now. Here is my working tweak to extend the ‘mcjSelectTheseMats’ script.
SelectTheseMats_ApplyShader.txt (download, rename to be a .DSA script)
This selects the named base figure in the scene, then makes sure he is really selected, then selects and highlights all the non-eye surfaces of the ‘Genesis 2 Male’. Adjust as desired for your likely target figure (e.g ‘Genesis 8 Female’. There is also a naming convention which handles having two or more Genesis figures of the same base type in a scene).
The resulting script auto-selects all the required surfaces. This part works even if something else entirely is selected in the scene, when the script is run, e.g. a light. It also doesn’t matter if the target figure is named ‘Fluffy Bunny’ etc in your runtime, the DAZ scene only sees and knows him as a ‘Genesis 2 Male’.
Then at the end of the script, I added two lines to apply the chosen shader to the selected surfaces. Obviously you will need to adjust the path to your desired shader and file and then save the script.
With this script in hand you can then theoretically build it into a larger multi-pass ‘render, load and repeat’ script. By having the script make an automatic render after each new shader is applied. It would be ‘shader-based’ multi-pass, rather than ‘render-engine based’ multi-pass.
Obviously the script as it stands is not the ‘apply to all surfaces in a scene, except those identified as eyes’ I initially wanted, but it works and goes a long way toward it.
Also, this was the short non-working version that I wrestled with for a long time. Theoretically it should work, but it doesn’t select the surfaces, only applies the shader to any already-selected surfaces…
var figure = Scene.findNodeByLabel( “Genesis 2 Male” );
figure.select( true );
var sPathToFile = “C://my_folder/my_shader.duf”;
App.getContentMgr().openFile( sPathToFile, true );
It may save someone else the trouble in the future.