Fix build for Max 2010 plugins on VS2008

This commit is contained in:
kaetemi 2019-04-28 16:25:19 +08:00
parent bd21bfeeb3
commit 449f0061f8
54 changed files with 455 additions and 347 deletions

View file

@ -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 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 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
#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
// FIXME: This is not accurate, it should be a conversion between local charset and utf8
#define tStrToUtf8(str) (std::string((LPCSTR)str))
inline const char *nlutf8ToTStr(const char *str) { return str; }
inline const char *nlutf8ToTStr(const std::string &str) { return str.c_str(); }
#define utf8ToTStr(str) NLMISC::nlutf8ToTStr(str)
#endif
#if (NL_COMP_VC_VERSION <= 90) /* VS2008 does not have stdint.h */
float nlroundf(float x)
#if (NL_COMP_VC_VERSION <= 90)
inline float nlroundf(float x)
{
return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
}
#define roundf(x) NLMISC::nlroundf(x)
#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);
/** Signed 64 bit fseek. Same interface as fseek

View file

@ -38,6 +38,8 @@
#include "nel/ligo/ligo_error.h"
#include "nel/misc/path.h"
#include "../../plugin_max/nel_3dsmax_shared/string_common.h"
using namespace std;
using namespace NLMISC;
extern HINSTANCE hInstance;
@ -126,13 +128,13 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di
{
// Get the path
TCHAR sModulePath[256];
int res=GetModuleFileName(hModule, sModulePath, 256);
int res = GetModuleFileName(hModule, sModulePath, 256);
// Success ?
if (res)
{
// Path
std::string path = NLMISC::CFile::getPath(tStrToUtf8(sModulePath) + "ligoscape.cfg");
std::string path = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath) + "ligoscape.cfg");
try
{
@ -164,16 +166,19 @@ void CMaxToLigo::errorMessage(const std::string &msg, const std::string &title,
if (dialog)
{
// 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
{
// Text message
mprintf (utf8ToTStr(msg + "\n"));
mprintf(_M("%s\n"), MaxTStrFromUtf8(msg).data());
}
// Output in log
nlwarning ("LIGO ERROR : %s", msg.c_str());
nlwarning("LIGO ERROR : %s", msg.c_str());
}
// ***************************************************************************

View file

@ -155,7 +155,7 @@ Value* export_material_cf (Value** arg_list, int count)
nlassert (node);
// 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
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));
// The second arg
std::string fileName = tStrToUtf8(arg_list[1]->to_string());
std::string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The second arg
string matFilename[2];
matFilename[0] = tStrToUtf8(arg_list[2]->to_string());
matFilename[1] = tStrToUtf8(arg_list[3]->to_string());
matFilename[0] = MCharStrToUtf8(arg_list[2]->to_string());
matFilename[1] = MCharStrToUtf8(arg_list[3]->to_string());
// The third arg
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);
// The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string());
string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The fourth arg
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);
// The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string());
string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The second arg
int transitionNumber = arg_list[2]->to_int();
@ -998,7 +998,7 @@ Value* export_zone_cf (Value** arg_list, int count)
nlassert (node);
// The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string());
string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The thrid arg
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);
// Get the strings
categories[i].first = tStrToUtf8(cell->get(1)->to_string());
categories[i].second = tStrToUtf8(cell->get(2)->to_string());
categories[i].first = MCharStrToUtf8(cell->get(1)->to_string());
categories[i].second = MCharStrToUtf8(cell->get(2)->to_string());
}
// 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;
// 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);
// 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
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);
// The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string());
string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The thrid arg
int xMin = arg_list[2]->to_int();

View file

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

View file

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

View file

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

View 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 */

View file

