diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-11-09 17:46:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-09 17:46:34 +0100 |
commit | 827e5b8bf3ba84719fd98b9a50f6d744de3561e0 (patch) | |
tree | 6089285a595c7f10317a0701206edfb9a7aff83b | |
parent | fdf84d25f3070f7cb8b6fb771f4a71ae4fb25f8e (diff) | |
parent | 9d2e8f2f27ec467e9004e0d94f8106b3bb1d0afd (diff) |
Merge pull request #43412 from akien-mga/variant-rename-_RID-to-RID
Variant: Rename Type::_RID to Type::RID
31 files changed, 98 insertions, 95 deletions
diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 41fa188c5b..4229436e84 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -606,7 +606,7 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_STRING_NAME", Variant::STRING_NAME); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH); - BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::_RID); + BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::RID); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_CALLABLE", Variant::CALLABLE); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_SIGNAL", Variant::SIGNAL); diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index c354c8ea63..3cf4acaf39 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -420,7 +420,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } } break; - case Variant::_RID: { + case Variant::RID: { r_variant = RID(); } break; case Variant::OBJECT: { @@ -1172,7 +1172,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4 * 4; } break; - case Variant::_RID: { + case Variant::RID: { } break; case Variant::CALLABLE: { } break; diff --git a/core/io/packed_data_container.cpp b/core/io/packed_data_container.cpp index f70482288d..fbe8fa8a28 100644 --- a/core/io/packed_data_container.cpp +++ b/core/io/packed_data_container.cpp @@ -246,7 +246,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd } break; // misc types - case Variant::_RID: + case Variant::RID: case Variant::OBJECT: { return _pack(Variant(), tmpdata, string_cache); } break; diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index fe93d9b067..c67e68e4fc 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1467,7 +1467,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia } } break; - case Variant::_RID: { + case Variant::RID: { f->store_32(VARIANT_RID); WARN_PRINT("Can't save RIDs."); RID val = p_property; diff --git a/core/variant/type_info.h b/core/variant/type_info.h index b9ae88d97c..ce7c2bfe14 100644 --- a/core/variant/type_info.h +++ b/core/variant/type_info.h @@ -153,7 +153,7 @@ MAKE_TYPE_INFO(Transform, Variant::TRANSFORM) MAKE_TYPE_INFO(Color, Variant::COLOR) MAKE_TYPE_INFO(StringName, Variant::STRING_NAME) MAKE_TYPE_INFO(NodePath, Variant::NODE_PATH) -MAKE_TYPE_INFO(RID, Variant::_RID) +MAKE_TYPE_INFO(RID, Variant::RID) MAKE_TYPE_INFO(Callable, Variant::CALLABLE) MAKE_TYPE_INFO(Signal, Variant::SIGNAL) MAKE_TYPE_INFO(Dictionary, Variant::DICTIONARY) diff --git a/core/variant/typed_array.h b/core/variant/typed_array.h index 0f3985b2f1..ff42cb687e 100644 --- a/core/variant/typed_array.h +++ b/core/variant/typed_array.h @@ -105,7 +105,7 @@ MAKE_TYPED_ARRAY(Transform, Variant::TRANSFORM) MAKE_TYPED_ARRAY(Color, Variant::COLOR) MAKE_TYPED_ARRAY(StringName, Variant::STRING_NAME) MAKE_TYPED_ARRAY(NodePath, Variant::NODE_PATH) -MAKE_TYPED_ARRAY(RID, Variant::_RID) +MAKE_TYPED_ARRAY(RID, Variant::RID) MAKE_TYPED_ARRAY(Callable, Variant::CALLABLE) MAKE_TYPED_ARRAY(Signal, Variant::SIGNAL) MAKE_TYPED_ARRAY(Dictionary, Variant::DICTIONARY) @@ -207,7 +207,7 @@ MAKE_TYPED_ARRAY_INFO(Transform, Variant::TRANSFORM) MAKE_TYPED_ARRAY_INFO(Color, Variant::COLOR) MAKE_TYPED_ARRAY_INFO(StringName, Variant::STRING_NAME) MAKE_TYPED_ARRAY_INFO(NodePath, Variant::NODE_PATH) -MAKE_TYPED_ARRAY_INFO(RID, Variant::_RID) +MAKE_TYPED_ARRAY_INFO(RID, Variant::RID) MAKE_TYPED_ARRAY_INFO(Callable, Variant::CALLABLE) MAKE_TYPED_ARRAY_INFO(Signal, Variant::SIGNAL) MAKE_TYPED_ARRAY_INFO(Dictionary, Variant::DICTIONARY) diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 73916bbef9..3114a358f7 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -109,7 +109,7 @@ String Variant::get_type_name(Variant::Type p_type) { return "Color"; } break; - case _RID: { + case RID: { return "RID"; } break; case OBJECT: { @@ -342,7 +342,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { } break; - case _RID: { + case RID: { static const Type valid[] = { OBJECT, NIL @@ -649,7 +649,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type } break; - case _RID: { + case RID: { static const Type valid[] = { OBJECT, NIL @@ -891,8 +891,8 @@ bool Variant::is_zero() const { return *reinterpret_cast<const Color *>(_data._mem) == Color(); } break; - case _RID: { - return *reinterpret_cast<const RID *>(_data._mem) == RID(); + case RID: { + return *reinterpret_cast<const ::RID *>(_data._mem) == ::RID(); } break; case OBJECT: { return _get_obj().obj == nullptr; @@ -1109,8 +1109,8 @@ void Variant::reference(const Variant &p_variant) { memnew_placement(_data._mem, Color(*reinterpret_cast<const Color *>(p_variant._data._mem))); } break; - case _RID: { - memnew_placement(_data._mem, RID(*reinterpret_cast<const RID *>(p_variant._data._mem))); + case RID: { + memnew_placement(_data._mem, ::RID(*reinterpret_cast<const ::RID *>(p_variant._data._mem))); } break; case OBJECT: { memnew_placement(_data._mem, ObjData); @@ -1311,9 +1311,11 @@ void Variant::_clear_internal() { _get_obj().obj = nullptr; _get_obj().id = ObjectID(); } break; - case _RID: { + case RID: { // not much need probably - reinterpret_cast<RID *>(_data._mem)->~RID(); + // Can't seem to use destructor + scoping operator, so hack. + typedef ::RID RID_Class; + reinterpret_cast<RID_Class *>(_data._mem)->~RID_Class(); } break; case CALLABLE: { reinterpret_cast<Callable *>(_data._mem)->~Callable(); @@ -1847,8 +1849,8 @@ String Variant::stringify(List<const void *> &stack) const { const Signal &s = *reinterpret_cast<const Signal *>(_data._mem); return s; } break; - case _RID: { - const RID &s = *reinterpret_cast<const RID *>(_data._mem); + case RID: { + const ::RID &s = *reinterpret_cast<const ::RID *>(_data._mem); return "RID(" + itos(s.get_id()) + ")"; } break; default: { @@ -2039,25 +2041,25 @@ Variant::operator NodePath() const { } } -Variant::operator RID() const { - if (type == _RID) { - return *reinterpret_cast<const RID *>(_data._mem); +Variant::operator ::RID() const { + if (type == RID) { + return *reinterpret_cast<const ::RID *>(_data._mem); } else if (type == OBJECT && _get_obj().obj == nullptr) { - return RID(); + return ::RID(); } else if (type == OBJECT && _get_obj().obj) { #ifdef DEBUG_ENABLED if (EngineDebugger::is_active()) { - ERR_FAIL_COND_V_MSG(ObjectDB::get_instance(_get_obj().id) == nullptr, RID(), "Invalid pointer (object was freed)."); + ERR_FAIL_COND_V_MSG(ObjectDB::get_instance(_get_obj().id) == nullptr, ::RID(), "Invalid pointer (object was freed)."); } #endif Callable::CallError ce; Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid, nullptr, 0, ce); - if (ce.error == Callable::CallError::CALL_OK && ret.get_type() == Variant::_RID) { + if (ce.error == Callable::CallError::CALL_OK && ret.get_type() == Variant::RID) { return ret; } - return RID(); + return ::RID(); } else { - return RID(); + return ::RID(); } } @@ -2261,9 +2263,9 @@ Variant::operator Vector<Color>() const { /* helpers */ -Variant::operator Vector<RID>() const { +Variant::operator Vector<::RID>() const { Array va = operator Array(); - Vector<RID> rids; + Vector<::RID> rids; rids.resize(va.size()); for (int i = 0; i < rids.size(); i++) { rids.write[i] = va[i]; @@ -2518,9 +2520,9 @@ Variant::Variant(const NodePath &p_node_path) { memnew_placement(_data._mem, NodePath(p_node_path)); } -Variant::Variant(const RID &p_rid) { - type = _RID; - memnew_placement(_data._mem, RID(p_rid)); +Variant::Variant(const ::RID &p_rid) { + type = RID; + memnew_placement(_data._mem, ::RID(p_rid)); } Variant::Variant(const Object *p_object) { @@ -2578,7 +2580,7 @@ Variant::Variant(const Vector<Plane> &p_array) { } } -Variant::Variant(const Vector<RID> &p_array) { +Variant::Variant(const Vector<::RID> &p_array) { type = ARRAY; Array *rid_array = memnew_placement(_data._mem, Array); @@ -2751,8 +2753,8 @@ void Variant::operator=(const Variant &p_variant) { case COLOR: { *reinterpret_cast<Color *>(_data._mem) = *reinterpret_cast<const Color *>(p_variant._data._mem); } break; - case _RID: { - *reinterpret_cast<RID *>(_data._mem) = *reinterpret_cast<const RID *>(p_variant._data._mem); + case RID: { + *reinterpret_cast<::RID *>(_data._mem) = *reinterpret_cast<const ::RID *>(p_variant._data._mem); } break; case OBJECT: { if (_get_obj().id.is_reference()) { @@ -2953,8 +2955,8 @@ uint32_t Variant::hash() const { return hash_djb2_one_float(reinterpret_cast<const Color *>(_data._mem)->a, hash); } break; - case _RID: { - return hash_djb2_one_64(reinterpret_cast<const RID *>(_data._mem)->get_id()); + case RID: { + return hash_djb2_one_64(reinterpret_cast<const ::RID *>(_data._mem)->get_id()); } break; case OBJECT: { return hash_djb2_one_64(make_uint64_t(_get_obj().obj)); diff --git a/core/variant/variant.h b/core/variant/variant.h index 55927ff211..8bb28b2406 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -97,7 +97,7 @@ public: COLOR, STRING_NAME, NODE_PATH, - _RID, + RID, OBJECT, CALLABLE, SIGNAL, @@ -234,7 +234,7 @@ private: false, //COLOR, true, //STRING_NAME, true, //NODE_PATH, - false, //_RID, + false, //RID, true, //OBJECT, true, //CALLABLE, true, //SIGNAL, @@ -325,7 +325,7 @@ public: operator Color() const; operator NodePath() const; - operator RID() const; + operator ::RID() const; operator Object *() const; operator Node *() const; @@ -350,7 +350,7 @@ public: operator Vector<Variant>() const; operator Vector<StringName>() const; - operator Vector<RID>() const; + operator Vector<::RID>() const; operator Vector<Vector2>() const; // some core type enums to convert to @@ -397,7 +397,7 @@ public: Variant(const Transform &p_transform); Variant(const Color &p_color); Variant(const NodePath &p_node_path); - Variant(const RID &p_rid); + Variant(const ::RID &p_rid); Variant(const Object *p_object); Variant(const Callable &p_callable); Variant(const Signal &p_signal); @@ -417,7 +417,7 @@ public: Variant(const Vector<Variant> &p_array); Variant(const Vector<StringName> &p_array); - Variant(const Vector<RID> &p_array); // helper + Variant(const Vector<::RID> &p_array); // helper Variant(const Vector<Vector2> &p_array); // helper Variant(const IP_Address &p_address); diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 5b9d9e9e8d..929a8e2cc8 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -1219,7 +1219,7 @@ void Variant::_register_variant_methods() { /* RID */ - bind_method(RID, get_id, sarray(), varray()); + bind_method(::RID, get_id, sarray(), varray()); /* NodePath */ diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp index b847ba09b9..e263d98815 100644 --- a/core/variant/variant_construct.cpp +++ b/core/variant/variant_construct.cpp @@ -577,7 +577,7 @@ void Variant::_register_variant_constructors() { add_constructor<VariantConstructor<NodePath, NodePath>>(sarray("from")); add_constructor<VariantConstructor<NodePath, String>>(sarray("from")); - add_constructor<VariantConstructor<RID, RID>>(sarray("from")); + add_constructor<VariantConstructor<::RID, ::RID>>(sarray("from")); add_constructor<VariantConstructorObject>(sarray("from")); add_constructor<VariantConstructorNilObject>(sarray("from")); @@ -654,7 +654,7 @@ void Variant::_register_variant_constructors() { initialize_funcs[COLOR] = variant_initialize<Color>; initialize_funcs[STRING_NAME] = variant_initialize<StringName>; initialize_funcs[NODE_PATH] = variant_initialize<NodePath>; - initialize_funcs[_RID] = variant_initialize<RID>; + initialize_funcs[RID] = variant_initialize<::RID>; initialize_funcs[OBJECT] = variant_initialize_obj; initialize_funcs[CALLABLE] = variant_initialize<Callable>; initialize_funcs[SIGNAL] = variant_initialize<Signal>; diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h index 7fd165aa81..eca02ad4ae 100644 --- a/core/variant/variant_internal.h +++ b/core/variant/variant_internal.h @@ -83,8 +83,8 @@ public: _FORCE_INLINE_ static const StringName *get_string_name(const Variant *v) { return reinterpret_cast<const StringName *>(v->_data._mem); } _FORCE_INLINE_ static NodePath *get_node_path(Variant *v) { return reinterpret_cast<NodePath *>(v->_data._mem); } _FORCE_INLINE_ static const NodePath *get_node_path(const Variant *v) { return reinterpret_cast<const NodePath *>(v->_data._mem); } - _FORCE_INLINE_ static RID *get_rid(Variant *v) { return reinterpret_cast<RID *>(v->_data._mem); } - _FORCE_INLINE_ static const RID *get_rid(const Variant *v) { return reinterpret_cast<const RID *>(v->_data._mem); } + _FORCE_INLINE_ static ::RID *get_rid(Variant *v) { return reinterpret_cast<::RID *>(v->_data._mem); } + _FORCE_INLINE_ static const ::RID *get_rid(const Variant *v) { return reinterpret_cast<const ::RID *>(v->_data._mem); } _FORCE_INLINE_ static Callable *get_callable(Variant *v) { return reinterpret_cast<Callable *>(v->_data._mem); } _FORCE_INLINE_ static const Callable *get_callable(const Variant *v) { return reinterpret_cast<const Callable *>(v->_data._mem); } _FORCE_INLINE_ static Signal *get_signal(Variant *v) { return reinterpret_cast<Signal *>(v->_data._mem); } @@ -405,9 +405,9 @@ struct VariantGetInternalPtr<NodePath> { }; template <> -struct VariantGetInternalPtr<RID> { - static RID *get_ptr(Variant *v) { return VariantInternal::get_rid(v); } - static const RID *get_ptr(const Variant *v) { return VariantInternal::get_rid(v); } +struct VariantGetInternalPtr<::RID> { + static ::RID *get_ptr(Variant *v) { return VariantInternal::get_rid(v); } + static const ::RID *get_ptr(const Variant *v) { return VariantInternal::get_rid(v); } }; template <> @@ -632,9 +632,9 @@ struct VariantInternalAccessor<NodePath> { }; template <> -struct VariantInternalAccessor<RID> { - static _FORCE_INLINE_ const RID &get(const Variant *v) { return *VariantInternal::get_rid(v); } - static _FORCE_INLINE_ void set(Variant *v, const RID &p_value) { *VariantInternal::get_rid(v) = p_value; } +struct VariantInternalAccessor<::RID> { + static _FORCE_INLINE_ const ::RID &get(const Variant *v) { return *VariantInternal::get_rid(v); } + static _FORCE_INLINE_ void set(Variant *v, const ::RID &p_value) { *VariantInternal::get_rid(v) = p_value; } }; template <> @@ -867,8 +867,8 @@ struct VariantInitializer<NodePath> { }; template <> -struct VariantInitializer<RID> { - static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<RID>(v); } +struct VariantInitializer<::RID> { + static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<::RID>(v); } }; template <> diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index 0def758388..4704deac20 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -1778,7 +1778,7 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorEqual<StringName, StringName>>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::STRING_NAME); register_op<OperatorEvaluatorEqual<NodePath, NodePath>>(Variant::OP_EQUAL, Variant::NODE_PATH, Variant::NODE_PATH); - register_op<OperatorEvaluatorEqual<RID, RID>>(Variant::OP_EQUAL, Variant::_RID, Variant::_RID); + register_op<OperatorEvaluatorEqual<::RID, ::RID>>(Variant::OP_EQUAL, Variant::RID, Variant::RID); register_op<OperatorEvaluatorEqualObject>(Variant::OP_EQUAL, Variant::OBJECT, Variant::OBJECT); register_op<OperatorEvaluatorEqualObjectNil>(Variant::OP_EQUAL, Variant::OBJECT, Variant::NIL); @@ -1824,7 +1824,7 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorNotEqual<StringName, StringName>>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::STRING_NAME); register_op<OperatorEvaluatorNotEqual<NodePath, NodePath>>(Variant::OP_NOT_EQUAL, Variant::NODE_PATH, Variant::NODE_PATH); - register_op<OperatorEvaluatorNotEqual<RID, RID>>(Variant::OP_NOT_EQUAL, Variant::_RID, Variant::_RID); + register_op<OperatorEvaluatorNotEqual<::RID, ::RID>>(Variant::OP_NOT_EQUAL, Variant::RID, Variant::RID); register_op<OperatorEvaluatorNotEqualObject>(Variant::OP_NOT_EQUAL, Variant::OBJECT, Variant::OBJECT); register_op<OperatorEvaluatorNotEqualObjectNil>(Variant::OP_NOT_EQUAL, Variant::OBJECT, Variant::NIL); @@ -1854,7 +1854,7 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorLess<Vector2i, Vector2i>>(Variant::OP_LESS, Variant::VECTOR2I, Variant::VECTOR2I); register_op<OperatorEvaluatorLess<Vector3, Vector3>>(Variant::OP_LESS, Variant::VECTOR3, Variant::VECTOR3); register_op<OperatorEvaluatorLess<Vector3i, Vector3i>>(Variant::OP_LESS, Variant::VECTOR3I, Variant::VECTOR3I); - register_op<OperatorEvaluatorLess<RID, RID>>(Variant::OP_LESS, Variant::_RID, Variant::_RID); + register_op<OperatorEvaluatorLess<::RID, ::RID>>(Variant::OP_LESS, Variant::RID, Variant::RID); register_op<OperatorEvaluatorLess<Array, Array>>(Variant::OP_LESS, Variant::ARRAY, Variant::ARRAY); register_op<OperatorEvaluatorLessEqual<int64_t, int64_t>>(Variant::OP_LESS_EQUAL, Variant::INT, Variant::INT); @@ -1866,7 +1866,7 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorLessEqual<Vector2i, Vector2i>>(Variant::OP_LESS_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I); register_op<OperatorEvaluatorLessEqual<Vector3, Vector3>>(Variant::OP_LESS_EQUAL, Variant::VECTOR3, Variant::VECTOR3); register_op<OperatorEvaluatorLessEqual<Vector3i, Vector3i>>(Variant::OP_LESS_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I); - register_op<OperatorEvaluatorLessEqual<RID, RID>>(Variant::OP_LESS_EQUAL, Variant::_RID, Variant::_RID); + register_op<OperatorEvaluatorLessEqual<::RID, ::RID>>(Variant::OP_LESS_EQUAL, Variant::RID, Variant::RID); register_op<OperatorEvaluatorLessEqual<Array, Array>>(Variant::OP_LESS_EQUAL, Variant::ARRAY, Variant::ARRAY); register_op<OperatorEvaluatorGreater<bool, bool>>(Variant::OP_GREATER, Variant::BOOL, Variant::BOOL); @@ -1879,7 +1879,7 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorGreater<Vector2i, Vector2i>>(Variant::OP_GREATER, Variant::VECTOR2I, Variant::VECTOR2I); register_op<OperatorEvaluatorGreater<Vector3, Vector3>>(Variant::OP_GREATER, Variant::VECTOR3, Variant::VECTOR3); register_op<OperatorEvaluatorGreater<Vector3i, Vector3i>>(Variant::OP_GREATER, Variant::VECTOR3I, Variant::VECTOR3I); - register_op<OperatorEvaluatorGreater<RID, RID>>(Variant::OP_GREATER, Variant::_RID, Variant::_RID); + register_op<OperatorEvaluatorGreater<::RID, ::RID>>(Variant::OP_GREATER, Variant::RID, Variant::RID); register_op<OperatorEvaluatorGreater<Array, Array>>(Variant::OP_GREATER, Variant::ARRAY, Variant::ARRAY); register_op<OperatorEvaluatorGreaterEqual<int64_t, int64_t>>(Variant::OP_GREATER_EQUAL, Variant::INT, Variant::INT); @@ -1891,7 +1891,7 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorGreaterEqual<Vector2i, Vector2i>>(Variant::OP_GREATER_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I); register_op<OperatorEvaluatorGreaterEqual<Vector3, Vector3>>(Variant::OP_GREATER_EQUAL, Variant::VECTOR3, Variant::VECTOR3); register_op<OperatorEvaluatorGreaterEqual<Vector3i, Vector3i>>(Variant::OP_GREATER_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I); - register_op<OperatorEvaluatorGreaterEqual<RID, RID>>(Variant::OP_GREATER_EQUAL, Variant::_RID, Variant::_RID); + register_op<OperatorEvaluatorGreaterEqual<::RID, ::RID>>(Variant::OP_GREATER_EQUAL, Variant::RID, Variant::RID); register_op<OperatorEvaluatorGreaterEqual<Array, Array>>(Variant::OP_GREATER_EQUAL, Variant::ARRAY, Variant::ARRAY); register_op<OperatorEvaluatorAlwaysFalse<Variant::OP_OR, Variant::NIL, Variant::NIL>>(Variant::OP_OR, Variant::NIL, Variant::NIL); diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp index cae64376d5..05fe2b80d9 100644 --- a/core/variant/variant_setget.cpp +++ b/core/variant/variant_setget.cpp @@ -2385,7 +2385,7 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & r_dst = a; } return; - case _RID: { + case RID: { r_dst = a; } return; diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 2d8a174773..248073c5a2 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1023,7 +1023,7 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n for (int i = 0; i < VARIANT_ARG_MAX; i++) { //no pointers, sorry - if (argptr[i] && (argptr[i]->get_type() == Variant::OBJECT || argptr[i]->get_type() == Variant::_RID)) { + if (argptr[i] && (argptr[i]->get_type() == Variant::OBJECT || argptr[i]->get_type() == Variant::RID)) { return; } } diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 9e7ddd9fac..1443302f3f 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3645,7 +3645,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ add_property_editor(p_path, editor); } break; - case Variant::_RID: { + case Variant::RID: { EditorPropertyRID *editor = memnew(EditorPropertyRID); add_property_editor(p_path, editor); } break; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index aa723af292..56fbfbd0c2 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -892,7 +892,7 @@ void EditorPropertyDictionary::update_property() { prop = memnew(EditorPropertyNodePath); } break; - case Variant::_RID: { + case Variant::RID: { prop = memnew(EditorPropertyRID); } break; diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index b6bd6345df..1e4ed0c552 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -345,7 +345,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: checks20[i]->hide(); } - type = (p_variant.get_type() != Variant::NIL && p_variant.get_type() != Variant::_RID && p_type != Variant::OBJECT) ? p_variant.get_type() : p_type; + type = (p_variant.get_type() != Variant::NIL && p_variant.get_type() != Variant::RID && p_type != Variant::OBJECT) ? p_variant.get_type() : p_type; switch (type) { case Variant::BOOL: { diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 7d50b63924..6b23ab1616 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -2541,7 +2541,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::STRING; break; // Don't support indexing, but we will check it later. - case Variant::_RID: + case Variant::RID: case Variant::BOOL: case Variant::CALLABLE: case Variant::FLOAT: @@ -2574,7 +2574,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri switch (base_type.builtin_type) { // Can't index at all. - case Variant::_RID: + case Variant::RID: case Variant::BOOL: case Variant::CALLABLE: case Variant::FLOAT: diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 10cc6febbc..1eb3846319 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -65,7 +65,7 @@ Variant::Type GDScriptParser::get_builtin_type(const StringName &p_type) { builtin_types["Basis"] = Variant::BASIS; builtin_types["Transform"] = Variant::TRANSFORM; builtin_types["Color"] = Variant::COLOR; - builtin_types["RID"] = Variant::_RID; + builtin_types["RID"] = Variant::RID; builtin_types["Object"] = Variant::OBJECT; builtin_types["StringName"] = Variant::STRING_NAME; builtin_types["NodePath"] = Variant::NODE_PATH; diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index e59dd24c34..b4537f531d 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -477,7 +477,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { Variant::COLOR, Variant::STRING_NAME, Variant::NODE_PATH, - Variant::_RID, + Variant::RID, Variant::CALLABLE }; diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 4ad5cdbf47..ff3122a77f 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -2426,7 +2426,7 @@ bool BindingsGenerator::_arg_default_value_is_assignable_to_type(const Variant & case Variant::VECTOR2: case Variant::RECT2: case Variant::VECTOR3: - case Variant::_RID: + case Variant::RID: case Variant::ARRAY: case Variant::DICTIONARY: case Variant::PACKED_BYTE_ARRAY: @@ -2979,7 +2979,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar r_iarg.default_argument = "new %s()"; r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF; break; - case Variant::_RID: + case Variant::RID: ERR_FAIL_COND_V_MSG(r_iarg.type.cname != name_cache.type_RID, false, "Parameter of type '" + String(r_iarg.type.cname) + "' cannot have a default value of type '" + String(name_cache.type_RID) + "'."); diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 563c45e71f..00a1e1e507 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -355,7 +355,7 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ } if (CACHED_CLASS(RID) == type_class) { - MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID()); + MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator ::RID()); mono_field_set_value(p_object, mono_field, managed); break; } @@ -450,8 +450,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath()); mono_field_set_value(p_object, mono_field, managed); } break; - case Variant::_RID: { - MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID()); + case Variant::RID: { + MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator ::RID()); mono_field_set_value(p_object, mono_field, managed); } break; case Variant::OBJECT: { diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index c460e283ea..9d193ab8ab 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -204,7 +204,7 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_ } if (CACHED_CLASS(RID) == type_class) { - return Variant::_RID; + return Variant::RID; } if (CACHED_CLASS(Dictionary) == type_class) { @@ -580,7 +580,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty } if (CACHED_CLASS(RID) == type_class) { - return GDMonoUtils::create_managed_from(p_var->operator RID()); + return GDMonoUtils::create_managed_from(p_var->operator ::RID()); } // Godot.Collections.Dictionary or IDictionary @@ -673,8 +673,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return GDMonoUtils::create_managed_from(p_var->operator StringName()); case Variant::NODE_PATH: return GDMonoUtils::create_managed_from(p_var->operator NodePath()); - case Variant::_RID: - return GDMonoUtils::create_managed_from(p_var->operator RID()); + case Variant::RID: + return GDMonoUtils::create_managed_from(p_var->operator ::RID()); case Variant::OBJECT: return GDMonoUtils::unmanaged_get_managed(p_var->operator Object *()); case Variant::CALLABLE: { diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 5fa3c2a873..1bb96a47f3 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -388,7 +388,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::NODE_PATH: color = Color(0.41, 0.58, 0.93); break; - case Variant::_RID: + case Variant::RID: color = Color(0.41, 0.93, 0.6); break; case Variant::OBJECT: @@ -494,7 +494,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::NODE_PATH: color = Color(0.41, 0.58, 0.93); break; - case Variant::_RID: + case Variant::RID: color = Color(0.17, 0.9, 0.45); break; case Variant::OBJECT: diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis index 90f0b55d0a..1f625cfb77 100644 --- a/platform/windows/godot.natvis +++ b/platform/windows/godot.natvis @@ -49,7 +49,7 @@ <DisplayString Condition="type == Variant::QUAT">{*(Quat *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::COLOR">{*(Color *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::NODE_PATH">{*(NodePath *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::_RID">{*(RID *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::RID">{*(RID *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::OBJECT">{*(Object *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::DICTIONARY">{*(Dictionary *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::ARRAY">{*(Array *)_data._mem}</DisplayString> @@ -79,7 +79,7 @@ <Item Name="[value]" Condition="type == Variant::QUAT">*(Quat *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::COLOR">*(Color *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::NODE_PATH">*(NodePath *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::_RID">*(RID *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::RID">*(RID *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::OBJECT">*(Object *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::DICTIONARY">*(Dictionary *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::ARRAY">*(Array *)_data._mem</Item> diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index 92f0353abf..76d37eaa71 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "shader.h" + #include "core/os/file_access.h" #include "scene/scene_string_names.h" #include "servers/rendering/shader_language.h" @@ -80,7 +81,7 @@ void Shader::get_param_list(List<PropertyInfo> *p_params) const { params_cache[pi.name] = E->get().name; if (p_params) { //small little hack - if (pi.type == Variant::_RID) { + if (pi.type == Variant::RID) { pi.type = Variant::OBJECT; } p_params->push_back(pi); diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 7bff850a15..41d3fe20be 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -341,8 +341,8 @@ void World2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World2D::get_direct_space_state); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "canvas", PROPERTY_HINT_NONE, "", 0), "", "get_canvas"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "canvas", PROPERTY_HINT_NONE, "", 0), "", "get_canvas"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState2D", 0), "", "get_direct_space_state"); } diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp index 8100f150ef..b8fb3825ce 100644 --- a/scene/resources/world_3d.cpp +++ b/scene/resources/world_3d.cpp @@ -321,8 +321,8 @@ void World3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState3D", 0), "", "get_direct_space_state"); } diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp index 88cdd9f991..1ea8985543 100644 --- a/servers/physics_server_2d.cpp +++ b/servers/physics_server_2d.cpp @@ -245,11 +245,11 @@ void PhysicsShapeQueryParameters2D::_bind_methods() { ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &PhysicsShapeQueryParameters2D::is_collide_with_areas_enabled); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::RID) + ":"), "set_exclude", "get_exclude"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "motion"), "set_motion", "get_motion"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D"), "set_shape", "get_shape"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_bodies"), "set_collide_with_bodies", "is_collide_with_bodies_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas"), "set_collide_with_areas", "is_collide_with_areas_enabled"); @@ -504,7 +504,7 @@ void PhysicsTestMotionResult2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collision_normal"), "", "get_collision_normal"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collider_velocity"), "", "get_collider_velocity"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id", PROPERTY_HINT_OBJECT_ID), "", "get_collider_id"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "collider_rid"), "", "get_collider_rid"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "collider_rid"), "", "get_collider_rid"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape"), "", "get_collider_shape"); } diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index 5796bccbac..fabd661970 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -238,10 +238,10 @@ void PhysicsShapeQueryParameters3D::_bind_methods() { ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &PhysicsShapeQueryParameters3D::is_collide_with_areas_enabled); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::RID) + ":"), "set_exclude", "get_exclude"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape3D"), "set_shape", "get_shape"); - ADD_PROPERTY(PropertyInfo(Variant::_RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); + ADD_PROPERTY(PropertyInfo(Variant::RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_bodies"), "set_collide_with_bodies", "is_collide_with_bodies_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas"), "set_collide_with_areas", "is_collide_with_areas_enabled"); diff --git a/tests/test_class_db.h b/tests/test_class_db.h index 63c3a55ea8..29fe837587 100644 --- a/tests/test_class_db.h +++ b/tests/test_class_db.h @@ -255,7 +255,7 @@ bool arg_default_value_is_assignable_to_type(const Context &p_context, const Var case Variant::VECTOR2: case Variant::RECT2: case Variant::VECTOR3: - case Variant::_RID: + case Variant::RID: case Variant::ARRAY: case Variant::DICTIONARY: case Variant::PACKED_BYTE_ARRAY: |