|
17 | 17 | * * |
18 | 18 | ********************************************************************************/ |
19 | 19 |
|
20 | | -#include "Max.h" |
21 | | -#include "stdmat.h" |
22 | | -#include "istdplug.h" |
| 20 | +#include <Max.h> |
| 21 | +#include <stdmat.h> |
| 22 | +#include <istdplug.h> |
23 | 23 |
|
24 | 24 | #include "../ifcmax/IfcMax.h" |
25 | 25 | #include "../ifcmax/MaxMaterials.h" |
@@ -103,28 +103,47 @@ DWORD WINAPI fn(LPVOID arg) { return 0; } |
103 | 103 |
|
104 | 104 | int IFCImp::DoImport(const TCHAR *name, ImpInterface *impitfc, Interface *itfc, BOOL suppressPrompts) { |
105 | 105 |
|
106 | | - itfc->ProgressStart("Importing file...", TRUE, fn, NULL); |
107 | | - |
108 | 106 | IfcGeomObjects::Settings(IfcGeomObjects::USE_WORLD_COORDS,false); |
109 | 107 | IfcGeomObjects::Settings(IfcGeomObjects::WELD_VERTICES,true); |
110 | 108 | IfcGeomObjects::Settings(IfcGeomObjects::SEW_SHELLS,true); |
111 | 109 |
|
112 | | - if ( ! IfcGeomObjects::Init((char*)name,0,0) ) return false; |
| 110 | +#ifdef _UNICODE |
| 111 | + int fn_buffer_size = WideCharToMultiByte(CP_UTF8, 0, name, -1, 0, 0, 0, 0); |
| 112 | + char* fn_mb = new char[fn_buffer_size]; |
| 113 | + WideCharToMultiByte(CP_UTF8, 0, name, -1, fn_mb, fn_buffer_size, 0, 0); |
| 114 | +#else |
| 115 | + const char* fn_mb = name; |
| 116 | +#endif |
| 117 | + |
| 118 | + if ( ! IfcGeomObjects::Init(fn_mb,0,0) ) return false; |
| 119 | + |
| 120 | + itfc->ProgressStart(_T("Importing file..."), TRUE, fn, NULL); |
113 | 121 |
|
114 | 122 | //std::map<int, TriObject*> dict; |
115 | 123 | MtlBaseLib* mats = itfc->GetSceneMtls(); |
116 | 124 | int slot = mats->Count(); |
117 | 125 |
|
118 | 126 | do{ |
119 | 127 |
|
120 | | - const IfcGeomObjects::IfcGeomObject* o = IfcGeomObjects::Get(); |
| 128 | + const IfcGeomObjects::IfcGeomObject* o = IfcGeomObjects::Get(); |
121 | 129 |
|
| 130 | +#if MAX_RELEASE > MAX_RELEASE_R14 |
| 131 | + TSTR o_type = TSTR::FromCStr(o->type.c_str()); |
| 132 | + TSTR o_guid = TSTR::FromCStr(o->guid.c_str()); |
| 133 | +#elif defined(_UNICODE) |
| 134 | + TSTR o_type = WStr(o->type.c_str()); |
| 135 | + TSTR o_guid = WStr(o->guid.c_str()); |
| 136 | +#else |
| 137 | + TSTR o_type = CStr(o->type.c_str()); |
| 138 | + TSTR o_guid = CStr(o->guid.c_str()); |
| 139 | +#endif |
| 140 | + |
122 | 141 | Mtl *m; |
123 | | - const int matIndex = mats->FindMtlByName(MSTR(o->type.c_str())); |
| 142 | + const int matIndex = mats->FindMtlByName(o_type); |
124 | 143 | if ( matIndex == -1 ) { |
125 | 144 | StdMat2* stdm = GetMaterial(o->type); |
126 | 145 | m = stdm; |
127 | | - m->SetName(o->type.c_str()); |
| 146 | + m->SetName(o_type); |
128 | 147 | mats->Add(m); |
129 | 148 | itfc->PutMtlToMtlEditor(m,slot++); |
130 | 149 | } else { |
@@ -169,13 +188,13 @@ int IFCImp::DoImport(const TCHAR *name, ImpInterface *impitfc, Interface *itfc, |
169 | 188 |
|
170 | 189 | ImpNode* node = impitfc->CreateNode(); |
171 | 190 | node->Reference(tri); |
172 | | - node->SetName(o->guid.c_str()); |
| 191 | + node->SetName(o_guid); |
173 | 192 | node->GetINode()->SetMtl(m); |
174 | 193 | node->SetTransform(0,Matrix3 ( Point3(o->matrix[0],o->matrix[1],o->matrix[2]),Point3(o->matrix[3],o->matrix[4],o->matrix[5]), |
175 | 194 | Point3(o->matrix[6],o->matrix[7],o->matrix[8]),Point3(o->matrix[9],o->matrix[10],o->matrix[11]) )); |
176 | 195 | impitfc->AddNodeToScene(node); |
177 | 196 |
|
178 | | - itfc->ProgressUpdate(IfcGeomObjects::Progress(),true,""); |
| 197 | + itfc->ProgressUpdate(IfcGeomObjects::Progress(),true,_T("")); |
179 | 198 |
|
180 | 199 | } while ( IfcGeomObjects::Next() ); |
181 | 200 |
|
|
0 commit comments