diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 1980f861142..4b294325dc3 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -1280,6 +1280,11 @@ void VisualScriptBuiltinFunc::_bind_methods() { BIND_ENUM_CONSTANT(FUNC_MAX); } +VisualScriptBuiltinFunc::VisualScriptBuiltinFunc(VisualScriptBuiltinFunc::BuiltinFunc func) { + + this->func = func; +} + VisualScriptBuiltinFunc::VisualScriptBuiltinFunc() { func = MATH_SIN; @@ -1288,9 +1293,7 @@ VisualScriptBuiltinFunc::VisualScriptBuiltinFunc() { template static Ref create_builtin_func_node(const String &p_name) { - Ref node; - node.instance(); - node->set_func(func); + Ref node = memnew(VisualScriptBuiltinFunc(func)); return node; } diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index af24f16a2f3..5758d23e8fd 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -132,6 +132,7 @@ public: virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); + VisualScriptBuiltinFunc(VisualScriptBuiltinFunc::BuiltinFunc func); VisualScriptBuiltinFunc(); };