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


C++ MFnDependencyNode::object方法代码示例

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


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

示例1: createAnimationCurve

    //---------------------------------------------------
    MObject DagHelper::createAnimationCurve ( const MPlug& plug, const char* curveType )
    {
        MStatus rc;
        MFnDependencyNode curveFn;
        curveFn.create ( curveType, &rc );

        if ( rc == MStatus::kSuccess )
        {
            DagHelper::connect ( curveFn.object(), "output", plug );
        }

        return curveFn.object();
    }
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:14,代码来源:COLLADAMayaDagHelper.cpp

示例2: addColorParameter

MStatus PRTAttrs::addColorParameter(MFnDependencyNode & node, MObject & attr, const MString & name, MString & value ) {
	MStatus             stat;
	MFnNumericAttribute nAttr;

	const wchar_t* s = value.asWChar();

	attr = nAttr.createColor(longName(name), briefName(name), &stat );
	MCHECK(stat);

	double r = 0.0;
	double g = 0.0;
	double b = 0.0;

	if (s[0] == '#' && wcslen(s) >= 7) {
		r = (double)((prtu::fromHex(s[1]) << 4) + prtu::fromHex(s[2])) / 255.0;
		g = (double)((prtu::fromHex(s[3]) << 4) + prtu::fromHex(s[4])) / 255.0;
		b = (double)((prtu::fromHex(s[5]) << 4) + prtu::fromHex(s[6])) / 255.0;

		nAttr.setDefault(r, g, b);
	}

	MCHECK(addParameter(node, attr, nAttr));

	MFnNumericData fnData;
	MObject        rgb = fnData.create(MFnNumericData::k3Double, &stat);
	MCHECK(stat);

	fnData.setData(r, g, b);
	MPlug plug(node.object(), attr);
	MCHECK(plug.setValue(rgb));

	return MS::kSuccess;
}
开发者ID:Esri,项目名称:esri-cityengine-sdk,代码行数:33,代码来源:PRTAttrs.cpp

示例3: addBoolParameter

MStatus PRTAttrs::addBoolParameter(MFnDependencyNode & node, MObject & attr, const MString & name, bool value) {
	MStatus stat;
	MFnNumericAttribute nAttr;
	attr = nAttr.create(longName(name), briefName(name), MFnNumericData::kBoolean, value, &stat);
	if ( stat != MS::kSuccess ) throw stat;

	MCHECK(addParameter(node, attr, nAttr));

	MPlug plug(node.object(), attr);
	MCHECK(plug.setValue(value));

	return MS::kSuccess;
}
开发者ID:Esri,项目名称:esri-cityengine-sdk,代码行数:13,代码来源:PRTAttrs.cpp

示例4: addStrParameter

MStatus PRTAttrs::addStrParameter(MFnDependencyNode & node, MObject & attr, const MString & name, MString & value ) {
	MStatus           stat;
	MStatus           stat2;
	MFnStringData		  stringData;
	MFnTypedAttribute sAttr;

	attr = sAttr.create(longName(name), briefName(name), MFnData::kString, stringData.create(value, &stat2), &stat );
	MCHECK(stat2);
	MCHECK(stat);
	MCHECK(addParameter(node, attr, sAttr));

	MPlug plug(node.object(), attr);
	MCHECK(plug.setValue(value));

	return MS::kSuccess;
}
开发者ID:Esri,项目名称:esri-cityengine-sdk,代码行数:16,代码来源:PRTAttrs.cpp

示例5: addEnumParameter

MStatus PRTAttrs::addEnumParameter(MFnDependencyNode & node, MObject & attr, const MString & name, short value, PRTEnum * e) {


	MStatus stat;

	attr = e->mAttr.create(longName(name), briefName(name), value, &stat);
	MCHECK(stat);

	MCHECK(e->fill());

	MCHECK(addParameter(node, attr, e->mAttr));

	MPlug plug(node.object(), attr);
	MCHECK(plug.setValue(value));

	return MS::kSuccess;
}
开发者ID:Esri,项目名称:esri-cityengine-sdk,代码行数:17,代码来源:PRTAttrs.cpp

示例6: EntityNodeParent

