Fix build for Max 2010 plugins on VS2008

feature/3ds-max-2020
kaetemi 6 years ago
parent bd21bfeeb3
commit 449f0061f8

@ -303,30 +303,32 @@ inline sint nlstricmp(const std::string &lhs, const std::string &rhs) { return s
inline sint nlstricmp(const std::string &lhs, const char *rhs) { return stricmp(lhs.c_str(),rhs); } inline sint nlstricmp(const std::string &lhs, const char *rhs) { return stricmp(lhs.c_str(),rhs); }
inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp(lhs,rhs.c_str()); } inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp(lhs,rhs.c_str()); }
// macros helper to convert UTF-8 std::string and wchar_t* // TODO: Can we prefix these with 'nl' like other methods?
// Macros helper to convert UTF-8 std::string and wchar_t*
#define wideToUtf8(str) (ucstring((ucchar*)str).toUtf8()) #define wideToUtf8(str) (ucstring((ucchar*)str).toUtf8())
#define utf8ToWide(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str()) #define utf8ToWide(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str())
// macros helper to convert UTF-8 std::string and TCHAR* // Macros helper to convert UTF-8 std::string and TCHAR*
#ifdef _UNICODE #ifdef _UNICODE
#define tStrToUtf8(str) (ucstring((ucchar*)(LPCWSTR)str).toUtf8()) #define tStrToUtf8(str) (ucstring((ucchar*)(LPCWSTR)str).toUtf8())
#define utf8ToTStr(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str()) #define utf8ToTStr(str) ((const wchar_t *)ucstring::makeFromUtf8(str).c_str())
#else #else
// FIXME: This is not accurate, it should be a conversion between local charset and utf8
#define tStrToUtf8(str) (std::string((LPCSTR)str)) #define tStrToUtf8(str) (std::string((LPCSTR)str))
inline const char *nlutf8ToTStr(const char *str) { return str; } inline const char *nlutf8ToTStr(const char *str) { return str; }
inline const char *nlutf8ToTStr(const std::string &str) { return str.c_str(); } inline const char *nlutf8ToTStr(const std::string &str) { return str.c_str(); }
#define utf8ToTStr(str) NLMISC::nlutf8ToTStr(str) #define utf8ToTStr(str) NLMISC::nlutf8ToTStr(str)
#endif #endif
#if (NL_COMP_VC_VERSION <= 90) /* VS2008 does not have stdint.h */ #if (NL_COMP_VC_VERSION <= 90)
float nlroundf(float x) inline float nlroundf(float x)
{ {
return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f); return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
} }
#define roundf(x) NLMISC::nlroundf(x) #define roundf(x) NLMISC::nlroundf(x)
#endif #endif
// wrapper for fopen to be able to open files with an UTF-8 filename // Wrapper for fopen to be able to open files with an UTF-8 filename
FILE* nlfopen(const std::string &filename, const std::string &mode); FILE* nlfopen(const std::string &filename, const std::string &mode);
/** Signed 64 bit fseek. Same interface as fseek /** Signed 64 bit fseek. Same interface as fseek

@ -38,6 +38,8 @@
#include "nel/ligo/ligo_error.h" #include "nel/ligo/ligo_error.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "../../plugin_max/nel_3dsmax_shared/string_common.h"
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
extern HINSTANCE hInstance; extern HINSTANCE hInstance;
@ -132,7 +134,7 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di
if (res) if (res)
{ {
// Path // Path
std::string path = NLMISC::CFile::getPath(tStrToUtf8(sModulePath) + "ligoscape.cfg"); std::string path = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath) + "ligoscape.cfg");
try try
{ {
@ -164,12 +166,15 @@ void CMaxToLigo::errorMessage(const std::string &msg, const std::string &title,
if (dialog) if (dialog)
{ {
// Dialog message // Dialog message
MessageBox (it.GetMAXHWnd(), utf8ToTStr(msg), utf8ToTStr(title), MB_OK|MB_ICONEXCLAMATION); ucstring ucmsg, uctitle;
ucmsg.fromUtf8(msg);
uctitle.fromUtf8(title);
MessageBoxW(it.GetMAXHWnd(), (LPCWSTR)ucmsg.c_str(), (LPCWSTR)uctitle.c_str(), MB_OK | MB_ICONEXCLAMATION);
} }
else else
{ {
// Text message // Text message
mprintf (utf8ToTStr(msg + "\n")); mprintf(_M("%s\n"), MaxTStrFromUtf8(msg).data());
} }
// Output in log // Output in log

@ -155,7 +155,7 @@ Value* export_material_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
const std::string fileName = tStrToUtf8(arg_list[1]->to_string()); const std::string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The third arg // The third arg
bool checkOnly = (arg_list[2]->to_bool() != FALSE); bool checkOnly = (arg_list[2]->to_bool() != FALSE);
@ -321,12 +321,12 @@ Value* export_transition_cf (Value** arg_list, int count)
nlassert (is_array(nodes)); nlassert (is_array(nodes));
// The second arg // The second arg
std::string fileName = tStrToUtf8(arg_list[1]->to_string()); std::string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The second arg // The second arg
string matFilename[2]; string matFilename[2];
matFilename[0] = tStrToUtf8(arg_list[2]->to_string()); matFilename[0] = MCharStrToUtf8(arg_list[2]->to_string());
matFilename[1] = tStrToUtf8(arg_list[3]->to_string()); matFilename[1] = MCharStrToUtf8(arg_list[3]->to_string());
// The third arg // The third arg
bool checkOnly = (arg_list[4]->to_bool() != FALSE); bool checkOnly = (arg_list[4]->to_bool() != FALSE);
@ -696,7 +696,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string()); string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The fourth arg // The fourth arg
bool errorInDialog = (arg_list[2]->to_bool() != FALSE); bool errorInDialog = (arg_list[2]->to_bool() != FALSE);
@ -830,7 +830,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string()); string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The second arg // The second arg
int transitionNumber = arg_list[2]->to_int(); int transitionNumber = arg_list[2]->to_int();
@ -998,7 +998,7 @@ Value* export_zone_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string()); string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The thrid arg // The thrid arg
Array *array = (Array*)arg_list[2]; Array *array = (Array*)arg_list[2];
@ -1043,8 +1043,8 @@ Value* export_zone_cf (Value** arg_list, int count)
type_check (cell->get(2), String, message); type_check (cell->get(2), String, message);
// Get the strings // Get the strings
categories[i].first = tStrToUtf8(cell->get(1)->to_string()); categories[i].first = MCharStrToUtf8(cell->get(1)->to_string());
categories[i].second = tStrToUtf8(cell->get(2)->to_string()); categories[i].second = MCharStrToUtf8(cell->get(2)->to_string());
} }
// Get a Object pointer // Get a Object pointer
@ -1352,7 +1352,7 @@ Value* get_error_string_cf (Value** arg_list, int count)
int errorCode = arg_list[0]->to_int()-1; int errorCode = arg_list[0]->to_int()-1;
// Error code // Error code
return new String (utf8ToTStr(CLigoError::getStringError ((CLigoError::TError)errorCode))); return new String(MaxTStrFromUtf8(CLigoError::getStringError ((CLigoError::TError)errorCode)));
} }
// *************************************************************************** // ***************************************************************************
@ -1367,7 +1367,7 @@ Value* set_directory_cf (Value** arg_list, int count)
type_check(arg_list[0], String, message); type_check(arg_list[0], String, message);
// The first arg // The first arg
const std::string dir = tStrToUtf8(arg_list[0]->to_string()); const std::string dir = MCharStrToUtf8(arg_list[0]->to_string());
// Set the directory // Set the directory
return (chdir (dir.c_str())==0)?&true_value:&false_value; return (chdir (dir.c_str())==0)?&true_value:&false_value;
@ -1859,7 +1859,7 @@ Value* make_snapshot_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string()); string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The thrid arg // The thrid arg
int xMin = arg_list[2]->to_int(); int xMin = arg_list[2]->to_int();

@ -18,3 +18,5 @@
// and not in this file // and not in this file
#include "stdafx.h" #include "stdafx.h"
void nlmax_shared_stdafx_dummy() { }

@ -72,3 +72,5 @@ NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext()
} }
return NLMISC::INelContext::getInstance(); return NLMISC::INelContext::getInstance();
} }
/* end of file */

@ -25,3 +25,5 @@ class CPatchAllocator;
extern NEL_3DSMAX_SHARED_API CPatchAllocator& GetAllocator(); extern NEL_3DSMAX_SHARED_API CPatchAllocator& GetAllocator();
extern NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext(); extern NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext();
/* end of file */

@ -0,0 +1,75 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLMAX_STRING_COMMON_H
#define NLMAX_STRING_COMMON_H
#include <nel/misc/ucstring.h>
#if (MAX_VERSION_MAJOR < 15)
#define GET_OBJECT_NAME_CONST
#define NOTIFY_REF_PARAMS Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message
#define NOTIFY_REF_PROPAGATE , BOOL propagate
#define nl_p_end end
#else
#define GET_OBJECT_NAME_CONST const
#define NOTIFY_REF_PARAMS const Interval &changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate
#define nl_p_end p_end
#endif
static TSTR MaxTStrFromUtf8(const std::string &src)
{
TSTR dst;
#if (MAX_VERSION_MAJOR < 15)
ucstring uc;
uc.fromUtf8(src);
dst = (const mwchar_t *)uc.c_str();
#else
dst.FromUTF8(source);
#endif
return dst;
}
static std::string MaxTStrToUtf8(const TSTR& src)
{
#if (MAX_VERSION_MAJOR < 15)
#ifdef _UNICODE
ucstring uc(src.data());
return uc.toUtf8();
#else
WStr ws = src;
ucstring uc((const ucchar *)ws.data());
return uc.toUtf8();
#endif
#else
return src.ToUTF8();
#endif
}
static std::string MCharStrToUtf8(const MCHAR *src)
{
#ifdef _UNICODE
ucstring uc((const ucchar *)src);
return uc.toUtf8();
#else
ucstring uc((const ucchar *)WStr(src).data());
return uc.toUtf8();
#endif
}
#endif /* #ifndef NLMAX_STRING_COMMON_H */
/* end of file */

