#if (_MSC_VER)
#ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
#endif
#ifndef _CRT_NONSTDC_NO_WARNINGS
#define _CRT_NONSTDC_NO_WARNINGS 1
#endif
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS 1
#endif
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#endif
#include "MyOwnWriter.h"
MyOwnWriter::MyOwnWriter(FbxManager &pFbxManager, int pID):
FbxWriter(pFbxManager, pID, mStatus),
mManager(&pFbxManager)
{
}
MyOwnWriter::~MyOwnWriter()
{
FileClose();
}
bool MyOwnWriter::FileCreate(char* pFileName)
{
{
FileClose();
}
mFilePointer = fopen(pFileName,"w");
{
return false;
}
return true;
}
bool MyOwnWriter::FileClose()
{
{
fclose(mFilePointer);
return true;
}
return false;
}
bool MyOwnWriter::IsFileOpen()
{
return true;
return false;
}
void MyOwnWriter::GetWriteOptions()
{
}
{
if (!pDocument)
{
GetStatus().SetCode(FbxStatus::eInvalidFile);
return false;
}
FbxScene* lScene = FbxCast<FbxScene>(pDocument);
bool lIsAScene = (lScene !=
NULL);
bool lResult = false;
if(lIsAScene)
{
PreprocessScene(*lScene);
printf("I'm in my own writer\n");
FbxNode* lRootNode = lScene->GetRootNode();
PrintHierarchy(lRootNode);
PostprocessScene(*lScene);
lResult = true;
}
return lResult;
}
void MyOwnWriter::PrintHierarchy(FbxNode* pStartNode)
{
FbxNode* lChildNode;
char const* lParentName = pStartNode->GetName();
for(
int i = 0;
i<pStartNode->GetChildCount();
i++)
{
lChildNode = pStartNode->GetChild(
i);
char const* lChildName = lChildNode->GetName();
fprintf(mFilePointer,"%s%s%s%s%s%s%s","\"",lChildName,"\"",", parent is ","\"",lParentName,"\"\n");
}
int lNodeChildCount = pStartNode->GetChildCount ();
while (lNodeChildCount > 0)
{
lNodeChildCount--;
lChildNode = pStartNode->GetChild (lNodeChildCount);
PrintHierarchy(lChildNode);
}
}
bool MyOwnWriter::PreprocessScene(FbxScene& )
{
printf("I'm in pre-process\n");
return true;
}
bool MyOwnWriter::PostprocessScene(FbxScene& )
{
printf("I'm in post process\n");
return true;
}