mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
more compatibility fixes
This commit is contained in:
parent
d899d8e6ed
commit
3841accba9
@ -274,17 +274,17 @@ const double meshVerts[252][3] = {
|
|||||||
This basically says "Yes, I am a helper object!"
|
This basically says "Yes, I am a helper object!"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class MaxEggPluginClassDesc : public ClassDesc
|
class MaxEggPluginClassDesc : public ClassDesc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int IsPublic() { return TRUE; }
|
int IsPublic() { return TRUE; }
|
||||||
void *Create(BOOL loading = FALSE) { return new MaxEggPlugin(); }
|
void *Create(BOOL loading = FALSE) { return new MaxEggPlugin(); }
|
||||||
const MCHAR *ClassName() { return GetString(IDS_CLASS_NAME); }
|
const TCHAR *ClassName() { return GetString(IDS_CLASS_NAME); }
|
||||||
SClass_ID SuperClassID() { return HELPER_CLASS_ID; }
|
SClass_ID SuperClassID() { return HELPER_CLASS_ID; }
|
||||||
Class_ID ClassID() { return MaxEggPlugin_CLASS_ID; }
|
Class_ID ClassID() { return MaxEggPlugin_CLASS_ID; }
|
||||||
const MCHAR *Category() { return GetString(IDS_CATEGORY); }
|
const TCHAR *Category() { return GetString(IDS_CATEGORY); }
|
||||||
// returns fixed parsable name (scripter-visible name)
|
// returns fixed parsable name (scripter-visible name)
|
||||||
const MCHAR *InternalName() { return _M("MaxEggPlugin"); }
|
const TCHAR *InternalName() { return _T("MaxEggPlugin"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Our private global instance of the above class
|
// Our private global instance of the above class
|
||||||
@ -822,7 +822,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
|||||||
|
|
||||||
// This function returns a string that describes the DLL and where the user
|
// This function returns a string that describes the DLL and where the user
|
||||||
// could purchase the DLL if they don't have it.
|
// could purchase the DLL if they don't have it.
|
||||||
__declspec( dllexport ) const MCHAR* LibDescription()
|
__declspec( dllexport ) const TCHAR* LibDescription()
|
||||||
{
|
{
|
||||||
return GetString(IDS_LIBDESCRIPTION);
|
return GetString(IDS_LIBDESCRIPTION);
|
||||||
}
|
}
|
||||||
@ -851,9 +851,9 @@ __declspec( dllexport ) ULONG LibVersion()
|
|||||||
return VERSION_3DSMAX;
|
return VERSION_3DSMAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCHAR *GetString(int id)
|
TCHAR *GetString(int id)
|
||||||
{
|
{
|
||||||
static MCHAR buf[256];
|
static TCHAR buf[256];
|
||||||
|
|
||||||
if (hInstance)
|
if (hInstance)
|
||||||
return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL;
|
return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL;
|
||||||
|
@ -75,7 +75,7 @@ extern HINSTANCE hInstance;
|
|||||||
|
|
||||||
/* Global Functions
|
/* Global Functions
|
||||||
*/
|
*/
|
||||||
extern MCHAR *GetString(int id);
|
extern TCHAR *GetString(int id);
|
||||||
|
|
||||||
/* This class defines the 3D Studio Max exporter itself. It is basically a
|
/* This class defines the 3D Studio Max exporter itself. It is basically a
|
||||||
shell that is invoked by 3D Studio Max's export API. It then sets up
|
shell that is invoked by 3D Studio Max's export API. It then sets up
|
||||||
@ -133,14 +133,14 @@ class MaxEggPlugin : public HelperObject
|
|||||||
void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
|
void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
|
||||||
void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
|
void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
|
||||||
#if MAX_VERSION_MAJOR < 15
|
#if MAX_VERSION_MAJOR < 15
|
||||||
MCHAR *GetObjectName() { return GetString(IDS_LIBDESCRIPTION); }
|
TCHAR *GetObjectName() { return GetString(IDS_LIBDESCRIPTION); }
|
||||||
#else
|
#else
|
||||||
const MCHAR *GetObjectName() { return GetString(IDS_LIBDESCRIPTION); }
|
const TCHAR *GetObjectName() { return GetString(IDS_LIBDESCRIPTION); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// From Object
|
// From Object
|
||||||
ObjectState Eval(TimeValue time);
|
ObjectState Eval(TimeValue time);
|
||||||
void InitNodeName(MSTR& s) { s = GetString(IDS_CLASS_NAME); }
|
void InitNodeName(TSTR& s) { s = GetString(IDS_CLASS_NAME); }
|
||||||
Interval ObjectValidity(TimeValue time);
|
Interval ObjectValidity(TimeValue time);
|
||||||
void Invalidate();
|
void Invalidate();
|
||||||
int DoOwnSelectHilite() { return 1; }
|
int DoOwnSelectHilite() { return 1; }
|
||||||
@ -154,8 +154,8 @@ class MaxEggPlugin : public HelperObject
|
|||||||
// Animatable methods
|
// Animatable methods
|
||||||
void DeleteThis() { delete this; }
|
void DeleteThis() { delete this; }
|
||||||
Class_ID ClassID() { return MaxEggPlugin_CLASS_ID; }
|
Class_ID ClassID() { return MaxEggPlugin_CLASS_ID; }
|
||||||
void GetClassName(MSTR& s) { s = MSTR(GetString(IDS_CLASS_NAME)); }
|
void GetClassName(TSTR& s) { s = TSTR(GetString(IDS_CLASS_NAME)); }
|
||||||
MSTR SubAnimName(int i) { return MSTR(GetString(IDS_CLASS_NAME)); }
|
TSTR SubAnimName(int i) { return TSTR(GetString(IDS_CLASS_NAME)); }
|
||||||
|
|
||||||
// From ref
|
// From ref
|
||||||
RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir());
|
RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir());
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
MaxEggMesh *GetMesh(EggVertexPool *pool);
|
MaxEggMesh *GetMesh(EggVertexPool *pool);
|
||||||
MaxEggJoint *FindJoint(EggGroup *joint);
|
MaxEggJoint *FindJoint(EggGroup *joint);
|
||||||
MaxEggJoint *MakeJoint(EggGroup *joint, EggGroup *context);
|
MaxEggJoint *MakeJoint(EggGroup *joint, EggGroup *context);
|
||||||
MaxEggTex *GetTex(const string &fn);
|
MaxEggTex *GetTex(const Filename &fn);
|
||||||
void CreateSkinModifier(MaxEggMesh *M);
|
void CreateSkinModifier(MaxEggMesh *M);
|
||||||
|
|
||||||
typedef phash_map<EggVertexPool *, MaxEggMesh *> MeshTable;
|
typedef phash_map<EggVertexPool *, MaxEggMesh *> MeshTable;
|
||||||
@ -91,26 +91,31 @@ Point3 MakeMaxPoint(LVector3d vec)
|
|||||||
class MaxEggTex
|
class MaxEggTex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
string _path;
|
Filename _path;
|
||||||
int _id;
|
int _id;
|
||||||
StdMat *_mat;
|
StdMat *_mat;
|
||||||
BitmapTex *_bmt;
|
BitmapTex *_bmt;
|
||||||
};
|
};
|
||||||
|
|
||||||
MaxEggTex *MaxEggLoader::GetTex(const string &fn)
|
MaxEggTex *MaxEggLoader::GetTex(const Filename &fn)
|
||||||
{
|
{
|
||||||
if (_tex_tab.count(fn))
|
if (_tex_tab.count(fn))
|
||||||
return _tex_tab[fn];
|
return _tex_tab[fn];
|
||||||
|
|
||||||
BitmapTex *bmt = NewDefaultBitmapTex();
|
BitmapTex *bmt = NewDefaultBitmapTex();
|
||||||
bmt->SetMapName(MSTR::FromACP(fn.c_str()));
|
#ifdef _UNICODE
|
||||||
|
bmt->SetMapName(fn.to_os_specific_w().c_str());
|
||||||
|
#else
|
||||||
|
bmt->SetMapName(fn.to_os_specific().c_str());
|
||||||
|
#endif
|
||||||
|
|
||||||
StdMat *mat = NewDefaultStdMat();
|
StdMat *mat = NewDefaultStdMat();
|
||||||
mat->SetSubTexmap(ID_DI, bmt);
|
mat->SetSubTexmap(ID_DI, bmt);
|
||||||
mat->SetTexmapAmt(ID_DI, 1.0, 0);
|
mat->SetTexmapAmt(ID_DI, 1.0, 0);
|
||||||
mat->EnableMap(ID_DI, TRUE);
|
mat->EnableMap(ID_DI, TRUE);
|
||||||
mat->SetActiveTexmap(bmt);
|
mat->SetActiveTexmap(bmt);
|
||||||
GetCOREInterface()->ActivateTexture(bmt, mat);
|
GetCOREInterface()->ActivateTexture(bmt, mat);
|
||||||
|
|
||||||
MaxEggTex *res = new MaxEggTex;
|
MaxEggTex *res = new MaxEggTex;
|
||||||
res->_path = fn;
|
res->_path = fn;
|
||||||
res->_id = _next_tex ++;
|
res->_id = _next_tex ++;
|
||||||
@ -260,7 +265,7 @@ void MaxEggJoint::CreateMaxBone(void)
|
|||||||
Point3 pos(MakeMaxPoint(GetPos()));
|
Point3 pos(MakeMaxPoint(GetPos()));
|
||||||
Point3 endpos(MakeMaxPoint(_endpos));
|
Point3 endpos(MakeMaxPoint(_endpos));
|
||||||
Point3 tzv(MakeMaxPoint(_perp));
|
Point3 tzv(MakeMaxPoint(_perp));
|
||||||
|
|
||||||
Point3 fwd = endpos - pos;
|
Point3 fwd = endpos - pos;
|
||||||
double len = fwd.Length();
|
double len = fwd.Length();
|
||||||
Point3 txv = fwd * ((PN_stdfloat)(1.0/len));
|
Point3 txv = fwd * ((PN_stdfloat)(1.0/len));
|
||||||
@ -275,16 +280,16 @@ void MaxEggJoint::CreateMaxBone(void)
|
|||||||
_node->SetNodeTM(0, Matrix3(xv, yv, zv, pos));
|
_node->SetNodeTM(0, Matrix3(xv, yv, zv, pos));
|
||||||
IParamBlock2 *blk = _bone->pblock2;
|
IParamBlock2 *blk = _bone->pblock2;
|
||||||
for (int i=0; i<blk->NumParams(); i++) {
|
for (int i=0; i<blk->NumParams(); i++) {
|
||||||
MSTR n = blk->GetLocalName(i);
|
TSTR n = blk->GetLocalName(i);
|
||||||
if (_tcscmp(n, _M("Length"))==0) blk->SetValue(i,0,(PN_stdfloat)len);
|
if (_tcscmp(n, _T("Length")) == 0) blk->SetValue(i, 0, (PN_stdfloat) len);
|
||||||
else if (_tcscmp(n, _M("Width"))==0) blk->SetValue(i,0,(PN_stdfloat)_thickness);
|
else if (_tcscmp(n, _T("Width")) == 0) blk->SetValue(i, 0, (PN_stdfloat) _thickness);
|
||||||
else if (_tcscmp(n, _M("Height"))==0) blk->SetValue(i,0,(PN_stdfloat)_thickness);
|
else if (_tcscmp(n, _T("Height")) == 0) blk->SetValue(i, 0, (PN_stdfloat) _thickness);
|
||||||
}
|
}
|
||||||
Point3 boneColor = GetUIColor(COLOR_BONES);
|
Point3 boneColor = GetUIColor(COLOR_BONES);
|
||||||
_node->SetWireColor(RGB(int(boneColor.x*255.0f), int(boneColor.y*255.0f), int(boneColor.z*255.0f) ));
|
_node->SetWireColor(RGB(int(boneColor.x*255.0f), int(boneColor.y*255.0f), int(boneColor.z*255.0f) ));
|
||||||
_node->SetBoneNodeOnOff(TRUE, 0);
|
_node->SetBoneNodeOnOff(TRUE, 0);
|
||||||
_node->SetRenderable(FALSE);
|
_node->SetRenderable(FALSE);
|
||||||
_node->SetName(MSTR::FromACP(_egg_joint->get_name().c_str()));
|
_node->SetName(TSTR(_egg_joint->get_name().c_str()));
|
||||||
_node->SetObjOffsetRot(ooquat);
|
_node->SetObjOffsetRot(ooquat);
|
||||||
if (_parent) {
|
if (_parent) {
|
||||||
_node->Detach(0, 1);
|
_node->Detach(0, 1);
|
||||||
@ -454,7 +459,7 @@ MaxEggMesh *MaxEggLoader::GetMesh(EggVertexPool *pool)
|
|||||||
result->_tvert_count = 0;
|
result->_tvert_count = 0;
|
||||||
result->_cvert_count = 0;
|
result->_cvert_count = 0;
|
||||||
result->_face_count = 0;
|
result->_face_count = 0;
|
||||||
result->_node->SetName(MSTR::FromACP(name.c_str()));
|
result->_node->SetName(TSTR(name.c_str()));
|
||||||
_mesh_tab[pool] = result;
|
_mesh_tab[pool] = result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -465,7 +470,7 @@ int MaxEggMesh::AddFace(int v0, int v1, int v2, int tv0, int tv1, int tv2, int c
|
|||||||
static int dump = 0;
|
static int dump = 0;
|
||||||
if (_face_count == _mesh->numFaces) {
|
if (_face_count == _mesh->numFaces) {
|
||||||
int nsize = _face_count*2 + 100;
|
int nsize = _face_count*2 + 100;
|
||||||
BOOL keep = _mesh->numFaces ? TRUE:FALSE;
|
BOOL keep = _mesh->numFaces ? TRUE : FALSE;
|
||||||
_mesh->setNumFaces(nsize, keep);
|
_mesh->setNumFaces(nsize, keep);
|
||||||
_mesh->setNumTVFaces(nsize, keep, _face_count);
|
_mesh->setNumTVFaces(nsize, keep, _face_count);
|
||||||
_mesh->setNumVCFaces(nsize, keep, _face_count);
|
_mesh->setNumVCFaces(nsize, keep, _face_count);
|
||||||
@ -566,7 +571,7 @@ void MaxEggLoader::TraverseEggNode(EggNode *node, EggGroup *context)
|
|||||||
vector<int> vertIndices;
|
vector<int> vertIndices;
|
||||||
vector<int> tvertIndices;
|
vector<int> tvertIndices;
|
||||||
vector<int> cvertIndices;
|
vector<int> cvertIndices;
|
||||||
|
|
||||||
if (node->is_of_type(EggPolygon::get_class_type())) {
|
if (node->is_of_type(EggPolygon::get_class_type())) {
|
||||||
EggPolygon *poly = DCAST(EggPolygon, node);
|
EggPolygon *poly = DCAST(EggPolygon, node);
|
||||||
|
|
||||||
@ -574,13 +579,13 @@ void MaxEggLoader::TraverseEggNode(EggNode *node, EggGroup *context)
|
|||||||
LMatrix3d uvtrans = LMatrix3d::ident_mat();
|
LMatrix3d uvtrans = LMatrix3d::ident_mat();
|
||||||
if (poly->has_texture()) {
|
if (poly->has_texture()) {
|
||||||
EggTexture *tex = poly->get_texture(0);
|
EggTexture *tex = poly->get_texture(0);
|
||||||
texid = GetTex(tex->get_fullpath().to_os_specific())->_id;
|
texid = GetTex(tex->get_fullpath())->_id;
|
||||||
if (tex->has_transform())
|
if (tex->has_transform())
|
||||||
uvtrans = tex->get_transform2d();
|
uvtrans = tex->get_transform2d();
|
||||||
} else {
|
} else {
|
||||||
texid = GetTex("")->_id;
|
texid = GetTex(Filename())->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
EggPolygon::const_iterator ci;
|
EggPolygon::const_iterator ci;
|
||||||
MaxEggMesh *mesh = GetMesh(poly->get_pool());
|
MaxEggMesh *mesh = GetMesh(poly->get_pool());
|
||||||
vertIndices.clear();
|
vertIndices.clear();
|
||||||
@ -621,7 +626,7 @@ bool MaxEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool an
|
|||||||
maxloader_cat.error() << "Currently, only 'merge' mode is implemented.\n";
|
maxloader_cat.error() << "Currently, only 'merge' mode is implemented.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((anim) || (!model)) {
|
if ((anim) || (!model)) {
|
||||||
maxloader_cat.error() << "Currently, only model-loading is implemented.\n";
|
maxloader_cat.error() << "Currently, only model-loading is implemented.\n";
|
||||||
return false;
|
return false;
|
||||||
@ -630,14 +635,14 @@ bool MaxEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool an
|
|||||||
MeshIterator ci;
|
MeshIterator ci;
|
||||||
JointIterator ji;
|
JointIterator ji;
|
||||||
TexIterator ti;
|
TexIterator ti;
|
||||||
|
|
||||||
data->set_coordinate_system(CS_zup_right);
|
data->set_coordinate_system(CS_zup_right);
|
||||||
|
|
||||||
SuspendAnimate();
|
SuspendAnimate();
|
||||||
SuspendSetKeyMode();
|
SuspendSetKeyMode();
|
||||||
AnimateOff();
|
AnimateOff();
|
||||||
_next_tex = 0;
|
_next_tex = 0;
|
||||||
|
|
||||||
TraverseEggNode(data, NULL);
|
TraverseEggNode(data, NULL);
|
||||||
|
|
||||||
for (ci = _mesh_tab.begin(); ci != _mesh_tab.end(); ++ci) {
|
for (ci = _mesh_tab.begin(); ci != _mesh_tab.end(); ++ci) {
|
||||||
@ -652,7 +657,7 @@ bool MaxEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool an
|
|||||||
mesh->_mesh->InvalidateGeomCache();
|
mesh->_mesh->InvalidateGeomCache();
|
||||||
mesh->_mesh->buildNormals();
|
mesh->_mesh->buildNormals();
|
||||||
}
|
}
|
||||||
|
|
||||||
double thickness = 0.0;
|
double thickness = 0.0;
|
||||||
for (ji = _joint_tab.begin(); ji != _joint_tab.end(); ++ji) {
|
for (ji = _joint_tab.begin(); ji != _joint_tab.end(); ++ji) {
|
||||||
double dfo = ((*ji)->GetPos()).length();
|
double dfo = ((*ji)->GetPos()).length();
|
||||||
@ -664,15 +669,15 @@ bool MaxEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool an
|
|||||||
joint->ChooseEndPos(thickness);
|
joint->ChooseEndPos(thickness);
|
||||||
joint->CreateMaxBone();
|
joint->CreateMaxBone();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ci = _mesh_tab.begin(); ci != _mesh_tab.end(); ++ci) {
|
for (ci = _mesh_tab.begin(); ci != _mesh_tab.end(); ++ci) {
|
||||||
MaxEggMesh *mesh = (*ci);
|
MaxEggMesh *mesh = (*ci);
|
||||||
EggGroup *joint = mesh->GetControlJoint();
|
EggGroup *joint = mesh->GetControlJoint();
|
||||||
if (joint) CreateSkinModifier(mesh);
|
if (joint) CreateSkinModifier(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_next_tex) {
|
if (_next_tex) {
|
||||||
MSTR name;
|
TSTR name;
|
||||||
MultiMtl *mtl = NewDefaultMultiMtl();
|
MultiMtl *mtl = NewDefaultMultiMtl();
|
||||||
mtl->SetNumSubMtls(_next_tex);
|
mtl->SetNumSubMtls(_next_tex);
|
||||||
for (ti = _tex_tab.begin(); ti != _tex_tab.end(); ++ti) {
|
for (ti = _tex_tab.begin(); ti != _tex_tab.end(); ++ti) {
|
||||||
@ -688,10 +693,10 @@ bool MaxEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool an
|
|||||||
for (ci = _mesh_tab.begin(); ci != _mesh_tab.end(); ++ci) delete *ci;
|
for (ci = _mesh_tab.begin(); ci != _mesh_tab.end(); ++ci) delete *ci;
|
||||||
for (ji = _joint_tab.begin(); ji != _joint_tab.end(); ++ji) delete *ji;
|
for (ji = _joint_tab.begin(); ji != _joint_tab.end(); ++ji) delete *ji;
|
||||||
for (ti = _tex_tab.begin(); ti != _tex_tab.end(); ++ti) delete *ti;
|
for (ti = _tex_tab.begin(); ti != _tex_tab.end(); ++ti) delete *ti;
|
||||||
|
|
||||||
ResumeSetKeyMode();
|
ResumeSetKeyMode();
|
||||||
ResumeAnimate();
|
ResumeAnimate();
|
||||||
|
|
||||||
maxloader_cat.info() << "Egg import successful\n";
|
maxloader_cat.info() << "Egg import successful\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,29 @@ MaxNodeDesc(MaxNodeDesc *parent, const string &name) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: MaxNodeDesc::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description: This convenience constructor takes a wstring.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
MaxNodeDesc::
|
||||||
|
MaxNodeDesc(MaxNodeDesc *parent, const wstring &name) :
|
||||||
|
Namable(string(name.begin(), name.end())),
|
||||||
|
_parent(parent)
|
||||||
|
{
|
||||||
|
_max_node = (INode *)NULL;
|
||||||
|
_egg_group = (EggGroup *)NULL;
|
||||||
|
_egg_table = (EggTable *)NULL;
|
||||||
|
_anim = (EggXfmSAnim *)NULL;
|
||||||
|
_joint_type = JT_none;
|
||||||
|
_joint_entry = NULL;
|
||||||
|
|
||||||
|
// Add ourselves to our parent.
|
||||||
|
if (_parent != (MaxNodeDesc *)NULL) {
|
||||||
|
_parent->_children.push_back(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: MaxNodeDesc::Destructor
|
// Function: MaxNodeDesc::Destructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
class MaxNodeDesc : public ReferenceCount, public Namable {
|
class MaxNodeDesc : public ReferenceCount, public Namable {
|
||||||
public:
|
public:
|
||||||
MaxNodeDesc(MaxNodeDesc *parent = NULL, const string &name = string());
|
MaxNodeDesc(MaxNodeDesc *parent = NULL, const string &name = string());
|
||||||
|
MaxNodeDesc(MaxNodeDesc *parent = NULL, const wstring &name = wstring());
|
||||||
~MaxNodeDesc();
|
~MaxNodeDesc();
|
||||||
|
|
||||||
void from_INode(INode *max_node);
|
void from_INode(INode *max_node);
|
||||||
|
@ -15,11 +15,6 @@
|
|||||||
|
|
||||||
#include "maxEgg.h"
|
#include "maxEgg.h"
|
||||||
|
|
||||||
// 3dsmax versions below 9 don't define this.
|
|
||||||
#ifndef _M
|
|
||||||
#define _M(s) (s)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: MaxNodeTree::Constructor
|
// Function: MaxNodeTree::Constructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
@ -269,12 +264,12 @@ r_build_node(INode* max_node)
|
|||||||
{
|
{
|
||||||
// If we have already encountered this pathname, return the
|
// If we have already encountered this pathname, return the
|
||||||
// corresponding MaxNodeDesc immediately.
|
// corresponding MaxNodeDesc immediately.
|
||||||
|
|
||||||
ULONG node_handle = 0;
|
ULONG node_handle = 0;
|
||||||
|
|
||||||
if (max_node) {
|
if (max_node) {
|
||||||
node_handle = max_node->GetHandle();
|
node_handle = max_node->GetHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
NodesByPath::const_iterator ni = _nodes_by_path.find(node_handle);
|
NodesByPath::const_iterator ni = _nodes_by_path.find(node_handle);
|
||||||
if (ni != _nodes_by_path.end()) {
|
if (ni != _nodes_by_path.end()) {
|
||||||
@ -291,7 +286,8 @@ r_build_node(INode* max_node)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
INode *parent_node;
|
INode *parent_node;
|
||||||
CStr local_name = CStr::FromMSTR(max_node->GetName());
|
TSTR local_name = max_node->GetName();
|
||||||
|
|
||||||
if (max_node->IsRootNode()) {
|
if (max_node->IsRootNode()) {
|
||||||
parent_node = NULL;
|
parent_node = NULL;
|
||||||
} else {
|
} else {
|
||||||
@ -315,14 +311,13 @@ r_build_node(INode* max_node)
|
|||||||
MaxNodeDesc *MaxNodeTree::
|
MaxNodeDesc *MaxNodeTree::
|
||||||
r_build_joint(MaxNodeDesc *node_desc, INode *max_node)
|
r_build_joint(MaxNodeDesc *node_desc, INode *max_node)
|
||||||
{
|
{
|
||||||
CStr node_name = CStr::FromMSTR(max_node->GetName())
|
|
||||||
MaxNodeDesc *node_joint;
|
MaxNodeDesc *node_joint;
|
||||||
if (node_desc == _root) {
|
if (node_desc == _root) {
|
||||||
node_joint = new MaxNodeDesc(_root, node_name);
|
node_joint = new MaxNodeDesc(_root, max_node->GetName());
|
||||||
_nodes.push_back(node_joint);
|
_nodes.push_back(node_joint);
|
||||||
return node_joint;
|
return node_joint;
|
||||||
} else if (node_desc->is_node_joint() && node_desc->_joint_entry) {
|
} else if (node_desc->is_node_joint() && node_desc->_joint_entry) {
|
||||||
node_joint = new MaxNodeDesc(node_desc->_joint_entry, node_name);
|
node_joint = new MaxNodeDesc(node_desc->_joint_entry, max_node->GetName());
|
||||||
_nodes.push_back(node_joint);
|
_nodes.push_back(node_joint);
|
||||||
return node_joint;
|
return node_joint;
|
||||||
} else {
|
} else {
|
||||||
@ -386,56 +381,56 @@ void MaxNodeTree::set_collision_tags(MaxNodeDesc *node_desc, EggGroup *egg_group
|
|||||||
|
|
||||||
//We have to check each collision type in turn to see if it's true
|
//We have to check each collision type in turn to see if it's true
|
||||||
//Ugly but it works per object, not globaly
|
//Ugly but it works per object, not globaly
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("polyset"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("polyset"), check)) {
|
||||||
//we have a polyset.
|
//we have a polyset.
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
egg_group->set_collision_name(node_desc->get_name());
|
egg_group->set_collision_name(node_desc->get_name());
|
||||||
egg_group->set_cs_type(EggGroup::CST_polyset);
|
egg_group->set_cs_type(EggGroup::CST_polyset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("plane"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("plane"), check)) {
|
||||||
//plane
|
//plane
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
egg_group->set_collision_name(node_desc->get_name());
|
egg_group->set_collision_name(node_desc->get_name());
|
||||||
egg_group->set_cs_type(EggGroup::CST_plane);
|
egg_group->set_cs_type(EggGroup::CST_plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("polygon"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("polygon"), check)) {
|
||||||
//polygon
|
//polygon
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
egg_group->set_collision_name(node_desc->get_name());
|
egg_group->set_collision_name(node_desc->get_name());
|
||||||
egg_group->set_cs_type(EggGroup::CST_polygon);
|
egg_group->set_cs_type(EggGroup::CST_polygon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("sphere"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("sphere"), check)) {
|
||||||
//sphere
|
//sphere
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
egg_group->set_collision_name(node_desc->get_name());
|
egg_group->set_collision_name(node_desc->get_name());
|
||||||
egg_group->set_cs_type(EggGroup::CST_sphere);
|
egg_group->set_cs_type(EggGroup::CST_sphere);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("inv-sphere"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("inv-sphere"), check)) {
|
||||||
//invsphere
|
//invsphere
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
egg_group->set_collision_name(node_desc->get_name());
|
egg_group->set_collision_name(node_desc->get_name());
|
||||||
egg_group->set_cs_type(EggGroup::CST_inv_sphere);
|
egg_group->set_cs_type(EggGroup::CST_inv_sphere);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("invsphere"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("invsphere"), check)) {
|
||||||
//invsphere (different spelling)
|
//invsphere (different spelling)
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
egg_group->set_collision_name(node_desc->get_name());
|
egg_group->set_collision_name(node_desc->get_name());
|
||||||
egg_group->set_cs_type(EggGroup::CST_inv_sphere);
|
egg_group->set_cs_type(EggGroup::CST_inv_sphere);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("tube"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("tube"), check)) {
|
||||||
//tube
|
//tube
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
egg_group->set_collision_name(node_desc->get_name());
|
egg_group->set_collision_name(node_desc->get_name());
|
||||||
egg_group->set_cs_type(EggGroup::CST_tube);
|
egg_group->set_cs_type(EggGroup::CST_tube);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("floor-mesh"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("floor-mesh"), check)) {
|
||||||
//floor-mesh
|
//floor-mesh
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
egg_group->set_collision_name(node_desc->get_name());
|
egg_group->set_collision_name(node_desc->get_name());
|
||||||
@ -443,49 +438,49 @@ void MaxNodeTree::set_collision_tags(MaxNodeDesc *node_desc, EggGroup *egg_group
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("descend"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("descend"), check)) {
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
//we have the descend flag specified
|
//we have the descend flag specified
|
||||||
egg_group->set_collide_flags(EggGroup::CF_descend);
|
egg_group->set_collide_flags(EggGroup::CF_descend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("event"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("event"), check)) {
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
//we have the event flag specified
|
//we have the event flag specified
|
||||||
egg_group->set_collide_flags(EggGroup::CF_event);
|
egg_group->set_collide_flags(EggGroup::CF_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("keep"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("keep"), check)) {
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
//we have the keep flag specified
|
//we have the keep flag specified
|
||||||
egg_group->set_collide_flags(EggGroup::CF_keep);
|
egg_group->set_collide_flags(EggGroup::CF_keep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("solid"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("solid"), check)) {
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
//we have the solid flag specified
|
//we have the solid flag specified
|
||||||
egg_group->set_collide_flags(EggGroup::CF_solid);
|
egg_group->set_collide_flags(EggGroup::CF_solid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("center"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("center"), check)) {
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
//we have the center flag specified
|
//we have the center flag specified
|
||||||
egg_group->set_collide_flags(EggGroup::CF_center);
|
egg_group->set_collide_flags(EggGroup::CF_center);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("turnstile"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("turnstile"), check)) {
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
//we have the turnstile flag specified
|
//we have the turnstile flag specified
|
||||||
egg_group->set_collide_flags(EggGroup::CF_turnstile);
|
egg_group->set_collide_flags(EggGroup::CF_turnstile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("level"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("level"), check)) {
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
//we have the level flag specified
|
//we have the level flag specified
|
||||||
egg_group->set_collide_flags(EggGroup::CF_level);
|
egg_group->set_collide_flags(EggGroup::CF_level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node_desc->get_max_node()->GetUserPropInt(_M("intangible"), check)) {
|
if (node_desc->get_max_node()->GetUserPropInt(_T("intangible"), check)) {
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
//we have the intangible flag specified
|
//we have the intangible flag specified
|
||||||
egg_group->set_collide_flags(EggGroup::CF_intangible);
|
egg_group->set_collide_flags(EggGroup::CF_intangible);
|
||||||
|
@ -165,8 +165,8 @@ public:
|
|||||||
ph(instance), hWnd(wnd) {}
|
ph(instance), hWnd(wnd) {}
|
||||||
|
|
||||||
#if MAX_VERSION_MAJOR < 15
|
#if MAX_VERSION_MAJOR < 15
|
||||||
virtual MCHAR *dialogTitle() {return _M("Objects to Export");}
|
virtual TCHAR *dialogTitle() {return _T("Objects to Export");}
|
||||||
virtual MCHAR *buttonText() {return _M("Select");}
|
virtual TCHAR *buttonText() {return _T("Select");}
|
||||||
#else
|
#else
|
||||||
virtual const MCHAR *dialogTitle() {return _M("Objects to Export");}
|
virtual const MCHAR *dialogTitle() {return _M("Objects to Export");}
|
||||||
virtual const MCHAR *buttonText() {return _M("Select");}
|
virtual const MCHAR *buttonText() {return _M("Select");}
|
||||||
@ -224,8 +224,8 @@ public:
|
|||||||
ph(instance), hWnd(wnd) {}
|
ph(instance), hWnd(wnd) {}
|
||||||
|
|
||||||
#if MAX_VERSION_MAJOR < 15
|
#if MAX_VERSION_MAJOR < 15
|
||||||
virtual MCHAR *dialogTitle() {return _M("Objects to Remove");}
|
virtual TCHAR *dialogTitle() {return _T("Objects to Remove");}
|
||||||
virtual MCHAR *buttonText() {return _M("Remove");}
|
virtual TCHAR *buttonText() {return _T("Remove");}
|
||||||
#else
|
#else
|
||||||
virtual const MCHAR *dialogTitle() {return _M("Objects to Remove");}
|
virtual const MCHAR *dialogTitle() {return _M("Objects to Remove");}
|
||||||
virtual const MCHAR *buttonText() {return _M("Remove");}
|
virtual const MCHAR *buttonText() {return _M("Remove");}
|
||||||
@ -523,7 +523,7 @@ void MaxOptionsDialog::RefreshNodeList(HWND hWnd) {
|
|||||||
SendMessage(nodeLB, LB_RESETCONTENT, 0, 0);
|
SendMessage(nodeLB, LB_RESETCONTENT, 0, 0);
|
||||||
for (int i = 0; i < _node_list.size(); i++) {
|
for (int i = 0; i < _node_list.size(); i++) {
|
||||||
INode *temp = _max_interface->GetINodeByHandle(_node_list[i]);
|
INode *temp = _max_interface->GetINodeByHandle(_node_list[i]);
|
||||||
const MCHAR *name = _M("Unknown Node");
|
const TCHAR *name = _T("Unknown Node");
|
||||||
if (temp) name = temp->GetName();
|
if (temp) name = temp->GetName();
|
||||||
SendMessage(nodeLB, LB_ADDSTRING, 0, (LPARAM)name);
|
SendMessage(nodeLB, LB_ADDSTRING, 0, (LPARAM)name);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user