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/gdscript/gd_script.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'modules/gdscript/gd_script.cpp') diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index cc46d91a2d..2f5c7956d1 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -262,10 +262,37 @@ void GDScript::get_method_list(List *p_list) const { mi.arguments.push_back(arg); } - mi.return_val.name="var"; + mi.return_val.name="Variant"; p_list->push_back(mi); } } + +bool GDScript::has_method(const StringName& p_method) const { + + return member_functions.has(p_method); +} + +MethodInfo GDScript::get_method_info(const StringName& p_method) const { + + const Map::Element *E=member_functions.find(p_method); + if (!E) + return MethodInfo(); + + MethodInfo mi; + mi.name=E->key(); + for(int i=0;iget()->get_argument_count();i++) { + PropertyInfo arg; + arg.type=Variant::NIL; //variant + arg.name=E->get()->get_argument_name(i); + mi.arguments.push_back(arg); + } + + mi.return_val.name="Variant"; + return mi; + +} + + bool GDScript::get_property_default_value(const StringName& p_property, Variant &r_value) const { #ifdef TOOLS_ENABLED @@ -1239,6 +1266,8 @@ void GDInstance::call_multilevel_reversed(const StringName& p_method,const Varia } } + + void GDInstance::notification(int p_notification) { //notification is not virutal, it gets called at ALL levels just like in C. -- cgit v1.2.3