yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::ObjectEditorPanel Class Reference

Unified panel for dungeon object editing. More...

#include <object_editor_panel.h>

Inheritance diagram for yaze::editor::ObjectEditorPanel:

Public Member Functions

 ObjectEditorPanel (gfx::IRenderer *renderer, Rom *rom, DungeonCanvasViewer *canvas_viewer, std::shared_ptr< zelda3::DungeonObjectEditor > object_editor=nullptr)
 
std::string GetId () const override
 Unique identifier for this panel.
 
std::string GetDisplayName () const override
 Human-readable name shown in menus and title bars.
 
std::string GetIcon () const override
 Material Design icon for this panel.
 
std::string GetEditorCategory () const override
 Editor category this panel belongs to.
 
int GetPriority () const override
 Get display priority for menu ordering.
 
void Draw (bool *p_open) override
 Draw the panel content.
 
void OnOpen () override
 Called when panel becomes visible.
 
void OnClose () override
 Called when panel is hidden.
 
DungeonObjectSelectorobject_selector ()
 
gui::DungeonObjectEmulatorPreviewemulator_preview ()
 
void SetCurrentRoom (int room_id)
 
void SetCanvasViewer (DungeonCanvasViewer *viewer)
 
void SetContext (EditorContext ctx)
 
void SetGameData (zelda3::GameData *game_data)
 
void SetRooms (std::array< zelda3::Room, 0x128 > *rooms)
 
void SetCurrentPaletteGroup (const gfx::PaletteGroup &group)
 
void SelectObject (int obj_id)
 
void SetAgentOptimizedLayout (bool enabled)
 
void SetupSelectionCallbacks ()
 
void CycleObjectSelection (int direction)
 
void SelectAllObjects ()
 
void DeleteSelectedObjects ()
 
void CopySelectedObjects ()
 
void PasteObjects ()
 
void CancelPlacement ()
 
void OpenStaticObjectEditor (int object_id)
 
void CloseStaticObjectEditor ()
 
bool IsStaticEditorOpen () const
 
int GetStaticEditorObjectId () const
 
- Public Member Functions inherited from yaze::editor::EditorPanel
virtual ~EditorPanel ()=default
 
virtual void OnFocus ()
 Called when panel receives focus.
 
virtual PanelCategory GetPanelCategory () const
 Get the lifecycle category for this panel.
 
virtual bool IsEnabled () const
 Check if this panel is currently enabled.
 
virtual std::string GetDisabledTooltip () const
 Get tooltip text when panel is disabled.
 
virtual std::string GetShortcutHint () const
 Get keyboard shortcut hint for display.
 
virtual float GetPreferredWidth () const
 Get preferred width for this panel (optional)
 
virtual bool IsVisibleByDefault () const
 Whether this panel should be visible by default.
 
virtual std::string GetParentPanelId () const
 Get parent panel ID for cascade behavior.
 
virtual bool CascadeCloseChildren () const
 Whether closing this panel should close child panels.
 

Private Member Functions

void OnSelectionChanged ()
 
void DrawObjectSelector ()
 
void DrawDoorSection ()
 
void DrawEmulatorPreview ()
 
void DrawSelectedObjectInfo ()
 
void DrawStaticObjectEditor ()
 
void HandleKeyboardShortcuts ()
 
void DeselectAllObjects ()
 
void PerformDelete ()
 
void DuplicateSelectedObjects ()
 
void NudgeSelectedObjects (int dx, int dy)
 
void ScrollToObject (size_t index)
 

Private Attributes

Romrom_ = nullptr
 
DungeonCanvasViewercanvas_viewer_ = nullptr
 
int current_room_id_ = 0
 
DungeonObjectSelector object_selector_
 
gui::DungeonObjectEmulatorPreview emulator_preview_
 
std::unordered_map< int, gui::Canvasobject_preview_canvases_
 
int selected_tab_ = 0
 
bool show_emulator_preview_ = false
 
bool show_object_list_ = true
 
bool show_interaction_controls_ = true
 
bool show_grid_ = true
 
bool show_object_ids_ = false
 
