Changeset 564

Show
Ignore:
Timestamp:
04/23/08 14:03:10 (9 months ago)
Author:
phill
Message:

o Committing some changes I made a while ago.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/morph-targets/x42maya/modelexporter.cpp

    r559 r564  
    2525namespace x42 
    2626{ 
    27 namespace file_export 
     27namespace exporters 
    2828{ 
    2929namespace maya 
  • branches/morph-targets/x42maya/translator.cpp

    r557 r564  
    2525namespace x42 
    2626{ 
    27 namespace file_export 
     27namespace exporters 
    2828{ 
    2929namespace maya 
     
    5656        MPxFileTranslator::FileAccessMode mode ) 
    5757{ 
    58         MStatus stat = MS::kFailure; 
    5958        MString path = filename.resolvedFullName(); 
    6059 
    61         bool remove_file = false; 
    6260        try 
    6361        { 
     
    6765                { 
    6866                        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 ); 
    7068 
    7169                        if( out_file.fail() ) 
     
    8987                out_model.compile(); 
    9088 
    91                 try 
    92                 { 
    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 trashed 
    97                 } 
    98                 catch( ... ) 
    99                 { 
    100                         MGlobal::displayError( "Error truncating file before writing." ); 
    101                         return MS::kFailure; 
    102                 } 
    103                  
    10489                out_model.write_file( out_file ); 
    10590 
    106                 stat = MS::kSuccess; 
    107                 remove_file = false; 
     91                return MS::kSuccess; 
    10892        } 
    10993        catch( std::exception &ex ) 
    11094        { 
    11195                MGlobal::displayError( MString( ex.what() ) ); 
    112                 stat = MS::kFailure; 
     96                return MS::kFailure; 
    11397        } 
    11498        catch( ... ) 
    11599        { 
    116100                MGlobal::displayError( "Export failed." ); 
    117                 stat = MS::kFailure; 
     101                return MS::kFailure; 
    118102        } 
    119  
    120         if( remove_file ) 
    121                 remove( path.asChar() ); 
    122  
    123         return stat; 
    124103} 
    125104 
  • branches/morph-targets/x42maya/translator.h

    r559 r564  
    2626namespace x42 
    2727{ 
    28 namespace file_export 
     28namespace exporters 
    2929{ 
    3030namespace maya