diff --git a/src/app/commands/cmd_goto_frame.cpp b/src/app/commands/cmd_goto_frame.cpp index 99126f06f..a98609028 100644 --- a/src/app/commands/cmd_goto_frame.cpp +++ b/src/app/commands/cmd_goto_frame.cpp @@ -99,7 +99,7 @@ protected: FrameTag* tag = editor ->getCustomizationDelegate() ->getFrameTagProvider() - ->getFrameTagByFrame(frame); + ->getFrameTagByFrame(frame, false); frame_t first = (tag ? tag->fromFrame(): 0); frame_t last = (tag ? tag->toFrame(): editor->sprite()->lastFrame()); @@ -118,7 +118,7 @@ protected: FrameTag* tag = editor ->getCustomizationDelegate() ->getFrameTagProvider() - ->getFrameTagByFrame(frame); + ->getFrameTagByFrame(frame, false); frame_t first = (tag ? tag->fromFrame(): 0); frame_t last = (tag ? tag->toFrame(): editor->sprite()->lastFrame()); diff --git a/src/app/loop_tag.cpp b/src/app/loop_tag.cpp index c53f05d11..57a208a93 100644 --- a/src/app/loop_tag.cpp +++ b/src/app/loop_tag.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2001-2015 David Capello +// Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -19,10 +19,7 @@ const char* kLoopTagName = "Loop"; doc::FrameTag* get_animation_tag(const doc::Sprite* sprite, doc::frame_t frame) { - doc::FrameTag* tag = sprite->frameTags().innerTag(frame); - if (!tag) - tag = get_loop_tag(sprite); - return tag; + return sprite->frameTags().innerTag(frame); } doc::FrameTag* get_loop_tag(const doc::Sprite* sprite) diff --git a/src/app/loop_tag.h b/src/app/loop_tag.h index 65eae3f0b..9858963a1 100644 --- a/src/app/loop_tag.h +++ b/src/app/loop_tag.h @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2001-2017 David Capello +// Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -20,7 +20,8 @@ namespace app { class FrameTagProvider { public: virtual ~FrameTagProvider() { } - virtual doc::FrameTag* getFrameTagByFrame(const doc::frame_t frame) = 0; + virtual doc::FrameTag* getFrameTagByFrame(const doc::frame_t frame, + const bool getLoopTagIfNone) = 0; }; doc::FrameTag* get_animation_tag(const doc::Sprite* sprite, doc::frame_t frame); diff --git a/src/app/ui/editor/play_state.cpp b/src/app/ui/editor/play_state.cpp index 2f7594502..5024afe13 100644 --- a/src/app/ui/editor/play_state.cpp +++ b/src/app/ui/editor/play_state.cpp @@ -64,7 +64,7 @@ void PlayState::onEnterState(Editor* editor) m_tag = m_editor ->getCustomizationDelegate() ->getFrameTagProvider() - ->getFrameTagByFrame(m_refFrame); + ->getFrameTagByFrame(m_refFrame, true); // Go to the first frame of the animation or active frame tag if (m_playOnce) { diff --git a/src/app/ui/preview_editor.cpp b/src/app/ui/preview_editor.cpp index d7eea6807..96c399697 100644 --- a/src/app/ui/preview_editor.cpp +++ b/src/app/ui/preview_editor.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2001-2017 David Capello +// Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -384,12 +384,12 @@ void PreviewEditorWindow::updateUsingEditor(Editor* editor) doc::FrameTag* tag = editor ->getCustomizationDelegate() ->getFrameTagProvider() - ->getFrameTagByFrame(editor->frame()); + ->getFrameTagByFrame(editor->frame(), true); doc::FrameTag* playingTag = editor ->getCustomizationDelegate() ->getFrameTagProvider() - ->getFrameTagByFrame(m_refFrame); + ->getFrameTagByFrame(m_refFrame, true); if (tag == playingTag) return; diff --git a/src/app/ui/timeline/timeline.cpp b/src/app/ui/timeline/timeline.cpp index f0922cbc6..4aed6e62e 100644 --- a/src/app/ui/timeline/timeline.cpp +++ b/src/app/ui/timeline/timeline.cpp @@ -558,13 +558,18 @@ void Timeline::activateClipboardRange() invalidate(); } -FrameTag* Timeline::getFrameTagByFrame(const frame_t frame) +FrameTag* Timeline::getFrameTagByFrame(const frame_t frame, + const bool getLoopTagIfNone) { if (!m_sprite) return nullptr; - if (m_tagFocusBand < 0) - return get_animation_tag(m_sprite, frame); + if (m_tagFocusBand < 0) { + FrameTag* tag = get_animation_tag(m_sprite, frame); + if (!tag && getLoopTagIfNone) + tag = get_loop_tag(m_sprite); + return tag; + } for (FrameTag* frameTag : m_sprite->frameTags()) { if (frame >= frameTag->fromFrame() && diff --git a/src/app/ui/timeline/timeline.h b/src/app/ui/timeline/timeline.h index 144f86380..a58665664 100644 --- a/src/app/ui/timeline/timeline.h +++ b/src/app/ui/timeline/timeline.h @@ -116,7 +116,8 @@ namespace app { // Returns the active frame tag depending on the timeline status // E.g. if other frame tags are collapsed, the focused band has // priority and tags in other bands are ignored. - FrameTag* getFrameTagByFrame(const frame_t frame) override; + FrameTag* getFrameTagByFrame(const frame_t frame, + const bool getLoopTagIfNone) override; // ScrollableViewDelegate impl gfx::Size visibleSize() const override;