ISceneEventManager.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2006 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 // FILE:        SceneEventListener.h
00012 // DESCRIPTION: Scene Event Notification Manager
00013 // AUTHOR:      Michaelson Britt
00014 // HISTORY:     Created 5 February 2007
00015 //**************************************************************************/
00016 
00017 #pragma once
00018 
00019 
00020 #include "MaxTypes.h"
00021 #include "Tab.h"
00022 #include "BaseInterface.h"
00023 #include "Export.h"
00024 #include "CoreExp.h"
00025 #include "plugapi.h"
00026 #include "Animatable.h"
00027 
00028 // forward declarations
00029 class INode;
00030 
00031 #define ISCENEEVENTCALLBACK_INTERFACE_ID    Interface_ID(0x36cd4b33, 0x36ef01e4)
00032 
00033 class INodeEventCallback;
00034 #define INODEEVENTCALLBACK_INTERFACE_ID     Interface_ID(0x6a173454, 0x4b420bbc)
00035 
00036 class ISceneEventManager;
00037 #define ISCENEEVENTMANAGER_INTERFACE_ID     Interface_ID(0x3f375083, 0x63ea3a86)
00038 
00039 
00040 
00041 
00042 //===========================================================================
00043 //
00044 // Namespace SceneEventNamespace
00045 //
00046 //===========================================================================
00047 
00048 namespace SceneEventNamespace {
00049     typedef DWORD CallbackKey;
00050 };
00051 
00052 
00053 //===========================================================================
00054 //
00055 // Namespace NodeEventNamespace
00056 //
00057 //===========================================================================
00058 
00059 namespace NodeEventNamespace {
00060     typedef AnimHandle NodeKey;
00061     typedef Tab<NodeKey> NodeKeyTab;
00062     typedef SceneEventNamespace::CallbackKey CallbackKey;
00063 
00064     // ---------- Helper Functions ----------
00069     inline NodeKey GetKeyByNode( INode* node ) {
00070         if( node!=NULL )
00071              return Animatable::GetHandleByAnim((Animatable*)node);
00072         else return 0;
00073     }
00078     inline INode* GetNodeByKey( NodeKey nodeKey ) {
00079         Animatable* anim = Animatable::GetAnimByHandle(nodeKey);
00080         if( (anim!=NULL) && (anim->SuperClassID()==BASENODE_CLASS_ID) )
00081              return (INode*)anim;
00082         else return NULL;
00083     }
00084 };
00085 
00086 
00087 //===========================================================================
00088 //
00089 // Class SceneEventCallback
00090 // Base class class for all EventCallback types
00091 //
00092 //===========================================================================
00093 class ISceneEventCallback : public BaseInterface {
00094     public:
00098         INodeEventCallback* GetINodeEventCallback()                 { return (INodeEventCallback*)(this->GetInterface(INODEEVENTCALLBACK_INTERFACE_ID)); }
00099 };
00100 
00101 
00102 //===========================================================================
00103 //
00104 // Class NodeEventCallback
00105 //
00106 //===========================================================================
00107 
00108 class INodeEventCallback : public ISceneEventCallback {
00109     public:
00110         typedef NodeEventNamespace::NodeKeyTab NodeKeyTab;
00111         #pragma warning(push)
00112         #pragma warning(disable:4100)
00113         // ---------- Hierarchy Events ----------
00116 
00117 
00118 
00119 
00120         virtual void Added( NodeKeyTab& nodes )                     {}
00125         virtual void Deleted( NodeKeyTab& nodes )                   {}
00130         virtual void LinkChanged( NodeKeyTab& nodes )               {}
00134         virtual void LayerChanged( NodeKeyTab& nodes )              {}
00138         virtual void GroupChanged( NodeKeyTab& nodes )              {}
00142         virtual void HierarchyOtherEvent( NodeKeyTab& nodes )       {}
00144 
00145         // ---------- Model Events ----------
00148 
00149 
00150 
00151 
00152         virtual void ModelStructured( NodeKeyTab& nodes )           {}
00156         virtual void GeometryChanged( NodeKeyTab& nodes )           {}
00160         virtual void TopologyChanged( NodeKeyTab& nodes )           {}
00165         virtual void MappingChanged( NodeKeyTab& nodes )            {}
00169         virtual void ExtentionChannelChanged( NodeKeyTab& nodes )   {}
00174         virtual void ModelOtherEvent( NodeKeyTab& nodes )           {}
00176 
00177         // ---------- Material Events ----------
00180 
00181 
00182 
00183 
00184         virtual void MaterialStructured( NodeKeyTab& nodes )        {}
00188         virtual void MaterialOtherEvent( NodeKeyTab& nodes )        {}
00190 
00191         // ---------- Controller Events ----------
00194 
00195 
00196 
00197 
00198 
00199         virtual void ControllerStructured( NodeKeyTab& nodes )      {}
00204         virtual void ControllerOtherEvent( NodeKeyTab& nodes )      {}
00206 
00207         // ---------- Property Events ----------
00210 
00211 
00212 
00213 
00214         virtual void NameChanged( NodeKeyTab& nodes )               {}
00218         virtual void WireColorChanged( NodeKeyTab& nodes )          {}
00224         virtual void RenderPropertiesChanged( NodeKeyTab& nodes )   {} // Includes PART_GI_xxx, PART_REND_xxx, PART_DISP_APPROX, and render elements
00231         virtual void DisplayPropertiesChanged( NodeKeyTab& nodes )  {} // Includes PART_DISP_xxx, PART_GFX_DATA
00236         virtual void UserPropertiesChanged( NodeKeyTab& nodes )     {}
00240         virtual void PropertiesOtherEvent( NodeKeyTab& nodes )      {} // All other property events
00242 
00243         // ---------- Display/Interaction Events ----------
00246 
00247 
00248 
00249 
00250         virtual void SubobjectSelectionChanged( NodeKeyTab& nodes ) {}
00254         virtual void SelectionChanged( NodeKeyTab& nodes )          {}
00258         virtual void HideChanged( NodeKeyTab& nodes )               {}
00262         virtual void FreezeChanged( NodeKeyTab& nodes )             {}
00267         virtual void DisplayOtherEvent( NodeKeyTab& nodes )         {}
00269         #pragma warning(pop)
00270         // ---------- Other callback methods ----------
00272         virtual void CallbackBegin()                                {}
00274         virtual void CallbackEnd()                                  {}
00275 
00276         // ---------- Callback Settings ----------
00283         virtual BOOL VerboseDeleted()                               {return FALSE;}
00284 
00285         // ---------- Support for Future Expansion ----------
00286         Interface_ID GetID()                                        { return INODEEVENTCALLBACK_INTERFACE_ID; }
00287         BaseInterface* GetInterface(Interface_ID id)
00288             { if (id == INODEEVENTCALLBACK_INTERFACE_ID) return this; else return BaseInterface::GetInterface(id); }
00289 };
00290 
00291 
00292 //===========================================================================
00293 //
00294 // Class SceneEventManager
00295 //
00296 //===========================================================================
00297 class ISceneEventManager : public BaseInterface {
00298     public:
00299         typedef SceneEventNamespace::CallbackKey CallbackKey;
00300 
00310         virtual CallbackKey RegisterCallback( ISceneEventCallback* callback, BOOL polling=FALSE, DWORD delayMilliseconds=0, BOOL mouseUp=FALSE ) = 0;
00313         virtual void UnRegisterCallback( CallbackKey callbackKey ) = 0;
00317         virtual ISceneEventCallback* GetCallbackByKey( CallbackKey callbackKey ) = 0;
00321         virtual CallbackKey GetKeyByCallback( ISceneEventCallback* callback ) = 0;
00322 
00327         virtual void TriggerMessages( CallbackKey callbackKey ) = 0;
00331         virtual void ResetMessages( CallbackKey callbackKey ) = 0;
00332 };
00333 
00334 CoreExport ISceneEventManager* GetISceneEventManager();
00335 
00336