feat: Add Palette Editor for Enhanced Color Management
- Introduced a new PaletteEditorWidget for visual editing of dungeon palettes, allowing users to select and modify colors. - Integrated palette editor into DungeonEditorV2, enabling real-time updates and re-rendering of rooms upon palette changes. - Enhanced GUI layout to include a dedicated palette editor card, improving user experience and accessibility. - Implemented callback functionality to notify when palette changes occur, ensuring seamless integration with room rendering.
This commit is contained in:
@@ -50,6 +50,20 @@ absl::Status DungeonEditorV2::Load() {
|
||||
|
||||
// NOW initialize emulator preview with loaded ROM
|
||||
object_emulator_preview_.Initialize(rom_);
|
||||
|
||||
// Initialize palette editor with loaded ROM
|
||||
palette_editor_.Initialize(rom_);
|
||||
|
||||
// Wire palette changes to trigger room re-renders
|
||||
palette_editor_.SetOnPaletteChanged([this](int palette_id) {
|
||||
// Re-render all active rooms when palette changes
|
||||
for (int i = 0; i < active_rooms_.Size; i++) {
|
||||
int room_id = active_rooms_[i];
|
||||
if (room_id >= 0 && room_id < (int)rooms_.size()) {
|
||||
rooms_[room_id].RenderRoomGraphics();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
is_loaded_ = true;
|
||||
return absl::OkStatus();
|
||||
@@ -134,8 +148,20 @@ void DungeonEditorV2::DrawLayout() {
|
||||
}
|
||||
object_card.End();
|
||||
}
|
||||
|
||||
// 3. Palette Editor Card (independent, dockable)
|
||||
{
|
||||
static bool show_palette_editor = true;
|
||||
gui::EditorCard palette_card(
|
||||
MakeCardTitle("Palette Editor").c_str(),
|
||||
ICON_MD_PALETTE, &show_palette_editor);
|
||||
if (palette_card.Begin()) {
|
||||
palette_editor_.Draw();
|
||||
}
|
||||
palette_card.End();
|
||||
}
|
||||
|
||||
// 3. Active Room Cards (independent, dockable, no inheritance)
|
||||
// 4. Active Room Cards (independent, dockable, no inheritance)
|
||||
for (int i = 0; i < active_rooms_.Size; i++) {
|
||||
int room_id = active_rooms_[i];
|
||||
bool open = true;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "app/zelda3/dungeon/room_entrance.h"
|
||||
#include "app/gui/editor_layout.h"
|
||||
#include "app/gui/widgets/dungeon_object_emulator_preview.h"
|
||||
#include "app/gui/widgets/palette_editor_widget.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
@@ -109,6 +110,7 @@ class DungeonEditorV2 : public Editor {
|
||||
DungeonCanvasViewer canvas_viewer_;
|
||||
DungeonObjectSelector object_selector_;
|
||||
gui::DungeonObjectEmulatorPreview object_emulator_preview_;
|
||||
gui::PaletteEditorWidget palette_editor_;
|
||||
|
||||
bool is_loaded_ = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user