Open Reality Reference Guide
 
Loading...
Searching...
No Matches
fbplug.h
Go to the documentation of this file.
1#ifndef __FBPLUG_H__
2#define __FBPLUG_H__
3/**************************************************************************
4Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5All Rights Reserved.
6
7The coded instructions, statements, computer programs, and/or related
8material (collectively the "Data") in these files contain unpublished
9information proprietary to Autodesk, Inc. and/or its licensors, which is
10protected by Canada and United States of America federal copyright law
11and by international treaties.
12
13The Data may not be disclosed or distributed to third parties, in whole
14or in part, without the prior written consent of Autodesk, Inc.
15("Autodesk").
16
17THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24FREE.
25
26IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36
37**************************************************************************/
38
45#include <kaydaradef.h>
46
47#ifndef FBSDK_DLL
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
61namespace 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
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
138 kFBConnect = kFBConnectSrc,
139 kFBConnected = kFBConnectedSrc,
140 kFBDisconnect = kFBDisconnectSrc,
141 kFBDisconnected = kFBDisconnectedSrc
142};
143
144FBSDK_DLL const char* FBGetConnectionActionString( FBConnectionAction pAction );
145
148{
152
154{
158 kFBAllDataModified = kFBSelfDataModified | kFBContentDataModified,
159
162 kFBAllKeyingModified = kFBSelfKeyingModified | kFBContentKeyingModified,
163
166 kFBAllStateModified = kFBSelfStateModified | kFBContentStateModified,
167
174 kFBAllConnectionModified = kFBSelfConnectionModifiedMask | kFBContentConnectionModified,
175
179
180 kFBSelfAllModifiedMask = kFBSelfDataModified | kFBSelfKeyingModified | kFBSelfStateModified | kFBSelfCustomPropertyModified | kFBSelfConnectionModifiedMask,
182 kFBAllModifiedMask = kFBSelfAllModifiedMask | kFBContentAllModifiedMask
183};
184
186{
189 kFBPlugStatusFlagMask = kFBOwnedByUndo
190};
191
194
202
207
208FBSDK_DLL const char* FBGetConnectionTypeString( FBConnectionType pType );
209
220class FBSDK_DLL FBPlug : public ICallback
221 , public FBWrapperHolder
222{
223protected:
224#ifndef DOXYGEN_SHOULD_SKIP_THIS
229 FBPlug( HIObject pObject );
230public:
232 virtual ~FBPlug();
233
235 virtual HIObject GetHIObject() const;
236
238 virtual bool SetHIObject( HIObject pObject, bool pSDKComponent );
239#endif
240
243
250
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
290
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
347
352 FBPlug* GetSrc( int pIndex );
353
359
364
369 FBPlug* GetDst( int pIndex );
370
376
381
383 void EndChange();
384
390
396
402
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
439
444 FBPlug* GetOwned( int pIndex );
445
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
506 IObject_Declare(override);
507 ICallback_Declare(override);
508
512 static void PrintClassDefinitions();
513
514#endif
515
516protected:
520 virtual void FBDelete();
521
522 static int mGlobalTypeInfo;
523 static int GetInternalClassId();
524 HIObject mObject;
526 FBSDK_DLL friend int __FBRegisterTypeInfo(int pInternalClassId);
527};
528
529
531// Connection related utility functions.
533
541
548FBSDK_DLL bool FBDisconnect( FBPlug* pSrc, FBPlug* pDst );
549
555FBSDK_DLL FBPlug* FBGetFBPlug( HIObject pObject, bool pAutoCreate=true );
556
562FBSDK_DLL HIObject FBGetFBObject( HIObject pObject, bool pAutoCreate=false );
563
569template<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{
585public:
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
622protected:
623 void SetPlug(const FBPlug* pFBPlug);
624
625private:
626 void * mData;
627};
628
629template <class T> class HdlFBPlugTemplate : public HdlFBPlug
630{
631public:
633 {
634 }
635
636 HdlFBPlugTemplate(HdlFBPlug const &pPlug)
637 : HdlFBPlug(pPlug)
638 {
639 }
640
641 HdlFBPlugTemplate(const FBPlug *pPlug)
642 : HdlFBPlug((FBPlug *)pPlug)
643 {
644 }
645
646 HdlFBPlugTemplate<T>& operator=(const HdlFBPlugTemplate<T>& pPlug)
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
Template class to contain an array of items.
Definition fbarray.h:78
Connections Basic Open Reality SDK Element.
Definition fbplug.h:222
bool MoveSrcAt(int pIndex, int pAtIndex)
Move source connection at pIndex to pAtIndex.
int GetPlugConnectionModifiedList(FBPlugList &pPlugList, FBPlugModificationFlag pConnectionModificatonFlag, bool pAddRemove)
Get plug's modified src/dst property/object connection added/removed List.
void DisconnectAllDst()
Remove all destination connections.
bool DisconnectSrcAt(int pIndex)
Remove a source connection at a specified index.
bool ConnectSrcAt(int pDst_SrcIndex, FBPlug *pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone)
Add a source connection.
bool GetStatusFlag(FBPlugStatusFlag pStatus) const
Tell if the plug's status has changed.
bool ReplaceDstAt(int pIndex, FBPlug *pDst)
Replace a destination connection at a specified index.
virtual const char * ClassName()
internal System vars.
bool mSDKComponent
bool Plug is an SDK component.
Definition fbplug.h:525
void SetContentModified(FBPlugModificationFlag pFlag, bool pBool)
Set the plug's owned property/object's modification flag.
bool GetSelfModified(FBPlugModificationFlag pFlag)
Tell if the plug's self has changed.
virtual bool PlugNotify(FBConnectionAction pAction, FBPlug *pThis, int pIndex, FBPlug *pPlug=NULL, FBConnectionType pConnectionType=kFBConnectionTypeNone, FBPlug *pNewPlug=NULL)
PlugNotify when overloaded is equivalent of FBSystem.OnConnectionNotify but in the context of the der...
FBPlug * GetDst(int pIndex)
Get a destination connection's plug at specified index.
bool RevertModification(FBPlugModificationFlag pFlag=kFBAllModifiedMask)
Revert the plug's modification to original status.
void SetStatusFlag(FBPlugStatusFlag pStatus, bool pValue)
Set the plug's status flag.
virtual bool PlugStateNotify(FBConnectionAction pAction, FBPlug *pThis, void *pData=NULL, void *pDataOld=NULL, int pDataSize=0)
PlugStateNotify when overloaded is equivalent of FBSystem.OnConnectionStateNotify but in the context ...
void EndChange()
Ends a change on multiple plugs.
virtual bool PlugDataNotify(FBConnectionAction pAction, FBPlug *pThis, void *pData=NULL, void *pDataOld=NULL, int pDataSize=0)
PlugDataNotify when overloaded is equivalent of FBSystem.OnConnectionDataNotify but in the context of...
virtual void FBDelete()
Actual destructor for a FBPlug.
virtual bool Is(int pTypeId)
Is( int pTypeId )
bool ConnectDstAt(int pSrc_DstIndex, FBPlug *pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone)
Add a destination connection.
FBPlug * GetSrc(int pIndex)
Get a source connection's plug at specified index.
FBPlug * GetOwner()
Get the owner of this plug.
static int GetInternalClassId()
Internal class Id.
bool ReplaceSrcAt(int pIndex, FBPlug *pSrc)
Replace a source connection at a specified index.
void SetSelfModified(FBPlugModificationFlag pFlag, bool pBool)
Set the plug's self modification flag.
int GetSrcCount()
Get source connection count.
bool mAllocated
Contain the Allocation State of the Component.
Definition fbplug.h:472
static int mGlobalTypeInfo
Represente the Type Index.
Definition fbplug.h:522
bool GetContentModified(FBPlugModificationFlag pFlag)
Tell if the plug's content has changed.
void DisconnectAllSrc()
Remove all source connections.
int GetDstCount()
Get destination connection count.
bool DisconnectSrc(FBPlug *pSrc)
Remove a source connection.
FBConnectionType GetSrcType(int pIndex)
Get a source connection's type at specified index.
static int TypeInfo
TypeInfo.
Definition fbplug.h:469
FBPlug * GetOwned(int pIndex)
Get the owned plug at specified index.
int GetOwnedCount()
Get the owned plug count.
bool BeginChange()
Begins a change on multiple plugs.
virtual int GetTypeId()
GetTypeId( int pTypeId )
K_DLLIMPORT friend int __FBRegisterTypeInfo(int pInternalClassId)
__FBRegisterTypeInfo For internal use only, Register the TypeInfo mapped to internal class id.
bool ConnectDst(FBPlug *pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone)
Add a destination connection.
static const char * ClassGroupName
ClassGroupName of the object.
Definition fbplug.h:466
bool IsSDKComponent()
Return whether or not item is an SDK component.
bool DisconnectDstAt(int pIndex)
Remove a destination connection at a specified index.
bool DisconnectDst(FBPlug *pDst)
Remove a destination connection.
bool SwapSrc(int pIndexA, int pIndexB)
Swap source connection at index A with source connection at index B.
HIObject mObject
Handle on the Plug.
Definition fbplug.h:524
bool ConnectSrc(FBPlug *pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone)
Add a source connection.
FBConnectionType GetDstType(int pIndex)
Get a destination connection's type at specified index.
bool MoveSrcAt(FBPlug *pSrc, FBPlug *pAtSrc)
Move source connection pSrc to the position of pAtSrc.
Handler of FBPlug object Use this handler object to gracefully take care of dangling pointer problem.
Definition fbplug.h:584
bool Is(int pTypeId)
Is( int pTypeId )
A template class for arrays.
T * FBCast(FBObject *pObject, bool pAutoCreate=false)
Cast the SDK object using it's IObject interface into the proper class.
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
The purpose of this file is to hold all of the SDK general-purpose preprocessor definitions.
K_DLLIMPORT void FBDestroyPlugList(FBPlugList *pPlugList)
Delete a FBPlugList object.
K_DLLIMPORT FBPlugList * FBCreatePlugList()
Create a FBPlugList object.
K_DLLIMPORT FBPlug * FBGetFBPlug(HIObject pObject, bool pAutoCreate=true)
Get the FBPlug from an Internal Object.
K_DLLIMPORT HIObject FBGetFBObject(HIObject pObject, bool pAutoCreate=false)
Get the SDK object from an Internal Object.
FBArrayTemplate< FBPlug * > FBPlugList
typedef FBArrayTemplate<FBPlug*> FBPlugList;
Definition fbplug.h:193
K_DLLIMPORT bool FBConnect(FBPlug *pSrc, FBPlug *pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone)
Request the connection two FBPlug objects.
K_DLLIMPORT bool FBDisconnect(FBPlug *pSrc, FBPlug *pDst)
Connect two FBPlug objects.
FBPlugModificationFlag
Definition fbplug.h:154
@ kFBSelfDataModified
Object/Property itself has been dirty, in case of property get dirty, its owner object will be set di...
Definition fbplug.h:156
@ kFBContentKeyingModified
Owner object/Namespace has data dirty property/objects.
Definition fbplug.h:161
@ kFBContentStateModified
Owner object/Namespace has state dirty property/objects.
Definition fbplug.h:165
@ kFBSelfConnectionDstPropertyModified
The dst property of this plug has been modified.
Definition fbplug.h:171
@ kFBSelfConnectionSrcObjectModified
The src object of this plug has been modified.
Definition fbplug.h:168
@ kFBSelfConnectionDstObjectModified
The dst object of this plug has been modified.
Definition fbplug.h:170
@ kFBSelfStateModified
Object/Property naming change.
Definition fbplug.h:164
@ kFBPlugAllContent
None Modified.
Definition fbplug.h:155
@ kFBContentCustomPropertyModified
Owner object/Namespace has dirty property/objects.
Definition fbplug.h:177
@ kFBContentConnectionModified
Owner object/namespace has connection modified property/objects.
Definition fbplug.h:173
@ kFBSelfCustomPropertyModified
Object custom property change.
Definition fbplug.h:176
@ kFBContentDataModified
Owner object/Namespace has data dirty property/objects.
Definition fbplug.h:157
@ kFBSelfConnectionSrcPropertyModified
The src property of this plug has been modified.
Definition fbplug.h:169
@ kFBSelfKeyingModified
Object/Property itself has been dirty, in case of property get dirty, its owner object will be set di...
Definition fbplug.h:160
FBConnectionAction
Possible actions when a notify plug event occurs.
Definition fbplug.h:79
@ kFBKeyingKey
Component keying add event.
Definition fbplug.h:131
@ kFBDisconnectOwner
Disconnect owner from destination.
Definition fbplug.h:105
@ kFBPrefixRenamed
Component prefix has been renamed.
Definition fbplug.h:126
@ kFBRequestDisconnectSrc
Request disconnection of source to destination.
Definition fbplug.h:88
@ kFBRequestConnectDst
Request connection of destination to source.
Definition fbplug.h:82
@ kFBCandidateGlobal
Data candidate event, global candidate.
Definition fbplug.h:110
@ kFBEndReplaceDst
End replace destination during merge.
Definition fbplug.h:98
@ kFBBeginReplaceDst
Begin replace destination during merge.
Definition fbplug.h:97
@ kFBRenamed
Component has been renamed.
Definition fbplug.h:122
@ kFBReselect
Component re-selection.
Definition fbplug.h:118
@ kFBKeyingDeleteKey
Component keying delete event.
Definition fbplug.h:132
@ kFBDetached
Component detached from scene.
Definition fbplug.h:113
@ kFBPrefixRename
Component prefix is going to be renamed.
Definition fbplug.h:125
@ kFBRequestDisconnectDst
Request disconnection of destination to source.
Definition fbplug.h:89
@ kFBConnectSrc
Connect source to destination.
Definition fbplug.h:83
@ kFBCandidate
Data candidate event, before the data is set.
Definition fbplug.h:108
@ kFBDisconnectSrc
Disconnect source from destination.
Definition fbplug.h:90
@ kFBKeyingCurveChange
Component curve has changed.
Definition fbplug.h:134
@ kFBConnectedDst
Connected destination to source.
Definition fbplug.h:86
@ kFBEndChange
End change on destination.
Definition fbplug.h:103
@ kFBSelect
Component selection.
Definition fbplug.h:116
@ kFBKeyingCurveEndChange
Component curve changes in Dopesheet completed.
Definition fbplug.h:135
@ kFBReorderedSrc
Source has been reordered.
Definition fbplug.h:100
@ kFBBeginChange
Begin change on destination.
Definition fbplug.h:102
@ kFBRequestConnectSrc
Request connection of source to destination.
Definition fbplug.h:81
@ kFBRename
Component is going to be renamed.
Definition fbplug.h:121
@ kFBDestroy
Component destroy.
Definition fbplug.h:114
@ kFBCandidated
Data candidate event, after the data is set.
Definition fbplug.h:109
@ kFBRequestPrefixRename
Compoent request Prefix Rename.
Definition fbplug.h:124
@ kFBConnectedSrc
Connected source to destination.
Definition fbplug.h:85
@ kFBReorderSrc
Reorder of source.
Definition fbplug.h:99
@ kFBBeginReplaceSrc
Begin replace source during merge.
Definition fbplug.h:95
@ kFBConnectDst
Connect destination to source.
Definition fbplug.h:84
@ kFBDescription
Component description event.
Definition fbplug.h:128
@ kFBKeyingCandidate
Component keying candidate event.
Definition fbplug.h:133
@ kFBDisconnectDst
Disconnect destination from source.
Definition fbplug.h:91
@ kFBUnselect
Component de-selection.
Definition fbplug.h:117
@ kFBEndReplaceSrc
End replace source during merge.
Definition fbplug.h:96
@ kFBDisconnectedDst
Disconnected destination from source.
Definition fbplug.h:93
@ kFBConnectedOwner
Connected owner to destination.
Definition fbplug.h:104
@ kFBDisconnectedSrc
Disconnected source from destination.
Definition fbplug.h:92
@ kFBRequestRename
Component request rename.
Definition fbplug.h:120
FBPlugStatusFlag
Definition fbplug.h:186
@ kFBOwnedByUndo
Plug is owned by undo framework.
Definition fbplug.h:188
@ kFBPlugStatusFlagNone
Plug has no status set.
Definition fbplug.h:187
FBConnectionType
Connection types available between plugs.
Definition fbplug.h:148
@ kFBConnectionTypeNone
Default connection type.
Definition fbplug.h:149
@ kFBConnectionTypeSystem
System connection type.
Definition fbplug.h:150
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition fbtypes.h:62