From c15f3746903dd93a50a090d5b1a8d9c3b9cd7d79 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 25 Apr 2022 15:14:02 -0300 Subject: [PATCH] Fix timeline re-painting issue when changing tag color (#3242) This is the worst possible hack, but we're already doing this for cel and layer color. Something to think about with #3266 --- src/app/commands/cmd_frame_tag_properties.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/app/commands/cmd_frame_tag_properties.cpp b/src/app/commands/cmd_frame_tag_properties.cpp index f6207d39e..95427d5df 100644 --- a/src/app/commands/cmd_frame_tag_properties.cpp +++ b/src/app/commands/cmd_frame_tag_properties.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2020 Igara Studio S.A. +// Copyright (C) 2019-2022 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -21,11 +21,12 @@ #include "app/loop_tag.h" #include "app/tx.h" #include "app/ui/tag_window.h" +#include "app/ui/timeline/timeline.h" #include "base/convert_to.h" #include "doc/anidir.h" #include "doc/sprite.h" -#include "doc/user_data.h" #include "doc/tag.h" +#include "doc/user_data.h" namespace app { @@ -109,8 +110,20 @@ void FrameTagPropertiesCommand::onExecute(Context* context) // Change user data doc::UserData userData = window.userDataValue(); - if (tag->userData() != userData) + if (tag->userData() != userData) { + // TODO Don't invalidate the whole timeline when the tag color + // change, and make this from the Timeline side listening + // DocObserver::onUserDataChange event. Anyway this is done + // in Cel properties and Layer properties dialog, so there is + // some general refactoring needed. + auto app = App::instance(); + if (app && app->timeline() && + tag->userData().color() != userData.color()) { + App::instance()->timeline()->invalidate(); + } + tx(new cmd::SetUserData(tag, userData, static_cast(sprite->document()))); + } tx.commit(); }