[olympic,nostalgia] Move item name/path studio::Editor
This commit is contained in:
@@ -16,18 +16,9 @@
|
||||
namespace nostalgia::core {
|
||||
|
||||
PaletteEditorImGui::PaletteEditorImGui(turbine::Context &ctx, ox::CRStringView path):
|
||||
Editor(path),
|
||||
m_ctx(ctx),
|
||||
m_itemPath(path),
|
||||
m_itemName(m_itemPath.substr(std::find(m_itemPath.rbegin(), m_itemPath.rend(), '/').offset() + 1)),
|
||||
m_pal(*keel::readObj<Palette>(keelCtx(m_ctx), ox::FileAddress(m_itemPath.c_str())).unwrapThrow()) {
|
||||
}
|
||||
|
||||
ox::CStringView PaletteEditorImGui::itemName() const noexcept {
|
||||
return m_itemPath;
|
||||
}
|
||||
|
||||
ox::CStringView PaletteEditorImGui::itemDisplayName() const noexcept {
|
||||
return m_itemName;
|
||||
m_pal(*keel::readObj<Palette>(keelCtx(m_ctx), ox::FileAddress(itemName())).unwrapThrow()) {
|
||||
}
|
||||
|
||||
void PaletteEditorImGui::draw(turbine::Context&) noexcept {
|
||||
@@ -140,7 +131,7 @@ void PaletteEditorImGui::draw(turbine::Context&) noexcept {
|
||||
|
||||
ox::Error PaletteEditorImGui::saveItem() noexcept {
|
||||
const auto sctx = applicationData<studio::StudioContext>(m_ctx);
|
||||
return sctx->project->writeObj(m_itemPath, m_pal);
|
||||
return sctx->project->writeObj(itemName(), m_pal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,21 +15,12 @@ class PaletteEditorImGui: public studio::Editor {
|
||||
|
||||
private:
|
||||
turbine::Context &m_ctx;
|
||||
ox::String m_itemPath;
|
||||
ox::String m_itemName;
|
||||
Palette m_pal;
|
||||
std::size_t m_selectedRow = 0;
|
||||
|
||||
public:
|
||||
PaletteEditorImGui(turbine::Context &ctx, ox::CRStringView path);
|
||||
|
||||
/**
|
||||
* Returns the name of item being edited.
|
||||
*/
|
||||
ox::CStringView itemName() const noexcept final;
|
||||
|
||||
ox::CStringView itemDisplayName() const noexcept final;
|
||||
|
||||
void draw(turbine::Context&) noexcept final;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user