fbsdk/fbplug.h Source File

fbplug.h
Go to the documentation of this file.
1 #ifndef __FBPLUG_H__
2 #define __FBPLUG_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 
47 #ifndef FBSDK_DLL
48 
51 #define FBSDK_DLL K_DLLIMPORT
52 #endif
53 
54 // Global includes
55 #include <object/i/icallback.h>
56 #include <fbsdk/fbdefines.h>
57 #include <fbsdk/fbscriptwrapper.h>
58 #include <fbsdk/fbarray.h>
59 
60 #ifdef FBSDKUseNamespace
61 namespace FBSDKNamespace {;
62 #endif
63 
67 #define __FBClassImplementation( ThisComponent,pInternalClassId ) \
68  int ThisComponent::TypeInfo=__FBRegisterTypeInfo(pInternalClassId);\
69  int ThisComponent::GetInternalClassId() { return pInternalClassId; }
70 
71 #define __FBClassImplementationGroup( ThisComponent, pInternalClass ) \
72  __FBClassImplementation( ThisComponent,pInternalClass::ClassId )\
73  const char* ThisComponent::ClassGroupName = pInternalClass::ClassGroupName;
74 
75 FB_FORWARD( FBPlug );
76 
79 {
80  // Connection notify actions
87 
94 
101 
106 
107  // Data notify actions
111 
112  // State notify actions
115 
119 
123 
127 
129 
130  // Keying Notify actions
136 
137  // for backward compatibility
142 };
143 
145 
148 {
151 };
152 
154 {
159 
163 
167 
175 
179 
183 };
184 
186 {
188  kFBOwnedByUndo = 1<<21,
190 };
191 
194 
201 FBSDK_DLL FBPlugList* FBCreatePlugList();
202 
206 FBSDK_DLL void FBDestroyPlugList( FBPlugList* pPlugList );
207 
209 
220 class FBSDK_DLL FBPlug : public ICallback
221  , public FBWrapperHolder
222 {
223 protected:
224 #ifndef DOXYGEN_SHOULD_SKIP_THIS
225 
229  FBPlug( HIObject pObject );
230 public:
232  virtual ~FBPlug();
233 
235  virtual HIObject GetHIObject() const;
236 
238  virtual bool SetHIObject( HIObject pObject, bool pSDKComponent );
239 #endif
240 
242  bool IsSDKComponent();
243 
249  bool ConnectSrc( FBPlug* pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone );
250 
256  bool ConnectDst( FBPlug* pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone );
257 
265  bool ConnectSrcAt( int pDst_SrcIndex, FBPlug* pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone );
266 
274  bool ConnectDstAt( int pSrc_DstIndex, FBPlug* pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone );
275 
280  bool DisconnectDst( FBPlug* pDst );
281 
286  bool DisconnectSrc( FBPlug* pSrc );
287 
289  void DisconnectAllSrc();
290 
292  void DisconnectAllDst();
293 
298  bool DisconnectDstAt( int pIndex );
299 
304  bool DisconnectSrcAt( int pIndex );
305 
311  bool ReplaceDstAt( int pIndex, FBPlug* pDst );
312 
318  bool ReplaceSrcAt( int pIndex, FBPlug* pSrc );
319 
325  bool SwapSrc( int pIndexA, int pIndexB );
326 
333  bool MoveSrcAt( int pIndex, int pAtIndex );
334 
341  bool MoveSrcAt( FBPlug* pSrc, FBPlug* pAtSrc );
342 
346  int GetSrcCount();
347 
352  FBPlug* GetSrc( int pIndex );
353 
358  FBConnectionType GetSrcType( int pIndex );
359 
363  int GetDstCount();
364 
369  FBPlug* GetDst( int pIndex );
370 
375  FBConnectionType GetDstType( int pIndex );
376 
380  bool BeginChange();
381 
383  void EndChange();
384 
389  void SetSelfModified(FBPlugModificationFlag pFlag, bool pBool);
390 
395  bool GetSelfModified(FBPlugModificationFlag pFlag);
396 
401  void SetContentModified(FBPlugModificationFlag pFlag, bool pBool);
402 
407  bool GetContentModified(FBPlugModificationFlag pFlag);
408 
415  int GetPlugConnectionModifiedList(FBPlugList& pPlugList, FBPlugModificationFlag pConnectionModificatonFlag, bool pAddRemove);
416 
421  bool RevertModification(FBPlugModificationFlag pFlag = kFBAllModifiedMask);
422 
427  void SetStatusFlag(FBPlugStatusFlag pStatus, bool pValue);
428 
433  bool GetStatusFlag(FBPlugStatusFlag pStatus) const;
434 
438  FBPlug* GetOwner();
439 
444  FBPlug* GetOwned( int pIndex );
445 
449  int GetOwnedCount();
450 
452  virtual const char* ClassName();
454 
457  virtual bool Is( int pTypeId );
458 
460 
463  virtual int GetTypeId();
464 
466  static const char* ClassGroupName;
467 
469  static int TypeInfo;
470 
473 
482  virtual bool PlugDataNotify(FBConnectionAction pAction,FBPlug* pThis,void* pData=NULL,void* pDataOld=NULL,int pDataSize=0);
483 
492  virtual bool PlugStateNotify(FBConnectionAction pAction,FBPlug* pThis,void* pData=NULL,void* pDataOld=NULL,int pDataSize=0);
493 
503  virtual bool PlugNotify(FBConnectionAction pAction,FBPlug* pThis,int pIndex,FBPlug* pPlug = NULL,FBConnectionType pConnectionType=kFBConnectionTypeNone,FBPlug* pNewPlug=NULL );
504 
505 #ifndef DOXYGEN_SHOULD_SKIP_THIS
508 
512  static void PrintClassDefinitions();
513 
514 #endif
515 
516 protected:
520  virtual void FBDelete();
521 
522  static int mGlobalTypeInfo;
523  static int GetInternalClassId();
526  FBSDK_DLL friend int __FBRegisterTypeInfo(int pInternalClassId);
527 };
528 
529 
531 // Connection related utility functions.
533 
540 FBSDK_DLL bool FBConnect( FBPlug* pSrc, FBPlug* pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone );
541 
548 FBSDK_DLL bool FBDisconnect( FBPlug* pSrc, FBPlug* pDst );
549 
555 FBSDK_DLL FBPlug* FBGetFBPlug( HIObject pObject, bool pAutoCreate=true );
556 
562 FBSDK_DLL HIObject FBGetFBObject( HIObject pObject, bool pAutoCreate=false );
563 
569 template<class T> inline T* FBCast(HIObject pObject, bool pAutoCreate = false)
570 {
571  HIObject lObject = FBGetFBObject(pObject, pAutoCreate);
572  // Should also validate type but not available for now
573  return (T*)lObject;
574 }
575 
584 {
585 public:
586  // CONSTRUCTOR/DESTRUCTOR
587  HdlFBPlug();
588  HdlFBPlug(const FBPlug * pFBPlug);
589  HdlFBPlug(HdlFBPlug const &pFBPlug);
590  ~HdlFBPlug();
591 
592  // VALIDATION
593  bool Ok() const;
594 
596 
599  bool Is( int pTypeId );
600 
601  //bool WasOk() const;
602  //int RefCount() const;
603 
604  // CASTING & ASSIGNATION
605  HdlFBPlug& operator= (const FBPlug* pFBPlug);
606  HdlFBPlug& operator= (const HdlFBPlug& pFBPlug);
607 
608  // Comparison
609  bool operator==(const HdlFBPlug& pFBPlug) const;
610  bool operator!=(const HdlFBPlug& pFBPlug) const;
611 
612  FBPlug* GetPlug() const;
613  inline FBPlug* operator()() const { return GetPlug(); }
614  inline FBPlug* operator->() const { return GetPlug(); }
615 
616  inline operator FBPlug* () const
617  {
618  return (FBPlug *)GetPlug();
619  }
620 
621 
622 protected:
623  void SetPlug(const FBPlug* pFBPlug);
624 
625 private:
626  void * mData;
627 };
628 
629 template <class T> class HdlFBPlugTemplate : public HdlFBPlug
630 {
631 public:
633  {
634  }
635 
637  : HdlFBPlug(pPlug)
638  {
639  }
640 
641  HdlFBPlugTemplate(const FBPlug *pPlug)
642  : HdlFBPlug((FBPlug *)pPlug)
643  {
644  }
645 
647  {
648  SetPlug(pPlug.GetPlug());
649  return *this;
650  }
651 
652  bool operator==(const HdlFBPlugTemplate<T>& pFBPlug) const
653  {
654  return GetPlug() == pFBPlug.GetPlug();
655  }
656 
657  bool operator!=(const HdlFBPlugTemplate<T>& pFBPlug) const
658  {
659  return GetPlug() != pFBPlug.GetPlug();
660  }
661 
662  T* operator()() const
663  {
664  return (T *)GetPlug();
665  }
666 
667  T* operator->() const
668  {
669  return (T *)GetPlug();
670  }
671 
672  operator T*() const
673  {
674  return (T *)GetPlug();
675  }
676 };
677 
678 #ifdef FBSDKUseNamespace
679 }
680 #endif
681 
682 #endif
Connected source to destination.
Definition: fbplug.h:85
Disconnected source from destination.
Definition: fbplug.h:92
A template class for arrays.
FBPlugModificationFlag
Definition: fbplug.h:153
Handler of FBPlug object Use this handler object to gracefully take care of dangling pointer problem...
Definition: fbplug.h:583
Component is going to be renamed.
Definition: fbplug.h:121
Begin change on destination.
Definition: fbplug.h:102
T * operator->() const
Definition: fbplug.h:667
Data candidate event, global candidate.
Definition: fbplug.h:110
Data candidate event, after the data is set.
Definition: fbplug.h:109
Plug has no status set.
Definition: fbplug.h:187
Component curve has changed.
Definition: fbplug.h:134
Connected owner to destination.
Definition: fbplug.h:104
End change on destination.
Definition: fbplug.h:103
Connect destination to source.
Definition: fbplug.h:84
Object/Property itself has been dirty, in case of property get dirty, its owner object will be set di...
Definition: fbplug.h:160
Object custom property change.
Definition: fbplug.h:176
Connect source to destination.
Definition: fbplug.h:83
Component description event.
Definition: fbplug.h:128
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbplug.h:51
#define NULL
Definition: kaydara.h:169
FBPlug * operator()() const
Definition: fbplug.h:613
#define ICallback_Declare(IsPure)
Forwarding.
Definition: icallback.h:42
static const char * ClassGroupName
ClassGroupName of the object.
Definition: fbplug.h:466
Compoent request Prefix Rename.
Definition: fbplug.h:124
bool FBConnect(FBPlug *pSrc, FBPlug *pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone)
Request the connection two FBPlug objects.
const char * FBGetConnectionTypeString(FBConnectionType pType)
Component detached from scene.
Definition: fbplug.h:113
T * FBCast(HIObject pObject, bool pAutoCreate=false)
Cast the SDK object using it's IObject interface into the proper class.
Definition: fbplug.h:569
#define K_IMPLEMENTATION
Definition: iobject.h:53
Connected destination to source.
Definition: fbplug.h:86
FBPlugStatusFlag
Definition: fbplug.h:185
bool mAllocated
Contain the Allocation State of the Component.
Definition: fbplug.h:472
FBPlug * GetPlug() const
The purpose of this file is to hold all of the SDK general-purpose preprocessor definitions.
#define IObject_Declare(IsPure)
Definition: iobject.h:75
Disconnect source from destination.
Definition: fbplug.h:90
Object/Property naming change.
Definition: fbplug.h:164
Connections Basic Open Reality SDK Element.
Definition: fbplug.h:220
Definition: Python-ast.h:24
Source has been reordered.
Definition: fbplug.h:100
The src property of this plug has been modified.
Definition: fbplug.h:169
None Modified.
Definition: fbplug.h:155
Component prefix is going to be renamed.
Definition: fbplug.h:125
Data candidate event, before the data is set.
Definition: fbplug.h:108
The dst property of this plug has been modified.
Definition: fbplug.h:171
Component has been renamed.
Definition: fbplug.h:122
Request connection of destination to source.
Definition: fbplug.h:82
Disconnect owner from destination.
Definition: fbplug.h:105
bool operator!=(const HdlFBPlugTemplate< T > &pFBPlug) const
Definition: fbplug.h:657
Begin replace destination during merge.
Definition: fbplug.h:97
Component selection.
Definition: fbplug.h:116
Component request rename.
Definition: fbplug.h:120
Object/Property itself has been dirty, in case of property get dirty, its owner object will be set di...
Definition: fbplug.h:156
FBPlugList * FBCreatePlugList()
Create a FBPlugList object.
static int mGlobalTypeInfo
Represente the Type Index.
Definition: fbplug.h:522
bool operator==(const HdlFBPlugTemplate< T > &pFBPlug) const
Definition: fbplug.h:652
Component keying delete event.
Definition: fbplug.h:132
HdlFBPlugTemplate< T > & operator=(const HdlFBPlugTemplate< T > &pPlug)
Definition: fbplug.h:646
static int TypeInfo
TypeInfo.
Definition: fbplug.h:469
FBPlug * operator->() const
Definition: fbplug.h:614
bool mSDKComponent
bool Plug is an SDK component.
Definition: fbplug.h:525
T * operator()() const
Definition: fbplug.h:662
End replace source during merge.
Definition: fbplug.h:96
HdlFBPlugTemplate(const FBPlug *pPlug)
Definition: fbplug.h:641
const char * FBGetConnectionActionString(FBConnectionAction pAction)
Disconnect destination from source.
Definition: fbplug.h:91
Template class to contain an array of items.
Definition: fbarray.h:77
Component de-selection.
Definition: fbplug.h:117
Component destroy.
Definition: fbplug.h:114
Component prefix has been renamed.
Definition: fbplug.h:126
The src object of this plug has been modified.
Definition: fbplug.h:168
The dst object of this plug has been modified.
Definition: fbplug.h:170
Request disconnection of destination to source.
Definition: fbplug.h:89
Request disconnection of source to destination.
Definition: fbplug.h:88
Component re-selection.
Definition: fbplug.h:118
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
Component keying add event.
Definition: fbplug.h:131
Component curve changes in Dopesheet completed.
Definition: fbplug.h:135
int __FBRegisterTypeInfo(int pInternalClassId)
__FBRegisterTypeInfo For internal use only, Register the TypeInfo mapped to internal class id...
Owner object/Namespace has data dirty property/objects.
Definition: fbplug.h:161
Component keying candidate event.
Definition: fbplug.h:133
HIObject FBGetFBObject(HIObject pObject, bool pAutoCreate=false)
Get the SDK object from an Internal Object.
Owner object/Namespace has dirty property/objects.
Definition: fbplug.h:177
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62
void FBDestroyPlugList(FBPlugList *pPlugList)
Delete a FBPlugList object.
Plug is owned by undo framework.
Definition: fbplug.h:188
FBArrayTemplate< FBPlug * > FBPlugList
typedef FBArrayTemplate FBPlugList;
Definition: fbplug.h:193
bool operator==(const FBPickInfos &pLhs, const FBPickInfos &pRhs)
FBPlug * FBGetFBPlug(HIObject pObject, bool pAutoCreate=true)
Get the FBPlug from an Internal Object.
Disconnected destination from source.
Definition: fbplug.h:93
FBConnectionType
Connection types available between plugs.
Definition: fbplug.h:147
Owner object/Namespace has data dirty property/objects.
Definition: fbplug.h:157
Default connection type.
Definition: fbplug.h:149
Begin replace source during merge.
Definition: fbplug.h:95
Owner object/Namespace has state dirty property/objects.
Definition: fbplug.h:165
HIObject mObject
Handle on the Plug.
Definition: fbplug.h:524
HdlFBPlugTemplate(HdlFBPlug const &pPlug)
Definition: fbplug.h:636
FBConnectionAction
Possible actions when a notify plug event occurs.
Definition: fbplug.h:78
bool FBDisconnect(FBPlug *pSrc, FBPlug *pDst)
Connect two FBPlug objects.
Owner object/namespace has connection modified property/objects.
Definition: fbplug.h:173
Request connection of source to destination.
Definition: fbplug.h:81
Reorder of source.
Definition: fbplug.h:99
End replace destination during merge.
Definition: fbplug.h:98
System connection type.
Definition: fbplug.h:150