Compare commits

...

8 Commits

Author SHA1 Message Date
49946ae170 [nostalgia] Update release notes
All checks were successful
Build / build (push) Successful in 1m21s
2025-05-30 23:51:48 -05:00
aa59db7a31 [nostalgia/gfx/studio/tilesheet] Fix draw command to work on same pixel after switching subsheets
All checks were successful
Build / build (push) Successful in 1m25s
2025-05-30 23:49:36 -05:00
cb25e610bb [nostalgia/gfx/studio/tilesheet] Fix manual redo of draw actions, fix drawing to pixel 0, 0 as first action
All checks were successful
Build / build (push) Successful in 1m22s
2025-05-29 22:14:41 -05:00
65df731abb [buildcore] Make pybb cmake_build specify --config debug/release
All checks were successful
Build / build (push) Successful in 1m20s
2025-05-22 20:48:53 -05:00
a098cb5ce7 [nostalgia] Update release-d2025.05.2 release notes
All checks were successful
Build / build (push) Successful in 1m22s
2025-05-22 20:46:56 -05:00
8c0b0263db [ox/fs] Fix new build error in MSVC (VS 17.14) 2025-05-22 20:06:36 -05:00
7f6c453345 [nostalgia/studio] Bump version to d2025.05.1
All checks were successful
Build / build (push) Successful in 1m14s
2025-05-21 22:20:56 -05:00
261e324acd [nostalgia/gfx/studio/tilesheet] Fix overrun errors when switching subsheets, clear selection on switch 2025-05-21 22:17:28 -05:00
9 changed files with 68 additions and 28 deletions

View File

@ -11,6 +11,7 @@
# "Python Busy Box" - adds cross-platform equivalents to Unix commands that
# don't translate well to that other operating system
import multiprocessing
import os
import platform
import shutil
@ -57,7 +58,11 @@ def cmake_build(base_path: str, target: Optional[str]) -> int:
path = os.path.join(base_path, d)
if not os.path.isdir(path):
continue
args = ['cmake', '--build', path]
args = ['cmake', '--build', path, f'-j{multiprocessing.cpu_count()}']
if path.endswith('release'):
args.append('--config=release')
elif path.endswith('debug'):
args.append('--config=debug')
if target is not None:
args.extend(['--target', target])
err = subprocess.run(args).returncode

View File

