From 283f45bb039202f4727d306908619f386290a16b Mon Sep 17 00:00:00 2001 From: johnche Date: Thu, 21 Nov 2024 12:07:45 +0800 Subject: [PATCH] =?UTF-8?q?[unreal]=E8=A7=A3=E5=86=B3=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=AF=B9=E4=BA=8Econst=20SomeClass=20&?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC=E4=BC=9A?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E5=88=B0=E5=B7=B2=E7=BB=8F=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E6=A0=88=E5=8F=98=E9=87=8F=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?fix=20https://github.com/Tencent/puerts/issues/1924?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Puerts/Source/JsEnv/Public/StaticCall.hpp | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/unreal/Puerts/Source/JsEnv/Public/StaticCall.hpp b/unreal/Puerts/Source/JsEnv/Public/StaticCall.hpp index ebf44232ef4..aafcd938a25 100644 --- a/unreal/Puerts/Source/JsEnv/Public/StaticCall.hpp +++ b/unreal/Puerts/Source/JsEnv/Public/StaticCall.hpp @@ -379,6 +379,11 @@ struct FuncCallHelper>, CheckArguments, return Arg; } + void SetArgument(typename ArgumentType::type InArg) + { + Arg = InArg; + } + void SetRef(typename API::ContextType context, typename API::ValueType holder) { } @@ -418,6 +423,11 @@ struct FuncCallHelper>, CheckArguments, return Arg; } + void SetArgument(typename ArgumentType::type InArg) + { + Arg = InArg; + } + void SetRef(typename API::ContextType context, typename API::ValueType holder) { if (&Buf != &(Arg.get())) @@ -452,6 +462,11 @@ struct FuncCallHelper>, CheckArguments, return Arg; } + void SetArgument(typename ArgumentType::type InArg) + { + Arg = InArg; + } + void SetRef(typename API::ContextType context, typename API::ValueType holder) { } @@ -476,6 +491,15 @@ struct FuncCallHelper>, CheckArguments, return Arg; } + using BuffType = typename std::remove_const::type>::type; + BuffType Buf; + + void SetArgument(BuffType InArg) + { + Buf = InArg; + Arg = Buf; + } + void SetRef(typename API::ContextType context, typename API::ValueType holder) { } @@ -501,6 +525,11 @@ struct FuncCallHelper>, CheckArguments, return Arg; } + void SetArgument(typename ArgumentType::type InArg) + { + Arg = InArg; + } + void SetRef(typename API::ContextType context, typename API::ValueType holder) { API::UpdateRefValue(context, holder, API::template Converter::type>::toScript(context, Arg)); @@ -527,6 +556,11 @@ struct FuncCallHelper>, CheckArguments, return Arg ? Arg : &Buf; } + void SetArgument(BuffType InArg) + { + Buf = InArg; + } + void SetRef(typename API::ContextType context, typename API::ValueType holder) { API::UpdateRefValue(context, holder, API::template Converter::toScript(context, Buf)); @@ -551,6 +585,11 @@ struct FuncCallHelper>, CheckArguments, return Arg; } + void SetArgument(T InArg) + { + Arg = InArg; + } + void SetRef(typename API::ContextType context, typename API::ValueType holder) { } @@ -574,6 +613,11 @@ struct FuncCallHelper>, CheckArguments, return Arg; } + void SetArgument(typename ArgumentType::type InArg) + { + Arg = InArg; + } + void SetRef(typename API::ContextType context, typename API::ValueType holder) { } @@ -615,7 +659,7 @@ struct FuncCallHelper>, CheckArguments, { if (argCount <= Pos) { - std::get(cppArgHolders).Arg = defaultValue; + std::get(cppArgHolders).SetArgument(defaultValue); } DefaultValueSetter<0, Pos + 1, FullArgs...>::Set(cppArgHolders, argCount, rest...); }