-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathmayaBinaryWriter.cpp
executable file
·61 lines (39 loc) · 1.2 KB
/
mayaBinaryWriter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright(c) 2005-2006. All Rights Reserved
// By Jean-René Bédard (https://github.com/jrbedard/3d-converter)
#include "StdAfx.h"
#include "mayaBinaryWriter.h"
CMayaBinaryWriter::CMayaBinaryWriter(CFile* pFile, const fs::path& fileName)
{
CMayaFile* pMayaFile = static_cast<CMayaFile*>(pFile);
OBJ_ASSERT(pMayaFile);
m_pMayaFile = pMayaFile;
m_fileName = fileName;
}
bool CMayaBinaryWriter::Write()
{
OBJ_ASSERT(m_pMayaFile);
if(!m_pMayaFile)
return false;
std::string fileName(m_fileName.string()); // Extract native file path string
// Verify here that we have something to actually write
OBJ_ASSERT(m_pMayaFile->GetMeshVector().size() > 0);
if(m_pMayaFile->GetMeshVector().size() > 0)
{
MSG_ERROR("Invalid Maya file!");
return false;
}
// Write Maya binary file version 6.0
OBJ_ASSERT(CheckStr(fileName));
if(!CheckStr(fileName))
return false;
m_ofs.open(fileName.c_str());
MSG_INFO("Writing Maya Binary file (.MB) : '" << fileName << "'.");
if( !m_ofs.is_open() )
{
MSG_ERROR("Couldn't write to Maya file '" << fileName << "'");
return false;
}
// Too difficult to write.... :(
m_ofs.close();
return true;
}