// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // createNSystem.mel // // Description: // Find a suitable nucleus node or create one. // // Arguments: // None. // global proc string createNSystem() // // Description: // // If there is an nucleus node selected, return it, // otherwise, create a new one and return it. // TODO - add a create flag, and decide exactly when to create a new one. // TODO - or perhaps allow an nThing as an argument // { string $nucleus; string $selected[] = `ls -sl`; // Get the selected nucleuss // string $nsys[] = `listRelatives -type "nucleus" $selected`; int $numSystems = size($nsys); if( $numSystems == 0 ){ $nucleus = `createNode nucleus`; connectAttr time1.outTime ($nucleus + ".currentTime"); string $ax = `upAxis -q -axis`; if( $ax == "z" ){ setAttr( $nucleus + ".gravityDirection" ) 0 0 -1; } } else { $nucleus = $nsys[0]; } return $nucleus; }