Compare commits
6 Commits
084baa6005
...
master
Author | SHA1 | Date | |
---|---|---|---|
6a0f57994c | |||
6b0a56d5d6 | |||
3aac345637 | |||
b67b95767b | |||
8aea7c2ecf | |||
e9a7fb1ec8 |
@@ -19,7 +19,7 @@ namespace ox {
|
||||
*/
|
||||
class StringLiteral: public detail::BaseStringView {
|
||||
public:
|
||||
consteval StringLiteral() noexcept = default;
|
||||
constexpr StringLiteral() noexcept = default;
|
||||
|
||||
constexpr StringLiteral(StringLiteral const &sv) noexcept = default;
|
||||
|
||||
|
6
deps/nostalgia/release-notes.md
vendored
6
deps/nostalgia/release-notes.md
vendored
@@ -1,3 +1,9 @@
|
||||
# d2025.07.0
|
||||
|
||||
* Add sub-command for exporting TileSheets as PNG files.
|
||||
* Add 'Reload Project' menu item under File.
|
||||
* Fix opening a project to mark an unopenable file as closed in the config file on startup.
|
||||
|
||||
# d2025.06.0
|
||||
|
||||
* Add ability to remember recent projects in config
|
||||
|
@@ -21,9 +21,28 @@ constexpr ox::Array<ox::StringLiteral, 2> FileExts_TileSheet{
|
||||
FileExt_ng,
|
||||
};
|
||||
|
||||
constexpr ox::Array<ox::StringLiteral, 2> FileExts_Palette{
|
||||
FileExt_npal,
|
||||
};
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr bool isTileSheet(ox::StringViewCR path) noexcept {
|
||||
return endsWith(path, FileExt_nts) || endsWith(path, FileExt_ng);
|
||||
return ox::any_of(
|
||||
FileExts_TileSheet.begin(),
|
||||
FileExts_TileSheet.end(),
|
||||
[path](ox::StringLiteral const &ext) {
|
||||
return endsWith(path, ext);
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr bool isPalette(ox::StringViewCR path) noexcept {
|
||||
return ox::any_of(
|
||||
FileExts_Palette.begin(),
|
||||
FileExts_Palette.end(),
|
||||
[path](ox::StringLiteral const &ext) {
|
||||
return endsWith(path, ext);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -64,11 +64,13 @@ class AssetContainer {
|
||||
|
||||
protected:
|
||||
constexpr void incRefs() const noexcept {
|
||||
oxAssert(m_references < ox::MaxValue<decltype(m_references)>, "reference count exceeds maximum");
|
||||
++m_references;
|
||||
}
|
||||
|
||||
constexpr void decRefs() const noexcept {
|
||||
--m_references;
|
||||
oxAssert(m_references >= 0, "negative references");
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
@@ -162,6 +164,7 @@ template<typename T>
|
||||
constexpr AssetRef<T>::AssetRef(AssetContainer<T> const*c) noexcept: m_ctr(c) {
|
||||
if (m_ctr) {
|
||||
m_ctr->updated.connect(this, &AssetRef::emitUpdated);
|
||||
m_ctr->incRefs();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -185,14 +185,13 @@ ox::Error Project::writeObj(ox::StringViewCR path, T const &obj) noexcept {
|
||||
|
||||
template<typename T>
|
||||
ox::Result<T> Project::loadObj(ox::StringViewCR path) const noexcept {
|
||||
OX_REQUIRE_M(buff, loadBuff(path));
|
||||
OX_REQUIRE(buff, loadBuff(path));
|
||||
if constexpr(ox::is_same_v<T, ox::ModelObject>) {
|
||||
return keel::readAsset(m_typeStore, buff);
|
||||
} else {
|
||||
OX_REQUIRE(typeId, keel::readAssetTypeId(buff));
|
||||
if (typeId != ox::ModelTypeId_v<T>) {
|
||||
OX_REQUIRE(ah, keel::readAssetHeader(buff));
|
||||
OX_RETURN_ERROR(keel::convertBuffToBuff<T>(m_kctx, buff, ah.clawHdr.fmt).moveTo(buff));
|
||||
return keel::convert<T>(m_kctx, buff);
|
||||
}
|
||||
return keel::readAsset<T>(buff);
|
||||
}
|
||||
|
Reference in New Issue
Block a user