From 7fb57ecbd9457d8d2f7cb8264e9c51530ea1967a Mon Sep 17 00:00:00 2001 From: RCurtis Date: Sat, 14 Oct 2017 14:55:09 -0400 Subject: [PATCH] Fixed issue that improperly initialized visual node properties to Nil --- modules/visual_script/visual_script_builtin_funcs.cpp | 9 ++++++--- modules/visual_script/visual_script_builtin_funcs.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 972be5f5a46..c5afb2a8f59 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -1236,6 +1236,11 @@ void VisualScriptBuiltinFunc::_bind_methods() { BIND_ENUM_CONSTANT(FUNC_MAX); } +VisualScriptBuiltinFunc::VisualScriptBuiltinFunc(VisualScriptBuiltinFunc::BuiltinFunc func) { + + this->func = func; +} + VisualScriptBuiltinFunc::VisualScriptBuiltinFunc() { func = MATH_SIN; @@ -1244,9 +1249,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 97ab307039e..9e8aae15845 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -130,6 +130,7 @@ public: virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); + VisualScriptBuiltinFunc(VisualScriptBuiltinFunc::BuiltinFunc func); VisualScriptBuiltinFunc(); };