202 lines
6.1 KiB
C++
202 lines
6.1 KiB
C++
/****************************************************************************************
|
|
|
|
Copyright (C) 2015 Autodesk, Inc.
|
|
All rights reserved.
|
|
|
|
Use of this software is subject to the terms of the Autodesk license agreement
|
|
provided at the time of installation or download, or which otherwise accompanies
|
|
this software in either electronic or hard copy form.
|
|
|
|
****************************************************************************************/
|
|
|
|
#include "DisplayCommon.h"
|
|
|
|
#if defined (FBXSDK_ENV_MAC)
|
|
// disable the “format not a string literal and no format arguments” warning since
|
|
// the FBXSDK_printf calls made here are all valid calls and there is no secuity risk
|
|
#pragma GCC diagnostic ignored "-Wformat-security"
|
|
#endif
|
|
|
|
void DisplayMetaDataConnections(FbxObject* pObject)
|
|
{
|
|
int nbMetaData = pObject->GetSrcObjectCount<FbxObjectMetaData>();
|
|
if (nbMetaData > 0)
|
|
DisplayString(" MetaData connections ");
|
|
|
|
for (int i = 0; i < nbMetaData; i++)
|
|
{
|
|
FbxObjectMetaData* metaData = pObject->GetSrcObject<FbxObjectMetaData>(i);
|
|
DisplayString(" Name: ", (char*)metaData->GetName());
|
|
}
|
|
}
|
|
|
|
void DisplayString(const char* pHeader, const char* pValue /* = "" */, const char* pSuffix /* = "" */)
|
|
{
|
|
FbxString lString;
|
|
|
|
lString = pHeader;
|
|
lString += pValue;
|
|
lString += pSuffix;
|
|
lString += "\n";
|
|
FBXSDK_printf(lString);
|
|
}
|
|
|
|
|
|
void DisplayBool(const char* pHeader, bool pValue, const char* pSuffix /* = "" */)
|
|
{
|
|
FbxString lString;
|
|
|
|
lString = pHeader;
|
|
lString += pValue ? "true" : "false";
|
|
lString += pSuffix;
|
|
lString += "\n";
|
|
FBXSDK_printf(lString);
|
|
}
|
|
|
|
|
|
void DisplayInt(const char* pHeader, int pValue, const char* pSuffix /* = "" */)
|
|
{
|
|
FbxString lString;
|
|
|
|
lString = pHeader;
|
|
lString += pValue;
|
|
lString += pSuffix;
|
|
lString += "\n";
|
|
FBXSDK_printf(lString);
|
|
}
|
|
|
|
|
|
void DisplayDouble(const char* pHeader, double pValue, const char* pSuffix /* = "" */)
|
|
{
|
|
FbxString lString;
|
|
FbxString lFloatValue = (float) pValue;
|
|
|
|
lFloatValue = pValue <= -HUGE_VAL ? "-INFINITY" : lFloatValue.Buffer();
|
|
lFloatValue = pValue >= HUGE_VAL ? "INFINITY" : lFloatValue.Buffer();
|
|
|
|
lString = pHeader;
|
|
lString += lFloatValue;
|
|
lString += pSuffix;
|
|
lString += "\n";
|
|
FBXSDK_printf(lString);
|
|
}
|
|
|
|
|
|
void Display2DVector(const char* pHeader, FbxVector2 pValue, const char* pSuffix /* = "" */)
|
|
{
|
|
FbxString lString;
|
|
FbxString lFloatValue1 = (float)pValue[0];
|
|
FbxString lFloatValue2 = (float)pValue[1];
|
|
|
|
lFloatValue1 = pValue[0] <= -HUGE_VAL ? "-INFINITY" : lFloatValue1.Buffer();
|
|
lFloatValue1 = pValue[0] >= HUGE_VAL ? "INFINITY" : lFloatValue1.Buffer();
|
|
lFloatValue2 = pValue[1] <= -HUGE_VAL ? "-INFINITY" : lFloatValue2.Buffer();
|
|
lFloatValue2 = pValue[1] >= HUGE_VAL ? "INFINITY" : lFloatValue2.Buffer();
|
|
|
|
lString = pHeader;
|
|
lString += lFloatValue1;
|
|
lString += ", ";
|
|
lString += lFloatValue2;
|
|
lString += pSuffix;
|
|
lString += "\n";
|
|
FBXSDK_printf(lString);
|
|
}
|
|
|
|
|
|
void Display3DVector(const char* pHeader, FbxVector4 pValue, const char* pSuffix /* = "" */)
|
|
{
|
|
FbxString lString;
|
|
FbxString lFloatValue1 = (float)pValue[0];
|
|
FbxString lFloatValue2 = (float)pValue[1];
|
|
FbxString lFloatValue3 = (float)pValue[2];
|
|
|
|
lFloatValue1 = pValue[0] <= -HUGE_VAL ? "-INFINITY" : lFloatValue1.Buffer();
|
|
lFloatValue1 = pValue[0] >= HUGE_VAL ? "INFINITY" : lFloatValue1.Buffer();
|
|
lFloatValue2 = pValue[1] <= -HUGE_VAL ? "-INFINITY" : lFloatValue2.Buffer();
|
|
lFloatValue2 = pValue[1] >= HUGE_VAL ? "INFINITY" : lFloatValue2.Buffer();
|
|
lFloatValue3 = pValue[2] <= -HUGE_VAL ? "-INFINITY" : lFloatValue3.Buffer();
|
|
lFloatValue3 = pValue[2] >= HUGE_VAL ? "INFINITY" : lFloatValue3.Buffer();
|
|
|
|
lString = pHeader;
|
|
lString += lFloatValue1;
|
|
lString += ", ";
|
|
lString += lFloatValue2;
|
|
lString += ", ";
|
|
lString += lFloatValue3;
|
|
lString += pSuffix;
|
|
lString += "\n";
|
|
FBXSDK_printf(lString);
|
|
}
|
|
|
|
void Display4DVector(const char* pHeader, FbxVector4 pValue, const char* pSuffix /* = "" */)
|
|
{
|
|
FbxString lString;
|
|
FbxString lFloatValue1 = (float)pValue[0];
|
|
FbxString lFloatValue2 = (float)pValue[1];
|
|
FbxString lFloatValue3 = (float)pValue[2];
|
|
FbxString lFloatValue4 = (float)pValue[3];
|
|
|
|
lFloatValue1 = pValue[0] <= -HUGE_VAL ? "-INFINITY" : lFloatValue1.Buffer();
|
|
lFloatValue1 = pValue[0] >= HUGE_VAL ? "INFINITY" : lFloatValue1.Buffer();
|
|
lFloatValue2 = pValue[1] <= -HUGE_VAL ? "-INFINITY" : lFloatValue2.Buffer();
|
|
lFloatValue2 = pValue[1] >= HUGE_VAL ? "INFINITY" : lFloatValue2.Buffer();
|
|
lFloatValue3 = pValue[2] <= -HUGE_VAL ? "-INFINITY" : lFloatValue3.Buffer();
|
|
lFloatValue3 = pValue[2] >= HUGE_VAL ? "INFINITY" : lFloatValue3.Buffer();
|
|
lFloatValue4 = pValue[3] <= -HUGE_VAL ? "-INFINITY" : lFloatValue4.Buffer();
|
|
lFloatValue4 = pValue[3] >= HUGE_VAL ? "INFINITY" : lFloatValue4.Buffer();
|
|
|
|
lString = pHeader;
|
|
lString += lFloatValue1;
|
|
lString += ", ";
|
|
lString += lFloatValue2;
|
|
lString += ", ";
|
|
lString += lFloatValue3;
|
|
lString += ", ";
|
|
lString += lFloatValue4;
|
|
lString += pSuffix;
|
|
lString += "\n";
|
|
FBXSDK_printf(lString);
|
|
}
|
|
|
|
|
|
void DisplayColor(const char* pHeader, FbxPropertyT<FbxDouble3> pValue, const char* pSuffix /* = "" */)
|
|
|
|
{
|
|
FbxString lString;
|
|
|
|
lString = pHeader;
|
|
//lString += (float) pValue.mRed;
|
|
//lString += (double)pValue.GetArrayItem(0);
|
|
lString += " (red), ";
|
|
//lString += (float) pValue.mGreen;
|
|
//lString += (double)pValue.GetArrayItem(1);
|
|
lString += " (green), ";
|
|
//lString += (float) pValue.mBlue;
|
|
//lString += (double)pValue.GetArrayItem(2);
|
|
lString += " (blue)";
|
|
lString += pSuffix;
|
|
lString += "\n";
|
|
FBXSDK_printf(lString);
|
|
}
|
|
|
|
|
|
void DisplayColor(const char* pHeader, FbxColor pValue, const char* pSuffix /* = "" */)
|
|
{
|
|
FbxString lString;
|
|
|
|
lString = pHeader;
|
|
lString += (float) pValue.mRed;
|
|
|
|
lString += " (red), ";
|
|
lString += (float) pValue.mGreen;
|
|
|
|
lString += " (green), ";
|
|
lString += (float) pValue.mBlue;
|
|
|
|
lString += " (blue)";
|
|
lString += pSuffix;
|
|
lString += "\n";
|
|
FBXSDK_printf(lString);
|
|
}
|
|
|