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

Panel for editing the tile8 composition of dungeon objects. More...

#include <object_tile_editor_panel.h>

Inheritance diagram for yaze::editor::ObjectTileEditorPanel:

Public Member Functions

 ObjectTileEditorPanel (gfx::IRenderer *renderer, Rom *rom)
 
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.
 
float GetPreferredWidth () const override
 Get preferred width for this panel (optional)
 
void Draw (bool *p_open) override
 Draw the panel content.
 
void OpenForObject (int16_t object_id, int room_id, std::array< zelda3::Room, 0x128 > *rooms)
 
void OpenForNewObject (int width, int height, const std::string &filename, int16_t object_id, int room_id, std::array< zelda3::Room, 0x128 > *rooms)
 
void Close ()
 
bool IsOpen () const
 
void SetCurrentPaletteGroup (const gfx::PaletteGroup &group)
 
void SetObjectCreatedCallback (std::function< void(int, const std::string &)> cb)
 
- Public Member Functions inherited from yaze::editor::EditorPanel
virtual ~EditorPanel ()=default
 
virtual void OnFirstDraw ()
 Called once before the first Draw() in a session.
 
virtual bool RequiresLazyInit () const
 Whether this panel uses lazy initialization.
 
void InvalidateLazyInit ()
 Reset lazy init state so OnFirstDraw() runs again.
 
virtual void OnOpen ()
 Called when panel becomes visible.
 
virtual void OnClose ()
 Called when panel is hidden.
 
virtual void OnFocus ()
 Called when panel receives focus.
 
virtual PanelCategory GetPanelCategory () const
 Get the lifecycle category for this panel.
 
virtual PanelContextScope GetContextScope () const
 Optional context binding for this panel (room/selection/etc)
 
virtual PanelScope GetScope () const
 Get the registration scope 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 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.
 
void DrawWithLazyInit (bool *p_open)
 Execute lazy initialization if needed, then call Draw()
 

Private Member Functions

void DrawTileGrid ()
 
void DrawSourceSheet ()
 
void DrawTileProperties ()
 
void DrawActionBar ()
 
void HandleKeyboardShortcuts ()
 
void RenderObjectPreview ()
 
void RenderTile8Atlas ()
 
void ApplyChanges (bool confirm_shared=true)
 

Private Attributes

std::unique_ptr< zelda3::ObjectTileEditortile_editor_
 
zelda3::ObjectTileLayout current_layout_
 
int selected_cell_index_ = -1
 
int selected_source_tile_ = -1
 
int source_palette_ = 2
 
gui::Canvas tile_grid_canvas_ {"##ObjTileGrid", ImVec2(256, 256)}
 
gui::Canvas source_sheet_canvas_ {"##ObjTileSource", ImVec2(256, 512)}
 
gfx::Bitmap object_preview_bmp_
 
gfx::Bitmap tile8_atlas_bmp_
 
bool preview_dirty_ = true
 
bool atlas_dirty_ = true
 
bool show_shared_confirm_ = false
 
int shared_object_count_ = 0
 
bool is_new_object_ = false
 
std::function< void(int, const std::string &) on_object_created_ )
 
gfx::IRendererrenderer_
 
Romrom_
 
int current_room_id_ = -1
 
int16_t current_object_id_ = -1
 
std::array< zelda3::Room, 0x128 > * rooms_ = nullptr
 
gfx::PaletteGroup current_palette_group_
 
bool is_open_ = false
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::EditorPanel
void InvalidateCache ()
 Invalidate all cached computations.
 
template<typename T >
T & GetCached (const std::string &key, std::function< T()> compute)
 Get or compute a cached value.
 
bool IsCacheValid () const
 Check if cache has been invalidated.
 
void ClearCache ()
 Clear all cached values (more aggressive than InvalidateCache)
 

Detailed Description

Panel for editing the tile8 composition of dungeon objects.

