00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #pragma once
00016 #include <WTypes.h>
00017 #include "maxheap.h"
00018 #include "ISkinCodes.h"
00019 #include "point3.h"
00020 #include "strbasic.h"
00021 #include "tab.h"
00022 #include "maxtypes.h"
00023 #include "ref.h"
00024 #include "iparamb2.h"
00025 #include "matrix3.h"
00026
00027
00028 class INode;
00029 class Matrix3;
00030 class BitArray;
00031 class ViewExp;
00032 class Box3;
00033 class ModContext;
00034 class GraphicsWindow;
00035 class HitRecord;
00036 class SubObjAxisCallback;
00037
00038 #define I_SKIN 0x00010000
00039 #define I_SKINIMPORTDATA 0x00020000
00040
00041
00042 #define I_SKIN2 0x00030000
00043
00044 #define I_GIZMO 9815854
00045
00046 #define I_GIZMO2 9815855
00047
00048 #define I_GIZMO3 9815856
00049
00050 #define SKIN_INVALID_NODE_PTR 0
00051 #define SKIN_OK 1
00052
00053
00054 #define SKIN_CLASSID Class_ID(9815843,87654)
00055
00056 #pragma warning(push)
00057 #pragma warning(disable:4100)
00058
00059
00067 class ISkinContextData: public MaxHeapOperators
00068 {
00069 public:
00071 virtual ~ISkinContextData() {}
00074 virtual int GetNumPoints()=0;
00080 virtual int GetNumAssignedBones(int vertexIdx)=0;
00088 virtual int GetAssignedBone(int vertexIdx, int boneIdx)=0;
00095 virtual float GetBoneWeight(int vertexIdx, int boneIdx)=0;
00096
00097
00105 virtual int GetSubCurveIndex(int vertexIdx, int boneIdx)=0;
00113 virtual int GetSubSegmentIndex(int vertexIdx, int boneIdx)=0;
00121 virtual float GetSubSegmentDistance(int vertexIdx, int boneIdx)=0;
00128 virtual Point3 GetTangent(int vertexIdx, int boneIdx)=0;
00136 virtual Point3 GetOPoint(int vertexIdx, int boneIdx)=0;
00137
00138 };
00139
00144 class ISkin: public MaxHeapOperators
00145 {
00146 public:
00148 virtual ~ISkin() {}
00161 virtual int GetBoneInitTM(INode *pNode, Matrix3 &InitTM, bool bObjOffset = false)=0;
00174 virtual int GetSkinInitTM(INode *pNode, Matrix3 &InitTM, bool bObjOffset = false)=0;
00177 virtual int GetNumBones()=0;
00185 virtual INode *GetBone(int idx)=0;
00209 virtual DWORD GetBoneProperty(int idx)=0;
00215 virtual ISkinContextData *GetContextInterface(INode *pNode)=0;
00216
00224 virtual MCHAR *GetBoneName(int index) = 0;
00226 virtual int GetSelectedBone() = 0;
00228 virtual void UpdateGizmoList() = 0;
00241 virtual void GetEndPoints(int id, Point3 &l1, Point3 &l2) = 0;
00246 virtual Matrix3 GetBoneTm(int id) = 0;
00254 virtual INode *GetBoneFlat(int idx)=0;
00257 virtual int GetNumBonesFlat()=0;
00259 virtual int GetRefFrame()=0;
00260
00261 };
00262
00263
00264
00265
00266
00267
00268
00269
00278 class ISkinImportData: public MaxHeapOperators
00279 {
00280 public:
00281
00283 virtual ~ISkinImportData() {}
00284
00285
00286
00287
00288
00289
00290
00291
00302 virtual BOOL AddBoneEx(INode *boneNode, BOOL update)=0;
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00336 virtual BOOL SetSkinTm(INode *skinNode, Matrix3 objectTm, Matrix3 nodeTm)=0;
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00371 virtual BOOL SetBoneTm(INode *boneNode, Matrix3 objectTm, Matrix3 nodeTm)=0;
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00400 virtual BOOL AddWeights(INode* skinNode, int vertexID, Tab<INode*>& boneNodeList, Tab<float>& weights)=0;
00401 };
00402
00403
00404
00405
00406
00407
00408
00409
00419 class ISkin2: public MaxHeapOperators
00420 {
00421 public:
00423 virtual ~ISkin2() {}
00431 virtual BOOL SetBoneStretchTm(INode *boneNode, Matrix3 stretchTm)=0;
00432
00436 virtual Matrix3 GetBoneStretchTm(INode *boneNode)=0;
00437
00441 virtual void GetVertexSelection(INode *skinNode, BitArray &sel) = 0;
00442
00446 virtual void SetVertexSelection(INode *skinNode, BitArray &sel) = 0;
00447 };
00448
00457 class IGizmoBuffer: public MaxHeapOperators
00458 {
00459 public:
00460 Class_ID cid;
00462 virtual ~IGizmoBuffer() {}
00466 virtual void DeleteThis()=0;
00467
00468 };
00469
00470
00492 class GizmoClass : public ReferenceTarget
00493 {
00494
00495 public:
00496
00497 ISkin *bonesMod;
00498 IParamBlock2 *pblock_gizmo_data;
00499
00500 GizmoClass() { pblock_gizmo_data = NULL; bonesMod = NULL; }
00504 int NumParamBlocks() { return 1; }
00510 IParamBlock2* GetParamBlock(int i)
00511 {
00512 if (i == 0) return pblock_gizmo_data;
00513 else return NULL;
00514 }
00520 IParamBlock2* GetParamBlockByID(BlockID id)
00521 {
00522 if (pblock_gizmo_data->ID() == id) return pblock_gizmo_data ;
00523 else return NULL;
00524 }
00525
00526 int NumRefs() {return 1;}
00527 RefTargetHandle GetReference(int i)
00528 {
00529 if (i==0)
00530 {
00531 return (RefTargetHandle)pblock_gizmo_data;
00532 }
00533 return NULL;
00534 }
00535
00536 protected:
00537 virtual void SetReference(int i, RefTargetHandle rtarg)
00538 {
00539 if (i==0)
00540 {
00541 pblock_gizmo_data = (IParamBlock2*)rtarg;
00542 }
00543 }
00544 public:
00546 void DeleteThis()=0;
00547
00548
00549 int NumSubs() {return 1;}
00550 Animatable* SubAnim(int i) { return GetReference(i);}
00551
00552
00553 MSTR SubAnimName(int i) {return _M(""); }
00554
00555 int SubNumToRefNum(int subNum) {return -1;}
00556
00557 RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget,
00558 PartID& partID, RefMessage message)
00559 {
00560 return REF_SUCCEED;
00561 }
00562
00563 virtual void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev) {}
00564 virtual void EndEditParams(IObjParam *ip,ULONG flags,Animatable *next) {}
00565 virtual IOResult Load(ILoad *iload) {return IO_OK;}
00566 virtual IOResult Save(ISave *isave) {return IO_OK;}
00567
00568
00569
00570
00571 virtual void GetWorldBoundBox(TimeValue t,INode* inode, ViewExp *vpt, Box3& box, ModContext *mc){}
00572
00573 virtual int Display(TimeValue t, GraphicsWindow *gw, Matrix3 tm ) { return 1;}
00574 virtual Interval LocalValidity(TimeValue t) {return FOREVER;}
00578 virtual BOOL IsEnabled() { return TRUE; }
00584 virtual BOOL IsVolumeBased() {return FALSE;}
00594 virtual BOOL IsInVolume(Point3 p, Matrix3 tm) { return FALSE;}
00595
00596
00597
00616 virtual Point3 DeformPoint(TimeValue t, int index, Point3 initialP, Point3 p, Matrix3 tm)
00617 {return p;}
00618
00622 virtual void SetInitialName() {}
00623
00627 virtual const MCHAR *GetName(){return NULL;}
00628
00635 virtual void SetName(const MCHAR *name) {}
00636
00638 virtual void SetName(MCHAR *name) { SetName(const_cast<const MCHAR*>(name)); }
00639
00640
00641
00642
00643
00644
00645
00665 virtual BOOL InitialCreation(int count, Point3 *p, int numbeOfInstances, int *mapTable) { return TRUE;}
00666
00667
00675 virtual void PreDeformSetup(TimeValue t) {}
00683 virtual void PostDeformSetup(TimeValue t) {}
00684
00690 virtual IGizmoBuffer *CopyToBuffer() { return NULL;}
00699 virtual void PasteFromBuffer(IGizmoBuffer *buffer) {}
00700
00707 virtual void Enable(BOOL enable) {}
00714 virtual BOOL IsEditing() { return FALSE;}
00718 virtual void EndEditing() {}
00728 virtual void EnableEditing(BOOL enable) {}
00729
00730
00758 virtual int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc, Matrix3 tm) {return 0;}
00780 virtual void SelectSubComponent(HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert=FALSE) {}
00806 virtual void Move( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, Matrix3 tm, BOOL localOrigin=FALSE ) {}
00826 virtual void GetSubObjectCenters(SubObjAxisCallback *cb,TimeValue t,INode *node, Matrix3 tm) {}
00847 virtual void GetSubObjectTMs(SubObjAxisCallback *cb,TimeValue t,INode *node, Matrix3 tm) {}
00856 virtual void ClearSelection(int selLevel) {}
00865 virtual void SelectAll(int selLevel) {}
00875 virtual void InvertSelection(int selLevel) {}
00876 };
00877
00878 #pragma warning(pop)
00879
00880
00881
00882 class IGizmoClass2: public MaxHeapOperators
00883 {
00884 public:
00885 virtual ~IGizmoClass2() {}
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896 virtual void SetBackTransFormMatrices(Matrix3 removeDoubleTransform, Matrix3 putbackDoubleTransform) = 0;
00897 };
00898
00899
00900
00901 class IGizmoClass3: public MaxHeapOperators
00902 {
00903 public:
00904 virtual ~IGizmoClass3() {}
00905
00906
00907 virtual void ResetRotationPlane()=0;
00908 };
00909
00910