Пример #1
0
// --------
// Strings
// --------
void KStrings::SplitString(	const KString&	String,
							LPCTSTR			pSplitter,
							bool			bAddEmpty,
							bool			bClearFirst)
{
	if(bClearFirst)
		Clear();

	const size_t szSplitterLength = _tcslen(pSplitter);

	size_t szPos = 0;
	for(;;)
	{
		size_t szOldPos = szPos;
		szPos = String.Find(pSplitter, szPos);
		if(szPos == UINT_MAX)
		{
			if(bAddEmpty || szOldPos < String.GetLength())
				*AddLast() = String.Mid(szOldPos);

			break;
		}

		if(bAddEmpty || szPos > szOldPos)
			*AddLast() = String.Mid(szOldPos, szPos - szOldPos), szPos += szSplitterLength;
	}
}
Пример #2
0
bool SaveScene(KFbxSdkManager* pSdkManager, KFbxDocument* pScene, const char* pFilename, int pFileFormat, bool pEmbedMedia)
{
    int lMajor, lMinor, lRevision;
    bool lStatus = true;

    // Create an exporter.
    KFbxExporter* lExporter = KFbxExporter::Create(pSdkManager, "");

    if( pFileFormat < 0 || pFileFormat >= pSdkManager->GetIOPluginRegistry()->GetWriterFormatCount() )
    {
        // Write in fall back format in less no ASCII format found
        pFileFormat = pSdkManager->GetIOPluginRegistry()->GetNativeWriterFormat();

        //Try to export in ASCII if possible
        int lFormatIndex, lFormatCount = pSdkManager->GetIOPluginRegistry()->GetWriterFormatCount();

        for (lFormatIndex=0; lFormatIndex<lFormatCount; lFormatIndex++)
        {
            if (pSdkManager->GetIOPluginRegistry()->WriterIsFBX(lFormatIndex))
            {
                KString lDesc =pSdkManager->GetIOPluginRegistry()->GetWriterFormatDescription(lFormatIndex);
                char *lASCII = "ascii";
                if (lDesc.Find(lASCII)>=0)
                {
                    pFileFormat = lFormatIndex;
                    break;
                }
            }
        }
    }

    // Set the export states. By default, the export states are always set to 
    // true except for the option eEXPORT_TEXTURE_AS_EMBEDDED. The code below 
    // shows how to change these states.

    IOS_REF.SetBoolProp(EXP_FBX_MATERIAL,        true);
    IOS_REF.SetBoolProp(EXP_FBX_TEXTURE,         true);
    IOS_REF.SetBoolProp(EXP_FBX_EMBEDDED,        pEmbedMedia);
    IOS_REF.SetBoolProp(EXP_FBX_SHAPE,           true);
    IOS_REF.SetBoolProp(EXP_FBX_GOBO,            true);
    IOS_REF.SetBoolProp(EXP_FBX_ANIMATION,       true);
    IOS_REF.SetBoolProp(EXP_FBX_GLOBAL_SETTINGS, true);

    // Initialize the exporter by providing a filename.
    if(lExporter->Initialize(pFilename, pFileFormat, pSdkManager->GetIOSettings()) == false)
    {
        common->Warning("Call to KFbxExporter::Initialize() failed. Error returned: %s\n\n\n", lExporter->GetLastErrorString());
        return false;
    }

    KFbxSdkManager::GetFileFormatVersion(lMajor, lMinor, lRevision);
    common->Printf("FBX version number for this version of the FBX SDK is %d.%d.%d\n\n", lMajor, lMinor, lRevision);

    // Export the scene.
    lStatus = lExporter->Export(pScene); 

    // Destroy the exporter.
    lExporter->Destroy();
    return lStatus;
}
Пример #3
0
void InitializeSdkObjects(KFbxSdkManager*& pSdkManager, KFbxScene*& pScene)
{
    // The first thing to do is to create the FBX SDK manager which is the 
    // object allocator for almost all the classes in the SDK.
    pSdkManager = KFbxSdkManager::Create();

    if (!pSdkManager)
    {
        printf("Unable to create the FBX SDK manager\n");
        exit(0);
    }

	// create an IOSettings object
	KFbxIOSettings * ios = KFbxIOSettings::Create(pSdkManager, IOSROOT );
	pSdkManager->SetIOSettings(ios);

	// Load plugins from the executable directory
	KString lPath = KFbxGetApplicationDirectory();
#if defined(KARCH_ENV_WIN)
	KString lExtension = "dll";
#elif defined(KARCH_ENV_MACOSX)
	KString lExtension = "dylib";
#elif defined(KARCH_ENV_LINUX)
	KString lExtension = "so";
#endif
	pSdkManager->LoadPluginsDirectory(lPath.Buffer(), lExtension.Buffer());

    // Create the entity that will hold the scene.
    pScene = KFbxScene::Create(pSdkManager,"");
}
Пример #4
0
KString KString::FormattedV(LPCTSTR pFormat, va_list ArgList)
{
	KString String;
	String.FormatV(pFormat, ArgList);

	return String;
}
Пример #5
0
KString KString::Upper() const
{
	KString String = *this;

	_tcsupr(String.GetDataPtr());

	return String;
}
Пример #6
0
KString KString::Lower() const
{
	KString String = *this;

	_tcslwr(String.GetDataPtr());

	return String;
}
Пример #7
0
/**
 * Print an attribute.
 */
void PrintAttribute(FbxNodeAttribute* pAttribute) {
    if(!pAttribute) return;
 
    KString typeName = GetAttributeTypeName(pAttribute->GetAttributeType());
    KString attrName = pAttribute->GetName();
    PrintTabs();
    // Note: to retrieve the chararcter array of a KString, use its Buffer() method.
    printf("<attribute type='%s' name='%s'/>\n", typeName.Buffer(), attrName.Buffer());
}
Пример #8
0
// Print an attribute
void FBXParser::printAttribute(KFbxNodeAttribute const & pAttribute) const{
  if(!&pAttribute){ return; }

  KString typeName = getAttributeTypeName(pAttribute.GetAttributeType());
  KString attrName = pAttribute.GetName();
  printTabs();
  cout << "<attribute type= " << typeName.Buffer() << " name= " << attrName.Buffer();
  cout << "/>" << endl;
}
Пример #9
0
KString KString::Formatted(LPCTSTR pFormat, ...)
{
	va_list ArgList;
	va_start(ArgList, pFormat);

	KString String;
	String.FormatV(pFormat, ArgList);

	va_end(ArgList);

	return String;
}
Пример #10
0
WHITEBOX_END



#define FBX_EXPORTER 0
#if FBX_EXPORTER

#include <stdio.h>

#include <fbxsdk.h>
#include <fbxfilesdk/kfbxio/kfbxiosettings.h>
#include <fbxfilesdk/kfbxio/kfbximporter.h>
#include <fbxfilesdk/kfbxplugins/kfbxsdkmanager.h>
#include <fbxfilesdk/kfbxplugins/kfbxscene.h>
#include <fbxfilesdk/fbxfilesdk_nsuse.h>

#ifdef IOS_REF
	#undef  IOS_REF
	#define IOS_REF (*(pSdkManager->GetIOSettings()))
#endif


