summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2020-02-13 16:03:10 -0300
committerJuan Linietsky <juan@godotengine.org>2020-02-15 08:36:04 -0300
commit867d073b98344b848c96012418912a7e72841a31 (patch)
tree3a0fa22ce848b4ee20df2057ebb5eb5d7ea8e89b /scene
parent53cf289f309ef44821e5bb1fe0c81de29a82d9d3 (diff)
Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr.
Diffstat (limited to 'scene')
-rw-r--r--scene/animation/animation_player.cpp2
-rw-r--r--scene/animation/tween.cpp11
-rw-r--r--scene/debugger/script_debugger_remote.cpp2
-rw-r--r--scene/gui/rich_text_label.cpp2
-rw-r--r--scene/resources/font.cpp2
-rw-r--r--scene/resources/resource_format_text.cpp2
6 files changed, 5 insertions, 16 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 740dad9a1a..ceee0529c2 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -106,7 +106,7 @@ bool AnimationPlayer::_get(const StringName &p_name, Variant &r_ret) const {
} else if (name.begins_with("anims/")) {
String which = name.get_slicec('/', 1);
- r_ret = get_animation(which).get_ref_ptr();
+ r_ret = get_animation(which);
} else if (name.begins_with("next/")) {
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 331a6c769c..a7f3794a05 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -1227,7 +1227,6 @@ bool Tween::_build_interpolation(InterpolateType p_interpolation_type, Object *p
// Give it the object
ERR_FAIL_COND_V_MSG(p_object == NULL, false, "Invalid object provided to Tween.");
- ERR_FAIL_COND_V_MSG(!ObjectDB::instance_validate(p_object), false, "Invalid object provided to Tween.");
data.id = p_object->get_instance_id();
// Validate the initial and final values
@@ -1328,7 +1327,6 @@ bool Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_c
// Check that the target object is valid
ERR_FAIL_COND_V(p_object == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false);
// Duration cannot be negative
ERR_FAIL_COND_V(p_duration < 0, false);
@@ -1387,7 +1385,6 @@ bool Tween::interpolate_deferred_callback(Object *p_object, real_t p_duration, S
// Check that the target object is valid
ERR_FAIL_COND_V(p_object == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false);
// No negative durations allowed
ERR_FAIL_COND_V(p_duration < 0, false);
@@ -1457,9 +1454,7 @@ bool Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini
// Confirm the source and target objects are valid
ERR_FAIL_COND_V(p_object == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false);
ERR_FAIL_COND_V(p_target == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_target), false);
// No negative durations
ERR_FAIL_COND_V(p_duration < 0, false);
@@ -1521,9 +1516,7 @@ bool Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi
// Verify the source and target objects are valid
ERR_FAIL_COND_V(p_object == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false);
ERR_FAIL_COND_V(p_target == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_target), false);
// No negative durations
ERR_FAIL_COND_V(p_duration < 0, false);
@@ -1587,9 +1580,7 @@ bool Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_
// Verify both objects are valid
ERR_FAIL_COND_V(p_object == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false);
ERR_FAIL_COND_V(p_initial == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_initial), false);
// No negative durations
ERR_FAIL_COND_V(p_duration < 0, false);
@@ -1655,9 +1646,7 @@ bool Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in
// Make sure the given objects are valid
ERR_FAIL_COND_V(p_object == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_object), false);
ERR_FAIL_COND_V(p_initial == NULL, false);
- ERR_FAIL_COND_V(!ObjectDB::instance_validate(p_initial), false);
// No negative durations
ERR_FAIL_COND_V(p_duration < 0, false);
diff --git a/scene/debugger/script_debugger_remote.cpp b/scene/debugger/script_debugger_remote.cpp
index 3608a11ed7..80972ba3d1 100644
--- a/scene/debugger/script_debugger_remote.cpp
+++ b/scene/debugger/script_debugger_remote.cpp
@@ -106,7 +106,7 @@ void ScriptDebuggerRemote::_put_variable(const String &p_name, const Variant &p_
packet_peer_stream->put_var(p_name);
Variant var = p_variable;
- if (p_variable.get_type() == Variant::OBJECT && !ObjectDB::instance_validate(p_variable)) {
+ if (p_variable.get_type() == Variant::OBJECT && p_variable.get_validated_object() == nullptr) {
var = Variant();
}
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 0c686296b3..6d8be469bd 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2664,7 +2664,7 @@ void RichTextLabel::set_effects(const Vector<Variant> &effects) {
Vector<Variant> RichTextLabel::get_effects() {
Vector<Variant> r;
for (int i = 0; i < custom_effects.size(); i++) {
- r.push_back(custom_effects[i].get_ref_ptr());
+ r.push_back(custom_effects[i]);
}
return r;
}
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 663ae5d45d..872d6a043c 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -192,7 +192,7 @@ Vector<Variant> BitmapFont::_get_textures() const {
Vector<Variant> rtextures;
for (int i = 0; i < textures.size(); i++)
- rtextures.push_back(textures[i].get_ref_ptr());
+ rtextures.push_back(textures[i]);
return rtextures;
}
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 9779f9c9ca..a5475776a7 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -1377,7 +1377,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant,
switch (p_variant.get_type()) {
case Variant::OBJECT: {
- RES res = p_variant.operator RefPtr();
+ RES res = p_variant;
if (res.is_null() || external_resources.has(res))
return;