#include "ortoolstory_tool.h"
#define ORTOOLSTORY__CLASS ORTOOLSTORY__CLASSNAME
#define ORTOOLSTORY__LABEL "Story Example"
#define ORTOOLSTORY__DESC "FBSDK - Tool Story Description"
ORTOOLSTORY__LABEL,
ORTOOLSTORY__DESC,
bool ORToolStory::FBCreate()
{
StartSize[0] = 200;
StartSize[1] = 68;
AddRegion(
"ButtonTest",
"ButtonTest", 10,
kFBAttachLeft,
"", 1.0,
SetControl( "ButtonTest", mButtonTest );
mButtonTest.OnClick.Add(
this, (
FBCallback) &ORToolStory::EventButtonTestClick );
mButtonTest.Caption = "Save to 'C:\\ortooltory.txt'";
OnShow.Add (
this, (
FBCallback) &ORToolStory::EventToolShow );
OnIdle.Add (
this, (
FBCallback) &ORToolStory::EventToolIdle );
OnResize.Add(
this, (
FBCallback) &ORToolStory::EventToolResize );
OnPaint.Add (
this, (
FBCallback) &ORToolStory::EventToolPaint );
OnInput.Add (
this, (
FBCallback) &ORToolStory::EventToolInput );
return true;
}
void ORToolStory::FBDestroy()
{
OnShow.Remove (
this, (
FBCallback) &ORToolStory::EventToolShow );
OnIdle.Remove (
this, (
FBCallback) &ORToolStory::EventToolIdle );
OnPaint.Remove (
this, (
FBCallback) &ORToolStory::EventToolPaint );
OnInput.Remove (
this, (
FBCallback) &ORToolStory::EventToolInput );
OnResize.Remove (
this, (
FBCallback) &ORToolStory::EventToolResize);
}
{
FBStory& lStory = FBStory::TheOne();
FBStoryFolder* lEditFolder = lStory.RootEditFolder;
FBStoryFolder* lActionFolder = lStory.RootFolder;
mFile = fopen( "C:\\ortoolstory.txt", "w");
if( !mFile ) return;
WriteRecursiveFolder(0, lEditFolder);
if( mFile ) fwrite("\n", strlen("\n"), 1, mFile);
WriteRecursiveFolder(0, lActionFolder);
if( mFile )
{
fclose(mFile);
}
}
{
}
{
FBEventShow lEvent( pEvent );
if( lEvent.Shown )
{
}
else
{
}
}
{
}
{
}
{
}
bool ORToolStory::FbxStore ( FBFbxObject* pFbxObject,
kFbxObjectStore pStoreWhat )
{
return true;
}
bool ORToolStory::FbxRetrieve( FBFbxObject* pFbxObject,
kFbxObjectStore pStoreWhat )
{
return true;
}
{
switch( pTrackType )
{
default: return "";
}
}
bool ORToolStory::WriteRecursiveFolder(int pCount, FBStoryFolder* pFolder)
{
if( !mFile ) return false;
WriteFolderContent(pCount, pFolder);
int i, c = pFolder->Childs.GetCount();
for( i = 0; i < c; i++ )
{
if( !WriteRecursiveFolder(pCount + 1, pFolder->Childs[i]) ) return false;
}
return true;
}
bool ORToolStory::WriteFolderContent(int pCount, FBStoryFolder* pFolder)
{
if( !mFile ) return false;
FBString lText;
for( int k = 0; k < pCount; k++ ) lText += " ";
lText += " - Folder (Name: ";
lText += pFolder->Name;
lText += ")\n";
fwrite((char*)lText, strlen(lText), 1, mFile);
int i, c = pFolder->Tracks.GetCount();
for( i = 0; i < c; i++ )
{
if( !WriteTrackContent(pCount + 1, pFolder->Tracks[i]) ) return false;
}
return true;
}
bool ORToolStory::WriteTrackContent(int pCount, FBStoryTrack* pTrack)
{
if( !mFile ) return false;
FBString lText;
for( int k = 0; k < pCount; k++ ) lText += " ";
lText += " - ";
lText += GetTrackTypeName(pTrack->Type);
lText += " Track (Name: ";
lText += pTrack->Name;
c = pTrack->Details.GetCount();
if( c > 0 )
{
lText += ", Details:";
for( i = 0; i < c; i++ )
{
lText += " ";
lText += pTrack->Details[
i]->Name;
if( i == 2 )
{
lText += " etc...";
break;
}
}
}
lText += ")\n";
fwrite((char*)lText, strlen(lText), 1, mFile);
c = pTrack->Clips.GetCount();
for( i = 0; i < c; i++ )
{
if( !WriteClipContent(pCount + 1, pTrack->Clips[i], pTrack->Type) ) return false;
}
return true;
}
bool ORToolStory::WriteClipContent(
int pCount, FBStoryClip* pClip,
FBStoryTrackType pTrackType)
{
if( !mFile ) return false;
FBTime lInTime = pClip->Start;
FBTime lOutTime = pClip->Stop;
char lSpeed[32];
sprintf(lSpeed, "%0.2f", double(pClip->Speed));
FBString lText;
for( int k = 0; k < pCount; k++ ) lText += " ";
lText += " - Clip (Name: ";
lText += pClip->Name;
lText += ", Speed: ";
lText += lSpeed;
{
lText += ", Camera: ";
FBCamera* lCamera = pClip->ShotCamera;
if( lCamera ) lText += lCamera->Name;
else lText += "<None>";
FBTime lStart = pClip->ShotActionStart;
FBTime lStop = pClip->ShotActionStop;
lText += ", ActionStart: ";
lText += lStart.GetTimeString();
lText += ", ActionStop: ";
lText += lStop.GetTimeString();
}
{
lText += ", AudioFile: ";
FBAudioClip* lAudio = pClip->AudioClip;
if( lAudio ) lText += lAudio->Filename;
else lText += "<None>";
}
{
}
lText += ", InTime: ";
lText += lInTime.GetTimeString();
lText += ", OutTime: ";
lText += lOutTime.GetTimeString();
lText += ")\n";
fwrite((char*)lText, strlen(lText), 1, mFile);
return true;
}