@ -94,7 +94,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
else else
SendMessage( GetDlgItem(hwndDlg,IDC_SHADOW), BM_SETCHECK, BST_UNCHECKED, 0 ); SendMessage( GetDlgItem(hwndDlg,IDC_SHADOW), BM_SETCHECK, BST_UNCHECKED, 0 );
SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(theExportSceneStruct.sExportLighting)); SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(theExportSceneStruct.sExportLighting).data());
if( theExportSceneStruct.nExportLighting == 0 ) if( theExportSceneStruct.nExportLighting == 0 )
SendMessage( GetDlgItem(hwndDlg,IDC_RADIONORMALEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 ); SendMessage( GetDlgItem(hwndDlg,IDC_RADIONORMALEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 );
@ -102,7 +102,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
if( theExportSceneStruct.nExportLighting == 1 ) if( theExportSceneStruct.nExportLighting == 1 )
SendMessage( GetDlgItem(hwndDlg,IDC_RADIORADIOSITYEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 ); SendMessage( GetDlgItem(hwndDlg,IDC_RADIORADIOSITYEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 );
SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.rLumelSize))); SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(toString(theExportSceneStruct.rLumelSize)).data());
if( theExportSceneStruct.nOverSampling == 1 ) if( theExportSceneStruct.nOverSampling == 1 )
SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_SETCHECK, BST_CHECKED, 0 ); SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_SETCHECK, BST_CHECKED, 0 );
@ -132,8 +132,8 @@ INT_PTR CALLBACK OptionsDialogCallback (
else else
SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_SETCHECK, BST_UNCHECKED, 0 ); SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_SETCHECK, BST_UNCHECKED, 0 );
SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.SurfaceLightingCellSize))); SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(toString(theExportSceneStruct.SurfaceLightingCellSize)).data());
SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.SurfaceLightingDeltaZ))); SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(toString(theExportSceneStruct.SurfaceLightingDeltaZ)).data());
} }
break; break;
@ -148,7 +148,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
if( theCNelExport.SelectDir(hwndDlg, _T("LightMaps Directory"), sTemp ) ) if( theCNelExport.SelectDir(hwndDlg, _T("LightMaps Directory"), sTemp ) )
{ {
theExportSceneStruct.sExportLighting = sTemp; theExportSceneStruct.sExportLighting = sTemp;
SendMessage( GetDlgItem(hwndDlg, IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(theExportSceneStruct.sExportLighting) ); SendMessage(GetDlgItem(hwndDlg, IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(theExportSceneStruct.sExportLighting).data());
} }
} }
break; break;
@ -180,7 +180,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
TCHAR tmp[1024]; TCHAR tmp[1024];
SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_GETTEXT, 1024, (LPARAM)tmp ); SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_GETTEXT, 1024, (LPARAM)tmp );
theExportSceneStruct.sExportLighting = tStrToUtf8(tmp); theExportSceneStruct.sExportLighting = MCharStrToUtf8(tmp);
if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIONORMALEXPORTLIGHTING), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIONORMALEXPORTLIGHTING), BM_GETCHECK, 0, 0 ) == BST_CHECKED )
theExportSceneStruct.nExportLighting = 0; theExportSceneStruct.nExportLighting = 0;
@ -189,7 +189,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
theExportSceneStruct.nExportLighting = 1; theExportSceneStruct.nExportLighting = 1;
SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_GETTEXT, 1024, (LPARAM)tmp ); SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_GETTEXT, 1024, (LPARAM)tmp );
NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.rLumelSize); NLMISC::fromString(MCharStrToUtf8(tmp), theExportSceneStruct.rLumelSize);
if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_GETCHECK, 0, 0 ) == BST_CHECKED )
theExportSceneStruct.nOverSampling = 1; theExportSceneStruct.nOverSampling = 1;
@ -214,10 +214,10 @@ INT_PTR CALLBACK OptionsDialogCallback (
theExportSceneStruct.bTestSurfaceLighting= (SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_GETCHECK, 0, 0 ) == BST_CHECKED); theExportSceneStruct.bTestSurfaceLighting= (SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_GETCHECK, 0, 0 ) == BST_CHECKED);
SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_GETTEXT, 1024, (LPARAM)tmp ); SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_GETTEXT, 1024, (LPARAM)tmp );
NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingCellSize); NLMISC::fromString(MCharStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingCellSize);
SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_GETTEXT, 1024, (LPARAM)tmp ); SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_GETTEXT, 1024, (LPARAM)tmp );
NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingDeltaZ); NLMISC::fromString(MCharStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingDeltaZ);
// End the dialog // End the dialog
EndDialog(hwndDlg, TRUE); EndDialog(hwndDlg, TRUE);
@ -354,7 +354,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (RPO::isZone (*pNode, time)) if (RPO::isZone (*pNode, time))
{ {
// Save path // Save path
std::string sSavePath = tStrToUtf8(pNode->GetName()); std::string sSavePath = MCharStrToUtf8(pNode->GetName());
// Choose a file to export // Choose a file to export
if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0))
@ -364,15 +364,15 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (!theCNelExport.exportZone (sSavePath, *pNode, time)) if (!theCNelExport.exportZone (sSavePath, *pNode, time))
{ {
// Error message // Error message
std::string sErrorMsg = toString("Error exporting the zone %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); std::string sErrorMsg = toString("Error exporting the zone %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox (hWnd, utf8ToTStr(sErrorMsg), L"NeL export", MB_OK|MB_ICONEXCLAMATION); MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
else if (CExportNel::isVegetable (*pNode, time)) else if (CExportNel::isVegetable (*pNode, time))
{ {
// Save path // Save path
std::string sSavePath = tStrToUtf8(pNode->GetName()); std::string sSavePath = MCharStrToUtf8(pNode->GetName());
// Choose a file to export // Choose a file to export
if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0))
@ -382,8 +382,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (!theCNelExport.exportVegetable (sSavePath.c_str(), *pNode, time)) if (!theCNelExport.exportVegetable (sSavePath.c_str(), *pNode, time))
{ {
// Error message // Error message
std::string sErrorMsg = toString("Error exporting the vegetable %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); std::string sErrorMsg = toString("Error exporting the vegetable %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
@ -391,7 +391,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
else if (CExportNel::isLodCharacter (*pNode, time)) else if (CExportNel::isLodCharacter (*pNode, time))
{ {
// Save path // Save path
std::string sSavePath = tStrToUtf8(pNode->GetName()); std::string sSavePath = MCharStrToUtf8(pNode->GetName());
// Choose a file to export // Choose a file to export
if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0))
@ -401,8 +401,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (!theCNelExport.exportLodCharacter (sSavePath, *pNode, time)) if (!theCNelExport.exportLodCharacter (sSavePath, *pNode, time))
{ {
// Error message // Error message
std::string sErrorMsg = toString("Error exporting the lod character %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); std::string sErrorMsg = toString("Error exporting the lod character %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
@ -410,7 +410,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
else if (CExportNel::isMesh (*pNode, time)) else if (CExportNel::isMesh (*pNode, time))
{ {
// Save path // Save path
std::string sSavePath = tStrToUtf8(pNode->GetName()); std::string sSavePath = MCharStrToUtf8(pNode->GetName());
// Choose a file to export // Choose a file to export
if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0))
@ -424,8 +424,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (!theCNelExport.exportMesh (sSavePath, *pNode, time)) if (!theCNelExport.exportMesh (sSavePath, *pNode, time))
{ {
// Error message // Error message
std::string sErrorMsg = toString("Error exporting the mesh %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); std::string sErrorMsg = toString("Error exporting the mesh %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
} }
// Delete the skeleton pointer // Delete the skeleton pointer
if (pSkinShape) if (pSkinShape)
@ -463,7 +463,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
// Name of the node // Name of the node
// Save path // Save path
std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName()); std::string sSavePath = MCharStrToUtf8((*vectNode.begin())->GetName());
// Choose a file to export // Choose a file to export
if (theCNelExport.SelectFileForSave (hWnd, _T("Save animations..."), (LOWORD(wParam)==ID_SAVE_MODEL_ANIM)?animModelFilter:animModelFilter, if (theCNelExport.SelectFileForSave (hWnd, _T("Save animations..."), (LOWORD(wParam)==ID_SAVE_MODEL_ANIM)?animModelFilter:animModelFilter,
@ -473,8 +473,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (!theCNelExport.exportAnim (sSavePath, vectNode, time, LOWORD(wParam)==ID_SAVE_SCENE_ANIM)) if (!theCNelExport.exportAnim (sSavePath, vectNode, time, LOWORD(wParam)==ID_SAVE_SCENE_ANIM))
{ {
// Error message // Error message
std::string sErrorMsg = toString("Error exporting animation %s in the file\n%s", tStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str()); std::string sErrorMsg = toString("Error exporting animation %s in the file\n%s", MCharStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str());
MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); MessageBox(hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -566,7 +566,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
nlassert (vectNode.size()!=0); nlassert (vectNode.size()!=0);
// Save path // Save path
std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName()); std::string sSavePath = MCharStrToUtf8((*vectNode.begin())->GetName());
if (theCNelExport.SelectFileForSave (hWnd, _T("Save SWT..."), SWTFilter, sSavePath)) if (theCNelExport.SelectFileForSave (hWnd, _T("Save SWT..."), SWTFilter, sSavePath))
{ {
@ -574,8 +574,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (!theCNelExport.exportSWT (sSavePath, vectNode)) if (!theCNelExport.exportSWT (sSavePath, vectNode))
{ {
// Error message // Error message
std::string sErrorMsg = toString("Error exporting SWT %s in the file\n%s", tStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str()); std::string sErrorMsg = toString("Error exporting SWT %s in the file\n%s", MCharStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str());
MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); MessageBox(hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -588,7 +588,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
nlassert (theIP); nlassert (theIP);
theCNelExport.init (false, true, theIP, true); theCNelExport.init (false, true, theIP, true);
std::string sConfigFileName = tStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg"; std::string sConfigFileName = MCharStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg";
// Do a modal dialog box to choose the scene export options // Do a modal dialog box to choose the scene export options
if( DialogBox( hInstance, if( DialogBox( hInstance,
@ -647,7 +647,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
theCNelExport.getSelectedNode (vectNode); theCNelExport.getSelectedNode (vectNode);
nlassert (vectNode.size()!=0); nlassert (vectNode.size()!=0);
std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName()); std::string sSavePath = MCharStrToUtf8((*vectNode.begin())->GetName());
if (theCNelExport.SelectFileForSave (hWnd, _T("Save Instance group"), InstanceGroupFilter, sSavePath)) if (theCNelExport.SelectFileForSave (hWnd, _T("Save Instance group"), InstanceGroupFilter, sSavePath))
{ {
@ -656,7 +656,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
{ {
// Error message // Error message
std::string sErrorMsg = toString("Error exporting instance group %s", sSavePath.c_str()); std::string sErrorMsg = toString("Error exporting instance group %s", sSavePath.c_str());
MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); MessageBox(hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -690,8 +690,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (!theCNelExport.exportSkeleton (sSavePath, pNode, theCNelExport._Ip->GetTime())) if (!theCNelExport.exportSkeleton (sSavePath, pNode, theCNelExport._Ip->GetTime()))
{ {
// Error message // Error message
std::string sErrorMsg = toString("Error exporting skeleton %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); std::string sErrorMsg = toString("Error exporting skeleton %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); MessageBox(hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -736,7 +736,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
} }
catch(const std::exception &e) catch(const std::exception &e)
{ {
::MessageBox(hWnd, utf8ToTStr(e.what()), _T("Error"), MB_OK | MB_ICONEXCLAMATION); ::MessageBoxA(hWnd, e.what(), "Error", MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -820,7 +820,7 @@ void CNelExport::getSelectedNode (std::vector<INode*>& vectNode)
void CNelExport::initOptions() void CNelExport::initOptions()
{ {
// Initialization of theExportSceneStruct // Initialization of theExportSceneStruct
std::string sConfigFileName = tStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg"; std::string sConfigFileName = MCharStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg";
// MessageBox (hWnd, sConfigFileName, "sConfigFileName", MB_OK|MB_ICONEXCLAMATION); // MessageBox (hWnd, sConfigFileName, "sConfigFileName", MB_OK|MB_ICONEXCLAMATION);
if( CFile::fileExists(sConfigFileName) ) if( CFile::fileExists(sConfigFileName) )

@ -329,7 +329,7 @@ bool CNelExport::exportAnim (const std::string &sPath, std::vector<INode*>& vect
catch (const Exception& e) catch (const Exception& e)
{ {
if (_ErrorInDialog) if (_ErrorInDialog)
MessageBox (NULL, utf8ToTStr(e.what()), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); MessageBoxA (NULL, e.what(), "NeL export", MB_OK|MB_ICONEXCLAMATION);
else else
nlwarning ("ERROR : %s", e.what ()); nlwarning ("ERROR : %s", e.what ());
} }

@ -50,8 +50,8 @@ ULONG CNelExport::SelectFileForSave(HWND Parent, const TCHAR* Title, const TCHAR
} }
// copy path and filename to temporary buffers // copy path and filename to temporary buffers
_tcscpy_s(curdir, MAX_PATH, utf8ToTStr(path)); _tcscpy_s(curdir, MAX_PATH, MaxTStrFromUtf8(path).data());
_tcscpy_s(fname, MAX_PATH, utf8ToTStr(filename)); _tcscpy_s(fname, MAX_PATH, MaxTStrFromUtf8(filename).data());
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn,0,sizeof(OPENFILENAME)); memset(&ofn,0,sizeof(OPENFILENAME));
@ -69,7 +69,7 @@ ULONG CNelExport::SelectFileForSave(HWND Parent, const TCHAR* Title, const TCHAR
ofn.lpstrInitialDir = curdir; ofn.lpstrInitialDir = curdir;
BOOL r = GetSaveFileName ( &ofn ); BOOL r = GetSaveFileName ( &ofn );
FileName = tStrToUtf8(fname); FileName = MCharStrToUtf8(fname);
return r; return r;
} }
@ -79,7 +79,7 @@ ULONG CNelExport::SelectFileForSave(HWND Parent, const TCHAR* Title, const TCHAR
ULONG CNelExport::SelectDir(HWND Parent, const TCHAR* Title, std::string &Path) ULONG CNelExport::SelectDir(HWND Parent, const TCHAR* Title, std::string &Path)
{ {
TCHAR str[MAX_PATH]; TCHAR str[MAX_PATH];
_tcscpy_s(str, MAX_PATH, utf8ToTStr(Path)); _tcscpy_s(str, MAX_PATH, MaxTStrFromUtf8(Path).data());
BROWSEINFO bi; BROWSEINFO bi;
bi.hwndOwner=Parent; bi.hwndOwner=Parent;
@ -98,7 +98,7 @@ ULONG CNelExport::SelectDir(HWND Parent, const TCHAR* Title, std::string &Path)
return 0; return 0;
} }
Path = tStrToUtf8(str); Path = MCharStrToUtf8(str);
return 1; return 1;
} }

@ -90,11 +90,11 @@ class addSubLodNodeHitCallBack : public HitByNameDlgCallback
public: public:
INodeTab NodeTab; INodeTab NodeTab;
private: private:
virtual const MCHAR *dialogTitle() virtual GET_OBJECT_NAME_CONST MCHAR *dialogTitle()
{ {
return _M("Select sub lod objects to add"); return _M("Select sub lod objects to add");
} }
virtual const MCHAR *buttonText() virtual GET_OBJECT_NAME_CONST MCHAR *buttonText()
{ {
return _M("Add"); return _M("Add");
} }
@ -522,27 +522,27 @@ INT_PTR CALLBACK AccelDialogCallback (
std::set<std::string>::iterator first(_KnownSoundGroups.begin()), last(_KnownSoundGroups.end()); std::set<std::string>::iterator first(_KnownSoundGroups.begin()), last(_KnownSoundGroups.end());
for (; first != last; ++first) for (; first != last; ++first)
{ {
SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_ADDSTRING, 0, (LPARAM)utf8ToTStr(*first)); SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_ADDSTRING, 0, (LPARAM)MaxTStrFromUtf8(*first).data());
} }
} }
// set the combo and edit box // set the combo and edit box
if (SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->OcclusionModel)) == CB_ERR) if (SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)MaxTStrFromUtf8(currentParam->OcclusionModel).data()) == CB_ERR)
{ {
// nlassert(false); // nlassert(false);
} }
if (SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->OpenOcclusionModel)) == CB_ERR) if (SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)MaxTStrFromUtf8(currentParam->OpenOcclusionModel).data()) == CB_ERR)
{ {
// nlassert(false); // nlassert(false);
} }
if (SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->EnvironmentFX)) == CB_ERR) if (SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_SELECTSTRING, -1, (LPARAM)MaxTStrFromUtf8(currentParam->EnvironmentFX).data()) == CB_ERR)
{ {
// nlassert(false); // nlassert(false);
} }
if (SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->SoundGroup)) == CB_ERR) if (SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_SELECTSTRING, -1, (LPARAM)MaxTStrFromUtf8(currentParam->SoundGroup).data()) == CB_ERR)
{ {
// nlassert(false); // nlassert(false);
} }
// SendMessage(GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(currentParam->SoundGroup)); // SendMessage(GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(currentParam->SoundGroup).data());
bool accelerator = (currentParam->AcceleratorType != -1); bool accelerator = (currentParam->AcceleratorType != -1);
CheckRadioButton (hwndDlg, IDC_RADIOACCELNO, IDC_RADIOACCELCLUSTER, accelerator?(IDC_RADIOACCELNO+(currentParam->AcceleratorType&NEL3D_APPDATA_ACCEL_TYPE)):0); CheckRadioButton (hwndDlg, IDC_RADIOACCELNO, IDC_RADIOACCELCLUSTER, accelerator?(IDC_RADIOACCELNO+(currentParam->AcceleratorType&NEL3D_APPDATA_ACCEL_TYPE)):0);
@ -583,14 +583,14 @@ INT_PTR CALLBACK AccelDialogCallback (
// get the strings params // get the strings params
TCHAR tmp[256]; TCHAR tmp[256];
SendMessage (GetDlgItem(hwndDlg, IDC_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp); SendMessage (GetDlgItem(hwndDlg, IDC_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->OcclusionModel = tStrToUtf8(tmp); currentParam->OcclusionModel = MCharStrToUtf8(tmp);
SendMessage (GetDlgItem(hwndDlg, IDC_OPEN_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp); SendMessage (GetDlgItem(hwndDlg, IDC_OPEN_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->OpenOcclusionModel = tStrToUtf8(tmp); currentParam->OpenOcclusionModel = MCharStrToUtf8(tmp);
SendMessage (GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_GETTEXT, 256, (LPARAM)tmp); SendMessage (GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->SoundGroup = tStrToUtf8(tmp); currentParam->SoundGroup = MCharStrToUtf8(tmp);
_KnownSoundGroups.insert(currentParam->SoundGroup); _KnownSoundGroups.insert(currentParam->SoundGroup);
SendMessage (GetDlgItem(hwndDlg, IDC_ENV_FX), WM_GETTEXT, 256, (LPARAM)tmp); SendMessage (GetDlgItem(hwndDlg, IDC_ENV_FX), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->EnvironmentFX = tStrToUtf8(tmp); currentParam->EnvironmentFX = MCharStrToUtf8(tmp);
// Quit // Quit
EndDialog(hwndDlg, IDOK); EndDialog(hwndDlg, IDOK);
@ -653,9 +653,9 @@ INT_PTR CALLBACK MRMDialogCallback (
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
// Window text // Window text
std::string winName= tStrToUtf8((*(currentParam->ListNode->begin()))->GetName()); std::string winName= MCharStrToUtf8((*(currentParam->ListNode->begin()))->GetName());
winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")"); winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")");
SetWindowText (hwndDlg, utf8ToTStr(winName)); SetWindowText (hwndDlg, MaxTStrFromUtf8(winName).data());
// Set default state // Set default state
SendMessage (GetDlgItem (hwndDlg, IDC_BLEND_IN), BM_SETCHECK, currentParam->BlendIn, 0); SendMessage (GetDlgItem (hwndDlg, IDC_BLEND_IN), BM_SETCHECK, currentParam->BlendIn, 0);
@ -669,8 +669,8 @@ INT_PTR CALLBACK MRMDialogCallback (
EnableWindow (GetDlgItem (hwndDlg, IDC_UP), currentParam->ListActived); EnableWindow (GetDlgItem (hwndDlg, IDC_UP), currentParam->ListActived);
EnableWindow (GetDlgItem (hwndDlg, IDC_DOWN), currentParam->ListActived); EnableWindow (GetDlgItem (hwndDlg, IDC_DOWN), currentParam->ListActived);
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), utf8ToTStr(currentParam->DistMax)); SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), MaxTStrFromUtf8(currentParam->DistMax).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), utf8ToTStr(currentParam->BlendLength)); SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), MaxTStrFromUtf8(currentParam->BlendLength).data());
SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_SETCHECK, currentParam->MRM, 0); SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_SETCHECK, currentParam->MRM, 0);
CoarseStateChanged (hwndDlg); CoarseStateChanged (hwndDlg);
@ -678,12 +678,12 @@ INT_PTR CALLBACK MRMDialogCallback (
if (currentParam->SkinReduction!=-1) if (currentParam->SkinReduction!=-1)
CheckRadioButton (hwndDlg, IDC_SKIN_REDUCTION_MIN, IDC_SKIN_REDUCTION_BEST, IDC_SKIN_REDUCTION_MIN+currentParam->SkinReduction); CheckRadioButton (hwndDlg, IDC_SKIN_REDUCTION_MIN, IDC_SKIN_REDUCTION_BEST, IDC_SKIN_REDUCTION_MIN+currentParam->SkinReduction);
SetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), utf8ToTStr(currentParam->NbLod)); SetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), MaxTStrFromUtf8(currentParam->NbLod).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), utf8ToTStr(currentParam->Divisor)); SetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), MaxTStrFromUtf8(currentParam->Divisor).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), utf8ToTStr(currentParam->DistanceFinest)); SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), MaxTStrFromUtf8(currentParam->DistanceFinest).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), utf8ToTStr(currentParam->DistanceMiddle)); SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), MaxTStrFromUtf8(currentParam->DistanceMiddle).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), utf8ToTStr(currentParam->DistanceCoarsest)); SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), MaxTStrFromUtf8(currentParam->DistanceCoarsest).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), utf8ToTStr(currentParam->BoneLodDistance)); SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), MaxTStrFromUtf8(currentParam->BoneLodDistance).data());
// Iterate list // Iterate list
HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1); HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1);
@ -719,9 +719,9 @@ INT_PTR CALLBACK MRMDialogCallback (
TCHAR tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), tmp, 512);
currentParam->DistMax = tStrToUtf8(tmp); currentParam->DistMax = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), tmp, 512);
currentParam->BlendLength = tStrToUtf8(tmp); currentParam->BlendLength = MCharStrToUtf8(tmp);
currentParam->MRM=SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_GETCHECK, 0, 0); currentParam->MRM=SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_GETCHECK, 0, 0);
@ -734,17 +734,17 @@ INT_PTR CALLBACK MRMDialogCallback (
currentParam->SkinReduction=2; currentParam->SkinReduction=2;
GetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), tmp, 512);
currentParam->NbLod = tStrToUtf8(tmp); currentParam->NbLod = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), tmp, 512);
currentParam->Divisor = tStrToUtf8(tmp); currentParam->Divisor = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), tmp, 512);
currentParam->DistanceFinest = tStrToUtf8(tmp); currentParam->DistanceFinest = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), tmp, 512);
currentParam->DistanceMiddle = tStrToUtf8(tmp); currentParam->DistanceMiddle = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), tmp, 512);
currentParam->DistanceCoarsest = tStrToUtf8(tmp); currentParam->DistanceCoarsest = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), tmp, 512);
currentParam->BoneLodDistance = tStrToUtf8(tmp); currentParam->BoneLodDistance = MCharStrToUtf8(tmp);
// Iterate list // Iterate list
HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1); HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1);
@ -758,7 +758,7 @@ INT_PTR CALLBACK MRMDialogCallback (
SendMessage (hwndList, LB_GETTEXT, item, (LPARAM) tmp); SendMessage (hwndList, LB_GETTEXT, item, (LPARAM) tmp);
// Push it back // Push it back
currentParam->ListLodName.push_back (tStrToUtf8(tmp)); currentParam->ListLodName.push_back (MCharStrToUtf8(tmp));
} }
// default LodCharacter // default LodCharacter
@ -920,8 +920,8 @@ INT_PTR CALLBACK InstanceDialogCallback (
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), utf8ToTStr(currentParam->InstanceShape)); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), MaxTStrFromUtf8(currentParam->InstanceShape).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), utf8ToTStr(currentParam->InstanceName)); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), MaxTStrFromUtf8(currentParam->InstanceName).data());
SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_SETCHECK, currentParam->DontAddToScene, 0); SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_SETCHECK, currentParam->DontAddToScene, 0);
@ -930,7 +930,7 @@ INT_PTR CALLBACK InstanceDialogCallback (
SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION), BM_SETCHECK, currentParam->Collision, 0); SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION), BM_SETCHECK, currentParam->Collision, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION_EXTERIOR), BM_SETCHECK, currentParam->CollisionExterior, 0); SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION_EXTERIOR), BM_SETCHECK, currentParam->CollisionExterior, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), utf8ToTStr(currentParam->InstanceGroupName)); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), MaxTStrFromUtf8(currentParam->InstanceGroupName).data());
bool colOk = currentParam->CollisionMeshGeneration>=0 && currentParam->CollisionMeshGeneration<4; bool colOk = currentParam->CollisionMeshGeneration>=0 && currentParam->CollisionMeshGeneration<4;
CheckRadioButton (hwndDlg, IDC_CAMERA_COL_RADIO1, IDC_CAMERA_COL_RADIO4, colOk?(IDC_CAMERA_COL_RADIO1+(currentParam->CollisionMeshGeneration)):0); CheckRadioButton (hwndDlg, IDC_CAMERA_COL_RADIO1, IDC_CAMERA_COL_RADIO4, colOk?(IDC_CAMERA_COL_RADIO1+(currentParam->CollisionMeshGeneration)):0);
@ -952,14 +952,14 @@ INT_PTR CALLBACK InstanceDialogCallback (
{ {
TCHAR tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), tmp, 512);
currentParam->InstanceShape = tStrToUtf8(tmp); currentParam->InstanceShape = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), tmp, 512);
currentParam->InstanceName = tStrToUtf8(tmp); currentParam->InstanceName = MCharStrToUtf8(tmp);
currentParam->DontAddToScene=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_GETCHECK, 0, 0); currentParam->DontAddToScene=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), tmp, 512);
currentParam->InstanceGroupName = tStrToUtf8(tmp); currentParam->InstanceGroupName = MCharStrToUtf8(tmp);
currentParam->DontExport=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_EXPORT), BM_GETCHECK, 0, 0); currentParam->DontExport=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_EXPORT), BM_GETCHECK, 0, 0);
@ -1036,9 +1036,9 @@ INT_PTR CALLBACK LightmapDialogCallback (
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), utf8ToTStr(currentParam->LumelSizeMul)); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), MaxTStrFromUtf8(currentParam->LumelSizeMul).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), utf8ToTStr(currentParam->SoftShadowRadius)); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), MaxTStrFromUtf8(currentParam->SoftShadowRadius).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), utf8ToTStr(currentParam->SoftShadowConeLength)); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), MaxTStrFromUtf8(currentParam->SoftShadowConeLength).data());
// Lighting // Lighting
SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_SETCHECK, currentParam->ExportRealTimeLight, 0); SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_SETCHECK, currentParam->ExportRealTimeLight, 0);
@ -1048,7 +1048,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
SendMessage (GetDlgItem (hwndDlg, IDC_USE_LIGHT_LOCAL_ATTENUATION), BM_SETCHECK, currentParam->UseLightingLocalAttenuation, 0); SendMessage (GetDlgItem (hwndDlg, IDC_USE_LIGHT_LOCAL_ATTENUATION), BM_SETCHECK, currentParam->UseLightingLocalAttenuation, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_INTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowInterior, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_INTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowInterior, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowExterior, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowExterior, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), utf8ToTStr(currentParam->ExportLightMapName)); SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), MaxTStrFromUtf8(currentParam->ExportLightMapName).data());
SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_SETCHECK, currentParam->RealTimeAmbientLightAddSun, 0); SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_SETCHECK, currentParam->RealTimeAmbientLightAddSun, 0);
// Set enable disable // Set enable disable
@ -1075,11 +1075,11 @@ INT_PTR CALLBACK LightmapDialogCallback (
// Set default state // Set default state
TCHAR tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), tmp, 512);
currentParam->LumelSizeMul = tStrToUtf8(tmp); currentParam->LumelSizeMul = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), tmp, 512);
currentParam->SoftShadowRadius = tStrToUtf8(tmp); currentParam->SoftShadowRadius = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), tmp, 512);
currentParam->SoftShadowConeLength = tStrToUtf8(tmp); currentParam->SoftShadowConeLength = MCharStrToUtf8(tmp);
// RealTime light // RealTime light
currentParam->ExportRealTimeLight = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_GETCHECK, 0, 0); currentParam->ExportRealTimeLight = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_GETCHECK, 0, 0);
@ -1090,7 +1090,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
currentParam->LightDontCastShadowExterior = SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_GETCHECK, 0, 0); currentParam->LightDontCastShadowExterior = SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_GETCHECK, 0, 0);
currentParam->ExportLightMapAnimated = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_ANIMATED), BM_GETCHECK, 0, 0); currentParam->ExportLightMapAnimated = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_ANIMATED), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), tmp, 512);
currentParam->ExportLightMapName = tStrToUtf8(tmp); currentParam->ExportLightMapName = MCharStrToUtf8(tmp);
currentParam->RealTimeAmbientLightAddSun= SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_GETCHECK, 0, 0); currentParam->RealTimeAmbientLightAddSun= SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_GETCHECK, 0, 0);
// Get the acceleration type // Get the acceleration type
@ -1679,7 +1679,7 @@ INT_PTR CALLBACK VegetableDialogCallback (
CheckRadioButton(hwndDlg, IDC_CENTER_NULL, IDC_CENTER_Z, IDC_CENTER_NULL+currentParam->VegetableBendCenter); CheckRadioButton(hwndDlg, IDC_CENTER_NULL, IDC_CENTER_Z, IDC_CENTER_NULL+currentParam->VegetableBendCenter);
SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), utf8ToTStr(currentParam->VegetableBendFactor)); SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), MaxTStrFromUtf8(currentParam->VegetableBendFactor).data());
VegetableStateChanged (hwndDlg); VegetableStateChanged (hwndDlg);
} }
@ -1734,7 +1734,7 @@ INT_PTR CALLBACK VegetableDialogCallback (
TCHAR tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), tmp, 512);
currentParam->VegetableBendFactor = tStrToUtf8(tmp); currentParam->VegetableBendFactor = MCharStrToUtf8(tmp);
} }
break; break;
case IDC_VEGETABLE: case IDC_VEGETABLE:
@ -2290,34 +2290,34 @@ INT_PTR CALLBACK MiscDialogCallback (
// Ligoscape // Ligoscape
SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_SETCHECK, currentParam->LigoSymmetry, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_SETCHECK, currentParam->LigoSymmetry, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), utf8ToTStr(currentParam->LigoRotate)); SetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), MaxTStrFromUtf8(currentParam->LigoRotate).data());
// SWT // SWT
SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_SETCHECK, currentParam->SWT, 0); SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_SETCHECK, currentParam->SWT, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), utf8ToTStr(currentParam->SWTWeight)); SetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), MaxTStrFromUtf8(currentParam->SWTWeight).data());
// Radial normals // Radial normals
for (uint smoothGroup=0; smoothGroup<NEL3D_RADIAL_NORMAL_COUNT; smoothGroup++) for (uint smoothGroup=0; smoothGroup<NEL3D_RADIAL_NORMAL_COUNT; smoothGroup++)
SetWindowText (GetDlgItem (hwndDlg, IDC_RADIAL_NORMAL_29+smoothGroup), utf8ToTStr(currentParam->RadialNormals[smoothGroup])); SetWindowText (GetDlgItem (hwndDlg, IDC_RADIAL_NORMAL_29+smoothGroup), MaxTStrFromUtf8(currentParam->RadialNormals[smoothGroup]).data());
// Mesh interfaces // Mesh interfaces
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), utf8ToTStr(currentParam->InterfaceFileName)); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), MaxTStrFromUtf8(currentParam->InterfaceFileName).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD),
currentParam->InterfaceThreshold != -1.f ? utf8ToTStr(toStringMax(currentParam->InterfaceThreshold)) currentParam->InterfaceThreshold != -1.f ? MaxTStrFromUtf8(toStringMax(currentParam->InterfaceThreshold)).data()
: _T("") : _T("")
); );
SendMessage(GetDlgItem(hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_SETCHECK, currentParam->GetInterfaceNormalsFromSceneObjects, 0); SendMessage(GetDlgItem(hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_SETCHECK, currentParam->GetInterfaceNormalsFromSceneObjects, 0);
// Skeleton Scale // Skeleton Scale
SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_SETCHECK, currentParam->ExportBoneScale, 0); SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_SETCHECK, currentParam->ExportBoneScale, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), utf8ToTStr(currentParam->ExportBoneScaleNameExt)); SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), MaxTStrFromUtf8(currentParam->ExportBoneScaleNameExt).data());
// Remanence // Remanence
SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_SETCHECK, currentParam->UseRemanence, 0); SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_SETCHECK, currentParam->UseRemanence, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_REMANENCE_SHIFTING_TEXTURE), BM_SETCHECK, currentParam->RemanenceShiftingTexture, 0); SendMessage (GetDlgItem (hwndDlg, IDC_REMANENCE_SHIFTING_TEXTURE), BM_SETCHECK, currentParam->RemanenceShiftingTexture, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), currentParam->RemanenceSliceNumber != - 1 ? utf8ToTStr(toStringMax(currentParam->RemanenceSliceNumber)) : _T("")); SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), currentParam->RemanenceSliceNumber != - 1 ? MaxTStrFromUtf8(toStringMax(currentParam->RemanenceSliceNumber)).data() : _T(""));
SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), currentParam->RemanenceSamplingPeriod != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceSamplingPeriod)) : _T("")); SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), currentParam->RemanenceSamplingPeriod != -1 ? MaxTStrFromUtf8(toStringMax(currentParam->RemanenceSamplingPeriod)).data() : _T(""));
SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceRollupRatio)) : _T("")); SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? MaxTStrFromUtf8(toStringMax(currentParam->RemanenceRollupRatio)).data() : _T(""));
} }
break; break;
@ -2338,24 +2338,24 @@ INT_PTR CALLBACK MiscDialogCallback (
currentParam->LigoSymmetry = SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_GETCHECK, 0, 0); currentParam->LigoSymmetry = SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_GETCHECK, 0, 0);
TCHAR tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), tmp, 512);
currentParam->LigoRotate = tStrToUtf8(tmp); currentParam->LigoRotate = MCharStrToUtf8(tmp);
// SWT // SWT
currentParam->SWT = SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_GETCHECK, 0, 0); currentParam->SWT = SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), tmp, 512);
currentParam->SWTWeight = tStrToUtf8(tmp); currentParam->SWTWeight = MCharStrToUtf8(tmp);
// Radial normals // Radial normals
for (uint smoothGroup=0; smoothGroup<NEL3D_RADIAL_NORMAL_COUNT; smoothGroup++) for (uint smoothGroup=0; smoothGroup<NEL3D_RADIAL_NORMAL_COUNT; smoothGroup++)
{ {
HWND edit = GetDlgItem (hwndDlg, IDC_RADIAL_NORMAL_29+smoothGroup); HWND edit = GetDlgItem (hwndDlg, IDC_RADIAL_NORMAL_29+smoothGroup);
GetWindowText (edit, tmp, 512); GetWindowText (edit, tmp, 512);
currentParam->RadialNormals[smoothGroup] = tStrToUtf8(tmp); currentParam->RadialNormals[smoothGroup] = MCharStrToUtf8(tmp);
} }
// mesh interfaces // mesh interfaces
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), tmp, 512);
currentParam->InterfaceFileName = tStrToUtf8(tmp); currentParam->InterfaceFileName = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), tmp, 512);
if (_tcslen(tmp) != 0) if (_tcslen(tmp) != 0)
currentParam->InterfaceThreshold = toFloatMax(tmp); currentParam->InterfaceThreshold = toFloatMax(tmp);
@ -2365,7 +2365,7 @@ INT_PTR CALLBACK MiscDialogCallback (
// Skeleton Scale // Skeleton Scale
currentParam->ExportBoneScale= SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_GETCHECK, 0, 0); currentParam->ExportBoneScale= SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), tmp, 512);
currentParam->ExportBoneScaleNameExt = tStrToUtf8(tmp); currentParam->ExportBoneScaleNameExt = MCharStrToUtf8(tmp);
// remanence // remanence
currentParam->UseRemanence = SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_GETCHECK, 0, 0); currentParam->UseRemanence = SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_GETCHECK, 0, 0);
@ -2374,7 +2374,7 @@ INT_PTR CALLBACK MiscDialogCallback (
GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), tmp, 512);
uint rsn; uint rsn;
if (NLMISC::fromString(tStrToUtf8(tmp), rsn)) if (NLMISC::fromString(MCharStrToUtf8(tmp), rsn))
{ {
currentParam->RemanenceSliceNumber = rsn; currentParam->RemanenceSliceNumber = rsn;
} }
@ -2492,9 +2492,9 @@ INT_PTR CALLBACK LodDialogCallback (
currentParam = (CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam = (CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
// Window text // Window text
std::string winName = tStrToUtf8((*(currentParam->ListNode->begin()))->GetName()); TSTR winName = (*(currentParam->ListNode->begin()))->GetName();
winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")"); winName = TSTR("Node properties (") + winName + ((currentParam->ListNode->size() > 1) ? _M(" ...)") : _M(")"));
SetWindowText (hwndDlg, utf8ToTStr(winName)); SetWindowText(hwndDlg, winName.data());
// Move dialog // Move dialog
RECT windowRect, desktopRect; RECT windowRect, desktopRect;

@ -59,7 +59,7 @@ bool CNelExport::exportInstanceGroup(string filename, vector<INode*>& vectNode)
catch (const Exception &c) catch (const Exception &c)
{ {
// Cannot save the file // Cannot save the file
MessageBox (NULL, utf8ToTStr(c.what()), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); MessageBox(NULL, MaxTStrFromUtf8(c.what()).data(), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
return false; return false;
} }
} }

@ -91,7 +91,7 @@ Value* export_shape_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Ok ? // Ok ?
Boolean *ret=&false_value; Boolean *ret=&false_value;
@ -154,12 +154,12 @@ Value* export_shape_ex_cf (Value** arg_list, int count)
nlassert(node->GetName()); nlassert(node->GetName());
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Ex argu // Ex argu
theExportSceneStruct.bShadow = arg_list[2]->to_bool()!=FALSE; theExportSceneStruct.bShadow = arg_list[2]->to_bool()!=FALSE;
theExportSceneStruct.bExportLighting = arg_list[3]->to_bool()!=FALSE; theExportSceneStruct.bExportLighting = arg_list[3]->to_bool()!=FALSE;
theExportSceneStruct.sExportLighting = tStrToUtf8(arg_list[4]->to_string()); theExportSceneStruct.sExportLighting = MCharStrToUtf8(arg_list[4]->to_string());
theExportSceneStruct.nExportLighting = arg_list[5]->to_int(); theExportSceneStruct.nExportLighting = arg_list[5]->to_int();
theExportSceneStruct.rLumelSize = arg_list[6]->to_float(); theExportSceneStruct.rLumelSize = arg_list[6]->to_float();
theExportSceneStruct.nOverSampling = arg_list[7]->to_int(); theExportSceneStruct.nOverSampling = arg_list[7]->to_int();
@ -220,7 +220,7 @@ Value* export_skeleton_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Ok ? // Ok ?
Boolean *ret=&false_value; Boolean *ret=&false_value;
@ -260,7 +260,7 @@ Value* export_animation_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Get time // Get time
TimeValue time=MAXScript_interface->GetTime(); TimeValue time=MAXScript_interface->GetTime();
@ -298,7 +298,7 @@ Value* export_animation_cf (Value** arg_list, int count)
else else
{ {
// Error message // Error message
mprintf (_M("Error exporting animation %s in the file\n%s\n"), (*vectNode.begin())->GetName(), utf8ToTStr(sPath)); mprintf(_M("Error exporting animation %s in the file\n%s\n"), (*vectNode.begin())->GetName(), MaxTStrFromUtf8(sPath).data());
} }
} }
} }
@ -352,7 +352,7 @@ Value* export_ig_cf (Value** arg_list, int count)
vect.push_back (array->get (i+1)->to_node()); vect.push_back (array->get (i+1)->to_node());
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Export // Export
if (theCNelExport.exportInstanceGroup (sPath, vect)) if (theCNelExport.exportInstanceGroup (sPath, vect))
@ -411,7 +411,7 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count)
vect.push_back (array->get (i+1)->to_node()); vect.push_back (array->get (i+1)->to_node());
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Export // Export
if (theCNelExport.exportSWT (sPath, vect)) if (theCNelExport.exportSWT (sPath, vect))
@ -471,11 +471,11 @@ Value* test_file_date_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// The 2 filenames // The 2 filenames
string file0 = tStrToUtf8(arg_list[0]->to_string()); WStr file0 = arg_list[0]->to_string();
string file1 = tStrToUtf8(arg_list[1]->to_string()); WStr file1 = arg_list[1]->to_string();
// Open it // Open it
FILE *file=nlfopen (file0.c_str(), "r"); FILE *file= nlfopen(ucstring((const ucchar *)file0.data()).toUtf8().c_str(), "r");
if (file == NULL) if (file == NULL)
return &true_value; return &true_value;
@ -486,10 +486,10 @@ Value* test_file_date_cf (Value** arg_list, int count)
Value *ret = &undefined; Value *ret = &undefined;
// Create first file // Create first file
HANDLE h0 = CreateFile (utf8ToTStr(file0), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE h0 = CreateFileW((LPCWSTR)file0.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h0!=INVALID_HANDLE_VALUE) if (h0!=INVALID_HANDLE_VALUE)
{ {
HANDLE h1 = CreateFile (utf8ToTStr(file1), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE h1 = CreateFileW((LPCWSTR)file1.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h1!=INVALID_HANDLE_VALUE) if (h1!=INVALID_HANDLE_VALUE)
{ {
// Get file time // Get file time
@ -536,7 +536,7 @@ Value* export_vegetable_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Message in dialog // Message in dialog
bool dialogMessage = arg_list[2]->to_bool() != FALSE; bool dialogMessage = arg_list[2]->to_bool() != FALSE;
@ -615,7 +615,7 @@ Value* export_collision_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
string sPath = tStrToUtf8(arg_list[1]->to_string()); string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Get time // Get time
TimeValue time = MAXScript_interface->GetTime(); TimeValue time = MAXScript_interface->GetTime();
@ -674,7 +674,7 @@ Value* export_pacs_primitives_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
string sPath = tStrToUtf8(arg_list[1]->to_string()); string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Get time // Get time
TimeValue time = MAXScript_interface->GetTime(); TimeValue time = MAXScript_interface->GetTime();
@ -733,7 +733,7 @@ Value* export_lod_character_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Message in dialog // Message in dialog
bool dialogMessage = arg_list[2]->to_bool() != FALSE; bool dialogMessage = arg_list[2]->to_bool() != FALSE;
@ -879,11 +879,11 @@ Value* get_file_modification_date_cf (Value** arg_list, int count)
type_check (arg_list[0], String, message); type_check (arg_list[0], String, message);
// get the node // get the node
string sPath = tStrToUtf8(arg_list[0]->to_string()); WStr sPath = arg_list[0]->to_string();
// get vertices indices // get vertices indices
string result; string result;
HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFileW((LPCWSTR)sPath.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file) if (file)
{ {
FILETIME lastWriteTime; FILETIME lastWriteTime;
@ -899,7 +899,7 @@ Value* get_file_modification_date_cf (Value** arg_list, int count)
if (result.empty()) if (result.empty())
return &undefined; return &undefined;
else else
return new String(utf8ToTStr(result)); return new String(MaxTStrFromUtf8(result));
} }
// *************************************************************************** // ***************************************************************************
@ -918,16 +918,16 @@ Value* set_file_modification_date_cf (Value** arg_list, int count)
type_check(arg_list[1], String, message); type_check(arg_list[1], String, message);
// get the node // get the node
string sPath = tStrToUtf8(arg_list[0]->to_string()); WStr sPath = arg_list[0]->to_string();
string sDate = tStrToUtf8(arg_list[1]->to_string()); WStr sDate = arg_list[1]->to_string();
// get vertices indices // get vertices indices
string result; string result;
HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFileW(sPath.data(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file) if (file)
{ {
FILETIME lastWriteTime; FILETIME lastWriteTime;
if (sscanf (sDate.c_str(), "%08x%08x", &lastWriteTime.dwHighDateTime, &lastWriteTime.dwLowDateTime) == 2) if (swscanf(sDate.data(), L"%08x%08x", &lastWriteTime.dwHighDateTime, &lastWriteTime.dwLowDateTime) == 2)
{ {
if (SetFileTime(file, NULL, NULL, &lastWriteTime)) if (SetFileTime(file, NULL, NULL, &lastWriteTime))
{ {

@ -55,15 +55,15 @@ bool CNelExport::exportSWT(const std::string &sPath, std::vector<INode*>& vectNo
// Store them in the temporary list // Store them in the temporary list
aSWNodes.resize(nNumNode+3); aSWNodes.resize(nNumNode+3);
aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name = MCharStrToUtf8(pNode->GetName());
aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getRotQuatValueName(); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getRotQuatValueName();
aSWNodes[nNumNode].Weight = rRotValue; aSWNodes[nNumNode].Weight = rRotValue;
++nNumNode; ++nNumNode;
aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name = MCharStrToUtf8(pNode->GetName());
aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getPosValueName (); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getPosValueName ();
aSWNodes[nNumNode].Weight = rPosValue; aSWNodes[nNumNode].Weight = rPosValue;
++nNumNode; ++nNumNode;
aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name = MCharStrToUtf8(pNode->GetName());
aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getScaleValueName(); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getScaleValueName();
aSWNodes[nNumNode].Weight = rScaleValue; aSWNodes[nNumNode].Weight = rScaleValue;
++nNumNode; ++nNumNode;

@ -113,7 +113,7 @@ void regsiterOVPath ()
int res = GetModuleFileName(hModule, sModulePath, 256); int res = GetModuleFileName(hModule, sModulePath, 256);
if (!res) { ::MessageBox(NULL, _T("'res' failed at '") __FUNCTION__ _T("' in file '") __FILE__ _T(" on line ") NL_MACRO_TO_STR(__LINE__), _T("NeL Export"), MB_OK | MB_ICONERROR); return; } if (!res) { ::MessageBox(NULL, _T("'res' failed at '") __FUNCTION__ _T("' in file '") __FILE__ _T(" on line ") NL_MACRO_TO_STR(__LINE__), _T("NeL Export"), MB_OK | MB_ICONERROR); return; }
std::string modulePath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)) + "object_viewer.cfg"; std::string modulePath = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath)) + "object_viewer.cfg";
// Load the config file // Load the config file
CConfigFile cf; CConfigFile cf;
@ -300,7 +300,7 @@ void CNelExport::viewMesh (TimeValue time)
_ExportNel->buildSkeletonShape (*skelShape, *skeletonRoot, &(iteSkeleton->second), mapId, time); _ExportNel->buildSkeletonShape (*skelShape, *skeletonRoot, &(iteSkeleton->second), mapId, time);
// Add the shape in the view // Add the shape in the view
uint instance = view->addSkel (skelShape, tStrToUtf8(skeletonRoot->GetName())); uint instance = view->addSkel (skelShape, MCharStrToUtf8(skeletonRoot->GetName()));
// Add tracks // Add tracks
CAnimation *anim=new CAnimation; CAnimation *anim=new CAnimation;
@ -365,7 +365,7 @@ void CNelExport::viewMesh (TimeValue time)
INode* pNode=_Ip->GetSelNode (nNode); INode* pNode=_Ip->GetSelNode (nNode);
string sTmp = "Object Name: "; string sTmp = "Object Name: ";
sTmp += tStrToUtf8(pNode->GetName()); sTmp += MCharStrToUtf8(pNode->GetName());
ProgBar.setLine (0, sTmp); ProgBar.setLine (0, sTmp);
sTmp.clear(); sTmp.clear();
for (uint32 i = 1; i < 10; ++i) for (uint32 i = 1; i < 10; ++i)
@ -410,7 +410,7 @@ void CNelExport::viewMesh (TimeValue time)
if (pShape) if (pShape)
{ {
// Add the shape in the view // Add the shape in the view
uint instance = view->addMesh (pShape, tStrToUtf8(pNode->GetName()).c_str(), iteSkelShape->second.SkeletonInstance); uint instance = view->addMesh (pShape, MCharStrToUtf8(pNode->GetName()), iteSkelShape->second.SkeletonInstance);
// Add tracks // Add tracks
CAnimation *anim=new CAnimation; CAnimation *anim=new CAnimation;

@ -70,7 +70,7 @@ INT_PTR CALLBACK CalculatingDialogCallback (
string all; string all;
for (uint32 i = 0; i < 14; ++i) for (uint32 i = 0; i < 14; ++i)
all += pClass->sInfoProgress[i] + "\n"; all += pClass->sInfoProgress[i] + "\n";
SendMessage (GetDlgItem (hwndDlg, IDC_STATICINFO), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(all)); SendMessage (GetDlgItem (hwndDlg, IDC_STATICINFO), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(all).data());
} }
break; break;

@ -14,6 +14,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std_afx.h" #include "std_afx.h"
void nlmax_nel_export_std_afx_dummy() { }

@ -73,4 +73,6 @@ namespace std
#include "nel/misc/bsphere.h" #include "nel/misc/bsphere.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "../nel_3dsmax_shared/string_common.h"
#endif #endif

@ -17,3 +17,5 @@
#include "stdafx.h" #include "stdafx.h"
void nlmax_mesh_library_stdafx_dummy() { }

@ -128,7 +128,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime)
if (maxLight->EvalLightState(tvTime, valid, &ls)!=REF_SUCCEED) if (maxLight->EvalLightState(tvTime, valid, &ls)!=REF_SUCCEED)
return; return;
this->Name = tStrToUtf8(node->GetName()); this->Name = MCharStrToUtf8(node->GetName());
// Retrieve the correct light Group Name // Retrieve the correct light Group Name
this->AnimatedLight = CExportNel::getAnimatedLight (node); this->AnimatedLight = CExportNel::getAnimatedLight (node);
@ -295,7 +295,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime)
INode *exclNode = exclusionList[i]; INode *exclNode = exclusionList[i];
if (exclNode) // Crashfix // FIXME: Why is this NULL? if (exclNode) // Crashfix // FIXME: Why is this NULL?
{ {
string tmp = tStrToUtf8(exclNode->GetName()); string tmp = MCharStrToUtf8(exclNode->GetName());
this->setExclusion.insert(tmp); this->setExclusion.insert(tmp);
} }
} }
@ -1930,7 +1930,7 @@ void supprLightNoInteractOne( vector<SLightBuild> &vLights, CMesh::CMeshBuild* p
{ {
bool bInteract = false; bool bInteract = false;
if( vLights[i].setExclusion.find(tStrToUtf8(node.GetName()) ) != vLights[i].setExclusion.end() ) if( vLights[i].setExclusion.find(MCharStrToUtf8(node.GetName()) ) != vLights[i].setExclusion.end() )
{ {
bInteract = false; bInteract = false;
} }
@ -2005,7 +2005,7 @@ void CExportNel::deleteLM(INode& ZeNode)
string sSaveName; string sSaveName;
sSaveName = _Options.sExportLighting; sSaveName = _Options.sExportLighting;
if( sSaveName[sSaveName.size()-1] != '\\' ) sSaveName += "\\"; if( sSaveName[sSaveName.size()-1] != '\\' ) sSaveName += "\\";
sSaveName += tStrToUtf8(ZeNode.GetName()); sSaveName += MCharStrToUtf8(ZeNode.GetName());
char tmp[32]; char tmp[32];
sprintf( tmp, "%d", i ); sprintf( tmp, "%d", i );
sSaveName += tmp; sSaveName += tmp;
@ -2276,7 +2276,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
{ {
string thetext; string thetext;
thetext = "Warning "; thetext = "Warning ";
thetext += tStrToUtf8(ZeNode.GetName()); thetext += MCharStrToUtf8(ZeNode.GetName());
thetext = "have all faces NOT mapped (UV2)"; thetext = "have all faces NOT mapped (UV2)";
if (gOptions.FeedBack != NULL) if (gOptions.FeedBack != NULL)
{ {
@ -2325,11 +2325,11 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
{ {
// Make an error message // Make an error message
string sTmp = "Warning : "; string sTmp = "Warning : ";
sTmp += tStrToUtf8(ZeNode.GetName()); sTmp += MCharStrToUtf8(ZeNode.GetName());
sTmp += " has mapping problem"; sTmp += " has mapping problem";
// Script trace // Script trace
mprintf (utf8ToTStr((sTmp+"\n"))); mprintf(_M("%s\n"), MaxTStrFromUtf8(sTmp).data());
// Feedback is here ? // Feedback is here ?
if (gOptions.FeedBack != NULL) if (gOptions.FeedBack != NULL)
@ -2530,7 +2530,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
// Add lightmap information in the lightmap log // Add lightmap information in the lightmap log
COFile outputLog; COFile outputLog;
if (outputLightmapLog) if (outputLightmapLog)
createLightmapLog(outputLog, gOptions.sExportLighting.c_str(), ucstring(projectName).toUtf8(), CStr(ZeNode.GetName()).data()); createLightmapLog(outputLog, gOptions.sExportLighting.c_str(), ucstring(projectName).toUtf8().c_str(), CStr(ZeNode.GetName()).data());
// Update UV coords to Texture space // Update UV coords to Texture space
PutFaceUV1InTextureCoord( LightMap.w, LightMap.h, AllFaces.begin(), AllFaces.size() ); PutFaceUV1InTextureCoord( LightMap.w, LightMap.h, AllFaces.begin(), AllFaces.size() );
@ -2559,7 +2559,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
{ {
CTextureFile *pLightMap = new CTextureFile(); CTextureFile *pLightMap = new CTextureFile();
//string sSaveName = AllMeshBuilds[nNode].second->GetName(); //string sSaveName = AllMeshBuilds[nNode].second->GetName();
string sSaveName = tStrToUtf8(ZeNode.GetName()); string sSaveName = MCharStrToUtf8(ZeNode.GetName());
char tmp[32]; char tmp[32];
sSaveName += "_"; sSaveName += "_";
sprintf( tmp, "%d", nLightMapNb ); sprintf( tmp, "%d", nLightMapNb );
@ -2633,7 +2633,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
if (gOptions.FeedBack != NULL) if (gOptions.FeedBack != NULL)
{ {
std::string message = toString("Can't write the file %s : %s", sSaveName.c_str(), e.what()); std::string message = toString("Can't write the file %s : %s", sSaveName.c_str(), e.what());
mprintf (utf8ToTStr(message)); mprintf(_M("%s\n"), MaxTStrFromUtf8(message).data());
} }
} }

@ -113,7 +113,7 @@ void CRTWorld::build (vector<SLightBuild> &AllLights, CVector &trans, bool bExcl
pLAP->create( 64 ); // width of each grid in number of square pLAP->create( 64 ); // width of each grid in number of square
for( j = 0; j < vMB.size(); ++j ) for( j = 0; j < vMB.size(); ++j )
{ {
if (rLight.setExclusion.find (tStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end()) if (rLight.setExclusion.find (MCharStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end())
continue; continue;
for (k = 0; k < vMB[j]->Faces.size(); ++k) for (k = 0; k < vMB[j]->Faces.size(); ++k)
@ -142,7 +142,7 @@ void CRTWorld::build (vector<SLightBuild> &AllLights, CVector &trans, bool bExcl
pLAD->create (64, rLight.rDirRadius/64.0f, rLight.Direction); pLAD->create (64, rLight.rDirRadius/64.0f, rLight.Direction);
for( j = 0; j < vMB.size(); ++j ) for( j = 0; j < vMB.size(); ++j )
{ {
if (rLight.setExclusion.find (tStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end()) if (rLight.setExclusion.find (MCharStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end())
continue; continue;
for (k = 0; k < vMB[j]->Faces.size(); ++k) for (k = 0; k < vMB[j]->Faces.size(); ++k)

@ -189,7 +189,7 @@ void CExportNel::addSSSTrack(CSSSBuild &ssBuilder, INode& node)
if(note) if(note)
{ {
CSSSBuild::CKey ks; CSSSBuild::CKey ks;
ks.Value = note->note.ToUTF8(); ks.Value = MaxTStrToUtf8(note->note);
ks.Time= CExportNel::convertTime (note->time); ks.Time= CExportNel::convertTime (note->time);
bs.Track.push_back(ks); bs.Track.push_back(ks);
} }
@ -228,7 +228,7 @@ NL3D::CTrackKeyFramerConstString* CExportNel::buildFromNoteTrack(INode& node)
{ {
firstDate = CExportNel::convertTime (note->time); firstDate = CExportNel::convertTime (note->time);
} }
ks.Value = note->note.ToUTF8(); ks.Value = MaxTStrToUtf8(note->note);
lastDate = CExportNel::convertTime (note->time); lastDate = CExportNel::convertTime (note->time);
st->addKey(ks , lastDate ); st->addKey(ks , lastDate );
@ -609,7 +609,7 @@ void CExportNel::addMorphTracks (NL3D::CAnimation& animation, INode& node, const
if (pNode == NULL) if (pNode == NULL)
continue; continue;
std::string name = parentName; std::string name = parentName;
name += tStrToUtf8(pNode->GetName()); name += MCharStrToUtf8(pNode->GetName());
name += "MorphFactor"; name += "MorphFactor";
IParamBlock *pb = (IParamBlock*)(pMorphMod->SubAnim (i+1)); IParamBlock *pb = (IParamBlock*)(pMorphMod->SubAnim (i+1));

@ -73,7 +73,7 @@ CCollisionMeshBuild* CExportNel::createCollisionMeshBuild(std::vector<INode *> &
{ {
// get the mesh name // get the mesh name
uint meshId = rootMeshNames.size(); uint meshId = rootMeshNames.size();
rootMeshNames.push_back(tStrToUtf8(nodes[node]->GetName())); rootMeshNames.push_back(MCharStrToUtf8(nodes[node]->GetName()));
bool collision = getScriptAppData (nodes[node], NEL3D_APPDATA_COLLISION, 0) != 0; bool collision = getScriptAppData (nodes[node], NEL3D_APPDATA_COLLISION, 0) != 0;
bool exterior = getScriptAppData (nodes[node], NEL3D_APPDATA_COLLISION_EXTERIOR, 0) != 0; bool exterior = getScriptAppData (nodes[node], NEL3D_APPDATA_COLLISION_EXTERIOR, 0) != 0;

@ -768,7 +768,7 @@ void CExportNel::buildAMaterial (NL3D::CMaterial& material, CMaxMaterialInfo& ma
// Set material name // Set material name
TSTR name=mtl.GetName(); TSTR name=mtl.GetName();
materialInfo.MaterialName = name.ToUTF8(); materialInfo.MaterialName = MaxTStrToUtf8(name);
} }
else else
{ {
@ -1120,7 +1120,7 @@ void CExportNel::buildAMaterial (NL3D::CMaterial& material, CMaxMaterialInfo& ma
// Set material name // Set material name
TSTR name=mtl.GetName(); TSTR name=mtl.GetName();
materialInfo.MaterialName = name.ToUTF8(); materialInfo.MaterialName = MaxTStrToUtf8(name);
} }
} }
@ -1255,7 +1255,7 @@ ITexture* CExportNel::buildATexture (Texmap& texmap, CMaterialDesc &remap3dsTexC
else // standard texture else // standard texture
{ {
srcTex = new CTextureFile; srcTex = new CTextureFile;
std::string mapName = tStrToUtf8(pBitmap->GetMapName()); std::string mapName = MCharStrToUtf8(pBitmap->GetMapName());
static_cast<CTextureFile *>(srcTex)->setFileName (ConvertTexFileName(mapName, _AbsolutePath)); static_cast<CTextureFile *>(srcTex)->setFileName (ConvertTexFileName(mapName, _AbsolutePath));
} }

@ -266,7 +266,7 @@ NL3D::IShape *CExportNel::buildShape (INode& node, TimeValue time, const TInodeP
std::string nodeName=getScriptAppData (&node, NEL3D_APPDATA_LOD_NAME+lod, ""); std::string nodeName=getScriptAppData (&node, NEL3D_APPDATA_LOD_NAME+lod, "");
// Get the node // Get the node
INode *lodNode=_Ip->GetINodeByName(utf8ToTStr(nodeName)); INode *lodNode=_Ip->GetINodeByName(MaxTStrFromUtf8(nodeName).data());
if (lodNode) if (lodNode)
{ {
// Index of the lod in the build structure // Index of the lod in the build structure
@ -611,7 +611,7 @@ void CExportNel::buildBaseMeshInterface (NL3D::CMeshBase::CMeshBaseBuild& buildM
continue; continue;
// get factor here ! // get factor here !
buildMesh.DefaultBSFactors.push_back(0.0f); buildMesh.DefaultBSFactors.push_back(0.0f);
std::string sTemp = tStrToUtf8(pNode->GetName()); std::string sTemp = MCharStrToUtf8(pNode->GetName());
buildMesh.BSNames.push_back (sTemp); buildMesh.BSNames.push_back (sTemp);
} }
@ -1064,7 +1064,7 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes
if (error!=NoError) if (error!=NoError)
{ {
std::string msg = toString("%s skin: %s", getName(node).c_str(), ErrorMessage[error]); std::string msg = toString("%s skin: %s", getName(node).c_str(), ErrorMessage[error]);
MessageBoxW (NULL, utf8ToTStr(msg), L"NeL export", MB_OK|MB_ICONEXCLAMATION); MessageBox(NULL, MaxTStrFromUtf8(msg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION);
} }
else else
{ {
@ -1492,7 +1492,7 @@ void CExportNel::buildMeshMorph (CMesh::CMeshBuild& buildMesh, INode &node, Time
continue; continue;
} }
bs.Name = tStrToUtf8(pNode->GetName()); bs.Name = MCharStrToUtf8(pNode->GetName());
bool bIsDeltaPos = false; bool bIsDeltaPos = false;
bs.deltaPos.resize (nNbVertVB, CVector::Null); bs.deltaPos.resize (nNbVertVB, CVector::Null);

@ -316,7 +316,7 @@ static void AddNodeToQuadGrid(const NLMISC::CAABBox &delimiter, TNodeFaceQG &des
{ {
if (delimiter.intersect(nodeBBox)) if (delimiter.intersect(nodeBBox))
{ {
nldebug("Adding %s to mesh interface quad grid", tStrToUtf8(node.GetName()).c_str()); nldebug("Adding %s to mesh interface quad grid", MCharStrToUtf8(node.GetName()).c_str());
// add this node tris // add this node tris
ObjectState os = node.EvalWorldState(time); ObjectState os = node.EvalWorldState(time);
Object *obj = os.obj; Object *obj = os.obj;
@ -579,9 +579,9 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
{ {
// Rename the material // Rename the material
string newName = "NelAutoMergeRenamedTmp" + toString(i); string newName = "NelAutoMergeRenamedTmp" + toString(i);
string originalName = (*lib)[i]->GetName ().ToUTF8(); string originalName = MaxTStrToUtf8((*lib)[i]->GetName());
renameMap.insert (map<string, string>::value_type (newName, originalName)); renameMap.insert (map<string, string>::value_type (newName, originalName));
(*lib)[i]->SetName (utf8ToTStr(newName)); (*lib)[i]->SetName (MaxTStrFromUtf8(newName));
} }
// Merge the interface project // Merge the interface project
@ -604,7 +604,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
for (i=0; i<size; i++) for (i=0; i<size; i++)
{ {
// Find the name in the map ? // Find the name in the map ?
string key = (*lib)[i]->GetName ().ToUTF8(); string key = MaxTStrToUtf8((*lib)[i]->GetName());
map<string, string>::iterator ite = renameMap.find (key); map<string, string>::iterator ite = renameMap.find (key);
// Not found ? This is a merged material // Not found ? This is a merged material
@ -612,9 +612,9 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
{ {
// Rename the material // Rename the material
string newName = "NelAutoMergeRenamed" + toString (i); string newName = "NelAutoMergeRenamed" + toString (i);
string originalName = (*lib)[i]->GetName ().ToUTF8(); string originalName = MaxTStrToUtf8((*lib)[i]->GetName());
renameMap.insert (map<string, string>::value_type (newName, originalName)); renameMap.insert (map<string, string>::value_type (newName, originalName));
(*lib)[i]->SetName (utf8ToTStr(newName)); (*lib)[i]->SetName (MaxTStrFromUtf8(newName));
} }
} }
@ -622,12 +622,12 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
for (i=0; i<size; i++) for (i=0; i<size; i++)
{ {
// Find the name // Find the name
string key = (*lib)[i]->GetName ().ToUTF8(); string key = MaxTStrToUtf8((*lib)[i]->GetName());
map<string, string>::iterator ite = renameMap.find (key); map<string, string>::iterator ite = renameMap.find (key);
if (ite != renameMap.end ()) if (ite != renameMap.end ())
{ {
// Rename the material with its original name // Rename the material with its original name
(*lib)[i]->SetName (utf8ToTStr(ite->second)); (*lib)[i]->SetName (MaxTStrFromUtf8(ite->second));
} }
} }

@ -223,7 +223,7 @@ Animatable* CExportNel::getSubAnimByName (Animatable& node, const char* sName)
TSTR sSubName=node.SubAnimName(nSub); TSTR sSubName=node.SubAnimName(nSub);
// Good name? // Good name?
if (strcmp (sSubName.ToUTF8(), sName)==0) if (strcmp (MaxTStrToUtf8(sSubName).c_str(), sName)==0)
{ {
// ok, return this subanim // ok, return this subanim
return node.SubAnim(nSub); return node.SubAnim(nSub);
@ -265,7 +265,7 @@ Control* CExportNel::getControlerByName (Animatable& node, const char* sName)
ParamDef& paramDef=param->GetParamDef(id); ParamDef& paramDef=param->GetParamDef(id);
// Good name? // Good name?
if (strcmp (tStrToUtf8(paramDef.int_name).c_str(), sName)==0) if (strcmp (MCharStrToUtf8(paramDef.int_name).c_str(), sName)==0)
{ {
// ok, return this subanim // ok, return this subanim
#if MAX_VERSION_MAJOR >= 14 #if MAX_VERSION_MAJOR >= 14
@ -288,7 +288,7 @@ Control* CExportNel::getControlerByName (Animatable& node, const char* sName)
{ {
// Sub anim name // Sub anim name
TSTR name=node.SubAnimName (s); TSTR name=node.SubAnimName (s);
if (strcmp (name.ToUTF8(), sName)==0) if (strcmp (MaxTStrToUtf8(name).c_str(), sName)==0)
{ {
// Get the controller pointer of this sub anim // Get the controller pointer of this sub anim
Control* c=GetControlInterface (node.SubAnim(s)); Control* c=GetControlInterface (node.SubAnim(s));
@ -332,7 +332,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName
ParamDef& paramDef=param->GetParamDef(id); ParamDef& paramDef=param->GetParamDef(id);
// Good name? // Good name?
if (strcmp (tStrToUtf8(paramDef.int_name).c_str(), sName)==0) if (strcmp (MCharStrToUtf8(paramDef.int_name).c_str(), sName)==0)
{ {
// Check this value is good type // Check this value is good type
ParamType2 paramType = param->GetParameterType(id); ParamType2 paramType = param->GetParameterType(id);
@ -372,7 +372,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName
break; break;
case TYPE_FILENAME: case TYPE_FILENAME:
case TYPE_STRING: case TYPE_STRING:
*(std::string*)pValue = tStrToUtf8(param->GetStr (id, tvTime)); *(std::string*)pValue = MCharStrToUtf8(param->GetStr (id, tvTime));
bRes = TRUE; bRes = TRUE;
break; break;
case TYPE_FILENAME_TAB: case TYPE_FILENAME_TAB:
@ -382,7 +382,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName
uint total = param->Count (id); uint total = param->Count (id);
rTab.resize(total); rTab.resize(total);
for( uint i = 0; i < total; ++i ) for( uint i = 0; i < total; ++i )
rTab[i] = tStrToUtf8(param->GetStr (id, tvTime, i)); rTab[i] = MCharStrToUtf8(param->GetStr (id, tvTime, i));
bRes = TRUE; bRes = TRUE;
} }
break; break;
@ -502,7 +502,7 @@ std::string CExportNel::getName (MtlBase& mtl)
// Return its name // Return its name
TSTR name; TSTR name;
name=mtl.GetName(); name=mtl.GetName();
return std::string((const char*)name.ToUTF8()); return MaxTStrToUtf8(name);
} }
// -------------------------------------------------- // --------------------------------------------------
@ -512,7 +512,7 @@ std::string CExportNel::getName(INode& node)
{ {
// Return its name // Return its name
const MCHAR *name = node.GetName(); const MCHAR *name = node.GetName();
return tStrToUtf8(name); return MCharStrToUtf8(name);
} }
// -------------------------------------------------- // --------------------------------------------------
@ -549,7 +549,7 @@ std::string CExportNel::getNelObjectName (INode& node)
} }
else else
{ {
return tStrToUtf8(node.GetName()); return MCharStrToUtf8(node.GetName());
} }
} }
else else
@ -564,23 +564,23 @@ std::string CExportNel::getNelObjectName (INode& node)
if (_tcslen((const TCHAR *) ad->data) != 0) if (_tcslen((const TCHAR *) ad->data) != 0)
{ {
// get file name only // get file name only
return NLMISC::CFile::getFilename(tStrToUtf8((const TCHAR*)ad->data)); return NLMISC::CFile::getFilename(MCharStrToUtf8((const MCHAR*)ad->data));
} }
else else
{ {
return tStrToUtf8(node.GetName()); return MCharStrToUtf8(node.GetName());
} }
} }
else else
{ {
// Extract the node name // Extract the node name
return tStrToUtf8(node.GetName()); return MCharStrToUtf8(node.GetName());
} }
} }
else else
{ {
// Extract the node name // Extract the node name
return tStrToUtf8(node.GetName()); return MCharStrToUtf8(node.GetName());
} }
} }
} }
@ -764,13 +764,12 @@ void CExportNel::outputErrorMessage(const std::string &message)
{ {
if (_ErrorInDialog) if (_ErrorInDialog)
{ {
MessageBoxW (_Ip->GetMAXHWnd(), utf8ToTStr(message), utf8ToTStr(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION); MessageBoxW(_Ip->GetMAXHWnd(), utf8ToWide(message), utf8ToWide(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION);
} }
mprintf (utf8ToTStr(message)); mprintf(_M("%s\n"), MaxTStrFromUtf8(message).data());
mprintf (_T("\n"));
nlwarning("Error in max file %s : ", _Ip->GetCurFilePath()); nlwarning("Error in max file %s : ", _Ip->GetCurFilePath());
nlwarning (message.c_str()); nlwarning("%s", message.c_str());
} }
// -------------------------------------------------- // --------------------------------------------------
@ -779,13 +778,12 @@ void CExportNel::outputWarningMessage (const std::string &message)
{ {
if (_ErrorInDialog) if (_ErrorInDialog)
{ {
MessageBox (_Ip->GetMAXHWnd(), utf8ToTStr(message), utf8ToTStr(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION); MessageBoxW(_Ip->GetMAXHWnd(), utf8ToWide(message), utf8ToWide(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION);
} }
mprintf (utf8ToTStr(message)); mprintf(_M("%s\n"), MaxTStrFromUtf8(message).data());
mprintf (_M("\n"));
nlwarning("Warning in max file %s : ", _Ip->GetCurFilePath()); nlwarning("Warning in max file %s : ", _Ip->GetCurFilePath());
nlwarning (message.c_str()); nlwarning("%s", message.c_str());
} }
// -------------------------------------------------- // --------------------------------------------------
@ -819,7 +817,7 @@ void CExportNel::addChildLodNode (std::set<INode*> &lodListToExclude, INode *cur
if (lodName != "") if (lodName != "")
{ {
// Get the lod by name // Get the lod by name
INode *lodNode = _Ip->GetINodeByName (utf8ToTStr(lodName)); INode *lodNode = _Ip->GetINodeByName(MaxTStrFromUtf8(lodName));
if (lodNode) if (lodNode)
{ {
// Insert it in the set // Insert it in the set
@ -850,7 +848,7 @@ void CExportNel::addParentLodNode (INode &child, std::set<INode*> &lodListToExcl
if (lodName != "") if (lodName != "")
{ {
// Get the lod by name // Get the lod by name
INode *lodNode = _Ip->GetINodeByName (utf8ToTStr(lodName)); INode *lodNode = _Ip->GetINodeByName(MaxTStrFromUtf8(lodName));
if (lodNode == &child) if (lodNode == &child)
{ {
// Insert it in the set // Insert it in the set
@ -1111,7 +1109,7 @@ static void restoreDecimalSeparator()
float toFloatMax(const TCHAR *src) float toFloatMax(const TCHAR *src)
{ {
float result = 0.f; float result = 0.f;
if (toFloatMax(tStrToUtf8(src), result)) return result; if (toFloatMax(MCharStrToUtf8(src), result)) return result;
return 0.f; return 0.f;
} }
@ -1124,7 +1122,7 @@ float toFloatMax(const std::string &src)
bool toFloatMax(const TCHAR *src, float &dest) bool toFloatMax(const TCHAR *src, float &dest)
{ {
return toFloatMax(tStrToUtf8(src), dest); return toFloatMax(MCharStrToUtf8(src), dest);
} }
bool toFloatMax(const std::string &src, float &dest) bool toFloatMax(const std::string &src, float &dest)

@ -51,7 +51,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time)
iF.serial(ss); iF.serial(ss);
if (!dynamic_cast<CParticleSystemShape *>(ss.getShapePointer())) if (!dynamic_cast<CParticleSystemShape *>(ss.getShapePointer()))
{ {
mprintf(_T("Error : Object shape %s isn't a particle system"), utf8ToTStr(shapeName)); mprintf(_M("Error : Object shape %s isn't a particle system\n"), MaxTStrFromUtf8(shapeName).data());
return NULL; return NULL;
} }
@ -78,7 +78,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time)
} }
else else
{ {
mprintf(_T("Error : Can't find %s while exporting a particle system \n"), utf8ToTStr(shapeName)); mprintf(_M("Error : Can't find %s while exporting a particle system\n"), MaxTStrFromUtf8(shapeName).data());
return NULL; return NULL;
} }
} }

@ -62,7 +62,7 @@ void CRadialVertices::init (INode *node, Mesh *mesh, TimeValue time, Interface &
_SmoothingGroupMask |= (1<<app); _SmoothingGroupMask |= (1<<app);
// Get the node by name // Get the node by name
INode *pivotNode = ip.GetINodeByName(utf8ToTStr(pivotName)); INode *pivotNode = ip.GetINodeByName(MaxTStrFromUtf8(pivotName));
if (pivotNode) if (pivotNode)
{ {
// Get the world Pivot point // Get the world Pivot point

@ -93,7 +93,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
resultInstanceNode[nNumIG] = pNode; resultInstanceNode[nNumIG] = pNode;
if (aIGArray[nNumIG].InstanceName == "") // no instance name was set, takes the node name instead if (aIGArray[nNumIG].InstanceName == "") // no instance name was set, takes the node name instead
{ {
aIGArray[nNumIG].InstanceName = tStrToUtf8(pNode->GetName()); aIGArray[nNumIG].InstanceName = MCharStrToUtf8(pNode->GetName());
} }
// Visible? always true, but if special flag for camera collision // Visible? always true, but if special flag for camera collision
@ -236,7 +236,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
pMB->Vertices[pMB->Faces[j].Corner[2].Vertex]) ) pMB->Vertices[pMB->Faces[j].Corner[2].Vertex]) )
{ {
// ERROR : The volume is not convex !!! // ERROR : The volume is not convex !!!
nlwarning("ERROR: The cluster %s is not convex.", tStrToUtf8(vectNode[i]->GetName()).c_str()); nlwarning("ERROR: The cluster %s is not convex.", MCharStrToUtf8(vectNode[i]->GetName()).c_str());
} }
} }
@ -244,7 +244,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
clusterTemp.VisibleFromFather = bVisibleFromFather; clusterTemp.VisibleFromFather = bVisibleFromFather;
clusterTemp.FatherAudible = bFatherAudible; clusterTemp.FatherAudible = bFatherAudible;
clusterTemp.AudibleFromFather = bAudibleFromFather; clusterTemp.AudibleFromFather = bAudibleFromFather;
clusterTemp.Name = tStrToUtf8(pNode->GetName()); clusterTemp.Name = MCharStrToUtf8(pNode->GetName());
vClusters.push_back (clusterTemp); vClusters.push_back (clusterTemp);
delete pMB; pMB = NULL; delete pMB; pMB = NULL;
@ -333,7 +333,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
if (!portalTemp.setPoly (polyv)) if (!portalTemp.setPoly (polyv))
{ {
// ERROR : Poly not convex, or set of vertices not plane // ERROR : Poly not convex, or set of vertices not plane
nlwarning("ERROR: The portal %s is not convex.", tStrToUtf8(vectNode[i]->GetName()).c_str()); nlwarning("ERROR: The portal %s is not convex.", MCharStrToUtf8(vectNode[i]->GetName()).c_str());
} }
if (nAccelType&16) // is dynamic portal ? if (nAccelType&16) // is dynamic portal ?
@ -342,7 +342,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
if (!InstanceName.empty()) if (!InstanceName.empty())
portalTemp.setName (InstanceName); portalTemp.setName (InstanceName);
else else
portalTemp.setName (tStrToUtf8(pNode->GetName())); portalTemp.setName (MCharStrToUtf8(pNode->GetName()));
} }
// Check if portal has 2 cluster // Check if portal has 2 cluster
@ -362,7 +362,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
if (nNbCluster != 2) if (nNbCluster != 2)
{ {
// ERROR // ERROR
nlwarning("ERROR: The portal %s has not 2 clusters but %d", tStrToUtf8(vectNode[i]->GetName()).c_str(), nNbCluster); nlwarning("ERROR: The portal %s has not 2 clusters but %d", MCharStrToUtf8(vectNode[i]->GetName()).c_str(), nNbCluster);
} }
@ -504,7 +504,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
if (!vClusters.empty()) if (!vClusters.empty())
if (aIGArray[nNumIG].Clusters.empty()) if (aIGArray[nNumIG].Clusters.empty())
{ {
nlwarning("ERROR: Object %s is not attached to any cluster\nbut his flag clusterize is set", tStrToUtf8(pNode->GetName()).c_str()); nlwarning("ERROR: Object %s is not attached to any cluster\nbut his flag clusterize is set", MCharStrToUtf8(pNode->GetName()).c_str());
} }
// debug purpose : to remove // debug purpose : to remove
@ -700,7 +700,7 @@ void CExportNel::buildScene (NL3D::CScene &scene, NL3D::CShapeBank &shapeBank, I
if ( (!pNode->IsHidden () || buildHidden) && (pNode->Selected () || !onlySelected) ) if ( (!pNode->IsHidden () || buildHidden) && (pNode->Selected () || !onlySelected) )
{ {
string sTmp = "Object Name: "; string sTmp = "Object Name: ";
sTmp += tStrToUtf8(pNode->GetName()); sTmp += MCharStrToUtf8(pNode->GetName());
if (progress) if (progress)
progress->setLine (0, sTmp); progress->setLine (0, sTmp);
sTmp.clear(); sTmp.clear();

@ -36,7 +36,7 @@ bool CExportNel::scriptEvaluate (const char *script, void *out, TNelScriptValueT
four_typed_value_locals(Parser* parser,Value* code,Value* result,StringStream* source); four_typed_value_locals(Parser* parser,Value* code,Value* result,StringStream* source);
vl.parser = new Parser; vl.parser = new Parser;
vl.source = new StringStream (utf8ToTStr(script)); vl.source = new StringStream(MaxTStrFromUtf8(script));
vl.source->log_to(NULL); vl.source->log_to(NULL);
#if MAX_VERSION_MAJOR < 19 #if MAX_VERSION_MAJOR < 19

@ -114,7 +114,7 @@ INode *CExportNel::getNELScaleReferenceNode(INode &node)
{ {
std::string boneScaleName= getName(node) + boneScaleNameExt; std::string boneScaleName= getName(node) + boneScaleNameExt;
// Get the reference node // Get the reference node
referenceNode= _Ip->GetINodeByName(utf8ToTStr(boneScaleName)); referenceNode= _Ip->GetINodeByName(MaxTStrFromUtf8(boneScaleName));
} }
} }
@ -455,7 +455,7 @@ uint CExportNel::buildSkinning (CMesh::CMeshBuild& buildMesh, const TInodePtrInt
nlassert ((uint)ite->second<buildMesh.BonesNames.size()); nlassert ((uint)ite->second<buildMesh.BonesNames.size());
// Names // Names
buildMesh.BonesNames[ite->second] = tStrToUtf8(ite->first->GetName()); buildMesh.BonesNames[ite->second] = MCharStrToUtf8(ite->first->GetName());
// Next // Next
ite++; ite++;
@ -1306,7 +1306,7 @@ static sint getBoneSide(INode *bone, std::string &mirrorName)
{ {
sint side= 0; sint side= 0;
sint pos; sint pos;
mirrorName = tStrToUtf8(bone->GetName()); mirrorName = MCharStrToUtf8(bone->GetName());
if((pos= mirrorName.find(" R "))!=std::string::npos) if((pos= mirrorName.find(" R "))!=std::string::npos)
{ {
@ -1335,7 +1335,7 @@ static INode *getMirrorBone(const std::vector<INode*> &skeletonNodes, INode *bon
// find // find
for(uint i=0;i<skeletonNodes.size();i++) for(uint i=0;i<skeletonNodes.size();i++)
{ {
if(mirrorName == tStrToUtf8(skeletonNodes[i]->GetName())) if(mirrorName == MCharStrToUtf8(skeletonNodes[i]->GetName()))
return skeletonNodes[i]; return skeletonNodes[i];
} }
} }

@ -33,14 +33,14 @@
#undef max #undef max
#endif #endif
#include "../nel_3dsmax_shared/string_common.h"
#define PO2RPO_CLASS_ID Class_ID(0x43bb65e6, 0x68935530) #define PO2RPO_CLASS_ID Class_ID(0x43bb65e6, 0x68935530)
extern TCHAR *GetString(int id); extern TCHAR *GetString(int id);
extern HINSTANCE hInstance; extern HINSTANCE hInstance;
class PO2RPO : public Modifier { class PO2RPO : public Modifier {
public: public:
// Parameter block // Parameter block
@ -50,7 +50,7 @@ class PO2RPO : public Modifier {
HWND hRollup; HWND hRollup;
// From Animatable // From Animatable
const MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); }
//From Modifier //From Modifier
//TODO: Add the channels that the modifier needs to perform its modification //TODO: Add the channels that the modifier needs to perform its modification
@ -87,7 +87,7 @@ class PO2RPO : public Modifier {
void GetClassName(TSTR& s) {s = GetString(IDS_CLASS_NAME);} void GetClassName(TSTR& s) {s = GetString(IDS_CLASS_NAME);}
RefTargetHandle Clone( RemapDir &remap ); RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); RefResult NotifyRefChanged(NOTIFY_REF_PARAMS);
int NumSubs() { return 0; } int NumSubs() { return 0; }
TSTR SubAnimName(int i) { return GetString(IDS_PARAMS); } TSTR SubAnimName(int i) { return GetString(IDS_PARAMS); }

@ -44,8 +44,8 @@ static ParamBlockDesc2 po2rpo_param_blk ( po2rpo_params, _T("params"), 0, &PO2R
p_default, 0.1f, p_default, 0.1f,
p_range, 0.0f,1000.0f, p_range, 0.0f,1000.0f,
p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_EDIT, IDC_SPIN, 0.01f, p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_EDIT, IDC_SPIN, 0.01f,
p_end, nl_p_end,
p_end nl_p_end
); );
IObjParam *PO2RPO::ip = NULL; IObjParam *PO2RPO::ip = NULL;
@ -142,7 +142,7 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
if (versionInfoSize) if (versionInfoSize)
{ {
// Alloc the buffer (size in bytes) // Alloc the buffer (size in bytes)
uint8_t *buffer = new uint8_t[versionInfoSize]; uint8 *buffer = new uint8[versionInfoSize];
// Find the verion resource // Find the verion resource
if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer)) if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer))
@ -221,7 +221,7 @@ void PO2RPO::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next)
// ----------------------------------------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------------------------------------
//From ReferenceMaker //From ReferenceMaker
RefResult PO2RPO::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) RefResult PO2RPO::NotifyRefChanged(NOTIFY_REF_PARAMS)
{ {
//TODO: Add code to handle the various reference changed messages //TODO: Add code to handle the various reference changed messages
return REF_SUCCEED; return REF_SUCCEED;

@ -216,7 +216,7 @@ export_zone_cf (Value** arg_list, int count)
if (tri->rpatch->exportZone (node, &tri->patch, zone, zoneSymmetry, nZone, 160, 1, false)) if (tri->rpatch->exportZone (node, &tri->patch, zone, zoneSymmetry, nZone, 160, 1, false))
{ {
// Export path // Export path
const std::string sPath = tStrToUtf8(arg_list[1]->to_string()); const std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
COFile file; COFile file;
if (file.open (sPath)) if (file.open (sPath))
@ -246,7 +246,7 @@ Value* import_zone_cf (Value** arg_list, int count)
Interface *ip = MAXScript_interface; Interface *ip = MAXScript_interface;
// Get the filename // Get the filename
string filename = tStrToUtf8(arg_list[0]->to_string()); string filename = MCharStrToUtf8(arg_list[0]->to_string());
// Get the flip // Get the flip
bool dialog = arg_list[1]->to_bool ()!=FALSE; bool dialog = arg_list[1]->to_bool ()!=FALSE;
@ -289,14 +289,14 @@ Value* import_zone_cf (Value** arg_list, int count)
{ {
// Error message // Error message
std::string msg = toString("Error when loading file %s: %s", filename.c_str(), e.what()); std::string msg = toString("Error when loading file %s: %s", filename.c_str(), e.what());
errorMessage (utf8ToTStr(msg), _T("NeL import zone"), *ip, dialog); errorMessage (MaxTStrFromUtf8(msg), _M("NeL import zone"), *ip, dialog);
} }
} }
else else
{ {
// Error message // Error message
std::string msg = toString("Can't open the file %s for reading.", filename.c_str()); std::string msg = toString("Can't open the file %s for reading.", filename.c_str());
errorMessage (utf8ToTStr(msg), _T("NeL import zone"), *ip, dialog); errorMessage (MaxTStrFromUtf8(msg), _M("NeL import zone"), *ip, dialog);
} }
return ret; return ret;
@ -1708,7 +1708,7 @@ Value* set_tile_bank_cf (Value** arg_list, int count)
type_check(arg_list[0], String, _M("NelSetTileBank [tile bank pathname]")); type_check(arg_list[0], String, _M("NelSetTileBank [tile bank pathname]"));
// ok ? // ok ?
const std::string pathname = tStrToUtf8(arg_list[0]->to_string()); const std::string pathname = MCharStrToUtf8(arg_list[0]->to_string());
// Get tile number // Get tile number
SetBankPathName (pathname); SetBankPathName (pathname);

@ -574,7 +574,7 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac
static bool additiveTile; static bool additiveTile;
static bool automaticLighting; static bool automaticLighting;
RefResult NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) { return REF_SUCCEED; } RefResult NotifyRefChanged(NOTIFY_REF_PARAMS) { return REF_SUCCEED; }
int selLevel; int selLevel;
@ -751,7 +751,7 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac
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 );
RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir()); RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir());
const MCHAR *GetObjectName() { return GetString(IDS_TH_EDITPATCH); } GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return GetString(IDS_TH_EDITPATCH); }
void ActivateSubobjSel(int level, XFormModes& modes ); void ActivateSubobjSel(int level, XFormModes& modes );
int NeedUseSubselButton() { return 0; } int NeedUseSubselButton() { return 0; }
void SelectSubPatch(int index); void SelectSubPatch(int index);

@ -338,7 +338,7 @@ static INT_PTR CALLBACK PickSetDlgProc(
Tab<TSTR*> &names = *((Tab < TSTR*>*)lParam); Tab<TSTR*> &names = *((Tab < TSTR*>*)lParam);
for (int i = 0; i < names.Count(); i++) for (int i = 0; i < names.Count(); i++)
{ {
int pos = SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_ADDSTRING, 0, (LPARAM)(TCHAR*)*names[i]->ToMCHAR()); int pos = SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_ADDSTRING, 0, (LPARAM)(*names[i]->data()));
SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_SETITEMDATA, pos, i); SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_SETITEMDATA, pos, i);
} }
break; break;

@ -1 +1,3 @@
#include "stdafx.h" #include "stdafx.h"
void nlmax_patch_edit_stdafx_dummy() { }

@ -107,7 +107,10 @@ std::string GetBankPathName ()
DWORD len = 256 * sizeof(TCHAR); DWORD len = 256 * sizeof(TCHAR);
DWORD type; DWORD type;
if (RegQueryValueEx(hKey, _T("Bank Path"), 0, &type, (LPBYTE)path, &len)==ERROR_SUCCESS) if (RegQueryValueEx(hKey, _T("Bank Path"), 0, &type, (LPBYTE)path, &len)==ERROR_SUCCESS)
return tStrToUtf8(path); {
RegCloseKey(hKey);
return MCharStrToUtf8(path);
}
RegCloseKey(hKey); RegCloseKey(hKey);
} }
return ""; return "";
@ -122,7 +125,10 @@ int GetBankTileSetSet ()
DWORD len = 256; DWORD len = 256;
DWORD type; DWORD type;
if (RegQueryValueEx(hKey, _T("Tileset Set"), 0, &type, (LPBYTE)&tileSetSet, &len)==ERROR_SUCCESS) if (RegQueryValueEx(hKey, _T("Tileset Set"), 0, &type, (LPBYTE)&tileSetSet, &len)==ERROR_SUCCESS)
{
RegCloseKey(hKey);
return tileSetSet; return tileSetSet;
}
RegCloseKey(hKey); RegCloseKey(hKey);
} }
return -1; return -1;
@ -134,8 +140,7 @@ void SetBankPathName (const std::string& path)
if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_TILEDIT, &hKey)==ERROR_SUCCESS) if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_TILEDIT, &hKey)==ERROR_SUCCESS)
{ {
TCHAR buffer[MAX_PATH]; TCHAR buffer[MAX_PATH];
_tcscpy_s(buffer, MAX_PATH, utf8ToTStr(path)); _tcscpy_s(buffer, MAX_PATH, MaxTStrFromUtf8(path).data());
RegSetValueEx(hKey, _T("Bank Path"), 0, REG_SZ, (LPBYTE)buffer, (_tcslen(buffer)+1)*sizeof(TCHAR)); RegSetValueEx(hKey, _T("Bank Path"), 0, REG_SZ, (LPBYTE)buffer, (_tcslen(buffer)+1)*sizeof(TCHAR));
RegCloseKey (hKey); RegCloseKey (hKey);
} }

@ -30,6 +30,7 @@
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
#include "path_mesh_alloc.h" #include "path_mesh_alloc.h"
#include "../nel_3dsmax_shared/string_common.h"
//#define USE_CACHE //#define USE_CACHE
@ -451,7 +452,7 @@ public:
} }
catch (const NLMISC::EStream& excp) catch (const NLMISC::EStream& excp)
{ {
MessageBox (NULL, utf8ToTStr(excp.what()), _T("Load error"), MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, MaxTStrFromUtf8(excp.what()).data(), _T("Load error"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
return _bank; return _bank;

@ -304,7 +304,7 @@ void RPO::GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel )
// ------------------------------------------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------------------------------------------
//From ReferenceMaker //From ReferenceMaker
RefResult RPO::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget,PartID& partID, RefMessage message, BOOL propagate ) RefResult RPO::NotifyRefChanged(NOTIFY_REF_PARAMS)
{ {
//TODO: Implement, if the object makes references to other things //TODO: Implement, if the object makes references to other things
//return PatchObject::NotifyRefChanged( changeInt, hTarget, partID, message, propagate); //return PatchObject::NotifyRefChanged( changeInt, hTarget, partID, message, propagate);

@ -83,7 +83,7 @@ class RPO : public PatchObject
int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt); int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt);
void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt); void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt);
//TODO: Return the name that will appear in the history browser (modifier stack) //TODO: Return the name that will appear in the history browser (modifier stack)
const MCHAR *GetObjectName() { return _M("Rykol Patch Object");} GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return _M("Rykol Patch Object");}
void GetWorldBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); void GetWorldBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box );
void GetLocalBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); void GetLocalBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box );
@ -206,10 +206,10 @@ class RPO : public PatchObject
? true : PatchObject::IsSubClassOf(classID); ? true : PatchObject::IsSubClassOf(classID);
} }
SClass_ID SuperClassID() { return GEOMOBJECT_CLASS_ID; } SClass_ID SuperClassID() { return GEOMOBJECT_CLASS_ID; }
void GetClassName(TSTR& s) {s.FromUTF8("Rykol Patch Object");} void GetClassName(TSTR& s) { s = "Rykol Patch Object";}
RefTargetHandle Clone ( RemapDir &remap ); RefTargetHandle Clone ( RemapDir &remap );
RefResult NotifyRefChanged (const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); RefResult NotifyRefChanged (NOTIFY_REF_PARAMS);
int NumSubs() int NumSubs()
{ {

@ -193,7 +193,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
} }
catch (const EStream& e) catch (const EStream& e)
{ {
MessageBox (NULL, utf8ToTStr(e.what()), _T("Error"), MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, MaxTStrFromUtf8(e.what()).data(), _T("Error"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
@ -267,8 +267,8 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
} }
// Show the message // Show the message
mprintf (utf8ToTStr(error)); mprintf(_M("%s\n"), MaxTStrFromUtf8(error).data());
nlwarning (error.c_str()); nlwarning("%s", error.c_str());
// Error // Error
return false; return false;
@ -395,7 +395,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
icv=getCommonVertex(pPM,idstpatch,isrcpatch,&orderdstvtx); icv=getCommonVertex(pPM,idstpatch,isrcpatch,&orderdstvtx);
if (icv==-1) if (icv==-1)
{ {
mprintf (_T("Invalid bind")); mprintf(_M("Invalid bind\n"));
nlwarning("Invalid bind"); nlwarning("Invalid bind");
return false; return false;
} }
@ -419,7 +419,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
icv=getCommonVertex(pPM,idstpatch,isrcpatch); icv=getCommonVertex(pPM,idstpatch,isrcpatch);
if (icv==-1) if (icv==-1)
{ {
mprintf (_T("Invalid bind")); mprintf(_M("Invalid bind\n"));
nlwarning ("Invalid bind"); nlwarning ("Invalid bind");
return false; return false;
} }
@ -436,7 +436,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
icv=getCommonVertex(pPM,idstpatch,isrcpatch); icv=getCommonVertex(pPM,idstpatch,isrcpatch);
if (icv==-1) if (icv==-1)
{ {
mprintf (_T("Invalid bind")); mprintf(_M("Invalid bind\n"));
nlwarning ("Invalid bind"); nlwarning ("Invalid bind");
return false; return false;
} }
@ -448,8 +448,8 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
isrcedge=getEdge(pPM,srcpatch,srcpatch->v[nv],icv); isrcedge=getEdge(pPM,srcpatch,srcpatch->v[nv],icv);
if (isrcedge==-1) if (isrcedge==-1)
{ {
mprintf (_T("Invalid edge")); mprintf(_M("Invalid edge\n"));
nlwarning ("Invalid bind"); nlwarning("Invalid edge");
return false; return false;
} }
// let's fill the dst patch (n is important here... it's the order) // let's fill the dst patch (n is important here... it's the order)
@ -592,8 +592,8 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
sym.invert (); sym.invert ();
if (!CPatchInfo::transform (patchinfo, zoneSymmetry, bank, symmetry, rotate, snapCell, weldThreshold, sym)) if (!CPatchInfo::transform (patchinfo, zoneSymmetry, bank, symmetry, rotate, snapCell, weldThreshold, sym))
{ {
mprintf (_T("Can't transform the zone")); mprintf(_M("Can't transform the zone\n"));
nlwarning ("Invalid bind"); nlwarning("Can't transform the zone");
return false; return false;
} }
} }
@ -609,7 +609,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
uint i; uint i;
for (i=0; i<error.Errors.size (); i++) for (i=0; i<error.Errors.size (); i++)
{ {
mprintf (utf8ToTStr(error.Errors[i])); mprintf(_M("%s\n"), MaxTStrFromUtf8(error.Errors[i]));
} }
return false; return false;
} }

@ -15,3 +15,5 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h" #include "stdafx.h"
void nlmax_patch_library_stdafx_dummy() { }

@ -422,7 +422,7 @@ class PaintPatchMod : public Modifier
static bool automaticLighting; static bool automaticLighting;
static bool lockBorders; static bool lockBorders;
RefResult NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) { return REF_SUCCEED; } RefResult NotifyRefChanged(NOTIFY_REF_PARAMS) { return REF_SUCCEED; }
bool includeMeshes; bool includeMeshes;
bool preloadTiles; bool preloadTiles;
@ -481,7 +481,7 @@ class PaintPatchMod : public Modifier
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 );
RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir()); RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir());
const MCHAR *GetObjectName() { return _M("NeL Patch Painter"); } GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return _M("NeL Patch Painter"); }
void RescaleWorldUnits(float f); void RescaleWorldUnits(float f);

@ -2839,7 +2839,7 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
if (GetOpenFileName(&openFile)) if (GetOpenFileName(&openFile))
{ {
// Load the file // Load the file
paintColor.loadBrush (tStrToUtf8(buffer)); paintColor.loadBrush (MCharStrToUtf8(buffer));
paintColor.setBrushMode (true); paintColor.setBrushMode (true);
} }
} }
@ -3720,7 +3720,7 @@ void EPM_PaintCMode::DoPaint ()
{ {
std::string error = NLMISC::toString("Invalid edge '%i' with value '%i' in patch '%i' in PatchMesh", p, mYedge, e); std::string error = NLMISC::toString("Invalid edge '%i' with value '%i' in patch '%i' in PatchMesh", p, mYedge, e);
nlwarning(error.c_str()); nlwarning(error.c_str());
MessageBox(NULL, utf8ToTStr(error), _T("NeL Patch Painter"), MB_OK | MB_ICONSTOP); MessageBox(NULL, MaxTStrFromUtf8(error).data(), _T("NeL Patch Painter"), MB_OK | MB_ICONSTOP);
return; return;
} }
#if (MAX_RELEASE < 4000) #if (MAX_RELEASE < 4000)
@ -3883,8 +3883,8 @@ void EPM_PaintCMode::DoPaint ()
} }
if (patchVoisin.patch!=-1) if (patchVoisin.patch!=-1)
{ {
std::string first = tStrToUtf8(vectMesh[i].Node->GetName()); std::string first = MCharStrToUtf8(vectMesh[i].Node->GetName());
std::string second = tStrToUtf8(vectMesh[patchVoisin.Mesh].Node->GetName()); std::string second = MCharStrToUtf8(vectMesh[patchVoisin.Mesh].Node->GetName());
int rot = (2-((vectMesh[i].Symmetry)?(2-e):e)+((vectMesh[patchVoisin.Mesh].Symmetry)?(2-edgeVoisin):edgeVoisin))&3; int rot = (2-((vectMesh[i].Symmetry)?(2-e):e)+((vectMesh[patchVoisin.Mesh].Symmetry)?(2-edgeVoisin):edgeVoisin))&3;
int nU = 1 << rpatch->getUIPatch (p).NbTilesU; int nU = 1 << rpatch->getUIPatch (p).NbTilesU;
int nV = 1 << rpatch->getUIPatch (p).NbTilesV; int nV = 1 << rpatch->getUIPatch (p).NbTilesV;
@ -3991,7 +3991,7 @@ void EPM_PaintCMode::DoPaint ()
} }
catch (const EStream& stream) catch (const EStream& stream)
{ {
MessageBox (NULL, utf8ToTStr(stream.what()), _T("Error"), MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, MaxTStrFromUtf8(stream.what()).data(), _T("Error"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
@ -4063,7 +4063,7 @@ bool loadLigoConfigFile (CLigoConfig& config, Interface& it)
if (res) if (res)
{ {
// Path // Path
std::string modulePath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)); std::string modulePath = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath));
try try
{ {
@ -4259,8 +4259,8 @@ DWORD WINAPI myThread (LPVOID vData)
} }
else else
{ {
std::string message = toString("Can't build the zone named %s", tStrToUtf8(pData->VectMesh[i].Node->GetName()).c_str()); std::string message = toString("Can't build the zone named %s", MCharStrToUtf8(pData->VectMesh[i].Node->GetName()).c_str());
MessageBox (pData->eproc->ip->GetMAXHWnd(), utf8ToTStr(message), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); MessageBox (pData->eproc->ip->GetMAXHWnd(), MaxTStrFromUtf8(message).data(), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
@ -4362,14 +4362,14 @@ DWORD WINAPI myThread (LPVOID vData)
} }
catch (const EDru& druExcept) catch (const EDru& druExcept)
{ {
MessageBox (NULL, utf8ToTStr(druExcept.what()), _T("NeL driver utility"), MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, MaxTStrFromUtf8(druExcept.what()).data(), _T("NeL driver utility"), MB_OK|MB_ICONEXCLAMATION);
} }
delete pData; delete pData;
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (NULL, utf8ToTStr(e.what()), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, MaxTStrFromUtf8(e.what()).data(), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION);
} }
return 0; return 0;

@ -319,7 +319,7 @@ void getColors (COLORREF *array)
DWORD len=4; DWORD len=4;
DWORD type; DWORD type;
std::string regName = toString("Color%u", i); std::string regName = toString("Color%u", i);
RegQueryValueEx (hKey, utf8ToTStr(regName), 0, &type, (LPBYTE)(array+i), &len); RegQueryValueEx (hKey, MaxTStrFromUtf8(regName).data(), 0, &type, (LPBYTE)(array+i), &len);
} }
RegCloseKey (hKey); RegCloseKey (hKey);
} }
@ -337,7 +337,7 @@ void setColors (const COLORREF *array)
{ {
DWORD len=4; DWORD len=4;
std::string regName = toString("Color%u", i); std::string regName = toString("Color%u", i);
RegSetValueEx (hKey, utf8ToTStr(regName), 0, REG_DWORD, (LPBYTE)(array+i), 4); RegSetValueEx (hKey, MaxTStrFromUtf8(regName).data(), 0, REG_DWORD, (LPBYTE)(array+i), 4);
} }
RegCloseKey (hKey); RegCloseKey (hKey);
} }
@ -412,7 +412,7 @@ void LoadKeyCfg ()
if (res) if (res)
{ {
// Make a new path // Make a new path
std::string cfgPath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)) + "keys.cfg"; std::string cfgPath = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath)) + "keys.cfg";
CConfigFile cf; CConfigFile cf;
@ -455,7 +455,7 @@ void LoadVarCfg ()
{ {
// Make a new path // Make a new path
char cgfPath[256]; char cgfPath[256];
std::string cfgPath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)) + "keys.cfg"; std::string cfgPath = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath)) + "keys.cfg";
CConfigFile cf; CConfigFile cf;

