Пример #1
0
MStatus moveCmd::doIt( const MArgList& args )
//
// Description
// 		Test MItSelectionList class
//
{
	MStatus stat;
	MVector	vector( 1.0, 0.0, 0.0 );	// default delta
	unsigned i = 0;

	switch ( args.length() )	 // set arguments to vector
	{
		case 1:
			vector.x = args.asDouble( 0, &stat );
			break;
		case 2:
			vector.x = args.asDouble( 0, &stat );
			vector.y = args.asDouble( 1, &stat );
			break;
		case 3:
			vector = args.asVector(i,3);
			break;
		case 0:
		default:
			break;
	}
	delta = vector;

	return action( DOIT );
}
MStatus liqAttachPrefAttribute::doIt(const MArgList& args)
{
  MStatus status;
  MArgParser argParser(syntax(), args);

  MString tempStr;
  status = argParser.getObjects(objectNames);
  if (!status) 
  {
    MGlobal::displayError("error parsing object list");
    return MS::kFailure;
  }

  worldSpace = false;
  int flagIndex = args.flagIndex("ws", "worldSpace");
  if (flagIndex != MArgList::kInvalidArgIndex) 
    worldSpace = true;

  exportN = false;
  flagIndex = args.flagIndex("en", "exportN");
  if (flagIndex != MArgList::kInvalidArgIndex) 
    exportN = true;

  //printf(">> got %d objects to PREF !\n",objectNames.length() );

  return redoIt();
}
Пример #3
0
MStatus apiMeshData::readFacesASCII( const MArgList& argList,
                                     unsigned& index )
{
    MStatus result = MS::kSuccess;
    MString geomStr;
    int faceCount = 0;
    int vid;

    while( argList.get(index,geomStr) && (geomStr == kFaceKeyword) )
    {
        result = argList.get( ++index, faceCount );
        fGeometry->face_counts.append( faceCount );

        for ( int i=0; i<faceCount; i++ )
        {
            if ( argList.get( ++index, vid ) ) {
                fGeometry->face_connects.append( vid );
            }
            else {
                result = MS::kFailure;
            }
        }
        index++;
    }

    fGeometry->faceCount = fGeometry->face_counts.length();
    return result;
}
Пример #4
0
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;
}
Пример #5
0
MStatus createClip::parseArgs( const MArgList& args )
//
// No arguments to parse.
//
{
	MStatus     	stat = MS::kSuccess;
	MString     	arg;
	MSelectionList	list;
	bool			charNameUsed = 0;
	MString			charName;
	const MString	charFlag			("-c");
	const MString	charFlagLong		("-char");

	// Parse the arguments.
	for ( unsigned int i = 0; i < args.length(); i++ ) {
		arg = args.asString( i, &stat );
		if (!stat)              
			continue;
				
		if ( arg == charFlag || arg == charFlagLong ) {
			// get the char name
			//
			if (i == args.length()-1) {
				arg += ": must specify a character name";
				displayError(arg);
				return MS::kFailure;
			}
			i++;
			args.get(i, charName);
			list.add(charName);
			charNameUsed = 1;
		}
		else {
			arg += ": unknown argument";
			displayError(arg);
			return MS::kFailure;
		}
	}

	if (charNameUsed) {
		// get the character corresponding to the node name
		//
		MItSelectionList iter (list);
		for ( /* nothing */ ; !iter.isDone(); iter.next() ) {
			MObject node;
			iter.getDependNode(node);
			if (node.apiType() == MFn::kCharacter) {
				fCharacter = node;
				break;
			}
		}
		if (fCharacter.isNull()) {
			MString errMsg("Character flag must specify a character node.");
			displayError(errMsg);
			return MS::kFailure;
		}
	}
	
	return stat;
}
Пример #6
0
MStatus apiMeshData::readNormalsASCII( const MArgList& argList,
                                       unsigned& index )
{
    MStatus result;
    MString geomStr;
    MPoint normal;
    int normalCount = 0;

    result = argList.get( index, geomStr );

    if ( result && (geomStr == kNormalKeyword) ) {
        result = argList.get( ++index, normalCount );
        for ( int i=0; i<normalCount; i++ )
        {
            if ( argList.get( ++index, normal ) ) {
                fGeometry->normals.append( normal );
            }
            else {
                result = MS::kFailure;
            }
        }
    }

    return result;
}
Пример #7
0
MStatus apiMeshData::readVerticesASCII( const MArgList& argList,
                                        unsigned& index )
{
    MStatus result;
    MString geomStr;
    MPoint vertex;
    int vertexCount = 0;

    result = argList.get( index, geomStr );

    if ( result && (geomStr == kVertexKeyword) ) {
        result = argList.get( ++index, vertexCount );

        for ( int i=0; i<vertexCount; i++ )
        {
            if ( argList.get( ++index, vertex ) ) {
                fGeometry->vertices.append( vertex );
            }
            else {
                result = MS::kFailure;
            }
        }
    }

    return result;
}
MStatus DDConvexHullCmd::doIt(const MArgList& args)
{
    if (args.length() != 1)
    {
        MGlobal::displayError("Needs at least 2 args");
        return MS::kFailure;
    }
    MString input = args.asString(0);
    MString output = args.asString(1);
    
    // Get the mObject for the input
    MSelectionList selList;
    selList.add(input);
    MDagPath inputMesh;
    selList.getDagPath(0, inputMesh);
    
    // Ensure we're looking at the shape
    inputMesh.extendToShape();

    // Create output object
    MDagModifier dm;
    MObject outMeshNode = dm.createNode(MFn::kMesh);
    MFnDependencyNode outMeshDag(outMeshNode);
    outMeshDag.setName("poopShape#");
    DDConvexHullUtils::hullOpts hullOptions;
    return DDConvexHullUtils::generateMayaHull(outMeshNode,
                                               inputMesh.node(), hullOptions);

}
		MStatus ConnectSuggestionsToolCommand::finalize() {
			std::cerr << "ConnectSuggestionsToolCommand::finalize" << std::endl;

			MArgList command;
			command.addArg(commandString());

			return MPxToolCommand::doFinalize(command);
		}
