diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-25 18:14:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-25 18:14:49 +0100 |
commit | f708ab55530e47b2f9ad761b922f86363b27e9f7 (patch) | |
tree | 1f0d43004fe59f9ad28d8b10ce9317bc360583b0 | |
parent | dace1ec9126c752792a0566cfd9485a8ad40c0d1 (diff) | |
parent | 6c8f2ae53a1921aa8589cf4da735f5cd443ff706 (diff) |
Merge pull request #36510 from akien-mga/int-vectors-doc-bindings
Update docs and bindings for new integer vector types
-rw-r--r-- | core/global_constants.cpp | 20 | ||||
-rw-r--r-- | core/io/marshalls.cpp | 8 | ||||
-rw-r--r-- | core/variant.h | 16 | ||||
-rw-r--r-- | core/variant_call.cpp | 22 | ||||
-rw-r--r-- | core/variant_op.cpp | 48 | ||||
-rw-r--r-- | doc/classes/@GlobalScope.xml | 62 | ||||
-rw-r--r-- | doc/classes/Rect2.xml | 14 | ||||
-rw-r--r-- | doc/classes/Rect2i.xml | 52 | ||||
-rw-r--r-- | doc/classes/String.xml | 30 | ||||
-rw-r--r-- | doc/classes/Vector2.xml | 14 | ||||
-rw-r--r-- | doc/classes/Vector2i.xml | 61 | ||||
-rw-r--r-- | doc/classes/Vector3.xml | 14 | ||||
-rw-r--r-- | doc/classes/Vector3i.xml | 72 | ||||
-rw-r--r-- | editor/doc/doc_dump.cpp | 2 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 10 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/variant.h | 14 |
16 files changed, 358 insertions, 101 deletions
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<const Dictionary *>(_data._mem); return dic->has(p_index); - } break; // 20 + } break; case ARRAY: { const Array *arr = reinterpret_cast<const Array *>(_data._mem); @@ -3302,13 +3302,13 @@ void Variant::get_property_list(List<PropertyInfo> *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<PropertyInfo> *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<PropertyInfo> *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<PropertyInfo> *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 @@ <constant name="TYPE_VECTOR2" value="5" enum="Variant.Type"> Variable is of type [Vector2]. </constant> - <constant name="TYPE_RECT2" value="6" enum="Variant.Type"> + <constant name="TYPE_VECTOR2I" value="6" enum="Variant.Type"> + Variable is of type [Vector2i]. + </constant> + <constant name="TYPE_RECT2" value="7" enum="Variant.Type"> Variable is of type [Rect2]. </constant> - <constant name="TYPE_VECTOR3" value="7" enum="Variant.Type"> + <constant name="TYPE_RECT2I" value="8" enum="Variant.Type"> + Variable is of type [Rect2i]. + </constant> + <constant name="TYPE_VECTOR3" value="9" enum="Variant.Type"> Variable is of type [Vector3]. </constant> - <constant name="TYPE_TRANSFORM2D" value="8" enum="Variant.Type"> + <constant name="TYPE_VECTOR3I" value="10" enum="Variant.Type"> + Variable is of type [Vector3i]. + </constant> + <constant name="TYPE_TRANSFORM2D" value="11" enum="Variant.Type"> Variable is of type [Transform2D]. </constant> - <constant name="TYPE_PLANE" value="9" enum="Variant.Type"> + <constant name="TYPE_PLANE" value="12" enum="Variant.Type"> Variable is of type [Plane]. </constant> - <constant name="TYPE_QUAT" value="10" enum="Variant.Type"> + <constant name="TYPE_QUAT" value="13" enum="Variant.Type"> Variable is of type [Quat]. </constant> - <constant name="TYPE_AABB" value="11" enum="Variant.Type"> + <constant name="TYPE_AABB" value="14" enum="Variant.Type"> Variable is of type [AABB]. </constant> - <constant name="TYPE_BASIS" value="12" enum="Variant.Type"> + <constant name="TYPE_BASIS" value="15" enum="Variant.Type"> Variable is of type [Basis]. </constant> - <constant name="TYPE_TRANSFORM" value="13" enum="Variant.Type"> + <constant name="TYPE_TRANSFORM" value="16" enum="Variant.Type"> Variable is of type [Transform]. </constant> - <constant name="TYPE_COLOR" value="14" enum="Variant.Type"> + <constant name="TYPE_COLOR" value="17" enum="Variant.Type"> Variable is of type [Color]. </constant> - <constant name="TYPE_STRING_NAME" value="15" enum="Variant.Type"> + <constant name="TYPE_STRING_NAME" value="18" enum="Variant.Type"> + Variable is of type [StringName]. </constant> - <constant name="TYPE_NODE_PATH" value="16" enum="Variant.Type"> + <constant name="TYPE_NODE_PATH" value="19" enum="Variant.Type"> Variable is of type [NodePath]. </constant> - <constant name="TYPE_RID" value="17" enum="Variant.Type"> + <constant name="TYPE_RID" value="20" enum="Variant.Type"> Variable is of type [RID]. </constant> - <constant name="TYPE_OBJECT" value="18" enum="Variant.Type"> + <constant name="TYPE_OBJECT" value="21" enum="Variant.Type"> Variable is of type [Object]. </constant> - <constant name="TYPE_CALLABLE" value="19" enum="Variant.Type"> + <constant name="TYPE_CALLABLE" value="22" enum="Variant.Type"> + Variable is of type [Callable]. </constant> - <constant name="TYPE_SIGNAL" value="20" enum="Variant.Type"> + <constant name="TYPE_SIGNAL" value="23" enum="Variant.Type"> + Variable is of type [Signal]. </constant> - <constant name="TYPE_DICTIONARY" value="21" enum="Variant.Type"> + <constant name="TYPE_DICTIONARY" value="24" enum="Variant.Type"> Variable is of type [Dictionary]. </constant> - <constant name="TYPE_ARRAY" value="22" enum="Variant.Type"> + <constant name="TYPE_ARRAY" value="25" enum="Variant.Type"> Variable is of type [Array]. </constant> - <constant name="TYPE_RAW_ARRAY" value="23" enum="Variant.Type"> + <constant name="TYPE_RAW_ARRAY" value="26" enum="Variant.Type"> Variable is of type [PackedByteArray]. </constant> - <constant name="TYPE_INT_ARRAY" value="24" enum="Variant.Type"> + <constant name="TYPE_INT_ARRAY" value="27" enum="Variant.Type"> Variable is of type [PackedIntArray]. </constant> - <constant name="TYPE_REAL_ARRAY" value="25" enum="Variant.Type"> + <constant name="TYPE_REAL_ARRAY" value="28" enum="Variant.Type"> Variable is of type [PackedRealArray]. </constant> - <constant name="TYPE_STRING_ARRAY" value="26" enum="Variant.Type"> + <constant name="TYPE_STRING_ARRAY" value="29" enum="Variant.Type"> Variable is of type [PackedStringArray]. </constant> - <constant name="TYPE_VECTOR2_ARRAY" value="27" enum="Variant.Type"> + <constant name="TYPE_VECTOR2_ARRAY" value="30" enum="Variant.Type"> Variable is of type [PackedVector2Array]. </constant> - <constant name="TYPE_VECTOR3_ARRAY" value="28" enum="Variant.Type"> + <constant name="TYPE_VECTOR3_ARRAY" value="31" enum="Variant.Type"> Variable is of type [PackedVector3Array]. </constant> - <constant name="TYPE_COLOR_ARRAY" value="29" enum="Variant.Type"> + <constant name="TYPE_COLOR_ARRAY" value="32" enum="Variant.Type"> Variable is of type [PackedColorArray]. </constant> - <constant name="TYPE_MAX" value="30" enum="Variant.Type"> + <constant name="TYPE_MAX" value="33" enum="Variant.Type"> Represents the size of the [enum Variant.Type] enum. </constant> <constant name="OP_EQUAL" value="0" enum="Variant.Operator"> 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 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Rect2" version="4.0"> <brief_description> - 2D axis-aligned bounding box. + 2D axis-aligned bounding box using floating point coordinates. </brief_description> <description> - 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. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> @@ -36,6 +37,15 @@ Constructs a [Rect2] by x, y, width, and height. </description> </method> + <method name="Rect2"> + <return type="Rect2"> + </return> + <argument index="0" name="from" type="Rect2i"> + </argument> + <description> + Constructs a [Rect2] from a [Rect2i]. + </description> + </method> <method name="abs"> <return type="Rect2"> </return> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="Rect2i" version="4.0"> + <brief_description> + 2D axis-aligned bounding box using integer coordinates. + </brief_description> + <description> + [Rect2i] consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. + It uses integer coordinates. + </description> + <tutorials> + <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> + </tutorials> + <methods> + <method name="Rect2i"> + <return type="Rect2i"> + </return> + <argument index="0" name="position" type="Vector2"> + </argument> + <argument index="1" name="size" type="Vector2"> + </argument> + <description> + Constructs a [Rect2i] by position and size. + </description> + </method> + <method name="Rect2i"> + <return type="Rect2i"> + </return> + <argument index="0" name="x" type="int"> + </argument> + <argument index="1" name="y" type="int"> + </argument> + <argument index="2" name="width" type="int"> + </argument> + <argument index="3" name="height" type="int"> + </argument> + <description> + Constructs a [Rect2i] by x, y, width, and height. + </description> + </method> + <method name="Rect2i"> + <return type="Rect2i"> + </return> + <argument index="0" name="from" type="Rect2"> + </argument> + <description> + Constructs a new [Rect2i] from [Rect2]. The floating point coordinates will be truncated. + </description> + </method> + </methods> + <constants> + </constants> +</class> 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 @@ -49,6 +49,15 @@ <method name="String"> <return type="String"> </return> + <argument index="0" name="from" type="Vector2i"> + </argument> + <description> + Constructs a new String from the given [Vector2i]. + </description> + </method> + <method name="String"> + <return type="String"> + </return> <argument index="0" name="from" type="Rect2"> </argument> <description> @@ -58,6 +67,15 @@ <method name="String"> <return type="String"> </return> + <argument index="0" name="from" type="Rect2i"> + </argument> + <description> + Constructs a new String from the given [Rect2i]. + </description> + </method> + <method name="String"> + <return type="String"> + </return> <argument index="0" name="from" type="Vector3"> </argument> <description> @@ -67,6 +85,15 @@ <method name="String"> <return type="String"> </return> + <argument index="0" name="from" type="Vector3i"> + </argument> + <description> + Constructs a new String from the given [Vector3i]. + </description> + </method> + <method name="String"> + <return type="String"> + </return> <argument index="0" name="from" type="Transform2D"> </argument> <description> @@ -133,6 +160,7 @@ <argument index="0" name="from" type="StringName"> </argument> <description> + Constructs a new String from the given [StringName]. </description> </method> <method name="String"> @@ -159,6 +187,7 @@ <argument index="0" name="from" type="Callable"> </argument> <description> + Constructs a new String from the given [Callable]. </description> </method> <method name="String"> @@ -167,6 +196,7 @@ <argument index="0" name="from" type="Signal"> </argument> <description> + Constructs a new String from the given [Signal]. </description> </method> <method name="String"> 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,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Vector2" version="4.0"> <brief_description> - Vector used for 2D math. + Vector used for 2D math using floating point coordinates. </brief_description> <description> 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. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> @@ -13,12 +14,21 @@ <method name="Vector2"> <return type="Vector2"> </return> + <argument index="0" name="from" type="Vector2i"> + </argument> + <description> + Constructs a new [Vector2] from [Vector2i]. + </description> + </method> + <method name="Vector2"> + <return type="Vector2"> + </return> <argument index="0" name="x" type="float"> </argument> <argument index="1" name="y" type="float"> </argument> <description> - 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]. </description> </method> <method name="abs"> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="Vector2i" version="4.0"> + <brief_description> + Vector used for 2D math using integer coordinates. + </brief_description> + <description> + 2-element structure that can be used to represent positions in 2D space or any other pair of numeric values. + It uses integer coordinates. + </description> + <tutorials> + <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> + </tutorials> + <methods> + <method name="Vector2i"> + <return type="Vector2i"> + </return> + <argument index="0" name="x" type="int"> + </argument> + <argument index="1" name="y" type="int"> + </argument> + <description> + Constructs a new [Vector2i] from the given [code]x[/code] and [code]y[/code]. + </description> + </method> + <method name="Vector2i"> + <return type="Vector2i"> + </return> + <argument index="0" name="from" type="Vector2"> + </argument> + <description> + Constructs a new [Vector2i] from [Vector2]. The floating point coordinates will be truncated. + </description> + </method> + </methods> + <constants> + <constant name="AXIS_X" value="0"> + Enumerated value for the X axis. + </constant> + <constant name="AXIS_Y" value="1"> + Enumerated value for the Y axis. + </constant> + <constant name="ZERO" value="Vector2i( 0, 0 )"> + Zero vector. + </constant> + <constant name="ONE" value="Vector2i( 1, 1 )"> + One vector. + </constant> + <constant name="LEFT" value="Vector2i( -1, 0 )"> + Left unit vector. + </constant> + <constant name="RIGHT" value="Vector2i( 1, 0 )"> + Right unit vector. + </constant> + <constant name="UP" value="Vector2i( 0, -1 )"> + Up unit vector. + </constant> + <constant name="DOWN" value="Vector2i( 0, 1 )"> + Down unit vector. + </constant> + </constants> +</class> 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,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Vector3" version="4.0"> <brief_description> - Vector used for 3D math. + Vector used for 3D math using floating point coordinates. </brief_description> <description> 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. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> @@ -13,6 +14,15 @@ <method name="Vector3"> <return type="Vector3"> </return> + <argument index="0" name="from" type="Vector3i"> + </argument> + <description> + Constructs a new [Vector3] from [Vector3i]. + </description> + </method> + <method name="Vector3"> + <return type="Vector3"> + </return> <argument index="0" name="x" type="float"> </argument> <argument index="1" name="y" type="float"> @@ -20,7 +30,7 @@ <argument index="2" name="z" type="float"> </argument> <description> - Returns a Vector3 with the given components. + Returns a [Vector3] with the given components. </description> </method> <method name="abs"> 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 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="Vector3i" version="4.0"> + <brief_description> + Vector used for 3D math using integer coordinates. + </brief_description> + <description> + 3-element structure that can be used to represent positions in 3D space or any other pair of numeric values. + It uses integer coordinates. + </description> + <tutorials> + <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> + </tutorials> + <methods> + <method name="Vector3i"> + <return type="Vector3i"> + </return> + <argument index="0" name="x" type="int"> + </argument> + <argument index="1" name="y" type="int"> + </argument> + <argument index="2" name="z" type="int"> + </argument> + <description> + Returns a [Vector3i] with the given components. + </description> + </method> + <method name="Vector3i"> + <return type="Vector3i"> + </return> + <argument index="0" name="from" type="Vector3"> + </argument> + <description> + Constructs a new [Vector3i] from [Vector3]. The floating point coordinates will be truncated. + </description> + </method> + </methods> + <constants> + <constant name="AXIS_X" value="0"> + Enumerated value for the X axis. + </constant> + <constant name="AXIS_Y" value="1"> + Enumerated value for the Y axis. + </constant> + <constant name="AXIS_Z" value="2"> + Enumerated value for the Z axis. + </constant> + <constant name="ZERO" value="Vector3i( 0, 0, 0 )"> + Zero vector. + </constant> + <constant name="ONE" value="Vector3i( 1, 1, 1 )"> + One vector. + </constant> + <constant name="LEFT" value="Vector3i( -1, 0, 0 )"> + Left unit vector. + </constant> + <constant name="RIGHT" value="Vector3i( 1, 0, 0 )"> + Right unit vector. + </constant> + <constant name="UP" value="Vector3i( 0, 1, 0 )"> + Up unit vector. + </constant> + <constant name="DOWN" value="Vector3i( 0, -1, 0 )"> + Down unit vector. + </constant> + <constant name="FORWARD" value="Vector3i( 0, 0, -1 )"> + Forward unit vector. + </constant> + <constant name="BACK" value="Vector3i( 0, 0, 1 )"> + Back unit vector. + </constant> + </constants> +</class> 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; |