bool show_template_creation_modal_ = false
 
bool show_delete_confirmation_modal_ = false
 
zelda3::RoomObject preview_object_ {0, 0, 0, 0, 0}
 
bool has_preview_object_ = false
 
gfx::IRendererrenderer_
 
std::shared_ptr< zelda3::DungeonObjectEditorobject_editor_
 
size_t cached_selection_count_ = 0
 
bool selection_callbacks_setup_ = false
 
bool static_editor_open_ = false
 
int static_editor_object_id_ = -1
 
gfx::Bitmap static_preview_bitmap_
 
gui::Canvas static_preview_canvas_ {"##StaticObjectPreview", ImVec2(128, 128)}
 
zelda3::ObjectDrawInfo static_editor_draw_info_
 
std::unique_ptr< zelda3::ObjectParserobject_parser_
 
gfx::BackgroundBuffer static_preview_buffer_ {128, 128}
 
bool static_preview_rendered_ = false
 
zelda3::DoorType selected_door_type_ = zelda3::DoorType::NormalDoor
 
bool door_placement_mode_ = false
 

Detailed Description

Unified panel for dungeon object editing.

This panel combines object selection, emulator preview, and canvas interaction into a single EditorPanel component. It provides a complete workflow for managing dungeon objects.

Features:

  • Object browser with graphical previews
  • Static object editor (opened via double-click)
  • Emulator-based preview rendering
  • Object templates for common patterns
  • Unified canvas context menu integration (Cut/Copy/Paste/Duplicate/Delete)
  • Keyboard shortcuts for efficient editing
See also
EditorPanel - Base interface
DungeonObjectSelector - Object browser component
DungeonObjectEmulatorPreview - Preview component

Definition at line 47 of file object_editor_panel.h.

Constructor & Destructor Documentation

◆ ObjectEditorPanel()

Member Function Documentation

◆ GetId()

std::string yaze::editor::ObjectEditorPanel::GetId ( ) const
inlineoverridevirtual

Unique identifier for this panel.

Returns
Panel ID in format "{category}.{name}" (e.g., "dungeon.room_selector")

IDs should be:

  • Lowercase with underscores
  • Prefixed with editor category
  • Unique across all panels

Implements yaze::editor::EditorPanel.

Definition at line 57 of file object_editor_panel.h.

◆ GetDisplayName()

std::string yaze::editor::ObjectEditorPanel::GetDisplayName ( ) const
inlineoverridevirtual

Human-readable name shown in menus and title bars.

Returns
Display name (e.g., "Room Selector")

Implements yaze::editor::EditorPanel.

Definition at line 58 of file object_editor_panel.h.

◆ GetIcon()

std::string yaze::editor::ObjectEditorPanel::GetIcon ( ) const
inlineoverridevirtual

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::EditorPanel.

Definition at line 59 of file object_editor_panel.h.

References ICON_MD_CONSTRUCTION.

◆ GetEditorCategory()

std::string yaze::editor::ObjectEditorPanel::GetEditorCategory ( ) const
inlineoverridevirtual

Editor category this panel belongs to.

Returns
Category name matching EditorType (e.g., "Dungeon", "Overworld")

Implements yaze::editor::EditorPanel.

Definition at line 60 of file object_editor_panel.h.

◆ GetPriority()

int yaze::editor::ObjectEditorPanel::GetPriority ( ) const
inlineoverridevirtual

Get display priority for menu ordering.

Returns
Priority value (lower = higher in list, default 50)

Reimplemented from yaze::editor::EditorPanel.

Definition at line 61 of file object_editor_panel.h.

◆ Draw()

void yaze::editor::ObjectEditorPanel::Draw ( bool * p_open)
overridevirtual

◆ OnOpen()

void yaze::editor::ObjectEditorPanel::OnOpen ( )
inlineoverridevirtual

Called when panel becomes visible.

Use this to initialize state, load resources, or start animations. Called after the panel is shown but before first Draw().

Reimplemented from yaze::editor::EditorPanel.

Definition at line 68 of file object_editor_panel.h.

