update palette group name labels and metadata
This commit is contained in:
@@ -92,25 +92,21 @@ absl::Status PaletteEditor::Update() {
|
|||||||
TableHeadersRow();
|
TableHeadersRow();
|
||||||
TableNextRow();
|
TableNextRow();
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
DisplayCategoryTable();
|
|
||||||
Separator();
|
|
||||||
if (gui::SnesColorEdit4("Color Picker", current_color_,
|
if (gui::SnesColorEdit4("Color Picker", current_color_,
|
||||||
ImGuiColorEditFlags_NoAlpha)) {
|
ImGuiColorEditFlags_NoAlpha)) {
|
||||||
// TODO: Implement new update color function
|
// TODO: Implement new update color function
|
||||||
}
|
}
|
||||||
|
Separator();
|
||||||
|
DisplayCategoryTable();
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
if (BeginTable("Palette Metadata", 2)) {
|
static bool in_use = false;
|
||||||
TableSetupColumn("Palette Name");
|
ImGui::Checkbox("Palette in use? ", &in_use);
|
||||||
TableSetupColumn("Palette Size");
|
Separator();
|
||||||
TableHeadersRow();
|
static std::string palette_notes = "Notes about the palette";
|
||||||
TableNextRow();
|
ImGui::InputTextMultiline("Notes", palette_notes.data(), 1024,
|
||||||
TableNextColumn();
|
ImVec2(-1, ImGui::GetTextLineHeight() * 16),
|
||||||
Text("Palette Name");
|
ImGuiInputTextFlags_AllowTabInput);
|
||||||
TableNextColumn();
|
|
||||||
Text("Palette Size");
|
|
||||||
EndTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
EndTable();
|
EndTable();
|
||||||
}
|
}
|
||||||
@@ -121,7 +117,11 @@ absl::Status PaletteEditor::Update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PaletteEditor::DisplayCategoryTable() {
|
void PaletteEditor::DisplayCategoryTable() {
|
||||||
if (BeginTable("Category Table", 6)) {
|
if (BeginTable("Category Table", 6,
|
||||||
|
ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable |
|
||||||
|
ImGuiTableFlags_SizingStretchSame |
|
||||||
|
ImGuiTableFlags_Hideable,
|
||||||
|
ImVec2(0, 0))) {
|
||||||
TableSetupColumn("Weapons and Gear");
|
TableSetupColumn("Weapons and Gear");
|
||||||
TableSetupColumn("World and Global Sprites");
|
TableSetupColumn("World and Global Sprites");
|
||||||
TableSetupColumn("Sprites Aux1");
|
TableSetupColumn("Sprites Aux1");
|
||||||
@@ -193,47 +193,22 @@ void PaletteEditor::DisplayCategoryTable() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::Status PaletteEditor::EditColorInPalette(gfx::SnesPalette& palette,
|
|
||||||
int index) {
|
|
||||||
if (index >= palette.size()) {
|
|
||||||
return absl::InvalidArgumentError("Index out of bounds");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the current color
|
|
||||||
ASSIGN_OR_RETURN(auto color, palette.GetColor(index));
|
|
||||||
auto currentColor = color.rgb();
|
|
||||||
if (ColorPicker4("Color Picker", (float*)&palette[index])) {
|
|
||||||
// The color was modified, update it in the palette
|
|
||||||
palette(index, currentColor);
|
|
||||||
}
|
|
||||||
return absl::OkStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
absl::Status PaletteEditor::ResetColorToOriginal(
|
|
||||||
gfx::SnesPalette& palette, int index,
|
|
||||||
const gfx::SnesPalette& originalPalette) {
|
|
||||||
if (index >= palette.size() || index >= originalPalette.size()) {
|
|
||||||
return absl::InvalidArgumentError("Index out of bounds");
|
|
||||||
}
|
|
||||||
ASSIGN_OR_RETURN(auto color, originalPalette.GetColor(index));
|
|
||||||
auto originalColor = color.rgb();
|
|
||||||
palette(index, originalColor);
|
|
||||||
return absl::OkStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
absl::Status PaletteEditor::DrawPaletteGroup(int category) {
|
absl::Status PaletteEditor::DrawPaletteGroup(int category) {
|
||||||
if (!rom()->is_loaded()) {
|
if (!rom()->is_loaded()) {
|
||||||
return absl::NotFoundError("ROM not open, no palettes to display");
|
return absl::NotFoundError("ROM not open, no palettes to display");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto palette_group_name = kPaletteGroupNames[category];
|
||||||
gfx::PaletteGroup palette_group =
|
gfx::PaletteGroup palette_group =
|
||||||
*rom()->palette_group().get_group(kPaletteGroupNames[category].data());
|
*rom()->palette_group().get_group(palette_group_name.data());
|
||||||
const auto size = palette_group.size();
|
const auto size = palette_group.size();
|
||||||
|
|
||||||
static bool edit_color = false;
|
static bool edit_color = false;
|
||||||
for (int j = 0; j < size; j++) {
|
for (int j = 0; j < size; j++) {
|
||||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||||
false, "Palette Name", /*key=*/std::to_string(j), "Unnamed Palette");
|
false, palette_group_name.data(), /*key=*/std::to_string(j),
|
||||||
|
"Unnamed Palette");
|
||||||
|
SameLine();
|
||||||
|
|
||||||
gfx::SnesPalette* palette = palette_group.mutable_palette(j);
|
gfx::SnesPalette* palette = palette_group.mutable_palette(j);
|
||||||
auto pal_size = palette->size();
|
auto pal_size = palette->size();
|
||||||
@@ -412,6 +387,34 @@ void PaletteEditor::DrawPortablePalette(gfx::SnesPalette& palette) {
|
|||||||
EndChild();
|
EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
absl::Status PaletteEditor::EditColorInPalette(gfx::SnesPalette& palette,
|
||||||
|
int index) {
|
||||||
|
if (index >= palette.size()) {
|
||||||
|
return absl::InvalidArgumentError("Index out of bounds");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the current color
|
||||||
|
ASSIGN_OR_RETURN(auto color, palette.GetColor(index));
|
||||||
|
auto currentColor = color.rgb();
|
||||||
|
if (ColorPicker4("Color Picker", (float*)&palette[index])) {
|
||||||
|
// The color was modified, update it in the palette
|
||||||
|
palette(index, currentColor);
|
||||||
|
}
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::Status PaletteEditor::ResetColorToOriginal(
|
||||||
|
gfx::SnesPalette& palette, int index,
|
||||||
|
const gfx::SnesPalette& originalPalette) {
|
||||||
|
if (index >= palette.size() || index >= originalPalette.size()) {
|
||||||
|
return absl::InvalidArgumentError("Index out of bounds");
|
||||||
|
}
|
||||||
|
ASSIGN_OR_RETURN(auto color, originalPalette.GetColor(index));
|
||||||
|
auto originalColor = color.rgb();
|
||||||
|
palette(index, originalColor);
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
Reference in New Issue
Block a user