diff --git a/unreal/Puerts/Source/JsEnv/Public/StaticCall.hpp b/unreal/Puerts/Source/JsEnv/Public/StaticCall.hpp index ebf44232ef..aafcd938a2 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...); }