void log(FILE* fp) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); for(FileInfoSeq::const_iterator p = _filesDone.begin(); p != _filesDone.end(); ++p) { if(fputc('+', fp) == EOF || !writeFileInfo(fp, *p)) { throw "error writing log file:\n" + IceUtilInternal::lastErrorToString(); } } _filesDone.clear(); }
// // Maya calls this method to have the translator write out a file. // MStatus maTranslator::writer( const MFileObject& file, const MString& /* options */, MPxFileTranslator::FileAccessMode mode ) { // // For simplicity, we only do full saves/exports. // if ((mode != kSaveAccessMode) && (mode != kExportAccessMode)) return MS::kNotImplemented; // // Let's see if we can open the output file. // fstream output(file.fullName().asChar(), ios::out | ios::trunc); if (!output.good()) return MS::kNotFound; // // Get some node flags to keep track of those nodes for which we // have already done various stages of processing. // MStatus status; fCreateFlag = MFnDependencyNode::allocateFlag(fPluginName, &status); if (status) fAttrFlag = MFnDependencyNode::allocateFlag(fPluginName, &status); if (status) fConnectionFlag = MFnDependencyNode::allocateFlag(fPluginName, &status); if (!status) { MGlobal::displayError( "Could not allocate three free node flags." " Try unloading some other plugins." ); return MS::kFailure; } // // Run through all of the nodes in the scene and clear their flags. // MItDependencyNodes nodesIter; for (; !nodesIter.isDone(); nodesIter.next()) { MObject node = nodesIter.item(); MFnDependencyNode nodeFn(node); nodeFn.setFlag(fCreateFlag, false); nodeFn.setFlag(fAttrFlag, false); nodeFn.setFlag(fConnectionFlag, false); } // // Write out the various sections of the file. // writeHeader(output, file.name()); writeFileInfo(output); writeReferences(output); writeRequirements(output); writeUnits(output); writeDagNodes(output); writeNonDagNodes(output); writeDefaultNodes(output); writeReferenceNodes(output); writeConnections(output); writeFooter(output, file.name()); output.close(); MFnDependencyNode::deallocateFlag(fPluginName, fCreateFlag); return MS::kSuccess; }