fbsdk/fbsystem.h Source File

fbsystem.h
Go to the documentation of this file.
1 #ifndef __FBSYSTEM_H__
2 #define __FBSYSTEM_H__
3 /**************************************************************************
4 Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5 All Rights Reserved.
6 
7 The coded instructions, statements, computer programs, and/or related
8 material (collectively the "Data") in these files contain unpublished
9 information proprietary to Autodesk, Inc. and/or its licensors, which is
10 protected by Canada and United States of America federal copyright law
11 and by international treaties.
12 
13 The Data may not be disclosed or distributed to third parties, in whole
14 or in part, without the prior written consent of Autodesk, Inc.
15 ("Autodesk").
16 
17 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18 ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19 WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20 ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21 OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22 PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23 WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24 FREE.
25 
26 IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27 OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28 EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29 DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30 OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31 DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32 LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33 LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34 DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35 BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
45 #include <kaydaradef.h>
46 #ifndef FBSDK_DLL
47 
50 #define FBSDK_DLL K_DLLIMPORT
51 #endif
52 
53 // Essential includes
54 #include <fbsdk/fbcomponent.h>
55 #include <fbsdk/fbdata.h> // FBPropertyListTake
56 
57 #include <fbsdk/fbio.h> // FBPropertyListCommPort
58 #include <fbsdk/fbshader.h>
59 #include <fbsdk/fbmodel.h>
60 #include <fbsdk/fbevaluateinfo.h>
61 #if !defined(K_NO_CONSTRUCTION_HISTORY)
63 #endif
64 
65 // For 'lean version' we don't need the plugin headers.
66 #if !defined(K_NO_AUDIO)
67 #include <fbsdk/fbaudio.h>
68 #endif
69 
70 #if !defined(K_NO_VIDEO)
71 #include <fbsdk/fbvideo.h>
72 #endif
73 
74 #if !defined(K_NO_DECK)
75 #include <fbsdk/fbdeck.h> // FBPropertyListDeck
76 #endif
77 
78 #if !defined(K_NO_ASSETMNG)
79 #include <fbsdk/fbassetmng.h> // FBPropertyAssetMng
80 #endif
81 
82 #if !defined(K_NO_MANIPULATOR)
83 #include <fbsdk/fbmanipulator.h> // FBPropertyListManipulator
84 #endif
85 
86 #ifdef FBSDKUseNamespace
87 namespace FBSDKNamespace {;
88 #endif
89 
90 #if !defined(K_NO_CHARACTER)
91  FB_FORWARD( FBCharacter );
92 #endif
93 
94  struct FBVideoGrabOptions;
95 
97  FB_DEFINE_COMPONENT( FBSDK_DLL, Renderer );
98 
101  {
102  public:
107 
109  typedef enum{
110  eBeginRendering = 1,
112  eEndRendering
113  }EState;
114 
118  kInt64 GetFrameNumber();
119 
123  kInt64 GetFrameCount();
124 
129 
130  private:
131  kInt64 mFrameNumber;
132  kInt64 mFrameCount;
133  EState mState;
134  };
135 
137  // FBSystem
139  __FB_FORWARD( FBSystem );
140 
157  class FBSDK_DLL FBSystem : public FBComponent {
159  public:
162  FBSystem();
163 
164  FBPropertyString ConfigPath; // < <b>Read Only Property:</b> Location where the config folder is.
165  FBPropertyString UserConfigPath; // < <b>Read Only Property:</b> Location where the user config folder is.
168 
171 
176 
181 
182 
184 
189 
191 
195 
197 #if !defined(K_NO_CONSTRUCTION_HISTORY)
199 #endif
204 
205 #if !defined(K_NO_AUDIO)
208 #endif
209 
210 #if !defined(K_NO_VIDEO)
213 #endif
214 
217 
223 
224 #if !defined(K_NO_ASSETMNG)
226 #endif
227 
228 #if !defined(K_NO_MANIPULATOR)
230 #endif
231 
236  static bool LibraryLoad(const char *pPath);
242  static void* LibraryGetProcAddress(const char *pPath, const char *pFunctionName);
247  static bool LibraryFree(const char *pPath);
248 
252  static FBString CurrentDirectory();
253 
258  static FBString MakeFullPath(const char* pRelativeFilePath);
259 
263  static FBSystem& TheOne();
264 
281  const FBStringList &GetCommandLineArgs() const;
282 
291  const FBStringList& GetPythonStartupPath() const;
292 
298  const FBStringList& GetPluginPath() const;
299 
301  typedef enum {
304  ePluginItemIconName
305  } EPluginItemInfo;
306 
310  const FBStringList& GetLoadedPluginItemsName() const;
311 
316  const FBStringList& GetLoadedPluginItemInfo( const char* pPluginItemName ) const;
317 
321  const FBStringList& GetLoadedPluginItemGroups( const char* pPluginItemName ) const;
322  };
323 
324 #ifndef K_NO_TRIGGER
325  // FBTriggerManager
328  __FB_FORWARD( FBTriggerManager );
333  {
335  public:
339 
343  int GetGroupCount();
344 
349  char* GetGroupName( int pIndex );
350 
355  bool GetGroupActive( int pIndex );
356 
361  void SetGroupActive( int pIndex, bool pState );
362 
364  };
365 #endif
366 
367 
369  // FBKeyControl
372 
377  {
379 
380  public:
384  FBKeyControl(HIObject pObject=NULL);
385 
400  void MoveKeys( FBTimeSpan pTimeSpan, FBModel *pPivot, FBVector3d pT, FBVector3d pR, FBVector3d pS, FBTime pTime, FBModelList *pModelList = NULL );
401 
403  };
404 
406  // FBPointCacheManager
409 
414  {
416 
422 
423  public:
425 
428 
431 
440 
444  static FBPointCacheManager& TheOne();
445  };
446 
448  // FBFileMonitoringManager
460  };
461 
462  FB_DEFINE_ENUM( FBSDK_DLL, FileMonitoringType );
463 
465 
470  {
471  public:
472 
476  FBEventFileChange( HKEventBase pEvent );
477 
480  };
481 
486  {
488 
494 
495  public:
500  void AddFileToMonitor(FBString pFilePath, FBFileMonitoringType pFileMonitoringType );
501 
505  void RemoveFileFromMonitor(FBString pFilePath);
506 
510  void PauseFileMonitoring(bool pPause = true);
511 
515  void CleanFileMonitoring(bool pIncludePythonEditorScripts = true);
516 
517  public:
522 
525  static FBFileMonitoringManager& TheOne();
526  };
527 
529  // FBCriticalSection
532 
538  {
539  void *mPtr;
540  public:
543 
546 
550  bool Init();
551 
553  void Enter();
554 
556  void Leave();
557  };
558 
560  // FBFastLock
563 
571  {
572  void *mPtr;
573  public:
575  FBFastLock();
576 
578  ~FBFastLock();
579 
581  void Lock();
582 
584  void Unlock();
585  };
586 
587 
589  // Global utility functions
591 
596  FBSDK_DLL void FBSleep( kULong MilliSeconds );
597 
615  {
616  kFBNO_TRACE = 0, //<! Tracing disabled
617  kFBCRITICAL_TRACE = 1, //<! Critical traces
618  kFBNORMAL_TRACE = 10, //<! Descriptive traces
619  kFBALL_TRACE = 20 //<! Default value, all traces.
620  };
621 
627  FBSDK_DLL void FBTraceSetLevel( unsigned int pNewLevel );
628 
633  FBSDK_DLL unsigned int FBTraceGetLevel();
634 
641  FBSDK_DLL void FBTrace( const char* pFormatString, ... );
642 
650  FBSDK_DLL void FBTraceWithLevel( unsigned int pLevel, const char* pFormatString, ... );
651 
653  typedef void (*FBTraceStubFct)(unsigned int pLevel, const char *pStr);
654 
660 
666 
684  FBSDK_DLL void FBObjectLifeLogEnable(bool pEnable);
685 
690  FBSDK_DLL unsigned int FBObjectGetGlobalUniqueId();
691 
696  FBSDK_DLL void FBObjectPrintLivings(unsigned int pStartUniqueId);
697 
700  FBSDK_DLL unsigned int FBObjectGetLivingCount();
701 
712  FBSDK_DLL void FBMakeFullPath( FBString &pFullPath, const char *pRootPath, const char *pFilePath );
713 
717  {
718  public:
719  virtual ~FBVisitDirectoryCallback();
720  virtual void FileVisited(const char* pSrc) const;
721  virtual void DirectoryVisited(const char* pSrc) const;
722  bool DoIt( const char* pSrcPath, bool pRecursive ) const;
723  };
724 
740 {
741 public:
742  virtual ~FBDirMap();
752  static void Add(FBString pSourceDir, FBString pTargetDir);
753 
756  static int GetCount();
757 
760  static FBString GetSource(int pIndex);
761 
764  static FBString GetTarget(int pIndex);
765 
768  static void Clear();
769 
776  static FBString Map(FBString pPath);
777 };
778 
779 #ifdef FBSDKUseNamespace
780 }
781 #endif
782 #endif
783 
class FBArrayTemplate< FBModel * > FBModelList
typedef class FBSDK_DLL FBArrayTemplate FBModelList;
Definition: fbcharacter.h:597
Model class.
Definition: fbmodel.h:273
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:132
unsigned int FBTraceGetLevel()
Get Global Trace Detailed Level which affects all the output targets.
class FBPropertyBase< FBVector2d, kFBPT_Vector2D > FBPropertyVector2d
FBPropertyVector2d type definition.
FBPropertyDouble ProcessMemoryPeak
Read Only Property: The size (MB) of process's peak memory.
Definition: fbsystem.h:220
void FBTraceSetLevel(unsigned int pNewLevel)
Set Global Trace Detailed Level which affects all the output targets.
Animation data types.
#define FB_DEFINE_COMPONENT(DllTag, Type)
Define a component and give it the ability to be a property.
Definition: fbproperties.h:139
FBTraceLevel
Trace Level.
Definition: fbsystem.h:614
Hardware input and output interfaces.
FBPropertyBool FullScreenViewer
Read Write Property: Indicates that the viewer is in full screen mode.
Definition: fbsystem.h:222
PropertyList: VideoOut
Definition: fbvideo.h:518
FBPropertyString TempPath
Read Only Property: Temporary path returned by the OS.
Definition: fbsystem.h:167
FBPropertyBool AutoKey
Read Write Property: Enable/Disable Auto Key feature (key when moving 3D objects).
Definition: fbsystem.h:402
Plug-in item's filename.
Definition: fbsystem.h:303
void FBSleep(kULong MilliSeconds)
Sleep function Puts system to sleep for specified time.
Key control.
Definition: fbsystem.h:376
FBPropertyEventConnectionDataNotify OnConnectionDataNotify
Event: A data event occurred between objects in the system.
Definition: fbsystem.h:173
FBPropertyAssetMng AssetManager
Read Only Property: Current asset manager.
Definition: fbsystem.h:225
class FBPropertyBase< double, kFBPT_double > FBPropertyDouble
Property: double
FBPropertyListAudioOut AudioOutputs
List: Available audio outputs.
Definition: fbsystem.h:207
FBPropertyVector2d DesktopSize
Read Only Property: The width and height of the desktop.
Definition: fbsystem.h:221
class FBPropertyBase< FBTime, kFBPT_Time > FBPropertyTime
Property: FBTime
PropertyEvent: Global KeyingNotify event.
Definition: fbproperties.h:605
Audio interface for FBSDK.
void(* FBTraceStubFct)(unsigned int pLevel, const char *pStr)
Trace Stub Function type define.
Definition: fbsystem.h:653
File change event class.
Definition: fbsystem.h:469
FBPropertyEvent OnFileChangePythonEditorScript
Event: Python Editor Script file change event.
Definition: fbsystem.h:521
void FBTraceWithLevel(unsigned int pLevel, const char *pFormatString,...)
This function prints useful debugging strings in the console.
File Reference change monitoring.
Definition: fbsystem.h:458
Basic string class.
Definition: fbstring.h:66
List of scene objects.
Definition: fbcomponent.h:573
void FBObjectPrintLivings(unsigned int pStartUniqueId)
Print those living objects created when logging is enabled.
#define NULL
Definition: kaydara.h:169
FBVideo and derivative classes.
void FBObjectLifeLogEnable(bool pEnable)
Enable object creation / deletion logging.
FBPropertyBool CacheNormal
Read Write Property: Cache normal when true.
Definition: fbsystem.h:435
FBPropertyEventConnectionStateNotify OnConnectionStateNotify
Event: A state change event occurred between objects in the system.
Definition: fbsystem.h:174
FBPropertyBool AlwaysAskForPath
Read Write Property: Always ask for the point cache file save path when true.
Definition: fbsystem.h:433
class FBPropertyBaseComponent< FBConstructionHistory * > FBPropertyConstructionHistory
FBPropertyEventVideoFrameRendering OnVideoFrameRendering
Event: A video frame rendering event occurred when the scene is being off-line rendered into video fi...
Definition: fbsystem.h:170
PropertyList: Manipulator.
FBPropertyBool AllowCacheResampling
Read Write Property: Allow the resample models's existing point cache deformation when true...
Definition: fbsystem.h:432
Property class: const char * (String).
FBPropertyBool Active
Read Write Property: Active status of engine.
Definition: fbsystem.h:363
FBPropertyModel NewModelRoot
Read Write Property: Valid only when ApplyCacheOnNewModel is on.
Definition: fbsystem.h:430
FBPropertyString PathMeshs
Read Only Property: Path to meshes
Definition: fbsystem.h:203
Base Event class.
Definition: fbcomponent.h:959
Base class for Cameras.
Animation clip change monitoring.
Definition: fbsystem.h:457
FBPropertyString ComputerName
Read Only Property: Computer name.
Definition: fbsystem.h:177
PropertyEvent: Global ConnectionDataNotify event.
Definition: fbproperties.h:589
#define FB_DEFINE_ENUM(DllTag, Type)
Define an enum and give it the ability to be a property.
Definition: fbproperties.h:148
FBPropertyListAudioIn AudioInputs
List: Available audio inputs.
Definition: fbsystem.h:206
FBPropertyEventUIIdle OnUIIdle
Event: User-interface idle event.
Definition: fbsystem.h:169
Declaration for the FBAssetMng class.
MotionBuilder SDK base class.
Definition: fbcomponent.h:668
FBPropertyListCommPort CommPorts
List: Comm Ports available.
Definition: fbsystem.h:215
FBPropertyInt SaveEveryFrame
Read Write Property: Recording Frequency.
Definition: fbsystem.h:439
class FBPropertyBaseComponent< FBTake * > FBPropertyTake
Definition: fbdata.h:1239
FBPropertyListVideoIn VideoInputs
List: Available video inputs.
Definition: fbsystem.h:211
PropertyEvent: Global ConnectionStateNotify event.
Definition: fbproperties.h:597
FBPropertyTake CurrentTake
Read Write Property: Current take.
Definition: fbsystem.h:194
class FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool
FBPropertyListManipulator Manipulators
List: of manipulators.
Definition: fbsystem.h:229
FBPropertyString ApplicationPath
Read Only Property: Location where the application is installed.
Definition: fbsystem.h:166
FBPropertyString BuildId
Read Only Property: Unique build Id string.
Definition: fbsystem.h:179
Python Editor Script change monitoring.
Definition: fbsystem.h:459
class FBPropertyBaseEnum< enum FBFileMonitoringType > FBPropertyFileMonitoringType
Definition: fbsystem.h:462
FBPropertyBool ApplyCacheOnNewModel
Read Write Property: Duplicated the cached models, and assoicated the point cache to the new models...
Definition: fbsystem.h:429
FBPropertyEvent OnFileChangeMainScene
Event: Main scene file change event.
Definition: fbsystem.h:518
class FBPropertyBaseComponent< FBScene * > FBPropertyScene
Definition: fbcore.h:69
Point Cache Manager Interface to the point cache manager.
Definition: fbsystem.h:413
FBPropertyEventConnectionKeyingNotify OnConnectionKeyingNotify
Event: A keying event occurred when objects are being keyed.
Definition: fbsystem.h:175
FBPropertyListObject Models
Read Write Property: Models to be recorded
Definition: fbsystem.h:424
FBPropertyTime SystemTime
Read Only Property: System time.
Definition: fbsystem.h:192
Property: Action Action property to trigger function.
FBPropertyString DefaultPath
Read Write Property: Default point cache file save path.
Definition: fbsystem.h:434
FBFileMonitoringType
File Monitoring Type.
Definition: fbsystem.h:454
Create new manipulators using the FBManipulator class.
Definition: Python-ast.h:18
FBPropertyEventConnectionNotify OnConnectionNotify
Event: A connection event occurred between objects in the system.
Definition: fbsystem.h:172
FBPropertyModel RootModel
Read Only Property: Root model.
Definition: fbsystem.h:201
class FBPropertyBaseComponent< FBRenderer * > FBPropertyRenderer
Definition: fbrenderer.h:71
FBPropertyEvent OnFileChangeFileReference
Event: File Reference file change event.
Definition: fbsystem.h:520
PropertyList: CommPort.
Definition: fbio.h:162
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
Construction History.
Loop over directory content.
Definition: fbsystem.h:716
FBPropertyListVideoOut VideoOutputs
List: Available video outputs.
Definition: fbsystem.h:212
unsigned int FBObjectGetLivingCount()
Get current total living object count.
FBPropertyBool SuspendMessageBoxes
Read Write Property: While true, all the message boxes, that would normally be displayed, are suspended.
Definition: fbsystem.h:183
FBPropertyString ConfigPath
Definition: fbsystem.h:164
class FBVector3< double > FBVector3d
3D vector.
Definition: fbtypes.h:438
FBPropertyBool CreateMultiChannelCache
Read Write Property: Create a single multiple channel point cache file for all models when true...
Definition: fbsystem.h:437
PropertyEvent: UI idle event.
Definition: fbproperties.h:565
class FBPropertyBaseComponent< FBModel * > FBPropertyModel
Definition: fbcore.h:70
FBPropertyBool CreateFilePerFrameCache
Read Write Property: Create the point cache file for each frame when true.
Definition: fbsystem.h:438
High priority critical section class.
Definition: fbsystem.h:537
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
FBPropertyBool CacheAABBox
Read Write Property: Cache AABBox (Axis Aligned Bounding Box) when true.
Definition: fbsystem.h:436
Basic class definitions.
Time data structure.
Definition: fbtime.h:86
PropertyEvent: Base event class.
Definition: fbproperties.h:507
PropertyEvent: Global ConnectionNotify event.
Definition: fbproperties.h:581
KEventBase * HKEventBase
Definition: fbcomponent.h:75
State before video renderer renders each frame.
Definition: fbsystem.h:111
Contains abstract deck class to interface with a deck.
FBPropertyString UserConfigPath
Definition: fbsystem.h:165
FBPropertyBool ApplyGlobalTransform
Read Write Property: Include no-deformable models and the global transform to Vertex Cache when true...
Definition: fbsystem.h:426
FBPropertyScene Scene
Read Only Property: Scene.
Definition: fbsystem.h:196
FBPropertyDouble ProcessMemory
Read Only Property: The size (MB) of process's working set memory.
Definition: fbsystem.h:219
FBPropertyModel SceneRootModel
Read Only Property: Scene root model.
Definition: fbsystem.h:200
FBPropertyFileMonitoringType Type
Read Only Property: Type of file change event.
Definition: fbsystem.h:478
FBPropertyBool AreMessageBoxesSuspended
Read Only Property: While true, the system is suspending the messages boxes that would normally be di...
Definition: fbsystem.h:188
void FBMakeFullPath(FBString &pFullPath, const char *pRootPath, const char *pFilePath)
FBeval.
void FBTrace(const char *pFormatString,...)
This function prints useful debugging strings in the console with kFBNORMAL_TRACE output detailed lev...
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62
String list.
Definition: fbstring.h:201
Event: Video Frame offline Rendering Event.
Definition: fbsystem.h:100
Plug-in item's description.
Definition: fbsystem.h:302
PropertyEvent: Video Frame Rendering Event
Definition: fbproperties.h:573
EState
video rendering state
Definition: fbsystem.h:109
Main Scene change monitoring.
Definition: fbsystem.h:456
Provides access to the underlying system, and the MotionBuilder scene.
Definition: fbsystem.h:157
Trigger engine management.
Definition: fbsystem.h:332
FBPropertyDouble Version
Read Only Property: Application version.
Definition: fbsystem.h:178
TimeSpan class.
Definition: fbtime.h:381
FBFastLock.
Definition: fbsystem.h:570
FBPropertyAction SetTransformReference
Action Property: Set the model's current transformation as the reference.
Definition: fbsystem.h:427
class FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
bool FBUnRegisterTraceStubFct(FBTraceStubFct pFct)
Unregister custom trace stub function.
FBPropertyRenderer Renderer
Read Only Property: Default renderer.
Definition: fbsystem.h:216
Declaration for the classes FBShaderManager, FBShader, FBPropertyListShader and other subclasses...
FBPropertyTime LocalTime
Read Only Property: Local time in take.
Definition: fbsystem.h:193
File Change Monitoring Interface to the file change monitoring.
Definition: fbsystem.h:485
bool FBRegisterTraceStubFct(FBTraceStubFct pFct)
Register custom trace stub function.
unsigned int FBObjectGetGlobalUniqueId()
Get the global static object unique ID counter.
FBPropertyEvent OnFileChangeAnimationClip
Event: Animation clip file change event.
Definition: fbsystem.h:519
FBPropertyConstructionHistory ConstructionHistory
Read Only Property: Construction History.
Definition: fbsystem.h:198
FBPropertyString BuildVersion
Read Only Property: Unique build version string.
Definition: fbsystem.h:180
FBPropertyString PathImages
Read Only Property: Path to images.
Definition: fbsystem.h:202
FBPropertyDouble FrameRate
Read Only Property: The frame rate of the viewer.
Definition: fbsystem.h:218
class FBPropertyBaseComponent< FBAssetMng * > FBPropertyAssetMng
Definition: fbassetmng.h:427
PropertyList: VideoIn
Definition: fbvideo.h:503
FBPropertyString Path
Read Only Property: The path of changed file.
Definition: fbsystem.h:479
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbsystem.h:50