|10 October 2011|
3D Generalist / Lighting TD
Sydney - atm, Germany
Script to connect all mia_materials in a Scene with Colorbuffers
yesterday i looked for scripts wich can create 21 Custom Color Buffers, name them (add_result, refl_level, refr_level...) and connect them to WriteToColor Nodes.
Because i didn't find any i tried it on my own. I'm not a coder and don't have any experiences with mel, but i could realize this first step by recording/and copying the commands.
The next and maybe more difficult step would be, to connect all Materials in the scene (type Mia_material_x_passes) or at least named like this "Mia_material" with the right colorbuffers.
So that i can use a lot of Mia_Material_x_passes in my scene, after that scan the entire scene for them and connect for example "indirect_raw" to the colorbuffer "Indirect_raw_buffer" for all of them.
The recorded command is:
connectAttr -f mia_material_x_passes3.indirect_raw indirect_raw_buffer.color;
connectAttr -f mia_material_x_passes3.indirect_raw indirect_raw_buffer.evaluationPassThrough;
But of course it only works for the material named "mia_material_x_passes3".
And that is what i'm trying to achieve.
select -r "mia_material*";
string $miaNode = `ls -selection`;
connectAttr -f $miaNode.indirect_raw indirect_raw_buffer.color;
connectAttr -f $miaNode_x_passes3.indirect_raw indirect_raw_buffer.evaluationPassThrough;
Of course it's not that easy :-/
Today i found a great (closed) thread with the same topic but with an different approach.
I think my problem could be, that i only have this one variable ($miaNode) right now??
I would be really happy, if you can show me how to solve this problem.