mirror of
https://github.com/godotengine/godot
synced 2024-11-02 14:43:31 +00:00
Add @GDScript.type_exists
This commit is contained in:
parent
57c67fb0f7
commit
71245995a4
2 changed files with 16 additions and 0 deletions
|
@ -87,6 +87,7 @@ const char *GDFunctions::get_func_name(Function p_func) {
|
||||||
"funcref",
|
"funcref",
|
||||||
"convert",
|
"convert",
|
||||||
"typeof",
|
"typeof",
|
||||||
|
"type_exists",
|
||||||
"str",
|
"str",
|
||||||
"print",
|
"print",
|
||||||
"printt",
|
"printt",
|
||||||
|
@ -531,6 +532,12 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
|
||||||
VALIDATE_ARG_COUNT(1);
|
VALIDATE_ARG_COUNT(1);
|
||||||
r_ret = p_args[0]->get_type();
|
r_ret = p_args[0]->get_type();
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case TYPE_EXISTS: {
|
||||||
|
|
||||||
|
VALIDATE_ARG_COUNT(1);
|
||||||
|
r_ret = ObjectTypeDB::type_exists(*p_args[0]);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case TEXT_STR: {
|
case TEXT_STR: {
|
||||||
|
|
||||||
|
@ -1126,6 +1133,7 @@ bool GDFunctions::is_deterministic(Function p_func) {
|
||||||
case LOGIC_NEAREST_PO2:
|
case LOGIC_NEAREST_PO2:
|
||||||
case TYPE_CONVERT:
|
case TYPE_CONVERT:
|
||||||
case TYPE_OF:
|
case TYPE_OF:
|
||||||
|
case TYPE_EXISTS:
|
||||||
case TEXT_STR:
|
case TEXT_STR:
|
||||||
case COLOR8:
|
case COLOR8:
|
||||||
// enable for debug only, otherwise not desirable - case GEN_RANGE:
|
// enable for debug only, otherwise not desirable - case GEN_RANGE:
|
||||||
|
@ -1388,6 +1396,13 @@ MethodInfo GDFunctions::get_info(Function p_func) {
|
||||||
mi.return_val.type=Variant::INT;
|
mi.return_val.type=Variant::INT;
|
||||||
return mi;
|
return mi;
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case TYPE_EXISTS: {
|
||||||
|
|
||||||
|
MethodInfo mi("type_exists",PropertyInfo(Variant::STRING,"type"));
|
||||||
|
mi.return_val.type=Variant::BOOL;
|
||||||
|
return mi;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case TEXT_STR: {
|
case TEXT_STR: {
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ public:
|
||||||
FUNC_FUNCREF,
|
FUNC_FUNCREF,
|
||||||
TYPE_CONVERT,
|
TYPE_CONVERT,
|
||||||
TYPE_OF,
|
TYPE_OF,
|
||||||
|
TYPE_EXISTS,
|
||||||
TEXT_STR,
|
TEXT_STR,
|
||||||
TEXT_PRINT,
|
TEXT_PRINT,
|
||||||
TEXT_PRINT_TABBED,
|
TEXT_PRINT_TABBED,
|
||||||
|
|
Loading…
Reference in a new issue