View Full Version : how can i fix this error?
10 October 2008, 09:46 PM
// Warning: line 92: Node 'pSphereShape2.instObjGroups': cannot make assignment to 'blinn2SG' shader. //
// Error: line 92: Connection not made: 'pSphereShape2.instObjGroups' -> 'blinn2SG.dagSetMembers[-1]'. Source node will not allow the connection. //
// Error: line 92: Error while parsing arguments. //
when i run my script i am getting this error and i am not sure why.
i am trying to duplicate a material and assign it to a duplicate object....
i have 2 arrays one with the duplicate objects the other with the corisponding materials...
everything up to here is working as it should...
from here on i am not sure if i am doing the right thing....
// this part is supposed to create a SG then attach the mat to the SG then assign the mat to an object
string $SG =`createNode shadingEngine -n ($material+"SG")`;
connectAttr -f ($material+".outColor") ($SG+".surfaceShader");
sets -e -forceElement $SG $object[$i];
this is where the script errors out
10 October 2008, 10:58 PM
That error means you are violating the partition based characteristics of a shading group.
Memberships to shading groups are mutually exclusive. That is to say that if I have:
I cannot have pSphere1 participating in more than one SG. This includes components. A component can only appear in one SG at a time.
So what you need to do is ensure that the object that you are assigning to the new SG is not already assigned to another SG (disconnect it). I'm guessing right now that when you duplicated, it was assigned to the default shading group: initialShadingGroup.
You want to disconnect it first. Alternatively, you can look for the MEL proc that does all of this for you in one neat method. I can't recall what it is off the top of my head, but you might be able to deduce it via 'Echo All Commands' and using the UI to assign the shader to the object.
10 October 2008, 02:11 AM
ah i see... i'll give that a shot...
i have tried looking through the echo all commands but it is a bit disapointing.... there is some hidden proc that runs when you attach a material that doesn't have a shading group yet to an object. it creates the shading group for you in the background and doesn't tell you the commands it just feeds a result into the echo all commands :(
10 October 2008, 03:52 AM
ok, so after messing with it for a little bit writing for loops that disconnect the object from the old shading group and reconnect it to the new one then reconnect all the shading group connections to the the other misc connections they need to be attached to... i got a bit fed up
so i re did all that work with 2 lines (2 short lines) of code.... sigh
select -r $object;
hyperShade -a $material;
10 October 2008, 03:52 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.