@ -402,7 +402,7 @@ bool CPaintColor::loadBrush (const std::string &brushFileName)
{ {
// Error message // Error message
std::string msg = toString("Can't open the file %s.", brushFileName.c_str()); std::string msg = toString("Can't open the file %s.", brushFileName.c_str());
MessageBox ((HWND)CNELU::Driver->getDisplay(), utf8ToTStr(msg), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); MessageBox((HWND)CNELU::Driver->getDisplay(), MaxTStrFromUtf8(msg).data(), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION);
// Return false // Return false
return false; return false;
@ -411,7 +411,7 @@ bool CPaintColor::loadBrush (const std::string &brushFileName)
catch (const Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
MessageBox ((HWND)CNELU::Driver->getDisplay(), utf8ToTStr(e.what()), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); MessageBox((HWND)CNELU::Driver->getDisplay(), MaxTStrFromUtf8(e.what()).data(), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION);
// Return false // Return false
return false; return false;

@ -1 +1,3 @@
#include "stdafx.h" #include "stdafx.h"
void nlmax_patch_painter_stdafx_dummy() { }

@ -483,7 +483,7 @@ void VertexPaint::EndEditParams(IObjParam *ip, ULONG flags, Animatable *next)
//From ReferenceMaker //From ReferenceMaker
RefResult VertexPaint::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) RefResult VertexPaint::NotifyRefChanged(NOTIFY_REF_PARAMS)
{ {
return REF_SUCCEED; return REF_SUCCEED;
} }

@ -29,6 +29,7 @@
#define NL_MAP_ASSERT #define NL_MAP_ASSERT
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include "../nel_3dsmax_shared/string_common.h"
#define VERTEX_TREE_PAINT_CLASS_ID Class_ID(0x40c7005e, 0x2a95082c) #define VERTEX_TREE_PAINT_CLASS_ID Class_ID(0x40c7005e, 0x2a95082c)
#define CID_PAINT (CID_USER+0x439c) #define CID_PAINT (CID_USER+0x439c)
@ -131,7 +132,7 @@ public:
void GetClassName(TSTR& s) { s= TSTR(GetString(IDS_CLASS_NAME)); } void GetClassName(TSTR& s) { s= TSTR(GetString(IDS_CLASS_NAME)); }
virtual Class_ID ClassID() { return VERTEX_TREE_PAINT_CLASS_ID;} virtual Class_ID ClassID() { return VERTEX_TREE_PAINT_CLASS_ID;}
RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir()); RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir());
const MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); }
IOResult Load(ILoad *iload); IOResult Load(ILoad *iload);
IOResult Save(ISave *isave); IOResult Save(ISave *isave);
IOResult LoadLocalData(ILoad *iload, LocalModData **pld); IOResult LoadLocalData(ILoad *iload, LocalModData **pld);
@ -161,7 +162,7 @@ public:
Animatable* SubAnim(int i); Animatable* SubAnim(int i);
TSTR SubAnimName(int i); TSTR SubAnimName(int i);
RefResult NotifyRefChanged(const Interval& changeInt,RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); RefResult NotifyRefChanged(NOTIFY_REF_PARAMS);
CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;} CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;}
void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev); void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);

