Merge: Add 3ds Max 2020 plugin build support. Fix Max 2010 plugin build. Improve Unicode build support. Enable music in Snowballs. Support MariaDB C connector

This commit is contained in:
Jan Boon 2019-05-01 16:22:42 +08:00 committed by GitHub
commit d6b26fcb92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
240 changed files with 2426 additions and 1724 deletions

24
code/.clang-format Normal file
View file

@ -0,0 +1,24 @@
---
BasedOnStyle: WebKit
AllowShortFunctionsOnASingleLine: All
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
BreakBeforeBraces: Custom
BreakConstructorInitializersBeforeComma: 'false'
NamespaceIndentation: None
PointerAlignment: Right
SortIncludes: 'false'
TabWidth: '4'
UseTab: ForIndentation
...

23
code/.editorconfig Normal file
View file

@ -0,0 +1,23 @@
; Top-most EditorConfig file
root = true
; 4-column tab indentation
[*.cpp]
indent_style = tab
indent_size = 4
[*.c]
indent_style = tab
indent_size = 4
[*.h]
indent_style = tab
indent_size = 4
[*.py]
indent_style = tab
indent_size = 4
[*.config]
indent_style = space
indent_size = 2

View file

@ -11,18 +11,56 @@ if(MAXSDK_INCLUDE_DIR)
SET(MAXSDK_FIND_QUIETLY TRUE) SET(MAXSDK_FIND_QUIETLY TRUE)
endif() endif()
set(_pf_x86 "PROGRAMFILES(x86)")
FIND_PATH(MAXSDK_DIR FIND_PATH(MAXSDK_DIR
"include/maxversion.h" "include/maxversion.h"
HINTS HINTS
"$ENV{MAXSDK_DIR}" "$ENV{MAXSDK_DIR}"
PATHS PATHS
"$ENV{ADSK_3DSMAX_SDK_2021}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2020}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2019}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2018}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2017}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2016}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2015}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2014}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2013}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk" "$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk" "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2021 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2020 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2019 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2018 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2017 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2016 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2015 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2014 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2013 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2012 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2011 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2010 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2009 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2008 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 9 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3dsMax8/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2021 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2020 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2019 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2018 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2016 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2015 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2014 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2013 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2012 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2011 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3dsMax8/maxsdk"
) )
FIND_PATH(MAXSDK_INCLUDE_DIR FIND_PATH(MAXSDK_INCLUDE_DIR

View file

@ -16,10 +16,12 @@ IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ELSE() ELSE()
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
PATH_SUFFIXES mysql PATH_SUFFIXES mysql mariadb
PATHS PATHS
/usr/include/mysql /usr/include/mysql
/usr/include/mariadb
/usr/local/include/mysql /usr/local/include/mysql
/usr/local/include/mariadb
/opt/local/include/mysql5/mysql /opt/local/include/mysql5/mysql
/opt/local/include/mysql55/mysql /opt/local/include/mysql55/mysql
/opt/local/include/mysql51/mysql /opt/local/include/mysql51/mysql
@ -27,28 +29,29 @@ ELSE()
$ENV{SystemDrive}/MySQL/*/include) $ENV{SystemDrive}/MySQL/*/include)
IF(WIN32 AND MSVC) IF(WIN32 AND MSVC)
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient libmariadb mariadbclient
PATHS PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt $ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt) $ENV{SystemDrive}/MySQL/*/lib/opt)
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd libmariadb mariadbclient
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd
PATHS PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt $ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt) $ENV{SystemDrive}/MySQL/*/lib/opt)
ELSE() ELSE()
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient mariadbclient
PATHS PATHS
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib
/usr/lib/mariadb
/usr/lib/mysql /usr/lib/mysql
/usr/local/lib/mysql /usr/local/lib/mysql
/usr/local/lib/mariadb
/opt/local/lib/mysql5/mysql /opt/local/lib/mysql5/mysql
/opt/local/lib/mysql55/mysql /opt/local/lib/mysql55/mysql
/opt/local/lib/mysql51/mysql /opt/local/lib/mysql51/mysql
) )
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd mariadbclientd
PATHS PATHS
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib
@ -80,6 +83,10 @@ ELSE()
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE) SET(MYSQL_FOUND TRUE)
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}") MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
IF (MYSQL_LIBRARIES MATCHES "libmariadb" OR MYSQL_LIBRARIES MATCHES "mariadbclient")
SET(MARIADB_FOUND TRUE)
MESSAGE(STATUS "Found MariaDB.")
ENDIF()
ELSE() ELSE()
SET(MYSQL_FOUND FALSE) SET(MYSQL_FOUND FALSE)
MESSAGE(STATUS "MySQL not found.") MESSAGE(STATUS "MySQL not found.")

View file

@ -568,6 +568,11 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("-DENABLE_LOGS") ADD_PLATFORM_FLAGS("-DENABLE_LOGS")
ENDIF() ENDIF()
SET(CUSTOM_FLAGS "" CACHE STRING "Custom compile flags (useful for /MPn)")
IF(NOT ${CUSTOM_FLAGS} STREQUAL "")
ADD_PLATFORM_FLAGS(${CUSTOM_FLAGS})
ENDIF()
IF(MSVC) IF(MSVC)
# Ignore default include paths # Ignore default include paths
ADD_PLATFORM_FLAGS("/X") ADD_PLATFORM_FLAGS("/X")

View file

@ -314,25 +314,20 @@ inline sint nlstricmp(const std::string &lhs, const std::string &rhs) { return s
inline sint nlstricmp(const std::string &lhs, const char *rhs) { return stricmp(lhs.c_str(),rhs); } inline sint nlstricmp(const std::string &lhs, const char *rhs) { return stricmp(lhs.c_str(),rhs); }
inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp(lhs,rhs.c_str()); } inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp(lhs,rhs.c_str()); }
// macros helper to convert UTF-8 std::string and wchar_t* #if (NL_COMP_VC_VERSION <= 90)
#define wideToUtf8(str) (ucstring((ucchar*)str).toUtf8()) inline float nlroundf(float x)
#define utf8ToWide(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str()) {
return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
// macros helper to convert UTF-8 std::string and TCHAR* }
#ifdef _UNICODE #define roundf(x) NLMISC::nlroundf(x)
#define tStrToUtf8(str) (ucstring((ucchar*)(LPCWSTR)str).toUtf8())
#define utf8ToTStr(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str())
#else
#define tStrToUtf8(str) (std::string((LPCSTR)str))
#define utf8ToTStr(str) (str.c_str())
#endif #endif
// wrapper for fopen to be able to open files with an UTF-8 filename // Wrapper for fopen to be able to open files with an UTF-8 filename
FILE* nlfopen(const std::string &filename, const std::string &mode); FILE *nlfopen(const std::string &filename, const std::string &mode);
/** Signed 64 bit fseek. Same interface as fseek /** Signed 64 bit fseek. Same interface as fseek
*/ */
int nlfseek64( FILE *stream, sint64 offset, int origin ); int nlfseek64(FILE *stream, sint64 offset, int origin);
// Retrieve position in a file, same interface as ftell // Retrieve position in a file, same interface as ftell
sint64 nlftell64(FILE *stream); sint64 nlftell64(FILE *stream);

View file

@ -242,54 +242,11 @@ inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(
inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; } inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; } inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }
inline bool fromString(const std::string &str, bool &val) // Fast string to bool, reliably defined for strings starting with 0, 1, t, T, f, F, y, Y, n, N, anything else is undefined.
{ // (str[0] == '1' || (str[0] & 0xD2) == 0x50)
if (str.length() == 1) // - Kaetemi
{
const char c = str[0];
switch(c) bool fromString(const std::string &str, bool &val);
{
case '1':
case 't':
case 'T':
case 'y':
case 'Y':
val = true;
break;
case '0':
case 'f':
case 'F':
case 'n':
case 'N':
val = false;
break;
default:
val = false;
return false;
}
}
else
{
if (str == "true" || str == "yes")
{
val = true;
}
else if (str == "false" || str == "no")
{
val = false;
}
else
{
val = false;
return false;
}
}
return true;
}
inline bool fromString(const std::string &str, std::string &val) { val = str; return true; } inline bool fromString(const std::string &str, std::string &val) { val = str; return true; }
@ -300,6 +257,105 @@ inline bool fromString(const std::string &str, uint &val) { return sscanf(str.c_
inline bool fromString(const std::string &str, sint &val) { return sscanf(str.c_str(), "%d", &val) == 1; } inline bool fromString(const std::string &str, sint &val) { return sscanf(str.c_str(), "%d", &val) == 1; }
#endif // NL_COMP_VC6 #endif // NL_COMP_VC6
// Convert local codepage to UTF-8
// On Windows, the local codepage is undetermined
// On Linux, the local codepage is always UTF-8 (no-op)
std::string mbcsToUtf8(const char *str, size_t len = 0);
std::string mbcsToUtf8(const std::string &str);
// Convert wide codepage to UTF-8
// On Windows, the wide codepage is UTF-16
// On Linux, the wide codepage is UTF-32
std::string wideToUtf8(const wchar_t *str, size_t len = 0);
std::string wideToUtf8(const std::wstring &str);
// Convert UTF-8 to wide character set
std::wstring utf8ToWide(const char *str, size_t len = 0);
std::wstring utf8ToWide(const std::string &str);
// Convert UTF-8 to local multibyte character set
std::string utf8ToMbcs(const char *str, size_t len = 0);
std::string utf8ToMbcs(const std::string &str);
// Convert wide to local multibyte character set
std::string wideToMbcs(const wchar_t *str, size_t len = 0);
std::string wideToMbcs(const std::wstring &str);
// Convert local multibyte to wide character set
std::wstring mbcsToWide(const char *str, size_t len = 0);
std::wstring mbcsToWide(const std::string &str);
inline const char *asCStr(const char *str) { return str; }
inline const char *asCStr(const std::string &str) { return str.c_str(); }
inline const wchar_t *asCStr(const wchar_t *str) { return str; }
inline const wchar_t *asCStr(const std::wstring &str) { return str.c_str(); }
#if defined(NL_OS_WINDOWS)
#define nlUtf8ToMbcs(str) (NLMISC::utf8ToMbcs(str).c_str())
#define nlMbcsToUtf8(str) (NLMISC::mbcsToUtf8(str).c_str())
#else
#define nlUtf8ToMbcs(str) (NLMISC::asCStr(str))
#define nlMbcsToUtf8(str) (NLMISC::asCStr(str))
#endif
#define nlWideToUtf8(str) (NLMISC::wideToUtf8(str).c_str())
#define nlUtf8ToWide(str) (NLMISC::utf8ToWide(str).c_str())
#define nlWideToMbcs(str) (NLMISC::wideToMbcs(str).c_str())
#define nlMbcsToWide(str) (NLMISC::mbcsToWide(str).c_str())
// On Windows, tstring is either local multibyte or utf-16 wide
// On Linux, tstring is always utf-8
#if defined(NL_OS_WINDOWS) && (defined(UNICODE) || defined(_UNICODE))
typedef std::wstring tstring;
typedef wchar_t tchar;
inline std::string tStrToUtf8(const tchar *str) { return wideToUtf8((const wchar_t *)str); }
inline std::string tStrToUtf8(const tstring &str) { return wideToUtf8((const std::wstring &)str); }
inline std::wstring tStrToWide(const tchar *str) { return (const wchar_t *)str; }
inline std::wstring tStrToWide(const tstring &str) { return (const std::wstring &)str; }
inline std::string tStrToMbcs(const tchar *str) { return wideToMbcs((const wchar_t *)str); }
inline std::string tStrToMbcs(const tstring &str) { return wideToMbcs((const std::wstring &)str); }
#define nlTStrToUtf8(str) (NLMISC::tStrToUtf8(str).c_str())
#define nlTStrToWide(str) ((const wchar_t *)NLMISC::asCStr(str))
#define nlTStrToMbcs(str) (NLMISC::tStrToMbcs(str).c_str())
inline tstring utf8ToTStr(const char *str) {return (const tstring &)utf8ToWide(str); }
inline tstring utf8ToTStr(const std::string &str) { return (const tstring &)utf8ToWide(str); }
inline tstring wideToTStr(const wchar_t *str) { return (const tchar *)str; }
inline tstring wideToTStr(const std::wstring &str) { return (const tstring &)str; }
inline tstring mbcsToTStr(const char *str) { return (const tstring &)mbcsToWide(str); }
inline tstring mbcsToTStr(const std::string &str) { return (const tstring &)mbcsToWide(str); }
#define nlUtf8ToTStr(str) (NLMISC::utf8ToTStr(str).c_str())
#define nlWideToTStr(str) ((const tchar *)NLMISC::asCStr(str))
#define nlMbcsToTStr(str) (NLMISC::mbcsToTStr(str).c_str())
#else
typedef std::string tstring;
typedef char tchar;
inline std::string tStrToUtf8(const tchar *str) { return mbcsToUtf8((const char *)str); }
inline std::string tStrToUtf8(const tstring &str) { return mbcsToUtf8((const std::string &)str); }
inline std::wstring tStrToWide(const tchar *str) { return mbcsToWide((const char *)str); }
inline std::wstring tStrToWide(const tstring &str) { return mbcsToWide((const std::string &)str); }
inline std::string tStrToMbcs(const tchar *str) { return (const char *)str; }
inline std::string tStrToMbcs(const tstring &str) { return (const std::string &)str; }
#if defined(NL_OS_WINDOWS)
#define nlTStrToUtf8(str) (NLMISC::tStrToUtf8(str).c_str())
#else
#define nlTStrToUtf8(str) ((const char *)NLMISC::asCStr(str))
#endif
#define nlTStrToWide(str) (NLMISC::tStrToWide(str).c_str())
#define nlTStrToMbcs(str) ((const char *)NLMISC::asCStr(str))
inline tstring utf8ToTStr(const char *str) { return (const tstring &)utf8ToMbcs(str); }
inline tstring utf8ToTStr(const std::string &str) { return (const tstring &)utf8ToMbcs(str); }
inline tstring wideToTStr(const wchar_t *str) { return (const tstring &)wideToMbcs(str); }
inline tstring wideToTStr(const std::wstring &str) { return (const tstring &)wideToMbcs(str); }
inline tstring mbcsToTStr(const char *str) { return (const tchar *)str; }
inline tstring mbcsToTStr(const std::string &str) { return (const tstring &)str; }
#if defined(NL_OS_WINDOWS)
#define nlUtf8ToTStr(str) (NLMISC::utf8ToTStr(str).c_str())
#else
#define nlUtf8ToTStr(str) ((const tchar *)NLMISC::asCStr(str))
#endif
#define nlWideToTStr(str) (NLMISC::wideToTStr(str).c_str())
#define nlMbcsToTStr(str) ((const tchar *)NLMISC::asCStr(str))
#endif
} // NLMISC } // NLMISC

View file

@ -70,10 +70,10 @@ public:
static void setRootKey(const std::string &root); static void setRootKey(const std::string &root);
/// Read a value from registry. /// Read a value from registry.
static std::string getRegKey(const std::string &Entry); static std::string getRegKey(const std::string &entry);
/// Write a value to registry. /// Write a value to registry.
static bool setRegKey(const std::string &ValueName, const std::string &Value); static bool setRegKey(const std::string &valueName, const std::string &value);
/// Get desktop current color depth without using UDriver. /// Get desktop current color depth without using UDriver.
static uint getCurrentColorDepth(); static uint getCurrentColorDepth();

View file

@ -173,6 +173,12 @@
# define NL_NO_EXCEPTION_SPECS # define NL_NO_EXCEPTION_SPECS
#endif #endif
#if defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 140)
#define nlmove(v) std::move(v)
#else
#define nlmove(v) (v)
#endif
// gcc 3.4 introduced ISO C++ with tough template rules // gcc 3.4 introduced ISO C++ with tough template rules
// //
// NL_ISO_SYNTAX can be used using #if NL_ISO_SYNTAX or #if !NL_ISO_SYNTAX // NL_ISO_SYNTAX can be used using #if NL_ISO_SYNTAX or #if !NL_ISO_SYNTAX
@ -220,6 +226,7 @@
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) # if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
# pragma warning (disable : 4005) // don't warn on redefinitions caused by xp platform sdk # pragma warning (disable : 4005) // don't warn on redefinitions caused by xp platform sdk
# endif // NL_COMP_VC8 || NL_COMP_VC9 # endif // NL_COMP_VC8 || NL_COMP_VC9
# pragma warning (disable : 26495) // Variable is uninitialized. Always initialize a member variable. (On purpose for performance.)
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
@ -519,6 +526,15 @@ template<> struct hash<uint64>
*/ */
typedef uint16 ucchar; typedef uint16 ucchar;
#if defined(NL_OS_WINDOWS) && (defined(UNICODE) || defined(_UNICODE))
#define nltmain wmain
#define nltWinMain wWinMain
#else
#define nltmain main
#if defined(NL_OS_WINDOWS)
#define nltWinMain WinMain
#endif
#endif
// To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234) // To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234)
#ifdef NL_COMP_VC #ifdef NL_COMP_VC

View file

@ -54,7 +54,17 @@ struct HINSTANCE__;
typedef struct HINSTANCE__ *HINSTANCE; typedef struct HINSTANCE__ *HINSTANCE;
typedef char CHAR; typedef char CHAR;
typedef wchar_t WCHAR;
typedef CHAR *LPSTR; typedef CHAR *LPSTR;
typedef WCHAR *LPWSTR;
#if defined(UNICODE) || defined(_UNICODE)
typedef LPWSTR LPTSTR;
#else
typedef LPSTR LPTSTR;
#endif
#endif #endif
namespace NLNET namespace NLNET
@ -117,11 +127,11 @@ class IServiceUpdatable;
#if defined(NL_OS_WINDOWS) && defined(_WINDOWS) #if defined(NL_OS_WINDOWS) && defined(_WINDOWS)
#define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \ #define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \
\ \
int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) \ int APIENTRY nltWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) \
{ \ { \
NLMISC::CApplicationContext serviceContext; \ NLMISC::CApplicationContext serviceContext; \
__ServiceClassName *scn = new __ServiceClassName; \ __ServiceClassName *scn = new __ServiceClassName; \
scn->setArgs (lpCmdLine); \ scn->setArgs (nlTStrToUtf8(lpCmdLine)); \
createDebug(NULL,!scn->haveLongArg("nolog"));\ createDebug(NULL,!scn->haveLongArg("nolog"));\
scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \ scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \
sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \ sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \
@ -132,7 +142,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
#else #else
#define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \ #define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \
\ \
int main(int argc, const char **argv) \ int nltmain(int argc, const NLMISC::tchar **argv) \
{ \ { \
NLMISC::CApplicationContext serviceContext; \ NLMISC::CApplicationContext serviceContext; \
__ServiceClassName *scn = new __ServiceClassName; \ __ServiceClassName *scn = new __ServiceClassName; \
@ -340,6 +350,9 @@ public:
/// Sets the command line and init _Args variable. You must call this before calling main() /// Sets the command line and init _Args variable. You must call this before calling main()
void setArgs (int argc, const char **argv); void setArgs (int argc, const char **argv);
/// Sets the command line and init _Args variable. You must call this before calling main()
void setArgs (int argc, const wchar_t **argv);
/// Sets the command line and init _Args variable. You must call this before calling main() /// Sets the command line and init _Args variable. You must call this before calling main()
void setArgs (const char *args); void setArgs (const char *args);

View file

@ -18,6 +18,8 @@
#define NLSOUND_AUDIO_DECODER_MP3_H #define NLSOUND_AUDIO_DECODER_MP3_H
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#if (NL_COMP_VC_VERSION > 90) /* VS2008 does not have stdint.h */
#include <nel/sound/audio_decoder.h> #include <nel/sound/audio_decoder.h>
// disable drmp3_init_file() // disable drmp3_init_file()
@ -91,6 +93,8 @@ public:
} /* namespace NLSOUND */ } /* namespace NLSOUND */
#endif /* (NL_COMP_VC_VERSION > 90) */
#endif // NLSOUND_AUDIO_DECODER_MP3_H #endif // NLSOUND_AUDIO_DECODER_MP3_H
/* end of file */ /* end of file */

View file

@ -1810,7 +1810,7 @@ emptyProc CDriverD3D::getWindowProc()
IDriver::TMessageBoxId CDriverD3D::systemMessageBox (const char* message, const char* title, TMessageBoxType type, TMessageBoxIcon icon) IDriver::TMessageBoxId CDriverD3D::systemMessageBox (const char* message, const char* title, TMessageBoxType type, TMessageBoxIcon icon)
{ {
switch (::MessageBoxW (_HWnd, utf8ToWide(message), utf8ToWide(title), ((type==retryCancelType)?MB_RETRYCANCEL: switch (::MessageBoxW(_HWnd, nlUtf8ToWide(message), nlUtf8ToWide(title), ((type == retryCancelType) ? MB_RETRYCANCEL :
(type==yesNoCancelType)?MB_YESNOCANCEL: (type==yesNoCancelType)?MB_YESNOCANCEL:
(type==okCancelType)?MB_OKCANCEL: (type==okCancelType)?MB_OKCANCEL:
(type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE: (type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE:

View file

@ -2644,7 +2644,7 @@ IDriver::TMessageBoxId CDriverGL::systemMessageBox (const char* message, const c
{ {
H_AUTO_OGL(CDriverGL_systemMessageBox) H_AUTO_OGL(CDriverGL_systemMessageBox)
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
switch (::MessageBoxW (NULL, utf8ToWide(message), utf8ToWide(title), ((type==retryCancelType)?MB_RETRYCANCEL: switch (::MessageBoxW(NULL, nlUtf8ToWide(message), nlUtf8ToWide(title), ((type == retryCancelType) ? MB_RETRYCANCEL :
(type==yesNoCancelType)?MB_YESNOCANCEL: (type==yesNoCancelType)?MB_YESNOCANCEL:
(type==okCancelType)?MB_OKCANCEL: (type==okCancelType)?MB_OKCANCEL:
(type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE: (type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE:

View file

@ -25,6 +25,8 @@ using namespace NLMISC;
#define new DEBUG_NEW #define new DEBUG_NEW
#endif #endif
void vertex_buffer_heap_dummy_cpp() { }
// This code is not used actually and doesn't compile // This code is not used actually and doesn't compile
// just preproc comment it // just preproc comment it
#if 0 #if 0

View file

@ -115,7 +115,7 @@ namespace NLGUI
{ {
#if !FINAL_VERSION #if !FINAL_VERSION
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
ShellExecuteW(NULL, utf8ToWide(operation), utf8ToWide(fileName), utf8ToWide(parameters), NULL, SW_SHOWDEFAULT); ShellExecuteW(NULL, nlUtf8ToWide(operation), nlUtf8ToWide(fileName), nlUtf8ToWide(parameters), NULL, SW_SHOWDEFAULT);
#endif #endif
#endif #endif
} }

View file

@ -911,7 +911,7 @@ static bool createProcess(const std::string &programName, const std::string &arg
} }
// or 0 for a window // or 0 for a window
BOOL res = CreateProcessW(sProgramName, utf8ToWide(args), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL /* current dir */, &si, &pi); BOOL res = CreateProcessW(sProgramName, (LPWSTR)nlUtf8ToWide(args), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL /* current dir */, &si, &pi);
if (sProgramName) if (sProgramName)
{ {
@ -1453,7 +1453,7 @@ void displayDwordBits( uint32 b, uint nbits, sint beginpos, bool displayBegin, N
FILE* nlfopen(const std::string &filename, const std::string &mode) FILE* nlfopen(const std::string &filename, const std::string &mode)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
return _wfopen(utf8ToWide(filename), utf8ToWide(mode)); return _wfopen(nlUtf8ToWide(filename), nlUtf8ToWide(mode));
#else #else
return fopen(filename.c_str(), mode.c_str()); return fopen(filename.c_str(), mode.c_str());
#endif #endif
@ -1632,7 +1632,7 @@ static bool openDocWithExtension (const std::string &document, const std::string
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// First try ShellExecute() // First try ShellExecute()
HINSTANCE result = ShellExecuteW(NULL, L"open", utf8ToWide(document), NULL, NULL, SW_SHOWDEFAULT); HINSTANCE result = ShellExecuteW(NULL, L"open", nlUtf8ToWide(document), NULL, NULL, SW_SHOWDEFAULT);
// If it failed, get the .htm regkey and lookup the program // If it failed, get the .htm regkey and lookup the program
if ((uintptr_t)result <= HINSTANCE_ERROR) if ((uintptr_t)result <= HINSTANCE_ERROR)
@ -1640,7 +1640,7 @@ static bool openDocWithExtension (const std::string &document, const std::string
wchar_t key[MAX_PATH + MAX_PATH]; wchar_t key[MAX_PATH + MAX_PATH];
// get the type of the extension // get the type of the extension
if (GetRegKey(HKEY_CLASSES_ROOT, utf8ToWide("." + ext), key) == ERROR_SUCCESS) if (GetRegKey(HKEY_CLASSES_ROOT, nlUtf8ToWide("." + ext), key) == ERROR_SUCCESS)
{ {
lstrcatW(key, L"\\shell\\open\\command"); lstrcatW(key, L"\\shell\\open\\command");

View file

@ -1431,7 +1431,7 @@ int getLastError()
std::string formatErrorMessage(int errorCode) std::string formatErrorMessage(int errorCode)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
LPVOID lpMsgBuf = NULL; LPWSTR lpMsgBuf = NULL;
DWORD len = FormatMessageW( DWORD len = FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_SYSTEM |
@ -1439,7 +1439,7 @@ std::string formatErrorMessage(int errorCode)
NULL, NULL,
errorCode, errorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPWSTR) &lpMsgBuf, (LPWSTR)(&lpMsgBuf),
0, 0,
NULL NULL
); );

View file

@ -286,14 +286,14 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess
// WARNING: READ THIS !!!!!!!!!!!!!!!! /////////////////////////// // WARNING: READ THIS !!!!!!!!!!!!!!!! ///////////////////////////
// If at the release time, it freezes here, it's a microsoft bug: // If at the release time, it freezes here, it's a microsoft bug:
// http://support.microsoft.com/support/kb/articles/q173/2/60.asp // http://support.microsoft.com/support/kb/articles/q173/2/60.asp
OutputDebugStringW(utf8ToWide(str2)); OutputDebugStringW(nlUtf8ToWide(str2));
} }
else else
{ {
sint count = 0; sint count = 0;
uint n = (uint)strlen(message); uint n = (uint)strlen(message);
std::string s(&str2.c_str()[0], (str2.size() - n)); std::string s(&str2.c_str()[0], (str2.size() - n));
OutputDebugStringW(utf8ToWide(s)); OutputDebugStringW(nlUtf8ToWide(s));
for(;;) for(;;)
{ {
@ -301,14 +301,14 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess
if((n - count) < maxOutString ) if((n - count) < maxOutString )
{ {
s = std::string(&message[count], (n - count)); s = std::string(&message[count], (n - count));
OutputDebugStringW(utf8ToWide(s)); OutputDebugStringW(nlUtf8ToWide(s));
OutputDebugStringW(L"\n"); OutputDebugStringW(L"\n");
break; break;
} }
else else
{ {
s = std::string(&message[count] , count + maxOutString); s = std::string(&message[count] , count + maxOutString);
OutputDebugStringW(utf8ToWide(s)); OutputDebugStringW(nlUtf8ToWide(s));
OutputDebugStringW(L"\n\t\t\t"); OutputDebugStringW(L"\n\t\t\t");
count += maxOutString; count += maxOutString;
} }
@ -323,13 +323,13 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess
if (pos+1000 < args.CallstackAndLog.size ()) if (pos+1000 < args.CallstackAndLog.size ())
{ {
splited = args.CallstackAndLog.substr (pos, 1000); splited = args.CallstackAndLog.substr (pos, 1000);
OutputDebugStringW(utf8ToWide(splited)); OutputDebugStringW(nlUtf8ToWide(splited));
pos += 1000; pos += 1000;
} }
else else
{ {
splited = args.CallstackAndLog.substr (pos); splited = args.CallstackAndLog.substr (pos);
OutputDebugStringW(utf8ToWide(splited)); OutputDebugStringW(nlUtf8ToWide(splited));
break; break;
} }
} }

View file

@ -32,7 +32,7 @@ NL_LIB_HANDLE nlLoadLibrary(const std::string &libName)
{ {
NL_LIB_HANDLE res = 0; NL_LIB_HANDLE res = 0;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
res = LoadLibraryW(utf8ToWide(libName)); res = LoadLibraryW(nlUtf8ToWide(libName));
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)
res = dlopen(libName.c_str(), RTLD_NOW); res = dlopen(libName.c_str(), RTLD_NOW);
#else #else

View file

@ -700,7 +700,7 @@ bool CFileContainer::setCurrentPath (const std::string &path)
int res; int res;
//nldebug("Change current path to '%s' (current path is '%s')", path.c_str(), getCurrentPath().c_str()); //nldebug("Change current path to '%s' (current path is '%s')", path.c_str(), getCurrentPath().c_str());
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
res = _wchdir(utf8ToWide(path)); res = _wchdir(nlUtf8ToWide(path));
#else #else
res = chdir(path.c_str()); res = chdir(path.c_str());
#endif #endif
@ -792,7 +792,7 @@ dirent *readdir (DIR *dir)
// first visit in this directory : FindFirstFile() // first visit in this directory : FindFirstFile()
if (hFind == NULL) if (hFind == NULL)
{ {
hFind = FindFirstFileW (utf8ToWide(CPath::standardizePath(sDir) + "*"), &findData); hFind = FindFirstFileW(nlUtf8ToWide(CPath::standardizePath(sDir) + "*"), &findData);
} }
// directory already visited : FindNextFile() // directory already visited : FindNextFile()
else else
@ -1914,7 +1914,7 @@ string CFile::getPath (const string &filename)
bool CFile::isDirectory (const string &filename) bool CFile::isDirectory (const string &filename)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
DWORD res = GetFileAttributesW(utf8ToWide(filename)); DWORD res = GetFileAttributesW(nlUtf8ToWide(filename));
if (res == INVALID_FILE_ATTRIBUTES) if (res == INVALID_FILE_ATTRIBUTES)
{ {
// nlwarning ("PATH: '%s' is not a valid file or directory name", filename.c_str ()); // nlwarning ("PATH: '%s' is not a valid file or directory name", filename.c_str ());
@ -1937,7 +1937,7 @@ bool CFile::isDirectory (const string &filename)
bool CFile::isExists (const string &filename) bool CFile::isExists (const string &filename)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
return GetFileAttributesW(utf8ToWide(filename)) != INVALID_FILE_ATTRIBUTES; return GetFileAttributesW(nlUtf8ToWide(filename)) != INVALID_FILE_ATTRIBUTES;
#else // NL_OS_WINDOWS #else // NL_OS_WINDOWS
struct stat buf; struct stat buf;
return stat (filename.c_str (), &buf) == 0; return stat (filename.c_str (), &buf) == 0;
@ -2017,7 +2017,7 @@ uint32 CFile::getFileSize (const std::string &filename)
{ {
#if defined (NL_OS_WINDOWS) #if defined (NL_OS_WINDOWS)
struct _stat buf; struct _stat buf;
int result = _wstat (utf8ToWide(filename), &buf); int result = _wstat(nlUtf8ToWide(filename), &buf);
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
struct stat buf; struct stat buf;
int result = stat (filename.c_str (), &buf); int result = stat (filename.c_str (), &buf);
@ -2068,7 +2068,7 @@ uint32 CFile::getFileModificationDate(const std::string &filename)
// Use the WIN32 API to read the file times in UTC // Use the WIN32 API to read the file times in UTC
// create a file handle (this does not open the file) // create a file handle (this does not open the file)
HANDLE h = CreateFileW(utf8ToWide(fn), 0, 0, NULL, OPEN_EXISTING, 0, 0); HANDLE h = CreateFileW(nlUtf8ToWide(fn), 0, 0, NULL, OPEN_EXISTING, 0, 0);
if (h == INVALID_HANDLE_VALUE) if (h == INVALID_HANDLE_VALUE)
{ {
nlwarning("Can't get modification date on file '%s' : %s", fn.c_str(), NLMISC::formatErrorMessage(NLMISC::getLastError()).c_str()); nlwarning("Can't get modification date on file '%s' : %s", fn.c_str(), NLMISC::formatErrorMessage(NLMISC::getLastError()).c_str());
@ -2138,7 +2138,7 @@ bool CFile::setFileModificationDate(const std::string &filename, uint32 modTime)
// Use the WIN32 API to set the file times in UTC // Use the WIN32 API to set the file times in UTC
// create a file handle (this does not open the file) // create a file handle (this does not open the file)
HANDLE h = CreateFileW(utf8ToWide(fn), GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); HANDLE h = CreateFileW(nlUtf8ToWide(fn), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if (h == INVALID_HANDLE_VALUE) if (h == INVALID_HANDLE_VALUE)
{ {
nlwarning("Can't set modification date on file '%s' (error accessing file) : %s", fn.c_str(), NLMISC::formatErrorMessage(NLMISC::getLastError()).c_str()); nlwarning("Can't set modification date on file '%s' (error accessing file) : %s", fn.c_str(), NLMISC::formatErrorMessage(NLMISC::getLastError()).c_str());
@ -2223,7 +2223,7 @@ uint32 CFile::getFileCreationDate(const std::string &filename)
#if defined (NL_OS_WINDOWS) #if defined (NL_OS_WINDOWS)
struct _stat buf; struct _stat buf;
int result = _wstat(utf8ToWide(fn), &buf); int result = _wstat(nlUtf8ToWide(fn), &buf);
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
struct stat buf; struct stat buf;
int result = stat(fn.c_str (), &buf); int result = stat(fn.c_str (), &buf);
@ -2357,7 +2357,7 @@ static bool CopyMoveFile(const std::string &dest, const std::string &src, bool c
else else
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
if (MoveFileW(utf8ToWide(ssrc), utf8ToWide(sdest)) == 0) if (MoveFileW(nlUtf8ToWide(ssrc), nlUtf8ToWide(sdest)) == 0)
{ {
sint lastError = NLMISC::getLastError(); sint lastError = NLMISC::getLastError();
nlwarning ("PATH: CopyMoveFile error: can't link/move '%s' into '%s', error %u (%s)", nlwarning ("PATH: CopyMoveFile error: can't link/move '%s' into '%s', error %u (%s)",
@ -2482,7 +2482,7 @@ bool CFile::moveFile(const std::string &dest, const std::string &src)
bool CFile::createDirectory(const std::string &filename) bool CFile::createDirectory(const std::string &filename)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
return _wmkdir(utf8ToWide(filename))==0; return _wmkdir(nlUtf8ToWide(filename)) == 0;
#else #else
// Set full permissions.... // Set full permissions....
return mkdir(filename.c_str(), 0xFFFF)==0; return mkdir(filename.c_str(), 0xFFFF)==0;
@ -2751,7 +2751,7 @@ bool CFile::deleteFile(const std::string &filename)
{ {
setRWAccess(filename); setRWAccess(filename);
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
sint res = _wunlink(utf8ToWide(filename)); sint res = _wunlink(nlUtf8ToWide(filename));
#else #else
sint res = unlink(filename.c_str()); sint res = unlink(filename.c_str());
#endif #endif
@ -2770,7 +2770,7 @@ bool CFile::deleteDirectory(const std::string &filename)
{ {
setRWAccess(filename); setRWAccess(filename);
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
sint res = _wrmdir(utf8ToWide(filename)); sint res = _wrmdir(nlUtf8ToWide(filename));
#else #else
sint res = rmdir(filename.c_str()); sint res = rmdir(filename.c_str());
#endif #endif

View file

@ -17,23 +17,24 @@
#include "stdmisc.h" #include "stdmisc.h"
#include "nel/misc/string_common.h" #include "nel/misc/string_common.h"
#include "nel/misc/sstring.h"
using namespace std; using namespace std;
#ifdef DEBUG_NEW #ifdef DEBUG_NEW
#define new DEBUG_NEW #define new DEBUG_NEW
#endif #endif
namespace NLMISC namespace NLMISC
{ {
string addSlashR (const string &str) string addSlashR(const string &str)
{ {
string formatedStr; string formatedStr;
// replace \n with \r\n // replace \n with \r\n
for (uint i = 0; i < str.size(); i++) for (uint i = 0; i < str.size(); i++)
{ {
if (str[i] == '\n' && i > 0 && str[i-1] != '\r') if (str[i] == '\n' && i > 0 && str[i - 1] != '\r')
{ {
formatedStr += '\r'; formatedStr += '\r';
} }
@ -42,7 +43,7 @@ string addSlashR (const string &str)
return formatedStr; return formatedStr;
} }
string removeSlashR (const string &str) string removeSlashR(const string &str)
{ {
string formatedStr; string formatedStr;
// remove \r // remove \r
@ -54,4 +55,267 @@ string removeSlashR (const string &str)
return formatedStr; return formatedStr;
} }
bool fromString(const std::string &str, bool &val)
{
if (str.length() == 1)
{
const char c = str[0];
switch (c)
{
case '1':
case 't':
case 'T':
case 'y':
case 'Y':
val = true;
break;
case '0':
case 'f':
case 'F':
case 'n':
case 'N':
val = false;
break;
default:
val = false;
return false;
}
}
else
{
std::string strl = toLower(str);
if (strl == "true" || strl == "yes")
{
val = true;
}
else if (strl == "false" || strl == "no")
{
val = false;
}
else
{
val = false;
return false;
}
}
return true;
}
#if defined(NL_OS_WINDOWS)
std::string winWideToCp(const wchar_t *str, size_t len, UINT cp)
{
if (!len)
len = wcslen(str);
if (!len)
return std::string();
// Convert from wide to codepage
char *tmp = (char *)_malloca((len + 1) * 4);
if (!tmp)
return std::string();
int tmpLen = WideCharToMultiByte(cp, 0,
str, (int)(len + 1),
tmp, (int)((len + 1) * 4),
NULL, NULL);
if (tmpLen <= 1)
{
_freea(tmp);
return std::string();
}
std::string res = tmp;
_freea(tmp);
return res;
}
std::string winCpToCp(const char *str, size_t len, UINT srcCp, UINT dstCp)
{
if (!len)
len = strlen(str);
if (!len)
return std::string();
// First convert from codepage to wide
wchar_t *tmp = (wchar_t *)_malloca((len + 1) * 4);
if (!tmp)
return std::string();
int tmpLen = MultiByteToWideChar(srcCp, MB_PRECOMPOSED,
str, (int)(len + 1), /* include null-termination */
tmp, (int)((len + 1) * 4));
if (tmpLen <= 1)
{
_freea(tmp);
return std::string();
}
// Then convert from wide to codepage
std::string res = winWideToCp(tmp, (size_t)tmpLen - 1, dstCp); /* tmpLen includes null-term */
_freea(tmp);
return res;
}
std::wstring winCpToWide(const char *str, size_t len, UINT cp)
{
if (!len)
len = strlen(str);
if (!len)
return std::wstring();
// Convert from codepage to wide
wchar_t *tmp = (wchar_t *)_malloca((len + 1) * 4);
if (!tmp)
return std::wstring();
int tmpLen = MultiByteToWideChar(cp, MB_PRECOMPOSED,
str, (int)(len + 1), /* include null-termination */
tmp, (int)((len + 1) * 4));
if (tmpLen <= 1)
{
_freea(tmp);
return std::wstring();
}
std::wstring res = tmp;
_freea(tmp);
return res;
}
#endif
// Convert local codepage to UTF-8
// On Windows, the local codepage is undetermined
// On Linux, the local codepage is always UTF-8 (no-op)
std::string mbcsToUtf8(const char *str, size_t len)
{
#if defined(NL_OS_WINDOWS)
UINT codePage = GetACP();
// Windows 10 allows setting the local codepage to UTF-8
if (codePage == CP_UTF8) /* 65001 */
return str;
return winCpToCp(str, len, CP_ACP, CP_UTF8);
#else
return str; /* no-op */
#endif
}
std::string mbcsToUtf8(const std::string &str)
{
#if defined(NL_OS_WINDOWS)
if (str.empty())
return str;
UINT codePage = GetACP();
// Windows 10 allows setting the local codepage to UTF-8
if (codePage == CP_UTF8) /* 65001 */
return str;
return winCpToCp(str.c_str(), str.size(), CP_ACP, CP_UTF8);
#else
return str; /* no-op */
#endif
}
// Convert wide codepage to UTF-8
// On Windows, the wide codepage is UTF-16
// On Linux, the wide codepage is UTF-32
std::string wideToUtf8(const wchar_t *str, size_t len)
{
#if defined(NL_OS_WINDOWS)
return winWideToCp(str, len, CP_UTF8);
#else
// TODO: UTF-32 to UTF-8
nlassert(false);
#endif
}
std::string wideToUtf8(const std::wstring &str)
{
return wideToUtf8(str.c_str(), str.size());
}
// Convert UTF-8 to wide character set
std::wstring utf8ToWide(const char *str, size_t len)
{
#if defined(NL_OS_WINDOWS)
return winCpToWide(str, len, CP_UTF8);
#else
// TODO: UTF-32 to UTF-8
nlassert(false);
#endif
}
std::wstring utf8ToWide(const std::string &str)
{
return utf8ToWide(str.c_str(), str.size());
}
// Convert UTF-8 to local multibyte character set
std::string utf8ToMbcs(const char *str, size_t len)
{
#if defined(NL_OS_WINDOWS)
UINT codePage = GetACP();
// Windows 10 allows setting the local codepage to UTF-8
if (codePage == CP_UTF8) /* 65001 */
return str;
return winCpToCp(str, len, CP_UTF8, CP_ACP);
#else
return str; /* no-op */
#endif
}
std::string utf8ToMbcs(const std::string &str)
{
#if defined(NL_OS_WINDOWS)
if (str.empty())
return str;
UINT codePage = GetACP();
// Windows 10 allows setting the local codepage to UTF-8
if (codePage == CP_UTF8) /* 65001 */
return str;
return winCpToCp(str.c_str(), str.size(), CP_UTF8, CP_ACP);
#else
return str; /* no-op */
#endif
}
// Convert wide to local multibyte character set
std::string wideToMbcs(const wchar_t *str, size_t len)
{
#if defined(NL_OS_WINDOWS)
return winWideToCp(str, len, CP_ACP);
#else
return wideToUtf8(str, len);
#endif
}
std::string wideToMbcs(const std::wstring &str)
{
#if defined(NL_OS_WINDOWS)
return winWideToCp(str.c_str(), str.size(), CP_ACP);
#else
return wideToUtf8(str);
#endif
}
// Convert local multibyte to wide character set
std::wstring mbcsToWide(const char *str, size_t len)
{
#if defined(NL_OS_WINDOWS)
return winCpToWide(str, len, CP_ACP);
#else
return utf8ToWide(str, len);
#endif
}
std::wstring mbcsToWide(const std::string &str)
{
#if defined(NL_OS_WINDOWS)
return winCpToWide(str.c_str(), str.size(), CP_ACP);
#else
return utf8ToWide(str);
#endif
}
} }

View file

@ -1460,7 +1460,7 @@ uint64 CSystemInfo::availableHDSpace (const string &filename)
return (uint64)stfs.f_bavail * (uint64)stfs.f_bsize; return (uint64)stfs.f_bavail * (uint64)stfs.f_bsize;
#else #else
ULARGE_INTEGER freeSpace = {0}; ULARGE_INTEGER freeSpace = {0};
BOOL bRes = ::GetDiskFreeSpaceExW(utf8ToWide(path), &freeSpace, NULL, NULL); BOOL bRes = ::GetDiskFreeSpaceExW(nlUtf8ToWide(path), &freeSpace, NULL, NULL);
if (!bRes) return 0; if (!bRes) return 0;
return (uint64)freeSpace.QuadPart; return (uint64)freeSpace.QuadPart;

View file

@ -323,58 +323,55 @@ void CSystemUtils::setRootKey(const std::string &root)
RootKey = root; RootKey = root;
} }
string CSystemUtils::getRegKey(const string &Entry) string CSystemUtils::getRegKey(const string &entry)
{ {
string ret; string ret;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
HKEY hkey; HKEY hkey;
if (RegOpenKeyExW(HKEY_CURRENT_USER, utf8ToWide(RootKey), 0, KEY_READ, &hkey) == ERROR_SUCCESS) if (RegOpenKeyExW(HKEY_CURRENT_USER, nlUtf8ToWide(RootKey), 0, KEY_READ, &hkey) == ERROR_SUCCESS)
{ {
DWORD dwType = 0L; DWORD dwType = 0L;
DWORD dwSize = KeyMaxLength; DWORD dwSize = KeyMaxLength;
wchar_t Buffer[KeyMaxLength]; wchar_t buffer[KeyMaxLength];
if (RegQueryValueExW(hkey, utf8ToWide(Entry), NULL, &dwType, (LPBYTE)Buffer, &dwSize) != ERROR_SUCCESS) if (RegQueryValueExW(hkey, nlUtf8ToWide(entry), NULL, &dwType, (LPBYTE)buffer, &dwSize) != ERROR_SUCCESS)
{ {
nlwarning("Can't get the reg key '%s'", Entry.c_str()); nlwarning("Can't get the reg key '%s'", entry.c_str());
} }
else else
{ {
ret = wideToUtf8(Buffer); ret = wideToUtf8(buffer);
} }
RegCloseKey(hkey); RegCloseKey(hkey);
} }
else else
{ {
nlwarning("Can't get the reg key '%s'", Entry.c_str()); nlwarning("Can't get the reg key '%s'", entry.c_str());
} }
#endif #endif
return ret; return ret;
} }
bool CSystemUtils::setRegKey(const string &ValueName, const string &Value) bool CSystemUtils::setRegKey(const string &valueName, const string &value)
{ {
bool res = false; bool res = false;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
HKEY hkey; HKEY hkey;
DWORD dwDisp; DWORD dwDisp;
if (RegCreateKeyExW(HKEY_CURRENT_USER, utf8ToWide(RootKey), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS) if (RegCreateKeyExW(HKEY_CURRENT_USER, nlUtf8ToWide(RootKey), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS)
{ {
ucstring utf16Value = ucstring::makeFromUtf8(Value);
// we must use the real Unicode string size in bytes // we must use the real Unicode string size in bytes
DWORD size = (utf16Value.length() + 1) * 2; std::wstring wvalue = nlUtf8ToWide(value);
if (RegSetValueExW(hkey, nlUtf8ToWide(valueName), 0, REG_SZ, (const BYTE *)wvalue.c_str(), (wvalue.size() + 1) * sizeof(WCHAR)) == ERROR_SUCCESS)
if (RegSetValueExW(hkey, utf8ToWide(ValueName), 0L, REG_SZ, (const BYTE *)utf16Value.c_str(), size) == ERROR_SUCCESS)
res = true; res = true;
RegCloseKey(hkey); RegCloseKey(hkey);
} }
else else
{ {
nlwarning("Can't set the reg key '%s' '%s'", ValueName.c_str(), Value.c_str()); nlwarning("Can't set the reg key '%s' '%s'", valueName.c_str(), value.c_str());
} }
#endif #endif

View file

@ -298,7 +298,7 @@ void CWinDisplayer::updateLabels ()
} }
} }
SendMessageW ((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LPARAM) utf8ToWide(n)); SendMessageW((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LPARAM)nlUtf8ToWide(n));
access.value()[i].NeedUpdate = false; access.value()[i].NeedUpdate = false;
} }
} }

View file

@ -492,6 +492,13 @@ void IService::setArgs (int argc, const char **argv)
} }
} }
void IService::setArgs(int argc, const wchar_t **argv)
{
for (sint i = 0; i < argc; i++)
{
_Args.push_back(nlWideToUtf8(argv[i]));
}
}
void cbLogFilter (CConfigFile::CVar &var) void cbLogFilter (CConfigFile::CVar &var)
{ {

View file

@ -103,10 +103,12 @@ IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &type, NLMISC
{ {
return new CAudioDecoderVorbis(stream, loop); return new CAudioDecoderVorbis(stream, loop);
} }
#if (NL_COMP_VC_VERSION > 90) /* VS2008 does not have stdint.h */
else if (type_lower == "mp3") else if (type_lower == "mp3")
{ {
return new CAudioDecoderMP3(stream, loop); return new CAudioDecoderMP3(stream, loop);
} }
#endif
else else
{ {
nlwarning("Music file type unknown: '%s'", type_lower.c_str()); nlwarning("Music file type unknown: '%s'", type_lower.c_str());
@ -144,6 +146,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st
nlwarning("Unable to open: '%s'", filepath.c_str()); nlwarning("Unable to open: '%s'", filepath.c_str());
} }
#if (NL_COMP_VC_VERSION > 90) /* VS2008 does not have stdint.h */
else if (type_lower == "mp3") else if (type_lower == "mp3")
{ {
CIFile ifile; CIFile ifile;
@ -154,6 +157,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st
nlwarning("Unable to open: '%s'", filepath.c_str()); nlwarning("Unable to open: '%s'", filepath.c_str());
} }
#endif
else else
{ {
nlwarning("Music file type unknown: '%s'", type_lower.c_str()); nlwarning("Music file type unknown: '%s'", type_lower.c_str());

View file

@ -17,6 +17,8 @@
#include "stdsound.h" #include "stdsound.h"
#if (NL_COMP_VC_VERSION > 90) /* VS2008 does not have stdint.h */
#include <nel/sound/audio_decoder_mp3.h> #include <nel/sound/audio_decoder_mp3.h>
#define DR_MP3_IMPLEMENTATION #define DR_MP3_IMPLEMENTATION
@ -221,4 +223,6 @@ void CAudioDecoderMP3::setLooping(bool loop)
} /* namespace NLSOUND */ } /* namespace NLSOUND */
#endif /* (NL_COMP_VC_VERSION > 90) */
/* end of file */ /* end of file */

View file

@ -36,8 +36,11 @@ NL_ADD_LIB_SUFFIX(${NLDRV_AL_LIB})
IF(WIN32) IF(WIN32)
# Find and include EFX-Util on Windows. # Find and include EFX-Util on Windows.
FIND_PACKAGE(EFXUtil) FIND_PACKAGE(EFXUtil)
IF(EFXUTIL_FOUND)
INCLUDE_DIRECTORIES(${EFXUTIL_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${EFXUTIL_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${NLDRV_AL_LIB} ${EFXUTIL_LIBRARY}) TARGET_LINK_LIBRARIES(${NLDRV_AL_LIB} ${EFXUTIL_LIBRARY})
ADD_DEFINITIONS(-DEFX_CREATIVE_AVAILABLE=1)
ENDIF()
ENDIF() ENDIF()
IF(WITH_PCH) IF(WITH_PCH)

View file

@ -17,12 +17,12 @@
#ifndef NL_EXT_AL_H #ifndef NL_EXT_AL_H
#define NL_EXT_AL_H #define NL_EXT_AL_H
#ifdef NL_OS_WINDOWS #ifndef EFX_CREATIVE_AVAILABLE
# define EFX_CREATIVE_AVAILABLE 1 #define EFX_CREATIVE_AVAILABLE 0
# define EAX_AVAILABLE 0 #endif
#else
# define EFX_CREATIVE_AVAILABLE 0 #ifndef EAX_AVAILABLE
# define EAX_AVAILABLE 0 #define EAX_AVAILABLE 0
#endif #endif
#if EAX_AVAILABLE #if EAX_AVAILABLE

View file

@ -226,7 +226,7 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD
*/ */
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
wchar_t buffer[1024], *ptr; wchar_t buffer[1024], *ptr;
uint len = SearchPathW (NULL, utf8ToWide(dllName), NULL, 1023, buffer, &ptr); uint len = SearchPathW (NULL, nlUtf8ToWide(dllName), NULL, 1023, buffer, &ptr);
if( len ) if( len )
nlinfo ("Using the library '%s' that is in the directory: '%s'", dllName.c_str(), wideToUtf8(buffer).c_str()); nlinfo ("Using the library '%s' that is in the directory: '%s'", dllName.c_str(), wideToUtf8(buffer).c_str());
#endif #endif

View file

@ -201,9 +201,9 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
// Main // Main
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
int CALLBACK WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) int APIENTRY nltWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
#else // NL_OS_WINDOWS #else // NL_OS_WINDOWS
int main(int argc, char **argv) int nltmain(int argc, NLMISC::tchar **argv)
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
{ {
double rGlobalTime = 0; double rGlobalTime = 0;

View file

@ -38,6 +38,8 @@
#include "nel/ligo/ligo_error.h" #include "nel/ligo/ligo_error.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "../../plugin_max/nel_3dsmax_shared/string_common.h"
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
extern HINSTANCE hInstance; extern HINSTANCE hInstance;
@ -126,13 +128,13 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di
{ {
// Get the path // Get the path
TCHAR sModulePath[256]; TCHAR sModulePath[256];
int res=GetModuleFileName(hModule, sModulePath, 256); int res = GetModuleFileName(hModule, sModulePath, 256);
// Success ? // Success ?
if (res) if (res)
{ {
// Path // Path
std::string path = NLMISC::CFile::getPath(tStrToUtf8(sModulePath) + "ligoscape.cfg"); std::string path = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath) + "ligoscape.cfg");
try try
{ {
@ -164,16 +166,19 @@ void CMaxToLigo::errorMessage(const std::string &msg, const std::string &title,
if (dialog) if (dialog)
{ {
// Dialog message // Dialog message
MessageBox (it.GetMAXHWnd(), utf8ToTStr(msg), utf8ToTStr(title), MB_OK|MB_ICONEXCLAMATION); ucstring ucmsg, uctitle;
ucmsg.fromUtf8(msg);
uctitle.fromUtf8(title);
MessageBoxW(it.GetMAXHWnd(), (LPCWSTR)ucmsg.c_str(), (LPCWSTR)uctitle.c_str(), MB_OK | MB_ICONEXCLAMATION);
} }
else else
{ {
// Text message // Text message
mprintf (utf8ToTStr(msg + "\n")); mprintf(_M("%s\n"), MaxTStrFromUtf8(msg).data());
} }
// Output in log // Output in log
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); nlassert (node);
// The second arg // The second arg
const std::string fileName = tStrToUtf8(arg_list[1]->to_string()); const std::string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The third arg // The third arg
bool checkOnly = (arg_list[2]->to_bool() != FALSE); bool checkOnly = (arg_list[2]->to_bool() != FALSE);
@ -321,12 +321,12 @@ Value* export_transition_cf (Value** arg_list, int count)
nlassert (is_array(nodes)); nlassert (is_array(nodes));
// The second arg // The second arg
std::string fileName = tStrToUtf8(arg_list[1]->to_string()); std::string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The second arg // The second arg
string matFilename[2]; string matFilename[2];
matFilename[0] = tStrToUtf8(arg_list[2]->to_string()); matFilename[0] = MCharStrToUtf8(arg_list[2]->to_string());
matFilename[1] = tStrToUtf8(arg_list[3]->to_string()); matFilename[1] = MCharStrToUtf8(arg_list[3]->to_string());
// The third arg // The third arg
bool checkOnly = (arg_list[4]->to_bool() != FALSE); bool checkOnly = (arg_list[4]->to_bool() != FALSE);
@ -696,7 +696,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string()); string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The fourth arg // The fourth arg
bool errorInDialog = (arg_list[2]->to_bool() != FALSE); bool errorInDialog = (arg_list[2]->to_bool() != FALSE);
@ -830,7 +830,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string()); string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The second arg // The second arg
int transitionNumber = arg_list[2]->to_int(); int transitionNumber = arg_list[2]->to_int();
@ -998,7 +998,7 @@ Value* export_zone_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string()); string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The thrid arg // The thrid arg
Array *array = (Array*)arg_list[2]; Array *array = (Array*)arg_list[2];
@ -1043,8 +1043,8 @@ Value* export_zone_cf (Value** arg_list, int count)
type_check (cell->get(2), String, message); type_check (cell->get(2), String, message);
// Get the strings // Get the strings
categories[i].first = tStrToUtf8(cell->get(1)->to_string()); categories[i].first = MCharStrToUtf8(cell->get(1)->to_string());
categories[i].second = tStrToUtf8(cell->get(2)->to_string()); categories[i].second = MCharStrToUtf8(cell->get(2)->to_string());
} }
// Get a Object pointer // Get a Object pointer
@ -1352,7 +1352,7 @@ Value* get_error_string_cf (Value** arg_list, int count)
int errorCode = arg_list[0]->to_int()-1; int errorCode = arg_list[0]->to_int()-1;
// Error code // Error code
return new String (utf8ToTStr(CLigoError::getStringError ((CLigoError::TError)errorCode))); return new String(MaxTStrFromUtf8(CLigoError::getStringError ((CLigoError::TError)errorCode)));
} }
// *************************************************************************** // ***************************************************************************
@ -1367,7 +1367,7 @@ Value* set_directory_cf (Value** arg_list, int count)
type_check(arg_list[0], String, message); type_check(arg_list[0], String, message);
// The first arg // The first arg
const std::string dir = tStrToUtf8(arg_list[0]->to_string()); const std::string dir = MCharStrToUtf8(arg_list[0]->to_string());
// Set the directory // Set the directory
return (chdir (dir.c_str())==0)?&true_value:&false_value; return (chdir (dir.c_str())==0)?&true_value:&false_value;
@ -1859,7 +1859,7 @@ Value* make_snapshot_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = tStrToUtf8(arg_list[1]->to_string()); string fileName = MCharStrToUtf8(arg_list[1]->to_string());
// The thrid arg // The thrid arg
int xMin = arg_list[2]->to_int(); int xMin = arg_list[2]->to_int();

View file

@ -158,7 +158,7 @@ void CAnimationSetDlg::OnAddAnimation ()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox (nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
@ -199,7 +199,7 @@ void CAnimationSetDlg::OnAddSkelWt()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -234,7 +234,7 @@ void CAnimationSetDlg::refresh (BOOL update)
for (i=0; i<_ObjView->getNumInstance (); i++) for (i=0; i<_ObjView->getNumInstance (); i++)
{ {
std::string name = NLMISC::CFile::getFilenameWithoutExtension(_ObjView->getInstance(i)->Saved.ShapeFilename); std::string name = NLMISC::CFile::getFilenameWithoutExtension(_ObjView->getInstance(i)->Saved.ShapeFilename);
EditedObject.InsertString (-1, utf8ToTStr(name)); EditedObject.InsertString(-1, nlUtf8ToTStr(name));
} }
// Get edited object // Get edited object
@ -268,7 +268,7 @@ void CAnimationSetDlg::refresh (BOOL update)
CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name)); CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name));
// Insert an intem // Insert an intem
HTREEITEM item=Tree.InsertItem(utf8ToTStr(name)); HTREEITEM item = Tree.InsertItem(nlUtf8ToTStr(name));
Tree.SetItemData (item, i); Tree.SetItemData (item, i);
nlassert (item!=NULL); nlassert (item!=NULL);
@ -279,7 +279,7 @@ void CAnimationSetDlg::refresh (BOOL update)
while (ite!=setString.end()) while (ite!=setString.end())
{ {
// Add this string // Add this string
HTREEITEM newItem = Tree.InsertItem (utf8ToTStr(*ite), item); HTREEITEM newItem = Tree.InsertItem(nlUtf8ToTStr(*ite), item);
Tree.SetItemData (newItem, 0xffffffff); Tree.SetItemData (newItem, 0xffffffff);
// Get the track // Get the track
@ -303,7 +303,7 @@ void CAnimationSetDlg::refresh (BOOL update)
name = toString("%s (%f - %f)", typeid(*track).name(), track->getBeginTime(), track->getEndTime()); name = toString("%s (%f - %f)", typeid(*track).name(), track->getBeginTime(), track->getEndTime());
} }
HTREEITEM keyItem = Tree.InsertItem(utf8ToTStr(name), newItem); HTREEITEM keyItem = Tree.InsertItem(nlUtf8ToTStr(name), newItem);
Tree.SetItemData(keyItem, 0xffffffff); Tree.SetItemData(keyItem, 0xffffffff);
ite++; ite++;
@ -320,7 +320,7 @@ void CAnimationSetDlg::refresh (BOOL update)
CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight(object->AnimationSet.getSkeletonWeightIdByName(name)); CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight(object->AnimationSet.getSkeletonWeightIdByName(name));
// Insert an intem // Insert an intem
HTREEITEM item=SkelTree.InsertItem(utf8ToTStr(name)); HTREEITEM item = SkelTree.InsertItem(nlUtf8ToTStr(name));
nlassert (item!=NULL); nlassert (item!=NULL);
// Get number of node in this skeleton weight // Get number of node in this skeleton weight
@ -332,7 +332,7 @@ void CAnimationSetDlg::refresh (BOOL update)
std::string percent = toString("%s (%f%%)", swt->getNodeName(n).c_str(), swt->getNodeWeight(n)*100); std::string percent = toString("%s (%f%%)", swt->getNodeName(n).c_str(), swt->getNodeWeight(n)*100);
// Add this string // Add this string
SkelTree.InsertItem (utf8ToTStr(percent), item); SkelTree.InsertItem(nlUtf8ToTStr(percent), item);
} }
} }
@ -340,7 +340,7 @@ void CAnimationSetDlg::refresh (BOOL update)
for (i=0; i<object->Saved.PlayList.size(); i++) for (i=0; i<object->Saved.PlayList.size(); i++)
{ {
// Insert an intem // Insert an intem
int item=PlayList.InsertString (-1, utf8ToTStr(object->Saved.PlayList[i])); int item = PlayList.InsertString(-1, nlUtf8ToTStr(object->Saved.PlayList[i]));
nlassert (item!=LB_ERR); nlassert (item!=LB_ERR);
} }
} }

View file

@ -355,7 +355,7 @@ void CAttribDlg::init(HBITMAP bitmap, sint x, sint y, CWnd *pParent)
for (uint k = 0; k < getNumScheme(); ++k) for (uint k = 0; k < getNumScheme(); ++k)
{ {
m_Scheme.InsertString(k, utf8ToTStr(getSchemeName(k))); m_Scheme.InsertString(k, nlUtf8ToTStr(getSchemeName(k)));
} }

View file

@ -33,7 +33,7 @@ CChooseName::CChooseName(const CString &initialName, CWnd* pParent /*=NULL*/)
std::string CChooseName::getName() std::string CChooseName::getName()
{ {
return tStrToUtf8(m_Name); return NLMISC::tStrToUtf8(m_Name);
} }
void CChooseName::DoDataExchange(CDataExchange* pDX) void CChooseName::DoDataExchange(CDataExchange* pDX)

View file

@ -53,10 +53,10 @@ void CChoosePoolID::OnOK()
CString val; CString val;
GetDlgItem(IDC_POOL_ID)->GetWindowText(val); GetDlgItem(IDC_POOL_ID)->GetWindowText(val);
if (NLMISC::fromString(tStrToUtf8(val), PoolID)) if (NLMISC::fromString(NLMISC::tStrToUtf8(val), PoolID))
{ {
GetDlgItem(IDC_POOL_NAME)->GetWindowText(val); GetDlgItem(IDC_POOL_NAME)->GetWindowText(val);
Name = tStrToUtf8(val); Name = NLMISC::tStrToUtf8(val);
CDialog::OnOK(); CDialog::OnOK();
} }
else else
@ -71,8 +71,8 @@ BOOL CChoosePoolID::OnInitDialog()
std::string val = NLMISC::toString(PoolID); std::string val = NLMISC::toString(PoolID);
GetDlgItem(IDC_POOL_ID)->SetWindowText(utf8ToTStr(val)); GetDlgItem(IDC_POOL_ID)->SetWindowText(nlUtf8ToTStr(val));
GetDlgItem(IDC_POOL_NAME)->SetWindowText(utf8ToTStr(Name)); GetDlgItem(IDC_POOL_NAME)->SetWindowText(nlUtf8ToTStr(Name));
if (_FreezeID) if (_FreezeID)
{ {

View file

@ -72,7 +72,7 @@ BOOL CCreateFileDlg::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
SetWindowText((LPCTSTR) _Title); SetWindowText((LPCTSTR) _Title);
GetDlgItem(IDC_LOCATION)->SetWindowText(utf8ToTStr(_DefaultBasePath)); GetDlgItem(IDC_LOCATION)->SetWindowText(nlUtf8ToTStr(_DefaultBasePath));
if (!_DefaultBasePath.empty()) if (!_DefaultBasePath.empty())
{ {
GetDlgItem(IDC_FILENAME)->SetFocus(); GetDlgItem(IDC_FILENAME)->SetFocus();
@ -90,10 +90,10 @@ void CCreateFileDlg::OnOK()
{ {
CString filename; CString filename;
GetDlgItem(IDC_FILENAME)->GetWindowText(filename); GetDlgItem(IDC_FILENAME)->GetWindowText(filename);
_Filename = tStrToUtf8(filename); _Filename = NLMISC::tStrToUtf8(filename);
CString location; CString location;
GetDlgItem(IDC_LOCATION)->GetWindowText(location); GetDlgItem(IDC_LOCATION)->GetWindowText(location);
_Path = tStrToUtf8(location); _Path = NLMISC::tStrToUtf8(location);
if (_Path.empty()) if (_Path.empty())
{ {
localizedMessageBox(*this, IDS_EMPTY_PATH, IDS_ERROR, MB_ICONEXCLAMATION); localizedMessageBox(*this, IDS_EMPTY_PATH, IDS_ERROR, MB_ICONEXCLAMATION);

View file

@ -173,7 +173,7 @@ void CDirectionAttr::OnDestroy()
void CDirectionAttr::OnGlobalDirection() void CDirectionAttr::OnGlobalDirection()
{ {
nlassert(_DirectionWrapper); nlassert(_DirectionWrapper);
CChooseName chooseName(utf8ToTStr(_DirectionWrapper->getGlobalVectorValueName())); CChooseName chooseName(nlUtf8ToTStr(_DirectionWrapper->getGlobalVectorValueName()));
if (chooseName.DoModal() == IDOK) if (chooseName.DoModal() == IDOK)
{ {

View file

@ -76,7 +76,7 @@ std::string CEditEx::getString() const
{ {
TCHAR buf[128]; TCHAR buf[128];
GetWindowText(buf, sizeof(buf)); GetWindowText(buf, sizeof(buf));
return tStrToUtf8(buf); return NLMISC::tStrToUtf8(buf);
} }
void CEditEx::setSInt(sint value) void CEditEx::setSInt(sint value)

View file

@ -89,7 +89,7 @@ bool CEditMorphMeshDlg::getShapeNameFromDlg(std::string &name)
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName())); NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()));
*/ */
name = tStrToUtf8(fd.GetPathName()); name = NLMISC::tStrToUtf8(fd.GetPathName());
return true; return true;
} }
@ -123,7 +123,7 @@ void CEditMorphMeshDlg::OnAdd()
_CM->setShapes(&shapeNames[0], (uint)shapeNames.size()); _CM->setShapes(&shapeNames[0], (uint)shapeNames.size());
std::vector<sint> numVerts; std::vector<sint> numVerts;
_CM->getShapeNumVerts(numVerts); _CM->getShapeNumVerts(numVerts);
m_MeshList.AddString(utf8ToTStr(getShapeDescStr(index, numVerts[index]))); m_MeshList.AddString(nlUtf8ToTStr(getShapeDescStr(index, numVerts[index])));
GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE); GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE);
} }
touchPSState(); touchPSState();
@ -253,7 +253,7 @@ void CEditMorphMeshDlg::updateMeshList()
m_MeshList.ResetContent(); m_MeshList.ResetContent();
for (uint k = 0; k < _CM->getNumShapes(); ++k) for (uint k = 0; k < _CM->getNumShapes(); ++k)
{ {
m_MeshList.AddString(utf8ToTStr(getShapeDescStr(k, numVerts[k]))); m_MeshList.AddString(nlUtf8ToTStr(getShapeDescStr(k, numVerts[k])));
} }
m_MeshList.SetCurSel(0); m_MeshList.SetCurSel(0);
updateValidFlag(); updateValidFlag();
@ -310,12 +310,12 @@ std::string CEditMorphMeshDlg::getShapeDescStr(uint shapeIndex, sint numVerts) c
{ {
CString verts; CString verts;
verts.LoadString(IDS_VERTICES); verts.LoadString(IDS_VERTICES);
std::string msg = _CM->getShape(shapeIndex) + " (" + NLMISC::toString(numVerts) + " " + tStrToUtf8(verts) + ")"; std::string msg = _CM->getShape(shapeIndex) + " (" + NLMISC::toString(numVerts) + " " + NLMISC::tStrToUtf8(verts) + ")";
return msg; return msg;
} }
else else
{ {
std::string result = _CM->getShape(shapeIndex) + " (" + tStrToUtf8(CMeshDlg::getShapeErrorString(numVerts)) + ")"; std::string result = _CM->getShape(shapeIndex) + " (" + NLMISC::tStrToUtf8(CMeshDlg::getShapeErrorString(numVerts)) + ")";
return result; return result;
} }
} }

View file

@ -195,7 +195,7 @@ void CEditPSSound::OnChangeSoundName()
{ {
nlassert(_Sound); nlassert(_Sound);
UpdateData(); UpdateData();
_Sound->setSoundName(NLMISC::CSheetId(tStrToUtf8(m_SoundName), "sound")); _Sound->setSoundName(NLMISC::CSheetId(NLMISC::tStrToUtf8(m_SoundName), "sound"));
updateModifiedFlag(); updateModifiedFlag();
} }
@ -209,7 +209,7 @@ void CEditPSSound::OnSpawn()
// play the currently selected sound // play the currently selected sound
void CEditPSSound::OnPlaySound() void CEditPSSound::OnPlaySound()
{ {
CSoundSystem::play(tStrToUtf8(m_SoundName)); CSoundSystem::play(NLMISC::tStrToUtf8(m_SoundName));
} }
void CEditPSSound::OnMute() void CEditPSSound::OnMute()

View file

@ -317,7 +317,7 @@ inline void CEditableRangeT<float>::value2CString(float value, CString &dest)
inline const TCHAR *CEditableRangeT<float>::string2value(const CString &value, float &result) inline const TCHAR *CEditableRangeT<float>::string2value(const CString &value, float &result)
{ {
if (NLMISC::fromString(tStrToUtf8(value), result)) if (NLMISC::fromString(NLMISC::tStrToUtf8(value), result))
{ {
return NULL; return NULL;
} }
@ -344,7 +344,7 @@ inline void CEditableRangeT<uint32>::value2CString(uint32 value, CString &dest)
inline const TCHAR *CEditableRangeT<uint32>::string2value(const CString &value, uint32 &result) inline const TCHAR *CEditableRangeT<uint32>::string2value(const CString &value, uint32 &result)
{ {
sint32 tmp; sint32 tmp;
if (NLMISC::fromString(tStrToUtf8(value), tmp)) if (NLMISC::fromString(NLMISC::tStrToUtf8(value), tmp))
{ {
if (value.Find(_T("-")) > -1) if (value.Find(_T("-")) > -1)
{ {
@ -380,7 +380,7 @@ inline void CEditableRangeT<sint32>::value2CString(sint32 value, CString &dest)
inline const TCHAR *CEditableRangeT<sint32>::string2value(const CString &value, sint32 &result) inline const TCHAR *CEditableRangeT<sint32>::string2value(const CString &value, sint32 &result)
{ {
sint32 tmp; sint32 tmp;
if (NLMISC::fromString(tStrToUtf8(value), tmp)) if (NLMISC::fromString(NLMISC::tStrToUtf8(value), tmp))
{ {
result = tmp; result = tmp;
return NULL; return NULL;

View file

@ -85,7 +85,7 @@ void CEmitterDlg::initEmittedType()
NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k)); NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k));
if (loc) // is this a located if (loc) // is this a located
{ {
m_EmittedTypeCtrl.AddString(utf8ToTStr(loc->getName())); m_EmittedTypeCtrl.AddString(nlUtf8ToTStr(loc->getName()));
_LocatedList.push_back(loc); _LocatedList.push_back(loc);
if (loc == _Emitter->getEmittedType()) if (loc == _Emitter->getEmittedType())
{ {

View file

@ -119,7 +119,7 @@ void CLBExternIDDlg::OnChangeIdValue()
TCHAR buf[6]; TCHAR buf[6];
::memset(buf, 0, 6); ::memset(buf, 0, 6);
GetDlgItem(IDC_ID_VALUE)->GetWindowText(buf, 6); GetDlgItem(IDC_ID_VALUE)->GetWindowText(buf, 6);
_ID = StringToID(tStrToUtf8(buf).c_str()); _ID = StringToID(NLMISC::tStrToUtf8(buf).c_str());
if (_ID) if (_ID)
{ {
GetDlgItem(IDOK)->EnableWindow(TRUE); GetDlgItem(IDOK)->EnableWindow(TRUE);

View file

@ -114,7 +114,7 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent)
// z-test // z-test
((CButton *) GetDlgItem(IDC_ZTEST))->SetCheck(material->isZTestEnabled() ? BST_CHECKED : BST_UNCHECKED); ((CButton *) GetDlgItem(IDC_ZTEST))->SetCheck(material->isZTestEnabled() ? BST_CHECKED : BST_UNCHECKED);
// z-bias // z-bias
GetDlgItem(IDC_ZBIAS)->SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", -material->getZBias()))); GetDlgItem(IDC_ZBIAS)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", -material->getZBias())));
} }
else else
{ {

View file

@ -322,7 +322,7 @@ void CLocatedProperties::goPostRender()
_MaxNbParticles->update(); _MaxNbParticles->update();
} }
// in all cases, show the current number of particles being used // in all cases, show the current number of particles being used
GetDlgItem(IDC_CURR_NUM_PARTS)->SetWindowText(utf8ToTStr(NLMISC::toString(_Located->getSize()))); GetDlgItem(IDC_CURR_NUM_PARTS)->SetWindowText(nlUtf8ToTStr(NLMISC::toString(_Located->getSize())));
} }
//**************************************************************************************************************** //****************************************************************************************************************

View file

@ -112,7 +112,7 @@ void CLocatedTargetDlg::OnAddTarget()
nlassert(loc); nlassert(loc);
_LBTarget->attachTarget(loc); _LBTarget->attachTarget(loc);
m_AvailableTargets.DeleteString(indexs[k] - k); m_AvailableTargets.DeleteString(indexs[k] - k);
int l = m_Targets.AddString(utf8ToTStr(loc->getName())); int l = m_Targets.AddString(nlUtf8ToTStr(loc->getName()));
m_Targets.SetItemData(l, (DWORD_PTR) loc); m_Targets.SetItemData(l, (DWORD_PTR) loc);
} }
UpdateData(FALSE); UpdateData(FALSE);
@ -135,7 +135,7 @@ void CLocatedTargetDlg::OnRemoveTarget()
nlassert(loc); nlassert(loc);
_LBTarget->detachTarget(loc); _LBTarget->detachTarget(loc);
m_Targets.DeleteString(indexs[k] - k); m_Targets.DeleteString(indexs[k] - k);
int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); int l = m_AvailableTargets.AddString(nlUtf8ToTStr(loc->getName()));
m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc); m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc);
} }
@ -159,7 +159,7 @@ BOOL CLocatedTargetDlg::OnInitDialog()
// fill the box thta tells us what the target are // fill the box thta tells us what the target are
for(k = 0; k < nbTarg; ++k) for(k = 0; k < nbTarg; ++k)
{ {
m_Targets.AddString(utf8ToTStr(_LBTarget->getTarget(k)->getName())); m_Targets.AddString(nlUtf8ToTStr(_LBTarget->getTarget(k)->getName()));
m_Targets.SetItemData(k, (DWORD_PTR) _LBTarget->getTarget(k)); m_Targets.SetItemData(k, (DWORD_PTR) _LBTarget->getTarget(k));
targetSet.insert(_LBTarget->getTarget(k)); targetSet.insert(_LBTarget->getTarget(k));
}; };
@ -179,7 +179,7 @@ BOOL CLocatedTargetDlg::OnInitDialog()
{ {
if (targetSet.find(loc) == targetSet.end()) if (targetSet.find(loc) == targetSet.end())
{ {
int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); int l = m_AvailableTargets.AddString(nlUtf8ToTStr(loc->getName()));
m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc); m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc);
} }
} }

View file

@ -592,7 +592,7 @@ void CMainFrame::OnFileLoadconfig()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
else else
@ -764,7 +764,7 @@ void CMainFrame::OnFileSaveconfig()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
else else
@ -1443,7 +1443,7 @@ void CMainFrame::OnUpdateSceneCamera(CCmdUI* pCmdUI)
CInstanceInfo *instance = ObjView->getInstance (ObjView->getCameraInstance (pCmdUI->m_nID - ID_SCENE_CAMERA_FIRST)); CInstanceInfo *instance = ObjView->getInstance (ObjView->getCameraInstance (pCmdUI->m_nID - ID_SCENE_CAMERA_FIRST));
nlassert (instance->Camera); nlassert (instance->Camera);
std::string text = NLMISC::toString("Camera %s", instance->Saved.ShapeFilename.c_str()); std::string text = NLMISC::toString("Camera %s", instance->Saved.ShapeFilename.c_str());
pCmdUI->SetText(utf8ToTStr(text)); pCmdUI->SetText(nlUtf8ToTStr(text));
} }
else else
{ {

View file

@ -94,7 +94,7 @@ void CMeshDlg::OnBrowseShape()
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add to the path // Add to the path
std::string fullPath = tStrToUtf8(fd.GetPathName()); std::string fullPath = NLMISC::tStrToUtf8(fd.GetPathName());
std::string fname = NLMISC::CFile::getFilenameWithoutExtension(fullPath); std::string fname = NLMISC::CFile::getFilenameWithoutExtension(fullPath);
std::string ext = NLMISC::CFile::getExtension(fullPath); std::string ext = NLMISC::CFile::getExtension(fullPath);
@ -104,12 +104,12 @@ void CMeshDlg::OnBrowseShape()
try try
{ {
_ShapeParticle->setShape(fname + "." + ext); _ShapeParticle->setShape(fname + "." + ext);
m_ShapeName = utf8ToTStr(fname + "." + ext); m_ShapeName = nlUtf8ToTStr(fname + "." + ext);
touchPSState(); touchPSState();
} }
catch (const NLMISC::Exception &e) catch (const NLMISC::Exception &e)
{ {
MessageBox(utf8ToTStr(e.what()), _T("shape loading error")); MessageBox(nlUtf8ToTStr(e.what()), _T("shape loading error"));
} }
updateMeshErrorString(); updateMeshErrorString();
@ -159,7 +159,7 @@ void CMeshDlg::updateForMorph()
GetDlgItem(IDC_SHAPE_NAME)->EnableWindow(!enable); GetDlgItem(IDC_SHAPE_NAME)->EnableWindow(!enable);
if (!enable) if (!enable)
{ {
m_ShapeName = utf8ToTStr(cm->getShape()); m_ShapeName = nlUtf8ToTStr(cm->getShape());
} }
else else
{ {

View file

@ -165,19 +165,19 @@ void CMultiTexDlg::readValues(bool alternate)
char buf[128]; char buf[128];
if (!alternate) if (!alternate)
{ {
GetDlgItem(IDC_U_SPEED_1)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).x))); GetDlgItem(IDC_U_SPEED_1)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).x)));
GetDlgItem(IDC_V_SPEED_1)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).y))); GetDlgItem(IDC_V_SPEED_1)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).y)));
GetDlgItem(IDC_U_SPEED_2)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).x))); GetDlgItem(IDC_U_SPEED_2)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).x)));
GetDlgItem(IDC_V_SPEED_2)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).y))); GetDlgItem(IDC_V_SPEED_2)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).y)));
} }
else else
{ {
if (_MTP->isAlternateTexEnabled()) if (_MTP->isAlternateTexEnabled())
{ {
GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).x))); GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).x)));
GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).y))); GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).y)));
GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).x))); GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).x)));
GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).y))); GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).y)));
} }
else else
{ {
@ -188,7 +188,7 @@ void CMultiTexDlg::readValues(bool alternate)
} }
} }
GetDlgItem(IDC_BUMP_FACTOR)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getBumpFactor()))); GetDlgItem(IDC_BUMP_FACTOR)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getBumpFactor())));
} }

