Merge branch 'master' into beta

This commit is contained in:
David Capello 2020-08-18 11:05:20 -03:00
commit 3623720dd4
13 changed files with 49 additions and 28 deletions

View File

@ -125,7 +125,7 @@ And then
cd aseprite
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_LIBRARY_DIR=C:\deps\skia\out\Release-x64 -G Ninja ..
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_LIBRARY_DIR=C:\deps\skia\out\Release-x64 -DSKIA_LIBRARY=C:\deps\skia\out\Release-x64\skia.lib -G Ninja ..
ninja aseprite
In this case, `C:\deps\skia` is the directory where Skia was compiled
@ -163,6 +163,7 @@ Run `cmake` with the following parameters and then `ninja`:
-DLAF_BACKEND=skia \
-DSKIA_DIR=$HOME/deps/skia \
-DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-x64 \
-DSKIA_LIBRARY=$HOME/deps/skia/out/Release-x64/libskia.a \
-G Ninja \
..
ninja aseprite
@ -191,6 +192,7 @@ Run `cmake` with the following parameters and then `ninja`:
-DLAF_BACKEND=skia \
-DSKIA_DIR=$HOME/deps/skia \
-DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-x64 \
-DSKIA_LIBRARY=$HOME/deps/skia/out/Release-x64/libskia.a \
-G Ninja \
..
ninja aseprite

2
laf

@ -1 +1 @@
Subproject commit e10bea5f04ca3410d787c75b4f50864c8e6c1520
Subproject commit 01553b175b910a3a7225cdd37edf7798501972e3

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -61,7 +61,7 @@ void FlattenLayers::onExecute()
backgroundIsSel = true;
}
LayerList list = layers.toLayerList();
LayerList list = layers.toBrowsableLayerList();
if (list.empty())
return; // Do nothing

View File

@ -320,7 +320,7 @@ void NewLayerCommand::onExecute(Context* context)
}
if (sameParents == selLayers.size()) {
for (Layer* newChild : selLayers.toLayerList()) {
for (Layer* newChild : selLayers.toBrowsableLayerList()) {
tx(
new cmd::MoveLayer(newChild, layer,
static_cast<LayerGroup*>(layer)->lastLayer()));

View File

@ -1370,10 +1370,14 @@ void DocExporter::createDataFile(const Samples& samples,
Layer* root = sprite->root();
LayerList layers;
if (item.selLayers)
layers = item.selLayers->toLayerList();
else
if (item.selLayers) {
// Select all layers (not only browseable ones)
layers = item.selLayers->toAllLayersList();
}
else {
// Select all visible layers by default
layers = sprite->allVisibleLayers();
}
for (Layer* layer : layers) {
// If this layer is inside a group, check that the group will

View File

@ -275,8 +275,8 @@ static DocRange drop_range_op(
if (op == Move) {
SelectedLayers srcSelLayers = from.selectedLayers();
SelectedLayers dstSelLayers = to.selectedLayers();
LayerList srcLayers = srcSelLayers.toLayerList();
LayerList dstLayers = dstSelLayers.toLayerList();
LayerList srcLayers = srcSelLayers.toBrowsableLayerList();
LayerList dstLayers = dstSelLayers.toBrowsableLayerList();
ASSERT(!srcLayers.empty());
if (srcLayers.empty())
return from;
@ -347,8 +347,8 @@ static DocRange drop_range_op(
if (allLayers.empty())
break;
LayerList srcLayers = from.selectedLayers().toLayerList();
LayerList dstLayers = to.selectedLayers().toLayerList();
LayerList srcLayers = from.selectedLayers().toBrowsableLayerList();
LayerList dstLayers = to.selectedLayers().toBrowsableLayerList();
if (srcLayers.empty() ||
dstLayers.empty())
throw std::invalid_argument("You need to specify a non-empty cels range");
@ -394,8 +394,8 @@ static DocRange drop_range_op(
if (allLayers.empty())
break;
LayerList srcLayers = from.selectedLayers().toLayerList();
LayerList dstLayers = to.selectedLayers().toLayerList();
LayerList srcLayers = from.selectedLayers().toBrowsableLayerList();
LayerList dstLayers = to.selectedLayers().toBrowsableLayerList();
ASSERT(!srcLayers.empty());
switch (op) {
@ -502,7 +502,7 @@ void reverse_frames(Doc* doc, const DocRange& range)
case DocRange::kCels:
frameBegin = range.firstFrame();
frameEnd = range.lastFrame();
layers = range.selectedLayers().toLayerList();
layers = range.selectedLayers().toBrowsableLayerList();
swapCels = true;
break;
case DocRange::kFrames:
@ -514,7 +514,7 @@ void reverse_frames(Doc* doc, const DocRange& range)
case DocRange::kLayers:
frameBegin = frame_t(0);
frameEnd = sprite->totalFrames()-1;
layers = range.selectedLayers().toLayerList();
layers = range.selectedLayers().toBrowsableLayerList();
swapCels = true;
break;
}

View File

@ -776,7 +776,7 @@ int Dialog_file(lua_State* L)
lua_pop(L, 1);
int type = lua_getfield(L, 2, "save");
if (type == LUA_TBOOLEAN) {
if (type == LUA_TBOOLEAN && lua_toboolean(L, -1)) {
dlgType = FileSelectorType::Save;
title = "Save File";
}

View File

@ -51,6 +51,7 @@
#include "ui/view.h"
#include <cstring>
#include <limits>
namespace app {
@ -62,6 +63,8 @@ MovingPixelsState::MovingPixelsState(Editor* editor, MouseMessage* msg, PixelsMo
, m_observingEditor(false)
, m_discarded(false)
, m_renderTimer(50)
, m_oldSpritePos(std::numeric_limits<int>::min(),
std::numeric_limits<int>::min())
{
// MovingPixelsState needs a selection tool to avoid problems
// sharing the extra cel between the drawing cursor preview and the
@ -366,14 +369,21 @@ bool MovingPixelsState::onMouseMove(Editor* editor, MouseMessage* msg)
// If there is a button pressed
if (m_pixelsMovement->isDragging()) {
m_renderTimer.start();
m_pixelsMovement->setFastMode(true);
// Auto-scroll
gfx::Point mousePos = editor->autoScroll(msg, AutoScroll::MouseDir);
// Get the position of the mouse in the sprite
gfx::Point spritePos = editor->screenToEditor(mousePos);
if (spritePos == m_oldSpritePos) {
// Avoid redrawing everything if the position in the canvas didn't change.
// TODO remove this if we add support for anti-aliasing in the
// transformations
return true;
}
m_oldSpritePos = spritePos;
m_renderTimer.start();
m_pixelsMovement->setFastMode(true);
// Get the customization for the pixels movement (snap to grid, angle snap, etc.).
KeyContext keyContext = KeyContext::Normal;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -95,6 +95,11 @@ namespace app {
ui::Timer m_renderTimer;
// Position of the mouse in the canvas to avoid redrawing when the
// mouse position changes (only we redraw when the canvas position
// changes).
gfx::Point m_oldSpritePos;
obs::connection m_ctxConn;
obs::connection m_opaqueConn;
obs::connection m_transparentConn;

View File

@ -511,7 +511,7 @@ void Timeline::prepareToMoveRange()
ASSERT(m_range.enabled());
layer_t i = 0;
for (auto layer : m_range.selectedLayers().toLayerList()) {
for (auto layer : m_range.selectedLayers().toBrowsableLayerList()) {
if (layer == m_layer)
break;
++i;
@ -538,7 +538,7 @@ void Timeline::moveRange(const Range& range)
m_range = range;
layer_t i = 0;
for (auto layer : range.selectedLayers().toLayerList()) {
for (auto layer : range.selectedLayers().toBrowsableLayerList()) {
if (i == m_moveRangeData.activeRelativeLayer) {
setLayer(layer);
break;

View File

@ -489,8 +489,8 @@ void paste(Context* ctx, const bool interactive)
while (dstFrameFirst+srcRange.frames() > dstSpr->totalFrames())
api.addFrame(dstSpr, dstSpr->totalFrames());
auto srcLayers = srcRange.selectedLayers().toLayerList();
auto dstLayers = dstRange.selectedLayers().toLayerList();
auto srcLayers = srcRange.selectedLayers().toBrowsableLayerList();
auto dstLayers = dstRange.selectedLayers().toBrowsableLayerList();
auto srcIt = srcLayers.begin();
auto dstIt = dstLayers.begin();
@ -593,7 +593,7 @@ void paste(Context* ctx, const bool interactive)
// copy the parent.
SelectedLayers srcLayersSet = srcRange.selectedLayers();
srcLayersSet.removeChildrenIfParentIsSelected();
LayerList srcLayers = srcLayersSet.toLayerList();
LayerList srcLayers = srcLayersSet.toBrowsableLayerList();
// Expand frames of dstDoc if it's needed.
frame_t maxFrame = 0;

View File

@ -79,7 +79,7 @@ LayerList SelectedLayers::toAllLayersList() const
return output;
}
LayerList SelectedLayers::toLayerList() const
LayerList SelectedLayers::toBrowsableLayerList() const
{
LayerList output;

View File

@ -39,7 +39,7 @@ namespace doc {
bool contains(const Layer* layer) const;
bool hasSameParent() const;
LayerList toLayerList() const;
LayerList toBrowsableLayerList() const;
LayerList toAllLayersList() const;
void removeChildrenIfParentIsSelected();