From 6c8f2ae53a1921aa8589cf4da735f5cd443ff706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 24 Feb 2020 17:00:40 +0100 Subject: Update docs and bindings for new integer vector types --- core/global_constants.cpp | 20 ++++---- core/io/marshalls.cpp | 8 ++-- core/variant.h | 16 +++---- core/variant_call.cpp | 22 ++++----- core/variant_op.cpp | 48 +++++++++---------- doc/classes/@GlobalScope.xml | 62 +++++++++++++++---------- doc/classes/Rect2.xml | 14 +++++- doc/classes/Rect2i.xml | 52 +++++++++++++++++++++ doc/classes/String.xml | 30 ++++++++++++ doc/classes/Vector2.xml | 14 +++++- doc/classes/Vector2i.xml | 61 ++++++++++++++++++++++++ doc/classes/Vector3.xml | 14 +++++- doc/classes/Vector3i.xml | 72 +++++++++++++++++++++++++++++ editor/doc/doc_dump.cpp | 2 +- editor/editor_properties.cpp | 10 ++-- modules/gdnative/include/gdnative/variant.h | 14 +++--- 16 files changed, 358 insertions(+), 101 deletions(-) create mode 100644 doc/classes/Rect2i.xml create mode 100644 doc/classes/Vector2i.xml create mode 100644 doc/classes/Vector3i.xml diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 73db723c65..0945240c1f 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -92,9 +92,6 @@ VARIANT_ENUM_CAST(JoystickList); VARIANT_ENUM_CAST(MidiMessageList); void register_global_constants() { - - //{ KEY_BACKSPACE, VK_BACK },// (0x08) // backspace - BIND_GLOBAL_ENUM_CONSTANT(MARGIN_LEFT); BIND_GLOBAL_ENUM_CONSTANT(MARGIN_TOP); BIND_GLOBAL_ENUM_CONSTANT(MARGIN_RIGHT); @@ -116,7 +113,7 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT(VALIGN_CENTER); BIND_GLOBAL_ENUM_CONSTANT(VALIGN_BOTTOM); - // hueg list of keys + // huge list of keys BIND_GLOBAL_CONSTANT(SPKEY); BIND_GLOBAL_ENUM_CONSTANT(KEY_ESCAPE); @@ -596,23 +593,26 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT", Variant::INT); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_REAL", Variant::FLOAT); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING", Variant::STRING); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2", Variant::VECTOR2); // 5 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2", Variant::VECTOR2); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2I", Variant::VECTOR2I); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT2", Variant::RECT2); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT2I", Variant::RECT2I); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3", Variant::VECTOR3); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3I", Variant::VECTOR3I); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_QUAT", Variant::QUAT); // 10 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_QUAT", Variant::QUAT); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM", Variant::TRANSFORM); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_NAME", Variant::STRING_NAME); // 15 - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH); // 15 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_NAME", Variant::STRING_NAME); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::_RID); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_CALLABLE", Variant::CALLABLE); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_SIGNAL", Variant::SIGNAL); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY); // 20 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_ARRAY", Variant::ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RAW_ARRAY", Variant::PACKED_BYTE_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT32_ARRAY", Variant::PACKED_INT32_ARRAY); @@ -620,7 +620,7 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_FLOAT32_ARRAY", Variant::PACKED_FLOAT32_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_FLOAT64_ARRAY", Variant::PACKED_FLOAT64_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_ARRAY", Variant::PACKED_STRING_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2_ARRAY", Variant::PACKED_VECTOR2_ARRAY); // 25 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2_ARRAY", Variant::PACKED_VECTOR2_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3_ARRAY", Variant::PACKED_VECTOR3_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR_ARRAY", Variant::PACKED_COLOR_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_MAX", Variant::VARIANT_MAX); diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 0b815b2c7b..fbcaa582b7 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -186,7 +186,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (r_len) (*r_len) += 4 * 2; - } break; // 5 + } break; case Variant::VECTOR2I: { ERR_FAIL_COND_V(len < 4 * 2, ERR_INVALID_DATA); @@ -198,7 +198,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (r_len) (*r_len) += 4 * 2; - } break; // 5 + } break; case Variant::RECT2: { ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA); @@ -1058,7 +1058,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 2 * 4; - } break; // 5 + } break; case Variant::VECTOR2I: { if (buf) { @@ -1069,7 +1069,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 2 * 4; - } break; // 5 + } break; case Variant::RECT2: { if (buf) { diff --git a/core/variant.h b/core/variant.h index 9ab25b9406..614d39e84a 100644 --- a/core/variant.h +++ b/core/variant.h @@ -78,7 +78,6 @@ class Variant { public: // If this changes the table in variant_op must be updated enum Type { - NIL, // atomic types @@ -88,8 +87,7 @@ public: STRING, // math types - - VECTOR2, // 5 + VECTOR2, VECTOR2I, RECT2, RECT2I, @@ -97,7 +95,7 @@ public: VECTOR3I, TRANSFORM2D, PLANE, - QUAT, // 10 + QUAT, AABB, BASIS, TRANSFORM, @@ -105,26 +103,26 @@ public: // misc types COLOR, STRING_NAME, - NODE_PATH, // 15 + NODE_PATH, _RID, OBJECT, CALLABLE, SIGNAL, DICTIONARY, ARRAY, - // arrays - PACKED_BYTE_ARRAY, // 20 + + // typed arrays + PACKED_BYTE_ARRAY, PACKED_INT32_ARRAY, PACKED_INT64_ARRAY, PACKED_FLOAT32_ARRAY, PACKED_FLOAT64_ARRAY, PACKED_STRING_ARRAY, PACKED_VECTOR2_ARRAY, - PACKED_VECTOR3_ARRAY, // 25 + PACKED_VECTOR3_ARRAY, PACKED_COLOR_ARRAY, VARIANT_MAX - }; private: diff --git a/core/variant_call.cpp b/core/variant_call.cpp index e82b491e4b..9cc08b54e6 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1291,14 +1291,14 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i // math types case VECTOR2: - return Vector2(); // 5 + return Vector2(); case RECT2: return Rect2(); case VECTOR3: return Vector3(); case TRANSFORM2D: return Transform2D(); case PLANE: return Plane(); case QUAT: return Quat(); case AABB: - return ::AABB(); // 10 + return ::AABB(); case BASIS: return Basis(); case TRANSFORM: return Transform(); @@ -1306,16 +1306,16 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i // misc types case COLOR: return Color(); case STRING_NAME: - return StringName(); // 15 + return StringName(); case NODE_PATH: - return NodePath(); // 15 + return NodePath(); case _RID: return RID(); case OBJECT: return (Object *)NULL; case CALLABLE: return Callable(); case SIGNAL: return Signal(); case DICTIONARY: return Dictionary(); case ARRAY: - return Array(); // 20 + return Array(); case PACKED_BYTE_ARRAY: return PackedByteArray(); case PACKED_INT32_ARRAY: return PackedInt32Array(); case PACKED_INT64_ARRAY: return PackedInt64Array(); @@ -1323,7 +1323,7 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i case PACKED_FLOAT64_ARRAY: return PackedFloat64Array(); case PACKED_STRING_ARRAY: return PackedStringArray(); case PACKED_VECTOR2_ARRAY: - return PackedVector2Array(); // 25 + return PackedVector2Array(); case PACKED_VECTOR3_ARRAY: return PackedVector3Array(); case PACKED_COLOR_ARRAY: return PackedColorArray(); default: return Variant(); @@ -1364,7 +1364,7 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i case PLANE: return (Plane(*p_args[0])); case QUAT: return (p_args[0]->operator Quat()); case AABB: - return (::AABB(*p_args[0])); // 10 + return (::AABB(*p_args[0])); case BASIS: return (Basis(p_args[0]->operator Basis())); case TRANSFORM: return (Transform(p_args[0]->operator Transform())); @@ -1372,16 +1372,16 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i // misc types case COLOR: return p_args[0]->type == Variant::STRING ? Color::html(*p_args[0]) : Color::hex(*p_args[0]); case STRING_NAME: - return (StringName(p_args[0]->operator StringName())); // 15 + return (StringName(p_args[0]->operator StringName())); case NODE_PATH: - return (NodePath(p_args[0]->operator NodePath())); // 15 + return (NodePath(p_args[0]->operator NodePath())); case _RID: return (RID(*p_args[0])); case OBJECT: return ((Object *)(p_args[0]->operator Object *())); case CALLABLE: return ((Callable)(p_args[0]->operator Callable())); case SIGNAL: return ((Signal)(p_args[0]->operator Signal())); case DICTIONARY: return p_args[0]->operator Dictionary(); case ARRAY: - return p_args[0]->operator Array(); // 20 + return p_args[0]->operator Array(); // arrays case PACKED_BYTE_ARRAY: return (PackedByteArray(*p_args[0])); @@ -1391,7 +1391,7 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i case PACKED_FLOAT64_ARRAY: return (PackedFloat64Array(*p_args[0])); case PACKED_STRING_ARRAY: return (PackedStringArray(*p_args[0])); case PACKED_VECTOR2_ARRAY: - return (PackedVector2Array(*p_args[0])); // 25 + return (PackedVector2Array(*p_args[0])); case PACKED_VECTOR3_ARRAY: return (PackedVector3Array(*p_args[0])); case PACKED_COLOR_ARRAY: return (PackedColorArray(*p_args[0])); default: return Variant(); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 8bdd8389dc..36d1278929 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -1612,7 +1612,7 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool } } - } break; // 10 + } break; case AABB: { if (p_value.type == Variant::VECTOR3) { @@ -1870,7 +1870,7 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { return v->w; } - } break; // 10 + } break; case AABB: { const ::AABB *v = _data._aabb; @@ -2097,7 +2097,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) } } - } break; // 5 + } break; case VECTOR2I: { if (p_value.type != Variant::INT && p_value.type != Variant::FLOAT) @@ -2132,7 +2132,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) } } - } break; // 5 + } break; case RECT2: { if (p_value.type != Variant::VECTOR2) @@ -2368,7 +2368,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) } } - } break; // 10 + } break; case AABB: { if (p_value.type != Variant::VECTOR3) @@ -2544,9 +2544,9 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) } break; case STRING_NAME: { - } break; // 15 + } break; case NODE_PATH: { - } break; // 15 + } break; case _RID: { } break; case OBJECT: { @@ -2580,14 +2580,14 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) valid = true; //always valid, i guess? should this really be ok? return; } break; - DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index] = p_value; return ) // 20 + DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index] = p_value; return ) DEFAULT_OP_DVECTOR_SET(PACKED_BYTE_ARRAY, uint8_t, p_value.type != Variant::FLOAT && p_value.type != Variant::INT) DEFAULT_OP_DVECTOR_SET(PACKED_INT32_ARRAY, int32_t, p_value.type != Variant::FLOAT && p_value.type != Variant::INT) DEFAULT_OP_DVECTOR_SET(PACKED_INT64_ARRAY, int64_t, p_value.type != Variant::FLOAT && p_value.type != Variant::INT) DEFAULT_OP_DVECTOR_SET(PACKED_FLOAT32_ARRAY, float, p_value.type != Variant::FLOAT && p_value.type != Variant::INT) DEFAULT_OP_DVECTOR_SET(PACKED_FLOAT64_ARRAY, double, p_value.type != Variant::FLOAT && p_value.type != Variant::INT) DEFAULT_OP_DVECTOR_SET(PACKED_STRING_ARRAY, String, p_value.type != Variant::STRING) - DEFAULT_OP_DVECTOR_SET(PACKED_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2) // 25 + DEFAULT_OP_DVECTOR_SET(PACKED_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2) DEFAULT_OP_DVECTOR_SET(PACKED_VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3) DEFAULT_OP_DVECTOR_SET(PACKED_COLOR_ARRAY, Color, p_value.type != Variant::COLOR) default: @@ -2660,7 +2660,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } } - } break; // 5 + } break; case VECTOR2I: { if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::FLOAT) { @@ -2688,7 +2688,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } } - } break; // 5 + } break; case RECT2: { if (p_index.get_type() == Variant::STRING) { @@ -2867,7 +2867,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } } - } break; // 10 + } break; case AABB: { if (p_index.get_type() == Variant::STRING) { @@ -3000,9 +3000,9 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } break; case STRING_NAME: { - } break; // 15 + } break; case NODE_PATH: { - } break; // 15 + } break; case _RID: { } break; case OBJECT: { @@ -3034,14 +3034,14 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { return *res; } } break; - DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index]) // 20 + DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index]) DEFAULT_OP_DVECTOR_GET(PACKED_BYTE_ARRAY, uint8_t) DEFAULT_OP_DVECTOR_GET(PACKED_INT32_ARRAY, int32_t) DEFAULT_OP_DVECTOR_GET(PACKED_INT64_ARRAY, int64_t) DEFAULT_OP_DVECTOR_GET(PACKED_FLOAT32_ARRAY, float) DEFAULT_OP_DVECTOR_GET(PACKED_FLOAT64_ARRAY, double) DEFAULT_OP_DVECTOR_GET(PACKED_STRING_ARRAY, String) - DEFAULT_OP_DVECTOR_GET(PACKED_VECTOR2_ARRAY, Vector2) // 25 + DEFAULT_OP_DVECTOR_GET(PACKED_VECTOR2_ARRAY, Vector2) DEFAULT_OP_DVECTOR_GET(PACKED_VECTOR3_ARRAY, Vector3) DEFAULT_OP_DVECTOR_GET(PACKED_COLOR_ARRAY, Color) default: @@ -3103,7 +3103,7 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { const Dictionary *dic = reinterpret_cast(_data._mem); return dic->has(p_index); - } break; // 20 + } break; case ARRAY: { const Array *arr = reinterpret_cast(_data._mem); @@ -3302,13 +3302,13 @@ void Variant::get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::FLOAT, "x")); p_list->push_back(PropertyInfo(Variant::FLOAT, "y")); - } break; // 5 + } break; case VECTOR2I: { p_list->push_back(PropertyInfo(Variant::INT, "x")); p_list->push_back(PropertyInfo(Variant::INT, "y")); - } break; // 5 + } break; case RECT2: { p_list->push_back(PropertyInfo(Variant::VECTOR2, "position")); @@ -3360,7 +3360,7 @@ void Variant::get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::FLOAT, "z")); p_list->push_back(PropertyInfo(Variant::FLOAT, "w")); - } break; // 10 + } break; case AABB: { p_list->push_back(PropertyInfo(Variant::VECTOR3, "position")); p_list->push_back(PropertyInfo(Variant::VECTOR3, "size")); @@ -3394,9 +3394,9 @@ void Variant::get_property_list(List *p_list) const { } break; case STRING_NAME: { - } break; // 15 + } break; case NODE_PATH: { - } break; // 15 + } break; case _RID: { } break; case OBJECT: { @@ -3427,14 +3427,14 @@ void Variant::get_property_list(List *p_list) const { } } } break; - case ARRAY: // 20 + case ARRAY: case PACKED_BYTE_ARRAY: case PACKED_INT32_ARRAY: case PACKED_INT64_ARRAY: case PACKED_FLOAT32_ARRAY: case PACKED_FLOAT64_ARRAY: case PACKED_STRING_ARRAY: - case PACKED_VECTOR2_ARRAY: // 25 + case PACKED_VECTOR2_ARRAY: case PACKED_VECTOR3_ARRAY: case PACKED_COLOR_ARRAY: { diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 0bf1120009..4100fa0f2f 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1480,76 +1480,88 @@ Variable is of type [Vector2]. - + + Variable is of type [Vector2i]. + + Variable is of type [Rect2]. - + + Variable is of type [Rect2i]. + + Variable is of type [Vector3]. - + + Variable is of type [Vector3i]. + + Variable is of type [Transform2D]. - + Variable is of type [Plane]. - + Variable is of type [Quat]. - + Variable is of type [AABB]. - + Variable is of type [Basis]. - + Variable is of type [Transform]. - + Variable is of type [Color]. - + + Variable is of type [StringName]. - + Variable is of type [NodePath]. - + Variable is of type [RID]. - + Variable is of type [Object]. - + + Variable is of type [Callable]. - + + Variable is of type [Signal]. - + Variable is of type [Dictionary]. - + Variable is of type [Array]. - + Variable is of type [PackedByteArray]. - + Variable is of type [PackedIntArray]. - + Variable is of type [PackedRealArray]. - + Variable is of type [PackedStringArray]. - + Variable is of type [PackedVector2Array]. - + Variable is of type [PackedVector3Array]. - + Variable is of type [PackedColorArray]. - + Represents the size of the [enum Variant.Type] enum. diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index e32b19ff00..26abfb538b 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -1,10 +1,11 @@ - 2D axis-aligned bounding box. + 2D axis-aligned bounding box using floating point coordinates. - Rect2 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. + [Rect2] consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. + It uses floating point coordinates. https://docs.godotengine.org/en/latest/tutorials/math/index.html @@ -36,6 +37,15 @@ Constructs a [Rect2] by x, y, width, and height. + + + + + + + Constructs a [Rect2] from a [Rect2i]. + + diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml new file mode 100644 index 0000000000..2e8be384c1 --- /dev/null +++ b/doc/classes/Rect2i.xml @@ -0,0 +1,52 @@ + + + + 2D axis-aligned bounding box using integer coordinates. + + + [Rect2i] consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. + It uses integer coordinates. + + + https://docs.godotengine.org/en/latest/tutorials/math/index.html + + + + + + + + + + + Constructs a [Rect2i] by position and size. + + + + + + + + + + + + + + + Constructs a [Rect2i] by x, y, width, and height. + + + + + + + + + Constructs a new [Rect2i] from [Rect2]. The floating point coordinates will be truncated. + + + + + + diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 7127ebdbff..bcd29d7355 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -46,6 +46,15 @@ Constructs a new String from the given [Vector2]. + + + + + + + Constructs a new String from the given [Vector2i]. + + @@ -55,6 +64,15 @@ Constructs a new String from the given [Rect2]. + + + + + + + Constructs a new String from the given [Rect2i]. + + @@ -64,6 +82,15 @@ Constructs a new String from the given [Vector3]. + + + + + + + Constructs a new String from the given [Vector3i]. + + @@ -133,6 +160,7 @@ + Constructs a new String from the given [StringName]. @@ -159,6 +187,7 @@ + Constructs a new String from the given [Callable]. @@ -167,6 +196,7 @@ + Constructs a new String from the given [Signal]. diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 4eef103d1f..7b02a1a4c9 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -1,15 +1,25 @@ - Vector used for 2D math. + Vector used for 2D math using floating point coordinates. 2-element structure that can be used to represent positions in 2D space or any other pair of numeric values. + It uses floating point coordinates. https://docs.godotengine.org/en/latest/tutorials/math/index.html + + + + + + + Constructs a new [Vector2] from [Vector2i]. + + @@ -18,7 +28,7 @@ - Constructs a new Vector2 from the given [code]x[/code] and [code]y[/code]. + Constructs a new [Vector2] from the given [code]x[/code] and [code]y[/code]. diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml new file mode 100644 index 0000000000..a516eb01dd --- /dev/null +++ b/doc/classes/Vector2i.xml @@ -0,0 +1,61 @@ + + + + Vector used for 2D math using integer coordinates. + + + 2-element structure that can be used to represent positions in 2D space or any other pair of numeric values. + It uses integer coordinates. + + + https://docs.godotengine.org/en/latest/tutorials/math/index.html + + + + + + + + + + + Constructs a new [Vector2i] from the given [code]x[/code] and [code]y[/code]. + + + + + + + + + Constructs a new [Vector2i] from [Vector2]. The floating point coordinates will be truncated. + + + + + + Enumerated value for the X axis. + + + Enumerated value for the Y axis. + + + Zero vector. + + + One vector. + + + Left unit vector. + + + Right unit vector. + + + Up unit vector. + + + Down unit vector. + + + diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 7ae89cc450..600c03ba7d 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -1,15 +1,25 @@ - Vector used for 3D math. + Vector used for 3D math using floating point coordinates. 3-element structure that can be used to represent positions in 3D space or any other pair of numeric values. + It uses floating point coordinates. https://docs.godotengine.org/en/latest/tutorials/math/index.html + + + + + + + Constructs a new [Vector3] from [Vector3i]. + + @@ -20,7 +30,7 @@ - Returns a Vector3 with the given components. + Returns a [Vector3] with the given components. diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml new file mode 100644 index 0000000000..4f5a658b89 --- /dev/null +++ b/doc/classes/Vector3i.xml @@ -0,0 +1,72 @@ + + + + Vector used for 3D math using integer coordinates. + + + 3-element structure that can be used to represent positions in 3D space or any other pair of numeric values. + It uses integer coordinates. + + + https://docs.godotengine.org/en/latest/tutorials/math/index.html + + + + + + + + + + + + + Returns a [Vector3i] with the given components. + + + + + + + + + Constructs a new [Vector3i] from [Vector3]. The floating point coordinates will be truncated. + + + + + + Enumerated value for the X axis. + + + Enumerated value for the Y axis. + + + Enumerated value for the Z axis. + + + Zero vector. + + + One vector. + + + Left unit vector. + + + Right unit vector. + + + Up unit vector. + + + Down unit vector. + + + Forward unit vector. + + + Back unit vector. + + + diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp index fa3ec7f706..b0a89ff4b8 100644 --- a/editor/doc/doc_dump.cpp +++ b/editor/doc/doc_dump.cpp @@ -198,7 +198,7 @@ void DocDump::dump(const String &p_file) { default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")"; break; case Variant::OBJECT: - case Variant::DICTIONARY: // 20 + case Variant::DICTIONARY: case Variant::ARRAY: case Variant::_RID: diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index a53a060479..e154b13eac 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3173,7 +3173,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(min, max, step, hide_slider); add_property_editor(p_path, editor); - } break; // 5 + } break; case Variant::RECT2: { EditorPropertyRect2 *editor = memnew(EditorPropertyRect2); double min = -65535, max = 65535, step = default_float_step; @@ -3260,7 +3260,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(min, max, step, hide_slider); add_property_editor(p_path, editor); - } break; // 10 + } break; case Variant::AABB: { EditorPropertyAABB *editor = memnew(EditorPropertyAABB); double min = -65535, max = 65535, step = default_float_step; @@ -3349,7 +3349,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ } add_property_editor(p_path, editor); - } break; // 15 + } break; case Variant::_RID: { EditorPropertyRID *editor = memnew(EditorPropertyRID); add_property_editor(p_path, editor); @@ -3388,7 +3388,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ EditorPropertyArray *editor = memnew(EditorPropertyArray); editor->setup(Variant::PACKED_BYTE_ARRAY); add_property_editor(p_path, editor); - } break; // 20 + } break; case Variant::PACKED_INT32_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); editor->setup(Variant::PACKED_INT32_ARRAY); @@ -3423,7 +3423,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ EditorPropertyArray *editor = memnew(EditorPropertyArray); editor->setup(Variant::PACKED_VECTOR3_ARRAY); add_property_editor(p_path, editor); - } break; // 25 + } break; case Variant::PACKED_COLOR_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); editor->setup(Variant::PACKED_COLOR_ARRAY); diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index 4d70f1143c..934e856fbf 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -56,31 +56,33 @@ typedef enum godot_variant_type { GODOT_VARIANT_TYPE_STRING, // math types - - GODOT_VARIANT_TYPE_VECTOR2, // 5 + GODOT_VARIANT_TYPE_VECTOR2, + GODOT_VARIANT_TYPE_VECTOR2I, GODOT_VARIANT_TYPE_RECT2, + GODOT_VARIANT_TYPE_RECT2I, GODOT_VARIANT_TYPE_VECTOR3, + GODOT_VARIANT_TYPE_VECTOR3I, GODOT_VARIANT_TYPE_TRANSFORM2D, GODOT_VARIANT_TYPE_PLANE, - GODOT_VARIANT_TYPE_QUAT, // 10 + GODOT_VARIANT_TYPE_QUAT, GODOT_VARIANT_TYPE_AABB, GODOT_VARIANT_TYPE_BASIS, GODOT_VARIANT_TYPE_TRANSFORM, // misc types GODOT_VARIANT_TYPE_COLOR, - GODOT_VARIANT_TYPE_NODE_PATH, // 15 + GODOT_VARIANT_TYPE_NODE_PATH, GODOT_VARIANT_TYPE_RID, GODOT_VARIANT_TYPE_OBJECT, GODOT_VARIANT_TYPE_DICTIONARY, - GODOT_VARIANT_TYPE_ARRAY, // 20 + GODOT_VARIANT_TYPE_ARRAY, // arrays GODOT_VARIANT_TYPE_PACKED_BYTE_ARRAY, GODOT_VARIANT_TYPE_PACKED_INT_ARRAY, GODOT_VARIANT_TYPE_PACKED_REAL_ARRAY, GODOT_VARIANT_TYPE_PACKED_STRING_ARRAY, - GODOT_VARIANT_TYPE_PACKED_VECTOR2_ARRAY, // 25 + GODOT_VARIANT_TYPE_PACKED_VECTOR2_ARRAY, GODOT_VARIANT_TYPE_PACKED_VECTOR3_ARRAY, GODOT_VARIANT_TYPE_PACKED_COLOR_ARRAY, } godot_variant_type; -- cgit v1.2.3