View file

@ -535,7 +535,7 @@ void CObjectViewer::loadConfigFile()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
::MessageBox (NULL, utf8ToTStr(e.what()), _T("Objectviewer.cfg"), MB_OK|MB_ICONEXCLAMATION); ::MessageBox(NULL, nlUtf8ToTStr(e.what()), _T("Objectviewer.cfg"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
@ -823,7 +823,7 @@ bool CObjectViewer::initUI (HWND parent)
catch (const NLMISC::EStream &e) catch (const NLMISC::EStream &e)
{ {
std::string msg = toString("Unable to load the default scheme bank file : %s", e.what()); std::string msg = toString("Unable to load the default scheme bank file : %s", e.what());
::MessageBox(NULL, utf8ToTStr(msg), _T("Object Viewer"), MB_ICONEXCLAMATION); ::MessageBox(NULL, nlUtf8ToTStr(msg), _T("Object Viewer"), MB_ICONEXCLAMATION);
} }
} }
iF.close(); iF.close();
@ -840,7 +840,7 @@ bool CObjectViewer::initUI (HWND parent)
catch (const Exception& e) catch (const Exception& e)
{ {
std::string msg = toString("Error while loading default.ovcgf : %s", e.what()); std::string msg = toString("Error while loading default.ovcgf : %s", e.what());
::MessageBox (NULL, utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); ::MessageBox(NULL, nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
@ -1312,7 +1312,7 @@ void CObjectViewer::go ()
); );
// Display // Display
_MainFrame->StatusBar.SetWindowText (utf8ToTStr(msgBar)); _MainFrame->StatusBar.SetWindowText(nlUtf8ToTStr(msgBar));
// Display Vegetable info. // Display Vegetable info.
if(_VegetableDlg!=NULL) if(_VegetableDlg!=NULL)
@ -1794,7 +1794,7 @@ void CObjectViewer::serial (NLMISC::IStream& f)
{ {
// Error message // Error message
std::string message = toString("File not found %s", readed[i].ShapeFilename.c_str()); std::string message = toString("File not found %s", readed[i].ShapeFilename.c_str());
_MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
// Stop loading // Stop loading
break; break;
@ -1829,7 +1829,7 @@ void CObjectViewer::serial (NLMISC::IStream& f)
{ {
// Error message // Error message
std::string message = toString("Error loading shape %s: %s", readed[i].ShapeFilename.c_str(), e.what()); std::string message = toString("Error loading shape %s: %s", readed[i].ShapeFilename.c_str(), e.what());
_MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
// Stop loading // Stop loading
break; break;
@ -1899,7 +1899,7 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igFilename)
{ {
// clean // clean
delete ig; delete ig;
_MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
return false; return false;
} }
} }
@ -1907,7 +1907,7 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igFilename)
{ {
// Create a message // Create a message
std::string msg = toString("Can't open the file %s for reading.", igFilename.c_str()); std::string msg = toString("Can't open the file %s for reading.", igFilename.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
return false; return false;
} }
@ -1962,7 +1962,7 @@ bool CObjectViewer::loadMesh (std::vector<std::string> &meshFilename, const std:
} }
catch (const Exception& e) catch (const Exception& e)
{ {
_MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
// error // error
skelError=true; skelError=true;
@ -1972,7 +1972,7 @@ bool CObjectViewer::loadMesh (std::vector<std::string> &meshFilename, const std:
{ {
// Create a message // Create a message
std::string msg = NLMISC::toString("Can't open the file %s for reading.", skeleton.c_str()); std::string msg = NLMISC::toString("Can't open the file %s for reading.", skeleton.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
// error // error
skelError=true; skelError=true;
@ -2015,7 +2015,7 @@ bool CObjectViewer::loadMesh (std::vector<std::string> &meshFilename, const std:
} }
catch (const Exception& e) catch (const Exception& e)
{ {
_MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
continue; continue;
} }
} }
@ -2023,7 +2023,7 @@ bool CObjectViewer::loadMesh (std::vector<std::string> &meshFilename, const std:
{ {
// Create a message // Create a message
std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
continue; continue;
} }
@ -2848,7 +2848,7 @@ void CObjectViewer::enableDynamicObjectLightingTest(NLPACS::CGlobalRetriever *gl
if (!_ObjectLightTestShape.empty()) if (!_ObjectLightTestShape.empty())
{ {
string str= string("Path not found for Light Test Shape: ") + _ObjectLightTestShape; string str= string("Path not found for Light Test Shape: ") + _ObjectLightTestShape;
::MessageBox(NULL, utf8ToTStr(str.c_str()), _T("Dynamic Object Light Test"), MB_OK|MB_ICONEXCLAMATION); ::MessageBox(NULL, nlUtf8ToTStr(str.c_str()), _T("Dynamic Object Light Test"), MB_OK | MB_ICONEXCLAMATION);
} }
// disable. // disable.
_ObjectLightTest= NULL; _ObjectLightTest= NULL;
@ -3223,7 +3223,7 @@ bool CObjectViewer::createVegetableLandscape()
// close the progress dialog // close the progress dialog
dlgProgress.DestroyWindow(); dlgProgress.DestroyWindow();
MessageBox(_MainFrame->m_hWnd, utf8ToTStr(e.what()), _T("Failed to Load landscape"), MB_OK | MB_APPLMODAL); MessageBox(_MainFrame->m_hWnd, nlUtf8ToTStr(e.what()), _T("Failed to Load landscape"), MB_OK | MB_APPLMODAL);
// remove first possibly created collisions objects. // remove first possibly created collisions objects.
if(_VegetableCollisionEntity) if(_VegetableCollisionEntity)
@ -3557,7 +3557,7 @@ void CObjectViewer::loadAnimation(const std::string &fileName, uint instance)
{ {
// Create a message // Create a message
std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
@ -3587,7 +3587,7 @@ void CObjectViewer::loadSWT (const std::string &fileName, uint instance)
{ {
// Create a message // Create a message
std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
@ -3771,14 +3771,14 @@ void CObjectViewer::shootScene()
else else
{ {
std::string message = toString("Can't open the file %s for writing.", filenamefinal.c_str()); std::string message = toString("Can't open the file %s for writing.", filenamefinal.c_str());
_MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
break; break;
} }
} }
catch (const Exception &e) catch (const Exception &e)
{ {
std::string message = toString("Error during writing of the file %s: %s", filenamefinal.c_str(), e.what()); std::string message = toString("Error during writing of the file %s: %s", filenamefinal.c_str(), e.what());
_MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
break; break;
} }
} }

View file

@ -428,7 +428,7 @@ bool CParticleDlg::savePSAs(HWND parent, CParticleWorkspace::CNode &psNode ,cons
} }
else else
{ {
::MessageBox(parent, utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); ::MessageBox(parent, nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION);
return false; return false;
} }
} }
@ -474,7 +474,7 @@ bool CParticleDlg::loadPS(HWND parent, CParticleWorkspace::CNode &psNode, TLoadP
{ {
case Silent: return false; // no op case Silent: return false; // no op
case ReportError: case ReportError:
::MessageBox(parent, utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); ::MessageBox(parent, nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK | MB_ICONEXCLAMATION);
return true; return true;
break; break;
case ReportErrorSkippable: case ReportErrorSkippable:
@ -549,7 +549,7 @@ void CParticleDlg::OnCreateNewPsWorkspace()
} }
catch(const NLMISC::EStream &e) catch(const NLMISC::EStream &e)
{ {
MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION);
} }
closeWorkspace(); closeWorkspace();
_PW = newPW; _PW = newPW;
@ -567,7 +567,7 @@ void CParticleDlg::OnLoadPSWorkspace()
CFileDialog fd( TRUE, _T(".pws"), _T("*.pws"), 0, szFilter); CFileDialog fd( TRUE, _T(".pws"), _T("*.pws"), 0, szFilter);
INT_PTR result = fd.DoModal(); INT_PTR result = fd.DoModal();
if (result != IDOK) return; if (result != IDOK) return;
loadWorkspace(tStrToUtf8(fd.GetPathName())); loadWorkspace(NLMISC::tStrToUtf8(fd.GetPathName()));
} }
//************************************************************************************************************************** //**************************************************************************************************************************
@ -585,7 +585,7 @@ void CParticleDlg::loadWorkspace(const std::string &fullPath)
} }
catch(const NLMISC::EStream &e) catch(const NLMISC::EStream &e)
{ {
MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION);
setStatusBarText(CString(e.what())); setStatusBarText(CString(e.what()));
return; return;
} }
@ -635,7 +635,7 @@ void CParticleDlg::saveWorkspaceStructure()
} }
catch(const NLMISC::EStream &e) catch(const NLMISC::EStream &e)
{ {
localizedMessageBox(*this, utf8ToTStr(e.what()), IDS_ERROR, MB_ICONEXCLAMATION); localizedMessageBox(*this, nlUtf8ToTStr(e.what()), IDS_ERROR, MB_ICONEXCLAMATION);
setStatusBarText(CString(e.what())); setStatusBarText(CString(e.what()));
} }
} }

View file

@ -213,7 +213,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H
if (node.isLoaded()) if (node.isLoaded())
{ {
// bind particle system icon // bind particle system icon
HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(node)), PSIconParticleSystem, PSIconParticleSystem, 0, 0, NULL, rootHandle, prevSibling); HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, nlUtf8ToTStr(computeCaption(node)), PSIconParticleSystem, PSIconParticleSystem, 0, 0, NULL, rootHandle, prevSibling);
// set the param (doesn't seems to work during first creation) // set the param (doesn't seems to work during first creation)
SetItemData(psRoot, (LPARAM) nt); SetItemData(psRoot, (LPARAM) nt);
// now, create each located // now, create each located
@ -228,7 +228,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H
else else
{ {
// bind a bitmap that say that the PS hasn't been loaded // bind a bitmap that say that the PS hasn't been loaded
HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(node)), PSIconParticleSystemNotLoaded, PSIconParticleSystemNotLoaded, 0, 0, NULL, rootHandle, prevSibling); HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, nlUtf8ToTStr(computeCaption(node)), PSIconParticleSystemNotLoaded, PSIconParticleSystemNotLoaded, 0, 0, NULL, rootHandle, prevSibling);
SetItemData(psRoot, (LPARAM) nt); SetItemData(psRoot, (LPARAM) nt);
return psRoot; return psRoot;
} }
@ -242,7 +242,7 @@ void CParticleTreeCtrl::buildTreeFromWorkSpace(CParticleWorkspace &ws)
CNodeType *nt = new CNodeType(&ws); CNodeType *nt = new CNodeType(&ws);
_NodeTypes.push_back(nt); _NodeTypes.push_back(nt);
// bind particle system icon // bind particle system icon
HTREEITEM rootHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(ws)), PSIconWorkspace, PSIconWorkspace, 0, 0, NULL, NULL, TVI_LAST); HTREEITEM rootHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, nlUtf8ToTStr(computeCaption(ws)), PSIconWorkspace, PSIconWorkspace, 0, 0, NULL, NULL, TVI_LAST);
// set the param (doesn't seems to work during first creation) // set the param (doesn't seems to work during first creation)
SetItemData(rootHandle, (LPARAM) nt); SetItemData(rootHandle, (LPARAM) nt);
// now, create each particle system // now, create each particle system
@ -259,7 +259,7 @@ void CParticleTreeCtrl::createNodeFromLocated(NL3D::CPSLocated *loc, HTREEITEM
CNodeType *nt = new CNodeType(loc); CNodeType *nt = new CNodeType(loc);
_NodeTypes.push_back(nt); _NodeTypes.push_back(nt);
// bind located icon // bind located icon
HTREEITEM nodeHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM |TVIF_TEXT, utf8ToTStr(loc->getName()) , PSIconLocated, PSIconLocated, 0, 0, (LPARAM) nt, rootHandle, TVI_LAST); HTREEITEM nodeHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(loc->getName()), PSIconLocated, PSIconLocated, 0, 0, (LPARAM)nt, rootHandle, TVI_LAST);
// now, insert each object that is bound to the located // now, insert each object that is bound to the located
for (uint l = 0; l < loc->getNbBoundObjects(); ++l) for (uint l = 0; l < loc->getNbBoundObjects(); ++l)
{ {
@ -273,7 +273,7 @@ void CParticleTreeCtrl::createNodeFromLocatedBindable(NL3D::CPSLocatedBindable *
// we ordered the image so that they match the type for a located bindable (force, particles, collision zones...) // we ordered the image so that they match the type for a located bindable (force, particles, collision zones...)
CNodeType *nt = new CNodeType(lb); CNodeType *nt = new CNodeType(lb);
_NodeTypes.push_back(nt); _NodeTypes.push_back(nt);
InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , utf8ToTStr(lb->getName()) , lb->getType(), lb->getType(), PSIconForce, PSIconForce, (LPARAM) nt, rootHandle, TVI_LAST); InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(lb->getName()), lb->getType(), lb->getType(), PSIconForce, PSIconForce, (LPARAM)nt, rootHandle, TVI_LAST);
} }
@ -1004,7 +1004,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
nlassert(ownerNode); nlassert(ownerNode);
// Add search path for the texture // Add search path for the texture
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName())));
CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank); CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
CParticleSystemModel *psm = NULL; CParticleSystemModel *psm = NULL;
@ -1012,9 +1012,9 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
{ {
NL3D::CShapeStream ss; NL3D::CShapeStream ss;
NLMISC::CIFile inputFile; NLMISC::CIFile inputFile;
inputFile.open(tStrToUtf8(fd.GetPathName())); inputFile.open(NLMISC::tStrToUtf8(fd.GetPathName()));
ss.serial(inputFile); ss.serial(inputFile);
std::string shapeName = NLMISC::CFile::getFilename(tStrToUtf8(fd.GetPathName())); std::string shapeName = NLMISC::CFile::getFilename(NLMISC::tStrToUtf8(fd.GetPathName()));
sb->add(shapeName, ss.getShapePointer()); sb->add(shapeName, ss.getShapePointer());
NL3D::CShapeBank *oldSB = CNELU::Scene->getShapeBank(); NL3D::CShapeBank *oldSB = CNELU::Scene->getShapeBank();
CNELU::Scene->setShapeBank(sb.get()); CNELU::Scene->setShapeBank(sb.get());
@ -1039,7 +1039,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
} }
catch(const NLMISC::EStream &e) catch(const NLMISC::EStream &e)
{ {
MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK | MB_ICONEXCLAMATION);
return TRUE; return TRUE;
} }
ownerNode->setResetAutoCountFlag(false); ownerNode->setResetAutoCountFlag(false);
@ -1096,10 +1096,10 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
_ParticleDlg->StartStopDlg->stop(); _ParticleDlg->StartStopDlg->stop();
std::string fileName = nt->PS->getFilename(); std::string fileName = nt->PS->getFilename();
static TCHAR BASED_CODE szFilter[] = _T("ps & shapes files(*.ps;*.shape)|*.ps; *.shape||"); static TCHAR BASED_CODE szFilter[] = _T("ps & shapes files(*.ps;*.shape)|*.ps; *.shape||");
CFileDialog fd(FALSE, _T(".ps"), utf8ToTStr(fileName), OFN_OVERWRITEPROMPT, szFilter, this); CFileDialog fd(FALSE, _T(".ps"), nlUtf8ToTStr(fileName), OFN_OVERWRITEPROMPT, szFilter, this);
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
_ParticleDlg->savePSAs(*this, *nt->PS, tStrToUtf8(fd.GetPathName()), false); _ParticleDlg->savePSAs(*this, *nt->PS, NLMISC::tStrToUtf8(fd.GetPathName()), false);
} }
} }
} }
@ -1249,7 +1249,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
} }
getOwnerNode(nt)->setModified(true); getOwnerNode(nt)->setModified(true);
// TODO : an enum for CPSLocatedBindable::getType would be better... // TODO : an enum for CPSLocatedBindable::getType would be better...
InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, utf8ToTStr(toCreate->getName()), toCreate->getType(), toCreate->getType(), 0, 0, (LPARAM) newNt, father, lastSon); InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(toCreate->getName()), toCreate->getType(), toCreate->getType(), 0, 0, (LPARAM)newNt, father, lastSon);
touchPSState(nt); touchPSState(nt);
Invalidate(); Invalidate();
_ParticleDlg->StartStopDlg->resetAutoCount(getOwnerNode(nt)); _ParticleDlg->StartStopDlg->resetAutoCount(getOwnerNode(nt));
@ -1280,7 +1280,7 @@ std::pair<CParticleTreeCtrl::CNodeType *, HTREEITEM> CParticleTreeCtrl::createL
CNodeType *newNt = new CNodeType(loc); CNodeType *newNt = new CNodeType(loc);
_NodeTypes.push_back(newNt); _NodeTypes.push_back(newNt);
// insert item in tree // insert item in tree
HTREEITEM insertedItem = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, utf8ToTStr(name), PSIconLocated, PSIconLocated, 0, 0, (LPARAM) newNt, headItem, TVI_LAST); HTREEITEM insertedItem = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(name), PSIconLocated, PSIconLocated, 0, 0, (LPARAM)newNt, headItem, TVI_LAST);
touchPSState(newNt); touchPSState(newNt);
return std::make_pair(newNt, insertedItem); return std::make_pair(newNt, insertedItem);
} }
@ -1299,7 +1299,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{ {
case CNodeType::workspace: case CNodeType::workspace:
{ {
nt->WS->setName(tStrToUtf8(info->item.pszText)); nt->WS->setName(NLMISC::tStrToUtf8(info->item.pszText));
workspaceModifiedFlagChanged(*nt->WS); // change name (this may be called twice because of the modification callback, but this doesn't matter) workspaceModifiedFlagChanged(*nt->WS); // change name (this may be called twice because of the modification callback, but this doesn't matter)
} }
break; break;
@ -1311,10 +1311,10 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
} }
else else
{ {
nt->PS->getPSPointer()->setName(tStrToUtf8(info->item.pszText)); nt->PS->getPSPointer()->setName(NLMISC::tStrToUtf8(info->item.pszText));
nt->PS->setModified(true); nt->PS->setModified(true);
} }
this->SetItemText(info->item.hItem, utf8ToTStr(computeCaption(*nt->PS))); this->SetItemText(info->item.hItem, nlUtf8ToTStr(computeCaption(*nt->PS)));
} }
break; break;
case CNodeType::located: case CNodeType::located:
@ -1322,7 +1322,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
nlassert(getOwnerNode(nt)); nlassert(getOwnerNode(nt));
getOwnerNode(nt)->setModified(true); getOwnerNode(nt)->setModified(true);
this->SetItemText(info->item.hItem, info->item.pszText); this->SetItemText(info->item.hItem, info->item.pszText);
nt->Loc->setName(tStrToUtf8(info->item.pszText)); nt->Loc->setName(NLMISC::tStrToUtf8(info->item.pszText));
} }
break; break;
case CNodeType::locatedBindable: case CNodeType::locatedBindable:
@ -1330,7 +1330,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
nlassert(getOwnerNode(nt)); nlassert(getOwnerNode(nt));
getOwnerNode(nt)->setModified(true); getOwnerNode(nt)->setModified(true);
this->SetItemText(info->item.hItem, info->item.pszText); this->SetItemText(info->item.hItem, info->item.pszText);
nt->Bind->setName(tStrToUtf8(info->item.pszText)); nt->Bind->setName(NLMISC::tStrToUtf8(info->item.pszText));
} }
break; break;
} }
@ -1466,7 +1466,7 @@ void CParticleTreeCtrl::updateCaption(CParticleWorkspace::CNode &node)
HTREEITEM item = getTreeItem(&node); HTREEITEM item = getTreeItem(&node);
if (!item) return; if (!item) return;
// update name of ps to dipslay a star in front of it (this tells that the ps has been modified) // update name of ps to dipslay a star in front of it (this tells that the ps has been modified)
SetItemText(item, utf8ToTStr(computeCaption(node))); SetItemText(item, nlUtf8ToTStr(computeCaption(node)));
} }
//**************************************************************************************************************** //****************************************************************************************************************
@ -1545,7 +1545,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
while (pos) while (pos)
{ {
CString path = fd.GetNextPathName(pos); CString path = fd.GetNextPathName(pos);
CParticleWorkspace::CNode *node = pws.addNode(tStrToUtf8(path)); CParticleWorkspace::CNode *node = pws.addNode(NLMISC::tStrToUtf8(path));
if (!node) if (!node)
{ {
if (diplayNodeAlreadyInserted) if (diplayNodeAlreadyInserted)
@ -1558,7 +1558,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
} }
else else
{ {
MessageBox(CString(utf8ToTStr(NLMISC::CFile::getFilename(tStrToUtf8(path)))) + getStrRsc(IDS_PS_ALREADY_INSERTED), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); MessageBox(CString(nlUtf8ToTStr(NLMISC::CFile::getFilename(NLMISC::tStrToUtf8(path)))) + getStrRsc(IDS_PS_ALREADY_INSERTED), getStrRsc(IDS_ERROR), MB_OK | MB_ICONEXCLAMATION);
} }
} }
continue; continue;
@ -1593,7 +1593,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
} }
} }
// update modified state // update modified state
SetItemText(GetRootItem(), utf8ToTStr(computeCaption(pws))); SetItemText(GetRootItem(), nlUtf8ToTStr(computeCaption(pws)));
} }
} }
@ -1736,7 +1736,7 @@ void CParticleTreeCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
switch (nt->Type) switch (nt->Type)
{ {
case CNodeType::workspace: case CNodeType::workspace:
pEdit->SetWindowText(utf8ToTStr(nt->WS->getName())); pEdit->SetWindowText(nlUtf8ToTStr(nt->WS->getName()));
break; break;
case CNodeType::particleSystem: case CNodeType::particleSystem:
{ {
@ -1747,18 +1747,18 @@ void CParticleTreeCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
} }
else else
{ {
pEdit->SetWindowText(utf8ToTStr(nt->PS->getPSPointer()->getName())); pEdit->SetWindowText(nlUtf8ToTStr(nt->PS->getPSPointer()->getName()));
} }
} }
break; break;
case CNodeType::located: case CNodeType::located:
{ {
pEdit->SetWindowText(utf8ToTStr(nt->Loc->getName())); pEdit->SetWindowText(nlUtf8ToTStr(nt->Loc->getName()));
} }
break; break;
case CNodeType::locatedBindable: case CNodeType::locatedBindable:
{ {
pEdit->SetWindowText(utf8ToTStr(nt->Bind->getName())); pEdit->SetWindowText(nlUtf8ToTStr(nt->Bind->getName()));
} }
break; break;
} }
@ -1855,10 +1855,10 @@ void CParticleTreeCtrl::updateAllCaptions()
switch(nt->Type) switch(nt->Type)
{ {
case CNodeType::particleSystem: case CNodeType::particleSystem:
SetItemText(curr, utf8ToTStr(computeCaption(*nt->PS))); SetItemText(curr, nlUtf8ToTStr(computeCaption(*nt->PS)));
break; break;
case CNodeType::workspace: case CNodeType::workspace:
SetItemText(curr, utf8ToTStr(computeCaption(*nt->WS))); SetItemText(curr, nlUtf8ToTStr(computeCaption(*nt->WS)));
break; break;
case CNodeType::located: case CNodeType::located:
case CNodeType::locatedBindable: case CNodeType::locatedBindable:

View file

@ -371,13 +371,13 @@ CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filena
TCHAR resultPath[MAX_PATH]; TCHAR resultPath[MAX_PATH];
std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath()); std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath());
std::string relativePath; std::string relativePath;
if (!PathRelativePathTo(resultPath, utf8ToTStr(dosPath), FILE_ATTRIBUTE_DIRECTORY, utf8ToTStr(filenameWithFullPath), 0)) if (!PathRelativePathTo(resultPath, nlUtf8ToTStr(dosPath), FILE_ATTRIBUTE_DIRECTORY, nlUtf8ToTStr(filenameWithFullPath), 0))
{ {
relativePath = filenameWithFullPath; relativePath = filenameWithFullPath;
} }
else else
{ {
relativePath = tStrToUtf8(resultPath); relativePath = NLMISC::tStrToUtf8(resultPath);
} }
if (relativePath.size() >= 2) if (relativePath.size() >= 2)

View file

@ -74,7 +74,7 @@ BOOL CPickSound::OnInitDialog()
for (TNameVect::iterator it = _Names.begin(); it != _Names.end(); ++it) for (TNameVect::iterator it = _Names.begin(); it != _Names.end(); ++it)
{ {
m_NameList.AddString(utf8ToTStr((*it).toString())); m_NameList.AddString(nlUtf8ToTStr((*it).toString()));
} }
_Timer = SetTimer (1, 100, NULL); _Timer = SetTimer (1, 100, NULL);
@ -111,7 +111,7 @@ void CPickSound::OnSelchange()
nlassert(m_NameList.GetTextLen(m_NameList.GetCurSel()) < 1024); nlassert(m_NameList.GetTextLen(m_NameList.GetCurSel()) < 1024);
m_NameList.GetText(m_NameList.GetCurSel(), str); m_NameList.GetText(m_NameList.GetCurSel(), str);
_CurrName = NLMISC::CSheetId(tStrToUtf8(str), "sound"); _CurrName = NLMISC::CSheetId(NLMISC::tStrToUtf8(str), "sound");
} }
@ -123,7 +123,7 @@ void CPickSound::OnPlaySound()
stopCurrSource(); stopCurrSource();
CString sName; CString sName;
m_NameList.GetText(curSel, sName); m_NameList.GetText(curSel, sName);
CSoundSystem::create(tStrToUtf8(sName)); CSoundSystem::create(NLMISC::tStrToUtf8(sName));
} }
//======================================================================================== //========================================================================================
@ -159,7 +159,7 @@ void CPickSound::OnDblclkList()
stopCurrSource(); stopCurrSource();
CString sName; CString sName;
m_NameList.GetText(curSel, sName); m_NameList.GetText(curSel, sName);
_CurrSource = CSoundSystem::create(tStrToUtf8(sName)); _CurrSource = CSoundSystem::create(NLMISC::tStrToUtf8(sName));
} }
//======================================================================================== //========================================================================================

