BOOL AscOut::nodeEnum(INode* node, int indentLevel) { nCurNode++; ip->ProgressUpdate((int)((float)nCurNode/nTotalNodeCount*100.0f)); // Stop recursing if the user pressed Cancel if (ip->GetCancel()) return FALSE; TSTR indent = GetIndent(indentLevel); // Only export if exporting everything or it's selected if(!exportSelected || node->Selected()) { // The ObjectState is a 'thing' that flows down the pipeline containing // all information about the object. By calling EvalWorldState() we tell // max to eveluate the object at end of the pipeline. ObjectState os = node->EvalWorldState(0); // The obj member of ObjectState is the actual object we will export. if (os.obj) { // We look at the super class ID to determine the type of the object. switch(os.obj->SuperClassID()) { case GEOMOBJECT_CLASS_ID: ExportGeomObject(node, indentLevel); break; case CAMERA_CLASS_ID: ExportCameraObject(node, indentLevel); break; case LIGHT_CLASS_ID: ExportLightObject(node, indentLevel); break; case SHAPE_CLASS_ID: ExportShapeObject(node, indentLevel); break; case HELPER_CLASS_ID: ExportHelperObject(node, indentLevel); break; } } } // For each child of this node, we recurse into ourselves // until no more children are found. for (int c = 0; c < node->NumberOfChildren(); c++) { if (!nodeEnum(node->GetChildNode(c), indentLevel)) return FALSE; } return TRUE; }
//------------------------------------------------------------------------ // Name: BOOL nodeEnum() // // Desc: This method is the main object exporter. // It is called once of every node in the scene. // The objects are exported as they are encoutered. // // Before recursing into the children of node,we will export it. // The benefit of this is that a nodes parent is always before // the children in the resulting file. This is desired since a // child's transformation matrix is optionally relative to the // parent. //------------------------------------------------------------------------ BOOL SMDExporter::nodeEnum( INode* node ) { // If user press cancel then break recurse if( m_ip->GetCancel() ) return FALSE; // Only export if exporting everything or it's selected if( !exportSelected || node->Selected() ) { // The ObjectState is a 'thing' that flows down the pipeline containing // all information about the object. By calling EvalWorldState() we tell // max to evaluate the object at the end of pipeline ObjectState os = node->EvalWorldState(0); // The obj member of ObjectState is the actual // object we will export if( os.obj ) { // We look at the superclassID to determin the type of the object switch( os.obj->SuperClassID() ) { case GEOMOBJECT_CLASS_ID: ExportGeomObject( node ); break; } } } // Update the processBar m_nCurNode++; m_ip->ProgressUpdate( int((float)m_nCurNode/m_nTotalNodeCount * 100.0f) ); // For each child of this node, we recurse into ourselves // until no more children is found for( int c=0;c<node->NumberOfChildren();c++ ) { if( !nodeEnum(node->GetChildNode(c)) ) return FALSE; } return TRUE; }