Compare commits
No commits in common. "0146d38405e3bdfe8495e5de8e5ff9be6e8c9d42" and "6b53eaf6b1d8f4caadea8df8ec6e4c09e37993b4" have entirely different histories.
0146d38405
...
6b53eaf6b1
@ -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 colorEditor = m_selectedColorRow < colorCnt(m_pal, m_page);
|
auto const 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,7 +123,6 @@ 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,17 +437,19 @@ 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);
|
||||||
auto constexpr palTags = ImGuiInputTextFlags_ReadOnly;
|
if (ig::ComboBox("Palette", files, m_selectedPaletteIdx)) {
|
||||||
if (ig::InputText("Palette", m_selectedPalette, palTags)) {
|
oxLogError(m_model.setPalette(files[m_selectedPaletteIdx]));
|
||||||
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) {
|
if (!err && endsWith(ref.path, FileExt_npal)) {
|
||||||
if (ref.path != m_selectedPalette) {
|
auto const oldVal = m_selectedPaletteIdx;
|
||||||
oxLogError(m_model.setPalette(ref.path));
|
std::ignore = ox::findIdx(files.begin(), files.end(), ref.path).moveTo(m_selectedPaletteIdx);
|
||||||
|
if (oldVal != m_selectedPaletteIdx) {
|
||||||
|
oxLogError(m_model.setPalette(files[m_selectedPaletteIdx]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -521,7 +523,15 @@ ox::Error TileSheetEditorImGui::updateActiveSubsheet(ox::StringView const&name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error TileSheetEditorImGui::setPaletteSelection() noexcept {
|
ox::Error TileSheetEditorImGui::setPaletteSelection() noexcept {
|
||||||
m_selectedPalette = m_model.palPath();
|
auto const&palPath = 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;
|
||||||
ox::String m_selectedPalette;
|
std::size_t m_selectedPaletteIdx = 0;
|
||||||
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…
x
Reference in New Issue
Block a user