View file

@ -126,7 +126,7 @@ void CPrecomputedRotationsDlg::OnUpdateMinRotSpeed()
nlassert(_RotatedParticle); nlassert(_RotatedParticle);
UpdateData(); UpdateData();
float newValue, valueMin, valueMax; float newValue, valueMin, valueMax;
if (NLMISC::fromString(tStrToUtf8(m_RotSpeedMin), newValue)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_RotSpeedMin), newValue))
{ {
uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax); uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
valueMin = newValue; valueMin = newValue;
@ -146,7 +146,7 @@ void CPrecomputedRotationsDlg::OnUpdateMaxRotSpeed()
nlassert(_RotatedParticle); nlassert(_RotatedParticle);
UpdateData(); UpdateData();
float newValue, valueMin, valueMax; float newValue, valueMin, valueMax;
if (NLMISC::fromString(tStrToUtf8(m_RotSpeedMax), newValue)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_RotSpeedMax), newValue))
{ {
uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax); uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
valueMax = newValue; valueMax = newValue;
@ -167,7 +167,7 @@ void CPrecomputedRotationsDlg::OnUpdateNbModels()
UpdateData(); UpdateData();
float valueMin, valueMax; float valueMin, valueMax;
sint32 newNbModels; sint32 newNbModels;
bool valid = (NLMISC::fromString(tStrToUtf8(m_NbModels), newNbModels) && newNbModels > 0); bool valid = (NLMISC::fromString(NLMISC::tStrToUtf8(m_NbModels), newNbModels) && newNbModels > 0);
if (dynamic_cast<NL3D::CPSConstraintMesh *>(_RotatedParticle)) if (dynamic_cast<NL3D::CPSConstraintMesh *>(_RotatedParticle))
{ {
valid &= (newNbModels < NL3D::ConstraintMeshMaxNumPrerotatedModels); valid &= (newNbModels < NL3D::ConstraintMeshMaxNumPrerotatedModels);

View file

@ -120,7 +120,7 @@ void CPSMoverDlg::OnUpdateXpos()
UpdateData(); UpdateData();
NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
float x; float x;
if (NLMISC::fromString(tStrToUtf8(m_X), x)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_X), x))
{ {
pos.x = x; pos.x = x;
updateListener(); updateListener();
@ -137,7 +137,7 @@ void CPSMoverDlg::OnUpdateYpos()
UpdateData(); UpdateData();
NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
float y; float y;
if (NLMISC::fromString(tStrToUtf8(m_Y), y)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_Y), y))
{ {
pos.y = y; pos.y = y;
updateListener(); updateListener();
@ -154,7 +154,7 @@ void CPSMoverDlg::OnUpdateZpos()
UpdateData(); UpdateData();
NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
float z; float z;
if (NLMISC::fromString(tStrToUtf8(m_Z), z)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_Z), z))
{ {
pos.z = z; pos.z = z;
updateListener(); updateListener();
@ -178,7 +178,7 @@ BOOL CPSMoverDlg::OnInitDialog()
{ {
if (dynamic_cast<NL3D::IPSMover *>(_EditedLocated->getBoundObject(k))) if (dynamic_cast<NL3D::IPSMover *>(_EditedLocated->getBoundObject(k)))
{ {
uint insertedLine = m_SubComponentCtrl.AddString(utf8ToTStr(_EditedLocated->getBoundObject(k)->getName())); uint insertedLine = m_SubComponentCtrl.AddString(nlUtf8ToTStr(_EditedLocated->getBoundObject(k)->getName()));
m_SubComponentCtrl.SetItemData(insertedLine, (DWORD_PTR) _EditedLocated->getBoundObject(k)); m_SubComponentCtrl.SetItemData(insertedLine, (DWORD_PTR) _EditedLocated->getBoundObject(k));
++nbCandidates; ++nbCandidates;
} }

View file

@ -84,7 +84,7 @@ void CSchemeBankDlg::buildList()
SchemeManager.getSchemes(_Type, schemes); SchemeManager.getSchemes(_Type, schemes);
for (TSchemeVect::const_iterator it = schemes.begin(); it != schemes.end(); ++it) for (TSchemeVect::const_iterator it = schemes.begin(); it != schemes.end(); ++it)
{ {
int index = m_SchemeList.AddString(utf8ToTStr(it->first)); int index = m_SchemeList.AddString(nlUtf8ToTStr(it->first));
m_SchemeList.SetItemData(index, (DWORD_PTR) it->second); m_SchemeList.SetItemData(index, (DWORD_PTR) it->second);
} }
@ -99,18 +99,18 @@ void CSchemeBankDlg::OnSaveBank()
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add search path for the texture // Add search path for the texture
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName())));
try try
{ {
NLMISC::COFile iF; NLMISC::COFile iF;
iF.open(tStrToUtf8(fd.GetFileName())); iF.open(NLMISC::tStrToUtf8(fd.GetFileName()));
iF.serial(SchemeManager); iF.serial(SchemeManager);
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
std::string message = NLMISC::toString("Error saving scheme bank : %s", e.what()); std::string message = NLMISC::toString("Error saving scheme bank : %s", e.what());
MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); MessageBox(nlUtf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK);
return; return;
} }
} }
@ -124,20 +124,20 @@ void CSchemeBankDlg::OnLoadBank()
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add search path for the texture // Add search path for the texture
NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName())));
CSchemeManager sm; CSchemeManager sm;
try try
{ {
NLMISC::CIFile iF; NLMISC::CIFile iF;
iF.open(NLMISC::CPath::lookup(tStrToUtf8(fd.GetFileName()))); iF.open(NLMISC::CPath::lookup(NLMISC::tStrToUtf8(fd.GetFileName())));
iF.serial(sm); iF.serial(sm);
SchemeManager.swap(sm); SchemeManager.swap(sm);
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
std::string message = NLMISC::toString("Error loading scheme bank : %s", e.what()); std::string message = NLMISC::toString("Error loading scheme bank : %s", e.what());
MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); MessageBox(nlUtf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK);
return; return;
} }
buildList(); buildList();
@ -167,7 +167,7 @@ void CSchemeBankDlg::OnRename()
SchemeManager.rename(scheme, cn.getName()); SchemeManager.rename(scheme, cn.getName());
int curSel = m_SchemeList.GetCurSel(); int curSel = m_SchemeList.GetCurSel();
m_SchemeList.DeleteString(curSel); m_SchemeList.DeleteString(curSel);
int insertedPos = m_SchemeList.InsertString(curSel, utf8ToTStr(cn.getName())); int insertedPos = m_SchemeList.InsertString(curSel, nlUtf8ToTStr(cn.getName()));
m_SchemeList.SetCurSel(insertedPos); m_SchemeList.SetCurSel(insertedPos);
m_SchemeList.Invalidate(); m_SchemeList.Invalidate();
} }

View file

