From d49ac0466f354369519f2399b9610253504b17b6 Mon Sep 17 00:00:00 2001 From: Danil Alexeev Date: Wed, 22 Feb 2023 10:45:00 +0300 Subject: [PATCH] Fix `SpriteFrames` data loss on 3-to-4 conversion --- doc/classes/SpriteFrames.xml | 4 ++-- editor/renames_map_3_to_4.cpp | 2 +- scene/resources/sprite_frames.cpp | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml index 195f3598d53..59a56e7ca6e 100644 --- a/doc/classes/SpriteFrames.xml +++ b/doc/classes/SpriteFrames.xml @@ -73,9 +73,9 @@ 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]. diff --git a/editor/renames_map_3_to_4.cpp b/editor/renames_map_3_to_4.cpp index 277df4e66c2..d7cac9a2b94 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 818be386816..17aaf579ddd 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 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];