Compare commits

...

4 Commits

Author SHA1 Message Date
Christian Kaiser 257e2b7b57
Merge f160b27aa5 into 2ba051b59b 2025-07-23 18:49:17 -04:00
David Capello 2ba051b59b Fix crash deselecting moved pixels when using certain extensions (fix #5280)
build / build (Debug, macos-latest, lua, cli) (push) Waiting to run Details
build / build (Debug, macos-latest, noscripts, cli) (push) Waiting to run Details
build / build (Debug, ubuntu-latest, lua, cli) (push) Waiting to run Details
build / build (Debug, ubuntu-latest, noscripts, cli) (push) Waiting to run Details
build / build (Debug, windows-latest, lua, cli) (push) Waiting to run Details
build / build (Debug, windows-latest, noscripts, cli) (push) Waiting to run Details
build / build (RelWithDebInfo, macos-latest, lua, gui) (push) Waiting to run Details
build / build (RelWithDebInfo, ubuntu-latest, lua, gui) (push) Waiting to run Details
build / build (RelWithDebInfo, windows-latest, lua, gui) (push) Waiting to run Details
Although the issue refers to deselecting MovingPixelsState, the same
crash could happen when canceling/finishing WritingTextState or
MovingSelectionState. This fixes the crash for all these states.
2025-07-23 19:01:37 -03:00
Christian Kaiser 3fcb000eb1 Fix slice transformations not updating editors
build / build (Debug, macos-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, macos-latest, noscripts, cli) (push) Has been cancelled Details
build / build (Debug, ubuntu-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, ubuntu-latest, noscripts, cli) (push) Has been cancelled Details
build / build (Debug, windows-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, windows-latest, noscripts, cli) (push) Has been cancelled Details
build / build (RelWithDebInfo, macos-latest, lua, gui) (push) Has been cancelled Details
build / build (RelWithDebInfo, ubuntu-latest, lua, gui) (push) Has been cancelled Details
build / build (RelWithDebInfo, windows-latest, lua, gui) (push) Has been cancelled Details
2025-07-22 02:11:07 -03:00
Christian Kaiser f160b27aa5 Do not export every tag to JSON when we have a tag selected (#5085) 2025-06-25 17:17:04 -03:00
6 changed files with 47 additions and 5 deletions

View File

@ -273,6 +273,7 @@ Doc* generate_sprite_sheet_from_params(DocExporter& exporter,
exporter.setSplitTags(splitTags);
exporter.setIgnoreEmptyCels(ignoreEmpty);
exporter.setMergeDuplicates(mergeDuplicates);
exporter.setSelectedTag(tagName);
if (listLayers)
exporter.setListLayers(true);
if (listTags)

View File

@ -1529,6 +1529,10 @@ void DocExporter::createDataFile(const Samples& samples, std::ostream& os, doc::
includedSprites.insert(sprite->id());
for (Tag* tag : sprite->tags()) {
// Ignore unselected tags if we picked a specific one.
if (!m_selectedTagName.empty() && m_selectedTagName != tag->name())
continue;
if (firstTag)
firstTag = false;
else
@ -1539,12 +1543,22 @@ void DocExporter::createDataFile(const Samples& samples, std::ostream& os, doc::
format = "{tag}";
}
frame_t fromFrame = tag->fromFrame();
frame_t toFrame = tag->toFrame();
// Reset the frame offset when we're only exporting one frame tag so they're consistent
// with the exported frame list.
if (!m_selectedTagName.empty()) {
toFrame = toFrame - fromFrame;
fromFrame = 0;
}
FilenameInfo fnInfo;
fnInfo.filename(doc->filename()).innerTagName(tag->name());
std::string tagname = filename_formatter(format, fnInfo);
os << "\n { \"name\": \"" << escape_for_json(tagname) << "\","
<< " \"from\": " << (tag->fromFrame()) << ","
<< " \"to\": " << (tag->toFrame())
<< " \"from\": " << fromFrame << ","
<< " \"to\": " << toFrame
<< ","
" \"direction\": \""
<< escape_for_json(convert_anidir_to_string(tag->aniDir())) << "\"";

View File

@ -79,6 +79,7 @@ public:
void setListLayers(bool value) { m_listLayers = value; }
void setListLayerHierarchy(bool value) { m_listLayerHierarchy = value; }
void setListSlices(bool value) { m_listSlices = value; }
void setSelectedTag(const std::string& tagName) { m_selectedTagName = tagName; }
void addImage(Doc* doc, const doc::ImageRef& image);
@ -153,6 +154,7 @@ private:
std::string m_textureFilename;
std::string m_filenameFormat;
std::string m_tagnameFormat;
std::string m_selectedTagName;
int m_textureWidth;
int m_textureHeight;
int m_textureColumns;

View File

@ -58,6 +58,7 @@
#include "app/util/tile_flags_utils.h"
#include "base/chrono.h"
#include "base/convert_to.h"
#include "base/scoped_value.h"
#include "doc/doc.h"
#include "doc/mask_boundaries.h"
#include "doc/slice.h"
@ -266,6 +267,23 @@ void Editor::setStateInternal(const EditorStatePtr& newState)
{
m_brushPreview.hide();
// Some onLeaveState impls (like the ones from MovingPixelsState,
// WritingTextState, MovingSelectionState) might generate a
// Tx/Transaction::commit(), which will add a new undo state,
// triggering a sprite change scripting event
// (SpriteEvents::onAddUndoState). This event could be handled by an
// extension and that extension might want to save the current
// sprite (e.g. calling Sprite_saveCopyAs, the kind of extension
// that takes snapshots after each sprite change). That will be a
// new Context::executeCommand() for the save command, generating a
// BeforeCommandExecution signal, getting back to onLeaveState
// again. In that case, we just ignore the reentry as the first
// onLeaveState should handle everything (to avoid an stack
// overflow/infinite recursion).
if (m_leavingState)
return;
base::ScopedValue leaving(m_leavingState, true);
// Fire before change state event, set the state, and fire after
// change state event.
EditorState::LeaveAction leaveAction = m_state->onLeaveState(this, newState.get());

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2024 Igara Studio S.A.
// Copyright (C) 2018-2025 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -458,6 +458,13 @@ private:
DocView* m_docView;
// Special flag to avoid re-entering a new state when we are leaving
// the current one. This avoids an infinite onLeaveState() recursion
// in some special cases when an extension (third-party code)
// creates a new sprite change in the same sprite change scripting
// event.
bool m_leavingState = false;
// Last known mouse position received by this editor when the
// mouse button was pressed. Used for auto-scrolling. To get the
// current mouse position on the editor you can use

View File

@ -428,8 +428,8 @@ bool MovingSliceState::onMouseMove(Editor* editor, MouseMessage* msg)
if (editor->slicesTransforms())
drawExtraCel();
// Redraw the editor.
editor->invalidate();
// Notify changes
m_site.document()->notifyGeneralUpdate();
// Use StandbyState implementation
return StandbyState::onMouseMove(editor, msg);