simpmod.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /**********************************************************************
  2. *<
  3. FILE: simpmod.h
  4. DESCRIPTION: Simple modifier base class
  5. CREATED BY: Dan Silva & Rolf Berteig
  6. HISTORY: created 30 Jauary, 1995
  7. *> Copyright (c) 1994, All Rights Reserved.
  8. **********************************************************************/
  9. #ifndef __SIMPMOD__
  10. #define __SIMPMOD__
  11. //--- SimpleMod -----------------------------------------------------------
  12. class SimpleMod: public Modifier {
  13. public:
  14. Control *tmControl;
  15. Control *posControl;
  16. IParamBlock *pblock;
  17. CoreExport static IObjParam *ip;
  18. static MoveModBoxCMode *moveMode;
  19. static RotateModBoxCMode *rotMode;
  20. static UScaleModBoxCMode *uscaleMode;
  21. static NUScaleModBoxCMode *nuscaleMode;
  22. static SquashModBoxCMode *squashMode;
  23. static SimpleMod *editMod;
  24. CoreExport SimpleMod();
  25. CoreExport virtual ~SimpleMod();
  26. ChannelMask ChannelsUsed() { return PART_GEOM|PART_TOPO|SELECT_CHANNEL|SUBSEL_TYPE_CHANNEL; }
  27. ChannelMask ChannelsChanged() { return PART_GEOM; }
  28. CoreExport void ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node);
  29. Class_ID InputType() {return defObjectClassID;}
  30. CoreExport Interval LocalValidity(TimeValue t);
  31. CoreExport Matrix3 CompMatrix(TimeValue t, ModContext& mc, Matrix3& ntm,
  32. Interval& valid, BOOL needOffset);
  33. CoreExport void CompOffset( TimeValue t, Matrix3& offset, Matrix3& invoffset);
  34. // From BaseObject
  35. CoreExport int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc);
  36. CoreExport int Display(TimeValue t, INode* inode, ViewExp *vpt, int flagst, ModContext *mc);
  37. CoreExport void GetWorldBoundBox(TimeValue t,INode* inode, ViewExp *vpt, Box3& box, ModContext *mc);
  38. CoreExport void GetSubObjectCenters(SubObjAxisCallback *cb,TimeValue t,INode *node,ModContext *mc);
  39. CoreExport void GetSubObjectTMs(SubObjAxisCallback *cb,TimeValue t,INode *node,ModContext *mc);
  40. BOOL ChangeTopology() {return FALSE;}
  41. CoreExport IParamArray *GetParamBlock();
  42. CoreExport int GetParamBlockIndex(int id);
  43. // Affine transform methods
  44. CoreExport void Move( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE );
  45. CoreExport void Rotate( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Quat& val, BOOL localOrigin=FALSE );
  46. CoreExport void Scale( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE );
  47. int NumRefs() {return 3;}
  48. CoreExport RefTargetHandle GetReference(int i);
  49. CoreExport void SetReference(int i, RefTargetHandle rtarg);
  50. int NumSubs() {return 3;}
  51. CoreExport Animatable* SubAnim(int i);
  52. CoreExport TSTR SubAnimName(int i);
  53. CoreExport RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget,
  54. PartID& partID, RefMessage message);
  55. CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;}
  56. CoreExport void ActivateSubobjSel(int level, XFormModes& modes);
  57. // When clients are cloning themselves, they should call this
  58. // method on the clone to copy SimpleMod's data.
  59. CoreExport void SimpleModClone(SimpleMod *smodSource);
  60. // Clients of simpmod probably want to override these. If they do
  61. // the should call these from within thier methods.
  62. CoreExport void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);
  63. CoreExport void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next);
  64. // Clients of simpmod need to implement this method
  65. virtual Deformer& GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat)=0;
  66. virtual void InvalidateUI() {}
  67. virtual Interval GetValidity(TimeValue t) {return FOREVER;}
  68. virtual ParamDimension *GetParameterDim(int pbIndex) {return defaultDim;}
  69. virtual TSTR GetParameterName(int pbIndex) {return TSTR(_T("Parameter"));}
  70. virtual BOOL GetModLimits(TimeValue t,float &zmin, float &zmax, int &axis) {return FALSE;}
  71. };
  72. // This is the ref ID of the parameter block
  73. #define SIMPMOD_PBLOCKREF 2
  74. //--- SimpleWSMMod -----------------------------------------------------------
  75. class SimpleWSMMod: public Modifier {
  76. public:
  77. WSMObject *obRef;
  78. INode *nodeRef;
  79. IParamBlock *pblock;
  80. CoreExport static IObjParam *ip;
  81. static SimpleWSMMod *editMod;
  82. CoreExport SimpleWSMMod();
  83. CoreExport virtual ~SimpleWSMMod();
  84. ChannelMask ChannelsUsed() { return PART_GEOM|PART_TOPO; }
  85. ChannelMask ChannelsChanged() { return PART_GEOM; }
  86. CoreExport void ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node);
  87. Class_ID InputType() {return defObjectClassID;}
  88. CoreExport Interval LocalValidity(TimeValue t);
  89. BOOL ChangeTopology() {return FALSE;}
  90. CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;}
  91. int NumRefs() {return 3;}
  92. CoreExport RefTargetHandle GetReference(int i);
  93. CoreExport void SetReference(int i, RefTargetHandle rtarg);
  94. int NumSubs() {return 1;}
  95. CoreExport Animatable* SubAnim(int i);
  96. CoreExport TSTR SubAnimName(int i);
  97. CoreExport RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget,
  98. PartID& partID, RefMessage message);
  99. CoreExport IParamArray *GetParamBlock();
  100. CoreExport int GetParamBlockIndex(int id);
  101. // Evaluates the node reference and returns the WSM object.
  102. CoreExport WSMObject *GetWSMObject(TimeValue t);
  103. // When clients are cloning themselves, they should call this
  104. // method on the clone to copy SimpleMod's data.
  105. CoreExport void SimpleWSMModClone(SimpleWSMMod *smodSource);
  106. // Clients of simpmod probably want to override these. If they do
  107. // the should call these from within thier methods.
  108. CoreExport void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);
  109. CoreExport void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next);
  110. // Clients of simpmod need to implement this method
  111. virtual Deformer& GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat)=0;
  112. virtual void InvalidateUI() {}
  113. virtual Interval GetValidity(TimeValue t) {return FOREVER;}
  114. virtual ParamDimension *GetParameterDim(int pbIndex) {return defaultDim;}
  115. virtual TSTR GetParameterName(int pbIndex) {return TSTR(_T("Parameter"));}
  116. virtual void InvalidateParamMap() {}
  117. };
  118. #define SIMPWSMMOD_OBREF 0
  119. #define SIMPWSMMOD_NODEREF 1
  120. #define SIMPWSMMOD_PBLOCKREF 2
  121. #endif