Shows an interactive grid of an object's constituent 8x8 tiles alongside a tile source sheet from the room's graphics buffer. Users can click a cell in the grid, then pick a replacement tile from the source sheet. Tile properties (palette, flip, priority) can be edited per-cell.

Opened from the Object Editor panel via "Edit Tiles" button.

Definition at line 32 of file object_tile_editor_panel.h.

Constructor & Destructor Documentation

◆ ObjectTileEditorPanel()

yaze::editor::ObjectTileEditorPanel::ObjectTileEditorPanel ( gfx::IRenderer * renderer,
Rom * rom )

Definition at line 11 of file object_tile_editor_panel.cc.

References tile_editor_.

Member Function Documentation

◆ GetId()

std::string yaze::editor::ObjectTileEditorPanel::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 36 of file object_tile_editor_panel.h.

◆ GetDisplayName()

std::string yaze::editor::ObjectTileEditorPanel::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 37 of file object_tile_editor_panel.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::EditorPanel.

Definition at line 38 of file object_tile_editor_panel.h.

References ICON_MD_GRID_ON.

◆ GetEditorCategory()

std::string yaze::editor::ObjectTileEditorPanel::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 39 of file object_tile_editor_panel.h.

◆ GetPriority()

int yaze::editor::ObjectTileEditorPanel::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 40 of file object_tile_editor_panel.h.

◆ GetPreferredWidth()

float yaze::editor::ObjectTileEditorPanel::GetPreferredWidth ( ) const
inlineoverridevirtual

Get preferred width for this panel (optional)

Returns
Preferred width in pixels, or 0 to use default (250px)

Override this to specify content-based sizing. For example, a tile selector with 8 tiles at 16px × 2.0 scale would return ~276px.

Reimplemented from yaze::editor::EditorPanel.

Definition at line 41 of file object_tile_editor_panel.h.

◆ Draw()

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

◆ OpenForObject()

void yaze::editor::ObjectTileEditorPanel::OpenForObject ( int16_t object_id,
int room_id,
std::array< zelda3::Room, 0x128 > * rooms )

◆ OpenForNewObject()

void yaze::editor::ObjectTileEditorPanel::OpenForNewObject ( int width,
int height,
const std::string & filename,
int16_t object_id,
int room_id,
std::array< zelda3::Room, 0x128 > * rooms )

◆ Close()

void yaze::editor::ObjectTileEditorPanel::Close ( )

◆ IsOpen()

bool yaze::editor::ObjectTileEditorPanel::IsOpen ( ) const
inline

Definition at line 51 of file object_tile_editor_panel.h.

References is_open_.

◆ SetCurrentPaletteGroup()

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

Definition at line 68 of file object_tile_editor_panel.cc.

References current_palette_group_.

◆ SetObjectCreatedCallback()

void yaze::editor::ObjectTileEditorPanel::SetObjectCreatedCallback ( std::function< void(int, const std::string &)> cb)
inline

Definition at line 56 of file object_tile_editor_panel.h.

References on_object_created_.

◆ DrawTileGrid()

◆ DrawSourceSheet()

◆ DrawTileProperties()

void yaze::editor::ObjectTileEditorPanel::DrawTileProperties ( )
private

◆ DrawActionBar()

◆ HandleKeyboardShortcuts()

void yaze::editor::ObjectTileEditorPanel::HandleKeyboardShortcuts ( )
private

Definition at line 489 of file object_tile_editor_panel.cc.

References yaze::zelda3::ObjectTileLayout::cells, Close(), current_layout_, preview_dirty_, and selected_cell_index_.

Referenced by Draw().

Here is the call graph for this function:

◆ RenderObjectPreview()

void yaze::editor::ObjectTileEditorPanel::RenderObjectPreview ( )
private

◆ RenderTile8Atlas()

void yaze::editor::ObjectTileEditorPanel::RenderTile8Atlas ( )
private

◆ ApplyChanges()

Member Data Documentation

◆ tile_editor_

std::unique_ptr<zelda3::ObjectTileEditor> yaze::editor::ObjectTileEditorPanel::tile_editor_
private

