godot
godot copied to clipboard
Scale from Cursor option in AnimationPlayer does not scale from cursor
Tested versions
Reproducible in: Master 4.4.1.stable 3.6.stable
System information
Godot v4.4.1.stable - Windows 11 (build 26100) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 Laptop GPU (NVIDIA; 32.0.15.6614) - AMD Ryzen 7 7840HS w/ Radeon 780M Graphics (16 threads)
Issue description
Scale from Cursor option does the same as Scale Selection. It uses the first key as pivot.
https://github.com/user-attachments/assets/542bf99c-5b7d-47d0-acb4-c3c9a5497154
This is because last_menu_track_opt is set to EDIT_SCALE_CONFIRM by the time it's checked:
https://github.com/godotengine/godot/blob/1f787b63a54b74a5238653883fe1a531200b675e/editor/animation_track_editor.cpp#L6728
The actual function for scaling is also incorrect, while the pivot is not set correctly because of the above, it is also not used correctly in the function:
current:
#define NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * Math::abs(s) + from_t
suggested:
#define NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * Math::abs(s) + pivot
Steps to reproduce
Select some keys and use the function.
Minimal reproduction project (MRP)
NA