View Full Version : determining top group of a reference

05 May 2007, 12:44 AM
Is there an easy way to get the top group of a reference that is bringing in everything under a group. Like when you reference with the namespace "hand", it will usually default to "handRNgroup"
... sorry it is probably obvious.

05 May 2007, 01:10 AM
I assume you mean using MEL? If so, it's not as easy as you might hope.

There should be a connection between the reference node's message attribute and the group node's "isHistoricallyInteresting" attribute.

If you know the reference node name, you can query all outgoing connections from its message attribute - hopefully it's only connected to the isHistoricallyInteresting attribute on one transform.

Here's one way to go at it:

// Get the reference node name
string $refNode = `file -q -rfn`;

// Get the list of outgoing connections. Entries of the form: node.attr
string $conList[] = `listConnections -source false -destination true -plugs true -type "transform" ($refNode + ".message")`;

string $group = "";
string $con;
for ( $con in $conList )
// Parse out the node and attribute name
string $nodeAndAttr[];
tokenize( $con, ".", $nodeAndAttr );
if ( 2 != `size $nodeAndAttr` )
// The -type flag in the listConnections command guarantees that
// that all nodes are transforms, so we just need to check that
// the connected attribute is "isHistoricallyInteresting"
if ( "isHistoricallyInteresting" == $nodeAndAttr[1] )
$group = $nodeAndAttr[0];

print("Group: " + $group + "\n");

05 May 2007, 02:31 AM
This is totally great! thanks...

CGTalk Moderation
05 May 2007, 02:31 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.