forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to match flipped tiles automatically in Auto/Stack modes
By default Aseprite will not try to match flipped versions of the tiles (as it requires more CPU), but when we create a tileset we can specify which flips can be matched automatically (new Tileset::matchFlags() property). These flags are just for the Auto mode, if we manually insert a flipped tile, that is always supported, even when the matchFlags() are not specified.
- Loading branch information
Showing
15 changed files
with
313 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Aseprite | ||
// Copyright (C) 2023 Igara Studio S.A. | ||
// | ||
// This program is distributed under the terms of | ||
// the End-User License Agreement for Aseprite. | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif | ||
|
||
#include "app/cmd/set_tileset_match_flags.h" | ||
|
||
#include "app/doc.h" | ||
#include "app/doc_event.h" | ||
#include "doc/tileset.h" | ||
|
||
namespace app { | ||
namespace cmd { | ||
|
||
SetTilesetMatchFlags::SetTilesetMatchFlags(Tileset* tileset, | ||
const tile_flags matchFlags) | ||
: WithTileset(tileset) | ||
, m_oldMatchFlags(tileset->matchFlags()) | ||
, m_newMatchFlags(matchFlags) | ||
{ | ||
} | ||
|
||
void SetTilesetMatchFlags::onExecute() | ||
{ | ||
auto ts = tileset(); | ||
ts->setMatchFlags(m_newMatchFlags); | ||
ts->incrementVersion(); | ||
ts->sprite()->incrementVersion(); | ||
} | ||
|
||
void SetTilesetMatchFlags::onUndo() | ||
{ | ||
auto ts = tileset(); | ||
ts->setMatchFlags(m_oldMatchFlags); | ||
ts->incrementVersion(); | ||
ts->sprite()->incrementVersion(); | ||
} | ||
|
||
} // namespace cmd | ||
} // namespace app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Aseprite | ||
// Copyright (C) 2023 Igara Studio S.A. | ||
// | ||
// This program is distributed under the terms of | ||
// the End-User License Agreement for Aseprite. | ||
|
||
#ifndef APP_CMD_SET_TILESET_MATCH_FLAGS_H_INCLUDED | ||
#define APP_CMD_SET_TILESET_MATCH_FLAGS_H_INCLUDED | ||
#pragma once | ||
|
||
#include "app/cmd.h" | ||
#include "app/cmd/with_tileset.h" | ||
#include "doc/tile.h" | ||
|
||
namespace app { | ||
namespace cmd { | ||
using namespace doc; | ||
|
||
class SetTilesetMatchFlags : public Cmd | ||
, public WithTileset { | ||
public: | ||
SetTilesetMatchFlags(Tileset* tileset, | ||
const tile_flags matchFlags); | ||
|
||
protected: | ||
void onExecute() override; | ||
void onUndo() override; | ||
size_t onMemSize() const override { | ||
return sizeof(*this); | ||
} | ||
|
||
private: | ||
tile_flags m_oldMatchFlags; | ||
tile_flags m_newMatchFlags; | ||
}; | ||
|
||
} // namespace cmd | ||
} // namespace app | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.