static MObject EntityNodeParent( MDagPath& path )
{
    if( path.hasFn( MFn::kDagNode ) )
    {
        MDagPath parentPath;
        MFnDependencyNode nodeFn;

        while( path.pop( 1 ) != MS::kInvalidParameter )
        {        
            nodeFn.setObject( path.node() );
            if( nodeFn.typeId() == EntityInstanceNode::s_TypeID )    
            {
                return nodeFn.object();
            }
        }
    }

    return MObject::kNullObj;
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例7: addFloatParameter

MStatus PRTAttrs::addFloatParameter(MFnDependencyNode & node, MObject & attr, const MString & name, double value, double min, double max) {
	MStatus stat;
	MFnNumericAttribute nAttr;
	attr = nAttr.create(longName(name), briefName(name), MFnNumericData::kDouble, value, &stat );
	if ( stat != MS::kSuccess ) throw stat;

	if(!isnan(min)) {
		MCHECK(nAttr.setMin(min));
	}

	if(!isnan(max)) {
		MCHECK(nAttr.setMax( max ));
	}

	MCHECK(addParameter(node, attr, nAttr));

	MPlug plug(node.object(), attr);
	MCHECK(plug.setValue(value));

	return MS::kSuccess;
}
开发者ID:Esri,项目名称:esri-cityengine-sdk,代码行数:21,代码来源:PRTAttrs.cpp

示例8: updateRuleFiles

MStatus PRTAttrs::updateRuleFiles(MFnDependencyNode & node, MString & rulePkg) {
	PRTNode* prtNode = (PRTNode*)node.userNode();
	MStatus  stat;

	std::string utf8Path(rulePkg.asUTF8());
	std::vector<char> percentEncodedPath(2*utf8Path.size()+1);
	size_t len = percentEncodedPath.size();
	prt::StringUtils::percentEncode(utf8Path.c_str(), &percentEncodedPath[0], &len);
	if(len > percentEncodedPath.size()+1){
		percentEncodedPath.resize(len);
		prt::StringUtils::percentEncode(utf8Path.c_str(), &percentEncodedPath[0], &len);
	}

	std::string uri(FILE_PREFIX);
	uri.append(&percentEncodedPath[0]);

	prtNode->mLRulePkg = uri;

	if(prtNode->mCreatedInteractively) {
		int count = (int)node.attributeCount(&stat);
		MCHECK(stat);

		MObjectArray attrs;

		for(int i = 0; i < count; i++) {
			MObject attr = node.attribute(i, &stat);
			if(stat != MS::kSuccess) continue;
			attrs.append(attr);
		}

		for(unsigned int i = 0; i < attrs.length(); i++) {
			MPlug   plug(node.object(), attrs[i]);
			MString name = plug.partialName();

			if(prtNode->mBriefName2prtAttr.count(name.asWChar()))
				node.removeAttribute(attrs[i]);
		}
		prtNode->destroyEnums();
	} else {
		node.removeAttribute(node.attribute(NAME_GENERATE, &stat));
		MCHECK(stat);
	}

	prtNode->mRuleFile.clear();
	prtNode->mStartRule.clear();

	MString      unpackDir       = MGlobal::executeCommandStringResult("workspace -q -fullName");
	unpackDir += "/assets";
	prt::Status resolveMapStatus = prt::STATUS_UNSPECIFIED_ERROR;


	std::wstring utf16URI;
	utf16URI.resize(uri.size()+1);
	len = utf16URI.size();
	if(prt::StringUtils::toUTF16FromUTF8(uri.c_str(), &utf16URI[0], &len)) {
		utf16URI.resize(len);
		prt::StringUtils::toUTF16FromUTF8(uri.c_str(), &utf16URI[0], &len);
	}

	prtNode->mResolveMap = prt::createResolveMap(utf16URI.c_str(), unpackDir.asWChar(), &resolveMapStatus);
	if(resolveMapStatus == prt::STATUS_OK) {
		size_t nKeys;
		const wchar_t * const* keys   = prtNode->mResolveMap->getKeys(&nKeys);
		std::wstring           sCGB(L".cgb");
		for(size_t k = 0; k < nKeys; k++) {
			std::wstring key = std::wstring(keys[k]);
			if(std::equal(sCGB.rbegin(), sCGB.rend(), key.rbegin())) {
				prtNode->mRuleFile = key;
				break;
			}
		}
	} else {
		prtNode->mResolveMap = 0;
	}

	if(prtNode->mRuleFile.length() > 0)
		updateStartRules(node);

	return MS::kSuccess;
}
开发者ID:Esri,项目名称:esri-cityengine-sdk,代码行数:80,代码来源:PRTAttrs.cpp

示例9: bumpFn

Corona::SharedPtr<Corona::Abstract::Map> getOslTexMap(MString& attributeName, MFnDependencyNode& depFn, ShadingNetwork& sn)
{
	MStatus status;
	OSL::OSLShadingNetworkRenderer *oslRenderer;
	MayaTo::MayaToWorld::WorldRenderType rType = MayaTo::getWorldPtr()->getRenderType();
	if ((rType == MayaTo::MayaToWorld::WorldRenderType::SWATCHRENDER))
	{
		oslRenderer = (OSL::OSLShadingNetworkRenderer *)MayaTo::getObjPtr("oslSwatchRenderer");
	}
	else{
		oslRenderer = (OSL::OSLShadingNetworkRenderer *)MayaTo::getObjPtr("oslRenderer");
	}

	size_t numNodes = sn.shaderList.size();
	MString OSLInterfaceName = depFn.name() + "_" + attributeName + "_OSLInterface";
	MString shaderGroupName = depFn.name() + "_" + attributeName + "_OSLShadingGroup";
	OSL::ShaderGroupRef shaderGroup = oslRenderer->shadingsys->ShaderGroupBegin(shaderGroupName.asChar());

	MObject thisMObject = depFn.object();
	MString outPlugName;
	MString connectedObjectName = getObjectName(getOtherSideSourceNode(attributeName, thisMObject, true, outPlugName));

	Logging::debug(MString("getOslTexMap: ") + connectedObjectName + "." + outPlugName + " is connected with " + depFn.name() + "." + attributeName);
	MPlug shaderPlug = depFn.findPlug(attributeName);

	MAYATO_OSL::createOSLProjectionNodes(shaderPlug);

	for (int shadingNodeId = 0; shadingNodeId < numNodes; shadingNodeId++)
	{
		ShadingNode snode = sn.shaderList[shadingNodeId];
		Logging::debug(MString("ShadingNode Id: ") + shadingNodeId + " ShadingNode name: " + snode.fullName);
		MAYATO_OSL::createOSLHelperNodes(sn.shaderList[shadingNodeId]);
		MAYATO_OSL::createOSLShadingNode(sn.shaderList[shadingNodeId]);
		MAYATO_OSL::connectProjectionNodes(sn.shaderList[shadingNodeId].mobject);

		if (snode.fullName == connectedObjectName.asChar())
		{
			MAYATO_OSL::createOSLHelperNodes(sn.shaderList[sn.shaderList.size() - 1]);
			Logging::debug(MString("connected node found: ") + snode.fullName + " search output attr.");

			for (size_t outId = 0; outId < snode.outputAttributes.size(); outId++)
			{
				ShaderAttribute& sa = snode.outputAttributes[outId];
				if (MString(sa.name.c_str()) == outPlugName)
				{
					Logging::debug(MString("connected out attr found: ") + sa.name.c_str() + " ");

					MString destParam;
					MString sourceParam = outPlugName;
					MString sourceNode = connectedObjectName;
					if ((sa.type == "color") || (sa.type == "vector"))
					{
						// lets see if we have a color helper node
						MString helperNodeName = MAYATO_OSL::createPlugHelperNodeName(attributeName.asChar(), thisMObject, false);
						Logging::debug(MString("Interface connection - color/vector attribute ") + sa.name.c_str() + " search for helper node " + helperNodeName);
						if (MAYATO_OSL::doesOSLNodeAlreadyExist(helperNodeName))
						{
							Logging::debug(MString("Found helper node name."));
							sourceParam = "outputValue";
							sourceNode = helperNodeName;
						}
						destParam = "inVector";
					}
					if (sa.type == "float")
					{
						destParam = "inFloat";
					}
					if (sa.type == "int")
					{
						destParam = "inInt";
					}
					if (sa.type == "bool")
					{
						destParam = "inBool";
					}

					if (sourceParam == "output")
						sourceParam = "outOutput";

					// if we have a color/vector input, try to find a multiplier attribute
					MString multiplierName = attributeName + "Multiplier";
					MPlug multiplierAttribute = depFn.findPlug(multiplierName, true, &status);
					if (status)
					{
						Logging::debug(MString("Found multiplier attribute: ") + multiplierName);
						float multiplier = multiplierAttribute.asFloat();
						float offset = 0.0f;
						if ((attributeName == "refractionIndex") || (attributeName == "reflectionIor"))
						{
							offset = -1.0f;
						}
						oslRenderer->shadingsys->Parameter("multiplier", OSL::TypeDesc::TypeFloat, &multiplier);
						oslRenderer->shadingsys->Parameter("offset", OSL::TypeDesc::TypeFloat, &offset);
					}
					Logging::debug(MString("creating OSLInterface shader ") + OSLInterfaceName);
					bool success = oslRenderer->shadingsys->Shader("surface", "OSLInterface", OSLInterfaceName.asChar());
					Logging::debug(MString("connecting ") + sourceNode + "." + sourceParam + " -> " + OSLInterfaceName + "." + destParam);
					success = oslRenderer->shadingsys->ConnectShaders(sourceNode.asChar(), sourceParam.asChar(), OSLInterfaceName.asChar(), destParam.asChar());
					break;
				}
//.........这里部分代码省略.........
开发者ID:posplotico,项目名称:OpenMaya,代码行数:101,代码来源:coronaOSLMapUtil.cpp

示例10: RunScripts

void CScriptedShapeTranslator::RunScripts(AtNode *atNode, unsigned int step, bool update)
{
   std::map<std::string, CScriptedTranslator>::iterator translatorIt;
   MFnDependencyNode fnNode(GetMayaObject());
   
   translatorIt = gTranslators.find(fnNode.typeName().asChar());
   if (translatorIt == gTranslators.end())
   {
      AiMsgError("[mtoa.scriptedTranslators] No command to export node \"%s\" of type %s.", fnNode.name().asChar(), fnNode.typeName().asChar());
      return;
   }
   
   MString exportCmd = translatorIt->second.exportCmd;
   MString cleanupCmd = translatorIt->second.cleanupCmd;
   
   MFnDagNode node(m_dagPath.node());
   
   bool isMasterDag = false;
   bool transformBlur = IsMotionBlurEnabled(MTOA_MBLUR_OBJECT) && IsLocalMotionBlurEnabled();
   bool deformBlur = IsMotionBlurEnabled(MTOA_MBLUR_DEFORM) && IsLocalMotionBlurEnabled();
   
   char buffer[64];
   
   MString command = exportCmd;
   command += "(";
   
   sprintf(buffer, "%f", GetExportFrame());
   command += buffer;
   command += ", ";
   
   sprintf(buffer, "%d", step);
   command += buffer;
   command += ", ";
   
   // current sample frame
   sprintf(buffer, "%f", GetSampleFrame(m_session, step));
   command += buffer;
   command += ", ";
   
   // List of arnold attributes the custom shape export command has overriden
   MStringArray attrs;
   
   if (!m_masterNode)
   {
      command += "(\"" + m_dagPath.partialPathName() + "\", \"";
      command += AiNodeGetName(atNode);
      command += "\"), None)";
      isMasterDag = true;
   }
   else
   {
      command += "(\"" + m_dagPath.partialPathName() + "\", \"";
      command += AiNodeGetName(atNode);
      command += "\"), (\"" + GetMasterInstance().partialPathName() + "\", \"";
      command += AiNodeGetName(m_masterNode);
      command += "\"))";
   }
   
   MStatus status = MGlobal::executePythonCommand(command, attrs);
   if (!status)
   {
      AiMsgError("[mtoa.scriptedTranslators] Failed to export node \"%s\".", node.name().asChar());
      return;
   }
   
   // Build set of attributes already processed
   std::set<std::string> attrsSet;
   for (unsigned int i=0; i<attrs.length(); ++i)
   {
      attrsSet.insert(attrs[i].asChar());
   }
   std::set<std::string>::iterator attrsEnd = attrsSet.end();
   
   // Should be getting displacement shader from master instance only
   //   as arnold do not support displacement shader overrides for ginstance
   MFnDependencyNode masterShadingEngine;
   MFnDependencyNode shadingEngine;
   float dispPadding = -AI_BIG;
   float dispHeight = 1.0f;
   float dispZeroValue = 0.0f;
   bool dispAutobump = false;
   bool outputDispPadding = false;
   bool outputDispHeight = false;
   bool outputDispZeroValue = false;
   bool outputDispAutobump = false;
   
   const AtNodeEntry *anodeEntry = AiNodeGetNodeEntry(atNode);
   
   GetShapeInstanceShader(m_dagPath, shadingEngine);
   if (!IsMasterInstance())
   {
      GetShapeInstanceShader(GetMasterInstance(), masterShadingEngine);
   }
   else
   {
      masterShadingEngine.setObject(shadingEngine.object());
   }
   
   AtMatrix matrix;
   MMatrix mmatrix = m_dagPath.inclusiveMatrix();
//.........这里部分代码省略.........
开发者ID:jonntd,项目名称:mtoaScriptedTranslators,代码行数:101,代码来源:shapetranslator.cpp

示例11:

NifTextureConnector::NifTextureConnector(MFnDependencyNode texture_placement, int uv_set) {
	this->texturePlacement.setObject(texture_placement.object());
	this->uvSet = uv_set;
}
开发者ID:jonntd,项目名称:maya_nif_plugin,代码行数:4,代码来源:NifTextureConnector.cpp


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