00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #pragma once
00018 #include "coreexp.h"
00019 #include "maxheap.h"
00020 #include "maxtypes.h"
00021 #include "mouseman.h"
00022 #include "bitarray.h"
00023 #include "maxapi.h"
00024 #include "objmode.h"
00025 #include "object.h"
00026 #include "istdplug.h"
00027 #include "sbmtlapi.h"
00028 #include "patch.h"
00029
00030 class IObjParam;
00031 class HitRecord;
00032
00033
00034 extern CoreExport Class_ID patchObjectClassID;
00035
00036 extern HINSTANCE hInstance;
00037
00038
00039 #define NS_PO_VERT 0
00040 #define NS_PO_EDGE 1
00041 #define NS_PO_PATCH 2
00042
00043
00044 #define DEF_PICKBOX_SIZE 4
00045
00046
00047 #define PO_OBJECT 0
00048 #define PO_VERTEX 1
00049 #define PO_EDGE 2
00050 #define PO_PATCH 3
00051 #define PO_ELEMENT 4
00052 #define PO_HANDLE 5
00053 #define PO_LEVELS 6
00054
00055 #define CID_EP_BIND CID_USER + 203
00056 #define CID_EP_EXTRUDE CID_USER + 204
00057 #define CID_EP_BEVEL CID_USER + 205
00058 #define CID_EP_NORMAL_FLIP CID_USER + 206
00059 #define CID_CREATE_VERT CID_USER + 207
00060 #define CID_CREATE_PATCH CID_USER + 208
00061 #define CID_VERT_WELD CID_USER + 209
00062
00063 #define CID_COPY_TANGENT CID_USER + 210
00064 #define CID_PASTE_TANGENT CID_USER + 211
00065
00066
00067
00068 #define EP_DISP_RESULT 0x0100
00069
00070
00071 #define EP_MASTER_CONTROL_REF 0
00072 #define EP_VERT_BASE_REF 1
00073
00074 class PatchObject;
00075
00076
00077 class EP_BindMouseProc : public MouseCallBack {
00078 private:
00079 PatchObject *pobj;
00080 IObjParam *ip;
00081 IPoint2 om;
00082 BitArray knotList;
00083
00084 protected:
00085 HCURSOR GetTransformCursor();
00086 BOOL HitAKnot(ViewExp *vpt, IPoint2 *p, int *vert);
00087 BOOL HitASegment(ViewExp *vpt, IPoint2 *p, int *Seg);
00088
00089 BOOL HitTest( ViewExp *vpt, IPoint2 *p, int type, int flags, int subType );
00090 BOOL AnyHits( ViewExp *vpt ) { return vpt->NumSubObjHits(); }
00091
00092 public:
00093 EP_BindMouseProc(PatchObject* spl, IObjParam *i) { pobj=spl; ip=i; }
00094 int proc(
00095 HWND hwnd,
00096 int msg,
00097 int point,
00098 int flags,
00099 IPoint2 m );
00100 };
00101
00102
00103
00104 class EP_BindCMode : public CommandMode {
00105 private:
00106 ChangeFGObject fgProc;
00107 EP_BindMouseProc eproc;
00108 PatchObject* pobj;
00109
00110
00111 public:
00112 EP_BindCMode(PatchObject* spl, IObjParam *i) :
00113 fgProc((ReferenceTarget*)spl), eproc(spl,i) {pobj=spl;}
00114
00115 int Class() { return MODIFY_COMMAND; }
00116 int ID() { return CID_EP_BIND; }
00117 MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &eproc; }
00118 ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00119 BOOL ChangeFG( CommandMode *oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00120 void EnterMode();
00121 void ExitMode();
00122
00123 };
00124
00125
00126 class EP_ExtrudeMouseProc : public MouseCallBack {
00127 private:
00128 MoveTransformer moveTrans;
00129 PatchObject *po;
00130 Interface *ip;
00131 IPoint2 om;
00132 Point3 ndir;
00133 public:
00134 EP_ExtrudeMouseProc(PatchObject* o, IObjParam *i) : moveTrans(i) {po=o;ip=i;}
00135 int proc(HWND hwnd, int msg, int point, int flags, IPoint2 m);
00136 };
00137
00138
00139 class EP_ExtrudeSelectionProcessor : public GenModSelectionProcessor {
00140 protected:
00141 HCURSOR GetTransformCursor();
00142 public:
00143 EP_ExtrudeSelectionProcessor(EP_ExtrudeMouseProc *mc, PatchObject *o, IObjParam *i)
00144 : GenModSelectionProcessor(mc,(BaseObject*) o,i) {}
00145 };
00146
00147
00148 class EP_ExtrudeCMode : public CommandMode {
00149 private:
00150 ChangeFGObject fgProc;
00151 EP_ExtrudeSelectionProcessor mouseProc;
00152 EP_ExtrudeMouseProc eproc;
00153 PatchObject* po;
00154
00155 public:
00156 EP_ExtrudeCMode(PatchObject* o, IObjParam *i) :
00157 fgProc((ReferenceTarget *)o), mouseProc(&eproc,o,i), eproc(o,i) {po=o;}
00158 int Class() { return MODIFY_COMMAND; }
00159 int ID() { return CID_EP_EXTRUDE; }
00160 MouseCallBack *MouseProc(int *numPoints) { *numPoints=2; return &mouseProc; }
00161 ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00162 BOOL ChangeFG( CommandMode *oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00163 void EnterMode();
00164 void ExitMode();
00165 };
00166
00167 class EP_NormalFlipMouseProc : public MouseCallBack {
00168 private:
00169 PatchObject *po;
00170 Interface *ip;
00171 IPoint2 om;
00172 Point3 ndir;
00173 public:
00174 EP_NormalFlipMouseProc(PatchObject* o, IObjParam *i) {po=o;ip=i;}
00175 BOOL HitTest( ViewExp *vpt, IPoint2 *p, int type, int flags, int subType );
00176 BOOL HitAPatch(ViewExp *vpt, IPoint2 *p, int *pix);
00177 int proc(HWND hwnd, int msg, int point, int flags, IPoint2 m);
00178 };
00179
00180 class EP_NormalFlipCMode : public CommandMode {
00181 private:
00182 ChangeFGObject fgProc;
00183 EP_NormalFlipMouseProc eproc;
00184 PatchObject* po;
00185
00186 public:
00187 EP_NormalFlipCMode(PatchObject* o, IObjParam *i) :
00188 fgProc((ReferenceTarget *)o), eproc(o,i) {po=o;}
00189 int Class() { return MODIFY_COMMAND; }
00190 int ID() { return CID_EP_NORMAL_FLIP; }
00191 MouseCallBack *MouseProc(int *numPoints) { *numPoints=1; return &eproc; }
00192 ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00193 BOOL ChangeFG( CommandMode *oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00194 void EnterMode();
00195 void ExitMode();
00196 };
00197
00198
00199 class EP_BevelMouseProc : public MouseCallBack {
00200 private:
00201 MoveTransformer moveTrans;
00202 PatchObject *po;
00203 Interface *ip;
00204 IPoint2 om;
00205
00206 public:
00207 EP_BevelMouseProc(PatchObject* o, IObjParam *i) : moveTrans(i) {po=o;ip=i;}
00208 int proc(HWND hwnd, int msg, int point, int flags, IPoint2 m);
00209 };
00210
00211
00212 class EP_BevelSelectionProcessor : public GenModSelectionProcessor {
00213 protected:
00214 HCURSOR GetTransformCursor();
00215 public:
00216 EP_BevelSelectionProcessor(EP_BevelMouseProc *mc, PatchObject *o, IObjParam *i)
00217 : GenModSelectionProcessor(mc,(BaseObject*) o,i) {}
00218 };
00219
00220
00221 class EP_BevelCMode : public CommandMode {
00222 private:
00223 ChangeFGObject fgProc;
00224 EP_BevelSelectionProcessor mouseProc;
00225 EP_BevelMouseProc eproc;
00226 PatchObject* po;
00227
00228 public:
00229 EP_BevelCMode(PatchObject* o, IObjParam *i) :
00230 fgProc((ReferenceTarget *)o), mouseProc(&eproc,o,i), eproc(o,i) {po=o;}
00231 int Class() { return MODIFY_COMMAND; }
00232 int ID() { return CID_EP_BEVEL; }
00233 MouseCallBack *MouseProc(int *numPoints) { *numPoints=3; return &mouseProc; }
00234 ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00235 BOOL ChangeFG( CommandMode *oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00236 void EnterMode();
00237 void ExitMode();
00238 };
00239
00240
00241 class EP_CreateVertMouseProc : public MouseCallBack {
00242 private:
00243 PatchObject *po;
00244 IObjParam *mpIP;
00245 public:
00246 EP_CreateVertMouseProc(PatchObject* mod, IObjParam *i) {po=mod;mpIP=i;}
00247 int proc (HWND hwnd, int msg, int point, int flags, IPoint2 m);
00248 };
00249
00250 class EP_CreateVertCMode : public CommandMode {
00251 private:
00252 ChangeFGObject fgProc;
00253 EP_CreateVertMouseProc proc;
00254 PatchObject *po;
00255
00256 public:
00257 EP_CreateVertCMode(PatchObject* mod, IObjParam *i) :
00258 fgProc((ReferenceTarget *)mod), proc(mod,i) {po=mod;}
00259 int Class() { return MODIFY_COMMAND; }
00260 int ID() { return CID_CREATE_VERT; }
00261 MouseCallBack *MouseProc(int *numPoints) {*numPoints=1; return &proc;}
00262 ChangeForegroundCallback *ChangeFGProc() {return &fgProc;}
00263 BOOL ChangeFG(CommandMode *oldMode) {return oldMode->ChangeFGProc()!= &fgProc;}
00264 void EnterMode();
00265 void ExitMode();
00266 };
00267
00268 class EP_CreatePatchMouseProc : public MouseCallBack {
00269 public:
00270 PatchObject *po;
00271 IObjParam *mpIP;
00272 int verts[4];
00273 IPoint2 anchor, lastPoint, startPoint;
00274
00275 EP_CreatePatchMouseProc(PatchObject* mod, IObjParam *i);
00276 BOOL HitTest( ViewExp *vpt, IPoint2 *p, int type, int flags, int subType );
00277 BOOL HitAVert(ViewExp *vpt, IPoint2 *p, int& vert);
00278
00279 int proc(HWND hwnd, int msg, int point, int flags, IPoint2 m );
00280 };
00281
00282 class EP_CreatePatchCMode : public CommandMode {
00283 public:
00284 ChangeFGObject fgProc;
00285 PatchObject *po;
00286 EP_CreatePatchMouseProc proc;
00287
00288 EP_CreatePatchCMode(PatchObject* mod, IObjParam *i) :
00289 fgProc((ReferenceTarget *)mod), proc(mod,i) {po=mod;}
00290 int Class() { return MODIFY_COMMAND; }
00291 int ID() { return CID_CREATE_PATCH; }
00292 MouseCallBack *MouseProc(int *numPoints) {*numPoints=5; return &proc;}
00293 ChangeForegroundCallback *ChangeFGProc() {return &fgProc;}
00294 BOOL ChangeFG(CommandMode *oldMode) {return oldMode->ChangeFGProc()!= &fgProc;}
00295 void EnterMode();
00296 void ExitMode();
00297 };
00298
00299
00300 class EP_VertWeldMouseProc : public MouseCallBack {
00301 public:
00302 PatchObject *po;
00303 IObjParam *mpIP;
00304 int fromVert, toVert;
00305 IPoint2 anchor, lastPoint;
00306
00307 EP_VertWeldMouseProc(PatchObject* mod, IObjParam *i){po=mod;mpIP=i;}
00308 BOOL HitTest( ViewExp *vpt, IPoint2 *p, int type, int flags, int subType );
00309 BOOL HitAVert(ViewExp *vpt, IPoint2 *p, int& vert);
00310
00311 int proc(HWND hwnd, int msg, int point, int flags, IPoint2 m );
00312 };
00313
00314 class EP_VertWeldCMode : public CommandMode {
00315 public:
00316 ChangeFGObject fgProc;
00317 PatchObject *po;
00318 EP_VertWeldMouseProc proc;
00319
00320 EP_VertWeldCMode(PatchObject* mod, IObjParam *i) :
00321 fgProc((ReferenceTarget *)mod), proc(mod,i) {po=mod;}
00322 int Class() { return MODIFY_COMMAND; }
00323 int ID() { return CID_VERT_WELD; }
00324 MouseCallBack *MouseProc(int *numPoints) {*numPoints=2; return &proc;}
00325 ChangeForegroundCallback *ChangeFGProc() {return &fgProc;}
00326 BOOL ChangeFG(CommandMode *oldMode) {return oldMode->ChangeFGProc()!= &fgProc;}
00327 void EnterMode();
00328 void ExitMode();
00329 };
00330
00331
00332
00333
00334
00335 class EP_CopyTangentMouseProc : public MouseCallBack {
00336 private:
00337 PatchObject *po;
00338 IObjParam *ip;
00339
00340 protected:
00341 HCURSOR GetTransformCursor();
00342 HitRecord* HitTest( ViewExp *vpt, IPoint2 *p, int type, int flags );
00343
00344 public:
00345 EP_CopyTangentMouseProc(PatchObject* obj, IObjParam *i) { po=obj; ip=i; }
00346 int proc(
00347 HWND hwnd,
00348 int msg,
00349 int point,
00350 int flags,
00351 IPoint2 m );
00352 };
00353
00354 class EP_CopyTangentCMode : public CommandMode {
00355 private:
00356 ChangeFGObject fgProc;
00357 EP_CopyTangentMouseProc eproc;
00358 PatchObject* po;
00359
00360 public:
00361 EP_CopyTangentCMode(PatchObject* obj, IObjParam *i) :
00362 fgProc((ReferenceTarget*)obj), eproc(obj,i) {po=obj;}
00363
00364 int Class() { return MODIFY_COMMAND; }
00365 int ID() { return CID_COPY_TANGENT; }
00366 MouseCallBack *MouseProc(int *numPoints) { *numPoints=1; return &eproc; }
00367 ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00368 BOOL ChangeFG( CommandMode *oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00369 void EnterMode();
00370 void ExitMode();
00371 };
00372
00373 class EP_PasteTangentMouseProc : public MouseCallBack {
00374 private:
00375 PatchObject *po;
00376 IObjParam *ip;
00377
00378 protected:
00379 HCURSOR GetTransformCursor();
00380 HitRecord* HitTest( ViewExp *vpt, IPoint2 *p, int type, int flags );
00381
00382 public:
00383 EP_PasteTangentMouseProc(PatchObject* obj, IObjParam *i) { po=obj; ip=i; }
00384 int proc(
00385 HWND hwnd,
00386 int msg,
00387 int point,
00388 int flags,
00389 IPoint2 m );
00390 };
00391
00392 class EP_PasteTangentCMode : public CommandMode {
00393 private:
00394 ChangeFGObject fgProc;
00395 EP_PasteTangentMouseProc eproc;
00396 PatchObject* po;
00397
00398 public:
00399 EP_PasteTangentCMode(PatchObject* obj, IObjParam *i) :
00400 fgProc((ReferenceTarget*)obj), eproc(obj,i) {po=obj;}
00401
00402 int Class() { return MODIFY_COMMAND; }
00403 int ID() { return CID_PASTE_TANGENT; }
00404 MouseCallBack *MouseProc(int *numPoints) { *numPoints=1; return &eproc; }
00405 ChangeForegroundCallback *ChangeFGProc() { return &fgProc; }
00406 BOOL ChangeFG( CommandMode *oldMode ) { return oldMode->ChangeFGProc() != &fgProc; }
00407 void EnterMode();
00408 void ExitMode();
00409 };
00410
00411
00412
00413
00414 class POPickPatchAttach :
00415 public PickModeCallback,
00416 public PickNodeCallback {
00417 public:
00418 PatchObject *po;
00419
00420 POPickPatchAttach() {po=NULL;}
00421
00422 BOOL HitTest(IObjParam *ip,HWND hWnd,ViewExp *vpt,IPoint2 m,int flags);
00423 BOOL Pick(IObjParam *ip,ViewExp *vpt);
00424
00425 void EnterMode(IObjParam *ip);
00426 void ExitMode(IObjParam *ip);
00427
00428 HCURSOR GetHitCursor(IObjParam *ip);
00429
00430 BOOL Filter(INode *node);
00431
00432 PickNodeCallback *GetFilter() {return this;}
00433
00434 BOOL RightClick(IObjParam* ip,ViewExp* vpt) { UNUSED_PARAM(ip); UNUSED_PARAM(vpt); return TRUE;}
00435 };
00436
00437
00438 class SingleRefMakerPatchNode;
00439 class SingleRefMakerPatchMtl;
00440
00441 #pragma warning(push)
00442 #pragma warning(disable:4239)
00443
00444
00482 class PatchObject: public GeomObject, IPatchOps, IPatchSelect, IPatchSelectData, ISubMtlAPI, AttachMatDlgUser {
00483 friend class PatchObjectRestore;
00484 friend class POXFormProc;
00485 friend class POPickPatchAttach;
00486 public:
00487 static HWND hSelectPanel, hOpsPanel, hSurfPanel, hSoftSelPanel;
00488 static BOOL rsSel, rsOps, rsSurf;
00489 static MoveModBoxCMode *moveMode;
00490 static RotateModBoxCMode *rotMode;
00491 static UScaleModBoxCMode *uscaleMode;
00492 static NUScaleModBoxCMode *nuscaleMode;
00493 static SquashModBoxCMode *squashMode;
00494 static SelectModBoxCMode *selectMode;
00495
00496 static EP_BindCMode *bindMode;
00497
00498 static EP_ExtrudeCMode *extrudeMode;
00499 static EP_NormalFlipCMode *normalFlipMode;
00500 static EP_BevelCMode *bevelMode;
00501 static EP_CreateVertCMode *createVertMode;
00502 static EP_CreatePatchCMode *createPatchMode;
00503 static EP_VertWeldCMode *vertWeldMode;
00504
00505 static EP_CopyTangentCMode *copyTangentMode;
00506 static EP_PasteTangentCMode *pasteTangentMode;
00507
00508
00509 static BOOL settingViewportTess;
00510 static BOOL settingDisp;
00511 static ISpinnerControl *uSpin;
00512 static ISpinnerControl *vSpin;
00513 static ISpinnerControl *edgeSpin;
00514 static ISpinnerControl *angSpin;
00515 static ISpinnerControl *distSpin;
00516 static ISpinnerControl *mergeSpin;
00517 static ISpinnerControl *matSpin;
00518 static ISpinnerControl *matSpinSel;
00519
00520 static ISpinnerControl *weldSpin;
00521 static ISpinnerControl *targetWeldSpin;
00522 static ISpinnerControl *stepsSpin;
00523 #ifndef NO_OUTPUTRENDERER
00524
00525 static ISpinnerControl *stepsRenderSpin;
00526 #endif // NO_OUTPUTRENDERER
00527
00528 static ISpinnerControl *relaxSpin;
00529 static ISpinnerControl *relaxIterSpin;
00530
00531 static POPickPatchAttach pickCB;
00532 static BOOL patchUIValid;
00533 static BOOL opsUIValid;
00534 static int attachMat;
00535 static BOOL condenseMat;
00536
00537 static int pickBoxSize;
00538
00539 static int weldBoxSize;
00540
00541
00542 int loadRefVersion;
00543
00544 Interval geomValid;
00545 Interval topoValid;
00546 Interval texmapValid;
00547 Interval selectValid;
00548 ChannelMask validBits;
00549 void CopyValidity(PatchObject *fromOb, ChannelMask channels);
00550
00551
00552 RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message );
00553
00554 static IObjParam *ip;
00555 static PatchObject *editObj;
00556
00557 PatchMesh patch;
00558 int patchSelSubType;
00559
00560 MasterPointControl *masterCont;
00561 Tab<Control*> vertCont;
00562 Tab<Control*> vecCont;
00563
00564
00565 PatchMesh *rememberedPatch;
00566 int rememberedIndex;
00567 int rememberedData;
00568
00569
00570 BOOL doingHandles;
00571
00572 BOOL showMesh;
00573 BOOL propagate;
00574
00575 BOOL inExtrude,inBevel, inPatchCreate;
00576
00577 DWORD epFlags;
00578
00579
00580 BOOL copyTanLength;
00581 BOOL tangentCopied;
00582 Point3 copiedTangent;
00583
00584
00585 GenericNamedSelSetList hselSet;
00586 GenericNamedSelSetList vselSet;
00587 GenericNamedSelSetList eselSet;
00588 GenericNamedSelSetList pselSet;
00589
00590
00591 SingleRefMakerPatchNode* noderef;
00592 SingleRefMakerPatchMtl* mtlref;
00593
00595 CoreExport PatchObject();
00596 CoreExport PatchObject(PatchObject &from);
00597
00598 CoreExport void PatchObjectInit();
00599
00601 CoreExport ~PatchObject();
00602
00603
00604 CoreExport virtual bool RequiresSupportForLegacyDisplayMode() const;
00605 CoreExport virtual bool UpdateDisplay(
00606 unsigned long renderItemCategories,
00607 const MaxSDK::Graphics::MaterialRequiredStreams& materialRequiredStreams,
00608 TimeValue t);
00609
00610 CoreExport PatchObject &operator=(PatchObject &from);
00611
00612
00622 void SetFlag (DWORD fl, BOOL val=TRUE) { if (val) epFlags |= fl; else epFlags &= ~fl; }
00630 void ClearFlag (DWORD fl) { epFlags &= (~fl); }
00639 bool GetFlag (DWORD fl) { return (epFlags&fl) ? TRUE : FALSE; }
00640
00641
00642
00643
00644 CoreExport int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt);
00645 CoreExport int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc);
00646 CoreExport int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags);
00647 CoreExport void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt);
00648 CoreExport CreateMouseCallBack* GetCreateMouseCallBack();
00649 CoreExport RefTargetHandle Clone(RemapDir& remap);
00650
00651
00669 CoreExport int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags, ModContext *mc);
00686 CoreExport void GetWorldBoundBox (TimeValue t, INode * inode, ViewExp* vp, Box3& box, ModContext *mc);
00687
00688
00689 CoreExport int NumSubObjTypes();
00690 CoreExport ISubObjType *GetSubObjType(int i);
00691
00692
00693 CoreExport Interval ObjectValidity(TimeValue t);
00694 CoreExport BOOL GetExtendedProperties(TimeValue t, MSTR &prop1Label, MSTR &prop1Data, MSTR &prop2Label, MSTR &prop2Data);
00695 CoreExport BOOL PolygonCount(TimeValue t, int& numFaces, int& numVerts);
00696
00697
00698 CoreExport Interval ChannelValidity(TimeValue t, int nchan);
00699 CoreExport void SetChannelValidity(int i, Interval v);
00700 CoreExport void InvalidateChannels(ChannelMask channels);
00701 CoreExport void TopologyChanged();
00702
00703
00704 CoreExport Interval ConvertValidity(TimeValue t);
00705
00706
00707 virtual int IsDeformable() { return 1; }
00708 CoreExport int NumPoints();
00709 CoreExport Point3 GetPoint(int i);
00710 CoreExport void SetPoint(int i, const Point3& p);
00711 CoreExport BOOL IsPointSelected (int i);
00712
00713 CoreExport void PointsWereChanged();
00714 CoreExport void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm=NULL,BOOL useSel=FALSE );
00715 CoreExport void Deform(Deformer *defProc, int useSel);
00716
00717 virtual BOOL IsParamSurface() {return TRUE;}
00718 CoreExport Point3 GetSurfacePoint(TimeValue t, float u, float v,Interval &iv);
00719
00720
00721 virtual int IsMappable() { return 1; }
00722 virtual int NumMapChannels () { return patch.NumMapChannels (); }
00723 virtual int NumMapsUsed () { return patch.getNumMaps(); }
00724 virtual void ApplyUVWMap(int type, float utile, float vtile, float wtile,
00725 int uflip, int vflip, int wflip, int cap,const Matrix3 &tm,int channel=1) {
00726 patch.ApplyUVWMap(type,utile,vtile,wtile,uflip,vflip,wflip,cap,tm,channel); }
00727
00728 CoreExport int CanConvertToType(Class_ID obtype);
00729 CoreExport Object* ConvertToType(TimeValue t, Class_ID obtype);
00730 CoreExport void GetCollapseTypes(Tab<Class_ID> &clist,Tab<MSTR*> &nlist);
00731 CoreExport void FreeChannels(ChannelMask chan);
00732 CoreExport Object *MakeShallowCopy(ChannelMask channels);
00733 CoreExport void ShallowCopy(Object* fromOb, ChannelMask channels);
00734 CoreExport void NewAndCopyChannels(ChannelMask channels);
00735
00736 CoreExport DWORD GetSubselState();
00737
00738
00739 CoreExport int IntersectRay(TimeValue t, Ray& ray, float& at, Point3& norm);
00740 CoreExport void GetWorldBoundBox(TimeValue t, INode *inode, ViewExp* vpt, Box3& box );
00741 CoreExport void GetLocalBoundBox(TimeValue t, INode *inode, ViewExp* vpt, Box3& box );
00742 CoreExport int IsInstanceDependent();
00743 CoreExport Mesh* GetRenderMesh(TimeValue t, INode *inode, View& view, BOOL& needDelete);
00744
00745 CoreExport PatchMesh& GetPatchMesh(TimeValue t);
00746 CoreExport Mesh& GetMesh(TimeValue t);
00747
00748
00749
00750 CoreExport virtual void DeleteThis();
00751 virtual void FreeCaches() {patch.InvalidateGeomCache(); }
00752 virtual Class_ID ClassID() { return Class_ID(PATCHOBJ_CLASS_ID,0); }
00753 CoreExport BOOL IsSubClassOf(Class_ID classID);
00754 CoreExport virtual void GetClassName(MSTR& s);
00755
00756 using GeomObject::GetInterface;
00757 CoreExport void* GetInterface(ULONG id);
00758
00759
00760 CoreExport virtual MCHAR *GetObjectName();
00761
00762
00763 int NumSubs() { return 1; }
00764 CoreExport Animatable* SubAnim(int i);
00765 CoreExport MSTR SubAnimName(int i);
00766 CoreExport BOOL AssignController(Animatable *control,int subAnim);
00767 int SubNumToRefNum(int subNum) {return subNum;}
00768 CoreExport BOOL SelectSubAnim(int subNum);
00769 CoreExport BOOL HasControllers(BOOL assertCheck=TRUE);
00770
00771
00772 CoreExport void RescaleWorldUnits(float f);
00773 int NumRefs() {return vertCont.Count() + vecCont.Count() + 1;}
00774 CoreExport RefTargetHandle GetReference(int i);
00775 protected:
00776 CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);
00777 public:
00778 CoreExport int RemapRefOnLoad(int iref);
00779 CoreExport void PlugControllersSel(TimeValue t);
00780 CoreExport void AllocVertContArray(int count);
00781 CoreExport void AllocVecContArray(int count);
00782 CoreExport void AllocContArrays(int vertCount, int vecCount);
00783 CoreExport void ReplaceVertContArray(Tab<Control *> &nc);
00784 CoreExport void ReplaceVecContArray(Tab<Control *> &nc);
00785 CoreExport void ReplaceContArrays(Tab<Control *> &vertnc, Tab<Control *> &vecnc);
00786 CoreExport BOOL PlugVertControl(TimeValue t,int i);
00787 CoreExport BOOL PlugVecControl(TimeValue t,int i);
00788 CoreExport void SetVertAnim(TimeValue t, int point, Point3 pt);
00789 CoreExport void SetVecAnim(TimeValue t, int point, Point3 pt);
00790 CoreExport void SetVertCont(int i, Control *c);
00791 CoreExport void SetVecCont(int i, Control *c);
00792
00793
00794 CoreExport IOResult Save(ISave *isave);
00795 CoreExport IOResult Load(ILoad *iload);
00796
00797
00807 CoreExport virtual void UpdatePatchMesh(TimeValue t);
00814 CoreExport void PrepareMesh(TimeValue t);
00815 CoreExport Mesh& GetUnrelaxedMesh(TimeValue t);
00818 CoreExport BOOL ShowLattice() { return patch.GetDispFlag(DISP_LATTICE) ? TRUE : FALSE; }
00821 CoreExport BOOL ShowVerts() { return patch.GetDispFlag(DISP_VERTS) ? TRUE : FALSE; }
00826 CoreExport void SetShowLattice(BOOL sw) { if(sw) patch.SetDispFlag(DISP_LATTICE); else patch.ClearDispFlag(DISP_LATTICE); }
00831 CoreExport void SetShowVerts(BOOL sw) { if(sw) patch.SetDispFlag(DISP_VERTS); else patch.ClearDispFlag(DISP_VERTS); }
00836 CoreExport void SetMeshSteps(int steps);
00838 CoreExport int GetMeshSteps();
00839 #ifndef NO_OUTPUTRENDERER
00840
00847 CoreExport void SetMeshStepsRender(int steps);
00851 CoreExport int GetMeshStepsRender();
00852 #endif // NO_OUTPUTRENDERER
00853 CoreExport BOOL Relaxing();
00854 CoreExport void SetRelax(BOOL v);
00855 CoreExport void SetRelaxViewports(BOOL v);
00856 CoreExport void SetRelaxValue(float v);
00857 CoreExport void SetRelaxIter(int v);
00858 CoreExport void SetRelaxBoundary(BOOL v);
00859 CoreExport void SetRelaxSaddle(BOOL v);
00860 BOOL GetRelax() { return patch.GetRelax(); }
00861 BOOL GetRelaxViewports() { return patch.GetRelaxViewports(); }
00862 float GetRelaxValue() { return patch.GetRelaxValue(); }
00863 int GetRelaxIter() { return patch.GetRelaxIter(); }
00864 BOOL GetRelaxBoundary() { return patch.GetRelaxBoundary(); }
00865 BOOL GetRelaxSaddle() { return patch.GetRelaxSaddle(); }
00866
00873 CoreExport void SetShowInterior(BOOL si);
00877 CoreExport BOOL GetShowInterior();
00878
00879 CoreExport void SetUsePatchNormals(BOOL usePatchNorm);
00880 CoreExport BOOL GetUsePatchNormals();
00881
00886 CoreExport void SetAdaptive(BOOL sw);
00889 CoreExport BOOL GetAdaptive();
00896 CoreExport void SetViewTess(TessApprox tess);
00899 CoreExport TessApprox GetViewTess();
00906 CoreExport void SetProdTess(TessApprox tess);
00909 CoreExport TessApprox GetProdTess();
00915 CoreExport void SetDispTess(TessApprox tess);
00918 CoreExport TessApprox GetDispTess();
00921 CoreExport BOOL GetViewTessNormals();
00926 CoreExport void SetViewTessNormals(BOOL use);
00929 CoreExport BOOL GetProdTessNormals();
00935 CoreExport void SetProdTessNormals(BOOL use);
00938 CoreExport BOOL GetViewTessWeld();
00944 CoreExport void SetViewTessWeld(BOOL weld);
00947 CoreExport BOOL GetProdTessWeld();
00953 CoreExport void SetProdTessWeld(BOOL weld);
00955 CoreExport void InvalidateMesh();
00956 CoreExport void InvalidateRelaxedMesh();
00957
00958
00959 CoreExport virtual void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
00960 CoreExport virtual void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
00961 CoreExport int GetSubobjectLevel();
00969 CoreExport int GetSubobjectType();
00970 CoreExport void SetSubobjectLevel(int level);
00971 CoreExport void ActivateSubobjSel(int level, XFormModes& modes );
00972 CoreExport int SubObjectIndex(HitRecord *hitRec);
00973 CoreExport void GetSubObjectTMs(SubObjAxisCallback *cb,TimeValue t,INode *node,ModContext *mc);
00984 CoreExport void ShowEndResultChanged (BOOL showEndResult);
00985 CoreExport void GetSubObjectCenters(SubObjAxisCallback *cb,TimeValue t,INode *node,ModContext *mc);
00986 int NeedUseSubselButton() { return 0; }
00987 CoreExport void SelectSubComponent( HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert );
00988 CoreExport void ClearSelection(int selLevel);
00989 CoreExport void SelectAll(int selLevel);
00990 CoreExport void InvertSelection(int selLevel);
00991
00992 CoreExport void PatchSelChanged();
00993 CoreExport void InvalidateSurfaceUI();
00994 CoreExport void InvalidateOpsUI();
00995
00996 CoreExport void ChangeRememberedPatch(int type);
00997 CoreExport void ChangeSelPatches(int type);
00998 CoreExport int RememberPatchThere(HWND hWnd, IPoint2 m);
00999 CoreExport void SetRememberedPatchType(int type);
01000 CoreExport void ChangeRememberedVert(int type);
01001 CoreExport void ChangeSelVerts(int type);
01002 CoreExport int RememberVertThere(HWND hWnd, IPoint2 m);
01003 CoreExport void SetRememberedVertType(int type);
01004
01005
01006 CoreExport void XFormVerts( POXFormProc *xproc, TimeValue t, Matrix3& partm, Matrix3& tmAxis );
01007
01008
01009 CoreExport void XFormHandles( POXFormProc *xproc, TimeValue t, Matrix3& partm, Matrix3& tmAxis, int handleIndex );
01010
01011
01012 CoreExport void Move( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE );
01013 CoreExport void Rotate( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Quat& val, BOOL localOrigin=FALSE );
01014 CoreExport void Scale( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE );
01015
01016
01017 CoreExport void TransformStart(TimeValue t);
01018
01019
01020
01021 CoreExport void TransformFinish(TimeValue t);
01022
01023
01024
01025 CoreExport void TransformCancel(TimeValue t);
01026
01027 CoreExport ObjectState Eval(TimeValue t);
01028
01029 BOOL SupportsNamedSubSels() {return TRUE;}
01030 CoreExport void ActivateSubSelSet(MSTR &setName);
01031 CoreExport void NewSetFromCurSel(MSTR &setName);
01032 CoreExport void RemoveSubSelSet(MSTR &setName);
01033 CoreExport void SetupNamedSelDropDown();
01034 CoreExport int NumNamedSelSets();
01035 CoreExport MSTR GetNamedSelSetName(int i);
01036 CoreExport void SetNamedSelSetName(int i,MSTR &newName);
01037 CoreExport void NewSetByOperator(MSTR &newName,Tab<int> &sets,int op);
01038 CoreExport BOOL GetUniqueSetName(MSTR &name);
01039 CoreExport int SelectNamedSet();
01040 CoreExport void NSCopy();
01041 CoreExport void NSPaste();
01042 CoreExport GenericNamedSelSetList &GetSelSet();
01043
01044 CoreExport void RefreshSelType();
01045 CoreExport void SetNumSelLabel();
01046 CoreExport void SetSelDlgEnables();
01047 CoreExport void SetOpsDlgEnables();
01048 CoreExport void SetSurfDlgEnables();
01049 CoreExport void SetSoftSelDlgEnables( HWND hSoftSel = NULL );
01050
01051
01052 CoreExport int GetAttachMat();
01053 CoreExport void SetAttachMat(int value);
01054 CoreExport BOOL GetCondenseMat();
01055 CoreExport void SetCondenseMat(BOOL sw);
01056
01057 CoreExport void DoAttach(INode *node, PatchMesh *attPatch, bool & canUndo);
01058 CoreExport void SetTessUI(HWND hDlg, TessApprox *tess);
01059
01060
01071 CoreExport void DoDeleteSelected(BOOL interactive=TRUE);
01090 CoreExport void DoBreak(BOOL interactive=TRUE);
01091 CoreExport void ResolveTopoChanges();
01092 CoreExport void DeletePatchParts(BitArray &delVerts, BitArray &delPatches);
01093
01094 CoreExport void CreateContArrays();
01095 CoreExport void SynchContArrays();
01096
01097 CoreExport int GetSelMatIndex();
01098 CoreExport void SetSelMatIndex(int index);
01099 CoreExport void SelectByMat(int index,BOOL clear);
01100
01101 CoreExport DWORD GetSelSmoothBits(DWORD &invalid);
01102 CoreExport DWORD GetUsedSmoothBits();
01103 CoreExport void SelectBySmoothGroup(DWORD bits,BOOL clear);
01104 CoreExport void SetSelSmoothBits(DWORD bits,DWORD which);
01105
01106 CoreExport void SetPropagate(BOOL sw);
01107 CoreExport BOOL GetPropagate();
01108 CoreExport void DoPatchAdd(int type);
01109 CoreExport void DoSubdivide(int level);
01110 CoreExport void DoPatchDetach(int copy, int reorient);
01111
01112 CoreExport void DoVertWeld();
01113 CoreExport void DoVertWeld(int fromVert, int toVert);
01121 CoreExport void DoEdgeWeld();
01122
01123 CoreExport void StartCopyTangentMode();
01124 CoreExport void StartPasteTangentMode();
01125 CoreExport void StartPasteTangent();
01126 CoreExport void EndPasteTangent();
01127
01128 CoreExport BOOL CopyTangent(int vec);
01129 CoreExport BOOL PasteTangent(int vec);
01130
01131
01132 CoreExport void DoHide(int type) ;
01133 CoreExport void DoUnHide();
01134 CoreExport void DoPatchHide();
01135 CoreExport void DoVertHide();
01136 CoreExport void DoEdgeHide();
01137
01138 CoreExport void DoAddHook(int vert1, int seg1) ;
01139 CoreExport void DoRemoveHook() ;
01140
01149 CoreExport void DoExtrude(TimeValue t) ;
01150 CoreExport void BeginExtrude(TimeValue t);
01151 CoreExport void EndExtrude (TimeValue t, BOOL accept=TRUE);
01152 CoreExport void Extrude( TimeValue t, float amount, BOOL useLocalNorm );
01153
01169 CoreExport void DoFlipNormals(int patchIndex = -1);
01183 CoreExport void DoUnifyNormals();
01184
01193 CoreExport void DoBevel(TimeValue t) ;
01194 CoreExport void BeginBevel(TimeValue t);
01195 CoreExport void EndBevel (TimeValue t, BOOL accept=TRUE);
01196 CoreExport void Bevel( TimeValue t, float amount, BOOL smoothStart, BOOL smoothEnd );
01197
01198
01199 CoreExport void DoPatchSmooth(int type);
01200
01201
01202 CoreExport void CreateVertex(Point3 pt, int& newIndex);
01203 CoreExport void CreatePatch(int vertIndx1,int vertIndx2,int vertIndx3);
01204 CoreExport void CreatePatch(int vertIndx1,int vertIndx2,int vertIndx3,int vertIndx4);
01205
01206
01207 CoreExport void StartCommandMode(patchCommandMode mode);
01208 CoreExport void ButtonOp(patchButtonOp opcode);
01209
01210
01211
01223 CoreExport void GetUIParam (patchUIParam uiCode, int & ret);
01235 CoreExport void SetUIParam (patchUIParam uiCode, int val);
01247 CoreExport void GetUIParam (patchUIParam uiCode, float & ret);
01259 CoreExport void SetUIParam (patchUIParam uiCode, float val);
01266 bool Editing () { return (ip && (editObj==this)) ? TRUE : FALSE; }
01267
01268 CoreExport DWORD GetSelLevel();
01269 CoreExport void SetSelLevel(DWORD level);
01270 CoreExport void LocalDataChanged();
01271
01272 CoreExport BitArray GetVecSel();
01273 CoreExport BitArray GetVertSel();
01274 CoreExport BitArray GetEdgeSel();
01275 CoreExport BitArray GetPatchSel();
01276
01277 CoreExport void SetVecSel(BitArray &set, IPatchSelect *imod, TimeValue t);
01278 CoreExport void SetVertSel(BitArray &set, IPatchSelect *imod, TimeValue t);
01279 CoreExport void SetEdgeSel(BitArray &set, IPatchSelect *imod, TimeValue t);
01280 CoreExport void SetPatchSel(BitArray &set, IPatchSelect *imod, TimeValue t);
01281
01282 CoreExport GenericNamedSelSetList& GetNamedVecSelList();
01283 CoreExport GenericNamedSelSetList& GetNamedVertSelList();
01284 CoreExport GenericNamedSelSetList& GetNamedEdgeSelList();
01285 CoreExport GenericNamedSelSetList& GetNamedPatchSelList();
01286
01287
01301 CoreExport Color GetVertColor(int mp=0, bool *differs=NULL);
01310 CoreExport void SetVertColor(Color clr, int mp=0);
01332 CoreExport void SelectVertByColor(VertColor clr, int deltaR, int deltaG, int deltaB, BOOL add, BOOL sub, int mp=0);
01333
01347 CoreExport Color GetPatchColor(int mp=0, bool *differs=NULL);
01356 CoreExport void SetPatchColor(Color clr, int mp=0);
01357
01358
01359 CoreExport MtlID GetNextAvailMtlID(ModContext* mc);
01360 CoreExport BOOL HasFaceSelection(ModContext* mc);
01361 CoreExport void SetSelFaceMtlID(ModContext* mc, MtlID id, BOOL bResetUnsel = FALSE);
01362 CoreExport int GetSelFaceUniqueMtlID(ModContext* mc);
01363 CoreExport int GetSelFaceAnyMtlID(ModContext* mc);
01364 CoreExport int GetMaxMtlID(ModContext* mc);
01365
01374 CoreExport void ChangeMappingTypeLinear(BOOL linear);
01375
01376
01377 CoreExport void ShrinkSelection(int type);
01378 CoreExport void GrowSelection(int type);
01379 CoreExport void SelectEdgeRing();
01380 CoreExport void SelectEdgeLoop();
01381
01386 CoreExport void SelectOpenEdges();
01393 CoreExport void DoCreateShape();
01394
01395
01396
01397 CoreExport int UseEdgeDists();
01398 CoreExport void SetUseEdgeDists( int useSoftSelections );
01399 CoreExport int UseSoftSelections();
01400 CoreExport void SetUseSoftSelections( int useSoftSelections );
01401 CoreExport void InvalidateVertexWeights();
01402
01403 CoreExport void ToggleShadedFaces();
01404
01405 CoreExport void UpdateVertexDists();
01406 CoreExport void UpdateEdgeDists( );
01407 CoreExport void UpdateVertexWeights();
01408
01409 CoreExport Point3 VertexNormal( int vIndex );
01410
01411 };
01412
01413 #pragma warning(pop)
01414
01415 CoreExport ClassDesc* GetPatchObjDescriptor();
01416
01417
01418
01419 class POModRecord: public MaxHeapOperators {
01420 public:
01421 virtual ~POModRecord(){}
01422 virtual BOOL Restore(PatchObject *po, BOOL isUndo)=0;
01423 virtual BOOL Redo(PatchObject *po)=0;
01424 virtual DWORD Parts()=0;
01425 };
01426
01427 class PatchObjectRestore : public RestoreObj {
01428 public:
01429 POModRecord *rec;
01430 PatchObject *po;
01431
01432 PatchObjectRestore(PatchObject *po, POModRecord *rec);
01433 virtual ~PatchObjectRestore();
01434
01435 void Restore(int isUndo);
01436 void Redo();
01437 int Size() { return 1; }
01438 void EndHold() {po->ClearAFlag(A_HELD);}
01439 MSTR Description() { return MSTR(_M("PatchObject restore")); }
01440 };
01441
01442 class SingleRefMakerPatchNode : public SingleRefMaker{
01443 public:
01444 HWND hwnd;
01445 PatchObject *po;
01446 SingleRefMakerPatchNode() {hwnd = NULL; po = NULL;}
01447 ~SingleRefMakerPatchNode() { }
01448 RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget,
01449 PartID& partID, RefMessage message );
01450 };
01451
01452 class SingleRefMakerPatchMtl : public SingleRefMaker{
01453 public:
01454 HWND hwnd;
01455 PatchObject *po;
01456 SingleRefMakerPatchMtl() {hwnd = NULL; po = NULL;}
01457 ~SingleRefMakerPatchMtl() { }
01458 RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget,
01459 PartID& partID, RefMessage message );
01460 };
01461
01462
01463 #define ID_PATCH_MENU 1333
01464
01465 const DWORD kPatchActions = 0x34fe4c77;
01466 const DWORD kPatchActionsContext = 0x34fe4c77;
01467