MStatus particleSystemInfoCmd::parseArgs( const MArgList& args ) { // Parse the arguments. MStatus stat = MS::kSuccess; if( args.length() > 1 ) { MGlobal::displayError( "Too many arguments." ); return MS::kFailure; } if( args.length() == 1 ) { MString particleName = args.asString( 0, &stat ); CHECKRESULT(stat, "Failed to parse particle node name argument." ); nodeFromName( particleName, particleNode ); if( !particleNode.isNull() && !particleNode.hasFn( MFn::kParticle ) ) { MGlobal::displayError( "The named node is not a particle system." ); return MS::kFailure; } } return MS::kSuccess; }
MStatus fluidInfoCmd::parseArgs( const MArgList& args ) { // Parse the arguments. MStatus stat = MS::kSuccess; // some defaults for the number of voxels we might want to print requestedVoxels = -1; if( args.length() < 1 ) { MGlobal::displayError( "Missing fluid node name argument." ); return MS::kFailure; } else if( args.length() > 2 ) { MGlobal::displayError( "Too many arguments." ); return MS::kFailure; } fluidName = args.asString( 0, &stat ); if (stat != MS::kSuccess) { MGlobal::displayError( "Failed to parse fluid node name argument." ); return MS::kFailure; } if(args.length() == 1) { // assume that the user wants to print all the voxels // they probably won't do this more than once requestedVoxels = -1; } else { requestedVoxels = args.asInt( 1, &stat ); if (stat != MS::kSuccess) { MGlobal::displayError( "Failed to parse num voxels to pribt argument." ); return MS::kFailure; } } nodeFromName( fluidName, fluidNode ); if( fluidNode.isNull() ) { MGlobal::displayError( "There is no fluid node with the given name." ); return MS::kFailure; } if( ! fluidNode.hasFn( MFn::kFluid ) ) { MGlobal::displayError( "The named node is not a fluid." ); return MS::kFailure; } return MS::kSuccess; }