当前位置: 首页>>代码示例>>C++>>正文


C++ MDGModifier类代码示例

本文整理汇总了C++中MDGModifier的典型用法代码示例。如果您正苦于以下问题:C++ MDGModifier类的具体用法?C++ MDGModifier怎么用?C++ MDGModifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MDGModifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MFloatPoint

sgBLocator_fromGeo::sgBLocator_fromGeo()
{
	m_pointArr.setLength(6);

 	m_pointArr[0] = MFloatPoint(  1,  0, 0 );
	m_pointArr[1] = MFloatPoint( -1,  0, 0 );
	m_pointArr[2] = MFloatPoint(  0, -1, 0 );
	m_pointArr[3] = MFloatPoint(  0,  1, 0 );
	m_pointArr[4] = MFloatPoint(  0,  0, 1 );
	m_pointArr[5] = MFloatPoint(  0,  0, -1 );

	m_boundingBox.clear();
    m_boundingBox.expand( MVector( 1.0, 1.0, 1.0 ) );
    m_boundingBox.expand( MVector( -1.0, -1.0, -1.0 ) );

	m_colorActive =  MColor( 1.0f, 1.0f, 1.0f );
	m_colorLead   =	 MColor( .26f, 1.0f, .64f );
	m_colorDefault = MColor( 1.0f, 1.0f, 0.0f );

	m_lineWidth = 1;

	MFnDependencyNode fnNode( thisMObject() );
	MPlug plugOutput = fnNode.findPlug( aOutputValue );
	MPlug plugVis    =fnNode.findPlug( "v" );

	MDGModifier dgModifier;
	dgModifier.connect( plugOutput, plugVis );
}
开发者ID:jonntd,项目名称:mayadev-1,代码行数:28,代码来源:sgBLocator_fromGeo.cpp

示例2: disconnectAllPlugsTo

