summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-02-22 10:45:00 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-02-22 11:17:10 +0300
commitd49ac0466f354369519f2399b9610253504b17b6 (patch)
treec35f22ddfa1c790ba1dedda1d6a34c0b35a603a5
parente13fae1414b0369fdd3f51b4e3529fd3f272b0e1 (diff)
Fix `SpriteFrames` data loss on 3-to-4 conversion
-rw-r--r--doc/classes/SpriteFrames.xml4
-rw-r--r--editor/renames_map_3_to_4.cpp2
-rw-r--r--scene/resources/sprite_frames.cpp2
3 files changed, 5 insertions, 3 deletions
diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml
index 195f3598d5..59a56e7ca6 100644
--- a/doc/classes/SpriteFrames.xml
+++ b/doc/classes/SpriteFrames.xml
@@ -73,9 +73,9 @@
<description>
Returns a relative duration of the frame [param idx] in the [param anim] animation (defaults to [code]1.0[/code]). For example, a frame with a duration of [code]2.0[/code] is displayed twice as long as a frame with a duration of [code]1.0[/code]. You can calculate the absolute duration (in seconds) of a frame using the following formula:
[codeblock]
- absolute_duration = relative_duration / (animation_fps * abs(speed_scale))
+ absolute_duration = relative_duration / (animation_fps * abs(playing_speed))
[/codeblock]
- In this example, [code]speed_scale[/code] refers to either [member AnimatedSprite2D.speed_scale] or [member AnimatedSprite3D.speed_scale].
+ In this example, [code]playing_speed[/code] refers to either [method AnimatedSprite2D.get_playing_speed] or [method AnimatedSprite3D.get_playing_speed].
</description>
</method>
<method name="get_frame_texture" qualifiers="const">
diff --git a/editor/renames_map_3_to_4.cpp b/editor/renames_map_3_to_4.cpp
index 277df4e66c..d7cac9a2b9 100644
--- a/editor/renames_map_3_to_4.cpp
+++ b/editor/renames_map_3_to_4.cpp
@@ -1174,7 +1174,7 @@ const char *RenamesMap3To4::gdscript_properties_renames[][2] = {
{ "unit_db", "volume_db" }, // AudioStreamPlayer3D
{ "unit_offset", "progress_ratio" }, // PathFollow2D, PathFollow3D
{ "vseparation", "v_separation" }, // Theme
- { "frames", "sprite_frames" }, // AnimatedSprite2D, AnimatedSprite3D
+ // { "frames", "sprite_frames" }, // AnimatedSprite2D, AnimatedSprite3D -- GH-73696
{ nullptr, nullptr },
};
diff --git a/scene/resources/sprite_frames.cpp b/scene/resources/sprite_frames.cpp
index 818be38681..17aaf579dd 100644
--- a/scene/resources/sprite_frames.cpp
+++ b/scene/resources/sprite_frames.cpp
@@ -201,6 +201,7 @@ void SpriteFrames::_set_animations(const Array &p_animations) {
anim.loop = d["loop"];
Array frames = d["frames"];
for (int j = 0; j < frames.size(); j++) {
+#ifndef DISABLE_DEPRECATED
// For compatibility.
Ref<Resource> res = frames[j];
if (res.is_valid()) {
@@ -208,6 +209,7 @@ void SpriteFrames::_set_animations(const Array &p_animations) {
anim.frames.push_back(frame);
continue;
}
+#endif
Dictionary f = frames[j];