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


C++ MItDag::partialPathName方法代码示例

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


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

示例1: ExportMayaNodes

void MayaMeshExporter::ExportMayaNodes(MItDag& dag_iterator)
{
	int start_frame = static_cast<int>(MAnimControl::minTime().as(MTime::kNTSCField));
	int end_frame = static_cast<int>(MAnimControl::maxTime().as(MTime::kNTSCField));
	int num_frames = end_frame - start_frame + 1;
	meshml_obj_.NumFrames(num_frames);

	MAnimControl::setCurrentTime(MTime(start_frame, MTime::kNTSCField));

	for (MItDependencyNodes dn(MFn::kSkinClusterFilter); !dn.isDone(); dn.next())
	{
		MStatus status = MS::kSuccess;
		MObject object = dn.item();
		shared_ptr<MFnSkinCluster> skin_cluster = MakeSharedPtr<MFnSkinCluster>(object, &status);

		std::vector<MObject> objs;
		unsigned int num_geometries = skin_cluster->numOutputConnections();
		for (unsigned int i = 0; i < num_geometries; ++ i) 
		{
			unsigned int index = skin_cluster->indexForOutputConnection(i);
			objs.push_back(skin_cluster->outputShapeAtIndex(index));
		}

		if (num_geometries > 0)
		{
			skin_clusters_.push_back(std::make_pair(skin_cluster, objs));
		}

		MDagPathArray influence_paths;
		int num_influence_objs = skin_cluster->influenceObjects(influence_paths, &status);

		MDagPath joint_path, root_path;
		for (int i = 0; i < num_influence_objs; ++ i)
		{
			joint_path = influence_paths[i];
			if (joint_path.hasFn(MFn::kJoint))
			{
				// Try to retrieve the root path
				root_path = joint_path;
				while (joint_path.length() > 0)
				{
					joint_path.pop();
					if (joint_path.hasFn(MFn::kJoint) && (joint_path.length() > 0))
					{
						root_path = joint_path;
					}
				}

				if (root_path.hasFn(MFn::kJoint))
				{
					MFnIkJoint fn_joint(root_path);

					// Don't work on existing joints
					KLAYGE_AUTO(iter, joint_to_id_.find(fn_joint.fullPathName().asChar()));
					if (iter == joint_to_id_.end())
					{
						this->ExportJoint(NULL, fn_joint, root_path);
					}
				}
			}
		}
	}
	
	MDagPath dag_path;
	for (; !dag_iterator.isDone(); dag_iterator.next())
	{
		MStatus status = dag_iterator.getPath(dag_path);
		if (!status)
		{
			std::cout << "Fail to get DAG path." << std::endl;
			continue;
		}

		MString obj_name = dag_iterator.partialPathName();
		switch (dag_path.apiType())
		{
		case MFn::kTransform:
			{
				/*MFnTransform fnTransform(dagPath, &status);
				if (status == MS::kSuccess)
				{
					MFloatMatrix matrix = fnTransform.transformation().asMatrix();
					// TODO: how to handle transformations?
				}
				else
				std::cout << "Fail to initialize transform node." << std::endl;*/
			}
			break;

		case MFn::kMesh:
			{
				MFnMesh fn_mesh(dag_path, &status);
				if (MS::kSuccess == status)
				{
					if (!fn_mesh.isIntermediateObject())
					{
						this->ExportMesh(obj_name, fn_mesh, dag_path);
					}
					else
					{
//.........这里部分代码省略.........
开发者ID:qioixiy,项目名称:KlayGE,代码行数:101,代码来源:exporter.cpp


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