MStatus disconnectAllPlugsTo(MPlug & dstPlug)
{
    MStatus status = MS::kSuccess;
    MPlugArray array;
    dstPlug.connectedTo(array, true, false, &status);
    unsigned int arrayLength = array.length();

    for (unsigned int i = 0; i < arrayLength; i++)
    {
        MPlug srcPlug = array[i];
        if (status == MS::kSuccess)
        {
            MDGModifier modifier;
            status = modifier.disconnect(srcPlug, dstPlug);
            status = modifier.doIt();
            if (status != MS::kSuccess)
            {
                MString theError("Disconnect ");
                theError += srcPlug.name();
                theError += MString(" -> ");
                theError += dstPlug.name();
                theError += MString(" failed, status = ");
                theError += status.errorString();
                MGlobal::displayError(theError);
                return status;
            }
        }
    }
    return MS::kSuccess;
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:30,代码来源:util.cpp

示例3: destFn

    //---------------------------------------------------
    bool DagHelper::connectToList ( const MPlug& source, const MObject& destination, const MString& destinationAttribute, int* _index )
    {
        MStatus status;
        MFnDependencyNode destFn ( destination );
        MPlug dest = destFn.findPlug ( destinationAttribute, &status );

        if ( status != MStatus::kSuccess ) return false;

        if ( !dest.isArray() ) return false;

        int index = ( _index != NULL ) ? *_index : -1;

        if ( index < 0 )
        {
            index = getNextAvailableIndex ( dest, ( int ) dest.evaluateNumElements() );

            if ( _index != NULL ) *_index = index;
        }

        MPlug d = dest.elementByLogicalIndex ( index );

        MDGModifier modifier;
        modifier.connect ( source, d );
        status = modifier.doIt();
        return status == MStatus::kSuccess;
    }
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:27,代码来源:COLLADAMayaDagHelper.cpp

示例4: connect

    //---------------------------------------------------
    bool DagHelper::connect ( const MPlug& source, const MPlug& destination )
    {
        MDGModifier modifier;
        modifier.connect ( source, destination );
        MStatus status = modifier.doIt();

        return status == MStatus::kSuccess;
    }
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:9,代码来源:COLLADAMayaDagHelper.cpp

示例5: deleteCurrentSelection

MStatus deleteCurrentSelection()
{
    MStatus status;

    MDGModifier modifier;
    status = modifier.commandToExecute("\ndelete;\n");
    status = modifier.doIt();

    return status;
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:10,代码来源:util.cpp

示例6: jointFn

std::vector<MObject> lrutils::buildSkeletonFromGuide(std::vector<MVectorArray> locations, MString prefix, MPlug metaDataPlug, MObject metaParentJoint, MString layerName) {
    MDGModifier dgMod;
    MStatus status;
    std::vector<MObject> joints;
    MFnMessageAttribute mAttr;

    MObject parentJoint;
    unsigned int jointNum = 0;

    for (std::vector<MVectorArray>::iterator it = locations.begin(); it != locations.end(); ++it) {
        MVectorArray location = *it;
        MObject joint = createJointFromLocation(location, prefix, jointNum, parentJoint);
        joints.push_back(joint);

        MFnTransform jointFn( joint );
        //add metaParent attributes to joint
        if(!metaDataPlug.isNull()) {
            MObject jointAttr = mAttr.create("metaParent", "metaParent");
            jointFn.addAttribute(jointAttr);
            //connect the metaparent attribute to the MDSpine node
            status = dgMod.connect( metaDataPlug, jointFn.findPlug("metaParent") );
            MyCheckStatus(status, "connect failed");
            dgMod.doIt();
        }

        //if layer name is provided, add the joint to that display layer
        if(layerName != "") {
            MGlobal::executeCommand("editDisplayLayerMembers -noRecurse "+ layerName+" "+ jointFn.name()+";");
        }

        parentJoint = joint;
        jointNum++;
    }
    //orient the joint chain
    MFnTransform topJointFn(joints.at(0));
    MGlobal::executeCommand("joint -e -zso -oj \"xyz\" -sao \"yup\" -ch " + topJointFn.fullPathName() + ";");

    //if meta parent joint is not null, parent first joint to it
    if(!metaParentJoint.isNull()) {
        MFnTransform firstJointFn(joints.at(0));

        MFnTransform metaParentJointFn(metaParentJoint);
        MGlobal::executeCommand("parent " + firstJointFn.fullPathName() + " " + metaParentJointFn.fullPathName() + ";");
        //orient the parent joint
        MGlobal::executeCommand("joint -e -zso -oj \"xyz\" -sao \"yup\" -ch " + metaParentJointFn.fullPathName() + ";");
    }

    return joints;
}
开发者ID:LoganKelly,项目名称:Modular_Rigging_Thesis,代码行数:49,代码来源:LoadRigUtils.cpp

示例7: createFKCtlFromLocation

void lrutils::createFKCtlFromLocation(MVectorArray location, MObject joint, MString prefix, unsigned int num, MString icon, MString color, MObject parent, MObject& fkCtlObj, MObject& fkCtlGroupObj, MString layerName, MObject metaDataNode) {
    MStatus status;
    MDGModifier dgMod;
    //used for holding results from executed commands
    MStringArray result;
    MFnDependencyNode depMetaDataNodeFn(metaDataNode);
    //used for creating metaParent attributes for objects
    MFnMessageAttribute mAttr;
    MFnTransform jointFn(joint);
    
    //create the control object and set its color
    status = MGlobal::executeCommand( "python(\"control = rig101().rig101WCGetByName('" + icon + "')\");" );
    status = MGlobal::executeCommand( "python(\"Utils.setControllerColor(control, '" + color + "')\");" );
    status = MGlobal::executeCommand( MString("python(\"control.fullPath()\");"), result );
    //get the MObject for the controller
    status = lrutils::getObjFromName(result[0], fkCtlObj);
    MyCheckStatus(status, "lrutils::getObjFromName() failed");
    MFnTransform fkCtlFn( fkCtlObj );
    lrutils::setLocation(fkCtlObj, location, MFnTransform::MFnTransform(), false, false, true);
    //set controller name
    MString fkCtlName = prefix + "_FK_"+num+"_CTL";
    dgMod.renameNode(fkCtlObj, fkCtlName);
    //add the metaParent attribute to the controller
    MObject controlAttr = mAttr.create("metaParent", "metaParent");
    fkCtlFn.addAttribute(controlAttr);
    //connect the controller's metaParent to the MDSpine node
    status = dgMod.connect( depMetaDataNodeFn.findPlug("FKControllers"), fkCtlFn.findPlug("metaParent") );
    dgMod.doIt();
    
    //create the fk control null
    lrutils::makeHomeNull(fkCtlObj, MFnTransform(), fkCtlGroupObj);
    lrutils::setLocation(fkCtlGroupObj, location, MFnTransform::MFnTransform(), true, true, false);
    MFnTransform fkCtlGroupFn( fkCtlGroupObj );
    if(!parent.isNull()) {
        MFnTransform parentFn(parent);
        MGlobal::executeCommand("parent " + fkCtlGroupFn.fullPathName() + " " + parentFn.fullPathName() + ";");
    }
    //add the metaParent attribute to the controller group
    fkCtlGroupFn.addAttribute(mAttr.create("metaParent", "metaParent"));
    //connect the controller group's metaParent to the MDGlobal node
    status = dgMod.connect( depMetaDataNodeFn.findPlug("FKControllerGroups"), fkCtlGroupFn.findPlug("metaParent") );
    MyCheckStatus(status, "connect failed"); 
    dgMod.doIt();

    MGlobal::executeCommand("parentConstraint -mo " + fkCtlFn.fullPathName() + " " + jointFn.fullPathName() + ";",result);
    MObject jointParentConstraintObj;
    status = lrutils::getObjFromName(result[0], jointParentConstraintObj);
    MyCheckStatus(status, "lrutils::getObjFromName() failed");
    MFnTransform jointParentConstraintFn(jointParentConstraintObj);
    jointParentConstraintFn.addAttribute(mAttr.create("metaParent", "metaParent"));
    status = dgMod.connect( depMetaDataNodeFn.findPlug("FKJointParentConstraints"), jointParentConstraintFn.findPlug("metaParent"));
    dgMod.doIt();

    //set the display layers for the controller and controller group
    MGlobal::executeCommand("editDisplayLayerMembers -noRecurse "+ layerName+" "+ fkCtlFn.fullPathName()+";");
    MGlobal::executeCommand("editDisplayLayerMembers -noRecurse "+ layerName+" "+ fkCtlGroupFn.fullPathName()+";");
    MGlobal::executeCommand("select -cl;");
}
开发者ID:LoganKelly,项目名称:Modular_Rigging_Thesis,代码行数:58,代码来源:LoadRigUtils.cpp

示例8: node

void
UsdMayaAdaptor::ClearMetadata(const TfToken& key, MDGModifier& modifier)
{
    if (!*this) {
        TF_CODING_ERROR("Adaptor is not valid");
        return;
    }

    MFnDependencyNode node(_handle.object());
    std::string mayaAttrName = _GetMayaAttrNameForMetadataKey(key);
    if (node.hasAttribute(mayaAttrName.c_str())) {
        MObject attr = node.attribute(mayaAttrName.c_str());
        modifier.removeAttribute(_handle.object(), attr);
        modifier.doIt();
    }
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:16,代码来源:adaptor.cpp

示例9: srcFn

    //---------------------------------------------------
    bool DagHelper::connect ( const MObject& source, const MString& sourceAttribute, const MPlug& destination )
    {
        MStatus status;
        MFnDependencyNode srcFn ( source );

        MPlug src = srcFn.findPlug ( sourceAttribute, &status );

        if ( status != MStatus::kSuccess ) return false;

        MDGModifier modifier;

        modifier.connect ( src, destination );

        status = modifier.doIt();

        return status == MStatus::kSuccess;
    }
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:18,代码来源:COLLADAMayaDagHelper.cpp

示例10: setMPSafe

// the postConstructor() function is called immediately after the objects
// constructor. It is not safe to call MPxNode member functions from the
// constructor, instead they should be called here.
//
void inSpecular::postConstructor( )
{
	MStatus stat;
    // setMPSafe indicates that this shader can be used for multiprocessor
    // rendering. For a shading node to be MP safe, it cannot access any
    // shared global data and should only use attributes in the datablock
    // to get input data and store output data.
    //
    setMPSafe( true );

	MDGModifier modifier;

	MPlug sourcePlug = MPlug(this->thisMObject(), emission);
	MPlug destPlug = MPlug(this->thisMObject(), aIncandescence);
	if( !destPlug.isConnected() )
		stat = modifier.connect(sourcePlug, destPlug);

	stat = modifier.doIt();
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:23,代码来源:inSpecularMaterial.cpp

示例11:

void
VertexPolyColourCommand::RemoveColoursNode(MDagPath& dagPath, MColorArray& colors)
{
	MStatus status;

	MObject ourNode;
	if (FindNodeOnMesh(dagPath,ourNode))
	{
		MDGModifier* modifier = new MDGModifier;

		// Delete the node
		status=modifier->deleteNode(ourNode);
		status=modifier->doIt();

		if (m_isUndoable)
			m_undos.push_back(modifier);
		else
			delete modifier;		
	}
}
开发者ID:jonntd,项目名称:MayaPlugin-VertexChameleon,代码行数:20,代码来源:VertexPolyColourCommand_Node.cpp

示例12:

MStatus	Molecule3Cmd::undoIt()
{
	MDGModifier dgMod;
	MFnDagNode dagFn;
	MObject child;
	
	unsigned int i;
	for( i=0; i < objTransforms.length(); i++ )
	{
		// N.B. It is important to delete the child shape before
		// the transform node, otherwise Maya will crash.
		dagFn.setObject( objTransforms[i] );
		child = dagFn.child( 0 );
		dgMod.deleteNode( child );
		
		dgMod.deleteNode( objTransforms[i] );
	}
	
	return dgMod.doIt();
}
开发者ID:animformed,项目名称:complete-maya-programming-book-files,代码行数:20,代码来源:Molecule3Cmd.cpp

示例13: MCheckStatus

MStatus polyModifierCmd::cacheMeshData()
{
	MStatus status = MS::kSuccess;

	MFnDependencyNode depNodeFn;
	MFnDagNode dagNodeFn;

	MObject meshNode = fDagPath.node();
	MObject dupMeshNode;
	MPlug dupMeshNodeOutMeshPlug;

	// Duplicate the mesh
	//
	dagNodeFn.setObject( meshNode );
	dupMeshNode = dagNodeFn.duplicate();

	MDagPath dupMeshDagPath;
	MDagPath::getAPathTo( dupMeshNode, dupMeshDagPath );
	dupMeshDagPath.extendToShape();

	depNodeFn.setObject( dupMeshDagPath.node() );
	dupMeshNodeOutMeshPlug = depNodeFn.findPlug( "outMesh", &status );
	MCheckStatus( status, "Could not retrieve outMesh" );

	// Retrieve the meshData
	//
	status = dupMeshNodeOutMeshPlug.getValue( fMeshData );
	MCheckStatus( status, "Could not retrieve meshData" );

	// Delete the duplicated node
	//

	MDGModifier deleter;
	deleter.deleteNode(dupMeshNode);
	deleter.doIt();
	//MGlobal::deleteNode( dupMeshNode );

	return status;
}
开发者ID:Byron,项目名称:bsuite,代码行数:39,代码来源:polyModifierCmd.cpp

示例14: fnDependNode

void
VertexPolyColourCommand::CreateNodeOnMesh(MDagPath& dagPath, MObject& ourNode)
{
	MStatus status;

	MFnDependencyNode fnDependNode( dagPath.node() );
	MPlug plug_outMesh = fnDependNode.findPlug("outMesh");

	MDGModifier* modifier = new MDGModifier;

	// Create the node
	ourNode=modifier->createNode("RH_VCP_PolyColourNode", &status);
	if (status != MStatus::kSuccess)
		MGlobal::doErrorLogEntry("error");

	// Connect it
	MFnDependencyNode dn(ourNode, &status);
	if (status != MStatus::kSuccess)
		MGlobal::doErrorLogEntry("error");
	MString dnname = dn.name();
	MPlug plug_inMesh=dn.findPlug(PolyColourNode::m_inMesh,&status);
	MString plugName = plug_inMesh.name();
	if (status != MStatus::kSuccess)
		MGlobal::doErrorLogEntry("error");
	status=modifier->connect(plug_outMesh,plug_inMesh);
	if (status != MStatus::kSuccess)
		MGlobal::doErrorLogEntry("error");

	status=modifier->doIt();
	if (status != MStatus::kSuccess)
		MGlobal::doErrorLogEntry("error");

	if (m_isUndoable)
		m_undos.push_back(modifier);
	else
		delete modifier;
}
开发者ID:jonntd,项目名称:MayaPlugin-VertexChameleon,代码行数:37,代码来源:VertexPolyColourCommand_Node.cpp

示例15: ConnectTexture

void NifTextureConnector::ConnectTexture( MDagPath mesh_path ) {
	MDGModifier dgModifier;
	MFnDependencyNode chooserFn;
	chooserFn.create( "uvChooser", "uvChooser" );

	//Connection between the mesh and the uvChooser
	MFnMesh meshFn;
	meshFn.setObject(mesh_path);
	dgModifier.connect( meshFn.findPlug("uvSet")[uvSet].child(0), chooserFn.findPlug("uvSets").elementByLogicalIndex(0) );

	//Connections between the uvChooser and the place2dTexture
	dgModifier.connect( chooserFn.findPlug("outUv"), texturePlacement.findPlug("uvCoord") );
	dgModifier.connect( chooserFn.findPlug("outVertexCameraOne"), texturePlacement.findPlug("vertexCameraOne") );
	dgModifier.connect( chooserFn.findPlug("outVertexUvOne"), texturePlacement.findPlug("vertexUvOne") );
	dgModifier.connect( chooserFn.findPlug("outVertexUvTwo"), texturePlacement.findPlug("vertexUvTwo") );
	dgModifier.connect( chooserFn.findPlug("outVertexUvThree"), texturePlacement.findPlug("vertexUvThree") );
	dgModifier.doIt();
}
开发者ID:jonntd,项目名称:maya_nif_plugin,代码行数:18,代码来源:NifTextureConnector.cpp


注:本文中的MDGModifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。