wireframex wrote:Hey Face
Any news about your plugin ?
Regards
Phil
I´m in a fight with shader compounds.
With normal shaders, the best option to get the shaders which are connected to a shader is with a simple GetShaders() function.
Then you can loop over the returned shaders and check also each connected shader with the GetShader() function. So you go from right to left through the shader tree.
The only simple problem here is to check if a shader is already found so you get no doubles.
Another methode is to run over each shader parameter and search for a source which is pluged in. This source will also be searched for parameters which have a source and so on. Here is the same simple problem with double shaders.
On Shader compounds this wouldn´t work complete. The GetShader() function will give you all shaders which are connected to the compound and
the GetAllShaders() function will give you each shader which is inside the compound. One problem is, not each shader which is inside a compound or is connected to a compound, must be in use. I think you know that it´s possible to connect a shader to an input port of a compound, this input port is connected to a shader inside the compound and the output from this shader is connected to an output port of the compound. When this output port isn´t used, you get the problem that you will become shaders, which aren´t used for the material. You will also become a problem which is explained in the next methode.
To solve the "unused shader" problem, it´s better to use the parameter methode, so you will only become shaders which are used.
You have also the compound as shader and run over the parameters to get the source which is connected to the port. The problem here, the last shader which is connected to an input port will give you the compound itself as shader source. But this is the same source which you have at the beginning, so you will hang in an endless loop.
After hours i have found a solution to solve the endless loop problem. How i solved it isn´t important, but at the end, i must create my "own" template compound structure with in/output ports and his source/targets.
This last step is, on which i´m current working.
When this is done, i will give you more news.
face