From bcee7e24dbcb7c086717b6c3566d85189481cff3 Mon Sep 17 00:00:00 2001 From: Stanislav Denisov Date: Thu, 29 Jan 2026 19:03:22 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20texture=20animation=20doesn=E2=80=99t=20r?= =?UTF-8?q?eset=20(#1524)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/MaterialWindow.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Editor/MaterialWindow.cpp b/Editor/MaterialWindow.cpp index 6ef8a5abd..4433e0f83 100644 --- a/Editor/MaterialWindow.cpp +++ b/Editor/MaterialWindow.cpp @@ -48,6 +48,17 @@ MaterialComponent* get_material(Scene& scene, PickResult x) return material; }; +void ResetTexAnim(MaterialComponent* material) +{ + if (material->texAnimFrameRate == 0 && material->texAnimDirection.x == 0 && material->texAnimDirection.y == 0) + { + material->texAnimElapsedTime = 0; + material->texMulAdd.z = 0; + material->texMulAdd.w = 0; + material->SetDirty(); + } +} + void MaterialWindow::Create(EditorComponent* _editor) { editor = _editor; @@ -674,6 +685,7 @@ void MaterialWindow::Create(EditorComponent* _editor) texAnimFrameRateSlider.SetPos(XMFLOAT2(x, y += step)); texAnimFrameRateSlider.OnSlide(forEachSelected([] (auto material, auto args) { material->texAnimFrameRate = args.fValue; + ResetTexAnim(material); })); AddWidget(&texAnimFrameRateSlider); @@ -683,6 +695,7 @@ void MaterialWindow::Create(EditorComponent* _editor) texAnimDirectionSliderU.SetPos(XMFLOAT2(x, y += step)); texAnimDirectionSliderU.OnSlide(forEachSelected([] (auto material, auto args) { material->texAnimDirection.x = args.fValue; + ResetTexAnim(material); })); AddWidget(&texAnimDirectionSliderU); @@ -692,6 +705,7 @@ void MaterialWindow::Create(EditorComponent* _editor) texAnimDirectionSliderV.SetPos(XMFLOAT2(x, y += step)); texAnimDirectionSliderV.OnSlide(forEachSelected([] (auto material, auto args) { material->texAnimDirection.y = args.fValue; + ResetTexAnim(material); })); AddWidget(&texAnimDirectionSliderV);