diff --git a/src/app/ui/timeline.cpp b/src/app/ui/timeline.cpp index a2d71d135..bfe49247f 100644 --- a/src/app/ui/timeline.cpp +++ b/src/app/ui/timeline.cpp @@ -41,6 +41,7 @@ #include "app/util/clipboard.h" #include "base/convert_to.h" #include "base/memory.h" +#include "base/scoped_value.h" #include "doc/doc.h" #include "doc/document_event.h" #include "doc/frame_tag.h" @@ -131,6 +132,7 @@ Timeline::Timeline() , m_clipboard_timer(100, this) , m_offset_count(0) , m_scroll(false) + , m_fromTimeline(false) { m_ctxConn = m_context->AfterCommandExecution.connect( &Timeline::onAfterCommandExecution, this); @@ -360,6 +362,7 @@ bool Timeline::onProcessMessage(Message* msg) break; } case PART_LAYER_TEXT: { + base::ScopedValue lock(m_fromTimeline, true, false); LayerIndex old_layer = getLayerIndex(m_layer); bool selectLayer = (mouseMsg->left() || !isLayerActive(m_clk.layer)); @@ -387,6 +390,7 @@ bool Timeline::onProcessMessage(Message* msg) case PART_LAYER_CONTINUOUS_ICON: break; case PART_CEL: { + base::ScopedValue lock(m_fromTimeline, true, false); LayerIndex old_layer = getLayerIndex(m_layer); bool selectCel = (mouseMsg->left() || !isLayerActive(m_clk.layer) @@ -1113,6 +1117,9 @@ void Timeline::onStateChanged(Editor* editor) void Timeline::onAfterFrameChanged(Editor* editor) { + if (m_fromTimeline) + return; + setFrame(editor->frame()); if (!hasCapture()) @@ -1124,6 +1131,9 @@ void Timeline::onAfterFrameChanged(Editor* editor) void Timeline::onAfterLayerChanged(Editor* editor) { + if (m_fromTimeline) + return; + setLayer(editor->layer()); if (!hasCapture()) diff --git a/src/app/ui/timeline.h b/src/app/ui/timeline.h index 537f4cf01..afbe84023 100644 --- a/src/app/ui/timeline.h +++ b/src/app/ui/timeline.h @@ -84,9 +84,6 @@ namespace app { Layer* getLayer() { return m_layer; } frame_t getFrame() { return m_frame; } - void setLayer(Layer* layer); - void setFrame(frame_t frame); - State getState() const { return m_state; } bool isMovingCel() const; @@ -185,6 +182,8 @@ namespace app { int xpos, ypos; }; + void setLayer(Layer* layer); + void setFrame(frame_t frame); bool allLayersVisible(); bool allLayersInvisible(); bool allLayersLocked(); @@ -287,6 +286,7 @@ namespace app { bool m_scroll; // True if the drag-and-drop operation is a scroll operation. bool m_copy; // True if the drag-and-drop operation is a copy. + bool m_fromTimeline; AniControls m_aniControls;