本文整理汇总了C++中MDGModifier::newPlugValueFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ MDGModifier::newPlugValueFloat方法的具体用法?C++ MDGModifier::newPlugValueFloat怎么用?C++ MDGModifier::newPlugValueFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDGModifier
的用法示例。
在下文中一共展示了MDGModifier::newPlugValueFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadComponent
MObject GlobalComponent::loadComponent(MDGModifier & dgMod) {
MStatus status = MS::kFailure;
this->m_metaDataNode = dgMod.createNode( "MDGlobalNode", &status );
MyCheckStatus(status, "createNode failed");
MString metaNodeName = "MGN_";
metaNodeName += this->m_rigName + "_";
metaNodeName += this->m_pCompGuide->getName();
dgMod.renameNode(this->m_metaDataNode, metaNodeName);
MFnDependencyNode depMetaDataNodeFn(this->m_metaDataNode);
status = dgMod.newPlugValueFloat( depMetaDataNodeFn.findPlug("version"), this->m_pCompGuide->getVersion() );
MyCheckStatus(status, "newPlugValueFloat() failed");
status = dgMod.newPlugValueString( depMetaDataNodeFn.findPlug("rigId"), this->m_pCompGuide->getRigId() );
MyCheckStatus(status, "newPlugValueInt() failed");
GlobalComponentGuidePtr globalGuide = boost::dynamic_pointer_cast<GlobalComponentGuide>(this->m_pCompGuide);
MString ctlColor = globalGuide->getColor();
MString ctlIcon = globalGuide->getIcon();
status = MGlobal::executeCommand( "python(\"control = rig101().rig101WCGetByName('" + ctlIcon + "')\");" );
status = MGlobal::executeCommand( "python(\"Utils.setControllerColor(control, '" + ctlColor + "')\");" );
MCommandResult res;
status = MGlobal::executeCommand( MString("python(\"control.fullPath()\");"), res );
int resType = res.resultType();
if( resType == MCommandResult::kString ) {
MString sResult;
res.getResult(sResult);
MObject ctlObj;
status = lrutils::getObjFromName(sResult, ctlObj);
MyCheckStatus(status, "lrutils::getObjFromName() failed");
MVectorArray ctlLocation = this->m_pCompGuide->getLocation(0);
MFnTransform transformFn( ctlObj );
lrutils::setLocation(ctlObj, ctlLocation, MFnTransform::MFnTransform(), false, false, true);
MString ctlName = this->m_rigName + "_" + this->m_pCompGuide->getName() + "_CTL";
dgMod.renameNode(ctlObj, ctlName);
dgMod.doIt();
//add the metaParent attribute to the controller
MFnMessageAttribute mAttr;
MObject transformAttr = mAttr.create("metaParent", "metaParent");
transformFn.addAttribute(transformAttr);
//connect the controller's metaParent to the MDGlobal node
status = dgMod.connect( depMetaDataNodeFn.findPlug("controller"), transformFn.findPlug("metaParent") );
MObject ctlGroupObj;
lrutils::makeHomeNull(ctlObj, MFnTransform(), ctlGroupObj);
lrutils::setLocation(ctlGroupObj, ctlLocation, MFnTransform::MFnTransform(), true, true, false);
MFnTransform ctlGroupFn( ctlGroupObj );
//add the metaParent attribute to the controller group
ctlGroupFn.addAttribute(mAttr.create("metaParent", "metaParent"));
//connect the controller group's metaParent to the MDGlobal node
status = dgMod.connect( depMetaDataNodeFn.findPlug("controllerGroup"), ctlGroupFn.findPlug("metaParent") );
MyCheckStatus(status, "connect failed");
MObject metaRootObj;
status = lrutils::getMetaRootByName(metaRootObj, this->m_rigName);
MyCheckStatus(status, "lrutils::getMetaRootByName() failed");
MObject rigCtlGroupObj;
status = lrutils::getMetaNodeConnection(metaRootObj, rigCtlGroupObj, "ctlGroup");
MyCheckStatus(status, "lrutils::getMetaNodeConnection() failed");
MFnTransform rigCtlGroupFn( rigCtlGroupObj );
rigCtlGroupFn.addChild( ctlGroupObj );
//add controller to controller display layer
MObject controlLayerObj;
status = lrutils::getMetaNodeConnection(metaRootObj, controlLayerObj, "ctlLayer");
MyCheckStatus(status, "lrutils::getMetaNodeConnection() failed");
MFnDependencyNode controlLayerFn(controlLayerObj);
MString controlLayerName = controlLayerFn.name();
MGlobal::executeCommand("editDisplayLayerMembers -noRecurse "+controlLayerName+" "+rigCtlGroupFn.name()+";");
//create parent constraints from the global controller to the rig group
MObject rigRigGroupObj;
status = lrutils::getMetaNodeConnection(metaRootObj, rigRigGroupObj, "rigGroup");
MFnTransform rigRigGroupFn( rigRigGroupObj );
MGlobal::executeCommand("parentConstraint -mo "+transformFn.name()+" "+rigRigGroupFn.name()+";", res);
//connect the parent constraint object to the component's metadata node
MStringArray sResults;
res.getResult(sResults);
status = lrutils::getObjFromName(sResults[0], this->m_rigParentConstraint);
MyCheckStatus(status, "lrutils::getObjFromName() failed");
MFnTransform rigParentConstraintFn( this->m_rigParentConstraint);
rigParentConstraintFn.addAttribute(mAttr.create("metaParent", "metaParent"));
status = dgMod.connect( depMetaDataNodeFn.findPlug("rigParentConstraint"), rigParentConstraintFn.findPlug("metaParent"));
//create the scale constraint from the global controller to the rig group
MGlobal::executeCommand("scaleConstraint -mo "+transformFn.name()+" "+rigRigGroupFn.name()+";", res);
//connect the scale constraint object to the component's metadata node
res.getResult(sResults);
status = lrutils::getObjFromName(sResults[0], this->m_rigScaleConstraint);
MyCheckStatus(status, "lrutils::getObjFromName() failed");
MFnTransform rigScaleConstraintFn( this->m_rigScaleConstraint );
rigScaleConstraintFn.addAttribute(mAttr.create("metaParent", "metaParent"));
status = dgMod.connect( depMetaDataNodeFn.findPlug("rigScaleConstraint"), rigScaleConstraintFn.findPlug("metaParent"));
//create scale constraint from the global controller to the noTransform group
MObject rigNoTransformGroupObj;
status = lrutils::getMetaNodeConnection(metaRootObj, rigNoTransformGroupObj, "noTransformGroup");
MFnTransform rigNoTransformGroupFn( rigNoTransformGroupObj );
MGlobal::executeCommand("scaleConstraint -mo "+transformFn.name()+" "+rigNoTransformGroupFn.name()+";", res);
//connect the scale constraint object to the component's metadata node
//.........这里部分代码省略.........