00001 #ifndef __FBSYSTEM_H__
00002 #define __FBSYSTEM_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00045 #include <kaydaradef.h>
00046 #ifndef FBSDK_DLL
00047
00050 #define FBSDK_DLL K_DLLIMPORT
00051 #endif
00052
00053
00054 #include <fbsdk/fbcomponent.h>
00055 #include <fbsdk/fbdata.h>
00056
00057 #include <fbsdk/fbio.h>
00058 #include <fbsdk/fbshader.h>
00059 #include <fbsdk/fbmodel.h>
00060
00061
00062 #if !defined(K_NO_AUDIO)
00063 #include <fbsdk/fbaudio.h>
00064 #endif
00065
00066 #if !defined(K_NO_VIDEO)
00067 #include <fbsdk/fbvideo.h>
00068 #endif
00069
00070 #if !defined(K_NO_DECK)
00071 #include <fbsdk/fbdeck.h>
00072 #endif
00073
00074 #if !defined(K_NO_ASSETMNG)
00075 #include <fbsdk/fbassetmng.h>
00076 #endif
00077
00078 #if !defined(K_NO_MANIPULATOR)
00079 #include <fbsdk/fbmanipulator.h>
00080 #endif
00081
00082 #ifdef FBSDKUseNamespace
00083 namespace FBSDKNamespace {
00084 #endif
00085
00086 FB_FORWARD( FBCharacter );
00087
00088 struct FBVideoGrabOptions;
00090 typedef FBVideoGrabOptions* HFBVideoGrabOptions;
00091
00092 struct FBPickInfos;
00094 typedef class FBSDK_DLL FBArrayTemplate<FBPickInfos> FBPickInfosList;
00095
00096 FB_DEFINE_COMPONENT( FBSDK_DLL, Take );
00097 FB_DEFINE_COMPONENT( FBSDK_DLL, Renderer );
00098
00100
00102
00103
00109 FBSDK_DLL HIObject FBGetFBObject( HIObject pObject, bool pAutoCreate=false );
00110
00116 template<class T> inline T* FBCast(HIObject pObject, bool pAutoCreate = false)
00117 {
00118 HIObject lObject = FBGetFBObject(pObject, pAutoCreate);
00119
00120 return (T*)lObject;
00121 }
00122
00124
00126 __FB_FORWARD( FBSystem );
00127
00144 class FBSDK_DLL FBSystem : public FBComponent {
00145 __FBClassDeclare( FBSystem,FBComponent );
00146 public:
00149 FBSystem();
00150
00151 FBPropertyString ApplicationPath;
00152 FBPropertyEventUIIdle OnUIIdle;
00153 FBPropertyEventConnectionNotify OnConnectionNotify;
00154 FBPropertyEventConnectionDataNotify OnConnectionDataNotify;
00155 FBPropertyEventConnectionStateNotify OnConnectionStateNotify;
00156
00157 FBPropertyString ComputerName;
00158 FBPropertyDouble Version;
00159 FBPropertyString BuildId;
00160
00161
00162 FBPropertyTime SystemTime;
00163 FBPropertyTime LocalTime;
00164 FBPropertyTake CurrentTake;
00165
00166 FBPropertyScene Scene;
00167
00168 FBPropertyModel SceneRootModel;
00169 FBPropertyModel RootModel;
00170 FBPropertyString PathImages;
00171 FBPropertyString PathMeshs;
00172
00173 #if !defined(K_NO_AUDIO)
00174 FBPropertyListAudioIn AudioInputs;
00175 FBPropertyListAudioOut AudioOutputs;
00176 #endif
00177
00178 #if !defined(K_NO_VIDEO)
00179 FBPropertyListVideoIn VideoInputs;
00180 FBPropertyListVideoOut VideoOutputs;
00181 #endif
00182
00183 FBPropertyListCommPort CommPorts;
00184 FBPropertyRenderer Renderer;
00185
00186 FBPropertyDouble FrameRate;
00187 FBPropertyDouble ProcessMemory;
00188 FBPropertyDouble ProcessMemoryPeak;
00189 FBPropertyVector2d DesktopSize;
00190 FBPropertyBool FullScreenViewer;
00191
00192 #if !defined(K_NO_ASSETMNG)
00193 FBPropertyAssetMng AssetManager;
00194 #endif
00195
00200 static bool LibraryLoad(char *pPath);
00206 static void* LibraryGetProcAddress(char *pPath, char *pFunctionName);
00211 static bool LibraryFree(char *pPath);
00212
00216 static FBSystem& TheOne();
00217 };
00218
00219 #ifndef K_NO_TRIGGER
00220
00221
00223 __FB_FORWARD( FBTriggerManager );
00227 class FBSDK_DLL FBTriggerManager :public FBComponent
00228 {
00229 __FBClassDeclare( FBTriggerManager, FBComponent );
00230 public:
00233 FBTriggerManager();
00234
00238 int GetGroupCount();
00239
00244 char* GetGroupName( int pIndex );
00245
00250 bool GetGroupActive( int pIndex );
00251
00256 void SetGroupActive( int pIndex, bool pState );
00257
00258 FBPropertyBool Active;
00259 };
00260 #endif
00261
00263
00265 FB_FORWARD( FBBatchOptions );
00266
00268 enum FBBatchProcessType
00269 {
00270 kFBBatchProcessTypeLoad,
00271 kFBBatchProcessTypeSave,
00272 kFBBatchProcessTypeConvert
00273 };
00274 FB_DEFINE_ENUM( FBSDK_DLL, BatchProcessType );
00275
00277 enum FBBatchFileFormat
00278 {
00279 kFBBatchFileFormatTRC,
00280 kFBBatchFileFormatC3D,
00281 kFBBatchFileFormatAMC,
00282 kFBBatchFileFormatBVH,
00283 kFBBatchFileFormatHTR,
00284 kFBBatchFileFormatFBX
00285 };
00286 FB_DEFINE_ENUM( FBSDK_DLL, BatchFileFormat );
00287
00289 enum FBBatchOnTakeExist
00290 {
00291 kFBBatchOnTakeExistOverwrite,
00292 kFBBatchOnTakeExistSkip
00293 };
00294 FB_DEFINE_ENUM( FBSDK_DLL, BatchOnTakeExist );
00295
00297 enum FBBatchOnContainsBatchTakes
00298 {
00299 kFBBatchOnContainsBatchTakesSaveBatchTakesOnly,
00300 kFBBatchOnContainsBatchTakesSaveAllTakes
00301 };
00302 FB_DEFINE_ENUM( FBSDK_DLL, BatchOnContainsBatchTakes );
00303
00305 enum FBBatchStatus
00306 {
00307 kFBBatchStatusSuccess,
00308 kFBBatchStatusError,
00309 kFBBatchStatusCharacterNotSpecified,
00310 kFBBatchStatusCharacterNotCharacterized,
00311 kFBBatchStatusCharacterHasNoReference,
00312 kFBBatchStatusInputActorNotSpecified,
00313 kFBBatchStatusActorInputMarkersetNotSpecified,
00314 kFBBatchStatusActorInputMarkersetHasNoReferenceModel,
00315 kFBBatchStatusActorInputMarkersetNotCorrectlyAssociated,
00316 kFBBatchStatusInputCharacterNotCharacterized,
00317 kFBBatchStatusInputCharacterHasNoReference,
00318 kFBBatchStatusInputDirectoryNotValid,
00319 kFBBatchStatusAsfSkeletonFileNotSpecified,
00320 kFBBatchStatusCantOpenAsfSkeletonFile,
00321 kFBBatchStatusOutputDirectoryNotValid
00322 };
00323
00325 class FBSDK_DLL FBBatchOptions
00326 {
00327 public:
00328
00331 FBBatchOptions();
00332
00333 FBBatchFileFormat mInputFileFormat;
00334 FBBatchFileFormat mOutputFileFormat;
00335
00336 FBBatchProcessType mProcessType;
00337
00338 FBString mInputDirectory;
00339 FBString mOutputDirectory;
00340 FBString mSkeletonFile;
00341
00342 #if !defined(K_NO_CHARACTER)
00343 HFBCharacter mCharacter;
00344 #endif
00345
00346 bool mStartAnimationAtZero;
00347 bool mFrameAnimation;
00348 bool mOverwriteScaling;
00349 bool mKeepDummyBones;
00350 bool mWriteRate;
00351 bool mWriteTranslation;
00352 bool mPlotToCharacter;
00353 bool mPlotToControlSet;
00354 bool mUseSingleTake;
00355 bool mUseBatchSuffix;
00356 bool mKeepCharacterConstraint;
00357
00358 FBBatchOnTakeExist mOnTakeExistAction;
00359 FBBatchOnContainsBatchTakes mOnContainsBatchTakesAction;
00360 };
00361
00362
00364
00366 FB_FORWARD( FBPlotOptions );
00367
00369 enum FBRotationFilter
00370 {
00371 kFBRotationFilterNone,
00372 kFBRotationFilterGimbleKiller,
00373 kFBRotationFilterUnroll
00374 };
00375 FB_DEFINE_ENUM( FBSDK_DLL, RotationFilter );
00376
00378 class FBSDK_DLL FBPlotOptions
00379 {
00380 public:
00381
00384 FBPlotOptions();
00385
00386 bool mPlotAllTakes;
00387 bool mPlotOnFrame;
00388 FBTime mPlotPeriod;
00389 FBRotationFilter mRotationFilterToApply;
00390 bool mUseConstantKeyReducer;
00391 bool mConstantKeyReducerKeepOneKey;
00392 bool mPlotTranslationOnRootOnly;
00393 bool mPreciseTimeDiscontinuities;
00394 };
00395
00396
00397
00398
00400
00402 __FB_FORWARD( FBApplication );
00403 __FB_FORWARD( FBCharacter );
00404 __FB_FORWARD( FBActor );
00405 FB_DEFINE_COMPONENT( FBSDK_DLL, Character );
00406 FB_DEFINE_COMPONENT( FBSDK_DLL, Actor );
00407
00409 enum FBViewerMode {
00410 kFBViewerModeOneWindow,
00411 kFBViewerModeTwoWindow,
00412 kFBViewerModeThreeWindow,
00413 kFBViewerModeFourWindow,
00414 kFBViewerModeSchematic
00415 };
00416
00431 class FBSDK_DLL FBApplication : public FBComponent
00432 {
00433 __FBClassDeclare( FBApplication,FBComponent );
00434 public:
00438 FBApplication(HIObject pObject=NULL);
00439
00440 FBPropertyEvent OnFileNewCompleted;
00441 FBPropertyEvent OnFileNew;
00442 FBPropertyEvent OnFileOpenCompleted;
00443 FBPropertyEvent OnFileOpen;
00444 FBPropertyEvent OnFileMerge;
00445 FBPropertyEvent OnFileSaveCompleted;
00446 FBPropertyEvent OnFileSave;
00447 FBPropertyEvent OnFileExit;
00448
00453 bool Minimize(bool pBlocking=true);
00454
00458 bool Maximize();
00459
00463 bool FileNew();
00464
00472 bool FileOpen( char* pFilename, bool pShowOptions = false, FBFbxOptions* pOptions = NULL );
00473 bool FileOpen( void* pBuffer, kULong pBufferLength );
00474 bool GetMaxFrameCount(void* pMemAddr, kULong pSize, kLong* pFrameCount, int pTimeScale);
00475
00483 bool FileMerge( char* pFilename, bool pShowOptions = false, FBFbxOptions* pOptions = NULL );
00484
00493 bool FileAppend( char* pFilename, bool pShowOptions = false, FBFbxOptions* pOptions = NULL );
00494
00500 bool FileSave( char* pFilename = NULL, FBFbxOptions* pOptions = NULL );
00501
00506 void FileExit( bool pSave = false );
00507
00519 bool FileImport( FBString pFilename, bool pMatchModels = false );
00520
00532 bool FileExport( FBString pFilename );
00533
00540 FBBatchStatus FileBatch( HFBBatchOptions pBatchOptions, HFBPlotOptions pPlotOptions = NULL );
00541
00550 bool FileImportBatch( char* pName, HFBBatchOptions pBatchOptions, HFBModel pReference );
00551
00561 bool FileExportBatch( char* pName, HFBTake pTake, HFBBatchOptions pBatchOptions, FBModelList &pExportModels );
00562
00569 bool SaveCharacterRigAndAnimation( char* pFileName, HFBCharacter pCharacter, HFBFbxOptions pFbxOptions);
00570
00578 bool LoadAnimationOnCharacter( char* pFileName, HFBCharacter pCharacter, HFBFbxOptions pFbxOptions, HFBPlotOptions pPlotOptions);
00579
00584 bool IsValidBatchFile( char* pFilename );
00585
00592 void FileRender( HFBVideoGrabOptions pRenderOptions = NULL );
00593
00599 bool ExecuteScript(FBString pFilename);
00600
00604 void SwitchViewerCamera( FBCamera &pCamera );
00605
00606
00607
00614 K_DEPRECATED bool FBXFileOpen( char* pFilename, FBFbxOptions* pOptions = NULL );
00615
00622 K_DEPRECATED bool FBXFileMerge( char* pFilename, FBFbxOptions* pOptions = NULL );
00623
00630 K_DEPRECATED bool FBXFileAppend( char* pFilename, FBFbxOptions* pOptions = NULL );
00631
00637 K_DEPRECATED bool FBXFileSave( char* pFilename = NULL, FBFbxOptions* pOptions = NULL );
00638
00639 public:
00640 FBPropertyString FBXFileName;
00641 FBPropertyActor CurrentActor;
00642 FBPropertyCharacter CurrentCharacter;
00643
00644 #if !defined(K_NO_MANIPULATOR)
00645 FBPropertyListManipulator Manipulators;
00646 #endif
00647
00651 static FBApplication& TheOne();
00652 };
00653
00654
00656
00658
00659 __FB_FORWARD( FBPlayerControl );
00660
00661
00662
00663
00665 enum FBTransportMode {
00666 kFBTransportPlay, kFBTransportPlayPrepare, kFBTransportPlayReady,
00667 kFBTransportStop, kFBTransportStopPost, kFBTransportStopReady,
00668 kFBTransportShuttle, kFBTransportShuttlePrepare, kFBTransportShuttleReady,
00669 kFBTransportPlayReverse, kFBTransportPlayReversePrepare, kFBTransportPlayReverseReady,
00670 kFBTransportJog, kFBTransportJogPrepare, kFBTransportJogReady,
00671 kFBTransportGoto, kFBTransportGotoPrepare, kFBTransportGotoReady,
00672 kFBTransportStepForward, kFBTransportStepForwardPrepare, kFBTransportStepForwardReady,
00673 kFBTransportStepBackward, kFBTransportStepBackwardPrepare,kFBTransportStepBackwardReady
00674 };
00675 FB_DEFINE_ENUM( FBSDK_DLL, TransportMode );
00676
00678 enum FBTransportTimeFormat
00679 {
00680 kFBTimeFormatTimecode,
00681 kFBTimeFormatFrame,
00682 };
00683
00684 FB_DEFINE_ENUM(FBSDK_DLL, TransportTimeFormat);
00685
00686
00688 enum FBTransportPlaySpeed
00689 {
00690 kFBSpeed_1_10x,
00691 kFBSpeed_1_5x,
00692 kFBSpeed_1_4x,
00693 kFBSpeed_1_3x,
00694 kFBSpeed_1_2x,
00695 kFBSpeed_1x,
00696 kFBSpeed_ALL_FR,
00697 kFBSpeed_2x,
00698 kFBSpeed_3x,
00699 kFBSpeed_4x,
00700 kFBSpeed_5x,
00701 kFBSpeed_10x
00702 };
00703 FB_DEFINE_ENUM( FBSDK_DLL, TransportPlaySpeed);
00704
00706 enum FBTransportSnapMode
00707 {
00708 kFBTransportSnapModeNoSnap,
00709 kFBTransportSnapModeSnapOnFrames,
00710 kFBTransportSnapModePlayOnFrames,
00711 kFBTransportSnapModeSnapAndPlayOnFrames,
00712 };
00713 FB_DEFINE_ENUM( FBSDK_DLL, TransportSnapMode );
00714
00715
00730 class FBSDK_DLL FBPlayerControl : public FBComponent {
00731 __FBClassDeclare( FBPlayerControl,FBComponent );
00732 public:
00733
00737 FBPlayerControl(HIObject pObject=NULL);
00738
00743 bool Play(bool pUseMarkers = false);
00744
00749 bool PlayReverse(bool pUseMarkers = false);
00750
00754 void SetPlaySpeed (FBTransportPlaySpeed pPlaySpeed );
00755
00759 FBTransportPlaySpeed GetPlaySpeed();
00760
00764 bool Stop();
00765
00769 bool GotoStart();
00770
00774 bool GotoEnd();
00775
00780 bool Goto( FBTime pTime );
00781
00785 bool StepForward();
00786
00790 bool StepBackward();
00791
00797 bool Record( bool pOverrideTake=false,bool pCopyData=true );
00798
00802 FBTransportMode GetTransportMode();
00803
00808 void SetTransportFps ( FBTimeMode pTimeMode, double pCustom=0.0);
00809
00813 FBTimeMode GetTransportFps ();
00814
00818 double GetTransportFpsValue ();
00819
00823 void Key();
00824
00827 void GotoNextKey();
00828
00831 void GotoPreviousKey();
00832
00835 void EvaluationPause();
00836
00839 void EvaluationResume();
00840
00841 FBPropertyBool LoopActive;
00842 FBPropertyTime LoopStart;
00843 FBPropertyTime LoopStop;
00844
00845 FBPropertyTime ZoomWindowStart;
00846 FBPropertyTime ZoomWindowStop;
00847
00848 FBPropertyTime NextMarker;
00849 FBPropertyTime PreviousMarker;
00850
00851 FBPropertyBool IsRecording;
00852 FBPropertyBool IsPlaying;
00853 FBPropertyBool IsPlotting;
00854
00855 FBPropertyTransportSnapMode SnapMode;
00856
00857 FBPropertyTransportTimeFormat TransportTimeFormat;
00858
00859 FBPropertyTime RecordingSamplingPeriod;
00860 FBPropertyTime PlotSamplingPeriod;
00861
00865 static FBPlayerControl& TheOne();
00866 };
00867
00869
00871
00873 enum FBParallelScheduleType
00874 {
00875 kFBParallelScheduleSerial,
00876 kFBParallelScheduleSimple,
00877 kFBParallelScheduleAdvanced,
00878 };
00879
00880 FB_DEFINE_ENUM(FBSDK_DLL, ParallelScheduleType);
00881
00886 __FB_FORWARD( FBEvaluateManager );
00887 class FBSDK_DLL FBEvaluateManager : public FBComponent
00888 {
00889 __FBClassDeclare( FBEvaluateManager,FBComponent );
00890
00891 public:
00892
00896 FBEvaluateManager(HIObject pObject=NULL);
00897
00898 FBPropertyBool ParallelPipeline;
00899 FBPropertyBool ParallelDeformation;
00900 FBPropertyParallelScheduleType ParallelScheduleType;
00901
00902 FBPropertyInt NodeCount;
00903 FBPropertyInt DeviceCount;
00904
00906 void InvalidateDAG();
00907
00911 static FBEvaluateManager& TheOne();
00912 };
00913
00915
00917 __FB_FORWARD( FBKeyControl );
00918
00922 class FBSDK_DLL FBKeyControl : public FBComponent
00923 {
00924 __FBClassDeclare(FBKeyControl, FBComponent);
00925
00926 public:
00930 FBKeyControl(HIObject pObject=NULL);
00931
00932 FBPropertyBool AutoKey;
00933 };
00934
00936
00938 __FB_FORWARD( FBPointCacheManager );
00939
00943 class FBSDK_DLL FBPointCacheManager : public FBComponent
00944 {
00945 __FBClassDeclare(FBPointCacheManager, FBComponent);
00946
00951 FBPointCacheManager(HIObject pObject=NULL);
00952
00953 public:
00954 FBPropertyListObject Models;
00955
00956 FBPropertyBool ApplyGlobalTransform;
00957 FBPropertyAction SetTransformReference;
00958
00959 FBPropertyBool ApplyCacheOnNewModel;
00960 FBPropertyModel NewModelRoot;
00961
00962 FBPropertyBool AllowCacheResampling;
00963 FBPropertyBool AlwaysAskForPath;
00964 FBPropertyString DefaultPath;
00965 FBPropertyBool CacheNormal;
00966 FBPropertyBool CacheAABBox;
00967 FBPropertyBool CreateMultiChannelCache;
00968 FBPropertyBool CreateFilePerFrameCache;
00969 FBPropertyInt SaveEveryFrame;
00970
00974 static FBPointCacheManager& TheOne();
00975 };
00976
00978
00980 FB_FORWARD( FBCriticalSection );
00981
00986 class FBSDK_DLL FBCriticalSection
00987 {
00988 void *mPtr;
00989 public:
00991 FBCriticalSection();
00992
00994 ~FBCriticalSection();
00995
00999 bool Init();
01000
01002 void Enter();
01003
01005 void Leave();
01006 };
01007
01009
01011 __FB_FORWARD( FBReferenceTime );
01012
01014 class FBSDK_DLL FBReferenceTime : public FBComponent {
01015 __FBClassDeclare( FBReferenceTime,FBComponent );
01016 public:
01020 FBReferenceTime(HIObject pObject=NULL);
01021
01026 int Add( char *pName );
01027
01031 void Remove( int pIndex );
01032
01038 void SetTime( int pIndex, FBTime pReferenceTime, FBTime pSystem );
01044 FBTime GetTime( int pIndex, FBTime pSystem );
01045
01050 char *operator[](int pIndex);
01051
01052 FBPropertyInt Count;
01053 FBPropertyInt ItemIndex;
01054 };
01055
01057
01059
01060
01067 FBSDK_DLL FBModelList* FBCreateModelList();
01068
01072 FBSDK_DLL void FBDestroyModelList( FBModelList* pModelList );
01073
01080 FBSDK_DLL FBPickInfosList* FBCreatePickInfosList();
01081
01085 FBSDK_DLL void FBDestroyPickInfosList( FBPickInfosList* pPickInfosList );
01086
01093 FBSDK_DLL FBComponentList* FBCreateComponentList();
01094
01098 FBSDK_DLL void FBDestroyComponentList( FBComponentList* pObjectList );
01099
01100
01105 FBSDK_DLL void FBSleep( kULong MilliSeconds );
01106
01115 K_DEPRECATED FBSDK_DLL HFBModel FBFindModelByName( char* pModelName, HFBModel pParent=NULL );
01116
01125 FBSDK_DLL HFBModel FBFindModelByLabelName( char* pModelLabelName );
01126
01131 FBSDK_DLL HFBModel FBLoadFbxPrimitivesModel( char* pModelName );
01132
01140 FBSDK_DLL void FBFindModelsOfType( FBModelList& pList, int pTypeInfo, HFBModel pParent=NULL );
01141
01151 FBSDK_DLL void FBGetSelectedModels( FBModelList& pList, HFBModel pParent=NULL, bool pSelected=true, bool pSortBySelectOrder = false );
01152
01159 FBSDK_DLL void FBSelectObjectsByNamespace ( char* pNameSpaceName, bool pSelect, bool pSearchExclusive = true );
01160
01168 FBSDK_DLL void FBFindObjectsByName( const char* pNamePattern, FBComponentList& pList, bool pIncludeNamespace = true, bool pModelsOnly = false );
01169
01178 FBSDK_DLL HFBComponent FBFindObjectByFullName( char* pObjectFullName );
01179
01185 FBSDK_DLL void FBFindObjectsByNamespace( const char* pNamePattern, FBComponentList& pList );
01186
01190 FBSDK_DLL void FBBeginChangeAllModels();
01191
01194 FBSDK_DLL void FBEndChangeAllModels();
01195
01204 FBSDK_DLL void FBTrace( char* pFormatString, ... );
01205
01206 #if !defined(K_NO_UI)
01207
01212 FBSDK_DLL bool FBPopNormalTool( char* pToolName, bool pSetFocus = true );
01213
01214 #endif
01215
01216 #ifdef FBSDKUseNamespace
01217 }
01218 #endif
01219 #endif
01220