Пример #10
0
MStatus mDbl3dNoise::doIt( const MArgList& args )
{
	if (args.length() == 1)
	{
    	// vector array
		// get the arguments
    	MDoubleArray dblA;
	    unsigned int count;
		MStatus stat = getArgVec(args, dblA, count);
		ERROR_FAIL(stat);
    
		// do the job
		MDoubleArray result = MDoubleArray(count);		

        Noise noiseGen;
        for(int i=0;i<count;i++)
        {
        	int id = ELEMENTS_VEC *i;
	    	result[i] = noiseGen.improvedPerlin3dS(float(dblA[id]), float(dblA[id+1]),float(dblA[id+2]));
        }
            
        setResult(result);
        
	}
	else if (args.length() == 3)
	{
		// get the arguments
	    MDoubleArray dblA, dblB, dblC;
    	unsigned int incA, incB, incC, count;
		MStatus stat = getArgDblDblDbl(args, dblA, dblB, dblC, incA, incB, incC, count);
		ERROR_FAIL(stat);
	
		// do the actual job
		unsigned int iterA, iterB, iterC;
		iterA = iterB = iterC = 0;

		MDoubleArray result(count);
		Noise noiseGen;

		for (unsigned int i=0;i<count;i++)
		{
        	result[i] = noiseGen.improvedPerlin3dS(float(dblA[iterA]), float(dblB[iterB]),  float(dblC[iterC]));

			iterA += incA;
			iterB += incB;
			iterC += incC;            
		}
		
        setResult(result);
	}
	else
	{
		USER_ERROR_CHECK(MS::kFailure,("mDbl3dNoise: wrong number of arguments, should be 1 vecArray or 3 dblArrays!"));
	}
    
	return MS::kSuccess;

}
Пример #11
0
MStatus helix::doIt( const MArgList& args )
{
	MStatus stat;

	const unsigned	deg 	= 3;			// Curve Degree
	const unsigned	ncvs 	= 20;			// Number of CVs
	const unsigned	spans 	= ncvs - deg;	// Number of spans
	const unsigned	nknots	= spans+2*deg-1;// Number of knots
	double	radius			= 4.0;			// Helix radius
	double	pitch 			= 0.5;			// Helix pitch
	unsigned	i;

	// Parse the arguments.
	for ( i = 0; i < args.length(); i++ )
		if ( MString( "-p" ) == args.asString( i, &stat )
				&& MS::kSuccess == stat)
		{
			double tmp = args.asDouble( ++i, &stat );
			if ( MS::kSuccess == stat )
				pitch = tmp;
		}
		else if ( MString( "-r" ) == args.asString( i, &stat )
				&& MS::kSuccess == stat)
		{
			double tmp = args.asDouble( ++i, &stat );
			if ( MS::kSuccess == stat )
				radius = tmp;
		}

	MPointArray	 controlVertices;
	MDoubleArray knotSequences;

	// Set up cvs and knots for the helix
	//
	for (i = 0; i < ncvs; i++)
		controlVertices.append( MPoint( radius * cos( (double)i ),
			pitch * (double)i, radius * sin( (double)i ) ) );

	for (i = 0; i < nknots; i++)
		knotSequences.append( (double)i );

	// Now create the curve
	//
	MFnNurbsCurve curveFn;

	curveFn.create( controlVertices,
					knotSequences, deg, 
					MFnNurbsCurve::kOpen, 
					false, false, 
					MObject::kNullObj, 
					&stat );

	if ( MS::kSuccess != stat )
		cout<<"Error creating curve."<<endl;

	return stat;
}
Пример #12
0
MStatus mDblGauss::doIt( const MArgList& args )
{
	MStatus stat;
	int count = 1;
    
    srand(mfSeed);
    
	// check how many arguments we have
	if (args.length() == 0)
	{
		// no args
		// just return a single double
		setResult(MDoubleArray(1,gauss()));
		return MS::kSuccess;
	}
	else if (args.length() == 1)
	{
		// one args, check if its an int - if yes return int identity arrays
		stat = getIntArg(args, 0, count);
		ERROR_FAIL(stat);
        MDoubleArray result(count);
        
        double randDif = ((double)RAND_MAX + 1);
        
        for (int i=0; i< count; i++)
			result[i] = gauss();
        
        setResult(result);
		return MS::kSuccess;
	}
	else if (args.length() == 3)
	{
		double mean, diff;
        
		stat = getIntArg(args, 0, count);
		ERROR_FAIL(stat);

		stat = getDoubleArg(args, 1, mean);
		ERROR_FAIL(stat);

		stat = getDoubleArg(args, 2, diff);
		ERROR_FAIL(stat);

      	MDoubleArray result(count);
                  
        for (int i=0; i< count; i++)
			result[i] = gauss()*diff+mean;
        
        setResult(result);
		return MS::kSuccess;
	}
	else
	{
		ERROR_FAIL(MS::kFailure);	
	}
}
Пример #13
0
MStatus CVData::readASCII ( const MArgList& args,
							unsigned& lastParsedElement ) 
{
	MStatus status;
	_intData = args.asInt( lastParsedElement++, &status );
	if ( status == MS::kSuccess ) {
	    _doubleData = args.asDouble( lastParsedElement++, &status );
	} 
	return status;
}
Пример #14
0
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;
}
Пример #15
0
MStatus blindDoubleData::readASCII(  const MArgList& args,
                                unsigned& lastParsedElement )
{
    MStatus status;
    if( args.length() > 0 ) {
        fValue = args.asDouble( lastParsedElement++, &status  );
        return status; 
    } else {
        return MS::kFailure;
    }
}
Пример #16
0
MStatus mDbl2dNoise::doIt( const MArgList& args )
{
	if (args.length() == 1)
	{
		// get the arguments
    	MDoubleArray dblA;
	    unsigned int count;
		MStatus stat = getArgUV(args, dblA, count);
		ERROR_FAIL(stat);
    
		// do the job
		MDoubleArray result = MDoubleArray(count);		

        Noise noiseGen;
        for(int i=0;i<count;i++)
	    	result[i] = noiseGen.improvedPerlin2dS(float(dblA[i*ELEMENTS_UV]), float(dblA[i*ELEMENTS_UV+1]));
            
        setResult(result);
        
	}
	else if (args.length() == 2)
	{
		// get the arguments
	    MDoubleArray dblA, dblB;
    	unsigned int incA, incB, count;
		MStatus stat = getArgDblDbl(args, dblA, dblB, incA, incB, count);
		ERROR_FAIL(stat);
	
		// do the actual job
		unsigned int iterA, iterB;
		iterA = iterB = 0;

		MDoubleArray result(count);
		Noise noiseGen;

		for (unsigned int i=0;i<count;i++)
		{
        	result[i] = noiseGen.improvedPerlin2dS(float(dblA[iterA]), float(dblB[iterB]));

			iterA += incA;
			iterB += incB;
		}
		
        setResult(result);
	}
	else
	{
		USER_ERROR_CHECK(MS::kFailure,("mDbl2dNoise: wrong number of arguments, should be 1 uvArray or 2 dblArrays!"));
	}
    
	return MS::kSuccess;

}
Пример #17
0
// parseArgs
//
MStatus viewCallbackTest::parseArgs(const MArgList& args)
{
	MStatus			status;
	MArgDatabase	argData(syntax(), args);

	// Buffer operation argument variables
	mBufferOperation = kInvertColorBuffer;
	MString operationString;

	MString     	arg;
	for ( unsigned int i = 0; i < args.length(); i++ ) 
	{
		arg = args.asString( i, &status );
		if (!status)              
			continue;

		if ( arg == MString(bufferOperationShortName) || arg == MString(bufferOperationLongName) ) 
		{
			if (i == args.length()-1) {
				arg += ": must specify a buffer operation.";
				displayError(arg);
				return MS::kFailure;
			}
			i++;
			args.get(i, operationString );

			bool validOperation = false;
			for (unsigned int k=0; k<_NUMBER_BUFFER_OPERATIONS_; k++)
			{
				if (bufferOperationStrings[i] == operationString)
				{
					mBufferOperation = bufferOperations[k];
					validOperation = true;
				}
			}
			if (!validOperation)
				status.perror("Invalid operation specified. Using invert by default.");
		}
	}

	// Read off the panel name
	status = argData.getCommandArgument(0, mPanelName);
	if (!status)
	{
		status.perror("No panel name specified as command argument");
		return status;
	}
	return MS::kSuccess;
}
Пример #18
0
MStatus blindComplexData::readASCII(  const MArgList& args,
        		                        unsigned& lastParsedElement )
{
    MStatus status;
	int argLength = args.length();
    if( argLength > 0 ) {
		int numDataRecord = (argLength - lastParsedElement); 
		//
		// Note: a better solution to determine the number of records is to
		// write out the number of records in the writeASCII() routine.
		//
		if ( numDataRecord % 2 != 0 ) {
			cerr << "warning: corrupted data for blindComplexData" << endl;
		}
		// 
		// 2 numbers per record.
		numDataRecord /= 2;
		setLength(numDataRecord); 
		for ( unsigned int i=0; i < _length; i++ ) {
        	status = _CVDataArrayPtr[i].readASCII(args, lastParsedElement);
			if ( status != MS::kSuccess ) {
				return status;
			}
		}
		return MS::kSuccess;
    } 
	return MS::kFailure;
}
Пример #19
0
MStatus Pick::doIt( const MArgList& args )
{
	MStatus res = MS::kSuccess;

	unsigned len = args.length();
	if ( len > 0 ) {
		MString object_name( args.asString(0) );

		if ( MS::kSuccess != MGlobal::selectByName( object_name ) )
			cerr << "Object " << object_name.asChar() << " not found\n";
	} else {
		cerr << "No Object name specified\n";
	}

	return res;
}
MStatus GetMetaNodeConnectionCmd::parseArgs(const MArgList & args)
{
    MStatus status;
    if( args.length() == 0 ) {
        return MS::kNotFound;
    }

    MArgDatabase argData(syntax(), args);

    //get the node name argument
    if (argData.isFlagSet(GetMetaNodeConnectionCmd::FileParam())) {
        MString tmp;
        status = argData.getFlagArgument(GetMetaNodeConnectionCmd::FileParam(), 0, tmp);
        if (!status) {
            status.perror("node flag parsing failed");
            return status;
        }
        this->m_metaNodeName = tmp;
    }
    //get the connection name argument
    if (argData.isFlagSet(GetMetaNodeConnectionCmd::FileParam2())) {
        MString tmp;
        status = argData.getFlagArgument(GetMetaNodeConnectionCmd::FileParam2(), 0, tmp);
        if (!status) {
            status.perror("connection flag parsing failed");
            return status;
        }
        this->m_connectionName = tmp;
    }

    return MS::kSuccess;
}
Пример #21
0
MStatus	brushToolCommand::finalize()
{
    MArgList command;

    command.addArg(commandString());
    command.addArg(MString(radiusFlag));
    command.addArg(radius);
    command.addArg(MString(intensityFlag));
    command.addArg(inten);
    command.addArg(MString(lockBaseFlag));
    command.addArg(lockbase);
    command.addArg(MString(brushModeFlag));
    command.addArg(brushModeVal);


    return MPxToolCommand::doFinalize( command );
}
Пример #22
0
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
uint CVstSmdIOCmd::GetExportType(
	const MArgDatabase &mArgDatabase )
{
	uint retVal( 0 );

	if ( mArgDatabase.isFlagSet( kOptExportType ) )
	{
		MString optExportType;
		MArgList tmpArgList;
		const uint etEnd( mArgDatabase.numberOfFlagUses( kOptExportType ) );
		for ( uint eti( 0 ); eti != etEnd; ++eti )
		{
			mArgDatabase.getFlagArgumentList( kOptExportType, eti, tmpArgList );
			optExportType = tmpArgList.asString( 0 );

			if ( strnicmp( optExportType.asChar(), "r", 1 ) == 0 || strnicmp( optExportType.asChar(), "m", 1 ) == 0 )
			{
				retVal |= CSmdExport::kReference;
			}
			else if ( strnicmp( optExportType.asChar(), "p", 1 ) == 0 )
			{
				retVal |= CSmdExport::kPhysModel;
			}
			else if ( strnicmp( optExportType.asChar(), "a", 1 ) == 0 || strnicmp( optExportType.asChar(), "s", 1 ) == 0 )
			{
				retVal |= CSmdExport::kAnimation;
			}
			else if ( strnicmp( optExportType.asChar(), "v", 1 ) == 0 )
			{
				retVal |= CSmdExport::kVTA;
			}
			else
			{
				MGlobal::displayWarning( MString( "Cannot determine the type of export from -et " ) + optExportType + ", assume reference/model" );
			}
		}
	}

	if ( retVal == 0 )
	{
		retVal = CSmdExport::kReference;
	}

	return retVal;
}
Пример #23
0
MStatus liqWriteArchive::doIt(const MArgList& args)
{
  MStatus status;
  MArgParser argParser(syntax(), args);

  MString tempStr;
  status = argParser.getCommandArgument(0, tempStr);
  if (!status) {
    MGlobal::displayError("error parsing object name argument");
    return MS::kFailure;
  }
  objectNames.append(tempStr);

  status = argParser.getCommandArgument(1, outputFilename);
  if (!status) {
    MGlobal::displayError("error parsing rib filename argument");
    return MS::kFailure;
  }

  outputRootTransform = false;
  int flagIndex = args.flagIndex("rt", "rootTransform");
  if (flagIndex != MArgList::kInvalidArgIndex) {
    outputRootTransform = true;
  }

  outputChildTransforms = true;
  flagIndex = args.flagIndex("ct", "childTransforms");
  if (flagIndex != MArgList::kInvalidArgIndex) {
    outputChildTransforms = true;
  }

  debug = false;
  flagIndex = args.flagIndex("d", "debug");
  if (flagIndex != MArgList::kInvalidArgIndex) {
    debug = true;
  }

  binaryRib = false;
  flagIndex = args.flagIndex("b", "binary");
  if (flagIndex != MArgList::kInvalidArgIndex) {
    binaryRib = true;
  }

  return redoIt();
}
Пример #24
0
MStatus dagPoseInfo::parseArgs( const MArgList& args )
//
// There is one mandatory flag: -f/-file <filename>
//
{
    MStatus     	stat;
    MString     	arg;
    MString			fileName;
    const MString	fileFlag			("-f");
    const MString	fileFlagLong		("-file");

    // Parse the arguments.
    for ( unsigned int i = 0; i < args.length(); i++ ) {
        arg = args.asString( i, &stat );
        if (!stat)
            continue;

        if ( arg == fileFlag || arg == fileFlagLong ) {
            // get the file name
            //
            if (i == args.length()-1) {
                arg += ": must specify a file name";
                displayError(arg);
                return MS::kFailure;
            }
            i++;
            args.get(i, fileName);
        }
        else {
            arg += ": unknown argument";
            displayError(arg);
            return MS::kFailure;
        }
    }

    file = fopen(fileName.asChar(),"wb");
    if (!file) {
        MString openError("Could not open: ");
        openError += fileName;
        displayError(openError);
        stat = MS::kFailure;
    }

    return stat;
}
Пример #25
0
MStatus moveCmd::finalize()
//
// Description
//     Command is finished, construct a string for the command
//     for journalling.
//
{
    MArgList command;
    command.addArg( commandString() );
    command.addArg( delta.x );
    command.addArg( delta.y );
    command.addArg( delta.z );

	// This call adds the command to the undo queue and sets
	// the journal string for the command.
	//
    return MPxToolCommand::doFinalize( command );
}
Пример #26
0
MStatus setupRGBShaders::doIt( const MArgList & args )
{
    unsigned int FIndex = args.flagIndex( "fp", "folderPath" );
    unsigned int fIndex = args.flagIndex( "fn", "fileName" );

    if( FIndex == MArgList::kInvalidArgIndex || fIndex == MArgList::kInvalidArgIndex ) {
        MGlobal::displayError( "Error specifying flag or flag values. \n-fp, -folderPath <folder_path> \t -fn, -fileName <file_name>" );
        return MS::kFailure;
    }

    folderPath = args.asString( FIndex );
    fileName = args.asString( fIndex );

    MItDag meshIt( MItDag::kDepthFirst, MFn::kMesh );

    for( ; !meshIt.isDone(); meshIt.next() ) {
        MDagPath dagPath;

        meshIt.getPath( dagPath );
        meshObjs.append( dagPath.transform() );
    }

    MItDag camIt( MItDag::kDepthFirst, MFn::kCamera );

    for( ; !camIt.isDone(); camIt.next() ) {
        MDagPath dagPath;

        camIt.getPath( dagPath );
        MFnDependencyNode camFn( dagPath.node() );

        bool isRenderable;
        camFn.findPlug( "renderable" ).getValue( isRenderable );

        if( isRenderable )
            camObjs.append( dagPath.transform() );
    }

    MGlobal::executeCommand( "setAttr miDefaultFramebuffer.datatype 5" );

    return redoIt();
}
Пример #27
0
bool readMultiUseFlag(const char flagName[], MArgDatabase &args, MSelectionList &sel){
	if (!args.isFlagSet(flagName))
		return false;
	MStatus status;

    for(unsigned int i=0,numUses = args.numberOfFlagUses(flagName); i<numUses; i++ )
    {
            MArgList argList;
            status = args.getFlagArgumentList( flagName, i, argList );
			CHECK_STATUS("problem reading multi flag",status);

            MString name = argList.asString( 0, &status );

			CHECK_STATUS("problem reading multi flag (2)",status);

			status = sel.add(name);
			CHECK_STATUS("problem adding item to selection",status);
	}

	return true;
}
Пример #28
0
MStatus iffPpm::doIt( const MArgList& args )
{
    MString componentName;
	if (args.length () < 2 || args.length () > 3) {
		displayError ("Syntax: iffPpm ifffile ppmfile [-depth]");
		return MS::kFailure;
	}

	args.get (0, fileName);
	args.get (1, ppmFile);
	if (args.length () == 3)
	{
		MString lastArg;
		args.get (2, lastArg);
		if (lastArg != MString ("-depth")) {
			displayError ("Syntax: iffPpm ifffile ppmfile [-depth]");
			return MS::kFailure;
		}
		useDepth = true;
	}
	else
		useDepth = false;

    return redoIt();
}
Пример #29
0
MStatus customAttrCmd::finalize()
//
// Description
//     This method constructs the final command syntax which will be called
//     to execute/undo/redo the action.  The syntax of the generated command
//     will be:
//
//     customAttrToolCmd <deltaVal>
//
//     where <deltaVal> is the most recently set value from the call to
//	   customAttrCmd::setDelta().
//
{
    MArgList command;
    command.addArg( commandString() );
    command.addArg( delta );

	// This call adds the command to the undo queue and sets
	// the journal string for the command.
	//
    return MPxToolCommand::doFinalize( command );
}
Пример #30
0
MStatus customAttrCmd::doIt( const MArgList& args )
//
// Description
// 	  This method executes the command given the passed arguments.
//    The arguments consist of a delta value and one or more axes
//    along which the delta value will be applied.
//
{
	MStatus stat;

	delta = args.asDouble( 0, &stat );

	return action( DOIT );
}