@ -77,14 +77,14 @@ BOOL CSelectString::OnInitDialog()
CDialog::OnInitDialog(); CDialog::OnInitDialog();
// Change title // Change title
SetWindowText (utf8ToTStr(Title)); SetWindowText(nlUtf8ToTStr(Title));
// Empty button ? // Empty button ?
EmptyCtrl.ShowWindow (Empty?SW_SHOW:SW_HIDE); EmptyCtrl.ShowWindow (Empty?SW_SHOW:SW_HIDE);
// Add string // Add string
for (uint s=0; s<Strings.size(); s++) for (uint s=0; s<Strings.size(); s++)
ListCtrl.InsertString (-1, utf8ToTStr(Strings[s])); ListCtrl.InsertString(-1, nlUtf8ToTStr(Strings[s]));
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE // EXCEPTION: OCX Property Pages should return FALSE

View file

@ -209,7 +209,7 @@ void CSkeletonScaleDlg::setSkeletonToEdit(NL3D::CSkeletonModel *skel, const std
name = tabStr + name; name = tabStr + name;
// append to the list // append to the list
_BoneList.AddString(utf8ToTStr(name)); _BoneList.AddString(nlUtf8ToTStr(name));
} }
} }
@ -404,7 +404,7 @@ void CSkeletonScaleDlg::applyScaleSlider(sint scrollValue)
// update marker text // update marker text
std::string str = NLMISC::toString("%d%%", (sint)(factor*100)); std::string str = NLMISC::toString("%d%%", (sint)(factor*100));
_StaticScaleMarkers[_SliderEdited]->SetWindowText(utf8ToTStr(str)); _StaticScaleMarkers[_SliderEdited]->SetWindowText(nlUtf8ToTStr(str));
} }
// *************************************************************************** // ***************************************************************************
@ -717,7 +717,7 @@ void CSkeletonScaleDlg::updateScalesFromText(UINT ctrlId)
return; return;
// get the scale info // get the scale info
std::string str = tStrToUtf8(*_ScaleEdits[sid]); std::string str = NLMISC::tStrToUtf8(*_ScaleEdits[sid]);
if(str.empty()) if(str.empty())
return; return;
float f; float f;
@ -846,13 +846,13 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas()
return; return;
// choose the file // choose the file
CFileDialog fd(FALSE, _T("skel"), utf8ToTStr(_SkeletonFileName), OFN_OVERWRITEPROMPT, _T("SkelFiles (*.skel)|*.skel|All Files (*.*)|*.*||"), this) ; CFileDialog fd(FALSE, _T("skel"), nlUtf8ToTStr(_SkeletonFileName), OFN_OVERWRITEPROMPT, _T("SkelFiles (*.skel)|*.skel|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle = _T("Save As Skeleton"); fd.m_ofn.lpstrTitle = _T("Save As Skeleton");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::COFile f; NLMISC::COFile f;
if( f.open(tStrToUtf8(fd.GetPathName())) ) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
if(saveCurrentInStream(f)) if(saveCurrentInStream(f))
{ {
@ -862,7 +862,7 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas()
} }
// bkup the valid fileName (new file edited) // bkup the valid fileName (new file edited)
_SkeletonFileName= tStrToUtf8(fd.GetPathName()); _SkeletonFileName = NLMISC::tStrToUtf8(fd.GetPathName());
_StaticFileName= _SkeletonFileName.c_str(); _StaticFileName= _SkeletonFileName.c_str();
UpdateData(FALSE); UpdateData(FALSE);
} }
@ -1228,13 +1228,13 @@ void CSkeletonScaleDlg::OnSsdButtonSaveScale()
std::string defaultFileName = _SkeletonFileName; std::string defaultFileName = _SkeletonFileName;
NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); NLMISC::strFindReplace(defaultFileName, ".skel", ".scale");
CFileDialog fd(FALSE, _T("scale"), utf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; CFileDialog fd(FALSE, _T("scale"), nlUtf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle = _T("Save As Skeleton Scale File"); fd.m_ofn.lpstrTitle = _T("Save As Skeleton Scale File");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::COFile f; NLMISC::COFile f;
if (f.open(tStrToUtf8(fd.GetPathName()))) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
saveSkelScaleInStream(f); saveSkelScaleInStream(f);
} }
@ -1256,13 +1256,13 @@ void CSkeletonScaleDlg::OnSsdButtonLoadScale()
std::string defaultFileName= _SkeletonFileName; std::string defaultFileName= _SkeletonFileName;
NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); NLMISC::strFindReplace(defaultFileName, ".skel", ".scale");
CFileDialog fd(TRUE, _T("scale"), utf8ToTStr(defaultFileName), 0, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; CFileDialog fd(TRUE, _T("scale"), nlUtf8ToTStr(defaultFileName), 0, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle= _T("Load a Skeleton Scale File"); fd.m_ofn.lpstrTitle= _T("Load a Skeleton Scale File");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::CIFile f; NLMISC::CIFile f;
if (f.open(tStrToUtf8(fd.GetPathName()))) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
loadSkelScaleFromStream(f); loadSkelScaleFromStream(f);
} }

View file

@ -472,7 +472,7 @@ void CSlotDlg::setWindowName ()
} }
} }
GetDlgItem (IDC_SLOT_NAME)->SetWindowText (utf8ToTStr(tmp)); GetDlgItem(IDC_SLOT_NAME)->SetWindowText(nlUtf8ToTStr(tmp));
} }
// *************************************************************************** // ***************************************************************************

View file

@ -183,7 +183,7 @@ void CSnapshotToolDlg::fromRegistry()
for (uint k = 0; k < filterList.size(); ++k) for (uint k = 0; k < filterList.size(); ++k)
{ {
m_Filters.AddString(utf8ToTStr(filterList[k])); m_Filters.AddString(nlUtf8ToTStr(filterList[k]));
} }
integralTypeFromRegistry(hKey, _T("RecurseSubFolder"), (int &) m_RecurseSubFolder, FALSE); integralTypeFromRegistry(hKey, _T("RecurseSubFolder"), (int &) m_RecurseSubFolder, FALSE);
@ -597,7 +597,7 @@ void CSnapshotToolDlg::OnTimer(UINT_PTR nIDEvent)
try try
{ {
CShapeStream ss; CShapeStream ss;
m_Log.AddString(utf8ToTStr(_FilteredFiles[0])); m_Log.AddString(nlUtf8ToTStr(_FilteredFiles[0]));
CIFile stream(_FilteredFiles[0]); CIFile stream(_FilteredFiles[0]);
ss.serial(stream); ss.serial(stream);
nlassert(ss.getShapePointer()); nlassert(ss.getShapePointer());

View file

@ -78,7 +78,7 @@ void CSoundAnimDlg::handle()
{ {
float sec = _AnimationDlg->getTime(); float sec = _AnimationDlg->getTime();
std::string text = toString("time: %.3f", sec); std::string text = toString("time: %.3f", sec);
GetDlgItem(IDC_SOUNDANIMINFO)->SetWindowText(utf8ToTStr(text)); GetDlgItem(IDC_SOUNDANIMINFO)->SetWindowText(nlUtf8ToTStr(text));
_AnimView.updateCursor(); _AnimView.updateCursor();
} }
@ -136,7 +136,7 @@ void CSoundAnimDlg::updateSounds()
for (iter = sounds.begin(); iter != sounds.end(); iter++) for (iter = sounds.begin(); iter != sounds.end(); iter++)
{ {
list->AddString(utf8ToTStr((*iter).toString())); list->AddString(nlUtf8ToTStr((*iter).toString()));
} }
list->UpdateData(); list->UpdateData();

View file

@ -217,7 +217,7 @@ void CSoundAnimView::save()
// Create a dialog // Create a dialog
TCHAR BASED_CODE szFilter[] = _T("NeL Sound Animations (*.sound_anim)|*.sound_anim|All Files (*.*)|*.*||"); TCHAR BASED_CODE szFilter[] = _T("NeL Sound Animations (*.sound_anim)|*.sound_anim|All Files (*.*)|*.*||");
CFileDialog fileDlg( FALSE, _T(".sound_anim"), utf8ToTStr(filename), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); CFileDialog fileDlg(FALSE, _T(".sound_anim"), nlUtf8ToTStr(filename), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);
if (fileDlg.DoModal() == IDOK) if (fileDlg.DoModal() == IDOK)
{ {
@ -236,7 +236,7 @@ void CSoundAnimView::save()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }

View file

@ -231,13 +231,13 @@ void CStartStopParticleSystem::updateUIFromState()
{ {
if (!_ActiveNode->getParentSkelName().empty()) if (!_ActiveNode->getParentSkelName().empty())
{ {
GetDlgItem(IDC_STICK_BONE)->SetWindowText(utf8ToTStr(_ActiveNode->getParentBoneName() + "." + _ActiveNode->getParentBoneName())); GetDlgItem(IDC_STICK_BONE)->SetWindowText(nlUtf8ToTStr(_ActiveNode->getParentBoneName() + "." + _ActiveNode->getParentBoneName()));
} }
else else
{ {
GetDlgItem(IDC_STICK_BONE)->SetWindowText(_T("")); GetDlgItem(IDC_STICK_BONE)->SetWindowText(_T(""));
} }
GetDlgItem(IDC_ACTIVE_PS)->SetWindowText(utf8ToTStr(_ActiveNode->getFilename())); GetDlgItem(IDC_ACTIVE_PS)->SetWindowText(nlUtf8ToTStr(_ActiveNode->getFilename()));
GetDlgItem(IDC_ENABLE_AUTO_COUNT)->EnableWindow(TRUE); GetDlgItem(IDC_ENABLE_AUTO_COUNT)->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_ENABLE_AUTO_COUNT))->SetCheck(getCurrPS()->getAutoCountFlag() ? 1 : 0); ((CButton *) GetDlgItem(IDC_ENABLE_AUTO_COUNT))->SetCheck(getCurrPS()->getAutoCountFlag() ? 1 : 0);
GetDlgItem(IDC_RESET_COUNT)->EnableWindow((_ActiveNode->getPSPointer()->getAutoCountFlag() && !_ActiveNode->getResetAutoCountFlag()) ? TRUE : FALSE); GetDlgItem(IDC_RESET_COUNT)->EnableWindow((_ActiveNode->getPSPointer()->getAutoCountFlag() && !_ActiveNode->getResetAutoCountFlag()) ? TRUE : FALSE);
@ -844,7 +844,7 @@ void CStartStopParticleSystem::OnLinkToSkeleton()
uint boneIndex; uint boneIndex;
std::string parentSkelName; std::string parentSkelName;
std::string parentBoneName; std::string parentBoneName;
if (ov->chooseBone(tStrToUtf8(chooseBoneForPS), skel, boneIndex, &parentSkelName, &parentBoneName)) if (ov->chooseBone(NLMISC::tStrToUtf8(chooseBoneForPS), skel, boneIndex, &parentSkelName, &parentBoneName))
{ {
_ParticleDlg->stickPSToSkeleton(_ActiveNode, skel, boneIndex, parentSkelName, parentBoneName); _ParticleDlg->stickPSToSkeleton(_ActiveNode, skel, boneIndex, parentSkelName, parentBoneName);
} }
@ -1017,11 +1017,11 @@ void CStartStopParticleSystem::OnBrowseAnim()
} }
} }
std::vector<std::string> animList(animSet.begin(), animSet.end()); std::vector<std::string> animList(animSet.begin(), animSet.end());
CSelectString st(animList, tStrToUtf8(getStrRsc(IDS_SELECT_ANIMATION)), this, false); CSelectString st(animList, NLMISC::tStrToUtf8(getStrRsc(IDS_SELECT_ANIMATION)), this, false);
if (st.DoModal() == IDOK && st.Selection != -1) if (st.DoModal() == IDOK && st.Selection != -1)
{ {
m_TriggerAnim = animList[st.Selection].c_str(); m_TriggerAnim = animList[st.Selection].c_str();
_ActiveNode->setTriggerAnim(tStrToUtf8(m_TriggerAnim)); _ActiveNode->setTriggerAnim(NLMISC::tStrToUtf8(m_TriggerAnim));
GetDlgItem(IDC_CLEAR_ANIM)->EnableWindow(!_ActiveNode->getTriggerAnim().empty()); GetDlgItem(IDC_CLEAR_ANIM)->EnableWindow(!_ActiveNode->getTriggerAnim().empty());
} }
_ParticleDlg->ParticleTreeCtrl->updateCaption(*_ActiveNode); _ParticleDlg->ParticleTreeCtrl->updateCaption(*_ActiveNode);

View file

@ -23,8 +23,13 @@
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX #define NOMINMAX
#define _WIN32_WINNT 0x0501 #ifdef _WIN64
#define _WIN32_WINNT 0x0600
#else
#define _WIN32_WINNT 0x0500
#endif
#include <afxwin.h> // MFC core and standard components #include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions #include <afxext.h> // MFC extensions

View file

@ -179,22 +179,22 @@ void CTextureChooser::OnBrowseTexture()
{ {
texName = (static_cast<NL3D::CTextureFile *>(_Wrapper->get()))->getFileName(); texName = (static_cast<NL3D::CTextureFile *>(_Wrapper->get()))->getFileName();
} }
CFileDialog fd(TRUE, _T(".tga"), utf8ToTStr(texName), 0, NULL, this); CFileDialog fd(TRUE, _T(".tga"), nlUtf8ToTStr(texName), 0, NULL, this);
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add search path for the texture // Add search path for the texture
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName())));
try try
{ {
NL3D::CTextureFile *tf = new NL3D::CTextureFile(tStrToUtf8(fd.GetFileName())); NL3D::CTextureFile *tf = new NL3D::CTextureFile(NLMISC::tStrToUtf8(fd.GetFileName()));
_Wrapper->setAndUpdateModifiedFlag(tf); _Wrapper->setAndUpdateModifiedFlag(tf);
_Texture = tf; _Texture = tf;
textureToBitmap(); textureToBitmap();
} }
catch (const NLMISC::Exception &e) catch (const NLMISC::Exception &e)
{ {
MessageBox(utf8ToTStr(e.what()), _T("error loading texture")); MessageBox(nlUtf8ToTStr(e.what()), _T("error loading texture"));
} }
} }

View file

@ -249,7 +249,7 @@ BOOL CVegetableCopyDlg::OnInitDialog()
uint num= _VegetableDlg->getNumVegetables(); uint num= _VegetableDlg->getNumVegetables();
for(uint i=0; i<num; i++) for(uint i=0; i<num; i++)
{ {
VegetableList.AddString(utf8ToTStr(_VegetableDlg->getVegetableName(i))); VegetableList.AddString(nlUtf8ToTStr(_VegetableDlg->getVegetableName(i)));
} }

View file

@ -100,7 +100,7 @@ void CVegetableDensityPage::setVegetableToEdit(NL3D::CVegetable *vegetable)
{ {
// Init ShapeName // Init ShapeName
// ---------- // ----------
StaticVegetableShape.SetWindowText(utf8ToTStr(_Vegetable->ShapeName)); StaticVegetableShape.SetWindowText(nlUtf8ToTStr(_Vegetable->ShapeName));
// init Creation Distance. // init Creation Distance.
// ---------- // ----------
@ -228,7 +228,7 @@ void CVegetableDensityPage::updateAngleMinFromEditText()
TCHAR stmp[256]; TCHAR stmp[256];
AngleMinEdit.GetWindowText(stmp, 256); AngleMinEdit.GetWindowText(stmp, 256);
float angleMin; float angleMin;
NLMISC::fromString(tStrToUtf8(stmp), angleMin); NLMISC::fromString(NLMISC::tStrToUtf8(stmp), angleMin);
NLMISC::clamp(angleMin, -90, 90); NLMISC::clamp(angleMin, -90, 90);
// make a sinus, because 90 => 1, and -90 =>-1 // make a sinus, because 90 => 1, and -90 =>-1
float cosAngleMin= (float)sin(angleMin*NLMISC::Pi/180.f); float cosAngleMin= (float)sin(angleMin*NLMISC::Pi/180.f);
@ -252,7 +252,7 @@ void CVegetableDensityPage::updateAngleMaxFromEditText()
TCHAR stmp[256]; TCHAR stmp[256];
AngleMaxEdit.GetWindowText(stmp, 256); AngleMaxEdit.GetWindowText(stmp, 256);
float angleMax; float angleMax;
NLMISC::fromString(tStrToUtf8(stmp), angleMax); NLMISC::fromString(NLMISC::tStrToUtf8(stmp), angleMax);
NLMISC::clamp(angleMax, -90, 90); NLMISC::clamp(angleMax, -90, 90);
// make a sinus, because 90 => 1, and -90 =>-1 // make a sinus, because 90 => 1, and -90 =>-1
float cosAngleMax= (float)sin(angleMax*NLMISC::Pi/180.f); float cosAngleMax= (float)sin(angleMax*NLMISC::Pi/180.f);
@ -523,10 +523,10 @@ void CVegetableDensityPage::OnButtonVegetableBrowse()
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add to the path // Add to the path
std::string fileName = tStrToUtf8(fd.GetFileName()); std::string fileName = NLMISC::tStrToUtf8(fd.GetFileName());
// Add search path for the .veget // Add search path for the .veget
std::string path = NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName())); std::string path = NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName()));
NLMISC::CPath::addSearchPath (path); NLMISC::CPath::addSearchPath (path);
try try
@ -546,7 +546,7 @@ void CVegetableDensityPage::OnButtonVegetableBrowse()
} }
catch (const NLMISC::EPathNotFound &ep) catch (const NLMISC::EPathNotFound &ep)
{ {
MessageBox(utf8ToTStr(ep.what()), _T("Can't open file")); MessageBox(nlUtf8ToTStr(ep.what()), _T("Can't open file"));
} }
} }
} }

View file

