From 31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 13 Mar 2014 22:57:24 -0300 Subject: -fix bug in cache for atlas import/export -fix some menus -fixed bug in out transition curves -detect and remove file:/// in collada -remove multiscript for now -remove dependencies on mouse in OS, moved to Input -avoid fscache from screwing up (fix might make it slower, but it works) -funcref was missing, it's there now --- modules/gdscript/gd_functions.cpp | 41 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'modules/gdscript/gd_functions.cpp') diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index 2930d9322c..c099c3f33c 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -31,6 +31,7 @@ #include "object_type_db.h" #include "reference.h" #include "gd_script.h" +#include "func_ref.h" #include "os/os.h" const char *GDFunctions::get_func_name(Function p_func) { @@ -80,6 +81,7 @@ const char *GDFunctions::get_func_name(Function p_func) { "clamp", "nearest_po2", "weakref", + "funcref", "convert", "typeof", "str", @@ -451,6 +453,36 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va + } break; + case FUNC_FUNCREF: { + VALIDATE_ARG_COUNT(2); + if (p_args[0]->get_type()!=Variant::OBJECT) { + + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::OBJECT; + r_ret=Variant(); + return; + + } + if (p_args[1]->get_type()!=Variant::STRING && p_args[1]->get_type()!=Variant::NODE_PATH) { + + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=1; + r_error.expected=Variant::STRING; + r_ret=Variant(); + return; + + } + + Ref fr = memnew( FuncRef); + + Object *obj = *p_args[0]; + fr->set_instance(*p_args[0]); + fr->set_function(*p_args[1]); + + r_ret=fr; + } break; case TYPE_CONVERT: { VALIDATE_ARG_COUNT(2); @@ -678,7 +710,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va } r_ret=ResourceLoader::load(*p_args[0]); - } + } break; case INST2DICT: { VALIDATE_ARG_COUNT(1); @@ -1129,6 +1161,13 @@ MethodInfo GDFunctions::get_info(Function p_func) { mi.return_val.type=Variant::OBJECT; return mi; + } break; + case FUNC_FUNCREF: { + + MethodInfo mi("funcref",PropertyInfo(Variant::OBJECT,"instance"),PropertyInfo(Variant::STRING,"funcname")); + mi.return_val.type=Variant::OBJECT; + return mi; + } break; case TYPE_CONVERT: { -- cgit v1.2.3 From 9f33134c93ecbadda70e8eefc50563e29b2eb7f2 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 5 Apr 2014 12:39:30 -0300 Subject: =?UTF-8?q?-Support=20for=20changing=20fonts=20-Detect=20when=20fr?= =?UTF-8?q?ee()=20might=20crash=20the=20project=20and=20throw=20error=20-f?= =?UTF-8?q?ixed=202D=20Bounce=20in=20physics=20(3d=20still=20broken)=20-re?= =?UTF-8?q?named=20=E2=80=9Con=5Ftop=E2=80=9D=20property=20to=20=E2=80=9Cb?= =?UTF-8?q?ehind=5Fparent=E2=80=9D,=20which=20makes=20more=20sense,=20old?= =?UTF-8?q?=20on=5Ftop=20remains=20there=20for=20compatibility=20but=20is?= =?UTF-8?q?=20invisible.=20-large=20amount=20of=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gdscript/gd_functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gdscript/gd_functions.cpp') diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index c099c3f33c..f789493ae8 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -1095,7 +1095,7 @@ MethodInfo GDFunctions::get_info(Function p_func) { return mi; } break; case MATH_RAND: { - MethodInfo mi("rand"); + MethodInfo mi("randi"); mi.return_val.type=Variant::INT; return mi; } break; -- cgit v1.2.3