@ -94,7 +94,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
else
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 )
SendMessage( GetDlgItem(hwndDlg,IDC_RADIONORMALEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 );
@ -102,7 +102,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
if( theExportSceneStruct.nExportLighting == 1 )
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 )
SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_SETCHECK, BST_CHECKED, 0 );
@ -132,8 +132,8 @@ INT_PTR CALLBACK OptionsDialogCallback (
else
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_EDITCELLDELTAZ), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.SurfaceLightingDeltaZ)));
SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(toString(theExportSceneStruct.SurfaceLightingCellSize)).data());
SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(toString(theExportSceneStruct.SurfaceLightingDeltaZ)).data());
}
break;
@ -148,7 +148,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
if( theCNelExport.SelectDir(hwndDlg, _T("LightMaps Directory"), 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;
@ -180,7 +180,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
TCHAR tmp[1024];
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 )
theExportSceneStruct.nExportLighting = 0;
@ -189,7 +189,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
theExportSceneStruct.nExportLighting = 1;
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 )
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);
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 );
NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingDeltaZ);
NLMISC::fromString(MCharStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingDeltaZ);
// End the dialog
EndDialog(hwndDlg, TRUE);
@ -354,7 +354,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (RPO::isZone (*pNode, time))
{
// Save path
std::string sSavePath = tStrToUtf8(pNode->GetName());
std::string sSavePath = MCharStrToUtf8(pNode->GetName());
// Choose a file to export
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))
{
// Error message
std::string sErrorMsg = toString("Error exporting the zone %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox (hWnd, utf8ToTStr(sErrorMsg), L"NeL export", MB_OK|MB_ICONEXCLAMATION);
std::string sErrorMsg = toString("Error exporting the zone %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
}
}
}
else if (CExportNel::isVegetable (*pNode, time))
{
// Save path
std::string sSavePath = tStrToUtf8(pNode->GetName());
std::string sSavePath = MCharStrToUtf8(pNode->GetName());
// Choose a file to export
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))
{
// Error message
std::string sErrorMsg = toString("Error exporting the vegetable %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
std::string sErrorMsg = toString("Error exporting the vegetable %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
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))
{
// Save path
std::string sSavePath = tStrToUtf8(pNode->GetName());
std::string sSavePath = MCharStrToUtf8(pNode->GetName());
// Choose a file to export
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))
{
// 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());
MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
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, 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))
{
// Save path
std::string sSavePath = tStrToUtf8(pNode->GetName());
std::string sSavePath = MCharStrToUtf8(pNode->GetName());
// Choose a file to export
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))
{
// Error message
std::string sErrorMsg = toString("Error exporting the mesh %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
std::string sErrorMsg = toString("Error exporting the mesh %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
}
// Delete the skeleton pointer
if (pSkinShape)
@ -463,7 +463,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
// Name of the node
// Save path
std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName());
std::string sSavePath = MCharStrToUtf8((*vectNode.begin())->GetName());
// Choose a file to export
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))
{
// Error message
std::string sErrorMsg = toString("Error exporting animation %s in the file\n%s", tStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str());
MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION);
std::string sErrorMsg = toString("Error exporting animation %s in the file\n%s", MCharStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str());
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);
// 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))
{
@ -574,8 +574,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if (!theCNelExport.exportSWT (sSavePath, vectNode))
{
// Error message
std::string sErrorMsg = toString("Error exporting SWT %s in the file\n%s", tStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str());
MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION);
std::string sErrorMsg = toString("Error exporting SWT %s in the file\n%s", MCharStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str());
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);
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
if( DialogBox( hInstance,
@ -647,7 +647,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
theCNelExport.getSelectedNode (vectNode);
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))
{
@ -656,7 +656,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP
{
// Error message
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()))
{
// Error message
std::string sErrorMsg = toString("Error exporting skeleton %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION);
std::string sErrorMsg = toString("Error exporting skeleton %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str());
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)
{
::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()
{
// 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);
if( CFile::fileExists(sConfigFileName) )

View file

@ -329,7 +329,7 @@ bool CNelExport::exportAnim (const std::string &sPath, std::vector<INode*>& vect
catch (const Exception& e)
{
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
nlwarning ("ERROR : %s", e.what ());
}

View file

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

View file

@ -90,11 +90,11 @@ class addSubLodNodeHitCallBack : public HitByNameDlgCallback
public:
INodeTab NodeTab;
private:
virtual const MCHAR *dialogTitle()
virtual GET_OBJECT_NAME_CONST MCHAR *dialogTitle()
{
return _M("Select sub lod objects to add");
}
virtual const MCHAR *buttonText()
virtual GET_OBJECT_NAME_CONST MCHAR *buttonText()
{
return _M("Add");
}
@ -522,27 +522,27 @@ INT_PTR CALLBACK AccelDialogCallback (
std::set<std::string>::iterator first(_KnownSoundGroups.begin()), last(_KnownSoundGroups.end());
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
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);
}
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);
}
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);
}
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);
}
// 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);
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
TCHAR tmp[256];
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);
currentParam->OpenOcclusionModel = tStrToUtf8(tmp);
currentParam->OpenOcclusionModel = MCharStrToUtf8(tmp);
SendMessage (GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->SoundGroup = tStrToUtf8(tmp);
currentParam->SoundGroup = MCharStrToUtf8(tmp);
_KnownSoundGroups.insert(currentParam->SoundGroup);
SendMessage (GetDlgItem(hwndDlg, IDC_ENV_FX), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->EnvironmentFX = tStrToUtf8(tmp);
currentParam->EnvironmentFX = MCharStrToUtf8(tmp);
// Quit
EndDialog(hwndDlg, IDOK);
@ -653,9 +653,9 @@ INT_PTR CALLBACK MRMDialogCallback (
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
// 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)?" ...)":")");
SetWindowText (hwndDlg, utf8ToTStr(winName));
SetWindowText (hwndDlg, MaxTStrFromUtf8(winName).data());
// Set default state
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_DOWN), currentParam->ListActived);
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), utf8ToTStr(currentParam->DistMax));
SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), utf8ToTStr(currentParam->BlendLength));
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), MaxTStrFromUtf8(currentParam->DistMax).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), MaxTStrFromUtf8(currentParam->BlendLength).data());
SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_SETCHECK, currentParam->MRM, 0);
CoarseStateChanged (hwndDlg);
@ -678,12 +678,12 @@ INT_PTR CALLBACK MRMDialogCallback (
if (currentParam->SkinReduction!=-1)
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_DIVISOR), utf8ToTStr(currentParam->Divisor));
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), utf8ToTStr(currentParam->DistanceFinest));
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), utf8ToTStr(currentParam->DistanceMiddle));
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), utf8ToTStr(currentParam->DistanceCoarsest));
SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), utf8ToTStr(currentParam->BoneLodDistance));
SetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), MaxTStrFromUtf8(currentParam->NbLod).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), MaxTStrFromUtf8(currentParam->Divisor).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), MaxTStrFromUtf8(currentParam->DistanceFinest).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), MaxTStrFromUtf8(currentParam->DistanceMiddle).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), MaxTStrFromUtf8(currentParam->DistanceCoarsest).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), MaxTStrFromUtf8(currentParam->BoneLodDistance).data());
// Iterate list
HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1);
@ -719,9 +719,9 @@ INT_PTR CALLBACK MRMDialogCallback (
TCHAR 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);
currentParam->BlendLength = tStrToUtf8(tmp);
currentParam->BlendLength = MCharStrToUtf8(tmp);
currentParam->MRM=SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_GETCHECK, 0, 0);
@ -734,17 +734,17 @@ INT_PTR CALLBACK MRMDialogCallback (
currentParam->SkinReduction=2;
GetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), tmp, 512);
currentParam->NbLod = tStrToUtf8(tmp);
currentParam->NbLod = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), tmp, 512);
currentParam->Divisor = tStrToUtf8(tmp);
currentParam->Divisor = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), tmp, 512);
currentParam->DistanceFinest = tStrToUtf8(tmp);
currentParam->DistanceFinest = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), tmp, 512);
currentParam->DistanceMiddle = tStrToUtf8(tmp);
currentParam->DistanceMiddle = MCharStrToUtf8(tmp);
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);
currentParam->BoneLodDistance = tStrToUtf8(tmp);
currentParam->BoneLodDistance = MCharStrToUtf8(tmp);
// Iterate list
HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1);
@ -758,7 +758,7 @@ INT_PTR CALLBACK MRMDialogCallback (
SendMessage (hwndList, LB_GETTEXT, item, (LPARAM) tmp);
// Push it back
currentParam->ListLodName.push_back (tStrToUtf8(tmp));
currentParam->ListLodName.push_back (MCharStrToUtf8(tmp));
}
// default LodCharacter
@ -920,8 +920,8 @@ INT_PTR CALLBACK InstanceDialogCallback (
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), utf8ToTStr(currentParam->InstanceShape));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), utf8ToTStr(currentParam->InstanceName));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), MaxTStrFromUtf8(currentParam->InstanceShape).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), MaxTStrFromUtf8(currentParam->InstanceName).data());
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_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;
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];
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);
currentParam->InstanceName = tStrToUtf8(tmp);
currentParam->InstanceName = MCharStrToUtf8(tmp);
currentParam->DontAddToScene=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_GETCHECK, 0, 0);
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);
@ -1036,9 +1036,9 @@ INT_PTR CALLBACK LightmapDialogCallback (
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), utf8ToTStr(currentParam->LumelSizeMul));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), utf8ToTStr(currentParam->SoftShadowRadius));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), utf8ToTStr(currentParam->SoftShadowConeLength));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), MaxTStrFromUtf8(currentParam->LumelSizeMul).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), MaxTStrFromUtf8(currentParam->SoftShadowRadius).data());
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), MaxTStrFromUtf8(currentParam->SoftShadowConeLength).data());
// Lighting
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_LIGHT_DONT_CAST_SHADOW_INTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowInterior, 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);
// Set enable disable
@ -1075,11 +1075,11 @@ INT_PTR CALLBACK LightmapDialogCallback (
// Set default state
TCHAR 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);
currentParam->SoftShadowRadius = tStrToUtf8(tmp);
currentParam->SoftShadowRadius = MCharStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), tmp, 512);
currentParam->SoftShadowConeLength = tStrToUtf8(tmp);
currentParam->SoftShadowConeLength = MCharStrToUtf8(tmp);
// RealTime light
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->ExportLightMapAnimated = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_ANIMATED), BM_GETCHECK, 0, 0);
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);
// 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);
SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), utf8ToTStr(currentParam->VegetableBendFactor));
SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), MaxTStrFromUtf8(currentParam->VegetableBendFactor).data());
VegetableStateChanged (hwndDlg);
}
@ -1734,7 +1734,7 @@ INT_PTR CALLBACK VegetableDialogCallback (
TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), tmp, 512);
currentParam->VegetableBendFactor = tStrToUtf8(tmp);
currentParam->VegetableBendFactor = MCharStrToUtf8(tmp);
}
break;
case IDC_VEGETABLE:
@ -2290,34 +2290,34 @@ INT_PTR CALLBACK MiscDialogCallback (
// Ligoscape
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
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
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
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),
currentParam->InterfaceThreshold != -1.f ? utf8ToTStr(toStringMax(currentParam->InterfaceThreshold))
currentParam->InterfaceThreshold != -1.f ? MaxTStrFromUtf8(toStringMax(currentParam->InterfaceThreshold)).data()
: _T("")
);
SendMessage(GetDlgItem(hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_SETCHECK, currentParam->GetInterfaceNormalsFromSceneObjects, 0);
// Skeleton Scale
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
SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_SETCHECK, currentParam->UseRemanence, 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_SAMPLING_PERIOD), currentParam->RemanenceSamplingPeriod != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceSamplingPeriod)) : _T(""));
SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceRollupRatio)) : _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 ? MaxTStrFromUtf8(toStringMax(currentParam->RemanenceSamplingPeriod)).data() : _T(""));
SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? MaxTStrFromUtf8(toStringMax(currentParam->RemanenceRollupRatio)).data() : _T(""));
}
break;
@ -2338,24 +2338,24 @@ INT_PTR CALLBACK MiscDialogCallback (
currentParam->LigoSymmetry = SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_GETCHECK, 0, 0);
TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), tmp, 512);
currentParam->LigoRotate = tStrToUtf8(tmp);
currentParam->LigoRotate = MCharStrToUtf8(tmp);
// SWT
currentParam->SWT = SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), tmp, 512);
currentParam->SWTWeight = tStrToUtf8(tmp);
currentParam->SWTWeight = MCharStrToUtf8(tmp);
// Radial normals
for (uint smoothGroup=0; smoothGroup<NEL3D_RADIAL_NORMAL_COUNT; smoothGroup++)
{
HWND edit = GetDlgItem (hwndDlg, IDC_RADIAL_NORMAL_29+smoothGroup);
GetWindowText (edit, tmp, 512);
currentParam->RadialNormals[smoothGroup] = tStrToUtf8(tmp);
currentParam->RadialNormals[smoothGroup] = MCharStrToUtf8(tmp);
}
// mesh interfaces
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);
if (_tcslen(tmp) != 0)
currentParam->InterfaceThreshold = toFloatMax(tmp);
@ -2365,7 +2365,7 @@ INT_PTR CALLBACK MiscDialogCallback (
// Skeleton Scale
currentParam->ExportBoneScale= SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), tmp, 512);
currentParam->ExportBoneScaleNameExt = tStrToUtf8(tmp);
currentParam->ExportBoneScaleNameExt = MCharStrToUtf8(tmp);
// remanence
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);
uint rsn;
if (NLMISC::fromString(tStrToUtf8(tmp), rsn))
if (NLMISC::fromString(MCharStrToUtf8(tmp), rsn))
{
currentParam->RemanenceSliceNumber = rsn;
}
@ -2489,12 +2489,12 @@ INT_PTR CALLBACK LodDialogCallback (
{
// Param pointers
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
currentParam = (CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
// Window text
std::string winName = tStrToUtf8((*(currentParam->ListNode->begin()))->GetName());
winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")");
SetWindowText (hwndDlg, utf8ToTStr(winName));
TSTR winName = (*(currentParam->ListNode->begin()))->GetName();
winName = TSTR("Node properties (") + winName + ((currentParam->ListNode->size() > 1) ? _M(" ...)") : _M(")"));
SetWindowText(hwndDlg, winName.data());
// Move dialog
RECT windowRect, desktopRect;

View file

@ -59,7 +59,7 @@ bool CNelExport::exportInstanceGroup(string filename, vector<INode*>& vectNode)
catch (const Exception &c)
{
// 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;
}
}

View file

@ -91,7 +91,7 @@ Value* export_shape_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true);
// Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string());
std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Ok ?
Boolean *ret=&false_value;
@ -154,12 +154,12 @@ Value* export_shape_ex_cf (Value** arg_list, int count)
nlassert(node->GetName());
// Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string());
std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Ex argu
theExportSceneStruct.bShadow = arg_list[2]->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.rLumelSize = arg_list[6]->to_float();
theExportSceneStruct.nOverSampling = arg_list[7]->to_int();
@ -220,7 +220,7 @@ Value* export_skeleton_cf (Value** arg_list, int count)
nlassert (node);
// Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string());
std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Ok ?
Boolean *ret=&false_value;
@ -260,7 +260,7 @@ Value* export_animation_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true);
// Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string());
std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Get time
TimeValue time=MAXScript_interface->GetTime();
@ -298,7 +298,7 @@ Value* export_animation_cf (Value** arg_list, int count)
else
{
// 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());
// Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string());
std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Export
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());
// Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string());
std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Export
if (theCNelExport.exportSWT (sPath, vect))
@ -462,8 +462,8 @@ Value* test_file_date_cf (Value** arg_list, int count)
// Make sure we have the correct number of arguments (2)
check_arg_count(view_shape, 2, count);
type_check (arg_list[0], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]"));
type_check (arg_list[1], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]"));
type_check(arg_list[0], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]"));
type_check(arg_list[1], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]"));
// Get a good interface pointer
Interface *ip = MAXScript_interface;
@ -471,11 +471,11 @@ Value* test_file_date_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true);
// The 2 filenames
string file0 = tStrToUtf8(arg_list[0]->to_string());
string file1 = tStrToUtf8(arg_list[1]->to_string());
WStr file0 = arg_list[0]->to_string();
WStr file1 = arg_list[1]->to_string();
// Open it
FILE *file=nlfopen (file0.c_str(), "r");
FILE *file= nlfopen(ucstring((const ucchar *)file0.data()).toUtf8().c_str(), "r");
if (file == NULL)
return &true_value;
@ -486,10 +486,10 @@ Value* test_file_date_cf (Value** arg_list, int count)
Value *ret = &undefined;
// 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)
{
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)
{
// Get file time
@ -536,7 +536,7 @@ Value* export_vegetable_cf (Value** arg_list, int count)
nlassert (node);
// Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string());
std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Message in dialog
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);
// Export path
string sPath = tStrToUtf8(arg_list[1]->to_string());
string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Get time
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);
// Export path
string sPath = tStrToUtf8(arg_list[1]->to_string());
string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Get time
TimeValue time = MAXScript_interface->GetTime();
@ -733,7 +733,7 @@ Value* export_lod_character_cf (Value** arg_list, int count)
nlassert (node);
// Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string());
std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Message in dialog
bool dialogMessage = arg_list[2]->to_bool() != FALSE;
@ -879,18 +879,18 @@ Value* get_file_modification_date_cf (Value** arg_list, int count)
type_check (arg_list[0], String, message);
// get the node
string sPath = tStrToUtf8(arg_list[0]->to_string());
WStr sPath = arg_list[0]->to_string();
// get vertices indices
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)
{
FILETIME lastWriteTime;
if (GetFileTime(file, NULL, NULL, &lastWriteTime))
{
char number[512];
sprintf (number, "%08x%08x", lastWriteTime.dwHighDateTime, lastWriteTime.dwLowDateTime);
sprintf(number, "%08x%08x", lastWriteTime.dwHighDateTime, lastWriteTime.dwLowDateTime);
result = number;
}
CloseHandle (file);
@ -899,7 +899,7 @@ Value* get_file_modification_date_cf (Value** arg_list, int count)
if (result.empty())
return &undefined;
else
return new String(utf8ToTStr(result));
return new String(MaxTStrFromUtf8(result));
}
// ***************************************************************************
@ -914,24 +914,24 @@ Value* set_file_modification_date_cf (Value** arg_list, int count)
MCHAR *message = _M("bool NeLSetFileModificationDate [filename] [date] - If an error occurred, returns false.");
//type_check
type_check (arg_list[0], String, message);
type_check (arg_list[1], String, message);
type_check(arg_list[0], String, message);
type_check(arg_list[1], String, message);
// get the node
string sPath = tStrToUtf8(arg_list[0]->to_string());
string sDate = tStrToUtf8(arg_list[1]->to_string());
WStr sPath = arg_list[0]->to_string();
WStr sDate = arg_list[1]->to_string();
// get vertices indices
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)
{
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))
{
CloseHandle (file);
CloseHandle(file);
return &true_value;
}
}

View file

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

View file

@ -113,7 +113,7 @@ void regsiterOVPath ()
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; }
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
CConfigFile cf;
@ -300,7 +300,7 @@ void CNelExport::viewMesh (TimeValue time)
_ExportNel->buildSkeletonShape (*skelShape, *skeletonRoot, &(iteSkeleton->second), mapId, time);
// Add the shape in the view
uint instance = view->addSkel (skelShape, tStrToUtf8(skeletonRoot->GetName()));
uint instance = view->addSkel (skelShape, MCharStrToUtf8(skeletonRoot->GetName()));
// Add tracks
CAnimation *anim=new CAnimation;
@ -365,7 +365,7 @@ void CNelExport::viewMesh (TimeValue time)
INode* pNode=_Ip->GetSelNode (nNode);
string sTmp = "Object Name: ";
sTmp += tStrToUtf8(pNode->GetName());
sTmp += MCharStrToUtf8(pNode->GetName());
ProgBar.setLine (0, sTmp);
sTmp.clear();
for (uint32 i = 1; i < 10; ++i)
@ -410,7 +410,7 @@ void CNelExport::viewMesh (TimeValue time)
if (pShape)
{
// 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
CAnimation *anim=new CAnimation;

View file

@ -70,7 +70,7 @@ INT_PTR CALLBACK CalculatingDialogCallback (
string all;
for (uint32 i = 0; i < 14; ++i)
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;

View file

@ -14,6 +14,7 @@
// 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/>.
#include "std_afx.h"
void nlmax_nel_export_std_afx_dummy() { }

View file

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

View file

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

View file

@ -128,7 +128,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime)
if (maxLight->EvalLightState(tvTime, valid, &ls)!=REF_SUCCEED)
return;
this->Name = tStrToUtf8(node->GetName());
this->Name = MCharStrToUtf8(node->GetName());
// Retrieve the correct light Group Name
this->AnimatedLight = CExportNel::getAnimatedLight (node);
@ -295,7 +295,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime)
INode *exclNode = exclusionList[i];
if (exclNode) // Crashfix // FIXME: Why is this NULL?
{
string tmp = tStrToUtf8(exclNode->GetName());
string tmp = MCharStrToUtf8(exclNode->GetName());
this->setExclusion.insert(tmp);
}
}
@ -1930,7 +1930,7 @@ void supprLightNoInteractOne( vector<SLightBuild> &vLights, CMesh::CMeshBuild* p
{
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;
}
@ -2005,7 +2005,7 @@ void CExportNel::deleteLM(INode& ZeNode)
string sSaveName;
sSaveName = _Options.sExportLighting;
if( sSaveName[sSaveName.size()-1] != '\\' ) sSaveName += "\\";
sSaveName += tStrToUtf8(ZeNode.GetName());
sSaveName += MCharStrToUtf8(ZeNode.GetName());
char tmp[32];
sprintf( tmp, "%d", i );
sSaveName += tmp;
@ -2276,7 +2276,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
{
string thetext;
thetext = "Warning ";
thetext += tStrToUtf8(ZeNode.GetName());
thetext += MCharStrToUtf8(ZeNode.GetName());
thetext = "have all faces NOT mapped (UV2)";
if (gOptions.FeedBack != NULL)
{
@ -2325,11 +2325,11 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
{
// Make an error message
string sTmp = "Warning : ";
sTmp += tStrToUtf8(ZeNode.GetName());
sTmp += MCharStrToUtf8(ZeNode.GetName());
sTmp += " has mapping problem";
// Script trace
mprintf (utf8ToTStr((sTmp+"\n")));
mprintf(_M("%s\n"), MaxTStrFromUtf8(sTmp).data());
// Feedback is here ?
if (gOptions.FeedBack != NULL)
@ -2530,7 +2530,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
// Add lightmap information in the lightmap log
COFile outputLog;
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
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();
//string sSaveName = AllMeshBuilds[nNode].second->GetName();
string sSaveName = tStrToUtf8(ZeNode.GetName());
string sSaveName = MCharStrToUtf8(ZeNode.GetName());
char tmp[32];
sSaveName += "_";
sprintf( tmp, "%d", nLightMapNb );
@ -2633,7 +2633,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
if (gOptions.FeedBack != NULL)
{
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());
}
}

View file

@ -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
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;
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);
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;
for (k = 0; k < vMB[j]->Faces.size(); ++k)

View file

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

View file

@ -73,7 +73,7 @@ CCollisionMeshBuild* CExportNel::createCollisionMeshBuild(std::vector<INode *> &
{
// get the mesh name
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 exterior = getScriptAppData (nodes[node], NEL3D_APPDATA_COLLISION_EXTERIOR, 0) != 0;

View file

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

View file

@ -266,7 +266,7 @@ NL3D::IShape *CExportNel::buildShape (INode& node, TimeValue time, const TInodeP
std::string nodeName=getScriptAppData (&node, NEL3D_APPDATA_LOD_NAME+lod, "");
// Get the node
INode *lodNode=_Ip->GetINodeByName(utf8ToTStr(nodeName));
INode *lodNode=_Ip->GetINodeByName(MaxTStrFromUtf8(nodeName).data());
if (lodNode)
{
// Index of the lod in the build structure
@ -611,7 +611,7 @@ void CExportNel::buildBaseMeshInterface (NL3D::CMeshBase::CMeshBaseBuild& buildM
continue;
// get factor here !
buildMesh.DefaultBSFactors.push_back(0.0f);
std::string sTemp = tStrToUtf8(pNode->GetName());
std::string sTemp = MCharStrToUtf8(pNode->GetName());
buildMesh.BSNames.push_back (sTemp);
}
@ -1045,7 +1045,7 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes
if (!vpColorVertex)
{
uint8 alphaBackup = pCorner->Color.A;
pCorner->Color.modulateFromColor (pCorner->Color, isLighted ? diffuse : color);
pCorner->Color.modulateFromColor(pCorner->Color, isLighted ? diffuse : color);
pCorner->Color.A = alphaBackup;
}
}
@ -1058,18 +1058,18 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes
if (skined)
{
// Add skinning information to the buildMesh struct
uint error=buildSkinning (buildMesh, *nodeMap, node);
uint error = buildSkinning (buildMesh, *nodeMap, node);
// Error code ?
if (error!=NoError)
{
std::string msg = toString("%s skin: %s", getName (node).c_str(), ErrorMessage[error]);
MessageBoxW (NULL, utf8ToTStr(msg), L"NeL export", MB_OK|MB_ICONEXCLAMATION);
std::string msg = toString("%s skin: %s", getName(node).c_str(), ErrorMessage[error]);
MessageBox(NULL, MaxTStrFromUtf8(msg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION);
}
else
{
// Active skinning
buildMesh.VertexFlags|=CVertexBuffer::PaletteSkinFlag;
buildMesh.VertexFlags |= CVertexBuffer::PaletteSkinFlag;
}
}
@ -1082,7 +1082,7 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes
buildMesh.InterfaceLinks.clear();
// don't do it for morph target (unusefull and slow)
if(!isMorphTarget)
if (!isMorphTarget)
{
// Apply normal correction if there is a mesh interface
if (skined)
@ -1118,41 +1118,41 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes
else // standard case
{
// What Vertexprogram is used??
int vpId= CExportNel::getScriptAppData (&node, NEL3D_APPDATA_VERTEXPROGRAM_ID, 0);
int vpId = CExportNel::getScriptAppData (&node, NEL3D_APPDATA_VERTEXPROGRAM_ID, 0);
// Setup vertexProgram
switch(vpId)
{
case 0:
buildMesh.MeshVertexProgram= NULL;
buildMesh.MeshVertexProgram = NULL;
break;
case 1:
{
// smartPtr set it.
buildMesh.MeshVertexProgram= new CMeshVPWindTree;
CMeshVPWindTree &vpwt= *(CMeshVPWindTree*)(IMeshVertexProgram*)buildMesh.MeshVertexProgram;
buildMesh.MeshVertexProgram = new CMeshVPWindTree;
CMeshVPWindTree &vpwt = *(CMeshVPWindTree*)(IMeshVertexProgram*)buildMesh.MeshVertexProgram;
// Read the AppData
CVPWindTreeAppData apd;
getScriptAppDataVPWT (&node, apd);
CVPWindTreeAppData apd;
getScriptAppDataVPWT(&node, apd);
// transform it to the vpwt.
nlassert(CVPWindTreeAppData::HrcDepth == CMeshVPWindTree::HrcDepth);
vpwt.SpecularLighting= apd.SpecularLighting == BST_CHECKED;
// read all levels.
float nticks= CVPWindTreeAppData::NumTicks;
for(uint i=0; i<CVPWindTreeAppData::HrcDepth;i++)
float nticks = CVPWindTreeAppData::NumTicks;
for (uint i = 0; i < CVPWindTreeAppData::HrcDepth; i++)
{
float scale;
float scale;
// read frequency
scale= apd.FreqScale;
vpwt.Frequency[i]= float(apd.Frequency[i])/nticks * scale;
vpwt.FrequencyWindFactor[i]= float(apd.FrequencyWindFactor[i])/nticks * scale;
scale = apd.FreqScale;
vpwt.Frequency[i] = float(apd.Frequency[i])/nticks * scale;
vpwt.FrequencyWindFactor[i] = float(apd.FrequencyWindFactor[i])/nticks * scale;
// read Distance
scale= apd.DistScale;
vpwt.PowerXY[i]= float(apd.DistXY[i])/nticks * scale;
vpwt.PowerZ[i]= float(apd.DistZ[i])/nticks * scale;
vpwt.PowerXY[i] = float(apd.DistXY[i])/nticks * scale;
vpwt.PowerZ[i] = float(apd.DistZ[i])/nticks * scale;
// read Bias. expand to -2,2
vpwt.Bias[i]= float(apd.Bias[i])/nticks*4 -2;
vpwt.Bias[i] = float(apd.Bias[i])/nticks*4 -2;
}
break;
@ -1492,7 +1492,7 @@ void CExportNel::buildMeshMorph (CMesh::CMeshBuild& buildMesh, INode &node, Time
continue;
}
bs.Name = tStrToUtf8(pNode->GetName());
bs.Name = MCharStrToUtf8(pNode->GetName());
bool bIsDeltaPos = false;
bs.deltaPos.resize (nNbVertVB, CVector::Null);

View file

@ -316,7 +316,7 @@ static void AddNodeToQuadGrid(const NLMISC::CAABBox &delimiter, TNodeFaceQG &des
{
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
ObjectState os = node.EvalWorldState(time);
Object *obj = os.obj;
@ -578,10 +578,10 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
for (i=0; i<size; i++)
{
// Rename the material
string newName = "NelAutoMergeRenamedTmp" + toString (i);
string originalName = (*lib)[i]->GetName ().ToUTF8();
string newName = "NelAutoMergeRenamedTmp" + toString(i);
string originalName = MaxTStrToUtf8((*lib)[i]->GetName());
renameMap.insert (map<string, string>::value_type (newName, originalName));
(*lib)[i]->SetName (utf8ToTStr(newName));
(*lib)[i]->SetName (MaxTStrFromUtf8(newName));
}
// Merge the interface project
@ -604,7 +604,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
for (i=0; i<size; i++)
{
// 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);
// Not found ? This is a merged material
@ -612,9 +612,9 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
{
// Rename the material
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));
(*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++)
{
// Find the name
string key = (*lib)[i]->GetName ().ToUTF8();
string key = MaxTStrToUtf8((*lib)[i]->GetName());
map<string, string>::iterator ite = renameMap.find (key);
if (ite != renameMap.end ())
{
// Rename the material with its original name
(*lib)[i]->SetName (utf8ToTStr(ite->second));
(*lib)[i]->SetName (MaxTStrFromUtf8(ite->second));
}
}

View file

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

View file

@ -51,7 +51,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time)
iF.serial(ss);
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;
}
@ -78,7 +78,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time)
}
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;
}
}

View file

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

View file

@ -93,7 +93,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
resultInstanceNode[nNumIG] = pNode;
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
@ -236,7 +236,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
pMB->Vertices[pMB->Faces[j].Corner[2].Vertex]) )
{
// 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.FatherAudible = bFatherAudible;
clusterTemp.AudibleFromFather = bAudibleFromFather;
clusterTemp.Name = tStrToUtf8(pNode->GetName());
clusterTemp.Name = MCharStrToUtf8(pNode->GetName());
vClusters.push_back (clusterTemp);
delete pMB; pMB = NULL;
@ -333,7 +333,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
if (!portalTemp.setPoly (polyv))
{
// 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 ?
@ -342,7 +342,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
if (!InstanceName.empty())
portalTemp.setName (InstanceName);
else
portalTemp.setName (tStrToUtf8(pNode->GetName()));
portalTemp.setName (MCharStrToUtf8(pNode->GetName()));
}
// Check if portal has 2 cluster
@ -362,7 +362,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
if (nNbCluster != 2)
{
// 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 (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
@ -700,7 +700,7 @@ void CExportNel::buildScene (NL3D::CScene &scene, NL3D::CShapeBank &shapeBank, I
if ( (!pNode->IsHidden () || buildHidden) && (pNode->Selected () || !onlySelected) )
{
string sTmp = "Object Name: ";
sTmp += tStrToUtf8(pNode->GetName());
sTmp += MCharStrToUtf8(pNode->GetName());
if (progress)
progress->setLine (0, sTmp);
sTmp.clear();

View file

@ -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);
vl.parser = new Parser;
vl.source = new StringStream (utf8ToTStr(script));
vl.source = new StringStream(MaxTStrFromUtf8(script));
vl.source->log_to(NULL);
#if MAX_VERSION_MAJOR < 19

View file

@ -114,7 +114,7 @@ INode *CExportNel::getNELScaleReferenceNode(INode &node)
{
std::string boneScaleName= getName(node) + boneScaleNameExt;
// 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());
// Names
buildMesh.BonesNames[ite->second] = tStrToUtf8(ite->first->GetName());
buildMesh.BonesNames[ite->second] = MCharStrToUtf8(ite->first->GetName());
// Next
ite++;
@ -1306,7 +1306,7 @@ static sint getBoneSide(INode *bone, std::string &mirrorName)
{
sint side= 0;
sint pos;
mirrorName = tStrToUtf8(bone->GetName());
mirrorName = MCharStrToUtf8(bone->GetName());
if((pos= mirrorName.find(" R "))!=std::string::npos)
{
@ -1335,7 +1335,7 @@ static INode *getMirrorBone(const std::vector<INode*> &skeletonNodes, INode *bon
// find
for(uint i=0;i<skeletonNodes.size();i++)
{
if(mirrorName == tStrToUtf8(skeletonNodes[i]->GetName()))
if(mirrorName == MCharStrToUtf8(skeletonNodes[i]->GetName()))
return skeletonNodes[i];
}
}

View file

@ -33,14 +33,14 @@
#undef max
#endif
#include "../nel_3dsmax_shared/string_common.h"
#define PO2RPO_CLASS_ID Class_ID(0x43bb65e6, 0x68935530)
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
class PO2RPO : public Modifier {
public:
// Parameter block
@ -50,7 +50,7 @@ class PO2RPO : public Modifier {
HWND hRollup;
// From Animatable
const MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); }
GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); }
//From Modifier
//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);}
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; }
TSTR SubAnimName(int i) { return GetString(IDS_PARAMS); }

View file

@ -44,8 +44,8 @@ static ParamBlockDesc2 po2rpo_param_blk ( po2rpo_params, _T("params"), 0, &PO2R
p_default, 0.1f,
p_range, 0.0f,1000.0f,
p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_EDIT, IDC_SPIN, 0.01f,
p_end,
p_end
nl_p_end,
nl_p_end
);
IObjParam *PO2RPO::ip = NULL;
@ -142,7 +142,7 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
if (versionInfoSize)
{
// Alloc the buffer (size in bytes)
uint8_t *buffer = new uint8_t[versionInfoSize];
uint8 *buffer = new uint8[versionInfoSize];
// Find the verion resource
if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer))
@ -174,7 +174,7 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfo failed"));
// Free the buffer
delete [] buffer;
delete[] buffer;
}
else
SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfoSize failed"));
@ -221,7 +221,7 @@ void PO2RPO::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next)
// -----------------------------------------------------------------------------------------------------------------------------------------------------------
//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
return REF_SUCCEED;

View file

@ -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))
{
// Export path
const std::string sPath = tStrToUtf8(arg_list[1]->to_string());
const std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
COFile file;
if (file.open (sPath))
@ -246,7 +246,7 @@ Value* import_zone_cf (Value** arg_list, int count)
Interface *ip = MAXScript_interface;
// Get the filename
string filename = tStrToUtf8(arg_list[0]->to_string());
string filename = MCharStrToUtf8(arg_list[0]->to_string());
// Get the flip
bool dialog = arg_list[1]->to_bool ()!=FALSE;
@ -289,14 +289,14 @@ Value* import_zone_cf (Value** arg_list, int count)
{
// Error message
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
{
// Error message
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;
@ -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]"));
// ok ?
const std::string pathname = tStrToUtf8(arg_list[0]->to_string());
const std::string pathname = MCharStrToUtf8(arg_list[0]->to_string());
// Get tile number
SetBankPathName (pathname);

View file

@ -574,7 +574,7 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac
static bool additiveTile;
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;
@ -751,7 +751,7 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac
void BeginEditParams( IObjParam *ip, ULONG flags, Animatable *prev );
void EndEditParams( IObjParam *ip, ULONG flags, Animatable *next );
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 );
int NeedUseSubselButton() { return 0; }
void SelectSubPatch(int index);

View file

@ -338,7 +338,7 @@ static INT_PTR CALLBACK PickSetDlgProc(
Tab<TSTR*> &names = *((Tab < TSTR*>*)lParam);
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);
}
break;

View file

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

View file

@ -104,11 +104,14 @@ std::string GetBankPathName ()
if (RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY_TILEDIT, 0, KEY_READ, &hKey)==ERROR_SUCCESS)
{
TCHAR path[256];
DWORD len=256 * sizeof(TCHAR);
DWORD len = 256 * sizeof(TCHAR);
DWORD type;
if (RegQueryValueEx(hKey, _T("Bank Path"), 0, &type, (LPBYTE)path, &len)==ERROR_SUCCESS)
return tStrToUtf8(path);
RegCloseKey (hKey);
{
RegCloseKey(hKey);
return MCharStrToUtf8(path);
}
RegCloseKey(hKey);
}
return "";
}
@ -119,11 +122,14 @@ int GetBankTileSetSet ()
if (RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY_TILEDIT, 0, KEY_READ, &hKey)==ERROR_SUCCESS)
{
int tileSetSet;
DWORD len=256;
DWORD len = 256;
DWORD type;
if (RegQueryValueEx(hKey, _T("Tileset Set"), 0, &type, (LPBYTE)&tileSetSet, &len)==ERROR_SUCCESS)
{
RegCloseKey(hKey);
return tileSetSet;
RegCloseKey (hKey);
}
RegCloseKey(hKey);
}
return -1;
}
@ -134,8 +140,7 @@ void SetBankPathName (const std::string& path)
if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_TILEDIT, &hKey)==ERROR_SUCCESS)
{
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));
RegCloseKey (hKey);
}

