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, DungeonRoomStore *rooms)
 
void OpenForNewObject (int width, int height, const std::string &filename, int16_t object_id, int room_id, DungeonRoomStore *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::WindowContent
virtual ~WindowContent ()=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 WindowLifecycle GetWindowLifecycle () const
 Get the lifecycle category for this window.
 
virtual WindowContextScope GetContextScope () const
 Optional context binding for this window (room/selection/etc)
 
virtual WindowScope GetScope () const
 Get the registration scope for this window.
 
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 std::string GetWorkflowGroup () const
 Optional workflow group for hack-centric actions.
 
virtual std::string GetWorkflowLabel () const
 Optional workflow label for menus/command palette.
 
virtual std::string GetWorkflowDescription () const
 Optional workflow description for menus/command palette.
 
virtual int GetWorkflowPriority () const
 Optional workflow ordering priority (lower sorts first).
 
virtual float GetPreferredHeight () const
 Get preferred height for this panel (optional)
 
virtual bool PreferAutoHideTabBar () const
 Whether the dock node hosting this panel should auto-hide its tab bar.
 
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 Types

enum class  ActionStatusTone { kNone , kWarning , kSuccess , kError }
 

Private Member Functions

void ClearRenderedBitmaps ()
 
void ClearActionStatus ()
 
void SetActionStatus (ActionStatusTone tone, std::string message)
 
void ResetTransientState ()
 
std::string BuildWindowTitle () const
 
void SelectFirstCellIfAvailable ()
 
int GetSharedTileDataUsageCount () const
 
bool HasSharedTileDataConflict () const
 
bool HasRenderableRoomContext () const
 
void RefreshRenderedViewsFromCurrentRoom ()
 
void DrawTileGrid ()
 
void DrawSourceSheet ()
 
void DrawTileProperties ()
 
void DrawActionBar ()
 
void HandleKeyboardShortcuts ()
 
void RenderObjectPreview ()
 
void RenderTile8Atlas ()
 
void SyncSourceSelectionFromSelectedCell ()
 
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
 
int shared_tile_data_usage_override_ = -1
 
ActionStatusTone action_status_tone_ = ActionStatusTone::kNone
 
std::string action_status_message_
 
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
 
DungeonRoomStorerooms_ = nullptr
 
gfx::PaletteGroup current_palette_group_
 
bool is_open_ = false
 

Friends

struct ObjectTileEditorPanelTestAccess
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::WindowContent
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 35 of file object_tile_editor_panel.h.

Member Enumeration Documentation

◆ ActionStatusTone

Enumerator
kNone 
kWarning 
kSuccess 
kError 

Definition at line 64 of file object_tile_editor_panel.h.

Constructor & Destructor Documentation

◆ ObjectTileEditorPanel()

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

Definition at line 13 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::WindowContent.

Definition at line 39 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::WindowContent.

Definition at line 40 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::WindowContent.

Definition at line 41 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::WindowContent.

Definition at line 42 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::WindowContent.

Definition at line 43 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::WindowContent.

Definition at line 44 of file object_tile_editor_panel.h.

◆ Draw()

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

Draw the panel content.

Parameters
p_openPointer to visibility flag (nullptr if not closable)

Called by WorkspaceWindowManager when the panel is visible. Do NOT call ImGui::Begin/End - the PanelWindow wrapper handles that. Just draw your content directly.

Implements yaze::editor::WindowContent.

Definition at line 168 of file object_tile_editor_panel.cc.

References ApplyChanges(), BuildWindowTitle(), yaze::zelda3::ObjectTileLayout::cells, Close(), current_layout_, DrawActionBar(), DrawSourceSheet(), DrawTileGrid(), DrawTileProperties(), HandleKeyboardShortcuts(), is_open_, shared_object_count_, and show_shared_confirm_.

◆ OpenForObject()

void yaze::editor::ObjectTileEditorPanel::OpenForObject ( int16_t object_id,
int room_id,
DungeonRoomStore * rooms )

◆ OpenForNewObject()

void yaze::editor::ObjectTileEditorPanel::OpenForNewObject ( int width,
int height,
const std::string & filename,
int16_t object_id,
int room_id,
DungeonRoomStore * rooms )

◆ Close()

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

◆ IsOpen()

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

Definition at line 53 of file object_tile_editor_panel.h.

References is_open_.

◆ SetCurrentPaletteGroup()

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

◆ SetObjectCreatedCallback()

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

Definition at line 58 of file object_tile_editor_panel.h.

References on_object_created_.

◆ ClearRenderedBitmaps()

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

Definition at line 18 of file object_tile_editor_panel.cc.

References object_preview_bmp_, and tile8_atlas_bmp_.

Referenced by ResetTransientState().

◆ ClearActionStatus()

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

◆ SetActionStatus()

void yaze::editor::ObjectTileEditorPanel::SetActionStatus ( ActionStatusTone tone,
std::string message )
private

Definition at line 28 of file object_tile_editor_panel.cc.

References action_status_message_, and action_status_tone_.

Referenced by ApplyChanges().

◆ ResetTransientState()

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

◆ BuildWindowTitle()

◆ SelectFirstCellIfAvailable()

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

◆ GetSharedTileDataUsageCount()

int yaze::editor::ObjectTileEditorPanel::GetSharedTileDataUsageCount ( ) const
private

◆ HasSharedTileDataConflict()

bool yaze::editor::ObjectTileEditorPanel::HasSharedTileDataConflict ( ) const
private

Definition at line 146 of file object_tile_editor_panel.cc.

References GetSharedTileDataUsageCount().

Here is the call graph for this function:

◆ HasRenderableRoomContext()

bool yaze::editor::ObjectTileEditorPanel::HasRenderableRoomContext ( ) const
private

◆ RefreshRenderedViewsFromCurrentRoom()

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

Definition at line 156 of file object_tile_editor_panel.cc.

References atlas_dirty_, HasRenderableRoomContext(), preview_dirty_, RenderObjectPreview(), and RenderTile8Atlas().

Referenced by ApplyChanges().

Here is the call graph for this function:

◆ DrawTileGrid()

◆ DrawSourceSheet()

◆ DrawTileProperties()

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

◆ DrawActionBar()

◆ HandleKeyboardShortcuts()

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

◆ RenderObjectPreview()

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

◆ RenderTile8Atlas()

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

◆ SyncSourceSelectionFromSelectedCell()

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

◆ ApplyChanges()

Friends And Related Symbol Documentation

◆ ObjectTileEditorPanelTestAccess

friend struct ObjectTileEditorPanelTestAccess
friend

Definition at line 98 of file object_tile_editor_panel.h.

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

◆ source_palette_

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

◆ tile_grid_canvas_

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

Definition at line 106 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 107 of file object_tile_editor_panel.h.

◆ object_preview_bmp_

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

◆ tile8_atlas_bmp_

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

◆ preview_dirty_

◆ 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 116 of file object_tile_editor_panel.h.

Referenced by ApplyChanges(), Draw(), and ResetTransientState().

◆ shared_object_count_

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

Definition at line 117 of file object_tile_editor_panel.h.

Referenced by ApplyChanges(), Draw(), and ResetTransientState().

◆ shared_tile_data_usage_override_

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

Definition at line 118 of file object_tile_editor_panel.h.

Referenced by GetSharedTileDataUsageCount(), and ResetTransientState().

◆ action_status_tone_

ActionStatusTone yaze::editor::ObjectTileEditorPanel::action_status_tone_ = ActionStatusTone::kNone
private

Definition at line 119 of file object_tile_editor_panel.h.

Referenced by ClearActionStatus(), DrawActionBar(), and SetActionStatus().

◆ action_status_message_

std::string yaze::editor::ObjectTileEditorPanel::action_status_message_
private

Definition at line 120 of file object_tile_editor_panel.h.

Referenced by ClearActionStatus(), DrawActionBar(), and SetActionStatus().

◆ is_new_object_

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

◆ on_object_created_

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

Definition at line 124 of file object_tile_editor_panel.h.

Referenced by ApplyChanges(), and SetObjectCreatedCallback().

◆ renderer_

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

Definition at line 127 of file object_tile_editor_panel.h.

◆ rom_

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

Definition at line 128 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_

DungeonRoomStore* 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 133 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: