Open Reality Reference Guide
fbassetmng.h
Go to the documentation of this file.
1 #ifndef __FBASSETMNG_H__
2 #define __FBASSETMNG_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 
43 #include <kaydaradef.h>
44 #ifndef FBSDK_DLL
45 
48  #define FBSDK_DLL K_DLLIMPORT
49 #endif
50 
51 #include <fbsdk/fbcomponent.h>
52 
53 #ifdef FBSDKUseNamespace
54  namespace FBSDKNamespace {
55 #endif
56 
57 
62 
63 
65 // FBAssetItem
67 
70 {
72 public:
73 
78  FBAssetItem( const char* pName, HIObject pObject=NULL );
79 
83  virtual FBString GetName() const = 0;
84 
88  virtual FBString GetLocalPath() const = 0;
89 
93  virtual FBString GetServerPath() const = 0;
94 
98  virtual FBAssetFolder* GetParent() const = 0;
99 
105  virtual bool GetLatest( bool pReplaceCheckedOut = false, bool pSilent = false ) = 0;
106 
113  virtual bool CheckIn( const FBString& pComment = "", bool pKeepCheckedOut = false, bool pSilent = false ) = 0;
114 
122  virtual bool CheckOut( const FBString& pComment = "", bool pDontGetLocal = false, bool pSilent = false ) = 0;
123 
129  virtual bool UndoCheckOut( bool pReplaceLocalFile = true, bool pSilent = false ) = 0;
130 
133  virtual void ShowHistory() const = 0;
134 
137  virtual void ShowProperties() const = 0;
138 
140 };
141 
142 
144 // FBAssetFile
146 
153 #define FBRegisterAssetFile( UniqueNameStr, ClassName, Label, Desc, IconFilename ) \
154  HIObject RegisterAssetFile##ClassName( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
155  { \
156  ClassName *Class = new ClassName( Label ); \
157  Class->mAllocated = true; \
158  Class->Name = UniqueNameStr; \
159  if (Class->FBCreate()) { \
160  return Class->GetHIObject(); \
161  } else { \
162  delete Class; \
163  return NULL; \
164  } \
165  } \
166  FBLibraryModule( ClassName ) \
167  { \
168  FBRegisterObject( ClassName,"Asset/AssetItem/AssetFile",Label,Desc,RegisterAssetFile##ClassName, true, IconFilename ); \
169  }
170 
175 #define FBAssetFileDeclare( ClassName, Parent ) \
176  FBClassDeclare( ClassName,Parent); \
177  public: \
178  ClassName(const char* pName):Parent(pName) { FBClassInit; } \
179  private:
180 
184 #define FBAssetFileImplementation( ThisComponent ) \
185  FBClassImplementation( ThisComponent )
186 
188 // FBAssetFile
190 
193 {
195 public:
200  FBAssetFile( const char* pName, HIObject pObject=NULL );
201 
202  IObject_Declare(override); // Interface to IObject.
203 
207  virtual bool FBCreate() override;
208 
212  virtual bool IsCheckedOut() const = 0;
213 
217  virtual bool IsCheckedOutByMe() const = 0;
218 
222  virtual FBString GetCheckedOutBy() const = 0;
223 };
224 
225 
227 // FBAssetFolder
229 
236 #define FBRegisterAssetFolder( UniqueNameStr, ClassName, Label, Desc, IconFilename ) \
237  HIObject RegisterAssetFolder##ClassName( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
238  { \
239  ClassName *Class = new ClassName( Label ); \
240  Class->mAllocated = true; \
241  Class->Name = UniqueNameStr; \
242  if (Class->FBCreate()) { \
243  return Class->GetHIObject(); \
244  } else { \
245  delete Class; \
246  return NULL; \
247  } \
248  } \
249  FBLibraryModule( ClassName ) \
250  { \
251  FBRegisterObject( ClassName,"Asset/AssetItem/AssetFolder",Label,Desc,RegisterAssetFolder##ClassName, true, IconFilename ); \
252  }
253 
258 #define FBAssetFolderDeclare( ClassName, Parent ) \
259  FBClassDeclare( ClassName,Parent); \
260  public: \
261  ClassName(const char* pName):Parent(pName) { FBClassInit; } \
262  private:
263 
267 #define FBAssetFolderImplementation( ThisComponent ) \
268  FBClassImplementation( ThisComponent )
269 
271 // FBAssetFolder
273 
276 {
278 public:
283  FBAssetFolder( const char* pName, HIObject pObject=NULL );
284 
285  IObject_Declare(override); // Interface to IObject.
286 
290  virtual bool FBCreate() override;
291 
295  virtual int GetChildCount() const = 0;
296 
300  virtual FBAssetItem* GetChild( int pIndex ) = 0;
301 
305  virtual FBAssetFile* GetFile( const FBString& pName ) = 0;
306 
310  virtual FBAssetFolder* GetFolder( const FBString& pName ) = 0;
311 
319  virtual FBAssetFile* AddFile( const FBString& pLocalPath, const FBString& pComment = "", bool pCheckOut = false, bool pSilent = false ) = 0;
320 
327  virtual FBAssetFolder* AddFolder( const FBString& pName, const FBString& pComment = "", bool pSilent = false ) = 0;
328 };
329 
330 
332 // FBAssetMng
334 
341 #define FBRegisterAssetMng( UniqueNameStr, ClassName, Label, Desc, IconFilename ) \
342  HIObject RegisterAssetMng##ClassName( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
343  { \
344  ClassName *Class = new ClassName( Label ); \
345  Class->mAllocated = true; \
346  Class->Name = UniqueNameStr; \
347  Class->Description = Desc; \
348  if (Class->FBCreate()) { \
349  return Class->GetHIObject(); \
350  } else { \
351  delete Class; \
352  return NULL; \
353  } \
354  } \
355  FBLibraryModule( ClassName ) \
356  { \
357  FBRegisterObject( ClassName,"Asset/AssetMng",Label,Desc,RegisterAssetMng##ClassName, false, IconFilename ); \
358  }
359 
364 #define FBAssetMngDeclare( ClassName, Parent ) \
365  FBClassDeclare( ClassName,Parent); \
366  public: \
367  ClassName(const char* pName):Parent(pName) { FBClassInit; } \
368  private:
369 
373 #define FBAssetMngImplementation( ThisComponent ) \
374  FBClassImplementation( ThisComponent )
375 
377 // FBAssetMng
379 
387  kMenuGetLatest = 1<<3,
388  kMenuCheckIn = 1<<4,
389  kMenuCheckOut = 1<<5,
396  kMenuEnable = 1<<12,
397 
400 
405 
409 
411  kMenuAll = 0xFFFFFFFF
412 };
413 
414 
426  kFileOptionsAll = 0xFFFFFFFF
427 };
428 
429 
430 FB_DEFINE_COMPONENT( FBSDK_DLL, AssetMng );
431 
436 public:
441  FBAssetMng( const char* pName, HIObject pObject=NULL );
442 
443  IObject_Declare(override); // Interface to IObject.
444 
448  virtual bool Initialize() = 0;
449 
453  virtual FBAssetFile* BrowseForFile() = 0;
454 
459 
464  virtual FBAssetFolder* CreateServerPath( const FBString& pServerPath ) = 0;
465 
470  virtual bool FileIsManaged( const FBString& pFilename ) = 0;
471 
476  virtual bool WithinManagedPath( const FBString& pLocalPath ) = 0;
477 
482  virtual FBString MapLocalPathToServerPath( const FBString& pLocalPath ) = 0;
483 
488  virtual FBAssetFile* GetAssetFile( const FBString& pServerFilename ) = 0;
489 
494  virtual FBAssetFile* GetAssetFileFromLocalPath( const FBString& pLocalFilename ) = 0;
495 
500  virtual FBAssetFolder* GetAssetFolder( const FBString& pServerPath ) = 0;
501 
506  virtual FBAssetFolder* GetAssetFolderFromLocalPath( const FBString& pLocalPath ) = 0;
507 
510  virtual void ShowSettings() = 0;
511 
515  virtual int GetFileOptions() = 0;
516 
519  virtual bool CheckAvailability() const = 0;
520 
525 };
526 
527 #ifdef FBSDKUseNamespace
528  }
529 #endif
530 #endif /* __FBASSETMNG_H__ */
kFileUploadOnSave_Ask
@ kFileUploadOnSave_Ask
Ask for upload on save.
Definition: fbassetmng.h:421
FBAssetItem::LastError
FBString LastError
Last error string.
Definition: fbassetmng.h:139
kMenuShowSettings
@ kMenuShowSettings
Version Control -> Show Settings.
Definition: fbassetmng.h:395
FBAssetFile
Class representing a file stored in a version control database.
Definition: fbassetmng.h:193
FBAssetMng::Description
FBPropertyString Description
Read Write Property: Description of the manager.
Definition: fbassetmng.h:522
kMenuCheckIn
@ kMenuCheckIn
Version Control -> Check In.
Definition: fbassetmng.h:388
FBAssetMngFileOptions
FBAssetMngFileOptions
Behavior of the application when working with managed files.
Definition: fbassetmng.h:417
FBAssetMng::WithinManagedPath
virtual bool WithinManagedPath(const FBString &pLocalPath)=0
Is the specified local path below a managed path.
FBPropertyInt
class K_DLLIMPORT FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
Definition: fbproperties.h:1331
kMenuUndoCheckOut
@ kMenuUndoCheckOut
Version Control -> Undo Check Out.
Definition: fbassetmng.h:390
FBAssetMng::MapLocalPathToServerPath
virtual FBString MapLocalPathToServerPath(const FBString &pLocalPath)=0
Convert the local path to a server path by using managed paths mapping.
FBAssetMng::BrowseForFile
virtual FBAssetFile * BrowseForFile()=0
Let the user browse the asset database to select a file.
FBAssetItem::CheckIn
virtual bool CheckIn(const FBString &pComment="", bool pKeepCheckedOut=false, bool pSilent=false)=0
Checks in this item and all its children (if this is a folder item).
FBAssetMng::GetFileOptions
virtual int GetFileOptions()=0
Get the file options (i.e.
FBAssetMng::ShowSettings
virtual void ShowSettings()=0
Display a dialog that let the user changes settings.
kMenuShowReferenceMng
@ kMenuShowReferenceMng
Version Control -> Show Reference Manager.
Definition: fbassetmng.h:394
FBAssetMng::CreateServerPath
virtual FBAssetFolder * CreateServerPath(const FBString &pServerPath)=0
Create a folder path on the server side by adding each missing folders.
FBAssetItem
Base class for all managed assets.
Definition: fbassetmng.h:70
FBSDK_DLL
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbassetmng.h:48
FBAssetFolder::GetChildCount
virtual int GetChildCount() const =0
Get the number of items in this folder.
FBAssetMng::FBAssetMng
FBAssetMng(const char *pName, HIObject pObject=NULL)
Constructor.
FBAssetFolder::GetFile
virtual FBAssetFile * GetFile(const FBString &pName)=0
Get a file present in this folder by using it's name.
kMenuShowHistory
@ kMenuShowHistory
Version Control -> Show History.
Definition: fbassetmng.h:391
kMenuSourceControlAll
@ kMenuSourceControlAll
Support all elements from the Version Control menu.
Definition: fbassetmng.h:402
FBAssetFile::FBCreate
virtual bool FBCreate() override
Open Reality Creation function.
kMenuFileAll
@ kMenuFileAll
Support all elements from the File menu.
Definition: fbassetmng.h:399
kMenuUploadToDatabase
@ kMenuUploadToDatabase
File -> Upload to database.
Definition: fbassetmng.h:386
FBAssetFolder::GetFolder
virtual FBAssetFolder * GetFolder(const FBString &pName)=0
Get a folder present in this folder by using it's name.
FBAssetMng::Name
FBPropertyString Name
Read Write Property: Unique Name.
Definition: fbassetmng.h:521
FBAssetMng::BrowseForFolder
virtual FBAssetFolder * BrowseForFolder()=0
Let the user browse the asset database to select a folder.
FBAssetMng::GetAssetFile
virtual FBAssetFile * GetAssetFile(const FBString &pServerFilename)=0
Get a file object using it's server path.
FBAssetMng::GetAssetFolder
virtual FBAssetFolder * GetAssetFolder(const FBString &pServerPath)=0
Get a folder object using it's server path.
FBAssetItem::CheckOut
virtual bool CheckOut(const FBString &pComment="", bool pDontGetLocal=false, bool pSilent=false)=0
Checks out this item and it's childs (if this is a folder item) and makes them writeable on the local...
kFileCheckInOnClose
@ kFileCheckInOnClose
Check in file automatically when closing it.
Definition: fbassetmng.h:424
kFileCheckOutOnLoad_Ask
@ kFileCheckOutOnLoad_Ask
Ask for checkout on load.
Definition: fbassetmng.h:419
FBAssetMngMenuOptions
FBAssetMngMenuOptions
Show or hide version control menu items.
Definition: fbassetmng.h:383
FBString
Basic string class.
Definition: fbstring.h:67
__FBClassDeclare
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:131
__FB_FORWARD
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
FBAssetMng
Used to access asset manager functionity to get files locally or from a server.
Definition: fbassetmng.h:434
FBAssetMng::GetAssetFolderFromLocalPath
virtual FBAssetFolder * GetAssetFolderFromLocalPath(const FBString &pLocalPath)=0
Get a folder object using it's local path.
FBAssetMng::Initialize
virtual bool Initialize()=0
Initialize the connection to the server.
FBAssetMng::FileIsManaged
virtual bool FileIsManaged(const FBString &pFilename)=0
Is the specified local file managed (ie.
FBAssetItem::ShowHistory
virtual void ShowHistory() const =0
Display a dialog with this item history.
FBAssetMng::LastError
FBString LastError
Last error string.
Definition: fbassetmng.h:524
FBAssetMng::GetAssetFileFromLocalPath
virtual FBAssetFile * GetAssetFileFromLocalPath(const FBString &pLocalFilename)=0
Get a file object using it's local path.
kFileAddOnNewSave_Ask
@ kFileAddOnNewSave_Ask
Ask for adding new file on save.
Definition: fbassetmng.h:423
FBAssetFolder::AddFolder
virtual FBAssetFolder * AddFolder(const FBString &pName, const FBString &pComment="", bool pSilent=false)=0
Add a folder in the database.
kMenuAddToDatabase
@ kMenuAddToDatabase
File -> Add to database.
Definition: fbassetmng.h:385
kFileUploadOnSave
@ kFileUploadOnSave
Upload file automatically on save.
Definition: fbassetmng.h:420
kFileCheckInOnClose_Ask
@ kFileCheckInOnClose_Ask
Ask for check in file when closing it.
Definition: fbassetmng.h:425
FBAssetFile::FBAssetFile
FBAssetFile(const char *pName, HIObject pObject=NULL)
Constructor.
fbcomponent.h
Basic class definitions.
FBAssetItem::ShowProperties
virtual void ShowProperties() const =0
Display a dialog showing the properties of this item.
kMenuOpenFromDatabase
@ kMenuOpenFromDatabase
File -> Open from database.
Definition: fbassetmng.h:384
FBAssetFile::IsCheckedOut
virtual bool IsCheckedOut() const =0
Returns a boolean value indicating if this file is checked out by any user.
FBAssetFolder
Class representing a folder stored in a version control database.
Definition: fbassetmng.h:276
FBAssetFile::IsCheckedOutByMe
virtual bool IsCheckedOutByMe() const =0
Returns a boolean value indicating if this file is checked out by the current user.
FBAssetFolder::FBAssetFolder
FBAssetFolder(const char *pName, HIObject pObject=NULL)
Constructor.
FBAssetFolder::AddFile
virtual FBAssetFile * AddFile(const FBString &pLocalPath, const FBString &pComment="", bool pCheckOut=false, bool pSilent=false)=0
Add a specified file into the database.
FBAssetItem::GetParent
virtual FBAssetFolder * GetParent() const =0
Get the parent folder of this item.
kFileAddOnNewSave
@ kFileAddOnNewSave
Add new file automatically on save.
Definition: fbassetmng.h:422
FBAssetFile::GetCheckedOutBy
virtual FBString GetCheckedOutBy() const =0
Returns the name of the user who currently has this file checked out.
FBAssetItem::GetServerPath
virtual FBString GetServerPath() const =0
Get the path to this item on the database.
kMenuShowExplorer
@ kMenuShowExplorer
Version Control -> Show Explorer.
Definition: fbassetmng.h:393
FBAssetItem::FBAssetItem
FBAssetItem(const char *pName, HIObject pObject=NULL)
Constructor.
FBAssetMng::MenuFlags
FBPropertyInt MenuFlags
Read Write Property: Flags specifing which menu items are added by the manager.
Definition: fbassetmng.h:523
kFileCheckOutOnLoad
@ kFileCheckOutOnLoad
Check out file automatically on load.
Definition: fbassetmng.h:418
FB_DEFINE_COMPONENT
FB_DEFINE_COMPONENT(K_DLLIMPORT, AnimationNode)
Animation node class.
FBAssetItem::GetLatest
virtual bool GetLatest(bool pReplaceCheckedOut=false, bool pSilent=false)=0
Obtain the latest version of the item from the server.
kMenuSourceControlMin
@ kMenuSourceControlMin
Support only the basics functionalities.
Definition: fbassetmng.h:407
FBAssetItem::GetLocalPath
virtual FBString GetLocalPath() const =0
Get the path to this item on the local hard disk.
FBAssetItem::UndoCheckOut
virtual bool UndoCheckOut(bool pReplaceLocalFile=true, bool pSilent=false)=0
Cancel the last check out operation.
kMenuGetLatest
@ kMenuGetLatest
Version Control -> Get Latest.
Definition: fbassetmng.h:387
FBPropertyString
Property class: const char * (String).
Definition: fbproperties.h:1281
FBComponent
MotionBuilder SDK base class.
Definition: fbcomponent.h:651
kMenuAll
@ kMenuAll
Support everything.
Definition: fbassetmng.h:411
FBAssetMng::CheckAvailability
virtual bool CheckAvailability() const =0
Check if this manager can be used on the computer.
kMenuShowProperties
@ kMenuShowProperties
Version Control -> Show Properties.
Definition: fbassetmng.h:392
FBAssetItem::GetName
virtual FBString GetName() const =0
Get the name of this item (file name or folder name).
kMenuCheckOut
@ kMenuCheckOut
Version Control -> Check Out.
Definition: fbassetmng.h:389
FBAssetFolder::GetChild
virtual FBAssetItem * GetChild(int pIndex)=0
Get the child at index pIndex.
FBAssetFolder::FBCreate
virtual bool FBCreate() override
Open Reality Creation function.
kMenuEnable
@ kMenuEnable
Version Control -> Disable Version Control Integration.
Definition: fbassetmng.h:396