Skip to content
Snippets Groups Projects
Commit fd38a5c8 authored by Gundalf's avatar Gundalf
Browse files

set/write all known havok values

parent 2278d6e7
No related branches found
No related tags found
No related merge requests found
......@@ -62,12 +62,25 @@ bool Exporter::makeCollisionHierarchy(NiNodeRef &parent, INode *node, TimeValue
Mesh *mesh = &tri->GetMesh();
mesh->buildNormals();
int lyr, mtl;
if (!npGetProp(node, NP_HVK_LAYER, lyr))
lyr = NP_DEFAULT_HVK_LAYER;
// get data from node
int lyr, mtl, msys, qtype;
float mass, lindamp, angdamp, frict, maxlinvel, maxangvel, resti, pendepth;
Vector3 center;
npGetProp(node, NP_HVK_LAYER, lyr, NP_DEFAULT_HVK_LAYER);
npGetProp(node, NP_HVK_MATERIAL, mtl, NP_DEFAULT_HVK_MATERIAL);
npGetProp(node, NP_HVK_MOTION_SYSTEM, msys, NP_DEFAULT_HVK_MOTION_SYSTEM);
npGetProp(node, NP_HVK_QUALITY_TYPE, qtype, NP_DEFAULT_HVK_QUALITY_TYPE);
npGetProp(node, NP_HVK_MASS, mass, NP_DEFAULT_HVK_MASS);
npGetProp(node, NP_HVK_LINEAR_DAMPING, lindamp, NP_DEFAULT_HVK_LINEAR_DAMPING);
npGetProp(node, NP_HVK_ANGULAR_DAMPING, angdamp, NP_DEFAULT_HVK_ANGULAR_DAMPING);
npGetProp(node, NP_HVK_FRICTION, frict, NP_DEFAULT_HVK_FRICTION);
npGetProp(node, NP_HVK_RESTITUTION, resti, NP_DEFAULT_HVK_RESTITUTION);
npGetProp(node, NP_HVK_MAX_LINEAR_VELOCITY, maxlinvel, NP_DEFAULT_HVK_MAX_LINEAR_VELOCITY);
npGetProp(node, NP_HVK_MAX_ANGULAR_VELOCITY, maxangvel, NP_DEFAULT_HVK_MAX_ANGULAR_VELOCITY);
npGetProp(node, NP_HVK_PENETRATION_DEPTH, pendepth, NP_DEFAULT_HVK_PENETRATION_DEPTH);
npGetProp(node, NP_HVK_CENTER, center);
if (!npGetProp(node, NP_HVK_MATERIAL, mtl))
mtl = NP_DEFAULT_HVK_LAYER;
// setup shape data
vector<Vector3> verts;
......@@ -122,9 +135,19 @@ bool Exporter::makeCollisionHierarchy(NiNodeRef &parent, INode *node, TimeValue
body->SetRotation(q);
body->SetTranslation(Vector3(trans.x/7, trans.y/7, trans.z/7));
body->SetLayer(lyr);
body->SetLayerCopy(lyr);
body->SetMotionSystem(msys);
body->SetQualityType(qtype);
body->SetMass(mass);
body->SetLinearDamping(lindamp);
body->SetAngularDamping(angdamp);
body->SetFriction(frict);
body->SetRestitution(resti);
body->SetMaxLinearVelocity(maxlinvel);
body->SetMaxAngularVelocity(maxangvel);
body->SetPenetrationDepth(pendepth);
body->SetCenter(center);
// link
parent->SetCollisionObject(DynamicCast<NiCollisionObject>(co));
......
......@@ -58,8 +58,6 @@ Exporter::Result Exporter::exportTree(NiNodeRef &parent, INode *node)
parent->AddChild(DynamicCast<NiAVObject>(n));
parent = n;
// fprintf(pStream,"%s%s \"%s\" {\n", indent.data(), ID_GROUP, FixupName(node->GetName()));
// indentLevel++;
}
......
......@@ -84,6 +84,8 @@ private:
void nodeTransform(QuaternionXYZW &rot, Vector3 &trans, INode *node, TimeValue t, bool local=true);
Point3 getVertexNormal(Mesh* mesh, int faceNo, RVertex* rv);
bool equal(const Vector3 &a, const Point3 &b, float thresh);
BitmapTex *getTexture(Mtl *mtl);
void getTextureMatrix(Matrix3 &mat, Mtl *mtl);
/* tristrips */
void strippify(TriStrips &strips, vector<Vector3> &verts, vector<Vector3> &norms, const Triangles &tris);
......@@ -96,13 +98,11 @@ private:
int addVertex(FaceGroup &grp, int face, int vi, Mesh *mesh, const Matrix3 &texm);
// adds a face to a face group
void addFace(FaceGroup &grp, int face, const int vi[3], Mesh *mesh, const Matrix3 &texm);
// returns true if at least one of the colors in the group has a value != (1, 1, 1, 1)
bool hasVertexColors(FaceGroup &grp);
// creates face groups from faces with same sub material id
bool splitMesh(INode *node, Mesh *, FaceGroups &grps, TimeValue t);
// creates a NiTriStrips or NiTriShape hierarchy from a face group
bool makeMesh(NiNodeRef &parent, Mtl *mtl, FaceGroup &grp);
// splits mesh and makes and converts it into nif blocks
// splits mesh and converts it into nif blocks
Result exportMesh(NiNodeRef &parent, INode *node, TimeValue t);
/* texture & material */
......@@ -110,8 +110,6 @@ private:
void makeTexture(NiAVObjectRef &parent, Mtl *mtl);
// creates a NiMaterialProperty
void makeMaterial(NiAVObjectRef &parent, Mtl *mtl);
BitmapTex *getTexture(Mtl *mtl);
void getTextureMatrix(Matrix3 &mat, Mtl *mtl);
/* havok & collision */
int addVertex(vector<Vector3> &verts, vector<Vector3> &vnorms, const Point3 &pt, const Point3 &norm);
......
......@@ -22,14 +22,7 @@ Exporter::Result Exporter::exportMesh(NiNodeRef &parent, INode *node, TimeValue
Mesh *mesh = &tri->GetMesh();
mesh->buildNormals();
/*
Matrix3 pm = node->GetParentTM(t);
pm.Invert();
Matrix3 tm = node->GetObjTMAfterWSM(t) * pm;
Matrix33 rot;
convertMatrix(rot, tm);
Vector3 trans(tm.GetTrans().x, tm.GetTrans().y, tm.GetTrans().z);
*/
Matrix33 rot;
Vector3 trans;
nodeTransform(rot, trans, node, t);
......@@ -65,7 +58,7 @@ Exporter::Result Exporter::exportMesh(NiNodeRef &parent, INode *node, TimeValue
}
if (alloc)
delete tri;
tri->DeleteMe();
return result;
}
......@@ -74,6 +67,7 @@ bool Exporter::makeMesh(NiNodeRef &parent, Mtl *mtl, FaceGroup &grp)
{
NiTriBasedGeomRef shape;
NiTriBasedGeomDataRef data;
if (mTriStrips)
{
NiTriStripsRef stripsShape = DynamicCast<NiTriStrips>(CreateBlock("NiTriStrips"));
......@@ -164,22 +158,7 @@ void Exporter::addFace(FaceGroup &grp, int face, const int vi[3], Mesh *mesh, co
{
Triangle tri;
for (int i=0; i<3; i++)
{
/* DWORD t0 = mesh->tvFace[ face ].getTVert(0);
DWORD t1 = mesh->tvFace[ face ].getTVert(1);
DWORD t2 = mesh->tvFace[ face ].getTVert(2);
int dir = mesh->tvFace[ face ].Direction(t0, t1);
*/
/* Point3 tv = mesh->verts[ mesh->faces[ face ].v[ vi[i] ] ]; // * tm;
tri[i] = addVertex(grp,
tv,
mesh->tVerts[ mesh->tvFace[ face ].t[ vi[i] ]],
getVertexNormal(mesh, face, mesh->getRVertPtr(mesh->faces[ face ].v[ vi[i] ])));
*/
tri[i] = addVertex(grp, face, vi[i], mesh, texm);
}
grp.faces.push_back(tri);
}
......@@ -204,6 +183,10 @@ bool Exporter::splitMesh(INode *node, Mesh *mesh, FaceGroups &grps, TimeValue t)
vi[2] = 2;
}
Matrix3 flip;
flip.IdentityMatrix();
flip.Scale(Point3(1, -1, 1));
int i, numSubMtls = nodeMtl?nodeMtl->NumSubMtls():0;
for (i=0; i<mesh->getNumFaces(); i++)
{
......@@ -212,9 +195,6 @@ bool Exporter::splitMesh(INode *node, Mesh *mesh, FaceGroups &grps, TimeValue t)
Matrix3 texm;
getTextureMatrix(texm, getMaterial(node, mtlID));
Matrix3 flip;
flip.IdentityMatrix();
flip.Scale(Point3(1, -1, 1));
texm *= flip;
addFace(grps[mtlID], i, vi, mesh, texm);
......
#include "pch.h"
#include "stdmat.h"
BitmapTex *Exporter::getTexture(Mtl *mtl)
{
if (!mtl)
return NULL;
int texMaps = mtl->NumSubTexmaps();
if (!texMaps)
return NULL;
BitmapTex *bmTex = NULL;
for (int i=0; i<texMaps; i++)
{
Texmap *texMap = mtl->GetSubTexmap(i);
if (!texMap)
continue;
if (texMap->ClassID() == Class_ID(BMTEX_CLASS_ID, 0))
{
bmTex = (BitmapTex*)texMap;
break;
}
}
return bmTex;
}
void Exporter::getTextureMatrix(Matrix3 &mat, Mtl *mtl)
{
BitmapTex *tex = getTexture(mtl);
if (tex)
tex->GetUVTransform(mat);
else
mat.IdentityMatrix();
}
void Exporter::makeTexture(NiAVObjectRef &parent, Mtl *mtl)
{
BitmapTex *bmTex = getTexture(mtl);
......@@ -125,3 +90,38 @@ Mtl *Exporter::getMaterial(INode *node, int subMtl)
}
return NULL;
}
BitmapTex *Exporter::getTexture(Mtl *mtl)
{
if (!mtl)
return NULL;
int texMaps = mtl->NumSubTexmaps();
if (!texMaps)
return NULL;
BitmapTex *bmTex = NULL;
for (int i=0; i<texMaps; i++)
{
Texmap *texMap = mtl->GetSubTexmap(i);
if (!texMap)
continue;
if (texMap->ClassID() == Class_ID(BMTEX_CLASS_ID, 0))
{
bmTex = (BitmapTex*)texMap;
break;
}
}
return bmTex;
}
void Exporter::getTextureMatrix(Matrix3 &mat, Mtl *mtl)
{
BitmapTex *tex = getTexture(mtl);
if (tex)
tex->GetUVTransform(mat);
else
mat.IdentityMatrix();
}
......@@ -300,7 +300,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="D:\code\NifExport\niflib;d:\3dsmax6\maxsdk\include"
AdditionalIncludeDirectories="D:\code\MaxPlugins\NifExport\niflib;d:\3dsmax6\maxsdk\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
StringPooling="TRUE"
RuntimeLibrary="2"
......
......@@ -20,6 +20,7 @@ void Exporter::strippify(TriStrips &strips, vector<Vector3> &verts, vector<Vecto
// triangles left over
Triangles stris;
for (i=0; i<groups.size(); i++)
{
if (groups[i].m_Type == tri_stripper::PT_Triangle_Strip)
......
......@@ -52,3 +52,57 @@ void bhkRigidBody::SetLayerCopy(int l)
layerCopy_ = l;
}
void bhkRigidBody::SetCenter(const Vector3 &v)
{
center = v;
}
void bhkRigidBody::SetMass(float f)
{
mass = f;
}
void bhkRigidBody::SetLinearDamping(float f)
{
linearDamping = f;
}
void bhkRigidBody::SetAngularDamping(float f)
{
angularDamping = f;
}
void bhkRigidBody::SetFriction(float f)
{
friction = f;
}
void bhkRigidBody::SetRestitution(float f)
{
restitution = f;
}
void bhkRigidBody::SetMaxLinearVelocity(float f)
{
maxLinearVelocity = f;
}
void bhkRigidBody::SetMaxAngularVelocity(float f)
{
maxAngularVelocity = f;
}
void bhkRigidBody::SetPenetrationDepth(float f)
{
penDepth = f;
}
void bhkRigidBody::SetMotionSystem(int i)
{
motionSystem_ = i;
}
void bhkRigidBody::SetQualityType(int i)
{
qualityType = i;
}
......@@ -41,7 +41,18 @@ public:
void SetTranslation(const Vector3 &v);
void SetRotation(const QuaternionXYZW &q);
void SetLayerCopy(int l);
void SetLayerCopy(int l);
void SetCenter(const Vector3 &v);
void SetMass(float f);
void SetLinearDamping(float f);
void SetAngularDamping(float f);
void SetFriction(float f);
void SetRestitution(float f);
void SetMaxLinearVelocity(float f);
void SetMaxAngularVelocity(float f);
void SetPenetrationDepth(float f);
void SetMotionSystem(int i);
void SetQualityType(int i);
protected:
BHK_RIGID_BODY_MEMBERS
......
......@@ -12,9 +12,24 @@ void npSetCollision(INode *node, bool coll)
npSetProp(node, NP_HASCOLL, (bool)coll);
}
bool npGetProp(INode *node, const TSTR &prop, int &value)
bool npGetProp(INode *node, const TSTR &prop, int &value, int def)
{
return node && node->GetUserPropInt(prop, value);
bool ret;
if (node)
{
if (!node->GetUserPropInt(prop, value))
{
value = def;
ret = false;
} else
ret = true;
} else
{
value = def;
ret = false;
}
return ret;
}
void npSetProp(INode *node, const TSTR &prop, int value)
......@@ -23,9 +38,24 @@ void npSetProp(INode *node, const TSTR &prop, int value)
node->SetUserPropInt(prop, value);
}
bool npGetProp(INode *node, const TSTR &prop, float &value)
bool npGetProp(INode *node, const TSTR &prop, float &value, float def)
{
return node && node->GetUserPropFloat(prop, value);
bool ret;
if (node)
{
if (!node->GetUserPropFloat(prop, value))
{
value = def;
ret = false;
} else
ret = true;
} else
{
value = def;
ret = false;
}
return ret;
}
void npSetProp(INode *node, const TSTR &prop, float value)
......@@ -34,4 +64,48 @@ void npSetProp(INode *node, const TSTR &prop, float value)
node->SetUserPropFloat(prop, value);
}
bool npGetProp(INode *node, const TSTR &prop, Vector3 &value, const Vector3 def)
{
bool ret;
if (node)
{
TSTR tmp;
if (node->GetUserPropString(prop, tmp))
{
value = def;
TCHAR *endp = NULL;
value.x = _tcstod(tmp, &endp);
if (endp)
value.y = _tcstod(endp, &endp);
if (endp)
value.z = _tcstod(endp, &endp);
} else
{
value = def;
ret = false;
}
} else
{
value = def;
ret = false;
}
return ret;
}
void npSetProp(INode *node, const TSTR &prop, const Vector3 &value)
{
if (node)
{
// TSTR's printf function seems to be locale-aware (prints ',')
// so we have to do it this way...
TCHAR tmp[256];
_stprintf(tmp, "%f %f %f", value.x, value.y, value.z);
node->SetUserPropString(prop, tmp);
}
}
#ifndef __NIFPLUGINS_H__
#define __NIFPLUGINS_H__
#define NP_HASCOLL _T("np_coll")
#define NP_HVK_LAYER _T("np_hvk_layer")
#define NP_HVK_MATERIAL _T("np_hvk_mtl")
#define NP_HVK_MASS _T("np_hvk_mass")
#define NP_HVK_LINEAR_DAMPING _T("np_hvk_ldamp")
#define NP_HVK_ANGULAR_DAMPING _T("np_hvk_adamp")
#define NP_HVK_FRICTION _T("np_hvk_frict")
#define NP_HVK_RESTITUTION _T("np_hvk_resti")
#define NP_HVK_MAX_LINEAR_VELOCITY _T("np_hvk_max_lvel")
#define NP_HVK_MAX_ANGULAR_VELOCITY _T("np_hvk_max_avel")
#define NP_HVK_PENETRATION_DEPTH _T("np_hvk_pdepth")
#define NP_HVK_MOTION_SYSTEM _T("np_hvk_msys")
#define NP_HVK_QUALITY_TYPE _T("np_hvk_qtype")
#include "niflib/nif_math.h"
using Niflib::Vector3;
#define NP_HASCOLL _T("np_coll")
#define NP_HVK_LAYER _T("np_hvk_layer")
#define NP_HVK_MATERIAL _T("np_hvk_mtl")
#define NP_HVK_CENTER _T("np_hvk_center")
#define NP_HVK_MASS _T("np_hvk_mass")
#define NP_HVK_LINEAR_DAMPING _T("np_hvk_ldamp")
#define NP_HVK_ANGULAR_DAMPING _T("np_hvk_adamp")
#define NP_HVK_FRICTION _T("np_hvk_frict")
#define NP_HVK_RESTITUTION _T("np_hvk_resti")
#define NP_HVK_MAX_LINEAR_VELOCITY _T("np_hvk_max_lvel")
#define NP_HVK_MAX_ANGULAR_VELOCITY _T("np_hvk_max_avel")
#define NP_HVK_PENETRATION_DEPTH _T("np_hvk_pdepth")
#define NP_HVK_MOTION_SYSTEM _T("np_hvk_msys")
#define NP_HVK_QUALITY_TYPE _T("np_hvk_qtype")
#define NP_DEFAULT_HVK_MATERIAL 9
#define NP_DEFAULT_HVK_LAYER 1
......@@ -31,10 +35,13 @@
bool npIsCollision(INode *node);
void npSetCollision(INode *node, bool coll);
bool npGetProp(INode *node, const TSTR &prop, int &value);
bool npGetProp(INode *node, const TSTR &prop, int &value, int def=0);
void npSetProp(INode *node, const TSTR &prop, int value);
bool npGetProp(INode *node, const TSTR &prop, float &value);
bool npGetProp(INode *node, const TSTR &prop, float &value, float def=0.0f);
void npSetProp(INode *node, const TSTR &prop, float value);
bool npGetProp(INode *node, const TSTR &prop, Vector3 &value, const Vector3 def=Vector3(0,0,0));
void npSetProp(INode *node, const TSTR &prop, const Vector3 &value);
#endif // __NIFPLUGINS_H__
......@@ -67,7 +67,9 @@ Global
{E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Release.ActiveCfg = Release|Win32
{E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Release.Build.0 = Release|Win32
{E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Release - Max 6.ActiveCfg = Release - Max 6|Win32
{E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Release - Max 6.Build.0 = Release - Max 6|Win32
{E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Release - Max 7.ActiveCfg = Release - Max 7|Win32
{E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Release - Max 7.Build.0 = Release - Max 7|Win32
{E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Release - Max 8.ActiveCfg = Release|Win32
{184D8F9A-75CA-4D26-8707-7666D9DE7D9B}.Debug.ActiveCfg = Debug|Win32
{184D8F9A-75CA-4D26-8707-7666D9DE7D9B}.Debug.Build.0 = Debug|Win32
......
......@@ -184,13 +184,14 @@ void NifProps::enableGUI(BOOL obj, BOOL hvk)
EnableWindow(GetDlgItem(mPanel, IDC_GRP_OBJECT), obj);
EnableWindow(GetDlgItem(mPanel, IDC_CHK_ISCOLL), obj);
EnableWindow(GetDlgItem(mPanel, IDC_GRP_HAVOK), hvk);
/* EnableWindow(GetDlgItem(mPanel, IDC_GRP_HAVOK), hvk);
EnableWindow(GetDlgItem(mPanel, IDC_LBL_MATERIAL), hvk);
EnableWindow(GetDlgItem(mPanel, IDC_CB_MATERIAL), hvk);
EnableWindow(GetDlgItem(mPanel, IDC_LBL_LAYER), hvk);
EnableWindow(GetDlgItem(mPanel, IDC_CB_LAYER), hvk);
// for (int i=IDC_HVK_BEGIN; i<=IDC_HVK_END; i++)
// EnableWindow(GetDlgItem(mPanel, i), hvk);
*/
for (int i=IDC_HVK_BEGIN; i<=IDC_HVK_END; i++)
EnableWindow(GetDlgItem(mPanel, i), hvk);
}
void NifProps::SelectionSetChanged(Interface *ip, IUtil *iu)
......@@ -221,42 +222,38 @@ void NifProps::selectionChanged()
CheckDlgButton(mPanel, IDC_CHK_ISCOLL, isColl);
int mtl, lyr, msys, qtype;
if (!npGetProp(nodeSel, NP_HVK_MATERIAL, mtl))
{
mtl = NP_DEFAULT_HVK_MATERIAL;
npSetProp(nodeSel, NP_HVK_MATERIAL, mtl);
} else
mtl = max(0, min(mCbMaterial.count()-1, mtl));
if (!npGetProp(nodeSel, NP_HVK_LAYER, lyr))
{
lyr = NP_DEFAULT_HVK_LAYER;
npSetProp(nodeSel, NP_HVK_LAYER, lyr);
} else
lyr = max(0, min(mCbLayer.count()-1, lyr));
if (!npGetProp(nodeSel, NP_HVK_MOTION_SYSTEM, msys))
{
msys = NP_DEFAULT_HVK_MOTION_SYSTEM;
npSetProp(nodeSel, NP_HVK_MOTION_SYSTEM, msys);
} else
msys = max(0, min(mCbMotionSystem.count()-1, msys));
float mass, lindamp, angdamp, frict, maxlinvel, maxangvel;
Vector3 center;
npGetProp(nodeSel, NP_HVK_MATERIAL, mtl, NP_DEFAULT_HVK_MATERIAL);
npGetProp(nodeSel, NP_HVK_LAYER, lyr, NP_DEFAULT_HVK_LAYER);
npGetProp(nodeSel, NP_HVK_MOTION_SYSTEM, msys, NP_DEFAULT_HVK_MOTION_SYSTEM);
npGetProp(nodeSel, NP_HVK_QUALITY_TYPE, qtype, NP_DEFAULT_HVK_QUALITY_TYPE);
npGetProp(nodeSel, NP_HVK_MASS, mass, NP_DEFAULT_HVK_MASS);
npGetProp(nodeSel, NP_HVK_LINEAR_DAMPING, lindamp, NP_DEFAULT_HVK_LINEAR_DAMPING);
npGetProp(nodeSel, NP_HVK_ANGULAR_DAMPING, angdamp, NP_DEFAULT_HVK_ANGULAR_DAMPING);
npGetProp(nodeSel, NP_HVK_FRICTION, frict, NP_DEFAULT_HVK_FRICTION);
npGetProp(nodeSel, NP_HVK_MAX_LINEAR_VELOCITY, maxlinvel, NP_DEFAULT_HVK_FRICTION);
npGetProp(nodeSel, NP_HVK_MAX_ANGULAR_VELOCITY, maxangvel, NP_DEFAULT_HVK_MAX_ANGULAR_VELOCITY);
npGetProp(nodeSel, NP_HVK_CENTER, center);
mCbMaterial.select(max(0, min(mtl, mCbMaterial.count()-1)));
mCbLayer.select(max(0, min(lyr, mCbLayer.count()-1)));
mCbMotionSystem.select(max(0, min(msys, mCbMotionSystem.count()-1)));
mCbQualityType.select(max(0, min(qtype, mCbQualityType.count()-1)));
mSpins[IDC_SP_CENTER_X]->SetValue(center.x, TRUE);
mSpins[IDC_SP_CENTER_Y]->SetValue(center.y, TRUE);
mSpins[IDC_SP_CENTER_Z]->SetValue(center.z, TRUE);
mSpins[IDC_SP_MASS]->SetValue(mass, TRUE);
mSpins[IDC_SP_LINEAR_DAMPING]->SetValue(lindamp, TRUE);
mSpins[IDC_SP_ANGULAR_DAMPING]->SetValue(angdamp, TRUE);
mSpins[IDC_SP_FRICTION]->SetValue(frict, TRUE);
mSpins[IDC_SP_MAX_LINEAR_VELOCITY]->SetValue(maxlinvel, TRUE);
mSpins[IDC_SP_MAX_ANGULAR_VELOCITY]->SetValue(maxangvel, TRUE);
if (!npGetProp(nodeSel, NP_HVK_QUALITY_TYPE, qtype))
{
qtype = NP_DEFAULT_HVK_QUALITY_TYPE;
npSetProp(nodeSel, NP_HVK_QUALITY_TYPE, qtype);
} else
qtype = max(0, min(mCbQualityType.count()-1, qtype));
mCbMaterial.select(mtl);
mCbLayer.select(lyr);
mCbMotionSystem.select(msys);
mCbQualityType.select(lyr);
}
void NifProps::Init(HWND hWnd)
......@@ -274,6 +271,8 @@ void NifProps::Destroy(HWND hWnd)
BOOL NifProps::dlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
Vector3 center;
switch (msg)
{
case WM_INITDIALOG:
......@@ -326,6 +325,57 @@ BOOL NifProps::dlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
case CC_SPINNER_CHANGE:
if (!mNode)
break;
switch (LOWORD(wParam))
{
case IDC_SP_CENTER_X:
npGetProp(mNode, NP_HVK_CENTER, center);
center.x = mSpins[IDC_SP_CENTER_X]->GetFVal();
npSetProp(mNode, NP_HVK_CENTER, center);
break;
case IDC_SP_CENTER_Y:
npGetProp(mNode, NP_HVK_CENTER, center);
center.y = mSpins[IDC_SP_CENTER_Y]->GetFVal();
npSetProp(mNode, NP_HVK_CENTER, center);
break;
case IDC_SP_CENTER_Z:
npGetProp(mNode, NP_HVK_CENTER, center);
center.z = mSpins[IDC_SP_CENTER_Z]->GetFVal();
npSetProp(mNode, NP_HVK_CENTER, center);
break;
case IDC_SP_MASS:
npSetProp(mNode, NP_HVK_MASS, mSpins[IDC_SP_MASS]->GetFVal());
break;
case IDC_SP_FRICTION:
npSetProp(mNode, NP_HVK_FRICTION, mSpins[IDC_SP_FRICTION]->GetFVal());
break;
case IDC_SP_RESTITUTION:
npSetProp(mNode, NP_HVK_RESTITUTION, mSpins[IDC_SP_RESTITUTION]->GetFVal());
break;
case IDC_SP_LINEAR_DAMPING:
npSetProp(mNode, NP_HVK_LINEAR_DAMPING, mSpins[IDC_SP_LINEAR_DAMPING]->GetFVal());
break;
case IDC_SP_ANGULAR_DAMPING:
npSetProp(mNode, NP_HVK_ANGULAR_DAMPING, mSpins[IDC_SP_ANGULAR_DAMPING]->GetFVal());
break;
case IDC_SP_MAX_LINEAR_VELOCITY:
npSetProp(mNode, NP_HVK_MAX_LINEAR_VELOCITY, mSpins[IDC_SP_MAX_LINEAR_VELOCITY]->GetFVal());
break;
case IDC_SP_MAX_ANGULAR_VELOCITY:
npSetProp(mNode, NP_HVK_MAX_ANGULAR_VELOCITY, mSpins[IDC_SP_MAX_ANGULAR_VELOCITY]->GetFVal());
break;
case IDC_SP_PENETRATION_DEPTH:
npSetProp(mNode, NP_HVK_PENETRATION_DEPTH, mSpins[IDC_SP_PENETRATION_DEPTH]->GetFVal());
break;
}
break;
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment