Skip to content

Commit 34b8e08

Browse files
committed
Fix compile errors in unicode conversion in max exporter
1 parent ea82d9d commit 34b8e08

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

pandatool/src/maxegg/maxEggLoader.cxx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void MaxEggJoint::CreateMaxBone(void)
291291
_node->SetRenderable(FALSE);
292292

293293
#ifdef _UNICODE
294-
TCHAR *wname [1024];
294+
TCHAR wname[1024];
295295
wname[1023] = 0;
296296
mbstowcs(wname, _egg_joint->get_name().c_str(), 1023);
297297
_node->SetName(wname);
@@ -468,7 +468,14 @@ MaxEggMesh *MaxEggLoader::GetMesh(EggVertexPool *pool)
468468
result->_tvert_count = 0;
469469
result->_cvert_count = 0;
470470
result->_face_count = 0;
471-
result->_node->SetName(TSTR(name.c_str()));
471+
#ifdef _UNICODE
472+
TCHAR wname[1024];
473+
wname[1023] = 0;
474+
mbstowcs(wname, name.c_str(), 1023);
475+
result->_node->SetName(wname);
476+
#else
477+
result->_node->SetName((char*) name.c_str());
478+
#endif
472479
_mesh_tab[pool] = result;
473480
}
474481
return result;

pandatool/src/maxegg/maxToEggConverter.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,14 @@ make_nurbs_curve(INode *max_node, NURBSCVCurve *curve,
589589
return false;
590590
}
591591

592+
#ifdef _UNICODE
593+
char mbname[1024];
594+
mbname[1023] = 0;
595+
wcstombs(mbname, max_node->GetName(), 1023);
596+
string name(mbname);
597+
#else
592598
string name = max_node->GetName();
599+
#endif
593600

594601
string vpool_name = name + ".cvs";
595602
EggVertexPool *vpool = new EggVertexPool(vpool_name);
@@ -652,7 +659,15 @@ make_polyset(INode *max_node, Mesh *mesh,
652659
// all the vertices up front, we'll start with an empty vpool, and
653660
// add vertices to it on the fly.
654661

662+
#ifdef _UNICODE
663+
char mbname[1024];
664+
mbname[1023] = 0;
665+
wcstombs(mbname, max_node->GetName(), 1023);
666+
string node_name(mbname);
667+
#else
655668
string node_name = max_node->GetName();
669+
#endif
670+
656671
string vpool_name = node_name + ".verts";
657672
EggVertexPool *vpool = new EggVertexPool(vpool_name);
658673
egg_group->add_child(vpool);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy