print ("maya2q3 " + `pluginInfo -q -v maya2q3` + ": Up and running!\n") ; /* The following are a bunch of helper commands for writing x42 config scripts. Note that they pretty much all call x42config so you can only use them from within an export script. */ /* Sets up some useful exporter defaults: (none thus far) */ global proc x42config_setDefaults( ) { } /* Given a chain of bones: A -> B -> C -> D -> E -> F -> G Calling x42config_reparentReverseChain( A, G ) will yield G -> F -> E -> D -> C -> B -> A If you call x42config_reparentReverseChain( A, D ) you'll get D -> C -> B -> A -> E -> F -> G Note that the command only affected the bones in the direct parenting chain between A and D. It doesn't touch *any* other bones. If the first paramater is not a tree root, for example by calling x42config_reparentReverseChain( C, E ), you get this: A -> B -> E -> D -> C -> F -> G */ global proc x42config_reparentReverseChain( string $start, string $end ) { string $s = `x42config -mn -bn $start` ; string $e = `x42config -mn -bn $end` ; if( $s == $e ) //nothing to do return; string $chain[]; string $p = $e; while( $p != $s ) { $chain[size( $chain )] = $p; $p = `x42config -mn -bp $p` ; if( $p == "" ) //hit a root before $s, was not a valid chain, abort x42config -k "Invalid reparenting chain." ; } $chain[size( $chain )] = $s; //grab the old root of it all $ps = `x42config -mn -bp $s` ; int $i; //clear out all the parenting info so we don't run into cycles for( $i = 0; $i < size( $chain ); $i++ ) x42config -e -rpb ("~" + $chain[$i]) "" ; //reverse the order of the parenting links for( $i = 1; $i < size( $chain ); $i++ ) x42config -e -rpb ("~" + $chain[$i]) ("~" + $chain[$i - 1]) ; //parent the whole thing to the old root x42config -e -rpb ("~" + $chain[0]) ("~" + $ps) ; }