From 9865650b43c2a924f5e3ed4ffdaac56c87328756 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 8 Aug 2016 01:21:22 -0300 Subject: 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. --- modules/visual_script/visual_script.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'modules/visual_script/visual_script.cpp') diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index e68807559..425436d90 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 *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::Element *E=functions.find(p_method); + if (!E) + return MethodInfo(); + + MethodInfo mi; + mi.name=E->key(); + if (E->get().function_id>=0) { + + Ref func=E->get().nodes[E->get().function_id].node; + if (func.is_valid()) { + + for(int i=0;iget_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(); -- cgit v1.2.3-70-g09d2