diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-10-20 23:20:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-20 23:20:32 +0200 |
commit | bf88c3c8e8c9afa9d6be5a4a0158f62becdd3486 (patch) | |
tree | a77929294f1d134a55f3b8b280ec56b12bfa2521 /modules/visual_script | |
parent | 08ebbc90a85ce15e1db2eab3ff3c25d7da1a4246 (diff) | |
parent | 7fb57ecbd9457d8d2f7cb8264e9c51530ea1967a (diff) |
Merge pull request #12097 from rcurtis/issue12065
Visualscript: Fixes untouched value is null instead of 0
Diffstat (limited to 'modules/visual_script')
-rw-r--r-- | modules/visual_script/visual_script_builtin_funcs.cpp | 9 | ||||
-rw-r--r-- | 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 1980f86114..4b294325dc 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 <VisualScriptBuiltinFunc::BuiltinFunc func> static Ref<VisualScriptNode> create_builtin_func_node(const String &p_name) { - Ref<VisualScriptBuiltinFunc> node; - node.instance(); - node->set_func(func); + Ref<VisualScriptBuiltinFunc> 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 af24f16a2f..5758d23e8f 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(); }; |