Compare commits

...

4 Commits

Author SHA1 Message Date
دانتي باولا 2f38228cc4
Merge 27f19959bd into cef92c1a38 2025-07-30 16:34:11 -03:00
David Capello cef92c1a38 Add .plist files for macOS
build-auto / build-auto (Debug, macos-latest) (push) Has been cancelled Details
build-auto / build-auto (Debug, ubuntu-latest) (push) Has been cancelled Details
build-auto / build-auto (Debug, windows-latest) (push) Has been cancelled Details
build-auto / build-auto (RelWithDebInfo, macos-latest) (push) Has been cancelled Details
build-auto / build-auto (RelWithDebInfo, ubuntu-latest) (push) Has been cancelled Details
build-auto / build-auto (RelWithDebInfo, windows-latest) (push) Has been cancelled Details
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
We don't have an Aseprite.app target in cmake files yet, but we might
add it in a near future.
2025-07-28 16:18:19 -03:00
Christian Kaiser 22e72ab5cb [win] Fix includeDesktopDir returning the default path
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
Uses SHGFP_TYPE_CURRENT which returns the Desktop that the user has configured instead of the default, fixes Windows 11's OneDrive Desktop folder.
2025-07-28 10:47:53 -03:00
Liebranca 27f19959bd Fix tilemap layer copy/paste 2025-07-24 00:01:20 -03:00
11 changed files with 159 additions and 7 deletions

View File

@ -180,8 +180,8 @@ if(ENABLE_ASEPRITE_EXE)
if(WIN32)
set(main_resources
main/resources_win32.rc
main/settings.manifest)
main/win/resources_win32.rc
main/win/settings.manifest)
endif()
add_executable(${main_target}

View File

@ -213,7 +213,7 @@ void ResourceFinder::includeDesktopDir(const char* filename)
#ifdef _WIN32
std::vector<wchar_t> buf(MAX_PATH);
HRESULT hr = SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_DEFAULT, &buf[0]);
HRESULT hr = SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT, &buf[0]);
if (hr == S_OK) {
addPath(base::join_path(base::to_utf8(&buf[0]), filename));
}

View File

@ -2748,7 +2748,10 @@ void Editor::setZoomAndCenterInMouse(const Zoom& zoom,
}
}
void Editor::pasteImage(const Image* image, const Mask* mask, const gfx::Point* position)
void Editor::pasteImage(const Image* image,
const Mask* mask,
const gfx::Point* position,
const Tileset* srcTileset)
{
ASSERT(image);
@ -2840,6 +2843,10 @@ void Editor::pasteImage(const Image* image, const Mask* mask, const gfx::Point*
PixelsMovementPtr pixelsMovement(
new PixelsMovement(UIContext::instance(), site, image, &mask2, "Paste"));
// Adjust image when copying between tilemap layers
if (site.tilemapMode() == TilemapMode::Tiles && srcTileset != nullptr)
pixelsMovement->remapTilesForPaste(srcTileset);
setState(EditorStatePtr(new MovingPixelsState(this, NULL, pixelsMovement, NoHandle)));
}

View File

@ -244,7 +244,8 @@ public:
void pasteImage(const Image* image,
const Mask* mask = nullptr,
const gfx::Point* position = nullptr);
const gfx::Point* position = nullptr,
const Tileset* srcTileset = nullptr);
void startSelectionTransformation(const gfx::Point& move, double angle);
void startFlipTransformation(doc::algorithm::FlipType flipType);

View File

@ -12,6 +12,7 @@
#include "app/ui/editor/pixels_movement.h"
#include "app/app.h"
#include "app/cmd/add_tile.h"
#include "app/cmd/clear_mask.h"
#include "app/cmd/deselect_mask.h"
#include "app/cmd/set_mask.h"
@ -1356,6 +1357,39 @@ void PixelsMovement::drawTransformedTilemap(const Transformation& transformation
draw_row(dst->height() - 1, src->height() - 1, 1);
}
void PixelsMovement::remapTilesForPaste(const Tileset* srcTileset)
{
// Check that tile size matches before doing anything
LayerTilemap* dstLayer = static_cast<LayerTilemap*>(m_site.layer());
Tileset* dstTileset = dstLayer->tileset();
const doc::Grid& srcGrid = srcTileset->grid();
const doc::Grid& dstGrid = dstTileset->grid();
if (srcGrid.tileSize() != dstGrid.tileSize())
throw base::Exception("Tile size does not match.");
// Map source to destination
tile_index dstSz = dstTileset->size();
for (int y = 0; y < m_originalImage->height(); ++y) {
for (int x = 0; x < m_originalImage->width(); ++x) {
// Blank tile can be skipped
const color_t srcTi = m_originalImage->getPixel(x, y);
if (!srcTi)
continue;
// Add tile to destination if missing
tile_index dstTi;
const ImageRef t = srcTileset->get(srcTi);
if (!dstTileset->findTileIndex(t, dstTi)) {
m_tx(new cmd::AddTile(dstTileset, t, srcTileset->getTileData(srcTi)));
dstTi = dstSz++;
}
// Update tile index in image
m_originalImage->putPixel(x, y, dstTi);
}
}
}
void PixelsMovement::onPivotChange()
{
set_pivot_from_preferences(m_currentData);

View File

@ -130,6 +130,9 @@ public:
const Transformation& getTransformation() const { return m_currentData; }
void setTransformation(const Transformation& t);
// For copy/paste between tilemap layers
void remapTilesForPaste(const Tileset* srcTileset);
private:
void setTransformationBase(const Transformation& t);
void adjustPivot();

View File

@ -10,6 +10,7 @@
#endif
#include "app/app.h"
#include "app/cmd/add_tileset.h"
#include "app/cmd/clear_mask.h"
#include "app/cmd/deselect_mask.h"
#include "app/cmd/set_mask.h"
@ -584,7 +585,10 @@ void Clipboard::paste(Context* ctx, const bool interactive, const gfx::Point* po
// TODO add post-command parameters (issue #2324)
// Change to MovingTilemapState
editor->pasteImage(m_data->tilemap.get(), m_data->mask.get(), position);
editor->pasteImage(m_data->tilemap.get(),
m_data->mask.get(),
position,
m_data->tileset.get());
}
else {
// TODO non-interactive version (for scripts)
@ -763,7 +767,14 @@ void Clipboard::paste(Context* ctx, const bool interactive, const gfx::Point* po
afterThis = dstSpr->root()->lastLayer();
Layer* newLayer = nullptr;
if (srcLayer->isImage())
if (srcLayer->isTilemap()) {
Tileset* srcTileset = static_cast<LayerTilemap*>(srcLayer)->tileset();
Tileset* tilesetCopy = Tileset::MakeCopyCopyingImagesForSprite(srcTileset, dstSpr);
const tileset_index tsi = dstSpr->tilesets()->size();
tx(new cmd::AddTileset(dstSpr, tilesetCopy));
newLayer = new LayerTilemap(dstSpr, tsi);
}
else if (srcLayer->isImage())
newLayer = new LayerImage(dstSpr);
else if (srcLayer->isGroup())
newLayer = new LayerGroup(dstSpr);

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>

86
src/main/osx/Info.plist Normal file
View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aseprite</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Document.icns</string>
<key>CFBundleTypeName</key>
<string>Aseprite Sprite</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ase</string>
<string>bmp</string>
<string>flc</string>
<string>fli</string>
<string>gif</string>
<string>ico</string>
<string>jpeg</string>
<string>jpg</string>
<string>pcx</string>
<string>png</string>
<string>tga</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Document.icns</string>
<key>CFBundleTypeName</key>
<string>Aseprite Sprite</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aseprite-extension</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Extension.icns</string>
<key>CFBundleTypeName</key>
<string>Aseprite Extension</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
</array>
<key>CFBundleDisplayName</key>
<string>Aseprite</string>
<key>CFBundleExecutable</key>
<string>aseprite</string>
<key>CFBundleIdentifier</key>
<string>org.aseprite.Aseprite</string>
<key>CFBundleName</key>
<string>Aseprite</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>1.3</string>
<key>CFBundleVersion</key>
<string>1.3</string>
<key>CFBundleIconFile</key>
<string>Aseprite.icns</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.graphics-design</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2001-2025, Igara Studio S.A.
All rights reserved.</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSRequiresAquaSystemAppearance</key>
<false/>
</dict>
</plist>