[nostalgia/core/studio/tilesheeteditor] Manually merge in changes that were lost in conflict
All checks were successful
Build / build (push) Successful in 3m19s
All checks were successful
Build / build (push) Successful in 3m19s
This commit is contained in:
parent
75d8e7bb89
commit
0146d38405
@ -437,19 +437,17 @@ void TileSheetEditorImGui::drawTileSheet(ox::Vec2 const&fbSize) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorImGui::drawPaletteMenu() noexcept {
|
void TileSheetEditorImGui::drawPaletteMenu() noexcept {
|
||||||
auto const&files = m_sctx.project->fileList(core::FileExt_npal);
|
|
||||||
auto const comboWidthSub = 62;
|
auto const comboWidthSub = 62;
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - comboWidthSub);
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - comboWidthSub);
|
||||||
if (ig::ComboBox("Palette", files, m_selectedPaletteIdx)) {
|
auto constexpr palTags = ImGuiInputTextFlags_ReadOnly;
|
||||||
oxLogError(m_model.setPalette(files[m_selectedPaletteIdx]));
|
if (ig::InputText("Palette", m_selectedPalette, palTags)) {
|
||||||
|
oxLogError(m_model.setPalette(m_selectedPalette));
|
||||||
}
|
}
|
||||||
if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
|
if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
|
||||||
auto const [ref, err] = ig::getDragDropPayload<studio::FileRef>("FileRef");
|
auto const [ref, err] = ig::getDragDropPayload<studio::FileRef>("FileRef");
|
||||||
if (!err && endsWith(ref.path, FileExt_npal)) {
|
if (!err) {
|
||||||
auto const oldVal = m_selectedPaletteIdx;
|
if (ref.path != m_selectedPalette) {
|
||||||
std::ignore = ox::findIdx(files.begin(), files.end(), ref.path).moveTo(m_selectedPaletteIdx);
|
oxLogError(m_model.setPalette(ref.path));
|
||||||
if (oldVal != m_selectedPaletteIdx) {
|
|
||||||
oxLogError(m_model.setPalette(files[m_selectedPaletteIdx]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -523,15 +521,7 @@ ox::Error TileSheetEditorImGui::updateActiveSubsheet(ox::StringView const&name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error TileSheetEditorImGui::setPaletteSelection() noexcept {
|
ox::Error TileSheetEditorImGui::setPaletteSelection() noexcept {
|
||||||
auto const&palPath = m_model.palPath();
|
m_selectedPalette = m_model.palPath();
|
||||||
auto const&palList = m_sctx.project->fileList(core::FileExt_npal);
|
|
||||||
for (std::size_t i = 0; auto const&pal : palList) {
|
|
||||||
if (palPath == pal) {
|
|
||||||
m_selectedPaletteIdx = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
|||||||
constexpr bool isOpen() const noexcept { return m_show; }
|
constexpr bool isOpen() const noexcept { return m_show; }
|
||||||
};
|
};
|
||||||
static constexpr float s_palViewWidth = 300;
|
static constexpr float s_palViewWidth = 300;
|
||||||
std::size_t m_selectedPaletteIdx = 0;
|
ox::String m_selectedPalette;
|
||||||
studio::StudioContext &m_sctx;
|
studio::StudioContext &m_sctx;
|
||||||
turbine::Context &m_tctx;
|
turbine::Context &m_tctx;
|
||||||
ox::Vector<ox::String> m_paletteList;
|
ox::Vector<ox::String> m_paletteList;
|
||||||
|
Loading…
Reference in New Issue
Block a user