iassembly.h

Go to the documentation of this file.
00001      /**********************************************************************
00002  
00003     FILE: IAssembly.h
00004 
00005     DESCRIPTION:  Public interface for setting and getting assembly flags
00006 
00007     CREATED BY: Attila Szabo, Discreet
00008 
00009     HISTORY: - created April 03, 2001
00010 
00011  *> Copyright (c) 1998-2000, All Rights Reserved.
00012  **********************************************************************/
00013 
00014 #pragma once
00015 
00016 #include "iFnPub.h"
00017 #include "maxtypes.h"
00018 
00019 // This type is not being used currently 
00020 typedef int AssemblyCode;
00021 
00022 // class IAssembly
00023 //
00024 // This interface allows for setting and retrieving assembly membership
00025 // information to\from nodes. All methods of the interface are implemented 
00026 // by the system (Max).
00027 // Client code can query an INode for this interface:
00028 // INode* n;
00029 // IAssembly* a = GetAssemblyInterface(n);
00036 class IAssembly : public FPMixinInterface 
00037 {
00038     public:
00039         //
00040         // -- Methods for setting assembly flags
00041         //
00042 
00043         // NOTE: nodes can be both assembly members and heads in the same time.
00044         
00045         // If b=TRUE, sets a node as an assembly member.
00046         // If b=FALSE sets a closed or open assembly member as not an assembly member
00047         // If the member is open, it closes it first then removes the member flag
00048         // To close an assembly member, call SetAssemblyMemberOpen(FALSE)
00061         virtual void SetAssemblyMember(BOOL b) = 0;
00062         
00063         // Should only be called on assembly members
00064         // If b=TRUE opens an assembly member
00065         // If b=FALSE closes an assembly member
00075         virtual void SetAssemblyMemberOpen(BOOL b) = 0;
00076 
00077         // If b=TRUE sets a node as an assembly head
00078         // If b=FALSE sets a closed or open assembly head as not an assembly head
00079         // If the head is open, it closes it first then removes the head flag
00080         // To close an assembly head, call SetAssemblyHeadOpen(FALSE)
00093         virtual void SetAssemblyHead(BOOL b) = 0;
00094         
00095         // Should only be called on assembly heads
00096         // If b=TRUE opens an assembly head
00097         // If b=FALSE closes an assembly head
00107         virtual void SetAssemblyHeadOpen(BOOL b) = 0;
00108         
00109         //
00110         // -- Methods for querying the assembly flags
00111         //
00112         
00113         // NOTE: to detect closed assembly members\heads, check for both 
00114         // the assembly member\head flag and open member\head flags:
00115         // IsAssemblyHead() && !IsAssemblyMemberOpen()
00116 
00117         // Returns TRUE for both closed and open assembly members\heads
00124         virtual BOOL IsAssemblyMember() const = 0;
00131         virtual BOOL IsAssemblyHead() const = 0;
00132         
00133         // Returns TRUE for open assembly members\heads
00139         virtual BOOL IsAssemblyMemberOpen() const = 0;
00145         virtual BOOL IsAssemblyHeadOpen() const = 0;
00146         
00147         // This method is used for detecting assemblies in assemblies. 
00148     // The method checks if this assembly node is a head node and whether it's a
00149     // member of the assembly head node passed in as parameter.
00157         virtual BOOL IsAssemblyHeadMemberOf(const IAssembly* const assemblyHead) const = 0;
00158 
00159         // Allow persistance of info kept in object implementing this interface
00170         virtual IOResult Save(ISave* isave) = 0;
00180         virtual IOResult Load(ILoad* iload) = 0;
00181 
00182         // -- IAssembly function publishing
00183         // Methods IDs
00184         enum 
00185         { 
00186             E_SET_ASSEMBLY_MEMBER, 
00187             E_GET_ASSEMBLY_MEMBER, 
00188             E_SET_ASSEMBLY_HEAD, 
00189             E_GET_ASSEMBLY_HEAD, 
00190             E_SET_ASSEMBLY_MEMBER_OPEN, 
00191             E_GET_ASSEMBLY_MEMBER_OPEN, 
00192             E_SET_ASSEMBLY_HEAD_OPEN,
00193             E_GET_ASSEMBLY_HEAD_OPEN,
00194         }; 
00195     
00196 }; 
00197 
00198 // Assembly interface ID
00199 #define ASSEMBLY_INTERFACE Interface_ID(0x2512714b, 0x4b456518)
00200 
00201 inline IAssembly* GetAssemblyInterface(BaseInterface* baseIfc)  
00202 { DbgAssert( baseIfc != NULL); return static_cast<IAssembly*>(baseIfc->GetInterface(ASSEMBLY_INTERFACE)); }
00203 
00204 // class IAssembly2
00205 //
00206 // This new version of the assembly interface extends IAssembly
00207 // SDK programmers are encouraged to use this version of the assembly interface
00208 // 
00209 // All methods of the interface are implemented by the system (Max).
00210 // Client code can query an INode for this interface:
00211 // INode* n;
00212 // IAssembly2* a = GetAssemblyInterface2(n);
00226 class IAssembly2 : public IAssembly
00227 {
00228     public:
00229         // Methods to control the display of assembly world 
00230         // bounding box of open assemblies, on a per assembly basis
00231         // These methods should be called on assembly head nodes only
00232         // If called on assembly member nodes, the display of the world 
00233         // bounding box won't get turned off.
00242         virtual void SetAssemblyBBoxDisplay(BOOL b) = 0;
00249         virtual BOOL GetAssemblyBBoxDisplay() = 0;
00250 
00251         // -- IAssembly2 function publishing
00252         // Methods IDs
00253         enum 
00254         { 
00255             E_SET_ASSEMBLY_BBOX_DISPLAY = IAssembly::E_GET_ASSEMBLY_HEAD_OPEN + 1, 
00256             E_GET_ASSEMBLY_BBOX_DISPLAY, 
00257         };
00258 
00259 };
00260 #define ASSEMBLY_INTERFACE2 Interface_ID(0x6fd5515a, 0x353c6734)
00261 inline IAssembly2* GetAssemblyInterface2(BaseInterface* baseIfc)    
00262 { DbgAssert( baseIfc != NULL); return static_cast<IAssembly2*>(baseIfc->GetInterface(ASSEMBLY_INTERFACE2)); }
00263