void InitializeSdkObjects(KFbxSdkManager*& pSdkManager, KFbxScene*& pScene)
{
    // The first thing to do is to create the FBX SDK manager which is the 
    // object allocator for almost all the classes in the SDK.
    pSdkManager = KFbxSdkManager::Create();

    if (!pSdkManager)
    {
        WbLog( "Default", "Unable to create the FBX SDK manager\n");
        return;
    }

	// create an IOSettings object
	KFbxIOSettings * ios = KFbxIOSettings::Create(pSdkManager, IOSROOT );
	pSdkManager->SetIOSettings(ios);

	// Load plugins from the executable directory
	KString lPath = KFbxGetApplicationDirectory();
#if defined(KARCH_ENV_WIN)
	KString lExtension = "dll";
#elif defined(KARCH_ENV_MACOSX)
	KString lExtension = "dylib";
#elif defined(KARCH_ENV_LINUX)
	KString lExtension = "so";
#endif
	pSdkManager->LoadPluginsDirectory(lPath.Buffer(), lExtension.Buffer());

    // Create the entity that will hold the scene.
    pScene = KFbxScene::Create(pSdkManager,"");
}
Пример #11
0
int Scene::getCurrentAnimationIndex()
{
    int index = 0;
    for(int i = 0; i < animationNames.GetCount(); i++) {
        KString* currentName = animationNames[i];
        KString activeName = KFbxGet<KString>(fbxScene->ActiveAnimStackName);

        if(currentName->Compare(activeName) == 0) {
            index = i;
        }
    }
    return index;
}
Пример #12
0
void DisplayDouble(const char* pHeader, double pValue, const char* pSuffix /* = "" */)
{
	KString lString;
	KString 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";
	printf(lString);
}
Пример #13
0
void ParseHTTPHeaderCommand(const KString&		s,
							THTTPHeaderCommand&	RCommand)
{
	int i = 0;

	i = s.Find(TEXT(":"));

	if(i == -1)
		RCommand.m_Command = s, RCommand.m_Content = TEXT("");
	else
		RCommand.m_Command = s.Left(i), RCommand.m_Content = s.Mid(i + 1);

	RCommand.m_Command = RCommand.m_Command.Trim();
	RCommand.m_Content = RCommand.m_Content.Trim();
}
Пример #14
0
bool TextureManager::LoadTextureFromFile(const KString & pFilePath, unsigned int & pTextureObject)
{
	int		compo;
	GLenum		Format;
	int		w;
	int		h;
	GLbyte*		Bits;

	if (pFilePath.Right(3).Upper() == "TGA")
	{

		Bits  = gltReadTGABits(pFilePath, &w, &h, &compo, &Format);

		if (Bits != NULL)
		{
			glGenTextures(1, &pTextureObject);
			glBindTexture(GL_TEXTURE_2D, pTextureObject);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
			glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
			glTexImage2D(GL_TEXTURE_2D, 0, compo, w, h, 0, Format,
					GL_UNSIGNED_BYTE, Bits);

			return true;
		}
	}

	return false;
}
Пример #15
0
void KStrings::SplitToTokens(	const KString&	String,
								LPCTSTR			pDelimeters,
								bool			bClearFirst)
{
	if(bClearFirst)
		Clear();

	KString TempString = String;

	TCHAR *pToken;
	for(pToken = _tcstok(TempString.GetDataPtr(), pDelimeters) ;
		pToken ;
		pToken = _tcstok(NULL, pDelimeters))
	{
		*AddLast() = pToken;
	}
}
Пример #16
0
// -------
// Tokens
// -------
KString TTokens::Process(const KString& String) const
{
	KString DstString;

	for(size_t szStart = 0 ; szStart < String.GetLength() ; )
	{
		// Scanning for the closest token starting at 'szStart'
		const TToken*	pClosestToken = NULL;
		size_t			szClosestTokenPos;

		for(size_t i = 0 ; i < GetN() ; i++)
		{
			const TToken& CurToken = GetDataRef(i);

			size_t szPos = String.Find(CurToken.m_SrcString, szStart);
			if(szPos == UINT_MAX)
				continue;

			if(	pClosestToken == NULL		||
				szPos < szClosestTokenPos	||
				szPos == szClosestTokenPos &&
					CurToken.m_SrcString.GetLength() >
						pClosestToken->m_SrcString.GetLength())
			{
				pClosestToken = &CurToken, szClosestTokenPos = szPos;
			}
		}
		
		if(pClosestToken == NULL) // no more tokens found
		{
			DstString += String.Mid(szStart); // adding leftovers
			break;
		}

		DstString += String.Mid(szStart, szClosestTokenPos - szStart); // adding pre-token part
		DstString += pClosestToken->m_DstString; // adding token replacement
		
		// Forwarding 'szStart' to the end of just substed token
		szStart = szClosestTokenPos + pClosestToken->m_SrcString.GetLength();
	}

	return DstString;
}
Пример #17
0
void KRegistryKey::WriteString(const KString& ValueName, const KString& Value)
{
	DEBUG_VERIFY_ALLOCATION;

	DEBUG_VERIFY(IsOpen());

	size_t szLength = Value.GetLength();
	TValueArray<TCHAR, true> Buf;
	Buf.Allocate(szLength + 2), Buf.Add(szLength + 2);
	memcpy(Buf.GetDataPtr(), (LPCTSTR)Value, (szLength + 1)*sizeof(TCHAR)), Buf[szLength + 1] = 0;

	if(RegSetValueEx(m_hKey, ValueName, NULL, REG_SZ, (BYTE*)Buf.GetDataPtr(), (szLength + 1) * sizeof(TCHAR)))
		INITIATE_FAILURE;
}
Пример #18
0
bool FolderExists(const KString& FolderName)
{
	if(FolderName.IsEmpty())
		return false;

	TCHAR CurDir[1024];
	_tgetcwd(CurDir, sizeof(CurDir) - 1);

	const bool bResult = _tchdir(UnslashedFolderName(FolderName)) ? false : true;

	_tchdir(CurDir);

	return bResult;
}
Пример #19
0
bool FileExists(const KString& FileName)
{
	if(FileName.IsEmpty())
		return false;

	FILE *file = _tfopen(FileName,TEXT("rb"));

	if(file)
	{
		fclose(file);
		return true;
	}

	return false;
}
Пример #20
0
KString KString::operator + (const KString& SString) const
{
	return KString(GetDataPtr(), GetLength(), SString, SString.GetLength());
}
Пример #21
0
std::string KDouble::operator*(const KString& string) const
{
	return string.repeatSequence(this->getValue());
}
Пример #22
0
// -- Cameras ----------------------------------------------------------------------------
KFbxCamera* Scene::getCurrentCamera(KTime time)
{
    KFbxGlobalSettings& lGlobalSettings = fbxScene->GetGlobalSettings();
    KFbxGlobalCameraSettings& lGlobalCameraSettings = fbxScene->GlobalCameraSettings();
    KString lCurrentCameraName = lGlobalSettings.GetDefaultCamera();

    // check if we need to create the Producer cameras!
    if (lGlobalCameraSettings.GetCameraProducerPerspective() == NULL &&
            lGlobalCameraSettings.GetCameraProducerBottom() == NULL &&
            lGlobalCameraSettings.GetCameraProducerTop() == NULL &&
            lGlobalCameraSettings.GetCameraProducerFront() == NULL &&
            lGlobalCameraSettings.GetCameraProducerBack() == NULL &&
            lGlobalCameraSettings.GetCameraProducerRight() == NULL &&
            lGlobalCameraSettings.GetCameraProducerLeft() == NULL)
    {
        lGlobalCameraSettings.CreateProducerCameras();
    }

    if (lCurrentCameraName.Compare(PRODUCER_PERSPECTIVE) == 0) {
        return lGlobalCameraSettings.GetCameraProducerPerspective();

    } else if (lCurrentCameraName.Compare(PRODUCER_BOTTOM) == 0) {
        return lGlobalCameraSettings.GetCameraProducerBottom();

    } else if (lCurrentCameraName.Compare(PRODUCER_TOP) == 0) {
        return lGlobalCameraSettings.GetCameraProducerTop();

    } else if (lCurrentCameraName.Compare(PRODUCER_FRONT) == 0) {
        return lGlobalCameraSettings.GetCameraProducerFront();

    } else if (lCurrentCameraName.Compare(PRODUCER_BACK) == 0) {
        return lGlobalCameraSettings.GetCameraProducerBack();

    } else if (lCurrentCameraName.Compare(PRODUCER_RIGHT) == 0) {
        return lGlobalCameraSettings.GetCameraProducerRight();

    } else if (lCurrentCameraName.Compare(PRODUCER_LEFT) == 0) {
        return lGlobalCameraSettings.GetCameraProducerLeft();

    } else if (lCurrentCameraName.Compare(CAMERA_SWITCHER) == 0) {
        KFbxCameraSwitcher* lCameraSwitcher = fbxScene->GlobalCameraSettings().GetCameraSwitcher();
        KFbxAnimCurve* lCurve = NULL;
        if (lCameraSwitcher) {
            lCurve = lCameraSwitcher->CameraIndex.GetCurve<KFbxAnimCurve>(currentAnimationLayer);
            KFCurve* lFCurve = (lCurve)?lCurve->GetKFCurve():NULL;

            int lCameraIndex = 0;
            if (lFCurve)
                // Get the index of the camera in the camera array.
                lCameraIndex = (int) lFCurve->Evaluate(time) - 1;

            if (lCameraIndex >= 0 && lCameraIndex < cameras.GetCount()) {
                KFbxNode* lNode = cameras[lCameraIndex];

                // Get the animated parameters of the camera.
                getCameraAnimatedParameters(lNode, time);

                return (KFbxCamera*) lNode->GetNodeAttribute();
            }
        }
    } else {
        int i;
        KFbxNode* lNode = NULL;

        // Find the camera in the camera array.
        for (i = 0; i < cameras.GetCount(); i++) {
            if (lCurrentCameraName.Compare(cameras[i]->GetName()) == 0) {
                lNode = cameras[i];
                break;
            }
        }

        if (lNode) {
            // Get the animated parameters of the camera.
            getCameraAnimatedParameters(lNode, time);

            return (KFbxCamera*) lNode->GetNodeAttribute();
        }
    }

    return lGlobalCameraSettings.GetCameraProducerPerspective();
}
Пример #23
0
std::string KDouble::operator+(const KString& string) const
{
	return this->toString() + string.getValue();
}
Пример #24
0
bool MeshImportFBX::Import( const char* filename, NVSHARE::MeshImportInterface *callback  )
{
	char message[OUTPUT_TEXT_BUFFER_SIZE+1] = "";
	message[OUTPUT_TEXT_BUFFER_SIZE] = '\0';
	
    const char* localName = getFileName( filename );
	KString fileName = KString( filename );
	KString filePath = fileName.Left( localName - filename );

	m_sdkManager = KFbxSdkManager::Create();

	if(m_sdkManager == NULL)
		return false;


    // Create the importer.
    int fileFormat = -1;
    //int registeredCount;
    //int pluginId;
    //m_sdkManager->GetIOPluginRegistry()->RegisterReader( CreateFBXImporterReader, GetFBXImporterReaderInfo,
    //             pluginId, registeredCount, FillFBXImporterReaderIOSettings );

    m_importer = KFbxImporter::Create( m_sdkManager, "" );
	if( !m_sdkManager->GetIOPluginRegistry()->DetectFileFormat( filename, fileFormat ) )
    {
        // Unrecognizable file format. Try to fall back to KFbxImporter::eFBX_BINARY
        fileFormat = m_sdkManager->GetIOPluginRegistry()->FindReaderIDByDescription( "FBX binary (*.fbx)" );;
    }

    m_importer->SetFileFormat( fileFormat );


    // Initialize the importer by providing a filename.
    if( !m_importer->Initialize( filename ) )
		return false;

    // Create the scene.
    m_scene = KFbxScene::Create( m_sdkManager, "" );


    if (m_importer->IsFBX())
    {
        // Set the import states. By default, the import states are always set to 
        // true. The code below shows how to change these states.
        IOSREF.SetBoolProp(IMP_FBX_MATERIAL,        true);
        IOSREF.SetBoolProp(IMP_FBX_TEXTURE,         true);
        IOSREF.SetBoolProp(IMP_FBX_LINK,            true);
        IOSREF.SetBoolProp(IMP_FBX_SHAPE,           true);
        IOSREF.SetBoolProp(IMP_FBX_GOBO,            true);
        IOSREF.SetBoolProp(IMP_FBX_ANIMATION,       true);
        IOSREF.SetBoolProp(IMP_FBX_GLOBAL_SETTINGS, true);
    }



	sprintf_s( message, OUTPUT_TEXT_BUFFER_SIZE, "Importing file %s", filename );
	outputMessage( message );
	if( !m_importer->Import(m_scene) )
		return false;

	//// Convert Axis System to what is used in this example, if needed
	//KFbxAxisSystem sceneAxisSystem = m_scene->GetGlobalSettings().GetAxisSystem();
	//KFbxAxisSystem ourAxisSystem(sceneAxisSystem.KFbxAxisSystem::ZAxis, KFbxAxisSystem::ParityOdd, KFbxAxisSystem::LeftHanded);
	//if( sceneAxisSystem != ourAxisSystem )
	//{
	//     ourAxisSystem.ConvertScene(m_scene);
	//}

	//// Convert Unit System to what is used in this example, if needed
	//KFbxSystemUnit sceneSystemUnit = m_scene->GetGlobalSettings().GetSystemUnit();
	//if( sceneSystemUnit.GetScaleFactor() != 1.0 )
	//{
	//	
	//    KFbxSystemUnit ourSystemUnit(1.0);
	//	ourSystemUnit.ConvertScene(m_scene);
	//	
	//}

	m_callback = callback;
	
	ImportSkeleton();

	m_takeName = NULL;
	m_takeInfo = NULL;
	m_takeNameArray.Clear();

    int takeCount = m_importer->GetTakeCount();
	int tSelected = -1;

	for(int t = 0; t < takeCount; t++ )
	{
		m_takeInfo = m_importer->GetTakeInfo(t);
		m_takeNameArray.Add( &m_takeInfo->mName );
		if(m_takeInfo->mSelect)
			tSelected = t;
	}        
	if(tSelected == -1 && takeCount > 0)
		tSelected = 0;

	if(tSelected >= 0)
	{
		m_takeInfo = m_importer->GetTakeInfo(tSelected);
		m_takeName = m_takeNameArray[tSelected];
		m_scene->SetCurrentTake( m_takeName->Buffer() );

		if (!ImportAnimation())
		{
			Release();
			return false;
		}
	}

    m_scene->FillMaterialArray(m_MaterialArray);


    ProcessScene();
				
	//// Load the texture data in memory (for supported formats)
	//LoadSupportedTextures(m_scene, m_textureArray);
				
	sprintf_s( message, OUTPUT_TEXT_BUFFER_SIZE, "done!" );
	outputMessage( message );


	m_scene->Destroy(true, true);
	m_scene = NULL;

	m_importer->Destroy(true, true);
	m_importer = NULL;

	m_sdkManager->Destroy();
	m_sdkManager = NULL;

	return true;
}
Пример #25
0
BOOL KStringManager::InitByDataFile(const char* filename , BOOL bCover)
{
	KTabfileLoader& loader = KTabfileLoader::GetInstance();
	KTabFile2* fileReader = loader.GetFileReader(filename);
	if(!fileReader)
	{
		AssertFile(filename);
		return FALSE;
	}

	BOOL nRetCode = FALSE;

	int stringID = 0;
	char str[1024] = {0};
	KString<1024> dstStr;

	while(TRUE)
	{
		int nRet = fileReader->ReadLine();
		if(nRet == -1) { loader.CloseFileReader(fileReader); return FALSE; }
		if(nRet == 0) break;

		nRetCode = fileReader->GetInteger(0 , 0, &stringID);
		if(!nRetCode) continue;

		nRetCode = fileReader->GetString(1, "", str, 1024);
		if(!nRetCode) continue;

		if (!stringID)
		{
			continue;
		}

		const char* ps = TranslateSourceMessage<1024>(str, dstStr);

		int len = dstStr.size();
		if (len == 0) dstStr = "";

		if(len < 0 || len >= 1024)
		{
			Log(LOG_ERROR, "error: string %u has a length %d exceed 1024 in file %s", stringID, len, filename);
			continue;
		}

		if(bCover)
		{
			const char* oldStr = this->GetStringByID(stringID);
			if(!oldStr || strcmp(oldStr, ps) != 0)
			{
				char* strValue = KBuffer64k::WriteData(ps, len+1);
				m_StringHashMap[stringID] = strValue;
			}
		}
		else
		{
			char* strValue = KBuffer64k::WriteData(ps, len+1);
			m_StringHashMap[stringID] = strValue;
		}
	}

	loader.CloseFileReader(fileReader);
	return TRUE;
}
Пример #26
0
KFbxCamera* GetCurrentCamera(KFbxScene* pScene, 
		KTime& pTime, 
		KArrayTemplate<KFbxNode*>& pCameraArray)
{
	KFbxGlobalSettings& lGlobalSettings = pScene->GetGlobalSettings();
	KFbxGlobalCameraSettings& lGlobalCameraSettings = pScene->GlobalCameraSettings();
	KString lCurrentCameraName = lGlobalSettings.GetDefaultCamera();

	if (lGlobalCameraSettings.GetCameraProducerPerspective() == NULL &&
			lGlobalCameraSettings.GetCameraProducerBottom() == NULL &&
			lGlobalCameraSettings.GetCameraProducerTop() == NULL &&
			lGlobalCameraSettings.GetCameraProducerFront() == NULL &&
			lGlobalCameraSettings.GetCameraProducerBack() == NULL &&
			lGlobalCameraSettings.GetCameraProducerRight() == NULL &&
			lGlobalCameraSettings.GetCameraProducerLeft() == NULL)
	{
		lGlobalCameraSettings.CreateProducerCameras();
	}

	if (lCurrentCameraName.Compare(PRODUCER_PERSPECTIVE) == 0)
	{
		return lGlobalCameraSettings.GetCameraProducerPerspective();
	}
	else if (lCurrentCameraName.Compare(PRODUCER_BOTTOM) == 0)
	{
		return lGlobalCameraSettings.GetCameraProducerBottom();
	}
	else if (lCurrentCameraName.Compare(PRODUCER_TOP) == 0)
	{
		return lGlobalCameraSettings.GetCameraProducerTop();
	}
	else if (lCurrentCameraName.Compare(PRODUCER_FRONT) == 0)
	{
		return lGlobalCameraSettings.GetCameraProducerFront();
	}
	else if (lCurrentCameraName.Compare(PRODUCER_BACK) == 0)
	{
		return lGlobalCameraSettings.GetCameraProducerBack();
	}
	else if (lCurrentCameraName.Compare(PRODUCER_RIGHT) == 0)
	{
		return lGlobalCameraSettings.GetCameraProducerRight();
	}
	else if (lCurrentCameraName.Compare(PRODUCER_LEFT) == 0)
	{
		return lGlobalCameraSettings.GetCameraProducerLeft();
	}
	else if (lCurrentCameraName.Compare(CAMERA_SWITCHER) == 0)
	{
		KFbxCameraSwitcher* lCameraSwitcher = pScene->GlobalCameraSettings().GetCameraSwitcher();
		KFbxAnimCurve* lCurve = NULL;
		if (lCameraSwitcher)
		{
			lCurve = lCameraSwitcher->CameraIndex.GetCurve<KFbxAnimCurve>(gCurrentAnimationLayer);
			KFCurve* lFCurve = (lCurve)?lCurve->GetKFCurve():NULL;

			int lCameraIndex = 0;
			if (lFCurve)
				lCameraIndex = (int) lFCurve->Evaluate(pTime) - 1;

			if (lCameraIndex >= 0 && lCameraIndex < pCameraArray.GetCount())
			{
				KFbxNode* lNode = pCameraArray[lCameraIndex];

				GetCameraAnimatedParameters(lNode, pTime);

				return (KFbxCamera*) lNode->GetNodeAttribute();
			}
		}
	}
	else
	{
		int i;
		KFbxNode* lNode = NULL;

		for (i = 0; i < pCameraArray.GetCount(); i++)
		{
			if (lCurrentCameraName.Compare(pCameraArray[i]->GetName()) == 0)
			{
				lNode = pCameraArray[i];
				break;
			}
		}

		if (lNode)
		{
			GetCameraAnimatedParameters(lNode, pTime);

			return (KFbxCamera*) lNode->GetNodeAttribute();
		}
	}

	return lGlobalCameraSettings.GetCameraProducerPerspective();
}