simpmod.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:        simpmod.h
00012 // DESCRIPTION: Simple modifier base class
00013 // AUTHOR:      Dan Silva & Rolf Berteig
00014 // HISTORY:     created 30 January, 1995
00015 //**************************************************************************/
00016 #pragma once
00017 
00018 #include "object.h"
00019 // forward declarations
00020 class MoveModBoxCMode;
00021 class RotateModBoxCMode;
00022 class UScaleModBoxCMode;
00023 class NUScaleModBoxCMode;
00024 class SquashModBoxCMode;
00025 
00026 //--- SimpleMod -----------------------------------------------------------
00027 
00082 class SimpleMod: public Modifier {
00083     protected:
00085         CoreExport virtual ~SimpleMod();
00086 
00087     public: 
00088         Control *tmControl;
00089         Control *posControl;
00090         IParamBlock *pblock;
00091                 
00092         CoreExport static IObjParam *ip;
00093         static MoveModBoxCMode *moveMode;
00094         static RotateModBoxCMode *rotMode;
00095         static UScaleModBoxCMode *uscaleMode;
00096         static NUScaleModBoxCMode *nuscaleMode;
00097         static SquashModBoxCMode *squashMode;       
00098         static SimpleMod *editMod;
00099             
00100         CoreExport SimpleMod();
00101 
00102 
00103         ChannelMask ChannelsUsed()  { return PART_GEOM|PART_TOPO|SELECT_CHANNEL|SUBSEL_TYPE_CHANNEL; }
00104         ChannelMask ChannelsChanged() { return PART_GEOM; }
00105         CoreExport void ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node);
00106         Class_ID InputType() {return defObjectClassID;}
00107         CoreExport Interval LocalValidity(TimeValue t);
00108         CoreExport Matrix3 CompMatrix(TimeValue t, ModContext& mc, Matrix3& ntm, 
00109             Interval& valid, BOOL needOffset);
00110         CoreExport void CompOffset( TimeValue t, Matrix3& offset, Matrix3& invoffset);
00111 
00112         // From BaseObject
00113         CoreExport int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc);
00114         CoreExport int Display(TimeValue t, INode* inode, ViewExp *vpt, int flagst, ModContext *mc);
00115         CoreExport void GetWorldBoundBox(TimeValue t,INode* inode, ViewExp *vpt, Box3& box, ModContext *mc);
00116         
00117         CoreExport void GetSubObjectCenters(SubObjAxisCallback *cb,TimeValue t,INode *node,ModContext *mc);
00118         CoreExport void GetSubObjectTMs(SubObjAxisCallback *cb,TimeValue t,INode *node,ModContext *mc);
00119         BOOL ChangeTopology() {return FALSE;}
00120 
00121         CoreExport IParamArray *GetParamBlock();
00122         CoreExport int GetParamBlockIndex(int id);
00123 
00124         // Affine transform methods
00125         CoreExport void Move( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE );
00126         CoreExport void Rotate( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Quat& val, BOOL localOrigin=FALSE );
00127         CoreExport void Scale( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE );
00128         
00129         int NumRefs() {return 3;}
00130         CoreExport RefTargetHandle GetReference(int i);
00131 protected:
00132         CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);
00133 public:
00134 
00135         int NumSubs() {return 3;}
00136         CoreExport Animatable* SubAnim(int i);
00137         CoreExport MSTR SubAnimName(int i);
00138         CoreExport int SubNumToRefNum(int subNum);
00139         CoreExport BOOL AssignController(Animatable *control,int subAnim);
00140 
00141         CoreExport RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget, 
00142            PartID& partID, RefMessage message);
00143 
00144         CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;} 
00145         CoreExport void ActivateSubobjSel(int level, XFormModes& modes);
00146 
00147         // When clients are cloning themselves, they should call this 
00148         // method on the clone to copy SimpleMod's data.
00149         // NOTE: DEPRECATED! Use SimpleModClone(SimpleMod *smodSource, RemapDir& remap )
00150         CoreExport void SimpleModClone(SimpleMod *smodSource);
00151 
00152         // When clients are cloning themselves, they should call this 
00153         // method on the clone to copy SimpleMod's data.
00154         CoreExport void SimpleModClone(SimpleMod *smodSource, RemapDir& remap );
00155 
00156         // Clients of simpmod probably want to override these. If they do
00157         // the should call these from within thier methods.
00158         CoreExport void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);
00159         CoreExport void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next);
00160 
00161         // Clients of simpmod need to implement this method
00182         virtual Deformer& GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat)=0;
00206         virtual void InvalidateUI() {}
00207         #pragma warning(push)
00208         #pragma warning(disable:4100)
00209 
00222         virtual Interval GetValidity(TimeValue t) {return FOREVER;}
00231         virtual ParamDimension *GetParameterDim(int pbIndex) {return defaultDim;}
00239         virtual MSTR GetParameterName(int pbIndex) {return MSTR(_M("Parameter"));}
00257         virtual BOOL GetModLimits(TimeValue t,float &zmin, float &zmax, int &axis) {return FALSE;}
00258         
00259         CoreExport int NumSubObjTypes();
00260         CoreExport ISubObjType *GetSubObjType(int i);
00261     };
00262 
00263 
00264 // This is the ref ID of the parameter block
00265 #define SIMPMOD_PBLOCKREF   2
00266 
00267 // ParamBlock2 specialization added JBW 2/9/99 (replaces a IParamBlock with IParamBlock2 block pointer)
00268 class IParamBlock2;
00278 class SimpleMod2 : public SimpleMod {
00279     protected:
00280         // \brief Destructor. This is a base class that is not meant to be instantiated directly.
00281         CoreExport virtual ~SimpleMod2();
00282 
00283     public:
00284         IParamBlock2* pblock2;
00285 
00286         SimpleMod2() { pblock2 = NULL; }
00287         // From ref
00288         CoreExport RefTargetHandle GetReference(int i);
00289 protected:
00290         CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);     
00291 public:
00292         CoreExport Animatable* SubAnim(int i);
00293     };
00294 
00295 //--- SimpleWSMMod -----------------------------------------------------------
00296 
00335 class SimpleWSMMod: public Modifier {   
00336     public:
00337         WSMObject   *obRef;
00338         INode       *nodeRef;
00339         IParamBlock *pblock;
00340                 
00341         CoreExport static IObjParam *ip;
00342         static SimpleWSMMod *editMod;
00343     
00344         CoreExport SimpleWSMMod();
00345         CoreExport virtual ~SimpleWSMMod();
00346 
00347         ChannelMask ChannelsUsed()  { return PART_GEOM|PART_TOPO; }
00348         ChannelMask ChannelsChanged() { return PART_GEOM; }
00349         CoreExport void ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node);
00350         Class_ID InputType() {return defObjectClassID;}
00351         CoreExport Interval LocalValidity(TimeValue t);     
00352         BOOL ChangeTopology() {return FALSE;}
00353         CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;}
00354 
00355         int NumRefs() {return 3;}
00356         CoreExport RefTargetHandle GetReference(int i);
00357 protected:
00358         CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);
00359 public:
00360 
00361         int NumSubs() {return 1;}
00362         CoreExport Animatable* SubAnim(int i);
00363         CoreExport MSTR SubAnimName(int i);
00364 
00365         CoreExport RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget, 
00366            PartID& partID, RefMessage message);
00367         
00368         CoreExport IParamArray *GetParamBlock();
00369         CoreExport int GetParamBlockIndex(int id);
00370 
00371         // Evaluates the node reference and returns the WSM object.
00388         CoreExport WSMObject *GetWSMObject(TimeValue t);
00389                 
00390         // When clients are cloning themselves, they should call this 
00391         // method on the clone to copy SimpleMod's data.
00392         // NOTE: DEPRECATED! Use SimpleWSMModClone(SimpleMod *smodSource, RemapDir& remap )
00393         CoreExport void SimpleWSMModClone(SimpleWSMMod *smodSource);
00394 
00395         // When clients are cloning themselves, they should call this 
00396         // method on the clone to copy SimpleMod's data.
00397         CoreExport void SimpleWSMModClone(SimpleWSMMod *smodSource, RemapDir& remap);
00398 
00399         // Clients of simpmod probably want to override these. If they do
00400         // the should call these from within thier methods.
00401         CoreExport void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);
00402         CoreExport void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next);
00403 
00404         // Clients of simpmod need to implement this method
00428         virtual Deformer& GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat)=0;
00452         virtual void InvalidateUI() {}
00466         virtual Interval GetValidity(TimeValue t) {return FOREVER;}
00475         virtual ParamDimension *GetParameterDim(int pbIndex) {return defaultDim;}
00483         virtual MSTR GetParameterName(int pbIndex) {return MSTR(_M("Parameter"));}
00484         #pragma warning(pop)
00485         virtual void InvalidateParamMap() {}
00486 
00487         // Schematic view Animatable overides...
00488         CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags);
00489     };
00490 
00491 // CAL-01/10/02: ParamBlock2 specialization (replaces a IParamBlock with IParamBlock2 block pointer)
00492 class SimpleWSMMod2 : public SimpleWSMMod {
00493     public:
00494         IParamBlock2* pblock2;
00495 
00496         SimpleWSMMod2() { pblock2 = NULL; }
00497         
00498         // From Animatable
00499         Animatable* SubAnim(int i);
00500 
00501         // From ReferenceMaker
00502         RefTargetHandle GetReference(int i);
00503 protected:
00504         virtual void SetReference(int i, RefTargetHandle rtarg);
00505 public:
00506 
00507         // From BaseObject
00508         // IParamArray *GetParamBlock() { return NULL; }
00509         // int GetParamBlockIndex(int id) { return -1; }
00510 
00511         // From SimpleWSMMod
00512         // NOTE: DEPRECATED! Use SimpleWSMModClone(SimpleMod *smodSource, RemapDir& remap )
00513         void SimpleWSMModClone(SimpleWSMMod2 *smodSource);
00514 
00515         // From SimpleWSMMod
00516         void SimpleWSMModClone(SimpleWSMMod2 *smodSource, RemapDir& remap);
00517     };
00518 
00519 
00520 #define SIMPWSMMOD_OBREF        0
00521 #define SIMPWSMMOD_NODEREF      1
00522 #define SIMPWSMMOD_PBLOCKREF    2
00523 
00524 #define SIMPLEOSMTOWSM_CLASSID  Class_ID(0x3fa72be3,0xa5ee1bf9)
00525 
00526 #pragma warning(push)
00527 #pragma warning(disable:4239)
00528 
00529 // Used by SimpleOSMToWSMObject to create WSMs out of OSMs
00568 class SimpleOSMToWSMMod : public SimpleWSMMod {
00569     public:
00570         CoreExport SimpleOSMToWSMMod();
00571         CoreExport SimpleOSMToWSMMod(INode *node);
00572 
00573         void GetClassName(MSTR& s) {s=GetObjectName();}
00574         SClass_ID SuperClassID() {return WSM_CLASS_ID;}
00575         Class_ID ClassID() {return SIMPLEOSMTOWSM_CLASSID;} 
00576         CoreExport void DeleteThis();
00577         
00578         CoreExport RefTargetHandle Clone(RemapDir& remap);
00579         CoreExport MCHAR *GetObjectName();
00580 
00581         CoreExport Deformer& GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat);      
00582         CoreExport Interval GetValidity(TimeValue t);       
00583     };
00584 
00585 // CAL-01/10/02: ParamBlock2 specialization (replaces a IParamBlock with IParamBlock2 block pointer)
00586 #define SIMPLEOSMTOWSM2_CLASSID Class_ID(0x385220f9, 0x7e7f48e9)
00587 
00588 class SimpleOSMToWSMMod2 : public SimpleWSMMod2 {
00589     public:
00590         CoreExport SimpleOSMToWSMMod2();
00591         CoreExport SimpleOSMToWSMMod2(INode *node);
00592 
00593         void GetClassName(MSTR& s) {s=GetObjectName();}
00594         SClass_ID SuperClassID() {return WSM_CLASS_ID;}
00595         Class_ID ClassID() {return SIMPLEOSMTOWSM2_CLASSID;} 
00596         CoreExport void DeleteThis();
00597         CoreExport RefTargetHandle Clone(RemapDir& remap);
00598         CoreExport MCHAR *GetObjectName();
00599 
00600         CoreExport Deformer& GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat);      
00601         CoreExport Interval GetValidity(TimeValue t);       
00602     };
00603 #pragma warning(pop)
00604 CoreExport ClassDesc* GetSimpleOSMToWSMModDesc();
00605 CoreExport ClassDesc* GetSimpleOSMToWSMMod2Desc();
00606 
00607