◆ OnClose()

void yaze::editor::ObjectEditorPanel::OnClose ( )
inlineoverridevirtual

Called when panel is hidden.

Use this to cleanup state, release resources, or save state. Called after the panel is hidden.

Reimplemented from yaze::editor::EditorPanel.

Definition at line 69 of file object_editor_panel.h.

◆ object_selector()

DungeonObjectSelector & yaze::editor::ObjectEditorPanel::object_selector ( )
inline

Definition at line 75 of file object_editor_panel.h.

References object_selector_.

◆ emulator_preview()

gui::DungeonObjectEmulatorPreview & yaze::editor::ObjectEditorPanel::emulator_preview ( )
inline

Definition at line 76 of file object_editor_panel.h.

References emulator_preview_.

◆ SetCurrentRoom()

void yaze::editor::ObjectEditorPanel::SetCurrentRoom ( int room_id)
inline

Definition at line 84 of file object_editor_panel.h.

References current_room_id_, object_selector_, and yaze::editor::DungeonObjectSelector::set_current_room_id().

Referenced by yaze::editor::DungeonEditorV2::OnRoomSelected().

Here is the call graph for this function:

◆ SetCanvasViewer()

void yaze::editor::ObjectEditorPanel::SetCanvasViewer ( DungeonCanvasViewer * viewer)
inline

◆ SetContext()

void yaze::editor::ObjectEditorPanel::SetContext ( EditorContext ctx)
inline

◆ SetGameData()

void yaze::editor::ObjectEditorPanel::SetGameData ( zelda3::GameData * game_data)
inline

◆ SetRooms()

void yaze::editor::ObjectEditorPanel::SetRooms ( std::array< zelda3::Room, 0x128 > * rooms)
inline

Definition at line 108 of file object_editor_panel.h.

References object_selector_, and yaze::editor::DungeonObjectSelector::set_rooms().

Here is the call graph for this function:

◆ SetCurrentPaletteGroup()

void yaze::editor::ObjectEditorPanel::SetCurrentPaletteGroup ( const gfx::PaletteGroup & group)
inline

Definition at line 112 of file object_editor_panel.h.

References object_selector_, and yaze::editor::DungeonObjectSelector::SetCurrentPaletteGroup().

Referenced by yaze::editor::DungeonEditorV2::OnRoomSelected().

Here is the call graph for this function:

◆ SelectObject()

void yaze::editor::ObjectEditorPanel::SelectObject ( int obj_id)

Definition at line 176 of file object_editor_panel.cc.

References object_selector_, and yaze::editor::DungeonObjectSelector::SelectObject().

Referenced by yaze::editor::DungeonEditorV2::SelectObject().

Here is the call graph for this function:

◆ SetAgentOptimizedLayout()

void yaze::editor::ObjectEditorPanel::SetAgentOptimizedLayout ( bool enabled)

Definition at line 180 of file object_editor_panel.cc.

Referenced by yaze::editor::DungeonEditorV2::SetAgentMode().

◆ SetupSelectionCallbacks()

void yaze::editor::ObjectEditorPanel::SetupSelectionCallbacks ( )

◆ CycleObjectSelection()

void yaze::editor::ObjectEditorPanel::CycleObjectSelection ( int direction)

◆ SelectAllObjects()

void yaze::editor::ObjectEditorPanel::SelectAllObjects ( )

◆ DeleteSelectedObjects()

void yaze::editor::ObjectEditorPanel::DeleteSelectedObjects ( )

◆ CopySelectedObjects()

void yaze::editor::ObjectEditorPanel::CopySelectedObjects ( )

◆ PasteObjects()

void yaze::editor::ObjectEditorPanel::PasteObjects ( )

◆ CancelPlacement()

void yaze::editor::ObjectEditorPanel::CancelPlacement ( )

◆ OpenStaticObjectEditor()

◆ CloseStaticObjectEditor()

void yaze::editor::ObjectEditorPanel::CloseStaticObjectEditor ( )

◆ IsStaticEditorOpen()

bool yaze::editor::ObjectEditorPanel::IsStaticEditorOpen ( ) const
inline