@ -196,7 +196,7 @@ void CVegetableDlg::updateCurSelVegetableName()
_Vegetables[id].updateVegetableName(); _Vegetables[id].updateVegetableName();
// replace name in the listBox: must delete, and re-insert // replace name in the listBox: must delete, and re-insert
VegetableList.DeleteString(id); VegetableList.DeleteString(id);
VegetableList.InsertString(id, utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.InsertString(id, nlUtf8ToTStr(_Vegetables[id].VegetableName));
VegetableList.SetCurSel(id); VegetableList.SetCurSel(id);
} }
} }
@ -349,14 +349,14 @@ bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const
ok= true; ok= true;
if( f.open(tStrToUtf8(fd.GetPathName()))) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
try try
{ {
// read the vegetable // read the vegetable
f.serial(vegetSet); f.serial(vegetSet);
// bkup fileName. // bkup fileName.
_LastVegetSetName = tStrToUtf8(fd.GetFileName()); _LastVegetSetName = NLMISC::tStrToUtf8(fd.GetFileName());
} }
catch(const NLMISC::EStream &) catch(const NLMISC::EStream &)
{ {
@ -439,7 +439,7 @@ void CVegetableDlg::appendVegetableSet(NL3D::CTileVegetableDesc &vegetSet)
_Vegetables[id].initVegetable(veget); _Vegetables[id].initVegetable(veget);
// update view // update view
VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.AddString(nlUtf8ToTStr(_Vegetables[id].VegetableName));
} }
} }
} }
@ -529,7 +529,7 @@ void CVegetableDlg::OnButtonVegetableAdd()
_Vegetables[id].initDefaultVegetable(); _Vegetables[id].initDefaultVegetable();
// update view // update view
VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.AddString(nlUtf8ToTStr(_Vegetables[id].VegetableName));
// update 3D view // update 3D view
refreshVegetableDisplay(); refreshVegetableDisplay();
@ -559,7 +559,7 @@ void CVegetableDlg::OnButtonVegetableInsert()
_Vegetables[id].initDefaultVegetable(); _Vegetables[id].initDefaultVegetable();
// update view // update view
VegetableList.InsertString(id, utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.InsertString(id, nlUtf8ToTStr(_Vegetables[id].VegetableName));
// update 3D view // update 3D view
refreshVegetableDisplay(); refreshVegetableDisplay();
@ -611,7 +611,7 @@ void CVegetableDlg::OnButtonVegetableLoadDesc()
{ {
NLMISC::CIFile f; NLMISC::CIFile f;
if( f.open(tStrToUtf8(fd.GetPathName())) ) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
NL3D::CVegetable veget; NL3D::CVegetable veget;
try try
@ -624,7 +624,7 @@ void CVegetableDlg::OnButtonVegetableLoadDesc()
_Vegetables[id].initVegetable(veget); _Vegetables[id].initVegetable(veget);
// update view // update view
VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.AddString(nlUtf8ToTStr(_Vegetables[id].VegetableName));
// update 3D view // update 3D view
refreshVegetableDisplay(); refreshVegetableDisplay();
@ -651,13 +651,13 @@ void CVegetableDlg::OnButtonVegetableSaveDesc()
std::string fileName= _Vegetables[id].VegetableName + ".vegetdesc"; std::string fileName= _Vegetables[id].VegetableName + ".vegetdesc";
CFileDialog fd(FALSE, _T("vegetdesc"), utf8ToTStr(fileName), OFN_OVERWRITEPROMPT, _T("VegetDescFiles (*.vegetdesc)|*.vegetdesc|All Files (*.*)|*.*||"), this) ; CFileDialog fd(FALSE, _T("vegetdesc"), nlUtf8ToTStr(fileName), OFN_OVERWRITEPROMPT, _T("VegetDescFiles (*.vegetdesc)|*.vegetdesc|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle = _T("Save Vegetable Descriptor"); fd.m_ofn.lpstrTitle = _T("Save Vegetable Descriptor");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::COFile f; NLMISC::COFile f;
if( f.open(tStrToUtf8(fd.GetPathName())) ) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
try try
{ {
@ -722,13 +722,13 @@ void CVegetableDlg::OnButtonVegetableSaveSet()
buildVegetableSet(vegetSet); buildVegetableSet(vegetSet);
// Then try to save it. // Then try to save it.
CFileDialog fd(FALSE, _T("vegetset"), utf8ToTStr(_LastVegetSetName), OFN_OVERWRITEPROMPT, _T("VegetSetFiles (*.vegetset)|*.vegetset|All Files (*.*)|*.*||"), this) ; CFileDialog fd(FALSE, _T("vegetset"), nlUtf8ToTStr(_LastVegetSetName), OFN_OVERWRITEPROMPT, _T("VegetSetFiles (*.vegetset)|*.vegetset|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle = _T("Save Vegetable Set"); fd.m_ofn.lpstrTitle = _T("Save Vegetable Set");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::COFile f; NLMISC::COFile f;
if( f.open(tStrToUtf8(fd.GetPathName())) ) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
try try
{ {

View file

@ -33,7 +33,7 @@ void CDirectEditableRangeFloat::init(uint32 x, uint32 y, CWnd *pParent)
CRect rect; CRect rect;
rect.SetRect(x, y+10, x+dx, y+25); rect.SetRect(x, y+10, x+dx, y+25);
_StaticText.Create(utf8ToTStr(_Title), WS_CHILD | WS_VISIBLE, rect, pParent); _StaticText.Create(nlUtf8ToTStr(_Title), WS_CHILD | WS_VISIBLE, rect, pParent);
_StaticText.SetFont(pParent->GetFont()); _StaticText.SetFont(pParent->GetFont());
} }

View file

@ -154,7 +154,7 @@ BOOL CVegetableNoiseValueDlg::OnInitDialog()
// Set the name. // Set the name.
NoiseValueName.SetWindowText(utf8ToTStr(_TitleName)); NoiseValueName.SetWindowText(nlUtf8ToTStr(_TitleName));
// if previously setuped, setup now the noiseValue. // if previously setuped, setup now the noiseValue.
@ -264,5 +264,5 @@ void CVegetableNoiseValueDlg::applyScaleSlider(sint scrollValue)
_RandValue->updateValueFromReader(); _RandValue->updateValueFromReader();
// update marker text // update marker text
StaticScaleMarker.SetWindowText(utf8ToTStr(NLMISC::toString("%d%%", (sint)(factor * 100)))); StaticScaleMarker.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%d%%", (sint)(factor * 100))));
} }

View file

@ -63,7 +63,7 @@ BOOL CVegetableSelectDlg::OnInitDialog()
uint num= _VegetableDlg->getNumVegetables(); uint num= _VegetableDlg->getNumVegetables();
for(uint i=0; i<num; i++) for(uint i=0; i<num; i++)
{ {
VegetableList.AddString(utf8ToTStr(_VegetableDlg->getVegetableName(i))); VegetableList.AddString(nlUtf8ToTStr(_VegetableDlg->getVegetableName(i)));
} }
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control

View file

@ -73,19 +73,19 @@ void CVegetableWindDlg::updateView()
// update Power. // update Power.
a= _ObjViewer->getVegetableWindPower(); a= _ObjViewer->getVegetableWindPower();
StaticPower.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticPower.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_POWER); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_POWER);
SliderPower.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_POWER)); SliderPower.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_POWER));
// update BendStart. // update BendStart.
a= _ObjViewer->getVegetableWindBendStart(); a= _ObjViewer->getVegetableWindBendStart();
StaticBendStart.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticBendStart.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART);
SliderBendStart.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART)); SliderBendStart.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART));
// update Frequency. // update Frequency.
a= _ObjViewer->getVegetableWindFrequency(); a= _ObjViewer->getVegetableWindFrequency();
StaticFrequency.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticFrequency.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY);
SliderFrequency.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY)); SliderFrequency.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY));
@ -129,20 +129,20 @@ void CVegetableWindDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBa
{ {
a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_POWER / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_POWER / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
_ObjViewer->setVegetableWindPower(a); _ObjViewer->setVegetableWindPower(a);
StaticPower.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticPower.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
} }
else if(sliderCtrl == &SliderBendStart) else if(sliderCtrl == &SliderBendStart)
{ {
a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
_ObjViewer->setVegetableWindBendStart(a); _ObjViewer->setVegetableWindBendStart(a);
StaticBendStart.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticBendStart.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
} }
else if(sliderCtrl == &SliderFrequency) else if(sliderCtrl == &SliderFrequency)
{ {
a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
_ObjViewer->setVegetableWindFrequency(a); _ObjViewer->setVegetableWindFrequency(a);
StaticFrequency.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticFrequency.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
} }
} }
else else

View file

@ -166,7 +166,7 @@ BOOL CWaterPoolEditor::OnInitDialog()
int CWaterPoolEditor::addPool(uint32 ID) int CWaterPoolEditor::addPool(uint32 ID)
{ {
std::string poolId = NLMISC::toString("%d (%s)", ID, _Wpm->getPoolByID(ID).getName().c_str()); std::string poolId = NLMISC::toString("%d (%s)", ID, _Wpm->getPoolByID(ID).getName().c_str());
int index = m_PoolList.AddString(utf8ToTStr(poolId)); int index = m_PoolList.AddString(nlUtf8ToTStr(poolId));
nlassert(index != LB_ERR); nlassert(index != LB_ERR);
m_PoolList.SetItemData(index, ID); m_PoolList.SetItemData(index, ID);
return index; return index;
@ -357,7 +357,7 @@ void CWaterPoolEditor::OnLoadPool()
{ {
NLMISC::CIXml iXml; NLMISC::CIXml iXml;
NLMISC::CIFile iF; NLMISC::CIFile iF;
if (iF.open(tStrToUtf8(fileDlg.GetPathName()))) if (iF.open(NLMISC::tStrToUtf8(fileDlg.GetPathName())))
{ {
if (iXml.init (iF)) if (iXml.init (iF))
{ {
@ -369,17 +369,17 @@ void CWaterPoolEditor::OnLoadPool()
else else
{ {
iF.close(); iF.close();
MessageBox (utf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
else else
{ {
MessageBox (utf8ToTStr(NLMISC::toString("Unable to open file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to open file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
catch (const NLMISC::Exception& e) catch (const NLMISC::Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -395,7 +395,7 @@ void CWaterPoolEditor::OnSavePool()
{ {
NLMISC::COXml oXml; NLMISC::COXml oXml;
NLMISC::COFile oF; NLMISC::COFile oF;
if (oF.open(tStrToUtf8(fileDlg.GetPathName()))) if (oF.open(NLMISC::tStrToUtf8(fileDlg.GetPathName())))
{ {
if (oXml.init (&oF)) if (oXml.init (&oF))
{ {
@ -406,17 +406,17 @@ void CWaterPoolEditor::OnSavePool()
else else
{ {
oF.close(); oF.close();
MessageBox (utf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
else else
{ {
MessageBox (utf8ToTStr(NLMISC::toString("Unable to open file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to open file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
catch (const NLMISC::Exception& e) catch (const NLMISC::Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }

View file

@ -23,8 +23,13 @@
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX #define NOMINMAX
#define _WIN32_WINNT 0x0501 #ifdef _WIN64
#define _WIN32_WINNT 0x0600
#else
#define _WIN32_WINNT 0x0500
#endif
#include <windows.h> #include <windows.h>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -91,7 +91,7 @@ Value* export_shape_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Ok ? // Ok ?
Boolean *ret=&false_value; Boolean *ret=&false_value;
@ -154,12 +154,12 @@ Value* export_shape_ex_cf (Value** arg_list, int count)
nlassert(node->GetName()); nlassert(node->GetName());
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Ex argu // Ex argu
theExportSceneStruct.bShadow = arg_list[2]->to_bool()!=FALSE; theExportSceneStruct.bShadow = arg_list[2]->to_bool()!=FALSE;
theExportSceneStruct.bExportLighting = arg_list[3]->to_bool()!=FALSE; theExportSceneStruct.bExportLighting = arg_list[3]->to_bool()!=FALSE;
theExportSceneStruct.sExportLighting = tStrToUtf8(arg_list[4]->to_string()); theExportSceneStruct.sExportLighting = MCharStrToUtf8(arg_list[4]->to_string());
theExportSceneStruct.nExportLighting = arg_list[5]->to_int(); theExportSceneStruct.nExportLighting = arg_list[5]->to_int();
theExportSceneStruct.rLumelSize = arg_list[6]->to_float(); theExportSceneStruct.rLumelSize = arg_list[6]->to_float();
theExportSceneStruct.nOverSampling = arg_list[7]->to_int(); theExportSceneStruct.nOverSampling = arg_list[7]->to_int();
@ -220,7 +220,7 @@ Value* export_skeleton_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Ok ? // Ok ?
Boolean *ret=&false_value; Boolean *ret=&false_value;
@ -260,7 +260,7 @@ Value* export_animation_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Get time // Get time
TimeValue time=MAXScript_interface->GetTime(); TimeValue time=MAXScript_interface->GetTime();
@ -298,7 +298,7 @@ Value* export_animation_cf (Value** arg_list, int count)
else else
{ {
// Error message // Error message
mprintf (_M("Error exporting animation %s in the file\n%s\n"), (*vectNode.begin())->GetName(), utf8ToTStr(sPath)); mprintf(_M("Error exporting animation %s in the file\n%s\n"), (*vectNode.begin())->GetName(), MaxTStrFromUtf8(sPath).data());
} }
} }
} }
@ -352,7 +352,7 @@ Value* export_ig_cf (Value** arg_list, int count)
vect.push_back (array->get (i+1)->to_node()); vect.push_back (array->get (i+1)->to_node());
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Export // Export
if (theCNelExport.exportInstanceGroup (sPath, vect)) if (theCNelExport.exportInstanceGroup (sPath, vect))
@ -411,7 +411,7 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count)
vect.push_back (array->get (i+1)->to_node()); vect.push_back (array->get (i+1)->to_node());
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Export // Export
if (theCNelExport.exportSWT (sPath, vect)) if (theCNelExport.exportSWT (sPath, vect))
@ -462,8 +462,8 @@ Value* test_file_date_cf (Value** arg_list, int count)
// Make sure we have the correct number of arguments (2) // Make sure we have the correct number of arguments (2)
check_arg_count(view_shape, 2, count); check_arg_count(view_shape, 2, count);
type_check (arg_list[0], 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]")); type_check(arg_list[1], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]"));
// Get a good interface pointer // Get a good interface pointer
Interface *ip = MAXScript_interface; Interface *ip = MAXScript_interface;
@ -471,11 +471,11 @@ Value* test_file_date_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// The 2 filenames // The 2 filenames
string file0 = tStrToUtf8(arg_list[0]->to_string()); WStr file0 = arg_list[0]->to_string();
string file1 = tStrToUtf8(arg_list[1]->to_string()); WStr file1 = arg_list[1]->to_string();
// Open it // Open it
FILE *file=nlfopen (file0.c_str(), "r"); FILE *file= nlfopen(ucstring((const ucchar *)file0.data()).toUtf8().c_str(), "r");
if (file == NULL) if (file == NULL)
return &true_value; return &true_value;
@ -486,10 +486,10 @@ Value* test_file_date_cf (Value** arg_list, int count)
Value *ret = &undefined; Value *ret = &undefined;
// Create first file // Create first file
HANDLE h0 = CreateFile (utf8ToTStr(file0), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE h0 = CreateFileW((LPCWSTR)file0.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h0!=INVALID_HANDLE_VALUE) if (h0!=INVALID_HANDLE_VALUE)
{ {
HANDLE h1 = CreateFile (utf8ToTStr(file1), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE h1 = CreateFileW((LPCWSTR)file1.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h1!=INVALID_HANDLE_VALUE) if (h1!=INVALID_HANDLE_VALUE)
{ {
// Get file time // Get file time
@ -536,7 +536,7 @@ Value* export_vegetable_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Message in dialog // Message in dialog
bool dialogMessage = arg_list[2]->to_bool() != FALSE; bool dialogMessage = arg_list[2]->to_bool() != FALSE;
@ -615,7 +615,7 @@ Value* export_collision_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
string sPath = tStrToUtf8(arg_list[1]->to_string()); string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Get time // Get time
TimeValue time = MAXScript_interface->GetTime(); TimeValue time = MAXScript_interface->GetTime();
@ -674,7 +674,7 @@ Value* export_pacs_primitives_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
string sPath = tStrToUtf8(arg_list[1]->to_string()); string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Get time // Get time
TimeValue time = MAXScript_interface->GetTime(); TimeValue time = MAXScript_interface->GetTime();
@ -733,7 +733,7 @@ Value* export_lod_character_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// Export path // Export path
std::string sPath = tStrToUtf8(arg_list[1]->to_string()); std::string sPath = MCharStrToUtf8(arg_list[1]->to_string());
// Message in dialog // Message in dialog
bool dialogMessage = arg_list[2]->to_bool() != FALSE; bool dialogMessage = arg_list[2]->to_bool() != FALSE;
@ -879,18 +879,18 @@ Value* get_file_modification_date_cf (Value** arg_list, int count)
type_check (arg_list[0], String, message); type_check (arg_list[0], String, message);
// get the node // get the node
string sPath = tStrToUtf8(arg_list[0]->to_string()); WStr sPath = arg_list[0]->to_string();
// get vertices indices // get vertices indices
string result; string result;
HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFileW((LPCWSTR)sPath.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file) if (file)
{ {
FILETIME lastWriteTime; FILETIME lastWriteTime;
if (GetFileTime(file, NULL, NULL, &lastWriteTime)) if (GetFileTime(file, NULL, NULL, &lastWriteTime))
{ {
char number[512]; char number[512];
sprintf (number, "%08x%08x", lastWriteTime.dwHighDateTime, lastWriteTime.dwLowDateTime); sprintf(number, "%08x%08x", lastWriteTime.dwHighDateTime, lastWriteTime.dwLowDateTime);
result = number; result = number;
} }
CloseHandle (file); CloseHandle (file);
@ -899,7 +899,7 @@ Value* get_file_modification_date_cf (Value** arg_list, int count)
if (result.empty()) if (result.empty())
return &undefined; return &undefined;
else else
return new String(utf8ToTStr(result)); return new String(MaxTStrFromUtf8(result));
} }
// *************************************************************************** // ***************************************************************************
@ -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."); MCHAR *message = _M("bool NeLSetFileModificationDate [filename] [date] - If an error occurred, returns false.");
//type_check //type_check
type_check (arg_list[0], String, message); type_check(arg_list[0], String, message);
type_check (arg_list[1], String, message); type_check(arg_list[1], String, message);
// get the node // get the node
string sPath = tStrToUtf8(arg_list[0]->to_string()); WStr sPath = arg_list[0]->to_string();
string sDate = tStrToUtf8(arg_list[1]->to_string()); WStr sDate = arg_list[1]->to_string();
// get vertices indices // get vertices indices
string result; string result;
HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFileW(sPath.data(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file) if (file)
{ {
FILETIME lastWriteTime; FILETIME lastWriteTime;
if (sscanf (sDate.c_str(), "%08x%08x", &lastWriteTime.dwHighDateTime, &lastWriteTime.dwLowDateTime) == 2) if (swscanf(sDate.data(), L"%08x%08x", &lastWriteTime.dwHighDateTime, &lastWriteTime.dwLowDateTime) == 2)
{ {
if (SetFileTime(file, NULL, NULL, &lastWriteTime)) if (SetFileTime(file, NULL, NULL, &lastWriteTime))
{ {
CloseHandle (file); CloseHandle(file);
return &true_value; 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 // Store them in the temporary list
aSWNodes.resize(nNumNode+3); aSWNodes.resize(nNumNode+3);
aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name = MCharStrToUtf8(pNode->GetName());
aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getRotQuatValueName(); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getRotQuatValueName();
aSWNodes[nNumNode].Weight = rRotValue; aSWNodes[nNumNode].Weight = rRotValue;
++nNumNode; ++nNumNode;
aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name = MCharStrToUtf8(pNode->GetName());
aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getPosValueName (); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getPosValueName ();
aSWNodes[nNumNode].Weight = rPosValue; aSWNodes[nNumNode].Weight = rPosValue;
++nNumNode; ++nNumNode;
aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name = MCharStrToUtf8(pNode->GetName());
aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getScaleValueName(); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getScaleValueName();
aSWNodes[nNumNode].Weight = rScaleValue; aSWNodes[nNumNode].Weight = rScaleValue;
++nNumNode; ++nNumNode;

View file

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

View file

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

View file

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

View file

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

View file

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

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

View file

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

View file

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

View file

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

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

View file

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

Some files were not shown because too many files have changed in this diff Show more