xtcobject.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *<
00003     FILE: XTCObject.h
00004                   
00005     DESCRIPTION:  Defines the Extension Channel Object
00006 
00007     CREATED BY: Nikolai Sander
00008 
00009     HISTORY: created 3 March 2000
00010 
00011  *>     Copyright (c) 2000, All Rights Reserved.
00012  **********************************************************************/
00013 
00014 #pragma once
00015 
00016 #include "maxapi.h"
00017 #include "plugapi.h"
00018 #include "iFnPub.h"
00019 #include "channels.h"
00020 #include "object.h"
00021 // forward declarations
00022 class ObjectState;
00023 
00024 
00025 /*------------------------------------------------------------------- 
00026   XTCObject:  
00027 ---------------------------------------------------------------------*/
00028 
00092 class XTCObject : public InterfaceServer {
00093 public:
00094     // Unique identifier
00096     virtual Class_ID ExtensionID()=0;
00099     virtual XTCObject *Clone()=0;
00100     
00101     // Channels that the XTCObject depends on. If a modifier changes a channel, 
00102     // that a XTCObject depends on, its Pre- and PostChanChangedNotify
00103     // methods will be called
00111     virtual ChannelMask DependsOn(){return 0;}
00112     
00113     // These are the channels, that the extension object changes in the Pre- 
00114     // or PostChanChangedNotify methods
00121     virtual ChannelMask ChannelsChanged(){return 0;}
00122 
00123     // These are the channels, that the extension object changes in the Pre- 
00124     // or PostChanChangedNotify methods
00131     virtual ChannelMask ChannelsUsed(){return 0;}
00132     
00133     // If an XTCObject wants to display itself in the viewport, it can 
00134     // overwrite this method
00152     #pragma warning(push)
00153     #pragma warning(disable:4100)
00154     virtual int  Display(TimeValue t, INode* inode, ViewExp *vpt, int flags,Object *pObj){return 0;};
00155     
00156     // This method will be called before a modifier is applied, that 
00157     // changes a channel, that the XTCObject depends on. In case the 
00158     // modifier is the last in the stack, bEndOfPipleine is true,
00159     // otherwise false
00160 
00178     virtual void PreChanChangedNotify(TimeValue t, ModContext &mc, ObjectState* os, INode *node,Modifier *mod, bool bEndOfPipeline){};
00179 
00180     // This method will be called after a modifier is applied, that 
00181     // changes a channel, that the XTC object depends on. In case the 
00182     // modifier is the last in the stack, bEndOfPipleine is true
00183     // otherwise false
00201     virtual void PostChanChangedNotify(TimeValue t, ModContext &mc, ObjectState* os, INode *node,Modifier *mod, bool bEndOfPipeline){};
00202     
00203     // If the XTC object returns true from this method, the object 
00204     // is not displayed in the viewport
00210     virtual BOOL SuspendObjectDisplay(){ return false; }
00212     virtual void DeleteThis()=0;
00213     
00214     // This method allows the object to enlarge its viewport rectangle,
00215     // if it wants to. The system will call this method for all XTCObjects 
00216     // when calculating the viewport rectangle; the XTCObject can enlarge the 
00217     // rectangle if desired
00230     virtual void MaybeEnlargeViewportRect(GraphicsWindow *gw, Rect &rect){}
00231 
00232     // by default the existing XTCObjects will be deleted, if a branch updates. 
00233     // In case the XTCObject wants to do more intelligent branching (not just 
00234     // deleted and add), it might want to return false to this method, so that 
00235     // it can later (see MergeXTCObject) copy the data from this and other 
00236     // branches into an existing XTCObject.
00251     virtual bool RemoveXTCObjectOnMergeBranches(Object *obFrom, Object *obTo) { return true; }
00252     
00253 
00254     // The default implementation just adds the XTCObject to the to object
00255     // In case the XTCObject should do a more intelligent merge with already
00256     // existing XTCObjects in the obTo, it has to overwrite this method
00272     virtual bool MergeXTCObject(Object *obFrom, Object *obTo, int prio, int branchID) { obTo->AddXTCObject(this,prio,branchID); return true;}
00273 
00274     // In case a branch of a compound object is deleted the XTCObject will be asked,
00275     // if the XTCObject should be deleted as well. In case the XTCObject represents a
00276     // merge of all branches the TCObject might want to return false to this
00277     // method and reassign itself to another branch, so that the merged information is 
00278     // not lost.
00294     virtual bool RemoveXTCObjectOnBranchDeleted(Object *ComObj,int branchID, bool branchWillBeReordered) { return true; }
00295     #pragma warning(pop)
00296 };
00297