Variant: Rename Type::_RID to Type::RID

The underscore prefix was used to avoid the conflict between the `RID` class
name and the matching enum value in `Variant::Type`.

This can be fixed differently by prefixing uses of the `RID` class in `Variant`
with the scope resolution operator, as done already for `AABB`.
This commit is contained in:
Rémi Verschelde 2020-11-09 14:53:05 +01:00
parent bd0c40d051
commit 9d2e8f2f27
No known key found for this signature in database
GPG Key ID: C3336907360768E1
31 changed files with 98 additions and 95 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -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));

View File

@ -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);

View File

@ -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 */

View File

@ -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>;

View File

@ -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 <>

View File

@ -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);

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;

View File

@ -892,7 +892,7 @@ void EditorPropertyDictionary::update_property() {
prop = memnew(EditorPropertyNodePath);
} break;
case Variant::_RID: {
case Variant::RID: {
prop = memnew(EditorPropertyRID);
} break;

View File

@ -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: {

View File

@ -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:

View File

@ -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;

View File

@ -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
};

View File

@ -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) + "'.");

View File

@ -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: {

View File

@ -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: {

View File

@ -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:

View File

@ -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>

View File

@ -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);

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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");

View File

@ -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: