From 4c58441823009773d804864bbbc8574d58935330 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 22 Dec 2015 13:18:08 -0300 Subject: [PATCH] Redraw Timeline when layer/cel user color is changed --- src/app/commands/cmd_cel_properties.cpp | 14 ++++++++++++-- src/app/commands/cmd_layer_properties.cpp | 9 ++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/app/commands/cmd_cel_properties.cpp b/src/app/commands/cmd_cel_properties.cpp index 5c2fd72f4..b471415b4 100644 --- a/src/app/commands/cmd_cel_properties.cpp +++ b/src/app/commands/cmd_cel_properties.cpp @@ -167,8 +167,13 @@ private: if (newOpacity != m_cel->opacity()) transaction.execute(new cmd::SetCelOpacity(writer.cel(), newOpacity)); - if (m_userData != m_cel->data()->userData()) + if (m_userData != m_cel->data()->userData()) { transaction.execute(new cmd::SetUserData(writer.cel()->data(), m_userData)); + + // Redraw timeline because the cel's user data/color + // might have changed. + App::instance()->getMainWindow()->getTimeline()->invalidate(); + } } else { for (Cel* cel : m_document->sprite()->uniqueCels()) { @@ -178,8 +183,13 @@ private: transaction.execute(new cmd::SetCelOpacity(cel, newOpacity)); } - if (m_userData != cel->data()->userData()) + if (m_userData != cel->data()->userData()) { transaction.execute(new cmd::SetUserData(cel->data(), m_userData)); + + // Redraw timeline because the cel's user data/color + // might have changed. + App::instance()->getMainWindow()->getTimeline()->invalidate(); + } } } diff --git a/src/app/commands/cmd_layer_properties.cpp b/src/app/commands/cmd_layer_properties.cpp index 5442ca926..ac8c18db9 100644 --- a/src/app/commands/cmd_layer_properties.cpp +++ b/src/app/commands/cmd_layer_properties.cpp @@ -19,6 +19,8 @@ #include "app/context_access.h" #include "app/modules/gui.h" #include "app/transaction.h" +#include "app/ui/main_window.h" +#include "app/ui/timeline.h" #include "app/ui/user_data_popup.h" #include "app/ui_context.h" #include "base/bind.h" @@ -193,9 +195,14 @@ private: if (newBlendMode != m_layer->blendMode()) transaction.execute(new cmd::SetLayerBlendMode(static_cast(writer.layer()), newBlendMode)); - if (m_userData != m_layer->userData()) + if (m_userData != m_layer->userData()) { transaction.execute(new cmd::SetUserData(writer.layer(), m_userData)); + // Redraw timeline because the layer's user data/color + // might have changed. + App::instance()->getMainWindow()->getTimeline()->invalidate(); + } + transaction.commit(); } catch (const std::exception& e) {