Play subtags + repeat field by default to avoid surprises

If we start playing from a tag with a repeat field, we'll just play
the tag as many times it says and continue with the regular animation
of the sprite. Users expect the repeat field to be useful with the
default configuration of the program.
This commit is contained in:
David Capello 2023-03-22 15:14:41 -03:00
parent 63a387d804
commit 1f7f3677f2
2 changed files with 16 additions and 4 deletions

View File

@ -180,7 +180,7 @@
<option id="straight_line_preview" type="bool" default="true" />
<option id="play_once" type="bool" default="false" />
<option id="play_all" type="bool" default="false" />
<option id="play_subtags" type="bool" default="false" />
<option id="play_subtags" type="bool" default="true" />
<!-- TODO this would be nice to be "true" but we have to fix
some performance issue rendering huge sprites with small
zoom levels -->
@ -212,7 +212,7 @@
<section id="preview" text="Preview">
<option id="play_once" type="bool" default="false" />
<option id="play_all" type="bool" default="false" />
<option id="play_subtags" type="bool" default="false" />
<option id="play_subtags" type="bool" default="true" />
</section>
<section id="theme" text="Theme">
<option id="selected" type="std::string" default="&quot;default&quot;" />

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2022 Igara Studio S.A.
// Copyright (C) 2020-2023 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -66,12 +66,24 @@ void PlayState::onEnterState(Editor* editor)
}
// Get the tag
if (!m_playAll)
if (!m_playAll) {
m_tag = m_editor
->getCustomizationDelegate()
->getTagProvider()
->getTagByFrame(m_refFrame, true);
// Don't repeat the tag infinitely if the tag repeat field doesn't
// say so.
if (m_playSubtags &&
m_tag &&
m_tag->repeat() != 0) {
m_tag = nullptr;
}
}
else {
m_tag = nullptr;
}
// Go to the first frame of the animation or active frame tag
if (m_playOnce) {
frame_t frame = 0;