@ -85,7 +85,7 @@ class RGBAdd: public Texmap {
int RemapRefOnLoad(int iref); int RemapRefOnLoad(int iref);
RefTargetHandle Clone(RemapDir &remap = DefaultRemapDir()); RefTargetHandle Clone(RemapDir &remap = DefaultRemapDir());
RefResult NotifyRefChanged(const Interval &changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); RefResult NotifyRefChanged(NOTIFY_REF_PARAMS);
// IO // IO
IOResult Save(ISave *isave); IOResult Save(ISave *isave);
@ -130,41 +130,41 @@ enum
static ParamBlockDesc2 RGBAdd_param_blk ( RGBAdd_params, _T("parameters"), 0, &maskCD, P_AUTO_CONSTRUCT + P_AUTO_UI, 0, static ParamBlockDesc2 RGBAdd_param_blk ( RGBAdd_params, _T("parameters"), 0, &maskCD, P_AUTO_CONSTRUCT + P_AUTO_UI, 0,
//rollout //rollout
IDD_RGBMULT, "RGB Additif Parameters", 0, 0, NULL, IDD_RGBMULT, _T("RGB Additif Parameters"), 0, 0, NULL,
// params // params
RGBAdd_color1, _T("color1"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR1, RGBAdd_color1, _T("color1"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR1,
p_default, Color(0,0,0), p_default, Color(0,0,0),
p_ui, TYPE_COLORSWATCH, IDC_MULT_COL1, p_ui, TYPE_COLORSWATCH, IDC_MULT_COL1,
p_end, nl_p_end,
RGBAdd_color2, _T("color2"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR2, RGBAdd_color2, _T("color2"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR2,
p_default, Color(0.5,0.5,0.5), p_default, Color(0.5,0.5,0.5),
p_ui, TYPE_COLORSWATCH, IDC_MULT_COL2, p_ui, TYPE_COLORSWATCH, IDC_MULT_COL2,
p_end, nl_p_end,
RGBAdd_map1, _T("map1"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP1, RGBAdd_map1, _T("map1"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP1,
p_refno, 1, p_refno, 1,
p_subtexno, 0, p_subtexno, 0,
p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX1, p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX1,
p_end, nl_p_end,
RGBAdd_map2, _T("map2"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP2, RGBAdd_map2, _T("map2"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP2,
p_refno, 2, p_refno, 2,
p_subtexno, 1, p_subtexno, 1,
p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX2, p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX2,
p_end, nl_p_end,
RGBAdd_map1_on, _T("map1Enabled"), TYPE_BOOL, 0, IDS_JW_MAP1ENABLE, RGBAdd_map1_on, _T("map1Enabled"), TYPE_BOOL, 0, IDS_JW_MAP1ENABLE,
p_default, TRUE, p_default, TRUE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON1, p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON1,
p_end, nl_p_end,
RGBAdd_map2_on, _T("map2Enabled"), TYPE_BOOL, 0, IDS_JW_MAP2ENABLE, RGBAdd_map2_on, _T("map2Enabled"), TYPE_BOOL, 0, IDS_JW_MAP2ENABLE,
p_default, TRUE, p_default, TRUE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON2, p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON2,
p_end, nl_p_end,
RGBAdd_type, _T("alphaFrom"), TYPE_INT, 0, IDS_PW_ALPHAFROM, RGBAdd_type, _T("alphaFrom"), TYPE_INT, 0, IDS_PW_ALPHAFROM,
p_default, 2, p_default, 2,
p_range, 0, 2, p_range, 0, 2,
p_ui, TYPE_RADIO, 3, IDC_MULT_ALPHA1, IDC_MULT_ALPHA2, IDC_MULT_ALPHA3, p_ui, TYPE_RADIO, 3, IDC_MULT_ALPHA1, IDC_MULT_ALPHA2, IDC_MULT_ALPHA3,
p_end, nl_p_end,
p_end nl_p_end
); );
@ -364,7 +364,7 @@ TSTR RGBAdd::SubAnimName(int i) {
} }
} }
RefResult RGBAdd::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) RefResult RGBAdd::NotifyRefChanged(NOTIFY_REF_PARAMS)
{ {
switch (message) switch (message)
{ {

@ -21,6 +21,8 @@
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "../nel_patch_lib/rpo.h" #include "../nel_patch_lib/rpo.h"
#include "../nel_3dsmax_shared/string_common.h"
#define TILE_UTILITY_CLASS_ID Class_ID(0x2301c0, 0x4c156b46) #define TILE_UTILITY_CLASS_ID Class_ID(0x2301c0, 0x4c156b46)
extern ClassDesc* GetRGBAddDesc(); extern ClassDesc* GetRGBAddDesc();
@ -192,7 +194,7 @@ static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam,
ofn.lpTemplateName=0; ofn.lpTemplateName=0;
if (GetOpenFileName(&ofn)) if (GetOpenFileName(&ofn))
{ {
theTile_utility.Load (tStrToUtf8(sPath)); theTile_utility.Load (MCharStrToUtf8(sPath));
theTile_utility.SetLand (theTile_utility.Land); theTile_utility.SetLand (theTile_utility.Land);
theTile_utility.SetupUI (); theTile_utility.SetupUI ();
} }
@ -287,7 +289,7 @@ void Tile_utility::Load (const std::string& path)
if (!file.open (path)) if (!file.open (path))
{ {
std::string tmp = toString("File not found: %s", path.c_str()); std::string tmp = toString("File not found: %s", path.c_str());
MessageBox (NULL, utf8ToTStr(tmp), _T("Error.."), MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, MaxTStrFromUtf8(tmp).data(), _T("Error.."), MB_OK|MB_ICONEXCLAMATION);
} }
else else
{ {
@ -299,7 +301,7 @@ void Tile_utility::Load (const std::string& path)
catch (const EStream &stream) catch (const EStream &stream)
{ {
std::string tmp = toString("Error while loading %s:\n\n%s", path.c_str(), stream.what()); std::string tmp = toString("Error while loading %s:\n\n%s", path.c_str(), stream.what());
MessageBox (NULL, utf8ToTStr(tmp), _T("Error.."), MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, MaxTStrFromUtf8(tmp).data(), _T("Error.."), MB_OK|MB_ICONEXCLAMATION);
} }
} }
@ -337,7 +339,7 @@ void Tile_utility::SetupUI ()
std::string name=Bank.getLand(nLand)->getName(); std::string name=Bank.getLand(nLand)->getName();
if (hCombo) if (hCombo)
{ {
SendMessage (hCombo, CB_INSERTSTRING, -1, (LPARAM)utf8ToTStr(name)); SendMessage (hCombo, CB_INSERTSTRING, -1, (LPARAM)MaxTStrFromUtf8(name).data());
} }
} }
@ -369,7 +371,7 @@ void Tile_utility::SetupUI ()
name[0] = upName[0]; name[0] = upName[0];
} }
SetWindowText (hwnd, utf8ToTStr(name)); SetWindowText (hwnd, MaxTStrFromUtf8(name).data());
// Static text // Static text
TCHAR sTmp[256]; TCHAR sTmp[256];
@ -451,7 +453,7 @@ bool Tile_utility::SetupMaterial () const
tex->SetAlphaSource (ALPHA_NONE); tex->SetAlphaSource (ALPHA_NONE);
tex->SetAlphaAsMono (FALSE); tex->SetAlphaAsMono (FALSE);
tex->SetAlphaAsRGB (FALSE); tex->SetAlphaAsRGB (FALSE);
tex->SetMapName (utf8ToTStr(Bank.getAbsPath() + tile->getRelativeFileName(CTile::diffuse))); tex->SetMapName (MaxTStrFromUtf8(Bank.getAbsPath() + tile->getRelativeFileName(CTile::diffuse)).data());
// Assign BitmapTex // Assign BitmapTex
rgb->SetSubTexmap (0, tex); rgb->SetSubTexmap (0, tex);
@ -471,7 +473,7 @@ bool Tile_utility::SetupMaterial () const
tex->SetAlphaSource (ALPHA_NONE); tex->SetAlphaSource (ALPHA_NONE);
tex->SetAlphaAsMono (FALSE); tex->SetAlphaAsMono (FALSE);
tex->SetAlphaAsRGB (FALSE); tex->SetAlphaAsRGB (FALSE);
tex->SetMapName (utf8ToTStr(Bank.getAbsPath() + tile->getRelativeFileName(CTile::additive))); tex->SetMapName (MaxTStrFromUtf8(Bank.getAbsPath() + tile->getRelativeFileName(CTile::additive)).data());
// Assign BitmapTex // Assign BitmapTex
rgb->SetSubTexmap (1, tex); rgb->SetSubTexmap (1, tex);

@ -48,4 +48,6 @@ extern HINSTANCE hInstance;
#define RGBAddClassID (Class_ID(0x5621932, 0x565a6387)) #define RGBAddClassID (Class_ID(0x5621932, 0x565a6387))
#include "../nel_3dsmax_shared/string_common.h"
#endif // __TILE_UTILITY__H #endif // __TILE_UTILITY__H

Loading…
Cancel
Save