Hi,
One last thing I've noticed.
The last code shared by @HerrMay works great on all materials but the one I'm using to test my script, it's odd.
On this particular material, the function consistently skip the shader which is in the Blend Channel of the Fusion shader. Even the Mask shader in the Mask channel is discovered and printed.
db2bf693-59e6-4eb1-a42e-5c484b38f253-image.png
I've ran the debugger on the function :
when the loop state is on the Color shader, the function is going up on the parent Fusion shader as expected
but then the elif node.GetNext() condition isn't verified (?!) so it skips the last branch and go back to the material
The thing is it doesn't happen with other materials nor other shaders :
I've made this particular material's shader tree more complex and all the shaders are seen, even when a node has several children.
A brand new material with the same shader setup is not a problem.
There are two cases where the function scan the shader correctly and output the expected result :
When using
the recursive function written by @ferdinand
Disconnecting and reconnecting the Filter shader from the Fusion shader. If I run the function again after doing that, the AO and Filter shaders are discovered and printed correctly.
Do you have any idea of what it is happening here ?
I'm planning to use this function for several commands and I don't like the possibility that it could fail in some cases, even if it is some niche ones.