mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-11 09:40:42 +00:00
Merge branch 'main' into beta
This commit is contained in:
commit
91c687b1e3
@ -52,10 +52,6 @@ enable_testing()
|
|||||||
# Options (these can be specified in cmake command line or modifying
|
# Options (these can be specified in cmake command line or modifying
|
||||||
# CMakeCache.txt)
|
# CMakeCache.txt)
|
||||||
|
|
||||||
option(WITH_WEBP_SUPPORT "Enable support to load/save .webp files" on)
|
|
||||||
option(WITH_DESKTOP_INTEGRATION "Enable desktop integration modules" off)
|
|
||||||
option(WITH_QT_THUMBNAILER "Enable kde5/qt5 thumnailer" off)
|
|
||||||
|
|
||||||
option(USE_SHARED_CMARK "Use your installed copy of cmark" off)
|
option(USE_SHARED_CMARK "Use your installed copy of cmark" off)
|
||||||
option(USE_SHARED_CURL "Use your installed copy of curl" off)
|
option(USE_SHARED_CURL "Use your installed copy of curl" off)
|
||||||
option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off)
|
option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off)
|
||||||
@ -82,7 +78,10 @@ option(FULLSCREEN_PLATFORM "Enable fullscreen by default" off)
|
|||||||
option(ENABLE_CLANG_TIDY "Enable static analysis" off)
|
option(ENABLE_CLANG_TIDY "Enable static analysis" off)
|
||||||
option(ENABLE_CCACHE "Use CCache to improve recompilation speed (optional)" on)
|
option(ENABLE_CCACHE "Use CCache to improve recompilation speed (optional)" on)
|
||||||
option(ENABLE_SENTRY "Use Sentry SDK to report crashes" off)
|
option(ENABLE_SENTRY "Use Sentry SDK to report crashes" off)
|
||||||
|
option(ENABLE_WEBP "Enable support to load/save .webp files" on)
|
||||||
option(ENABLE_PSD "Enable experimental support for .psd files" off)
|
option(ENABLE_PSD "Enable experimental support for .psd files" off)
|
||||||
|
option(ENABLE_DESKTOP_INTEGRATION "Enable desktop integration modules" off)
|
||||||
|
option(ENABLE_QT_THUMBNAILER "Enable kde5/qt5 thumnailer" off)
|
||||||
set(CUSTOM_WEBSITE_URL "" CACHE STRING "Enable custom local webserver to check updates")
|
set(CUSTOM_WEBSITE_URL "" CACHE STRING "Enable custom local webserver to check updates")
|
||||||
|
|
||||||
if(ENABLE_SENTRY)
|
if(ENABLE_SENTRY)
|
||||||
@ -236,7 +235,7 @@ include_directories(${PNG_INCLUDE_DIRS})
|
|||||||
add_definitions(-DPNG_NO_MMX_CODE) # Do not use MMX optimizations in PNG code
|
add_definitions(-DPNG_NO_MMX_CODE) # Do not use MMX optimizations in PNG code
|
||||||
|
|
||||||
# libwebp
|
# libwebp
|
||||||
if(WITH_WEBP_SUPPORT)
|
if(ENABLE_WEBP)
|
||||||
set(WEBP_LIBRARIES webp webpdemux libwebpmux)
|
set(WEBP_LIBRARIES webp webpdemux libwebpmux)
|
||||||
set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
|
set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
|
||||||
include_directories(${WEBP_INCLUDE_DIR})
|
include_directories(${WEBP_INCLUDE_DIR})
|
||||||
|
@ -133,7 +133,7 @@ if(ENABLE_STEAM)
|
|||||||
add_subdirectory(steam)
|
add_subdirectory(steam)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_DESKTOP_INTEGRATION)
|
if(ENABLE_DESKTOP_INTEGRATION)
|
||||||
add_subdirectory(desktop)
|
add_subdirectory(desktop)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ add_custom_command(
|
|||||||
DEPENDS ${GEN_DEP} ${widget_files} ${string_files} "${SOURCE_DATA_DIR}/gui.xml")
|
DEPENDS ${GEN_DEP} ${widget_files} ${string_files} "${SOURCE_DATA_DIR}/gui.xml")
|
||||||
list(APPEND generated_files ${output_fn})
|
list(APPEND generated_files ${output_fn})
|
||||||
|
|
||||||
if(WITH_WEBP_SUPPORT)
|
if(ENABLE_WEBP)
|
||||||
add_definitions(-DASEPRITE_WITH_WEBP_SUPPORT)
|
add_definitions(-DENABLE_WEBP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_PSD)
|
if(ENABLE_PSD)
|
||||||
@ -138,7 +138,7 @@ set(file_formats
|
|||||||
file/png_format.cpp
|
file/png_format.cpp
|
||||||
file/svg_format.cpp
|
file/svg_format.cpp
|
||||||
file/tga_format.cpp)
|
file/tga_format.cpp)
|
||||||
if(WITH_WEBP_SUPPORT)
|
if(ENABLE_WEBP)
|
||||||
list(APPEND file_formats file/webp_format.cpp)
|
list(APPEND file_formats file/webp_format.cpp)
|
||||||
endif()
|
endif()
|
||||||
if(ENABLE_PSD)
|
if(ENABLE_PSD)
|
||||||
|
@ -37,7 +37,7 @@ extern FileFormat* CreateTgaFormat();
|
|||||||
extern FileFormat* CreatePsdFormat();
|
extern FileFormat* CreatePsdFormat();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ASEPRITE_WITH_WEBP_SUPPORT
|
#ifdef ENABLE_WEBP
|
||||||
extern FileFormat* CreateWebPFormat();
|
extern FileFormat* CreateWebPFormat();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ FileFormatsManager::FileFormatsManager()
|
|||||||
registerFormat(CreateSvgFormat());
|
registerFormat(CreateSvgFormat());
|
||||||
registerFormat(CreateTgaFormat());
|
registerFormat(CreateTgaFormat());
|
||||||
|
|
||||||
#ifdef ASEPRITE_WITH_WEBP_SUPPORT
|
#ifdef ENABLE_WEBP
|
||||||
registerFormat(CreateWebPFormat());
|
registerFormat(CreateWebPFormat());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -136,6 +136,7 @@ namespace app {
|
|||||||
int push_image_iterator_function(lua_State* L, const doc::Image* image, int extraArgIndex);
|
int push_image_iterator_function(lua_State* L, const doc::Image* image, int extraArgIndex);
|
||||||
void push_brush(lua_State* L, const doc::BrushRef& brush);
|
void push_brush(lua_State* L, const doc::BrushRef& brush);
|
||||||
void push_cel_image(lua_State* L, doc::Cel* cel);
|
void push_cel_image(lua_State* L, doc::Cel* cel);
|
||||||
|
void push_cel_images(lua_State* L, const doc::ObjectIds& cels);
|
||||||
void push_cels(lua_State* L, const doc::ObjectIds& cels);
|
void push_cels(lua_State* L, const doc::ObjectIds& cels);
|
||||||
void push_cels(lua_State* L, doc::Layer* layer);
|
void push_cels(lua_State* L, doc::Layer* layer);
|
||||||
void push_cels(lua_State* L, doc::Sprite* sprite);
|
void push_cels(lua_State* L, doc::Sprite* sprite);
|
||||||
@ -143,7 +144,6 @@ namespace app {
|
|||||||
void push_doc_range(lua_State* L, Site& site);
|
void push_doc_range(lua_State* L, Site& site);
|
||||||
void push_group_layers(lua_State* L, doc::LayerGroup* group);
|
void push_group_layers(lua_State* L, doc::LayerGroup* group);
|
||||||
void push_image(lua_State* L, doc::Image* image);
|
void push_image(lua_State* L, doc::Image* image);
|
||||||
void push_images(lua_State* L, const doc::ObjectIds& images);
|
|
||||||
void push_layers(lua_State* L, const doc::ObjectIds& layers);
|
void push_layers(lua_State* L, const doc::ObjectIds& layers);
|
||||||
void push_palette(lua_State* L, doc::Palette* palette);
|
void push_palette(lua_State* L, doc::Palette* palette);
|
||||||
void push_plugin(lua_State* L, Extension* ext);
|
void push_plugin(lua_State* L, Extension* ext);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018 Igara Studio S.A.
|
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -9,8 +9,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/script/docobj.h"
|
#include "app/script/docobj.h"
|
||||||
|
#include "app/script/engine.h"
|
||||||
#include "app/script/luacpp.h"
|
#include "app/script/luacpp.h"
|
||||||
#include "doc/image.h"
|
#include "doc/cel.h"
|
||||||
#include "doc/object_ids.h"
|
#include "doc/object_ids.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
@ -21,10 +22,10 @@ using namespace doc;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct ImagesObj {
|
struct ImagesObj {
|
||||||
ObjectIds images;
|
ObjectIds cels;
|
||||||
|
|
||||||
ImagesObj(const ObjectIds& images)
|
ImagesObj(const ObjectIds& cels)
|
||||||
: images(images) {
|
: cels(cels) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImagesObj(const ImagesObj&) = delete;
|
ImagesObj(const ImagesObj&) = delete;
|
||||||
@ -40,7 +41,7 @@ int Images_gc(lua_State* L)
|
|||||||
int Images_len(lua_State* L)
|
int Images_len(lua_State* L)
|
||||||
{
|
{
|
||||||
auto obj = get_obj<ImagesObj>(L, 1);
|
auto obj = get_obj<ImagesObj>(L, 1);
|
||||||
lua_pushinteger(L, obj->images.size());
|
lua_pushinteger(L, obj->cels.size());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,10 +49,13 @@ int Images_index(lua_State* L)
|
|||||||
{
|
{
|
||||||
auto obj = get_obj<ImagesObj>(L, 1);
|
auto obj = get_obj<ImagesObj>(L, 1);
|
||||||
const int i = lua_tointeger(L, 2);
|
const int i = lua_tointeger(L, 2);
|
||||||
if (i >= 1 && i <= obj->images.size())
|
if (i >= 1 && i <= obj->cels.size()) {
|
||||||
push_docobj<Image>(L, obj->images[i-1]);
|
if (auto cel = doc::get<doc::Cel>(obj->cels[i-1])) {
|
||||||
else
|
push_cel_image(L, cel);
|
||||||
lua_pushnil(L);
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lua_pushnil(L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,9 +76,9 @@ void register_images_class(lua_State* L)
|
|||||||
REG_CLASS(L, Images);
|
REG_CLASS(L, Images);
|
||||||
}
|
}
|
||||||
|
|
||||||
void push_images(lua_State* L, const ObjectIds& images)
|
void push_cel_images(lua_State* L, const ObjectIds& cels)
|
||||||
{
|
{
|
||||||
push_new<ImagesObj>(L, images);
|
push_new<ImagesObj>(L, cels);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -219,31 +219,35 @@ int Range_get_cels(lua_State* L)
|
|||||||
int Range_get_images(lua_State* L)
|
int Range_get_images(lua_State* L)
|
||||||
{
|
{
|
||||||
auto obj = get_obj<RangeObj>(L, 1);
|
auto obj = get_obj<RangeObj>(L, 1);
|
||||||
std::set<ObjectId> imagesSet;
|
std::set<ObjectId> set;
|
||||||
for (auto celId : obj->cels) {
|
for (auto celId : obj->cels) {
|
||||||
Cel* cel = check_docobj(L, doc::get<Cel>(celId));
|
Cel* cel = check_docobj(L, doc::get<Cel>(celId));
|
||||||
imagesSet.insert(cel->image()->id());
|
if (Cel* link = cel->link())
|
||||||
|
cel = link;
|
||||||
|
set.insert(cel->id());
|
||||||
}
|
}
|
||||||
ObjectIds images;
|
ObjectIds cels;
|
||||||
for (auto imageId : imagesSet)
|
for (auto celId : set)
|
||||||
images.push_back(imageId);
|
cels.push_back(celId);
|
||||||
push_images(L, images);
|
push_cel_images(L, cels);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Range_get_editableImages(lua_State* L)
|
int Range_get_editableImages(lua_State* L)
|
||||||
{
|
{
|
||||||
auto obj = get_obj<RangeObj>(L, 1);
|
auto obj = get_obj<RangeObj>(L, 1);
|
||||||
std::set<ObjectId> imagesSet;
|
std::set<ObjectId> set;
|
||||||
for (auto celId : obj->cels) {
|
for (auto celId : obj->cels) {
|
||||||
Cel* cel = check_docobj(L, doc::get<Cel>(celId));
|
Cel* cel = check_docobj(L, doc::get<Cel>(celId));
|
||||||
|
if (Cel* link = cel->link())
|
||||||
|
cel = link;
|
||||||
if (cel->layer()->isEditable())
|
if (cel->layer()->isEditable())
|
||||||
imagesSet.insert(cel->image()->id());
|
set.insert(cel->id());
|
||||||
}
|
}
|
||||||
ObjectIds images;
|
ObjectIds cels;
|
||||||
for (auto imageId : imagesSet)
|
for (auto celId : set)
|
||||||
images.push_back(imageId);
|
cels.push_back(celId);
|
||||||
push_images(L, images);
|
push_cel_images(L, cels);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,32 @@ namespace app {
|
|||||||
|
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// Used to show a view temporarily (the one with the file to be
|
||||||
|
// closed) and restore the previous view. E.g. When we close the
|
||||||
|
// non-active sprite pressing the cross button in a sprite tab.
|
||||||
|
class SetRestoreDocView {
|
||||||
|
public:
|
||||||
|
SetRestoreDocView(UIContext* ctx, DocView* newView)
|
||||||
|
: m_ctx(ctx)
|
||||||
|
, m_oldView(ctx->activeView()) {
|
||||||
|
if (newView != m_oldView)
|
||||||
|
m_ctx->setActiveView(newView);
|
||||||
|
else
|
||||||
|
m_oldView = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
~SetRestoreDocView() {
|
||||||
|
if (m_oldView)
|
||||||
|
m_ctx->setActiveView(m_oldView);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
UIContext* m_ctx;
|
||||||
|
DocView* m_oldView;
|
||||||
|
};
|
||||||
|
|
||||||
class AppEditor : public Editor,
|
class AppEditor : public Editor,
|
||||||
public EditorObserver,
|
public EditorObserver,
|
||||||
public EditorCustomizationDelegate {
|
public EditorCustomizationDelegate {
|
||||||
@ -193,6 +219,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
DocView::DocView(Doc* document, Type type,
|
DocView::DocView(Doc* document, Type type,
|
||||||
DocViewPreviewDelegate* previewDelegate)
|
DocViewPreviewDelegate* previewDelegate)
|
||||||
: Box(VERTICAL)
|
: Box(VERTICAL)
|
||||||
@ -282,42 +310,41 @@ bool DocView::onCloseView(Workspace* workspace, bool quitting)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UIContext* ctx = UIContext::instance();
|
UIContext* ctx = UIContext::instance();
|
||||||
|
SetRestoreDocView restoreView(ctx, this);
|
||||||
bool save_it;
|
bool save_it;
|
||||||
bool try_again = true;
|
bool try_again = true;
|
||||||
|
|
||||||
while (try_again) {
|
while (try_again) {
|
||||||
// This flag indicates if we have to sabe the sprite before to destroy it
|
// This flag indicates if we have to sabe the sprite before to destroy it
|
||||||
save_it = false;
|
save_it = false;
|
||||||
{
|
|
||||||
// see if the sprite has changes
|
|
||||||
while (m_document->isModified()) {
|
|
||||||
// ask what want to do the user with the changes in the sprite
|
|
||||||
int ret = Alert::show(
|
|
||||||
fmt::format(
|
|
||||||
Strings::alerts_save_sprite_changes(),
|
|
||||||
m_document->name(),
|
|
||||||
(quitting ? Strings::alerts_save_sprite_changes_quitting():
|
|
||||||
Strings::alerts_save_sprite_changes_closing())));
|
|
||||||
|
|
||||||
if (ret == 1) {
|
// See if the sprite has changes
|
||||||
// "save": save the changes
|
while (m_document->isModified()) {
|
||||||
save_it = true;
|
// ask what want to do the user with the changes in the sprite
|
||||||
break;
|
int ret = Alert::show(
|
||||||
}
|
fmt::format(
|
||||||
else if (ret != 2) {
|
Strings::alerts_save_sprite_changes(),
|
||||||
// "cancel" or "ESC" */
|
m_document->name(),
|
||||||
return false; // we back doing nothing
|
(quitting ? Strings::alerts_save_sprite_changes_quitting():
|
||||||
}
|
Strings::alerts_save_sprite_changes_closing())));
|
||||||
else {
|
|
||||||
// "discard"
|
if (ret == 1) {
|
||||||
break;
|
// "save": save the changes
|
||||||
}
|
save_it = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (ret != 2) {
|
||||||
|
// "cancel" or "ESC" */
|
||||||
|
return false; // we back doing nothing
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// "discard"
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does we need to save the sprite?
|
// Does we need to save the sprite?
|
||||||
if (save_it) {
|
if (save_it) {
|
||||||
ctx->setActiveView(this);
|
|
||||||
ctx->updateFlags();
|
ctx->updateFlags();
|
||||||
|
|
||||||
Command* save_command =
|
Command* save_command =
|
||||||
|
@ -10,6 +10,6 @@ install(PROGRAMS aseprite-thumbnailer DESTINATION bin)
|
|||||||
install(FILES gnome/aseprite.thumbnailer DESTINATION share/thumbnailers)
|
install(FILES gnome/aseprite.thumbnailer DESTINATION share/thumbnailers)
|
||||||
|
|
||||||
# Qt Thumbnailer
|
# Qt Thumbnailer
|
||||||
if(WITH_QT_THUMBNAILER)
|
if(ENABLE_QT_THUMBNAILER)
|
||||||
add_subdirectory(kde)
|
add_subdirectory(kde)
|
||||||
endif()
|
endif()
|
||||||
|
@ -329,8 +329,13 @@ Image* convert_pixel_format(
|
|||||||
|
|
||||||
if (!is_background && c == image->maskColor())
|
if (!is_background && c == image->maskColor())
|
||||||
*dst_it = rgba(0, 0, 0, 0);
|
*dst_it = rgba(0, 0, 0, 0);
|
||||||
else
|
else {
|
||||||
*dst_it = palette->getEntry(c);
|
const uint32_t p = palette->getEntry(c);
|
||||||
|
if (is_background)
|
||||||
|
*dst_it = rgba(rgba_getr(p), rgba_getg(p), rgba_getb(p), 255);
|
||||||
|
else
|
||||||
|
*dst_it = p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ASSERT(dst_it == dst_end);
|
ASSERT(dst_it == dst_end);
|
||||||
break;
|
break;
|
||||||
|
2
third_party/CMakeLists.txt
vendored
2
third_party/CMakeLists.txt
vendored
@ -33,7 +33,7 @@ if(NOT USE_SHARED_GIFLIB)
|
|||||||
add_subdirectory(giflib)
|
add_subdirectory(giflib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_WEBP_SUPPORT)
|
if(ENABLE_WEBP)
|
||||||
set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "Build extras.")
|
set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "Build extras.")
|
||||||
set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "Build animation utilities.")
|
set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "Build animation utilities.")
|
||||||
set(WEBP_BUILD_CWEBP OFF CACHE BOOL "Build the cwebp command line tool.")
|
set(WEBP_BUILD_CWEBP OFF CACHE BOOL "Build the cwebp command line tool.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user