diff options
| author | Juan Linietsky <reduzio@gmail.com> | 2016-08-08 01:21:22 -0300 |
|---|---|---|
| committer | Juan Linietsky <reduzio@gmail.com> | 2016-08-08 01:21:22 -0300 |
| commit | 9865650b43c2a924f5e3ed4ffdaac56c87328756 (patch) | |
| tree | f32bb974d4ea39076d830f07ad163da8cae42b68 /modules/visual_script/visual_script.cpp | |
| parent | cfbdeeffec74f9c8c8d7ddac9b31eb32c85ddf89 (diff) | |
| download | redot-engine-9865650b43c2a924f5e3ed4ffdaac56c87328756.tar.gz | |
Added a simpler way to do sub-functions in both visual and gdscript with the subcall node.
With this, visual script is almost done (missing registering custom nodes from addon).
All this is probably pretty broken, too and needs a lot of testing.
Diffstat (limited to 'modules/visual_script/visual_script.cpp')
| -rw-r--r-- | modules/visual_script/visual_script.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index e688075596..425436d907 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -1015,6 +1015,36 @@ void VisualScript::get_method_list(List<MethodInfo> *p_list) const { } } +bool VisualScript::has_method(const StringName& p_method) const { + + return functions.has(p_method); +} +MethodInfo VisualScript::get_method_info(const StringName& p_method) const{ + + const Map<StringName,Function>::Element *E=functions.find(p_method); + if (!E) + return MethodInfo(); + + MethodInfo mi; + mi.name=E->key(); + if (E->get().function_id>=0) { + + Ref<VisualScriptFunction> func=E->get().nodes[E->get().function_id].node; + if (func.is_valid()) { + + for(int i=0;i<func->get_argument_count();i++) { + PropertyInfo arg; + arg.name=func->get_argument_name(i); + arg.type=func->get_argument_type(i); + mi.arguments.push_back(arg); + } + } + } + + return mi; +} + + void VisualScript::_set_data(const Dictionary& p_data) { Dictionary d = p_data; @@ -2550,7 +2580,7 @@ VisualScriptLanguage::VisualScriptLanguage() { notification="_notification"; _get_output_port_unsequenced="_get_output_port_unsequenced"; _step="_step"; - + _subcall="_subcall"; singleton=this; #ifndef NO_THREADS lock = Mutex::create(); |
