fbsdk/fbassetmng.h Source File

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 
58 __FB_FORWARD( FBAssetItem );
59 __FB_FORWARD( FBAssetFile );
60 __FB_FORWARD( FBAssetFolder );
61 __FB_FORWARD( FBAssetMng );
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->Name = UniqueNameStr; \
158  if (Class->FBCreate()) { \
159  return Class->GetHIObject(); \
160  } else { \
161  delete Class; \
162  return NULL; \
163  } \
164  } \
165  FBLibraryModule( ClassName ) \
166  { \
167  FBRegisterObject( ClassName,"Asset/AssetItem/AssetFile",Label,Desc,RegisterAssetFile##ClassName, true, IconFilename ); \
168  }
169 
174 #define FBAssetFileDeclare( ClassName, Parent ) \
175  FBClassDeclare( ClassName,Parent); \
176  public: \
177  ClassName(const char* pName):Parent(pName) { FBClassInit; } \
178  private:
179 
183 #define FBAssetFileImplementation( ThisComponent ) \
184  FBClassImplementation( ThisComponent )
185 
187 // FBAssetFile
189 
192 {
194 public:
199  FBAssetFile( const char* pName, HIObject pObject=NULL );
200 
201  IObject_Declare(K_IMPLEMENTATION); // Interface to IObject.
202 
206  virtual bool FBCreate();
207 
211  virtual bool IsCheckedOut() const = 0;
212 
216  virtual bool IsCheckedOutByMe() const = 0;
217 
221  virtual FBString GetCheckedOutBy() const = 0;
222 };
223 
224 
226 // FBAssetFolder
228 
235 #define FBRegisterAssetFolder( UniqueNameStr, ClassName, Label, Desc, IconFilename ) \
236  HIObject RegisterAssetFolder##ClassName( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
237  { \
238  ClassName *Class = new ClassName( Label ); \
239  Class->Name = UniqueNameStr; \
240  if (Class->FBCreate()) { \
241  return Class->GetHIObject(); \
242  } else { \
243  delete Class; \
244  return NULL; \
245  } \
246  } \
247  FBLibraryModule( ClassName ) \
248  { \
249  FBRegisterObject( ClassName,"Asset/AssetItem/AssetFolder",Label,Desc,RegisterAssetFolder##ClassName, true, IconFilename ); \
250  }
251 
256 #define FBAssetFolderDeclare( ClassName, Parent ) \
257  FBClassDeclare( ClassName,Parent); \
258  public: \
259  ClassName(const char* pName):Parent(pName) { FBClassInit; } \
260  private:
261 
265 #define FBAssetFolderImplementation( ThisComponent ) \
266  FBClassImplementation( ThisComponent )
267 
269 // FBAssetFolder
271 
274 {
276 public:
281  FBAssetFolder( const char* pName, HIObject pObject=NULL );
282 
283  IObject_Declare(K_IMPLEMENTATION); // Interface to IObject.
284 
288  virtual bool FBCreate();
289 
293  virtual int GetChildCount() const = 0;
294 
298  virtual FBAssetItem* GetChild( int pIndex ) = 0;
299 
303  virtual FBAssetFile* GetFile( const FBString& pName ) = 0;
304 
308  virtual FBAssetFolder* GetFolder( const FBString& pName ) = 0;
309 
317  virtual FBAssetFile* AddFile( const FBString& pLocalPath, const FBString& pComment = "", bool pCheckOut = false, bool pSilent = false ) = 0;
318 
325  virtual FBAssetFolder* AddFolder( const FBString& pName, const FBString& pComment = "", bool pSilent = false ) = 0;
326 };
327 
328 
330 // FBAssetMng
332 
339 #define FBRegisterAssetMng( UniqueNameStr, ClassName, Label, Desc, IconFilename ) \
340  HIObject RegisterAssetMng##ClassName( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
341  { \
342  ClassName *Class = new ClassName( Label ); \
343  Class->Name = UniqueNameStr; \
344  Class->Description = Desc; \
345  if (Class->FBCreate()) { \
346  return Class->GetHIObject(); \
347  } else { \
348  delete Class; \
349  return NULL; \
350  } \
351  } \
352  FBLibraryModule( ClassName ) \
353  { \
354  FBRegisterObject( ClassName,"Asset/AssetMng",Label,Desc,RegisterAssetMng##ClassName, false, IconFilename ); \
355  }
356 
361 #define FBAssetMngDeclare( ClassName, Parent ) \
362  FBClassDeclare( ClassName,Parent); \
363  public: \
364  ClassName(const char* pName):Parent(pName) { FBClassInit; } \
365  private:
366 
370 #define FBAssetMngImplementation( ThisComponent ) \
371  FBClassImplementation( ThisComponent )
372 
374 // FBAssetMng
376 
384  kMenuGetLatest = 1<<3,
385  kMenuCheckIn = 1<<4,
386  kMenuCheckOut = 1<<5,
393  kMenuEnable = 1<<12,
394 
397 
402 
406 
408  kMenuAll = 0xFFFFFFFF
409 };
410 
411 
423  kFileOptionsAll = 0xFFFFFFFF
424 };
425 
426 
428 
433 public:
438  FBAssetMng( const char* pName, HIObject pObject=NULL );
439 
440  IObject_Declare(K_IMPLEMENTATION); // Interface to IObject.
441 
445  virtual bool Initialize() = 0;
446 
450  virtual FBAssetFile* BrowseForFile() = 0;
451 
455  virtual FBAssetFolder* BrowseForFolder() = 0;
456 
461  virtual FBAssetFolder* CreateServerPath( const FBString& pServerPath ) = 0;
462 
467  virtual bool FileIsManaged( const FBString& pFilename ) = 0;
468 
473  virtual bool WithinManagedPath( const FBString& pLocalPath ) = 0;
474 
479  virtual FBString MapLocalPathToServerPath( const FBString& pLocalPath ) = 0;
480 
485  virtual FBAssetFile* GetAssetFile( const FBString& pServerFilename ) = 0;
486 
491  virtual FBAssetFile* GetAssetFileFromLocalPath( const FBString& pLocalFilename ) = 0;
492 
497  virtual FBAssetFolder* GetAssetFolder( const FBString& pServerPath ) = 0;
498 
503  virtual FBAssetFolder* GetAssetFolderFromLocalPath( const FBString& pLocalPath ) = 0;
504 
507  virtual void ShowSettings() = 0;
508 
512  virtual int GetFileOptions() = 0;
513 
516  virtual bool CheckAvailability() const = 0;
517 
522 };
523 
524 #ifdef FBSDKUseNamespace
525  }
526 #endif
527 #endif /* __FBASSETMNG_H__ */
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:132
File -> Upload to database.
Definition: fbassetmng.h:383
#define FB_DEFINE_COMPONENT(DllTag, Type)
Define a component and give it the ability to be a property.
Definition: fbproperties.h:139
File -> Add to database.
Definition: fbassetmng.h:382
Add new file automatically on save.
Definition: fbassetmng.h:419
Ask for adding new file on save.
Definition: fbassetmng.h:420
Ask for checkout on load.
Definition: fbassetmng.h:416
FBPropertyString Name
Read Write Property: Unique Name.
Definition: fbassetmng.h:518
Version Control -> Undo Check Out.
Definition: fbassetmng.h:387
Version Control -> Show Explorer.
Definition: fbassetmng.h:390
Basic string class.
Definition: fbstring.h:66
#define NULL
Definition: kaydara.h:169
Version Control -> Check Out.
Definition: fbassetmng.h:386
#define K_IMPLEMENTATION
Definition: iobject.h:53
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbassetmng.h:48
Version Control -> Show History.
Definition: fbassetmng.h:388
Check out file automatically on load.
Definition: fbassetmng.h:415
#define IObject_Declare(IsPure)
Definition: iobject.h:75
Property class: const char * (String).
MotionBuilder SDK base class.
Definition: fbcomponent.h:668
Ask for upload on save.
Definition: fbassetmng.h:418
Class representing a folder stored in a version control database.
Definition: fbassetmng.h:273
Support all elements from the File menu.
Definition: fbassetmng.h:396
File -> Open from database.
Definition: fbassetmng.h:381
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
Version Control -> Disable Version Control Integration.
Definition: fbassetmng.h:393
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
Version Control -> Check In.
Definition: fbassetmng.h:385
Basic class definitions.
Base class for all managed assets.
Definition: fbassetmng.h:69
FBPropertyString Description
Read Write Property: Description of the manager.
Definition: fbassetmng.h:519
FBString LastError
Last error string.
Definition: fbassetmng.h:521
Support only the basics functionalities.
Definition: fbassetmng.h:404
FBAssetMngMenuOptions
Show or hide version control menu items.
Definition: fbassetmng.h:380
Used to access asset manager functionity to get files locally or from a server.
Definition: fbassetmng.h:431
FBAssetMngFileOptions
Behavior of the application when working with managed files.
Definition: fbassetmng.h:414
Support everything.
Definition: fbassetmng.h:408
Version Control -> Show Properties.
Definition: fbassetmng.h:389
Ask for check in file when closing it.
Definition: fbassetmng.h:422
Version Control -> Get Latest.
Definition: fbassetmng.h:384
FBString LastError
Last error string.
Definition: fbassetmng.h:139
class FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
Version Control -> Show Reference Manager.
Definition: fbassetmng.h:391
Support all elements from the Version Control menu.
Definition: fbassetmng.h:399
Upload file automatically on save.
Definition: fbassetmng.h:417
Check in file automatically when closing it.
Definition: fbassetmng.h:421
FBPropertyInt MenuFlags
Read Write Property: Flags specifing which menu items are added by the manager.
Definition: fbassetmng.h:520
Version Control -> Show Settings.
Definition: fbassetmng.h:392
Class representing a file stored in a version control database.
Definition: fbassetmng.h:191