From 50be04111624b5443bafbc4c1b80c3cfaa623fc4 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 30 Mar 2020 02:43:28 +0800 Subject: [PATCH] Fix plugin build for 3ds Max 9 --- .../nel_3dsmax_shared/string_common.h | 22 ++++--------------- .../plugin_max/nel_patch_converter/script.cpp | 2 +- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h b/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h index 737b1a5dd..4a331a78a 100644 --- a/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h +++ b/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h @@ -21,6 +21,7 @@ #define NLMAX_STRING_COMMON_H #include +#include #if (MAX_VERSION_MAJOR < 15) #define GET_OBJECT_NAME_CONST @@ -37,9 +38,7 @@ 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(); + dst = nlUtf8ToTStr(src); #else dst.FromUTF8(src.c_str()); #endif @@ -49,14 +48,7 @@ static TSTR MaxTStrFromUtf8(const std::string &src) 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 + return NLMISC::tStrToUtf8(src.data()); #else return src.ToUTF8().data(); #endif @@ -64,13 +56,7 @@ static std::string MaxTStrToUtf8(const TSTR& src) 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 + return NLMISC::tStrToUtf8(src); } #endif /* #ifndef NLMAX_STRING_COMMON_H */ diff --git a/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp b/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp index 2c2f100f7..48bf1d921 100644 --- a/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp +++ b/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp @@ -1271,7 +1271,7 @@ Value* get_patch_vertex_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - const MCHAR *message= _M("NeLGetPatchVertex [NeLPatchMesh] [PatchId] [VertexId]"); + MCHAR *message= _M("NeLGetPatchVertex [NeLPatchMesh] [PatchId] [VertexId]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], Integer, message); type_check(arg_list[2], Integer, message);