Changeset 564
- Timestamp:
- 04/23/08 14:03:10 (9 months ago)
- Files:
-
- branches/morph-targets/x42maya/modelexporter.cpp (modified) (1 diff)
- branches/morph-targets/x42maya/translator.cpp (modified) (4 diffs)
- branches/morph-targets/x42maya/translator.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/morph-targets/x42maya/modelexporter.cpp
r559 r564 25 25 namespace x42 26 26 { 27 namespace file_export27 namespace exporters 28 28 { 29 29 namespace maya branches/morph-targets/x42maya/translator.cpp
r557 r564 25 25 namespace x42 26 26 { 27 namespace file_export27 namespace exporters 28 28 { 29 29 namespace maya … … 56 56 MPxFileTranslator::FileAccessMode mode ) 57 57 { 58 MStatus stat = MS::kFailure;59 58 MString path = filename.resolvedFullName(); 60 59 61 bool remove_file = false;62 60 try 63 61 { … … 67 65 { 68 66 out_file.open( path.asChar(), std::ios::out | 69 std::ios::binary | std::ios:: ate, _SH_DENYRW );67 std::ios::binary | std::ios::trunc, _SH_DENYRW ); 70 68 71 69 if( out_file.fail() ) … … 89 87 out_model.compile(); 90 88 91 try92 {93 out_file.close();94 out_file.open( path.asChar(), std::ios::out |95 std::ios::binary | std::ios::trunc, _SH_DENYRW );96 remove_file = true; //if we fail after this point, souce has been trashed97 }98 catch( ... )99 {100 MGlobal::displayError( "Error truncating file before writing." );101 return MS::kFailure;102 }103 104 89 out_model.write_file( out_file ); 105 90 106 stat = MS::kSuccess; 107 remove_file = false; 91 return MS::kSuccess; 108 92 } 109 93 catch( std::exception &ex ) 110 94 { 111 95 MGlobal::displayError( MString( ex.what() ) ); 112 stat =MS::kFailure;96 return MS::kFailure; 113 97 } 114 98 catch( ... ) 115 99 { 116 100 MGlobal::displayError( "Export failed." ); 117 stat =MS::kFailure;101 return MS::kFailure; 118 102 } 119 120 if( remove_file )121 remove( path.asChar() );122 123 return stat;124 103 } 125 104 branches/morph-targets/x42maya/translator.h
r559 r564 26 26 namespace x42 27 27 { 28 namespace file_export28 namespace exporters 29 29 { 30 30 namespace maya
