mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 12:44:53 +00:00
Always show transformation preview on Preview window
Fix regression from cd5bf499eab932061b10a8f0a22d6781e099c909
This commit is contained in:
parent
cd5bf499ea
commit
d073ecd9d1
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2020 Igara Studio S.A.
|
// Copyright (C) 2020-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -16,12 +16,14 @@
|
|||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
ExtraCel::ExtraCel()
|
ExtraCel::ExtraCel()
|
||||||
: m_type(render::ExtraType::NONE)
|
: m_purpose(Purpose::Unknown)
|
||||||
|
, m_type(render::ExtraType::NONE)
|
||||||
, m_blendMode(doc::BlendMode::NORMAL)
|
, m_blendMode(doc::BlendMode::NORMAL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtraCel::create(const TilemapMode tilemapMode,
|
void ExtraCel::create(Purpose purpose,
|
||||||
|
const TilemapMode tilemapMode,
|
||||||
doc::Sprite* sprite,
|
doc::Sprite* sprite,
|
||||||
const gfx::Rect& bounds,
|
const gfx::Rect& bounds,
|
||||||
const gfx::Size& imageSize,
|
const gfx::Size& imageSize,
|
||||||
@ -30,6 +32,8 @@ void ExtraCel::create(const TilemapMode tilemapMode,
|
|||||||
{
|
{
|
||||||
ASSERT(sprite);
|
ASSERT(sprite);
|
||||||
|
|
||||||
|
m_purpose = purpose;
|
||||||
|
|
||||||
doc::PixelFormat pixelFormat;
|
doc::PixelFormat pixelFormat;
|
||||||
if (tilemapMode == TilemapMode::Tiles)
|
if (tilemapMode == TilemapMode::Tiles)
|
||||||
pixelFormat = doc::IMAGE_TILEMAP;
|
pixelFormat = doc::IMAGE_TILEMAP;
|
||||||
@ -60,6 +64,7 @@ void ExtraCel::create(const TilemapMode tilemapMode,
|
|||||||
|
|
||||||
void ExtraCel::reset()
|
void ExtraCel::reset()
|
||||||
{
|
{
|
||||||
|
m_purpose = Purpose::Unknown;
|
||||||
m_type = render::ExtraType::NONE;
|
m_type = render::ExtraType::NONE;
|
||||||
m_image.reset();
|
m_image.reset();
|
||||||
m_cel.reset();
|
m_cel.reset();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -29,9 +29,16 @@ namespace app {
|
|||||||
|
|
||||||
class ExtraCel {
|
class ExtraCel {
|
||||||
public:
|
public:
|
||||||
|
enum class Purpose {
|
||||||
|
Unknown,
|
||||||
|
BrushPreview,
|
||||||
|
TransformationPreview,
|
||||||
|
};
|
||||||
|
|
||||||
ExtraCel();
|
ExtraCel();
|
||||||
|
|
||||||
void create(const TilemapMode tilemapMode,
|
void create(Purpose purpose,
|
||||||
|
const TilemapMode tilemapMode,
|
||||||
doc::Sprite* sprite,
|
doc::Sprite* sprite,
|
||||||
const gfx::Rect& bounds,
|
const gfx::Rect& bounds,
|
||||||
const gfx::Size& imageSize,
|
const gfx::Size& imageSize,
|
||||||
@ -39,6 +46,8 @@ namespace app {
|
|||||||
const int opacity);
|
const int opacity);
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
Purpose purpose() const { return m_purpose; }
|
||||||
|
|
||||||
render::ExtraType type() const { return m_type; }
|
render::ExtraType type() const { return m_type; }
|
||||||
void setType(render::ExtraType type) { m_type = type; }
|
void setType(render::ExtraType type) { m_type = type; }
|
||||||
|
|
||||||
@ -49,6 +58,7 @@ namespace app {
|
|||||||
void setBlendMode(doc::BlendMode mode) { m_blendMode = mode; }
|
void setBlendMode(doc::BlendMode mode) { m_blendMode = mode; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Purpose m_purpose;
|
||||||
render::ExtraType m_type;
|
render::ExtraType m_type;
|
||||||
std::unique_ptr<doc::Cel> m_cel;
|
std::unique_ptr<doc::Cel> m_cel;
|
||||||
doc::ImageRef m_image;
|
doc::ImageRef m_image;
|
||||||
|
@ -351,6 +351,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
|||||||
m_extraCel.reset(new ExtraCel);
|
m_extraCel.reset(new ExtraCel);
|
||||||
|
|
||||||
m_extraCel->create(
|
m_extraCel->create(
|
||||||
|
ExtraCel::Purpose::BrushPreview,
|
||||||
tilemapMode,
|
tilemapMode,
|
||||||
document->sprite(),
|
document->sprite(),
|
||||||
extraCelBoundsInCanvas,
|
extraCelBoundsInCanvas,
|
||||||
|
@ -705,8 +705,16 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
|
|||||||
ExtraCelRef extraCel = m_document->extraCel();
|
ExtraCelRef extraCel = m_document->extraCel();
|
||||||
if (extraCel &&
|
if (extraCel &&
|
||||||
extraCel->type() != render::ExtraType::NONE &&
|
extraCel->type() != render::ExtraType::NONE &&
|
||||||
(!m_docView->isPreview() ||
|
// We render the extra cel if:
|
||||||
m_docPref.show.brushPreviewInPreview())) {
|
(// 1) it doesn't contains the brush preview (e.g. the user
|
||||||
|
// is transforming the selection),
|
||||||
|
extraCel->purpose() != ExtraCel::Purpose::BrushPreview
|
||||||
|
// 2) we are drawing the brush preview in a regular editor,
|
||||||
|
|| !m_docView->isPreview()
|
||||||
|
// 3) we are drawing the brush preview in a preview editor
|
||||||
|
// and preferences (brushPreviewInPreview) says that we
|
||||||
|
// should do that.
|
||||||
|
|| m_docPref.show.brushPreviewInPreview())) {
|
||||||
m_renderEngine->setExtraImage(extraCel->type(),
|
m_renderEngine->setExtraImage(extraCel->type(),
|
||||||
extraCel->cel(),
|
extraCel->cel(),
|
||||||
extraCel->image(),
|
extraCel->image(),
|
||||||
|
@ -1156,6 +1156,7 @@ void PixelsMovement::redrawExtraImage(Transformation* transformation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_extraCel->create(
|
m_extraCel->create(
|
||||||
|
ExtraCel::Purpose::TransformationPreview,
|
||||||
m_site.tilemapMode(),
|
m_site.tilemapMode(),
|
||||||
m_document->sprite(),
|
m_document->sprite(),
|
||||||
bounds,
|
bounds,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user