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