◆ current_layout_

◆ selected_cell_index_

int yaze::editor::ObjectTileEditorPanel::selected_cell_index_ = -1
private

◆ selected_source_tile_

int yaze::editor::ObjectTileEditorPanel::selected_source_tile_ = -1
private

Definition at line 80 of file object_tile_editor_panel.h.

Referenced by Close(), DrawSourceSheet(), OpenForNewObject(), and OpenForObject().

◆ source_palette_

int yaze::editor::ObjectTileEditorPanel::source_palette_ = 2
private

Definition at line 81 of file object_tile_editor_panel.h.

Referenced by DrawSourceSheet(), and RenderTile8Atlas().

◆ tile_grid_canvas_

gui::Canvas yaze::editor::ObjectTileEditorPanel::tile_grid_canvas_ {"##ObjTileGrid", ImVec2(256, 256)}
private

Definition at line 84 of file object_tile_editor_panel.h.

◆ source_sheet_canvas_

gui::Canvas yaze::editor::ObjectTileEditorPanel::source_sheet_canvas_ {"##ObjTileSource", ImVec2(256, 512)}
private

Definition at line 85 of file object_tile_editor_panel.h.

◆ object_preview_bmp_

gfx::Bitmap yaze::editor::ObjectTileEditorPanel::object_preview_bmp_
private

Definition at line 88 of file object_tile_editor_panel.h.

Referenced by DrawTileGrid(), and RenderObjectPreview().

◆ tile8_atlas_bmp_

gfx::Bitmap yaze::editor::ObjectTileEditorPanel::tile8_atlas_bmp_
private

Definition at line 89 of file object_tile_editor_panel.h.

Referenced by DrawSourceSheet(), and RenderTile8Atlas().

◆ preview_dirty_

bool yaze::editor::ObjectTileEditorPanel::preview_dirty_ = true
private

◆ atlas_dirty_

bool yaze::editor::ObjectTileEditorPanel::atlas_dirty_ = true
private

◆ show_shared_confirm_

bool yaze::editor::ObjectTileEditorPanel::show_shared_confirm_ = false
private

Definition at line 94 of file object_tile_editor_panel.h.

Referenced by ApplyChanges(), and Draw().

◆ shared_object_count_

int yaze::editor::ObjectTileEditorPanel::shared_object_count_ = 0
private

Definition at line 95 of file object_tile_editor_panel.h.

Referenced by ApplyChanges(), and Draw().

◆ is_new_object_

bool yaze::editor::ObjectTileEditorPanel::is_new_object_ = false
private

Definition at line 98 of file object_tile_editor_panel.h.

Referenced by ApplyChanges(), Close(), Draw(), and OpenForNewObject().

◆ on_object_created_

std::function<void(int, const std::string&) yaze::editor::ObjectTileEditorPanel::on_object_created_)
private

Definition at line 99 of file object_tile_editor_panel.h.

Referenced by ApplyChanges(), and SetObjectCreatedCallback().

◆ renderer_

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

Definition at line 102 of file object_tile_editor_panel.h.

◆ rom_

Rom* yaze::editor::ObjectTileEditorPanel::rom_
private

Definition at line 103 of file object_tile_editor_panel.h.

◆ current_room_id_

int yaze::editor::ObjectTileEditorPanel::current_room_id_ = -1
private

◆ current_object_id_

int16_t yaze::editor::ObjectTileEditorPanel::current_object_id_ = -1
private

◆ rooms_

std::array<zelda3::Room, 0x128>* yaze::editor::ObjectTileEditorPanel::rooms_ = nullptr
private

◆ current_palette_group_

gfx::PaletteGroup yaze::editor::ObjectTileEditorPanel::current_palette_group_
private

◆ is_open_

bool yaze::editor::ObjectTileEditorPanel::is_open_ = false
private

Definition at line 108 of file object_tile_editor_panel.h.

Referenced by Close(), Draw(), IsOpen(), OpenForNewObject(), and OpenForObject().


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