MasterZ
04-29-2006, 09:39 PM
Well I can simply right click on a material and say "Select Objects with Material" and it will show this kind of stuff...
select -cl; select -r someobj_body.f[120] someobj_body.f[125:212] ... etc.
but to write a MEL script to do that is extremely difficult so I have come here to see if anyone knows offhand what to do (or can help figure it out).
Basically I want to replace all shaders in a complex rig with a maskShader (Matte Opacity 0.0 and Color black, etc.)
If I do that with a complex rig (group/trunk) all sorts of things barf on it, so I wrote a quick script to set it to all items and let those that barf barf and those that won't don't.
string $storeSel[] = `ls -sl`;
string $selection[] = `ls -g -dag -ap -sl`;
string $obj;
print "Started setting Mask Shader to";
print $storeSel;
print "/n";
print "Items found ";
print $selection;
print "/n";
for($obj in $selection) {
print ("Item: " + $obj + "/n");
select $obj;
hyperShade -assign maskShader;
}
select $storeSel;
This works fine until it runs into mesh with different textures assigned to different vertex clusters.
I believe they are hidden in instObjGroups (iog) of which there is not much said about here (or anywhere except what is it? reply: I don't know).
So my search has taken me to and through various commands...
listSets seems like a good place to start listing all sets shows things like skinCluster1Set exist but if you select it...
listSets -as;
// Result: initialShadingGroup ... lots of stuff... skinCluster1Set ... more stuff //
select skinCluster1Set;
// Error: No object matches name: skinCluster1Set //
sets -q skinCluster1Set;
// Error: No object matches name: skinCluster1Set //
It's not found for sets, object select, etc. which is strange to me since it’s found by listSets.
Basically I want all the vertex groups of a mesh selected so the maskShader can be assigned.
I know with the GUI it would only take a minute but scripts save time and have no human error, and automated pipelining becomes more plausible etc.
Maybe Render Layers can help set one layer to be a mask object for another layer or something completely different I am currently unaware of, what’s your approach?
I will continue searching in the mean time.
I think this is a good one for those that like a challenge.
select -cl; select -r someobj_body.f[120] someobj_body.f[125:212] ... etc.
but to write a MEL script to do that is extremely difficult so I have come here to see if anyone knows offhand what to do (or can help figure it out).
Basically I want to replace all shaders in a complex rig with a maskShader (Matte Opacity 0.0 and Color black, etc.)
If I do that with a complex rig (group/trunk) all sorts of things barf on it, so I wrote a quick script to set it to all items and let those that barf barf and those that won't don't.
string $storeSel[] = `ls -sl`;
string $selection[] = `ls -g -dag -ap -sl`;
string $obj;
print "Started setting Mask Shader to";
print $storeSel;
print "/n";
print "Items found ";
print $selection;
print "/n";
for($obj in $selection) {
print ("Item: " + $obj + "/n");
select $obj;
hyperShade -assign maskShader;
}
select $storeSel;
This works fine until it runs into mesh with different textures assigned to different vertex clusters.
I believe they are hidden in instObjGroups (iog) of which there is not much said about here (or anywhere except what is it? reply: I don't know).
So my search has taken me to and through various commands...
listSets seems like a good place to start listing all sets shows things like skinCluster1Set exist but if you select it...
listSets -as;
// Result: initialShadingGroup ... lots of stuff... skinCluster1Set ... more stuff //
select skinCluster1Set;
// Error: No object matches name: skinCluster1Set //
sets -q skinCluster1Set;
// Error: No object matches name: skinCluster1Set //
It's not found for sets, object select, etc. which is strange to me since it’s found by listSets.
Basically I want all the vertex groups of a mesh selected so the maskShader can be assigned.
I know with the GUI it would only take a minute but scripts save time and have no human error, and automated pipelining becomes more plausible etc.
Maybe Render Layers can help set one layer to be a mask object for another layer or something completely different I am currently unaware of, what’s your approach?
I will continue searching in the mean time.
I think this is a good one for those that like a challenge.