Definition at line 138 of file object_editor_panel.h.

References static_editor_open_.

◆ GetStaticEditorObjectId()

int yaze::editor::ObjectEditorPanel::GetStaticEditorObjectId ( ) const
inline

Definition at line 139 of file object_editor_panel.h.

References static_editor_object_id_.

◆ OnSelectionChanged()

void yaze::editor::ObjectEditorPanel::OnSelectionChanged ( )
private

◆ DrawObjectSelector()

void yaze::editor::ObjectEditorPanel::DrawObjectSelector ( )
private

Definition at line 185 of file object_editor_panel.cc.

References yaze::editor::DungeonObjectSelector::DrawObjectAssetBrowser(), and object_selector_.

Referenced by Draw().

Here is the call graph for this function:

◆ DrawDoorSection()

◆ DrawEmulatorPreview()

void yaze::editor::ObjectEditorPanel::DrawEmulatorPreview ( )
private

Definition at line 351 of file object_editor_panel.cc.

References emulator_preview_, yaze::editor::AgentUI::GetTheme(), yaze::gui::HelpMarker(), ICON_MD_INFO, and yaze::gui::DungeonObjectEmulatorPreview::Render().

Referenced by Draw().

Here is the call graph for this function:

◆ DrawSelectedObjectInfo()

◆ DrawStaticObjectEditor()

◆ HandleKeyboardShortcuts()

◆ DeselectAllObjects()

void yaze::editor::ObjectEditorPanel::DeselectAllObjects ( )
private

◆ PerformDelete()

void yaze::editor::ObjectEditorPanel::PerformDelete ( )
private

◆ DuplicateSelectedObjects()

void yaze::editor::ObjectEditorPanel::DuplicateSelectedObjects ( )
private

◆ NudgeSelectedObjects()

void yaze::editor::ObjectEditorPanel::NudgeSelectedObjects ( int dx,
int dy )
private

◆ ScrollToObject()

void yaze::editor::ObjectEditorPanel::ScrollToObject ( size_t index)
private
Todo
Implement ScrollTo in DungeonCanvasViewer

Definition at line 929 of file object_editor_panel.cc.

References canvas_viewer_, and object_editor_.

Member Data Documentation

◆ rom_

Rom* yaze::editor::ObjectEditorPanel::rom_ = nullptr
private

Definition at line 164 of file object_editor_panel.h.

Referenced by OpenStaticObjectEditor(), and SetContext().

◆ canvas_viewer_

◆ current_room_id_

int yaze::editor::ObjectEditorPanel::current_room_id_ = 0
private

Definition at line 166 of file object_editor_panel.h.

Referenced by DrawDoorSection(), OpenStaticObjectEditor(), and SetCurrentRoom().

◆ object_selector_

◆ emulator_preview_

gui::DungeonObjectEmulatorPreview yaze::editor::ObjectEditorPanel::emulator_preview_
private

◆ object_preview_canvases_

std::unordered_map<int, gui::Canvas> yaze::editor::ObjectEditorPanel::object_preview_canvases_
private

Definition at line 173 of file object_editor_panel.h.

◆ selected_tab_

int yaze::editor::ObjectEditorPanel::selected_tab_ = 0
private

Definition at line 176 of file object_editor_panel.h.

◆ show_emulator_preview_

bool yaze::editor::ObjectEditorPanel::show_emulator_preview_ = false
private

Definition at line 177 of file object_editor_panel.h.

Referenced by Draw().

◆ show_object_list_

bool yaze::editor::ObjectEditorPanel::show_object_list_ = true
private

Definition at line 178 of file object_editor_panel.h.

◆ show_interaction_controls_

bool yaze::editor::ObjectEditorPanel::show_interaction_controls_ = true
private

Definition at line 179 of file object_editor_panel.h.

◆ show_grid_

bool yaze::editor::ObjectEditorPanel::show_grid_ = true
private

Definition at line 180 of file object_editor_panel.h.

Referenced by HandleKeyboardShortcuts().

◆ show_object_ids_