@ -24,9 +24,6 @@ enum class FileAddressType: int8_t {
Inode,
};
template<typename T>
constexpr Error model(T *h, CommonPtrWith<class FileAddress> auto *fa) noexcept;
class FileAddress {
template<typename T>

View File

@ -1,3 +1,19 @@
# d2025.06.0
* Add ability to remember recent projects in config
* PaletteEditor: Add RGB key shortcuts for focusing color channels
# d2025.05.2
* TileSheetEditor: Fix manual redo of draw actions, fix drawing to pixel 0, 0 as first action (cce5f52f96511694afd98f0b9b6b1f19c06ecd20)
* TileSheetEditor: Fix draw command to work on same pixel after switching subsheets (514cb978351ee4b0a5335c22a506a6d9f608f0a7)
# d2025.05.1
* TileSheetEditor: Fix overrun errors when switching subsheets, clear selection
on switch (261e324acd)
* Fix new build error that occurs in MSVC (26d5048e6720c4c2d52508a6ee44c67dd9fe3ee5)
# d2025.05.0
* Add app icon for both window and file

View File

@ -27,11 +27,14 @@ CutPasteCommand::CutPasteCommand(
TileSheet::SubSheetIdx subSheetIdx,
ox::Point const&dstStart,
ox::Point dstEnd,
TileSheetClipboard const&cb) noexcept:
TileSheetClipboard const&cb):
m_commandId(commandId),
m_img(img),
m_subSheetIdx(std::move(subSheetIdx)) {
auto const&ss = getSubSheet(m_img, m_subSheetIdx);
if (dstStart.x >= ss.columns * TileWidth || dstStart.y >= ss.rows * TileHeight) {
throw ox::Exception{1, "paste starts beyond the bounds of target"};
}
dstEnd.x = std::min(ss.columns * TileWidth - 1, dstEnd.x);
dstEnd.y = std::min(ss.rows * TileHeight - 1, dstEnd.y);
for (auto const&p : cb.pixels()) {

View File

@ -69,7 +69,7 @@ class CutPasteCommand: public TileSheetCommand {
TileSheet::SubSheetIdx subSheetIdx,
ox::Point const&dstStart,
ox::Point dstEnd,
TileSheetClipboard const&cb) noexcept;
TileSheetClipboard const&cb);
ox::Error redo() noexcept final;

View File

@ -46,13 +46,13 @@ Palette const TileSheetEditorModel::s_defaultPalette = {
TileSheetEditorModel::TileSheetEditorModel(
studio::Context &sctx, ox::StringParam path, studio::UndoStack &undoStack):
m_sctx(sctx),
m_tctx(m_sctx.tctx),
m_path(std::move(path)),
m_img(*readObj<TileSheet>(keelCtx(m_tctx), m_path).unwrapThrow()),
m_sctx{sctx},
m_tctx{m_sctx.tctx},
m_path{std::move(path)},
m_img{*readObj<TileSheet>(keelCtx(m_tctx), m_path).unwrapThrow()},
// ignore failure to load palette
m_pal(readObj<Palette>(keelCtx(m_tctx), m_img.defaultPalette).value),
m_undoStack(undoStack) {
m_pal{readObj<Palette>(keelCtx(m_tctx), m_img.defaultPalette).value},
m_undoStack{undoStack} {
normalizeSubsheets(m_img.subsheet);
m_pal.updated.connect(this, &TileSheetEditorModel::markUpdated);
m_undoStack.changeTriggered.connect(this, &TileSheetEditorModel::markUpdatedCmdId);
@ -67,19 +67,27 @@ void TileSheetEditorModel::cut() {
TileSheetClipboard blankCb;
auto cb = ox::make_unique<TileSheetClipboard>();
auto const&s = activeSubSheet();
iterateSelectionRows(*m_selection, [&](int const x, int const y) {
if (iterateSelectionRows(*m_selection, [&](int const x, int const y) {
auto pt = ox::Point{x, y};
auto const idx = gfx::idx(s, pt);
auto const c = getPixel(s, idx);
if (idx >= s.pixels.size()) {
return ox::Error{1, "invalid idx"};
}
auto const c = s.pixels[idx];
pt -= m_selection->a;
cb->addPixel(pt, c);
blankCb.addPixel(pt, 0);
});
return ox::Error{};
})) {
return;
}
auto const pt1 = m_selection->a;
auto const pt2 = ox::Point{s.columns * TileWidth, s.rows * TileHeight};
turbine::setClipboardObject(m_tctx, std::move(cb));
std::ignore = pushCommand(ox::make<CutPasteCommand>(
CommandId::Cut, m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb));
if (auto const cmd = ox::makeCatch<CutPasteCommand>(
CommandId::Cut, m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb); cmd.ok()) {
std::ignore = pushCommand(cmd.value);
}
}
void TileSheetEditorModel::copy() {
@ -87,14 +95,20 @@ void TileSheetEditorModel::copy() {
return;
}
auto cb = ox::make_unique<TileSheetClipboard>();
iterateSelectionRows(*m_selection, [&](int const x, int const y) {
if (iterateSelectionRows(*m_selection, [&](int const x, int const y) {
auto pt = ox::Point{x, y};
auto const&s = activeSubSheet();
auto const idx = gfx::idx(s, pt);
auto const c = getPixel(s, idx);
if (idx >= s.pixels.size()) {
return ox::Error{1, "invalid idx"};
}
auto const c = s.pixels[idx];
pt -= m_selection->a;
cb->addPixel(pt, c);
});
return ox::Error{};
})) {
return;
}
turbine::setClipboardObject(m_tctx, std::move(cb));
}
@ -111,8 +125,10 @@ void TileSheetEditorModel::paste() {
auto const&s = activeSubSheet();
auto const pt1 = m_selection->a;
auto const pt2 = ox::Point{s.columns * TileWidth, s.rows * TileHeight};
std::ignore = pushCommand(ox::make<CutPasteCommand>(
CommandId::Paste, m_img, m_activeSubsSheetIdx, pt1, pt2, *cb));
if (auto const cmd = ox::makeCatch<CutPasteCommand>(
CommandId::Paste, m_img, m_activeSubsSheetIdx, pt1, pt2, *cb); cmd.ok()) {
std::ignore = pushCommand(cmd.value);
}
}
bool TileSheetEditorModel::acceptsClipboardPayload() const noexcept {
@ -152,7 +168,7 @@ void TileSheetEditorModel::drawCommand(ox::Point const &pt, std::size_t const pa
auto const idx = gfx::idx(activeSubSheet, pt);
if (m_ongoingDrawCommand) {
m_updated = m_updated || m_ongoingDrawCommand->append(idx);
} else if (getPixel(activeSubSheet, idx) != palIdx) {
} else if (activeSubSheet.pixels[idx] != palIdx) {
std::ignore = pushCommand(ox::make<DrawCommand>(
m_img, m_activeSubsSheetIdx, idx, static_cast<int>(palIdx)));
}
@ -182,6 +198,7 @@ void TileSheetEditorModel::endDrawCommand() noexcept {
if (m_ongoingDrawCommand) {
m_ongoingDrawCommand->finish();
m_ongoingDrawCommand = nullptr;
m_lastDrawUpdatePt = {-1, -1};
}
}
@ -213,6 +230,8 @@ ox::Error TileSheetEditorModel::updateSubsheet(
void TileSheetEditorModel::setActiveSubsheet(TileSheet::SubSheetIdx const&idx) noexcept {
m_activeSubsSheetIdx = idx;
this->activeSubsheetChanged.emit(m_activeSubsSheetIdx);
clearSelection();
m_lastDrawUpdatePt = {-1, -1};
}
void TileSheetEditorModel::fill(ox::Point const&pt, int const palIdx) noexcept {
@ -381,7 +400,7 @@ void TileSheetEditorModel::getFillPixels(
int const oldColor) const noexcept {
auto const idx = ptToIdx(pt, activeSubSheet.columns);
auto const relIdx = idx % PixelsPerTile;
if (pixels[relIdx] || getPixel(activeSubSheet, idx) != oldColor) {
if (pixels[relIdx] || activeSubSheet.pixels[idx] != oldColor) {
return;
}
// mark pixels to update
@ -419,7 +438,7 @@ void TileSheetEditorModel::setPalPath() noexcept {
}
ox::Error TileSheetEditorModel::pushCommand(studio::UndoCommand *cmd) noexcept {
std::ignore = m_undoStack.push(ox::UPtr<studio::UndoCommand>{cmd});
std::ignore = m_undoStack.push(ox::UPtr{cmd});
m_ongoingDrawCommand = dynamic_cast<DrawCommand*>(cmd);
m_updated = true;
return {};

View File

@ -35,7 +35,7 @@ class TileSheetEditorModel: public ox::SignalHandler {
studio::SelectionTracker m_selTracker;
ox::Optional<studio::Selection> m_selection;
ox::Point m_lineStartPt;
ox::Point m_lastDrawUpdatePt;
ox::Point m_lastDrawUpdatePt{-1, -1};
bool m_updated = false;
public:

View File

@ -15,7 +15,7 @@ target_link_libraries(
target_compile_definitions(
NostalgiaStudio PUBLIC
OLYMPIC_APP_VERSION="d2025.05.0"
OLYMPIC_APP_VERSION="d2025.05.1"
)
install(

View File

@ -18,7 +18,7 @@
<string>APPL</string>
<key>CFBundleVersion</key>
<string>d2025.05.0</string>
<string>d2025.05.1</string>
<key>LSMinimumSystemVersion</key>
<string>12.0.0</string>