mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
parent
64a63e0861
commit
b5e1e05ef2
1439 changed files with 1 additions and 34187 deletions
|
@ -43,14 +43,11 @@ typedef void (*VariantFunc)(Variant &r_ret, Variant &p_self, const Variant **p_a
|
|||
typedef void (*VariantConstructFunc)(Variant &r_ret, const Variant **p_args);
|
||||
|
||||
struct _VariantCall {
|
||||
|
||||
static void Vector3_dot(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
r_ret = reinterpret_cast<Vector3 *>(p_self._data._mem)->dot(*reinterpret_cast<const Vector3 *>(p_args[0]->_data._mem));
|
||||
}
|
||||
|
||||
struct FuncData {
|
||||
|
||||
int arg_count;
|
||||
Vector<Variant> default_args;
|
||||
Vector<Variant::Type> arg_types;
|
||||
|
@ -63,14 +60,12 @@ struct _VariantCall {
|
|||
VariantFunc func;
|
||||
|
||||
_FORCE_INLINE_ bool verify_arguments(const Variant **p_args, Variant::CallError &r_error) {
|
||||
|
||||
if (arg_count == 0)
|
||||
return true;
|
||||
|
||||
const Variant::Type *tptr = &arg_types[0];
|
||||
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
|
||||
if (tptr[i] == Variant::NIL || tptr[i] == p_args[i]->type)
|
||||
continue; // all good
|
||||
if (!Variant::can_convert(p_args[i]->type, tptr[i])) {
|
||||
|
@ -125,7 +120,6 @@ struct _VariantCall {
|
|||
};
|
||||
|
||||
struct TypeFunc {
|
||||
|
||||
Map<StringName, FuncData> functions;
|
||||
};
|
||||
|
||||
|
@ -144,14 +138,12 @@ struct _VariantCall {
|
|||
//void addfunc(Variant::Type p_type, const StringName& p_name,VariantFunc p_func);
|
||||
|
||||
static void make_func_return_variant(Variant::Type p_type, const StringName &p_name) {
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
type_funcs[p_type].functions[p_name].returns = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void addfunc(bool p_const, Variant::Type p_type, Variant::Type p_return, bool p_has_return, const StringName &p_name, VariantFunc p_func, const Vector<Variant> &p_defaultarg, const Arg &p_argtype1 = Arg(), const Arg &p_argtype2 = Arg(), const Arg &p_argtype3 = Arg(), const Arg &p_argtype4 = Arg(), const Arg &p_argtype5 = Arg()) {
|
||||
|
||||
FuncData funcdata;
|
||||
funcdata.func = p_func;
|
||||
funcdata.default_args = p_defaultarg;
|
||||
|
@ -317,7 +309,6 @@ struct _VariantCall {
|
|||
VCALL_LOCALMEM1R(String, trim_suffix);
|
||||
|
||||
static void _call_String_to_ascii(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
String *s = reinterpret_cast<String *>(p_self._data._mem);
|
||||
if (s->empty()) {
|
||||
r_ret = PoolByteArray();
|
||||
|
@ -336,7 +327,6 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void _call_String_to_utf8(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
String *s = reinterpret_cast<String *>(p_self._data._mem);
|
||||
if (s->empty()) {
|
||||
r_ret = PoolByteArray();
|
||||
|
@ -355,7 +345,6 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void _call_String_to_wchar(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
String *s = reinterpret_cast<String *>(p_self._data._mem);
|
||||
if (s->empty()) {
|
||||
r_ret = PoolByteArray();
|
||||
|
@ -578,7 +567,6 @@ struct _VariantCall {
|
|||
VCALL_LOCALMEM0R(Array, min);
|
||||
|
||||
static void _call_PoolByteArray_get_string_from_ascii(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
PoolByteArray *ba = reinterpret_cast<PoolByteArray *>(p_self._data._mem);
|
||||
String s;
|
||||
if (ba->size() > 0) {
|
||||
|
@ -594,7 +582,6 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void _call_PoolByteArray_get_string_from_utf8(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
PoolByteArray *ba = reinterpret_cast<PoolByteArray *>(p_self._data._mem);
|
||||
String s;
|
||||
if (ba->size() > 0) {
|
||||
|
@ -605,7 +592,6 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void _call_PoolByteArray_compress(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
PoolByteArray *ba = reinterpret_cast<PoolByteArray *>(p_self._data._mem);
|
||||
PoolByteArray compressed;
|
||||
if (ba->size() > 0) {
|
||||
|
@ -621,7 +607,6 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void _call_PoolByteArray_decompress(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
PoolByteArray *ba = reinterpret_cast<PoolByteArray *>(p_self._data._mem);
|
||||
PoolByteArray decompressed;
|
||||
Compression::Mode mode = (Compression::Mode)(int)(*p_args[1]);
|
||||
|
@ -800,9 +785,7 @@ struct _VariantCall {
|
|||
VCALL_PTR1R(Transform2D, is_equal_approx);
|
||||
|
||||
static void _call_Transform2D_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
switch (p_args[0]->type) {
|
||||
|
||||
case Variant::VECTOR2:
|
||||
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator Vector2());
|
||||
return;
|
||||
|
@ -818,9 +801,7 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void _call_Transform2D_xform_inv(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
switch (p_args[0]->type) {
|
||||
|
||||
case Variant::VECTOR2:
|
||||
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector2());
|
||||
return;
|
||||
|
@ -836,9 +817,7 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void _call_Transform2D_basis_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
switch (p_args[0]->type) {
|
||||
|
||||
case Variant::VECTOR2:
|
||||
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->basis_xform(p_args[0]->operator Vector2());
|
||||
return;
|
||||
|
@ -848,9 +827,7 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void _call_Transform2D_basis_xform_inv(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
switch (p_args[0]->type) {
|
||||
|
||||
case Variant::VECTOR2:
|
||||
r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->basis_xform_inv(p_args[0]->operator Vector2());
|
||||
return;
|
||||
|
@ -900,9 +877,7 @@ struct _VariantCall {
|
|||
VCALL_PTR1R(Transform, is_equal_approx);
|
||||
|
||||
static void _call_Transform_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
switch (p_args[0]->type) {
|
||||
|
||||
case Variant::VECTOR3:
|
||||
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Vector3());
|
||||
return;
|
||||
|
@ -921,9 +896,7 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void _call_Transform_xform_inv(Variant &r_ret, Variant &p_self, const Variant **p_args) {
|
||||
|
||||
switch (p_args[0]->type) {
|
||||
|
||||
case Variant::VECTOR3:
|
||||
r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector3());
|
||||
return;
|
||||
|
@ -950,7 +923,6 @@ struct _VariantCall {
|
|||
VCALL_PTR0( Transform, orthonormalize ); */
|
||||
|
||||
struct ConstructData {
|
||||
|
||||
int arg_count;
|
||||
Vector<Variant::Type> arg_types;
|
||||
Vector<String> arg_names;
|
||||
|
@ -958,35 +930,29 @@ struct _VariantCall {
|
|||
};
|
||||
|
||||
struct ConstructFunc {
|
||||
|
||||
List<ConstructData> constructors;
|
||||
};
|
||||
|
||||
static ConstructFunc *construct_funcs;
|
||||
|
||||
static void Vector2_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Vector2(*p_args[0], *p_args[1]);
|
||||
}
|
||||
|
||||
static void Rect2_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Rect2(*p_args[0], *p_args[1]);
|
||||
}
|
||||
|
||||
static void Rect2_init2(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Rect2(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
|
||||
}
|
||||
|
||||
static void Transform2D_init2(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
Transform2D m(*p_args[0], *p_args[1]);
|
||||
r_ret = m;
|
||||
}
|
||||
|
||||
static void Transform2D_init3(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
Transform2D m;
|
||||
m[0] = *p_args[0];
|
||||
m[1] = *p_args[1];
|
||||
|
@ -995,71 +961,57 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void Vector3_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Vector3(*p_args[0], *p_args[1], *p_args[2]);
|
||||
}
|
||||
|
||||
static void Plane_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Plane(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
|
||||
}
|
||||
|
||||
static void Plane_init2(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Plane(*p_args[0], *p_args[1], *p_args[2]);
|
||||
}
|
||||
|
||||
static void Plane_init3(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Plane(p_args[0]->operator Vector3(), p_args[1]->operator real_t());
|
||||
}
|
||||
static void Plane_init4(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Plane(p_args[0]->operator Vector3(), p_args[1]->operator Vector3());
|
||||
}
|
||||
|
||||
static void Quat_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Quat(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
|
||||
}
|
||||
|
||||
static void Quat_init2(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Quat(((Vector3)(*p_args[0])), ((real_t)(*p_args[1])));
|
||||
}
|
||||
|
||||
static void Quat_init3(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Quat(((Vector3)(*p_args[0])));
|
||||
}
|
||||
|
||||
static void Color_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Color(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
|
||||
}
|
||||
|
||||
static void Color_init2(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Color(*p_args[0], *p_args[1], *p_args[2]);
|
||||
}
|
||||
|
||||
static void Color_init3(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Color::html(*p_args[0]);
|
||||
}
|
||||
|
||||
static void Color_init4(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Color::hex(*p_args[0]);
|
||||
}
|
||||
|
||||
static void AABB_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = ::AABB(*p_args[0], *p_args[1]);
|
||||
}
|
||||
|
||||
static void Basis_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
Basis m;
|
||||
m.set_axis(0, *p_args[0]);
|
||||
m.set_axis(1, *p_args[1]);
|
||||
|
@ -1068,12 +1020,10 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void Basis_init2(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Basis(p_args[0]->operator Vector3(), p_args[1]->operator real_t());
|
||||
}
|
||||
|
||||
static void Transform_init1(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
Transform t;
|
||||
t.basis.set_axis(0, *p_args[0]);
|
||||
t.basis.set_axis(1, *p_args[1]);
|
||||
|
@ -1083,7 +1033,6 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void Transform_init2(Variant &r_ret, const Variant **p_args) {
|
||||
|
||||
r_ret = Transform(p_args[0]->operator Basis(), p_args[1]->operator Vector3());
|
||||
}
|
||||
|
||||
|
@ -1092,7 +1041,6 @@ struct _VariantCall {
|
|||
const String &p_name2 = "", const Variant::Type p_type2 = Variant::NIL,
|
||||
const String &p_name3 = "", const Variant::Type p_type3 = Variant::NIL,
|
||||
const String &p_name4 = "", const Variant::Type p_type4 = Variant::NIL) {
|
||||
|
||||
ConstructData cd;
|
||||
cd.func = p_func;
|
||||
cd.arg_count = 0;
|
||||
|
@ -1127,7 +1075,6 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
struct ConstantData {
|
||||
|
||||
Map<StringName, int> value;
|
||||
#ifdef DEBUG_ENABLED
|
||||
List<StringName> value_ordered;
|
||||
|
@ -1141,7 +1088,6 @@ struct _VariantCall {
|
|||
static ConstantData *constant_data;
|
||||
|
||||
static void add_constant(int p_type, StringName p_constant_name, int p_constant_value) {
|
||||
|
||||
constant_data[p_type].value[p_constant_name] = p_constant_value;
|
||||
#ifdef DEBUG_ENABLED
|
||||
constant_data[p_type].value_ordered.push_back(p_constant_name);
|
||||
|
@ -1149,7 +1095,6 @@ struct _VariantCall {
|
|||
}
|
||||
|
||||
static void add_variant_constant(int p_type, StringName p_constant_name, const Variant &p_constant_value) {
|
||||
|
||||
constant_data[p_type].variant_value[p_constant_name] = p_constant_value;
|
||||
#ifdef DEBUG_ENABLED
|
||||
constant_data[p_type].variant_value_ordered.push_back(p_constant_name);
|
||||
|
@ -1162,7 +1107,6 @@ _VariantCall::ConstructFunc *_VariantCall::construct_funcs = NULL;
|
|||
_VariantCall::ConstantData *_VariantCall::constant_data = NULL;
|
||||
|
||||
Variant Variant::call(const StringName &p_method, const Variant **p_args, int p_argcount, CallError &r_error) {
|
||||
|
||||
Variant ret;
|
||||
call_ptr(p_method, p_args, p_argcount, &ret, r_error);
|
||||
return ret;
|
||||
|
@ -1189,7 +1133,6 @@ void Variant::call_ptr(const StringName &p_method, const Variant **p_args, int p
|
|||
//else if (type==Variant::METHOD) {
|
||||
|
||||
} else {
|
||||
|
||||
r_error.error = Variant::CallError::CALL_OK;
|
||||
|
||||
Map<StringName, _VariantCall::FuncData>::Element *E = _VariantCall::type_funcs[type].functions.find(p_method);
|
||||
|
@ -1210,7 +1153,6 @@ void Variant::call_ptr(const StringName &p_method, const Variant **p_args, int p
|
|||
#define VCALL(m_type, m_method) _VariantCall::_call_##m_type##_##m_method
|
||||
|
||||
Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, int p_argcount, CallError &r_error, bool p_strict) {
|
||||
|
||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, Variant());
|
||||
|
||||
|
@ -1289,7 +1231,6 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
|
|||
|
||||
switch (p_type) {
|
||||
case NIL: {
|
||||
|
||||
return Variant();
|
||||
} break;
|
||||
case BOOL: {
|
||||
|
@ -1357,7 +1298,6 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
|
|||
return Variant();
|
||||
}
|
||||
} else if (p_argcount >= 1) {
|
||||
|
||||
_VariantCall::ConstructFunc &c = _VariantCall::construct_funcs[p_type];
|
||||
|
||||
for (List<_VariantCall::ConstructData>::Element *E = c.constructors.front(); E; E = E->next()) {
|
||||
|
@ -1386,7 +1326,6 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
|
|||
}
|
||||
|
||||
bool Variant::has_method(const StringName &p_method) const {
|
||||
|
||||
if (type == OBJECT) {
|
||||
Object *obj = _OBJ_PTR(*this);
|
||||
if (!obj) {
|
||||
|
@ -1405,7 +1344,6 @@ bool Variant::has_method(const StringName &p_method) const {
|
|||
}
|
||||
|
||||
Vector<Variant::Type> Variant::get_method_argument_types(Variant::Type p_type, const StringName &p_method) {
|
||||
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
|
||||
|
||||
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
|
||||
|
@ -1416,7 +1354,6 @@ Vector<Variant::Type> Variant::get_method_argument_types(Variant::Type p_type, c
|
|||
}
|
||||
|
||||
bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method) {
|
||||
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
|
||||
|
||||
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
|
||||
|
@ -1427,7 +1364,6 @@ bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method)
|
|||
}
|
||||
|
||||
Vector<StringName> Variant::get_method_argument_names(Variant::Type p_type, const StringName &p_method) {
|
||||
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
|
||||
|
||||
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
|
||||
|
@ -1438,7 +1374,6 @@ Vector<StringName> Variant::get_method_argument_names(Variant::Type p_type, cons
|
|||
}
|
||||
|
||||
Variant::Type Variant::get_method_return_type(Variant::Type p_type, const StringName &p_method, bool *r_has_return) {
|
||||
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
|
||||
|
||||
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
|
||||
|
@ -1452,7 +1387,6 @@ Variant::Type Variant::get_method_return_type(Variant::Type p_type, const String
|
|||
}
|
||||
|
||||
Vector<Variant> Variant::get_method_default_arguments(Variant::Type p_type, const StringName &p_method) {
|
||||
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
|
||||
|
||||
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
|
||||
|
@ -1463,11 +1397,9 @@ Vector<Variant> Variant::get_method_default_arguments(Variant::Type p_type, cons
|
|||
}
|
||||
|
||||
void Variant::get_method_list(List<MethodInfo> *p_list) const {
|
||||
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[type];
|
||||
|
||||
for (const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.front(); E; E = E->next()) {
|
||||
|
||||
const _VariantCall::FuncData &fd = E->get();
|
||||
|
||||
MethodInfo mi;
|
||||
|
@ -1478,7 +1410,6 @@ void Variant::get_method_list(List<MethodInfo> *p_list) const {
|
|||
}
|
||||
|
||||
for (int i = 0; i < fd.arg_types.size(); i++) {
|
||||
|
||||
PropertyInfo pi;
|
||||
pi.type = fd.arg_types[i];
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
@ -1501,18 +1432,15 @@ void Variant::get_method_list(List<MethodInfo> *p_list) const {
|
|||
}
|
||||
|
||||
void Variant::get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_list) {
|
||||
|
||||
ERR_FAIL_INDEX(p_type, VARIANT_MAX);
|
||||
|
||||
//custom constructors
|
||||
for (const List<_VariantCall::ConstructData>::Element *E = _VariantCall::construct_funcs[p_type].constructors.front(); E; E = E->next()) {
|
||||
|
||||
const _VariantCall::ConstructData &cd = E->get();
|
||||
MethodInfo mi;
|
||||
mi.name = Variant::get_type_name(p_type);
|
||||
mi.return_val.type = p_type;
|
||||
for (int i = 0; i < cd.arg_count; i++) {
|
||||
|
||||
PropertyInfo pi;
|
||||
pi.name = cd.arg_names[i];
|
||||
pi.type = cd.arg_types[i];
|
||||
|
@ -1539,18 +1467,15 @@ void Variant::get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_lis
|
|||
}
|
||||
|
||||
void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_constants) {
|
||||
|
||||
ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);
|
||||
|
||||
_VariantCall::ConstantData &cd = _VariantCall::constant_data[p_type];
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
for (List<StringName>::Element *E = cd.value_ordered.front(); E; E = E->next()) {
|
||||
|
||||
p_constants->push_back(E->get());
|
||||
#else
|
||||
for (Map<StringName, int>::Element *E = cd.value.front(); E; E = E->next()) {
|
||||
|
||||
p_constants->push_back(E->key());
|
||||
#endif
|
||||
}
|
||||
|
@ -1560,21 +1485,18 @@ void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_c
|
|||
p_constants->push_back(E->get());
|
||||
#else
|
||||
for (Map<StringName, Variant>::Element *E = cd.variant_value.front(); E; E = E->next()) {
|
||||
|
||||
p_constants->push_back(E->key());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool Variant::has_constant(Variant::Type p_type, const StringName &p_value) {
|
||||
|
||||
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, false);
|
||||
_VariantCall::ConstantData &cd = _VariantCall::constant_data[p_type];
|
||||
return cd.value.has(p_value) || cd.variant_value.has(p_value);
|
||||
}
|
||||
|
||||
Variant Variant::get_constant_value(Variant::Type p_type, const StringName &p_value, bool *r_valid) {
|
||||
|
||||
if (r_valid)
|
||||
*r_valid = false;
|
||||
|
||||
|
@ -1599,7 +1521,6 @@ Variant Variant::get_constant_value(Variant::Type p_type, const StringName &p_va
|
|||
}
|
||||
|
||||
void register_variant_methods() {
|
||||
|
||||
_VariantCall::type_funcs = memnew_arr(_VariantCall::TypeFunc, Variant::VARIANT_MAX);
|
||||
|
||||
_VariantCall::construct_funcs = memnew_arr(_VariantCall::ConstructFunc, Variant::VARIANT_MAX);
|
||||
|
@ -2172,7 +2093,6 @@ void register_variant_methods() {
|
|||
}
|
||||
|
||||
void unregister_variant_methods() {
|
||||
|
||||
memdelete_arr(_VariantCall::type_funcs);
|
||||
memdelete_arr(_VariantCall::construct_funcs);
|
||||
memdelete_arr(_VariantCall::constant_data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue