  | | | set has restrictions on membership? | set has restrictions on membership? 2003-11-29 - By Bryan Ewert
Back ? from Fri, 28 Nov 2003 19:41:00 -0000
> sets -e -forceElement phong1SG;
> // Warning: Cannot add the following items to the set since the set has restrictions on membership: rigidBody2 // > // Result: phong1SG //
What is the nodeType of rigidBody2? I'd bet it's of type "rigidBody" (wild ass guess :-). Check this:
nodeType rigidBody1; // Result: rigidBody //
sets -fe blinn1SG rigidBody1; // Warning: line 1: Cannot add the following items to the set since the set has restrictions on membership: rigidBody1 //
// Warning: line 1: None of the items can be added to the set //
You can't assign a shading group to a rigid body node. You must assign it to the _geometry_ which is associated with the rigid body.
The syntactical form you specify uses the current selection list as the item(s) to add to the Shading Engine set. What you'll need to do (assuming you don't have an easier way of determining this) is to trace the DG from your rigidBody to find the geometry, and specify _that_ node to be added to the shadingEngine set:
Doing a quick test and examining the Hypergraph, I see that the rigidBody has an incoming connection from the associated geometry's transform:
pSphere1.worldMatrix[0] -> rigidBody1.rigidWorldMatrix
Thus, I should be able to trace upstream from the '.rigidWorldMatrix' attribute, find the shape node, assert that it's geometry, and assign it to the shadingGroup:
global proc assignRigidBodyToSG( string $rigidBody, string $sg ) { string $rigidBody = "rigidBody1"; string $sg = "blinn1SG"; if ( `attributeQuery -node $rigidBody -exists "rigidWorldMatrix"` ) { string $cc[] = `listConnections -plugs false ( $rigidBody + ".rigidWorldMatrix" )`; if ( `size $cc` > 0 ) { // Find the shape node // Note: Oddly, this returns the rigidBody as a shape. string $shapes[] = `listRelatives -shapes $cc[0]`; for ( $shape in $shapes ) { string $isGeometry[] = `ls -geometry $shape`; if ( `size $isGeometry` > 0 ) { print ( "Assigned \"" + $shape + "\" to \"" + $sg + "\"\n" ); sets -fe $sg $shape; } } } } }
Example use:
assignRigidBodyToSG( "rigidBody2", "phong1SG" ); // Result: Assigned "pSphereShape1" to "blinn1SG" //
-- Bryan Ewert ? maya@(protected) ? http://www.ewertb.com ?
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- List-help: <mailto:listar@(protected)?Subject=help> List-archive: <http://www.highend3d.com/maya/devarchive/>
|
|
 |