View file

@ -30,6 +30,7 @@
#include "nel/misc/file.h"
#include "nel/misc/rgba.h"
#include "path_mesh_alloc.h"
#include "../nel_3dsmax_shared/string_common.h"
//#define USE_CACHE
@ -451,7 +452,7 @@ public:
}
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;

View file

@ -304,7 +304,7 @@ void RPO::GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel )
// ------------------------------------------------------------------------------------------------------------------------------------------------
//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
//return PatchObject::NotifyRefChanged( changeInt, hTarget, partID, message, propagate);

View file

@ -83,7 +83,7 @@ class RPO : public PatchObject
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);
//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 GetLocalBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box );
@ -206,10 +206,10 @@ class RPO : public PatchObject
? true : PatchObject::IsSubClassOf(classID);
}
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 );
RefResult NotifyRefChanged (const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate);
RefResult NotifyRefChanged (NOTIFY_REF_PARAMS);
int NumSubs()
{

View file

@ -193,7 +193,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
}
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
mprintf (utf8ToTStr(error));
nlwarning (error.c_str());
mprintf(_M("%s\n"), MaxTStrFromUtf8(error).data());
nlwarning("%s", error.c_str());
// Error
return false;
@ -395,8 +395,8 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
icv=getCommonVertex(pPM,idstpatch,isrcpatch,&orderdstvtx);
if (icv==-1)
{
mprintf (_T("Invalid bind"));
nlwarning ("Invalid bind");
mprintf(_M("Invalid bind\n"));
nlwarning("Invalid bind");
return false;
}
if (idstedge==orderdstvtx)
@ -419,7 +419,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
icv=getCommonVertex(pPM,idstpatch,isrcpatch);
if (icv==-1)
{
mprintf (_T("Invalid bind"));
mprintf(_M("Invalid bind\n"));
nlwarning ("Invalid bind");
return false;
}
@ -436,7 +436,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
icv=getCommonVertex(pPM,idstpatch,isrcpatch);
if (icv==-1)
{
mprintf (_T("Invalid bind"));
mprintf(_M("Invalid bind\n"));
nlwarning ("Invalid bind");
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);
if (isrcedge==-1)
{
mprintf (_T("Invalid edge"));
nlwarning ("Invalid bind");
mprintf(_M("Invalid edge\n"));
nlwarning("Invalid edge");
return false;
}
// 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 ();
if (!CPatchInfo::transform (patchinfo, zoneSymmetry, bank, symmetry, rotate, snapCell, weldThreshold, sym))
{
mprintf (_T("Can't transform the zone"));
nlwarning ("Invalid bind");
mprintf(_M("Can't transform the zone\n"));
nlwarning("Can't transform the zone");
return false;
}
}
@ -609,7 +609,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo
uint i;
for (i=0; i<error.Errors.size (); i++)
{
mprintf (utf8ToTStr(error.Errors[i]));
mprintf(_M("%s\n"), MaxTStrFromUtf8(error.Errors[i]));
}
return false;
}

View file

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

View file

@ -422,7 +422,7 @@ class PaintPatchMod : public Modifier
static bool automaticLighting;
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 preloadTiles;
@ -481,7 +481,7 @@ class PaintPatchMod : public Modifier
void BeginEditParams( IObjParam *ip, ULONG flags, Animatable *prev );
void EndEditParams( IObjParam *ip, ULONG flags, Animatable *next );
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);

View file

@ -2839,7 +2839,7 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
if (GetOpenFileName(&openFile))
{
// Load the file
paintColor.loadBrush (tStrToUtf8(buffer));
paintColor.loadBrush (MCharStrToUtf8(buffer));
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);
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;
}
#if (MAX_RELEASE < 4000)
@ -3883,8 +3883,8 @@ void EPM_PaintCMode::DoPaint ()
}
if (patchVoisin.patch!=-1)
{
std::string first = tStrToUtf8(vectMesh[i].Node->GetName());
std::string second = tStrToUtf8(vectMesh[patchVoisin.Mesh].Node->GetName());
std::string first = MCharStrToUtf8(vectMesh[i].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 nU = 1 << rpatch->getUIPatch (p).NbTilesU;
int nV = 1 << rpatch->getUIPatch (p).NbTilesV;
@ -3991,7 +3991,7 @@ void EPM_PaintCMode::DoPaint ()
}
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)
{
// Path
std::string modulePath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath));
std::string modulePath = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath));
try
{
@ -4259,8 +4259,8 @@ DWORD WINAPI myThread (LPVOID vData)
}
else
{
std::string message = toString("Can't build the zone named %s", tStrToUtf8(pData->VectMesh[i].Node->GetName()).c_str());
MessageBox (pData->eproc->ip->GetMAXHWnd(), utf8ToTStr(message), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION);
std::string message = toString("Can't build the zone named %s", MCharStrToUtf8(pData->VectMesh[i].Node->GetName()).c_str());
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)
{
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;
}
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;

View file

@ -319,7 +319,7 @@ void getColors (COLORREF *array)
DWORD len=4;
DWORD type;
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);
}
@ -337,7 +337,7 @@ void setColors (const COLORREF *array)
{
DWORD len=4;
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);
}
@ -412,7 +412,7 @@ void LoadKeyCfg ()
if (res)
{
// 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;
@ -455,7 +455,7 @@ void LoadVarCfg ()
{
// Make a new path
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;

View file

@ -402,7 +402,7 @@ bool CPaintColor::loadBrush (const std::string &brushFileName)
{
// Error message
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;
@ -411,7 +411,7 @@ bool CPaintColor::loadBrush (const std::string &brushFileName)
catch (const Exception &e)
{
// 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;

View file

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

View file

@ -483,7 +483,7 @@ void VertexPaint::EndEditParams(IObjParam *ip, ULONG flags, Animatable *next)
//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;
}

View file

@ -29,6 +29,7 @@
#define NL_MAP_ASSERT
#include <nel/misc/debug.h>
#include "../nel_3dsmax_shared/string_common.h"
#define VERTEX_TREE_PAINT_CLASS_ID Class_ID(0x40c7005e, 0x2a95082c)
#define CID_PAINT (CID_USER+0x439c)
@ -131,7 +132,7 @@ public:
void GetClassName(TSTR& s) { s= TSTR(GetString(IDS_CLASS_NAME)); }
virtual Class_ID ClassID() { return VERTEX_TREE_PAINT_CLASS_ID;}
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 Save(ISave *isave);
IOResult LoadLocalData(ILoad *iload, LocalModData **pld);
@ -161,7 +162,7 @@ public:
Animatable* SubAnim(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;}
void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);

View file

@ -85,7 +85,7 @@ class RGBAdd: public Texmap {
int RemapRefOnLoad(int iref);
RefTargetHandle Clone(RemapDir &remap = DefaultRemapDir());
RefResult NotifyRefChanged(const Interval &changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate);
RefResult NotifyRefChanged(NOTIFY_REF_PARAMS);
// IO
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,
//rollout
IDD_RGBMULT, "RGB Additif Parameters", 0, 0, NULL,
IDD_RGBMULT, _T("RGB Additif Parameters"), 0, 0, NULL,
// params
RGBAdd_color1, _T("color1"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR1,
p_default, Color(0,0,0),
p_ui, TYPE_COLORSWATCH, IDC_MULT_COL1,
p_end,
nl_p_end,
RGBAdd_color2, _T("color2"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR2,
p_default, Color(0.5,0.5,0.5),
p_ui, TYPE_COLORSWATCH, IDC_MULT_COL2,
p_end,
nl_p_end,
RGBAdd_map1, _T("map1"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP1,
p_refno, 1,
p_subtexno, 0,
p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX1,
p_end,
nl_p_end,
RGBAdd_map2, _T("map2"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP2,
p_refno, 2,
p_subtexno, 1,
p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX2,
p_end,
nl_p_end,
RGBAdd_map1_on, _T("map1Enabled"), TYPE_BOOL, 0, IDS_JW_MAP1ENABLE,
p_default, TRUE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON1,
p_end,
nl_p_end,
RGBAdd_map2_on, _T("map2Enabled"), TYPE_BOOL, 0, IDS_JW_MAP2ENABLE,
p_default, TRUE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON2,
p_end,
nl_p_end,
RGBAdd_type, _T("alphaFrom"), TYPE_INT, 0, IDS_PW_ALPHAFROM,
p_default, 2,
p_range, 0, 2,
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)
{

View file

@ -21,6 +21,8 @@
#include "nel/misc/file.h"
#include "../nel_patch_lib/rpo.h"
#include "../nel_3dsmax_shared/string_common.h"
#define TILE_UTILITY_CLASS_ID Class_ID(0x2301c0, 0x4c156b46)
extern ClassDesc* GetRGBAddDesc();
@ -192,7 +194,7 @@ static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam,
ofn.lpTemplateName=0;
if (GetOpenFileName(&ofn))
{
theTile_utility.Load (tStrToUtf8(sPath));
theTile_utility.Load (MCharStrToUtf8(sPath));
theTile_utility.SetLand (theTile_utility.Land);
theTile_utility.SetupUI ();
}
@ -287,7 +289,7 @@ void Tile_utility::Load (const std::string& path)
if (!file.open (path))
{
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
{
@ -299,7 +301,7 @@ void Tile_utility::Load (const std::string& path)
catch (const EStream &stream)
{
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();
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];
}
SetWindowText (hwnd, utf8ToTStr(name));
SetWindowText (hwnd, MaxTStrFromUtf8(name).data());
// Static text
TCHAR sTmp[256];
@ -451,7 +453,7 @@ bool Tile_utility::SetupMaterial () const
tex->SetAlphaSource (ALPHA_NONE);
tex->SetAlphaAsMono (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
rgb->SetSubTexmap (0, tex);
@ -471,7 +473,7 @@ bool Tile_utility::SetupMaterial () const
tex->SetAlphaSource (ALPHA_NONE);
tex->SetAlphaAsMono (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
rgb->SetSubTexmap (1, tex);

View file

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