2017-03-05 14:47:28 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* visual_script_builtin_funcs.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2017-03-05 14:47:28 +00:00
|
|
|
/*************************************************************************/
|
2022-01-03 20:27:34 +00:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2017-03-05 14:47:28 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2016-08-02 22:11:05 +00:00
|
|
|
#include "visual_script_builtin_funcs.h"
|
2017-03-05 14:47:28 +00:00
|
|
|
|
2018-09-11 16:13:45 +00:00
|
|
|
#include "core/io/marshalls.h"
|
|
|
|
#include "core/math/math_funcs.h"
|
2020-11-07 22:33:38 +00:00
|
|
|
#include "core/object/class_db.h"
|
2021-06-04 16:03:15 +00:00
|
|
|
#include "core/object/ref_counted.h"
|
2018-09-11 16:13:45 +00:00
|
|
|
#include "core/os/os.h"
|
2020-11-07 22:33:38 +00:00
|
|
|
#include "core/variant/variant_parser.h"
|
2016-08-02 22:11:05 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX] = {
|
2016-08-02 22:11:05 +00:00
|
|
|
"sin",
|
|
|
|
"cos",
|
|
|
|
"tan",
|
|
|
|
"sinh",
|
|
|
|
"cosh",
|
|
|
|
"tanh",
|
|
|
|
"asin",
|
|
|
|
"acos",
|
|
|
|
"atan",
|
|
|
|
"atan2",
|
|
|
|
"sqrt",
|
|
|
|
"fmod",
|
|
|
|
"fposmod",
|
|
|
|
"floor",
|
|
|
|
"ceil",
|
|
|
|
"round",
|
|
|
|
"abs",
|
|
|
|
"sign",
|
|
|
|
"pow",
|
|
|
|
"log",
|
|
|
|
"exp",
|
|
|
|
"is_nan",
|
|
|
|
"is_inf",
|
|
|
|
"ease",
|
2020-02-12 10:14:34 +00:00
|
|
|
"step_decimals",
|
2020-12-21 18:02:57 +00:00
|
|
|
"snapped",
|
2016-08-02 22:11:05 +00:00
|
|
|
"lerp",
|
2017-10-13 12:47:07 +00:00
|
|
|
"inverse_lerp",
|
|
|
|
"range_lerp",
|
2019-04-07 21:40:56 +00:00
|
|
|
"move_toward",
|
2016-08-02 22:11:05 +00:00
|
|
|
"randomize",
|
|
|
|
"randi",
|
|
|
|
"randf",
|
2020-07-26 10:52:24 +00:00
|
|
|
"randi_range",
|
2021-06-21 09:58:31 +00:00
|
|
|
"randf_range",
|
|
|
|
"randfn",
|
2016-08-02 22:11:05 +00:00
|
|
|
"seed",
|
|
|
|
"rand_seed",
|
|
|
|
"deg2rad",
|
|
|
|
"rad2deg",
|
|
|
|
"linear2db",
|
|
|
|
"db2linear",
|
2017-10-11 17:38:55 +00:00
|
|
|
"wrapi",
|
|
|
|
"wrapf",
|
2021-10-15 13:25:00 +00:00
|
|
|
"pingpong",
|
2016-08-02 22:11:05 +00:00
|
|
|
"max",
|
|
|
|
"min",
|
|
|
|
"clamp",
|
|
|
|
"nearest_po2",
|
|
|
|
"weakref",
|
|
|
|
"convert",
|
|
|
|
"typeof",
|
|
|
|
"type_exists",
|
2016-10-03 16:17:54 +00:00
|
|
|
"char",
|
2016-08-02 22:11:05 +00:00
|
|
|
"str",
|
|
|
|
"print",
|
|
|
|
"printerr",
|
|
|
|
"printraw",
|
2021-09-20 17:14:27 +00:00
|
|
|
"print_verbose",
|
2016-08-02 22:11:05 +00:00
|
|
|
"var2str",
|
|
|
|
"str2var",
|
|
|
|
"var2bytes",
|
|
|
|
"bytes2var",
|
2019-03-19 11:39:43 +00:00
|
|
|
"smoothstep",
|
2018-10-27 20:12:27 +00:00
|
|
|
"posmod",
|
2019-07-14 04:30:45 +00:00
|
|
|
"lerp_angle",
|
2019-09-02 20:20:49 +00:00
|
|
|
"ord",
|
2016-08-02 22:11:05 +00:00
|
|
|
};
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptBuiltinFunc::BuiltinFunc VisualScriptBuiltinFunc::find_function(const String &p_string) {
|
|
|
|
for (int i = 0; i < FUNC_MAX; i++) {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_string == func_name[i]) {
|
2016-09-06 22:12:28 +00:00
|
|
|
return BuiltinFunc(i);
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FUNC_MAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
String VisualScriptBuiltinFunc::get_func_name(BuiltinFunc p_func) {
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_INDEX_V(p_func, FUNC_MAX, String());
|
2016-09-06 22:12:28 +00:00
|
|
|
return func_name[p_func];
|
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
|
|
|
|
int VisualScriptBuiltinFunc::get_output_sequence_port_count() const {
|
2016-08-31 02:44:14 +00:00
|
|
|
return has_input_sequence_port() ? 1 : 0;
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
bool VisualScriptBuiltinFunc::has_input_sequence_port() const {
|
|
|
|
switch (func) {
|
2016-08-31 02:44:14 +00:00
|
|
|
case MATH_RANDOMIZE:
|
|
|
|
case TEXT_PRINT:
|
|
|
|
case TEXT_PRINTERR:
|
|
|
|
case TEXT_PRINTRAW:
|
2021-09-20 17:14:27 +00:00
|
|
|
case TEXT_PRINT_VERBOSE:
|
2021-05-08 18:37:42 +00:00
|
|
|
case MATH_SEED:
|
2016-08-31 02:44:14 +00:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) {
|
2017-03-05 15:44:50 +00:00
|
|
|
switch (p_func) {
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_RANDOMIZE:
|
2020-07-26 10:52:24 +00:00
|
|
|
case MATH_RANDI:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_RANDF:
|
|
|
|
return 0;
|
|
|
|
case MATH_SIN:
|
|
|
|
case MATH_COS:
|
|
|
|
case MATH_TAN:
|
|
|
|
case MATH_SINH:
|
|
|
|
case MATH_COSH:
|
|
|
|
case MATH_TANH:
|
|
|
|
case MATH_ASIN:
|
|
|
|
case MATH_ACOS:
|
|
|
|
case MATH_ATAN:
|
|
|
|
case MATH_SQRT:
|
|
|
|
case MATH_FLOOR:
|
|
|
|
case MATH_CEIL:
|
|
|
|
case MATH_ROUND:
|
|
|
|
case MATH_ABS:
|
|
|
|
case MATH_SIGN:
|
|
|
|
case MATH_LOG:
|
|
|
|
case MATH_EXP:
|
|
|
|
case MATH_ISNAN:
|
|
|
|
case MATH_ISINF:
|
2020-02-12 10:14:34 +00:00
|
|
|
case MATH_STEP_DECIMALS:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_SEED:
|
|
|
|
case MATH_RANDSEED:
|
|
|
|
case MATH_DEG2RAD:
|
|
|
|
case MATH_RAD2DEG:
|
|
|
|
case MATH_LINEAR2DB:
|
|
|
|
case MATH_DB2LINEAR:
|
|
|
|
case LOGIC_NEAREST_PO2:
|
|
|
|
case OBJ_WEAKREF:
|
|
|
|
case TYPE_OF:
|
2016-10-03 16:17:54 +00:00
|
|
|
case TEXT_CHAR:
|
2019-09-02 20:20:49 +00:00
|
|
|
case TEXT_ORD:
|
2016-08-02 22:11:05 +00:00
|
|
|
case TEXT_STR:
|
|
|
|
case TEXT_PRINT:
|
|
|
|
case TEXT_PRINTERR:
|
|
|
|
case TEXT_PRINTRAW:
|
2021-09-20 17:14:27 +00:00
|
|
|
case TEXT_PRINT_VERBOSE:
|
2016-08-02 22:11:05 +00:00
|
|
|
case VAR_TO_STR:
|
|
|
|
case STR_TO_VAR:
|
|
|
|
case TYPE_EXISTS:
|
|
|
|
return 1;
|
2019-03-26 15:52:42 +00:00
|
|
|
case VAR_TO_BYTES:
|
|
|
|
case BYTES_TO_VAR:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_ATAN2:
|
|
|
|
case MATH_FMOD:
|
|
|
|
case MATH_FPOSMOD:
|
2018-10-27 20:12:27 +00:00
|
|
|
case MATH_POSMOD:
|
2021-10-15 13:25:00 +00:00
|
|
|
case MATH_PINGPONG:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_POW:
|
|
|
|
case MATH_EASE:
|
2020-12-21 18:02:57 +00:00
|
|
|
case MATH_SNAPPED:
|
2020-07-26 10:52:24 +00:00
|
|
|
case MATH_RANDI_RANGE:
|
2021-06-21 09:58:31 +00:00
|
|
|
case MATH_RANDF_RANGE:
|
|
|
|
case MATH_RANDFN:
|
2016-08-02 22:11:05 +00:00
|
|
|
case LOGIC_MAX:
|
|
|
|
case LOGIC_MIN:
|
|
|
|
case TYPE_CONVERT:
|
|
|
|
return 2;
|
|
|
|
case MATH_LERP:
|
2019-07-14 04:30:45 +00:00
|
|
|
case MATH_LERP_ANGLE:
|
2017-10-13 12:47:07 +00:00
|
|
|
case MATH_INVERSE_LERP:
|
2019-03-19 11:39:43 +00:00
|
|
|
case MATH_SMOOTHSTEP:
|
2019-04-07 21:40:56 +00:00
|
|
|
case MATH_MOVE_TOWARD:
|
2017-10-11 17:38:55 +00:00
|
|
|
case MATH_WRAP:
|
|
|
|
case MATH_WRAPF:
|
2016-08-02 22:11:05 +00:00
|
|
|
case LOGIC_CLAMP:
|
|
|
|
return 3;
|
2017-10-13 12:47:07 +00:00
|
|
|
case MATH_RANGE_LERP:
|
|
|
|
return 5;
|
2017-03-05 15:44:50 +00:00
|
|
|
case FUNC_MAX: {
|
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2016-09-06 22:12:28 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
int VisualScriptBuiltinFunc::get_input_value_port_count() const {
|
2016-09-06 22:12:28 +00:00
|
|
|
return get_func_argument_count(func);
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
int VisualScriptBuiltinFunc::get_output_value_port_count() const {
|
|
|
|
switch (func) {
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_RANDOMIZE:
|
|
|
|
case TEXT_PRINT:
|
|
|
|
case TEXT_PRINTERR:
|
|
|
|
case TEXT_PRINTRAW:
|
2021-09-20 17:14:27 +00:00
|
|
|
case TEXT_PRINT_VERBOSE:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_SEED:
|
|
|
|
return 0;
|
|
|
|
case MATH_RANDSEED:
|
|
|
|
return 2;
|
|
|
|
default:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
String VisualScriptBuiltinFunc::get_output_sequence_port_text(int p_port) const {
|
|
|
|
return String();
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const {
|
|
|
|
switch (func) {
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_SIN:
|
|
|
|
case MATH_COS:
|
|
|
|
case MATH_TAN:
|
|
|
|
case MATH_SINH:
|
|
|
|
case MATH_COSH:
|
|
|
|
case MATH_TANH:
|
|
|
|
case MATH_ASIN:
|
|
|
|
case MATH_ACOS:
|
|
|
|
case MATH_ATAN:
|
2018-10-27 20:12:27 +00:00
|
|
|
case MATH_SQRT:
|
|
|
|
case MATH_FLOOR:
|
|
|
|
case MATH_CEIL:
|
|
|
|
case MATH_ROUND:
|
|
|
|
case MATH_ABS:
|
|
|
|
case MATH_SIGN:
|
|
|
|
case MATH_LOG:
|
|
|
|
case MATH_EXP:
|
|
|
|
case MATH_ISNAN:
|
|
|
|
case MATH_ISINF: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "s");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2018-09-16 19:27:54 +00:00
|
|
|
case MATH_ATAN2: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "y");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "x");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2018-09-16 19:27:54 +00:00
|
|
|
} break;
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_FMOD:
|
2018-10-27 20:12:27 +00:00
|
|
|
case MATH_FPOSMOD:
|
|
|
|
case LOGIC_MAX:
|
|
|
|
case LOGIC_MIN: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "a");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "b");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2018-10-27 20:12:27 +00:00
|
|
|
case MATH_POSMOD: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
2018-10-27 20:12:27 +00:00
|
|
|
return PropertyInfo(Variant::INT, "a");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
2018-10-27 20:12:27 +00:00
|
|
|
return PropertyInfo(Variant::INT, "b");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_POW: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "base");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "exp");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_EASE: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "s");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "curve");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2020-02-12 10:14:34 +00:00
|
|
|
case MATH_STEP_DECIMALS: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "step");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2020-12-21 18:02:57 +00:00
|
|
|
case MATH_SNAPPED: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "s");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "steps");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2018-10-27 20:12:27 +00:00
|
|
|
case MATH_LERP:
|
2019-07-14 04:30:45 +00:00
|
|
|
case MATH_LERP_ANGLE:
|
|
|
|
case MATH_INVERSE_LERP:
|
|
|
|
case MATH_SMOOTHSTEP: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "from");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else if (p_idx == 1) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "to");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "weight");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2017-10-13 12:47:07 +00:00
|
|
|
} break;
|
|
|
|
case MATH_RANGE_LERP: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "value");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else if (p_idx == 1) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "istart");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else if (p_idx == 2) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "istop");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else if (p_idx == 3) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "ostart");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "ostop");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2019-04-07 21:40:56 +00:00
|
|
|
case MATH_MOVE_TOWARD: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "from");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else if (p_idx == 1) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "to");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "delta");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2019-04-07 21:40:56 +00:00
|
|
|
} break;
|
2018-10-27 20:12:27 +00:00
|
|
|
case MATH_RANDOMIZE:
|
2020-07-26 10:52:24 +00:00
|
|
|
case MATH_RANDI:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_RANDF: {
|
|
|
|
} break;
|
2021-06-21 09:58:31 +00:00
|
|
|
case MATH_RANDI_RANGE: {
|
|
|
|
if (p_idx == 0) {
|
|
|
|
return PropertyInfo(Variant::INT, "from");
|
|
|
|
} else {
|
|
|
|
return PropertyInfo(Variant::INT, "to");
|
|
|
|
}
|
|
|
|
} break;
|
2020-07-26 10:52:24 +00:00
|
|
|
case MATH_RANDF_RANGE: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "from");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "to");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2021-06-21 09:58:31 +00:00
|
|
|
case MATH_RANDFN: {
|
2020-07-26 10:52:24 +00:00
|
|
|
if (p_idx == 0) {
|
2021-06-21 09:58:31 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "mean");
|
2020-07-26 10:52:24 +00:00
|
|
|
} else {
|
2021-06-21 09:58:31 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "deviation");
|
2020-07-26 10:52:24 +00:00
|
|
|
}
|
|
|
|
} break;
|
2018-10-27 20:12:27 +00:00
|
|
|
case MATH_SEED:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_RANDSEED: {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::INT, "seed");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_DEG2RAD: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "deg");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_RAD2DEG: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "rad");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_LINEAR2DB: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "nrg");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_DB2LINEAR: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "db");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2021-10-15 13:25:00 +00:00
|
|
|
case MATH_PINGPONG: {
|
|
|
|
if (p_idx == 0) {
|
|
|
|
return PropertyInfo(Variant::FLOAT, "value");
|
|
|
|
} else {
|
|
|
|
return PropertyInfo(Variant::FLOAT, "length");
|
|
|
|
}
|
|
|
|
} break;
|
2017-10-11 17:38:55 +00:00
|
|
|
case MATH_WRAP: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
2017-10-11 17:38:55 +00:00
|
|
|
return PropertyInfo(Variant::INT, "value");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else if (p_idx == 1) {
|
2017-10-11 17:38:55 +00:00
|
|
|
return PropertyInfo(Variant::INT, "min");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
2017-10-11 17:38:55 +00:00
|
|
|
return PropertyInfo(Variant::INT, "max");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2017-10-11 17:38:55 +00:00
|
|
|
} break;
|
2018-10-27 20:12:27 +00:00
|
|
|
case MATH_WRAPF:
|
2016-08-02 22:11:05 +00:00
|
|
|
case LOGIC_CLAMP: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "value");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else if (p_idx == 1) {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "min");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
return PropertyInfo(Variant::FLOAT, "max");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case LOGIC_NEAREST_PO2: {
|
2018-01-16 16:31:10 +00:00
|
|
|
return PropertyInfo(Variant::INT, "value");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case OBJ_WEAKREF: {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::OBJECT, "source");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case TYPE_CONVERT: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::NIL, "what");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::STRING, "type");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case TYPE_OF: {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::NIL, "what");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case TYPE_EXISTS: {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::STRING, "type");
|
2016-10-03 16:17:54 +00:00
|
|
|
} break;
|
2019-09-02 20:20:49 +00:00
|
|
|
case TEXT_ORD: {
|
|
|
|
return PropertyInfo(Variant::STRING, "character");
|
|
|
|
} break;
|
2016-10-03 16:17:54 +00:00
|
|
|
case TEXT_CHAR: {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::INT, "ascii");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2018-10-27 20:12:27 +00:00
|
|
|
case TEXT_STR:
|
|
|
|
case TEXT_PRINT:
|
|
|
|
case TEXT_PRINTERR:
|
2021-09-20 17:14:27 +00:00
|
|
|
case TEXT_PRINTRAW:
|
|
|
|
case TEXT_PRINT_VERBOSE: {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::NIL, "value");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case STR_TO_VAR: {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::STRING, "string");
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2018-10-27 20:12:27 +00:00
|
|
|
case VAR_TO_STR:
|
2016-08-02 22:11:05 +00:00
|
|
|
case VAR_TO_BYTES: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
2019-03-26 15:52:42 +00:00
|
|
|
return PropertyInfo(Variant::NIL, "var");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
2019-03-26 15:52:42 +00:00
|
|
|
return PropertyInfo(Variant::BOOL, "full_objects");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
|
|
|
|
} break;
|
|
|
|
case BYTES_TO_VAR: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
2020-02-17 21:06:54 +00:00
|
|
|
return PropertyInfo(Variant::PACKED_BYTE_ARRAY, "bytes");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
2019-03-26 15:52:42 +00:00
|
|
|
return PropertyInfo(Variant::BOOL, "allow_objects");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2017-03-05 15:44:50 +00:00
|
|
|
case FUNC_MAX: {
|
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return PropertyInfo();
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) const {
|
|
|
|
Variant::Type t = Variant::NIL;
|
|
|
|
switch (func) {
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_SIN:
|
|
|
|
case MATH_COS:
|
|
|
|
case MATH_TAN:
|
|
|
|
case MATH_SINH:
|
|
|
|
case MATH_COSH:
|
|
|
|
case MATH_TANH:
|
|
|
|
case MATH_ASIN:
|
|
|
|
case MATH_ACOS:
|
|
|
|
case MATH_ATAN:
|
|
|
|
case MATH_ATAN2:
|
|
|
|
case MATH_SQRT:
|
|
|
|
case MATH_FMOD:
|
|
|
|
case MATH_FPOSMOD:
|
|
|
|
case MATH_FLOOR:
|
2016-08-04 01:06:39 +00:00
|
|
|
case MATH_CEIL: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
t = Variant::FLOAT;
|
2016-08-04 01:06:39 +00:00
|
|
|
} break;
|
2020-04-14 21:08:22 +00:00
|
|
|
case MATH_POSMOD: {
|
|
|
|
t = Variant::INT;
|
|
|
|
} break;
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_ROUND: {
|
2020-04-13 17:02:40 +00:00
|
|
|
t = Variant::FLOAT;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_ABS: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::NIL;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_SIGN: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::NIL;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_POW:
|
|
|
|
case MATH_LOG:
|
|
|
|
case MATH_EXP: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
t = Variant::FLOAT;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_ISNAN:
|
|
|
|
case MATH_ISINF: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::BOOL;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_EASE: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
t = Variant::FLOAT;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2020-02-12 10:14:34 +00:00
|
|
|
case MATH_STEP_DECIMALS: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::INT;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2020-12-21 18:02:57 +00:00
|
|
|
case MATH_SNAPPED:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_LERP:
|
2019-07-14 04:30:45 +00:00
|
|
|
case MATH_LERP_ANGLE:
|
2017-10-13 12:47:07 +00:00
|
|
|
case MATH_INVERSE_LERP:
|
|
|
|
case MATH_RANGE_LERP:
|
2019-03-19 11:39:43 +00:00
|
|
|
case MATH_SMOOTHSTEP:
|
2019-04-07 21:40:56 +00:00
|
|
|
case MATH_MOVE_TOWARD:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_RANDOMIZE: {
|
|
|
|
} break;
|
2020-07-26 10:52:24 +00:00
|
|
|
case MATH_RANDI: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::INT;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_RANDF:
|
2021-06-21 09:58:31 +00:00
|
|
|
case MATH_RANDFN:
|
2020-07-26 10:52:24 +00:00
|
|
|
case MATH_RANDF_RANGE: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
t = Variant::FLOAT;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2020-07-26 10:52:24 +00:00
|
|
|
case MATH_RANDI_RANGE: {
|
|
|
|
t = Variant::INT;
|
|
|
|
} break;
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_SEED: {
|
|
|
|
} break;
|
|
|
|
case MATH_RANDSEED: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::INT, "rnd");
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(Variant::INT, "seed");
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case MATH_DEG2RAD:
|
|
|
|
case MATH_RAD2DEG:
|
|
|
|
case MATH_LINEAR2DB:
|
2017-10-11 17:38:55 +00:00
|
|
|
case MATH_WRAPF:
|
2021-10-15 13:25:00 +00:00
|
|
|
case MATH_PINGPONG:
|
2016-08-02 22:11:05 +00:00
|
|
|
case MATH_DB2LINEAR: {
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
t = Variant::FLOAT;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
2017-10-11 17:38:55 +00:00
|
|
|
case MATH_WRAP: {
|
|
|
|
t = Variant::INT;
|
|
|
|
} break;
|
2016-08-02 22:11:05 +00:00
|
|
|
case LOGIC_MAX:
|
|
|
|
case LOGIC_MIN:
|
|
|
|
case LOGIC_CLAMP: {
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case LOGIC_NEAREST_PO2: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::NIL;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case OBJ_WEAKREF: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::OBJECT;
|
2016-08-02 22:11:05 +00:00
|
|
|
|
|
|
|
} break;
|
|
|
|
case TYPE_CONVERT: {
|
|
|
|
} break;
|
2019-09-02 20:20:49 +00:00
|
|
|
case TEXT_ORD:
|
2016-08-02 22:11:05 +00:00
|
|
|
case TYPE_OF: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::INT;
|
2016-08-02 22:11:05 +00:00
|
|
|
|
|
|
|
} break;
|
|
|
|
case TYPE_EXISTS: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::BOOL;
|
2016-08-02 22:11:05 +00:00
|
|
|
|
|
|
|
} break;
|
2016-10-03 16:17:54 +00:00
|
|
|
case TEXT_CHAR:
|
2016-08-02 22:11:05 +00:00
|
|
|
case TEXT_STR: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::STRING;
|
2016-08-02 22:11:05 +00:00
|
|
|
|
|
|
|
} break;
|
|
|
|
case TEXT_PRINT: {
|
|
|
|
} break;
|
|
|
|
case TEXT_PRINTERR: {
|
|
|
|
} break;
|
|
|
|
case TEXT_PRINTRAW: {
|
|
|
|
} break;
|
2021-09-20 17:14:27 +00:00
|
|
|
case TEXT_PRINT_VERBOSE: {
|
|
|
|
} break;
|
2016-08-02 22:11:05 +00:00
|
|
|
case VAR_TO_STR: {
|
2017-03-05 15:44:50 +00:00
|
|
|
t = Variant::STRING;
|
2016-08-02 22:11:05 +00:00
|
|
|
} break;
|
|
|
|
case STR_TO_VAR: {
|
|
|
|
} break;
|
|
|
|
case VAR_TO_BYTES: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 0) {
|
2020-02-17 21:06:54 +00:00
|
|
|
t = Variant::PACKED_BYTE_ARRAY;
|
2020-05-14 14:41:43 +00:00
|
|
|
} else {
|
2019-03-26 15:52:42 +00:00
|
|
|
t = Variant::BOOL;
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
|
|
|
|
} break;
|
|
|
|
case BYTES_TO_VAR: {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (p_idx == 1) {
|
2019-03-26 15:52:42 +00:00
|
|
|
t = Variant::BOOL;
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2016-11-10 21:06:00 +00:00
|
|
|
} break;
|
2017-03-05 15:44:50 +00:00
|
|
|
case FUNC_MAX: {
|
|
|
|
}
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
return PropertyInfo(t, "");
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
|
2018-04-29 23:28:31 +00:00
|
|
|
/*
|
2016-08-02 22:11:05 +00:00
|
|
|
String VisualScriptBuiltinFunc::get_caption() const {
|
|
|
|
return "BuiltinFunc";
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2018-04-29 23:28:31 +00:00
|
|
|
*/
|
2016-08-02 22:11:05 +00:00
|
|
|
|
2018-04-29 23:28:31 +00:00
|
|
|
String VisualScriptBuiltinFunc::get_caption() const {
|
2016-08-02 22:11:05 +00:00
|
|
|
return func_name[func];
|
|
|
|
}
|
|
|
|
|
|
|
|
void VisualScriptBuiltinFunc::set_func(BuiltinFunc p_which) {
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_INDEX(p_which, FUNC_MAX);
|
|
|
|
func = p_which;
|
2021-02-10 20:18:45 +00:00
|
|
|
notify_property_list_changed();
|
2016-08-04 01:06:39 +00:00
|
|
|
ports_changed_notify();
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VisualScriptBuiltinFunc::BuiltinFunc VisualScriptBuiltinFunc::get_func() {
|
|
|
|
return func;
|
|
|
|
}
|
|
|
|
|
2020-02-19 19:27:19 +00:00
|
|
|
#define VALIDATE_ARG_NUM(m_arg) \
|
|
|
|
if (!p_inputs[m_arg]->is_num()) { \
|
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \
|
|
|
|
r_error.argument = m_arg; \
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
r_error.expected = Variant::FLOAT; \
|
2020-02-19 19:27:19 +00:00
|
|
|
return; \
|
2016-08-06 01:46:45 +00:00
|
|
|
}
|
|
|
|
|
2020-02-19 19:27:19 +00:00
|
|
|
void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return, Callable::CallError &r_error, String &r_error_str) {
|
2017-03-05 15:44:50 +00:00
|
|
|
switch (p_func) {
|
2016-09-06 22:12:28 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_SIN: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::sin((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_COS: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::cos((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_TAN: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::tan((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_SINH: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::sinh((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_COSH: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::cosh((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_TANH: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::tanh((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_ASIN: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::asin((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_ACOS: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::acos((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_ATAN: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::atan((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_ATAN2: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::atan2((double)*p_inputs[0], (double)*p_inputs[1]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_SQRT: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::sqrt((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_FMOD: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::fmod((double)*p_inputs[0], (double)*p_inputs[1]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_FPOSMOD: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::fposmod((double)*p_inputs[0], (double)*p_inputs[1]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2018-10-27 20:12:27 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_POSMOD: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2021-05-04 10:51:03 +00:00
|
|
|
*r_return = Math::posmod((int64_t)*p_inputs[0], (int64_t)*p_inputs[1]);
|
2018-10-27 20:12:27 +00:00
|
|
|
} break;
|
2016-09-06 22:12:28 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_FLOOR: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::floor((double)*p_inputs[0]);
|
|
|
|
} break;
|
2016-09-06 22:12:28 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_CEIL: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::ceil((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_ROUND: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::round((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_ABS: {
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_inputs[0]->get_type() == Variant::INT) {
|
2016-09-06 22:12:28 +00:00
|
|
|
int64_t i = *p_inputs[0];
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = ABS(i);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
} else if (p_inputs[0]->get_type() == Variant::FLOAT) {
|
2016-09-06 22:12:28 +00:00
|
|
|
real_t r = *p_inputs[0];
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::abs(r);
|
2016-09-06 22:12:28 +00:00
|
|
|
} else {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2017-03-05 15:44:50 +00:00
|
|
|
r_error.argument = 0;
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
r_error.expected = Variant::FLOAT;
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_SIGN: {
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_inputs[0]->get_type() == Variant::INT) {
|
|
|
|
int64_t i = *p_inputs[0];
|
|
|
|
*r_return = i < 0 ? -1 : (i > 0 ? +1 : 0);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
} else if (p_inputs[0]->get_type() == Variant::FLOAT) {
|
2017-03-05 15:44:50 +00:00
|
|
|
real_t r = *p_inputs[0];
|
|
|
|
*r_return = r < 0.0 ? -1.0 : (r > 0.0 ? +1.0 : 0.0);
|
|
|
|
} else {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2017-03-05 15:44:50 +00:00
|
|
|
r_error.argument = 0;
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
r_error.expected = Variant::FLOAT;
|
2017-03-05 15:44:50 +00:00
|
|
|
}
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_POW: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::pow((double)*p_inputs[0], (double)*p_inputs[1]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_LOG: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::log((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_EXP: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::exp((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_ISNAN: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::is_nan((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_ISINF: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::is_inf((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_EASE: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::ease((double)*p_inputs[0], (double)*p_inputs[1]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2020-02-12 10:14:34 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_STEP_DECIMALS: {
|
2016-09-06 22:12:28 +00:00
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::step_decimals((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2020-12-21 18:02:57 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_SNAPPED: {
|
2016-09-06 22:12:28 +00:00
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2020-12-21 18:02:57 +00:00
|
|
|
*r_return = Math::snapped((double)*p_inputs[0], (double)*p_inputs[1]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_LERP: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
VALIDATE_ARG_NUM(2);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2019-07-14 04:30:45 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_LERP_ANGLE: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
VALIDATE_ARG_NUM(2);
|
|
|
|
*r_return = Math::lerp_angle((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]);
|
|
|
|
} break;
|
2017-10-13 12:47:07 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_INVERSE_LERP: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
VALIDATE_ARG_NUM(2);
|
|
|
|
*r_return = Math::inverse_lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]);
|
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_RANGE_LERP: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
VALIDATE_ARG_NUM(2);
|
|
|
|
VALIDATE_ARG_NUM(3);
|
|
|
|
VALIDATE_ARG_NUM(4);
|
|
|
|
*r_return = Math::range_lerp((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2], (double)*p_inputs[3], (double)*p_inputs[4]);
|
|
|
|
} break;
|
2019-03-19 11:39:43 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_SMOOTHSTEP: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
VALIDATE_ARG_NUM(2);
|
|
|
|
*r_return = Math::smoothstep((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]);
|
|
|
|
} break;
|
2019-04-07 21:40:56 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_MOVE_TOWARD: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
VALIDATE_ARG_NUM(2);
|
|
|
|
*r_return = Math::move_toward((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]);
|
|
|
|
} break;
|
2016-09-06 22:12:28 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_RANDOMIZE: {
|
|
|
|
Math::randomize();
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2020-07-26 10:52:24 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_RANDI: {
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::rand();
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_RANDF: {
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::randf();
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2021-11-17 15:52:44 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_RANDI_RANGE: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
*r_return = Math::random((int)*p_inputs[0], (int)*p_inputs[1]);
|
|
|
|
} break;
|
2020-07-26 10:52:24 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_RANDF_RANGE: {
|
2016-09-06 22:12:28 +00:00
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::random((double)*p_inputs[0], (double)*p_inputs[1]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2021-11-17 15:52:44 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_RANDFN: {
|
2020-07-26 10:52:24 +00:00
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2021-11-17 15:52:44 +00:00
|
|
|
*r_return = Math::randfn((double)*p_inputs[0], (double)*p_inputs[1]);
|
2020-07-26 10:52:24 +00:00
|
|
|
} break;
|
2016-09-06 22:12:28 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_SEED: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
uint64_t seed = *p_inputs[0];
|
2016-09-06 22:12:28 +00:00
|
|
|
Math::seed(seed);
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_RANDSEED: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
uint64_t seed = *p_inputs[0];
|
2016-09-06 22:12:28 +00:00
|
|
|
int ret = Math::rand_from_seed(&seed);
|
|
|
|
Array reta;
|
|
|
|
reta.push_back(ret);
|
|
|
|
reta.push_back(seed);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = reta;
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_DEG2RAD: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::deg2rad((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_RAD2DEG: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::rad2deg((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_LINEAR2DB: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::linear2db((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_DB2LINEAR: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = Math::db2linear((double)*p_inputs[0]);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2021-10-15 13:25:00 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_PINGPONG: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
*r_return = Math::pingpong((double)*p_inputs[0], (double)*p_inputs[1]);
|
|
|
|
} break;
|
2017-10-11 17:38:55 +00:00
|
|
|
case VisualScriptBuiltinFunc::MATH_WRAP: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
VALIDATE_ARG_NUM(2);
|
|
|
|
*r_return = Math::wrapi((int64_t)*p_inputs[0], (int64_t)*p_inputs[1], (int64_t)*p_inputs[2]);
|
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::MATH_WRAPF: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
VALIDATE_ARG_NUM(2);
|
|
|
|
*r_return = Math::wrapf((double)*p_inputs[0], (double)*p_inputs[1], (double)*p_inputs[2]);
|
|
|
|
} break;
|
2016-09-06 22:12:28 +00:00
|
|
|
case VisualScriptBuiltinFunc::LOGIC_MAX: {
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_inputs[0]->get_type() == Variant::INT && p_inputs[1]->get_type() == Variant::INT) {
|
2016-09-06 22:12:28 +00:00
|
|
|
int64_t a = *p_inputs[0];
|
|
|
|
int64_t b = *p_inputs[1];
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = MAX(a, b);
|
2016-09-06 22:12:28 +00:00
|
|
|
} else {
|
2016-08-06 01:46:45 +00:00
|
|
|
VALIDATE_ARG_NUM(0);
|
2016-09-06 22:12:28 +00:00
|
|
|
VALIDATE_ARG_NUM(1);
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
real_t a = *p_inputs[0];
|
|
|
|
real_t b = *p_inputs[1];
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = MAX(a, b);
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::LOGIC_MIN: {
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_inputs[0]->get_type() == Variant::INT && p_inputs[1]->get_type() == Variant::INT) {
|
2016-09-06 22:12:28 +00:00
|
|
|
int64_t a = *p_inputs[0];
|
|
|
|
int64_t b = *p_inputs[1];
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = MIN(a, b);
|
2016-09-06 22:12:28 +00:00
|
|
|
} else {
|
2016-08-06 01:46:45 +00:00
|
|
|
VALIDATE_ARG_NUM(0);
|
2016-09-06 22:12:28 +00:00
|
|
|
VALIDATE_ARG_NUM(1);
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
real_t a = *p_inputs[0];
|
|
|
|
real_t b = *p_inputs[1];
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = MIN(a, b);
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::LOGIC_CLAMP: {
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_inputs[0]->get_type() == Variant::INT && p_inputs[1]->get_type() == Variant::INT && p_inputs[2]->get_type() == Variant::INT) {
|
2016-09-06 22:12:28 +00:00
|
|
|
int64_t a = *p_inputs[0];
|
|
|
|
int64_t b = *p_inputs[1];
|
|
|
|
int64_t c = *p_inputs[2];
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = CLAMP(a, b, c);
|
2016-09-06 22:12:28 +00:00
|
|
|
} else {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
VALIDATE_ARG_NUM(1);
|
|
|
|
VALIDATE_ARG_NUM(2);
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
real_t a = *p_inputs[0];
|
|
|
|
real_t b = *p_inputs[1];
|
|
|
|
real_t c = *p_inputs[2];
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = CLAMP(a, b, c);
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::LOGIC_NEAREST_PO2: {
|
|
|
|
VALIDATE_ARG_NUM(0);
|
|
|
|
int64_t num = *p_inputs[0];
|
2017-08-17 21:35:55 +00:00
|
|
|
*r_return = next_power_of_2(num);
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::OBJ_WEAKREF: {
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_inputs[0]->get_type() != Variant::OBJECT) {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2017-03-05 15:44:50 +00:00
|
|
|
r_error.argument = 0;
|
|
|
|
r_error.expected = Variant::OBJECT;
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
if (p_inputs[0]->is_ref()) {
|
|
|
|
REF r = *p_inputs[0];
|
|
|
|
if (!r.is_valid()) {
|
|
|
|
return;
|
2016-08-06 01:46:45 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Ref<WeakRef> wref = memnew(WeakRef);
|
2016-09-06 22:12:28 +00:00
|
|
|
wref->set_ref(r);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = wref;
|
2016-09-06 22:12:28 +00:00
|
|
|
} else {
|
|
|
|
Object *obj = *p_inputs[0];
|
|
|
|
if (!obj) {
|
|
|
|
return;
|
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
Ref<WeakRef> wref = memnew(WeakRef);
|
2016-09-06 22:12:28 +00:00
|
|
|
wref->set_obj(obj);
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = wref;
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::TYPE_CONVERT: {
|
|
|
|
VALIDATE_ARG_NUM(1);
|
2017-03-05 15:44:50 +00:00
|
|
|
int type = *p_inputs[1];
|
|
|
|
if (type < 0 || type >= Variant::VARIANT_MAX) {
|
|
|
|
r_error_str = RTR("Invalid type argument to convert(), use TYPE_* constants.");
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2017-03-05 15:44:50 +00:00
|
|
|
r_error.argument = 0;
|
|
|
|
r_error.expected = Variant::INT;
|
2016-09-06 22:12:28 +00:00
|
|
|
return;
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} else {
|
2020-11-09 03:19:09 +00:00
|
|
|
Variant::construct(Variant::Type(type), *r_return, p_inputs, 1, r_error);
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::TYPE_OF: {
|
|
|
|
*r_return = p_inputs[0]->get_type();
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::TYPE_EXISTS: {
|
2017-01-03 02:03:46 +00:00
|
|
|
*r_return = ClassDB::class_exists(*p_inputs[0]);
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-10-03 16:17:54 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::TEXT_CHAR: {
|
2020-07-27 10:43:20 +00:00
|
|
|
char32_t result[2] = { *p_inputs[0], 0 };
|
2017-03-05 15:44:50 +00:00
|
|
|
|
|
|
|
*r_return = String(result);
|
2016-10-03 16:17:54 +00:00
|
|
|
|
2019-09-02 20:20:49 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::TEXT_ORD: {
|
|
|
|
if (p_inputs[0]->get_type() != Variant::STRING) {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2019-09-02 20:20:49 +00:00
|
|
|
r_error.argument = 0;
|
|
|
|
r_error.expected = Variant::STRING;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
String str = p_inputs[0]->operator String();
|
|
|
|
|
|
|
|
if (str.length() != 1) {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2019-09-02 20:20:49 +00:00
|
|
|
r_error.argument = 0;
|
|
|
|
r_error.expected = Variant::STRING;
|
|
|
|
*r_return = "Expected a string of length 1 (a character).";
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
*r_return = str.get(0);
|
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::TEXT_STR: {
|
|
|
|
String str = *p_inputs[0];
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = str;
|
2016-08-02 22:11:05 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::TEXT_PRINT: {
|
|
|
|
String str = *p_inputs[0];
|
|
|
|
print_line(str);
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
case VisualScriptBuiltinFunc::TEXT_PRINTERR: {
|
|
|
|
String str = *p_inputs[0];
|
2017-11-14 22:01:45 +00:00
|
|
|
print_error(str);
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::TEXT_PRINTRAW: {
|
2018-08-24 07:35:07 +00:00
|
|
|
String str = *p_inputs[0];
|
2017-03-05 15:44:50 +00:00
|
|
|
OS::get_singleton()->print("%s", str.utf8().get_data());
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2021-09-20 17:14:27 +00:00
|
|
|
case VisualScriptBuiltinFunc::TEXT_PRINT_VERBOSE: {
|
|
|
|
String str = *p_inputs[0];
|
|
|
|
print_verbose(str);
|
|
|
|
} break;
|
2016-09-06 22:12:28 +00:00
|
|
|
case VisualScriptBuiltinFunc::VAR_TO_STR: {
|
|
|
|
String vars;
|
2017-03-05 15:44:50 +00:00
|
|
|
VariantWriter::write_to_string(*p_inputs[0], vars);
|
|
|
|
*r_return = vars;
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::STR_TO_VAR: {
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_inputs[0]->get_type() != Variant::STRING) {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2017-03-05 15:44:50 +00:00
|
|
|
r_error.argument = 0;
|
|
|
|
r_error.expected = Variant::STRING;
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
VariantParser::StreamString ss;
|
2017-03-05 15:44:50 +00:00
|
|
|
ss.s = *p_inputs[0];
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
String errs;
|
|
|
|
int line;
|
2017-03-05 15:44:50 +00:00
|
|
|
Error err = VariantParser::parse(&ss, *r_return, errs, line);
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
if (err != OK) {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2017-03-05 15:44:50 +00:00
|
|
|
r_error.argument = 0;
|
|
|
|
r_error.expected = Variant::STRING;
|
|
|
|
*r_return = "Parse error at line " + itos(line) + ": " + errs;
|
2016-09-06 22:12:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::VAR_TO_BYTES: {
|
2019-03-26 15:52:42 +00:00
|
|
|
if (p_inputs[1]->get_type() != Variant::BOOL) {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2019-03-26 15:52:42 +00:00
|
|
|
r_error.argument = 1;
|
|
|
|
r_error.expected = Variant::BOOL;
|
|
|
|
return;
|
|
|
|
}
|
2020-02-17 21:06:54 +00:00
|
|
|
PackedByteArray barr;
|
2016-09-06 22:12:28 +00:00
|
|
|
int len;
|
2019-03-26 15:52:42 +00:00
|
|
|
bool full_objects = *p_inputs[1];
|
2020-04-01 23:20:12 +00:00
|
|
|
Error err = encode_variant(*p_inputs[0], nullptr, len, full_objects);
|
2016-09-06 22:12:28 +00:00
|
|
|
if (err) {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2017-03-05 15:44:50 +00:00
|
|
|
r_error.argument = 0;
|
|
|
|
r_error.expected = Variant::NIL;
|
|
|
|
r_error_str = "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).";
|
2016-09-06 22:12:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
barr.resize(len);
|
|
|
|
{
|
2020-02-17 21:06:54 +00:00
|
|
|
uint8_t *w = barr.ptrw();
|
|
|
|
encode_variant(*p_inputs[0], w, len, full_objects);
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = barr;
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
|
|
|
case VisualScriptBuiltinFunc::BYTES_TO_VAR: {
|
2020-02-17 21:06:54 +00:00
|
|
|
if (p_inputs[0]->get_type() != Variant::PACKED_BYTE_ARRAY) {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2017-03-05 15:44:50 +00:00
|
|
|
r_error.argument = 0;
|
2020-02-17 21:06:54 +00:00
|
|
|
r_error.expected = Variant::PACKED_BYTE_ARRAY;
|
2019-03-26 15:52:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (p_inputs[1]->get_type() != Variant::BOOL) {
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2019-03-26 15:52:42 +00:00
|
|
|
r_error.argument = 1;
|
|
|
|
r_error.expected = Variant::BOOL;
|
2016-09-06 22:12:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2020-02-17 21:06:54 +00:00
|
|
|
PackedByteArray varr = *p_inputs[0];
|
2019-03-26 15:52:42 +00:00
|
|
|
bool allow_objects = *p_inputs[1];
|
2016-09-06 22:12:28 +00:00
|
|
|
Variant ret;
|
|
|
|
{
|
2020-02-17 21:06:54 +00:00
|
|
|
const uint8_t *r = varr.ptr();
|
2020-04-01 23:20:12 +00:00
|
|
|
Error err = decode_variant(ret, r, varr.size(), nullptr, allow_objects);
|
2017-03-05 15:44:50 +00:00
|
|
|
if (err != OK) {
|
|
|
|
r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format.");
|
2020-02-19 19:27:19 +00:00
|
|
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
2017-03-05 15:44:50 +00:00
|
|
|
r_error.argument = 0;
|
2020-02-17 21:06:54 +00:00
|
|
|
r_error.expected = Variant::PACKED_BYTE_ARRAY;
|
2016-09-06 22:12:28 +00:00
|
|
|
return;
|
2016-08-06 01:46:45 +00:00
|
|
|
}
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
*r_return = ret;
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
} break;
|
2019-04-09 15:08:36 +00:00
|
|
|
default: {
|
|
|
|
}
|
2016-09-06 22:12:28 +00:00
|
|
|
}
|
|
|
|
}
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
class VisualScriptNodeInstanceBuiltinFunc : public VisualScriptNodeInstance {
|
|
|
|
public:
|
|
|
|
VisualScriptBuiltinFunc *node;
|
|
|
|
VisualScriptInstance *instance;
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
VisualScriptBuiltinFunc::BuiltinFunc func;
|
2016-08-06 01:46:45 +00:00
|
|
|
|
2016-09-06 22:12:28 +00:00
|
|
|
//virtual int get_working_memory_size() const { return 0; }
|
|
|
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
|
|
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
|
|
|
|
2020-02-19 19:27:19 +00:00
|
|
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptBuiltinFunc::exec_func(func, p_inputs, p_outputs[0], r_error, r_error_str);
|
2016-08-06 01:46:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-06-17 22:03:09 +00:00
|
|
|
VisualScriptNodeInstance *VisualScriptBuiltinFunc::instantiate(VisualScriptInstance *p_instance) {
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptNodeInstanceBuiltinFunc *instance = memnew(VisualScriptNodeInstanceBuiltinFunc);
|
|
|
|
instance->node = this;
|
|
|
|
instance->instance = p_instance;
|
|
|
|
instance->func = func;
|
2016-08-06 01:46:45 +00:00
|
|
|
return instance;
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VisualScriptBuiltinFunc::_bind_methods() {
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("set_func", "which"), &VisualScriptBuiltinFunc::set_func);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_func"), &VisualScriptBuiltinFunc::get_func);
|
2016-08-02 22:11:05 +00:00
|
|
|
|
|
|
|
String cc;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < FUNC_MAX; i++) {
|
2020-05-14 14:41:43 +00:00
|
|
|
if (i > 0) {
|
2017-03-05 15:44:50 +00:00
|
|
|
cc += ",";
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
cc += func_name[i];
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, cc), "set_func", "get_func");
|
2017-09-12 19:09:06 +00:00
|
|
|
|
|
|
|
BIND_ENUM_CONSTANT(MATH_SIN);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_COS);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_TAN);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_SINH);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_COSH);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_TANH);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_ASIN);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_ACOS);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_ATAN);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_ATAN2);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_SQRT);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_FMOD);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_FPOSMOD);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_FLOOR);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_CEIL);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_ROUND);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_ABS);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_SIGN);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_POW);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_LOG);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_EXP);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_ISNAN);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_ISINF);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_EASE);
|
2020-02-12 10:14:34 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_STEP_DECIMALS);
|
2020-12-21 18:02:57 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_SNAPPED);
|
2017-09-12 19:09:06 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_LERP);
|
2017-10-13 12:47:07 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_INVERSE_LERP);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_RANGE_LERP);
|
2019-04-07 21:40:56 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_MOVE_TOWARD);
|
2017-09-12 19:09:06 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_RANDOMIZE);
|
2020-07-26 10:52:24 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_RANDI);
|
2017-09-12 19:09:06 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_RANDF);
|
2020-07-26 10:52:24 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_RANDI_RANGE);
|
2021-06-21 09:58:31 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_RANDF_RANGE);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_RANDFN);
|
2017-09-12 19:09:06 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_SEED);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_RANDSEED);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_DEG2RAD);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_RAD2DEG);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_LINEAR2DB);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_DB2LINEAR);
|
2017-10-11 17:38:55 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_WRAP);
|
|
|
|
BIND_ENUM_CONSTANT(MATH_WRAPF);
|
2021-10-15 13:25:00 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_PINGPONG);
|
2017-09-12 19:09:06 +00:00
|
|
|
BIND_ENUM_CONSTANT(LOGIC_MAX);
|
|
|
|
BIND_ENUM_CONSTANT(LOGIC_MIN);
|
|
|
|
BIND_ENUM_CONSTANT(LOGIC_CLAMP);
|
|
|
|
BIND_ENUM_CONSTANT(LOGIC_NEAREST_PO2);
|
|
|
|
BIND_ENUM_CONSTANT(OBJ_WEAKREF);
|
|
|
|
BIND_ENUM_CONSTANT(TYPE_CONVERT);
|
|
|
|
BIND_ENUM_CONSTANT(TYPE_OF);
|
|
|
|
BIND_ENUM_CONSTANT(TYPE_EXISTS);
|
|
|
|
BIND_ENUM_CONSTANT(TEXT_CHAR);
|
|
|
|
BIND_ENUM_CONSTANT(TEXT_STR);
|
|
|
|
BIND_ENUM_CONSTANT(TEXT_PRINT);
|
|
|
|
BIND_ENUM_CONSTANT(TEXT_PRINTERR);
|
|
|
|
BIND_ENUM_CONSTANT(TEXT_PRINTRAW);
|
2021-09-20 17:14:27 +00:00
|
|
|
BIND_ENUM_CONSTANT(TEXT_PRINT_VERBOSE);
|
2017-09-12 19:09:06 +00:00
|
|
|
BIND_ENUM_CONSTANT(VAR_TO_STR);
|
|
|
|
BIND_ENUM_CONSTANT(STR_TO_VAR);
|
|
|
|
BIND_ENUM_CONSTANT(VAR_TO_BYTES);
|
|
|
|
BIND_ENUM_CONSTANT(BYTES_TO_VAR);
|
2019-03-19 11:39:43 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_SMOOTHSTEP);
|
2019-07-22 10:24:14 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_POSMOD);
|
2019-07-14 04:30:45 +00:00
|
|
|
BIND_ENUM_CONSTANT(MATH_LERP_ANGLE);
|
2019-09-02 20:20:49 +00:00
|
|
|
BIND_ENUM_CONSTANT(TEXT_ORD);
|
2017-09-12 19:09:06 +00:00
|
|
|
BIND_ENUM_CONSTANT(FUNC_MAX);
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
|
2017-10-14 18:55:09 +00:00
|
|
|
VisualScriptBuiltinFunc::VisualScriptBuiltinFunc(VisualScriptBuiltinFunc::BuiltinFunc func) {
|
|
|
|
this->func = func;
|
|
|
|
}
|
|
|
|
|
2016-08-02 22:11:05 +00:00
|
|
|
VisualScriptBuiltinFunc::VisualScriptBuiltinFunc() {
|
2017-03-05 15:44:50 +00:00
|
|
|
func = MATH_SIN;
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
template <VisualScriptBuiltinFunc::BuiltinFunc func>
|
|
|
|
static Ref<VisualScriptNode> create_builtin_func_node(const String &p_name) {
|
2017-10-14 18:55:09 +00:00
|
|
|
Ref<VisualScriptBuiltinFunc> node = memnew(VisualScriptBuiltinFunc(func));
|
2016-08-02 22:11:05 +00:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
void register_visual_script_builtin_func_node() {
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/sin", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_SIN>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/cos", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_COS>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/tan", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_TAN>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/sinh", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_SINH>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/cosh", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_COSH>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/tanh", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_TANH>);
|
|
|
|
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/asin", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_ASIN>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/acos", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_ACOS>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/atan", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_ATAN>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/atan2", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_ATAN2>);
|
|
|
|
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/sqrt", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_SQRT>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/fmod", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_FMOD>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/fposmod", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_FPOSMOD>);
|
2018-10-27 20:12:27 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/posmod", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_POSMOD>);
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/floor", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_FLOOR>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/ceil", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_CEIL>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/round", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_ROUND>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/abs", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_ABS>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/sign", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_SIGN>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/pow", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_POW>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/log", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_LOG>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/exp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_EXP>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/isnan", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_ISNAN>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/isinf", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_ISINF>);
|
|
|
|
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/ease", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_EASE>);
|
2020-02-12 10:14:34 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/step_decimals", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_STEP_DECIMALS>);
|
2020-12-21 18:02:57 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/snapped", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_SNAPPED>);
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/lerp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_LERP>);
|
2019-07-14 04:30:45 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/lerp_angle", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_LERP_ANGLE>);
|
2017-10-13 12:47:07 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/inverse_lerp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_INVERSE_LERP>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/range_lerp", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANGE_LERP>);
|
2019-03-19 11:39:43 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/smoothstep", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_SMOOTHSTEP>);
|
2019-04-07 21:40:56 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/move_toward", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_MOVE_TOWARD>);
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randomize", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDOMIZE>);
|
2020-07-26 10:52:24 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randi", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDI>);
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randf", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDF>);
|
2020-07-26 10:52:24 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randi_range", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDI_RANGE>);
|
2021-06-21 09:58:31 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randf_range", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDF_RANGE>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randfn", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDFN>);
|
2017-03-05 15:44:50 +00:00
|
|
|
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/seed", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_SEED>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/randseed", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RANDSEED>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/deg2rad", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_DEG2RAD>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/rad2deg", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RAD2DEG>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/linear2db", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_LINEAR2DB>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/db2linear", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_DB2LINEAR>);
|
2017-10-11 17:38:55 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/wrapi", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_WRAP>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/wrapf", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_WRAPF>);
|
2021-10-15 13:25:00 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/pingpong", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_PINGPONG>);
|
2017-03-05 15:44:50 +00:00
|
|
|
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/max", create_builtin_func_node<VisualScriptBuiltinFunc::LOGIC_MAX>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/min", create_builtin_func_node<VisualScriptBuiltinFunc::LOGIC_MIN>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/clamp", create_builtin_func_node<VisualScriptBuiltinFunc::LOGIC_CLAMP>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/nearest_po2", create_builtin_func_node<VisualScriptBuiltinFunc::LOGIC_NEAREST_PO2>);
|
|
|
|
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/weakref", create_builtin_func_node<VisualScriptBuiltinFunc::OBJ_WEAKREF>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/convert", create_builtin_func_node<VisualScriptBuiltinFunc::TYPE_CONVERT>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/typeof", create_builtin_func_node<VisualScriptBuiltinFunc::TYPE_OF>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/type_exists", create_builtin_func_node<VisualScriptBuiltinFunc::TYPE_EXISTS>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/char", create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_CHAR>);
|
2019-09-02 20:20:49 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/ord", create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_ORD>);
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/str", create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_STR>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/print", create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_PRINT>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/printerr", create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_PRINTERR>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/printraw", create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_PRINTRAW>);
|
2021-09-20 17:14:27 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/print_verbose", create_builtin_func_node<VisualScriptBuiltinFunc::TEXT_PRINT_VERBOSE>);
|
2017-03-05 15:44:50 +00:00
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/var2str", create_builtin_func_node<VisualScriptBuiltinFunc::VAR_TO_STR>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/str2var", create_builtin_func_node<VisualScriptBuiltinFunc::STR_TO_VAR>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/var2bytes", create_builtin_func_node<VisualScriptBuiltinFunc::VAR_TO_BYTES>);
|
|
|
|
VisualScriptLanguage::singleton->add_register_func("functions/built_in/bytes2var", create_builtin_func_node<VisualScriptBuiltinFunc::BYTES_TO_VAR>);
|
2016-08-02 22:11:05 +00:00
|
|
|
}
|