Compare commits
2 Commits
6b53eaf6b1
...
0146d38405
Author | SHA1 | Date | |
---|---|---|---|
0146d38405 | |||
75d8e7bb89 |
@ -107,7 +107,7 @@ void PaletteEditorImGui::colorInput(ox::CStringView label, int &v, bool &inputFo
|
|||||||
void PaletteEditorImGui::drawColorsEditor() noexcept {
|
void PaletteEditorImGui::drawColorsEditor() noexcept {
|
||||||
constexpr auto tableFlags = ImGuiTableFlags_RowBg;
|
constexpr auto tableFlags = ImGuiTableFlags_RowBg;
|
||||||
auto const colorsSz = ImGui::GetContentRegionAvail();
|
auto const colorsSz = ImGui::GetContentRegionAvail();
|
||||||
auto const colorEditor = m_selectedColorRow < colorCnt(m_pal, m_page);
|
auto colorEditor = m_selectedColorRow < colorCnt(m_pal, m_page);
|
||||||
auto const colorEditorWidth = 220;
|
auto const colorEditorWidth = 220;
|
||||||
static constexpr auto toolbarHeight = 40;
|
static constexpr auto toolbarHeight = 40;
|
||||||
{
|
{
|
||||||
@ -123,6 +123,7 @@ void PaletteEditorImGui::drawColorsEditor() noexcept {
|
|||||||
if (ImGui::Button("Remove", sz)) {
|
if (ImGui::Button("Remove", sz)) {
|
||||||
std::ignore = pushCommand<RemoveColorCommand>(m_pal, m_selectedColorRow);
|
std::ignore = pushCommand<RemoveColorCommand>(m_pal, m_selectedColorRow);
|
||||||
m_selectedColorRow = ox::min(colorCnt(m_pal, m_page) - 1, m_selectedColorRow);
|
m_selectedColorRow = ox::min(colorCnt(m_pal, m_page) - 1, m_selectedColorRow);
|
||||||
|
colorEditor = m_selectedColorRow < colorCnt(m_pal, m_page);
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::BeginDisabled(m_selectedColorRow <= 0);
|
ImGui::BeginDisabled(m_selectedColorRow <= 0);
|
||||||
|
@ -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