bool yaze::editor::ObjectEditorPanel::show_object_ids_ = false
private

Definition at line 181 of file object_editor_panel.h.

Referenced by HandleKeyboardShortcuts().

◆ show_template_creation_modal_

bool yaze::editor::ObjectEditorPanel::show_template_creation_modal_ = false
private

Definition at line 182 of file object_editor_panel.h.

◆ show_delete_confirmation_modal_

bool yaze::editor::ObjectEditorPanel::show_delete_confirmation_modal_ = false
private

Definition at line 183 of file object_editor_panel.h.

Referenced by DeleteSelectedObjects().

◆ preview_object_

zelda3::RoomObject yaze::editor::ObjectEditorPanel::preview_object_ {0, 0, 0, 0, 0}
private

Definition at line 186 of file object_editor_panel.h.

Referenced by Draw(), DrawSelectedObjectInfo(), and ObjectEditorPanel().

◆ has_preview_object_

bool yaze::editor::ObjectEditorPanel::has_preview_object_ = false
private

◆ renderer_

gfx::IRenderer* yaze::editor::ObjectEditorPanel::renderer_
private

Definition at line 188 of file object_editor_panel.h.

Referenced by OpenStaticObjectEditor().

◆ object_editor_

◆ cached_selection_count_

size_t yaze::editor::ObjectEditorPanel::cached_selection_count_ = 0
private

Definition at line 192 of file object_editor_panel.h.

Referenced by OnSelectionChanged().

◆ selection_callbacks_setup_

bool yaze::editor::ObjectEditorPanel::selection_callbacks_setup_ = false
private

Definition at line 193 of file object_editor_panel.h.

Referenced by SetCanvasViewer(), and SetupSelectionCallbacks().

◆ static_editor_open_

bool yaze::editor::ObjectEditorPanel::static_editor_open_ = false
private

◆ static_editor_object_id_

int yaze::editor::ObjectEditorPanel::static_editor_object_id_ = -1
private

◆ static_preview_bitmap_

gfx::Bitmap yaze::editor::ObjectEditorPanel::static_preview_bitmap_
private

Definition at line 198 of file object_editor_panel.h.

◆ static_preview_canvas_

gui::Canvas yaze::editor::ObjectEditorPanel::static_preview_canvas_ {"##StaticObjectPreview", ImVec2(128, 128)}
private

Definition at line 199 of file object_editor_panel.h.

Referenced by DrawStaticObjectEditor().

◆ static_editor_draw_info_

zelda3::ObjectDrawInfo yaze::editor::ObjectEditorPanel::static_editor_draw_info_
private

Definition at line 200 of file object_editor_panel.h.

Referenced by DrawStaticObjectEditor(), and OpenStaticObjectEditor().

◆ object_parser_

std::unique_ptr<zelda3::ObjectParser> yaze::editor::ObjectEditorPanel::object_parser_
private

Definition at line 201 of file object_editor_panel.h.

Referenced by ObjectEditorPanel(), and OpenStaticObjectEditor().

◆ static_preview_buffer_

gfx::BackgroundBuffer yaze::editor::ObjectEditorPanel::static_preview_buffer_ {128, 128}
private

Definition at line 202 of file object_editor_panel.h.

Referenced by DrawStaticObjectEditor(), and OpenStaticObjectEditor().

◆ static_preview_rendered_

bool yaze::editor::ObjectEditorPanel::static_preview_rendered_ = false
private

Definition at line 203 of file object_editor_panel.h.

Referenced by DrawStaticObjectEditor(), and OpenStaticObjectEditor().

◆ selected_door_type_

zelda3::DoorType yaze::editor::ObjectEditorPanel::selected_door_type_ = zelda3::DoorType::NormalDoor
private

Definition at line 206 of file object_editor_panel.h.

Referenced by DrawDoorSection().

◆ door_placement_mode_

bool yaze::editor::ObjectEditorPanel::door_placement_mode_ = false
private

Definition at line 207 of file object_editor_panel.h.

Referenced by DrawDoorSection().


The documentation for this class was generated from the following files: