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 // MGlobal::deleteNode( dupMeshNode ); return status; }
std::pair< EntityNode*, EntityInstanceNode*> EntityNode::CreateInstance( const Asset::EntityInstancePtr& entity ) { EntityNode* artClass = &Get( entity->GetEntity()->GetPath() ); M_EntityNode::iterator instItor = artClass->m_Instances.find( entity->m_ID ); EntityInstanceNode* entityNode = NULL; if( instItor == artClass->m_Instances.end() ) { MFnDagNode nodeFn; MObject instanceObject = nodeFn.create( EntityInstanceNode::s_TypeID, entity->GetName().c_str() ); nodeFn.setDoNotWrite( true ); entityNode = static_cast< EntityInstanceNode* >( nodeFn.userNode() ); artClass->m_Instances[ entity->m_ID ] = entityNode; entityNode->SetBackingEntity( entity ); entityNode->Show( *artClass ); } else { entityNode = instItor->second; entityNode->SetBackingEntity( entity ); } return std::pair< EntityNode*, EntityInstanceNode* >( artClass, entityNode ); }
// -------------------------------------------------------------------------------------------- MStatus polyModifierCmd::processMeshNode( modifyPolyData& data ) // -------------------------------------------------------------------------------------------- { MStatus status = MS::kSuccess; // Declare our function sets. Use MFnDagNode here so // we can retrieve the parent transform. // MFnDagNode dagNodeFn; // Use the DAG path to retrieve our mesh shape node. // data.meshNodeShape = fDagPath.node(); dagNodeFn.setObject( data.meshNodeShape ); // ASSERT: meshNodeShape node should have a parent transform! // MStatusAssert( (0 < dagNodeFn.parentCount()), "0 < dagNodeFn.parentCount() -- meshNodeshape has no parent transform" ); data.meshNodeTransform = dagNodeFn.parent(0); data.meshNodeDestPlug = dagNodeFn.findPlug( "inMesh" ); data.meshNodeDestAttr = data.meshNodeDestPlug.attribute(); return status; }
void RadiosityRenderer::printTransformData(const MDagPath& dagPath) { printf("got"); //This method simply determines the transformation information on the DAG node and prints it out. MStatus status; MObject transformNode = dagPath.transform(&status); // This node has no transform - i.e., it’s the world node if (!status && status.statusCode () == MStatus::kInvalidParameter) return; MFnDagNode transform (transformNode, &status); if (!status) { status.perror("MFnDagNode constructor"); return; } MTransformationMatrix matrix (transform.transformationMatrix()); //cout << " translation: " << matrix.translation(MSpace::kWorld) //<< endl; double threeDoubles[3]; MTransformationMatrix::RotationOrder rOrder; matrix.getRotation (threeDoubles, rOrder, MSpace::kWorld); cout << " rotation: [" << threeDoubles[0] << ", " << threeDoubles[1] << ", " << threeDoubles[2] << "]\n"; matrix.getScale (threeDoubles, MSpace::kWorld); cout << " scale: [" << threeDoubles[0] << ", " << threeDoubles[1] << ", " << threeDoubles[2] << "]\n"; }
// ------------------------------------------------------ // Unlike Maya's default behavior, we want to consider set membership to be inheritable bool SetHelper::isMemberOfSet ( const MDagPath& dagPath, MFnSet& Set ) { if ( Set.isMember ( dagPath ) ) { return true; } else { MFnDagNode dagNode ( dagPath ); MSelectionList setMembers; Set.getMembers ( setMembers, true ); for ( unsigned int i = 0; i < setMembers.length(); ++i ) { MObject memberObject; if ( setMembers.getDependNode ( i, memberObject ) ) { if ( dagNode.isChildOf ( memberObject ) ) { return true; } } } } return false; }
// ------------------------------------------------------------ void SceneGraph::findForcedNodes() { MStatus status; if ( mExportSelectedOnly ) { MSelectionList selectedItems; MGlobal::getActiveSelectionList ( selectedItems ); uint selectedCount = selectedItems.length(); MDagPathArray queue; for ( uint i = 0; i < selectedCount; ++i ) { MDagPath selectedPath; status = selectedItems.getDagPath ( i, selectedPath ); if ( status == MStatus::kSuccess ) queue.append ( selectedPath ); } while ( queue.length() > 0 ) { MDagPath selectedPath = queue[queue.length() - 1]; queue.remove ( queue.length() - 1 ); // Queue up the children. uint childCount = selectedPath.childCount(); for ( uint i = 0; i < childCount; ++i ) { MObject node = selectedPath.child ( i ); MDagPath childPath = selectedPath; childPath.push ( node ); queue.append ( childPath ); } // Look for a mesh if ( selectedPath.node().hasFn ( MFn::kMesh ) ) { // export forced nodes in path addForcedNodes ( selectedPath ); } } } else { for ( MItDag dagIt ( MItDag::kBreadthFirst ); !dagIt.isDone(); dagIt.next() ) { MDagPath currentPath; status = dagIt.getPath ( currentPath ); if ( status == MStatus::kSuccess ) { MFnDagNode node ( currentPath ); String nodeName = node.name().asChar(); if ( currentPath.node().hasFn ( MFn::kMesh ) ) { // export forced nodes in path addForcedNodes ( currentPath ); } } } } }
void SGToolContext::toolOnSetup(MEvent& evt) { MStatus status; SGPermit permit; SGKey::initializeKeys(); SGMouse::initializeButtons(); SGMesh::getSelection(SGToolCondition::option.symInfo); SGSelection::sels.initialize(SGMesh::pMesh); M3dView activeView = M3dView().active3dView(); manip = (SGManip*)SGManip::newManipulator(Names::manipName, m_oManip); if (!manip) sgPrintf("manip is null"); this->addManipulator(m_oManip); toolWidget = new SGWidget(MQtUtil::mainWindow()); toolWidget->startEvent(); this->setCursor( MCursor::editCursor ); if ( SGMesh::pMesh->dagPath.node().isNull() ) { //MGlobal::displayWarning("Select mesh first"); } else { MFnMesh fnMesh = SGMesh::pMesh->dagPath; MFnDagNode dagNode = fnMesh.parent(0); char buffer[128]; sprintf(buffer, "maintainActiveChangeSelectMode %s", dagNode.partialPathName().asChar() ); MGlobal::executeCommand(buffer); } SGMarkingMenu::menu.setDefaultMenu(); SGToolCondition::toolIsOn = true; }
CBaseNode *CMayaNode::GetChild(int childId) { MStatus status; MFnDagNode dagNode (m_dagPath, &status); if (status != MS::kSuccess) return 0; MObject objChild = dagNode.child (childId, &status); if (status != MS::kSuccess) return 0; MFnDagNode childDagNode (objChild, &status); if (status != MS::kSuccess) return 0; MDagPath childPath; if (childDagNode.getPath (childPath) != MS::kSuccess) return 0; CMayaNode *pNode = new CMayaNode; if (!pNode->Create (childPath)) { delete pNode; return 0; } return pNode; }
int CMayaNode::GetChildCount() { MStatus status; MFnDagNode dagNode (m_dagPath, &status); if (status != MS::kSuccess) return 0; return dagNode.childCount(); }
void tLocatorMgr::scanScene(const float lframe__, const int sample__, boost::shared_ptr< liqRibHT > &htable__, int &count__, MStatus &returnStatus__) { CM_TRACE_FUNC("tLocatorMgr::scanScene("<<lframe__<<","<<sample__<<",htable__,count__,returnStatus__)"); //[refactor 10] beg from scanScene() MItDag dagCoordSysIterator( MItDag::kDepthFirst, MFn::kLocator, &returnStatus__); for (; !dagCoordSysIterator.isDone(); dagCoordSysIterator.next()) { #if (Refactoring == 0) LIQ_CHECK_CANCEL_REQUEST; #endif MDagPath path; MObject currentNode; currentNode = dagCoordSysIterator.item(); MFnDagNode dagNode; dagCoordSysIterator.getPath( path ); if(MS::kSuccess != returnStatus__) continue; if(!currentNode.hasFn(MFn::kDagNode)) continue; returnStatus__ = dagNode.setObject( currentNode ); if(MS::kSuccess != returnStatus__) continue; // scanScene: if it's a coordinate system then insert it into the hash table if( dagNode.typeName() == "liquidCoordSys" ) { int coordType = 0; MPlug typePlug = dagNode.findPlug( "type", &returnStatus__ ); if( MS::kSuccess == returnStatus__ ) typePlug.getValue( coordType ); bool useSamples( ( sample__ > 0 ) && isObjectMotionBlur( path ) ); ObjectType mrttype = getMRTType(currentNode, coordType); ObjectType mrttype_shouldbe = ( coordType == 5 )? MRT_ClipPlane : MRT_Coord; if( mrttype != mrttype_shouldbe ){ liquidMessage2(messageError, "mrttype[%d] should be %d", mrttype_shouldbe); } htable__->insert( path, lframe__, ( useSamples )? sample__ : 0, mrttype, //( coordType == 5 )? MRT_ClipPlane : MRT_Coord, count__++ ); continue; } } //[refactor 10] end from scanScene() }
bool IsPathTemplated(MDagPath& path) { MStatus stat = MStatus::kSuccess; while (stat == MStatus::kSuccess) { MFnDagNode node; node.setObject(path.node()); if (IsTemplated(node)) return true; stat = path.pop(); } return false; }
void EntityInstanceNode::Hide() { MFnTransform transformFn( thisMObject() ); u32 len = transformFn.childCount(); MFnDagNode nodeFn; for( u32 i = 0; i < len; ++i ) { nodeFn.setObject( transformFn.child( 0 ) ); MDagPath path; nodeFn.getPath( path ); MGlobal::deleteNode( path.node() ); } }
// ------------------------------------------------------------ SceneElement* SceneGraph::createSceneElement ( const MDagPath &dagPath, SceneElement* parentSceneElement ) { // Create a new scene element SceneElement* sceneElement = new SceneElement ( dagPath ); // Attach a function set MFnDependencyNode fn ( dagPath.node() ); // Check for multiple instances. bool isInstanced = dagPath.isInstanced (); if ( parentSceneElement == 0 ) { // dagPath.getAllPathsTo ( ) () } // Get the node name String nodeName = DocumentExporter::mayaNameToColladaName ( fn.name() ); sceneElement->setNodeName ( nodeName ); // Check if it's a node to export and // tell the scene node to be transformed or not. bool isForced = false; bool isVisible = false; bool isExportNode = getIsExportNode ( dagPath, isForced, isVisible ); sceneElement->setIsForced ( isForced ); sceneElement->setIsVisible ( isVisible ); // Check for a file reference MFnDagNode dagFn ( dagPath ); bool isLocal = !dagFn.isFromReferencedFile(); if ( ExportOptions::exportXRefs() && ExportOptions::dereferenceXRefs()) isLocal = true; if ( !isLocal && !ExportOptions::exportXRefs() ) isExportNode = false; sceneElement->setIsExportNode ( isExportNode ); sceneElement->setIsLocal ( isLocal ); if ( parentSceneElement != NULL ) { if ( !sceneElement->containsParentElement ( parentSceneElement ) ) sceneElement->addParentElement ( parentSceneElement ); if ( !parentSceneElement->containsChildElement ( sceneElement ) ) parentSceneElement->addChildElement ( sceneElement ); } return sceneElement; }
MStatus sgBDataCmd_key::importData() { MStatus status; MTime::Unit currentUnit = MTime().unit(); MPlugArray connections; sgObject_keyData& objectKeyData = m_objectKeyDataImport; MObject& oTarget = objectKeyData.oTargetNode; MDoubleArray& dArrTime = objectKeyData.dArrTime; MTime::Unit unit = (MTime::Unit)objectKeyData.unit; MFnDagNode fnNode = oTarget; MPlugArray targetPlugs; unsigned int numAttr = objectKeyData.namesAttribute.length(); unsigned int lengthTime = dArrTime.length(); for( unsigned int j=0; j<numAttr; j++ ) { if( numAttr <= j ) break; MPlug targetPlug = fnNode.findPlug( objectKeyData.namesAttribute[j] ); targetPlug.connectedTo( connections, true, false ); if( connections.length() ){ m_dgMod_connection.disconnect( connections[0], targetPlug ); m_dgMod_delete.deleteNode( connections[0].node() ); } m_dgMod_connection.doIt(); m_dgMod_delete.doIt(); MObject oAnimCurve = MFnAnimCurve().create( targetPlug ); m_oArrKeyAfter.append( oAnimCurve ); MFnAnimCurve fnAnimCurve( oAnimCurve ); for( unsigned int k=0; k<lengthTime; k++ ) { double& dTime = dArrTime[k]; double& dValue = objectKeyData.dArrValuesArray[ k*numAttr+j ]; MTime mTime( dTime, unit ); mTime.setUnit( currentUnit ); fnAnimCurve.addKeyframe( mTime, dValue ); } } return MS::kSuccess; };
MStatus testSelectAddAttribute::doIt( const MArgList& args ) { MDagPath node; MObject component; MSelectionList list; MFnDagNode nodeFn; MGlobal::getActiveSelectionList( list ); for ( unsigned int index = 0; index < list.length(); index++ ) { list.getDagPath( index, node, component ); nodeFn.setObject( node ); cout<<nodeFn.name().asChar( ) << "is selected" << endl; } return MS::kSuccess; }
EntityNode& EntityNode::Get( const Helium::Path& path, bool createIfNotExisting ) { MFnDagNode dagFn; try { M_IdClassTransform::iterator findItor = s_ClassTransformsMap.find( path.Hash() ); if( findItor != s_ClassTransformsMap.end() ) { return *findItor->second; } else if ( createIfNotExisting ) { // we couldn't find it, so create it and return the loaded art class Asset::AssetClassPtr assetClass = Asset::AssetClass::LoadAssetClass( path ); if ( assetClass.ReferencesObject() ) { tstring artFilePath = assetClass->GetPath().Get(); MObject classTransform = dagFn.create( EntityNode::s_TypeID, assetClass->GetShortName().c_str() ); dagFn.setDoNotWrite( true ); EntityNode* artClass = static_cast<EntityNode*>( dagFn.userNode() ); artClass->m_AssetPath = path; artClass->SetArtFilePath( artFilePath.c_str() ); s_ClassTransformsMap[ path.Hash() ] = artClass; artClass->LoadArt(); return *artClass; } } } catch (Helium::Exception& ) { if ( createIfNotExisting ) { MGlobal::displayError( MString("Unable to create EntityNode!") ); } } return EntityNode::Null; }
void exportCurve(MFnDagNode & theDagNode, WorldBuilderBase & theParentTransform, SceneBuilder & theSceneBuilder) { MAKE_SCOPE_TIMER(CurveExporter_exportCurve); if (theDagNode.isIntermediateObject()) { return; } string myCurveName = string(theDagNode.name().asChar()); DB(AC_TRACE << "Exporting curve: " << myCurveName << endl); MFnNurbsCurve myMCurve(theDagNode.object()); DB( cerr << "Number of cvs: " << myMCurve.numCVs() << endl; cerr << "Number of spans: " << myMCurve.numSpans() << endl; cerr << "Number of knots: " << myMCurve.numKnots() << endl; cerr << "Degree: " << myMCurve.degree() << endl; cerr << "Length: " << myMCurve.length() << endl; for (double d = 0.0; d <= 1.0; d += 0.1) { MPoint myPoint; myMCurve.getPointAtParam(d, myPoint); cerr << "Point at param " << d << ": " << myPoint.x << ", " << myPoint.y << ", " << myPoint.z << endl; } int myCvCount = myMCurve.numCVs(); for (int i = 0; i < myCvCount; ++i) { MPoint myPoint; myMCurve.getCV(i, myPoint); cerr << "CV " << i << ": " << myPoint.x << ", " << myPoint.y << ", " << myPoint.z << endl; } int myKnotCount = myMCurve.numKnots(); for (int i = 0; i < myKnotCount; ++i) { double knotParam; knotParam = myMCurve.knot(i); MPoint myPoint; myMCurve.getPointAtParam(knotParam, myPoint); cerr << "Point at knot# " << i << ": " << myPoint.x << ", " << myPoint.y << ", " << myPoint.z << endl; } )
MStatus unShowAvailableSystems::doIt( const MArgList& args ) { MItDag dagIter; MFnDagNode worldDag (dagIter.root()); MDagPath worldPath; worldDag.getPath(worldPath); std::string str; findAvailableSystems(str,worldPath); if(!str.empty()) { MessageBox(0,str.c_str(),"Particle or Ribbon Systems",0); } else { MessageBox(0,"no particle or ribbon system yet","Particle or Ribbon Systems",0); } return MS::kSuccess; }
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(); }
void DMPDSExporter::fillSkeleton( DMPParameters* param ) { MStatus stat; mSkelData.clear(); if (!param->bExportSkeleton) { return; } mSkelData.skeleton.name = param->skeletonFileName.asUTF8(); // Get the selection list MSelectionList activeList; stat = MGlobal::getActiveSelectionList(activeList); if(param->bExportAll) { // We are exporting the whole scene MItDag dagIter; MFnDagNode worldDag (dagIter.root()); MDagPath worldPath; worldDag.getPath(worldPath); traverseSubSkeleton(param, worldPath); } else { if (MStatus::kSuccess != stat) { return; } MItSelectionList iter(activeList); for ( ; !iter.isDone(); iter.next()) { MDagPath dagPath; iter.getDagPath(dagPath); traverseSubSkeleton(param, dagPath); } } // may lose selection while exporting, so reset it. MGlobal::setActiveSelectionList(activeList); }
// ------------------------------------------------------ bool SetHelper::isExcluded ( const MDagPath& dagPath ) { MFnDagNode dagNode ( dagPath ); if ( dagNode.name() == "world" ) return false; bool bContainedInSet = false; for ( unsigned int i = 0; i < SetHelper::setObjects.size(); ++i ) { # if MAYA_API_VERSION < 600 MObject o = SetHelper::setObjects[i]; # else MObject o = SetHelper::setObjects[i].object(); # endif MFnSet currentSet ( o ); if ( isMemberOfSet ( dagPath, currentSet ) ) { bContainedInSet = true; break; } } if ( setMode == kExcluding ) { return bContainedInSet; } else if ( setMode == kIncludeOnly ) { return !bContainedInSet; } else { return false; } }
bool polyExporter::isVisible(MFnDagNode & fnDag, MStatus& status) //Summary: determines if the given DAG node is currently visible //Args : fnDag - the DAG node to check //Returns: true if the node is visible; // false otherwise { if(fnDag.isIntermediateObject()) return false; MPlug visPlug = fnDag.findPlug("visibility", &status); if (MStatus::kFailure == status) { MGlobal::displayError("MPlug::findPlug"); return false; } else { bool visible; status = visPlug.getValue(visible); if (MStatus::kFailure == status) { MGlobal::displayError("MPlug::getValue"); } return visible; } }
void Exporter::createSceneGraph(MFnDagNode& path, int parentIndex) { Node output; std::vector<std::string> pathparts; output.name = path.fullPathName().asChar(); splitStringToVector(output.name, pathparts, "|"); output.name = pathparts[pathparts.size() - 1]; if (!strcmp(output.name.c_str(), "persp")) return; else if (!strcmp(output.name.c_str(), "top")) return; else if (!strcmp(output.name.c_str(), "side")) return; else if (!strcmp(output.name.c_str(), "front")) return; output.parent = parentIndex; output.transform = path.transformationMatrix().matrix; scene_.sceneGraph.push_back(output); int children = path.childCount(); int parent = scene_.sceneGraph.size() - 1; for (int i = 0; i < children; i++) { cout << path.child(i).apiTypeStr() << endl; if (!strcmp(path.child(i).apiTypeStr(), "kMesh")){ scene_.sceneGraph[parent].type = 1; MFnMesh mesh(path.child(i)); MDagPath dag_path; MItDag dag_iter(MItDag::kBreadthFirst, MFn::kMesh); int y = 0; while (!dag_iter.isDone()) { if (dag_iter.getPath(dag_path)) { MFnDagNode dag_node = dag_path.node(); if (!dag_node.isIntermediateObject()) { if (!strcmp(mesh.partialPathName().asChar(), dag_node.partialPathName().asChar())) scene_.sceneGraph[parent].mesh = y; y++; } } dag_iter.next(); } } // else if (!strcmp(path.child(i).apiTypeStr(), "kCamera")); kan l�gga till fler typer h�r else createSceneGraph(MFnDagNode(path.child(i)), parent); } }
//--------------------------------------------------- void DagHelper::setArrayPlugSize ( MPlug& plug, uint size ) { if ( plug.node().isNull() ) return; #if MAYA_API_VERSION >= 800 MStatus status = plug.setNumElements ( size ); CHECK_STAT ( status ); #else MObject node = plug.node(); MString plugPath = plug.info(); if ( node.hasFn ( MFn::kDagNode ) ) { MFnDagNode dagFn ( node ); int dot = plugPath.index ( '.' ); plugPath = dagFn.fullPathName() + plugPath.substring ( dot, plugPath.length() ); } MString command = MString ( "setAttr -s " ) + size + " \"" + plugPath + "\";"; MGlobal::executeCommand ( command ); #endif // MAYA 8.00+ }
// ------------------------------------------------------------ bool SceneGraph::createChildSceneElements ( SceneElement* sceneElement ) { // Get the current path MDagPath dagPath = sceneElement->getPath(); // Now, whip through this node's DAG children MFnDagNode dagFn ( dagPath ); uint childCount = dagFn.childCount(); for ( uint i = 0; i < childCount; ++i ) { MObject child = dagFn.child ( i ); MDagPath childDagPath = dagPath; childDagPath.push ( child ); SceneElement* childSceneElement = createSceneElement ( childDagPath, sceneElement ); // Recursive call to take the children createChildSceneElements ( childSceneElement ); } return true; }
void EntityNode::AddToInstances( MObject &addedNode ) { MStatus stat; MFnDagNode instanceFn; MFnDagNode nodeFn( addedNode ); MDagPath source; nodeFn.getPath( source ); M_EntityNode::iterator itor = m_Instances.begin(); M_EntityNode::iterator end = m_Instances.end(); for( ; itor != end; ++itor) { instanceFn.setObject( itor->second->thisMObject() ); instanceFn.setObject( instanceFn.parent( 0 ) ); MDagPath parent; instanceFn.getPath( parent ); MDagPath result; Maya::duplicate( source, parent, result, true ); } }
asl::Vector4f getLineColor(MFnDagNode & theDagNode) { float myR = 1.0; float myG = 1.0; float myB = 1.0; float myA = 1.0; MObject myParent = theDagNode.parent(0); getCustomAttribute(myParent, "ac_linecolor_r", myR); getCustomAttribute(myParent, "ac_linecolor_g", myG); getCustomAttribute(myParent, "ac_linecolor_b", myB); getCustomAttribute(myParent, "ac_linecolor_alpha", myA); return asl::Vector4f(myR, myG, myB, myA); }
bool IsVisible(MFnDagNode& node) { MStatus stat; if (node.isIntermediateObject()) return false; bool visibility = true; MFnDependencyNode depFn(node.object(), &stat); if (!stat) MGlobal::displayInfo("Problem getting dep from " + node.name()); if (!getBool(MString("visibility"), depFn, visibility)) MGlobal::displayInfo("Problem getting visibility attr from " + node.name()); if (!visibility) return false; getBool(MString("overrideVisibility"), depFn, visibility); if (!visibility) return false; return true; }
void IterateSelection() { unsigned int i; MSelectionList list; MDagPath dagpath; MFnDagNode fnnode; MGlobal::getActiveSelectionList(list); for(i = 0; i < list.length(); i++) { list.getDagPath(i, dagpath); fnnode.setObject(dagpath); cout << fnnode.name().asChar() << " of type " << fnnode.typeName().asChar() << " is selected" << endl; cout << "has " << fnnode.childCount() << " children" << endl; //Iterate the children for(int j = 0; j < fnnode.childCount(); j++) { MObject childobj; MFnDagNode fnchild; childobj = fnnode.child(j); fnchild.setObject(childobj); cout << "child " << j << " is a " << fnchild.typeName().asChar() << endl; //MFn::Type type = fnchild.type() //if(fnchild.type() == MFn::kMesh) //DumpMesh(dagpath); //DumpMesh2(dagpath); IterateWorldMeshesInSelection(); } } }
bool IsTemplated(MFnDagNode& node) { MStatus status; MFnDependencyNode depFn(node.object()); bool isTemplate = false; getBool(MString("template"), depFn, isTemplate); if (isTemplate) return true; int intTempl = 0; getInt(MString("overrideDisplayType"), depFn, intTempl); if (intTempl == 1) return true; return false; }