Panel for editing the tile8 composition of dungeon objects. More...
#include <object_tile_editor_panel.h>

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::ObjectTileEditor > | tile_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::IRenderer * | renderer_ |
| Rom * | rom_ |
| int | current_room_id_ = -1 |
| int16_t | current_object_id_ = -1 |
| DungeonRoomStore * | rooms_ = 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) | |
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.
|
strongprivate |
| Enumerator | |
|---|---|
| kNone | |
| kWarning | |
| kSuccess | |
| kError | |
Definition at line 64 of file object_tile_editor_panel.h.
| yaze::editor::ObjectTileEditorPanel::ObjectTileEditorPanel | ( | gfx::IRenderer * | renderer, |
| Rom * | rom ) |
Definition at line 13 of file object_tile_editor_panel.cc.
References tile_editor_.
|
inlineoverridevirtual |
Unique identifier for this panel.
IDs should be:
Implements yaze::editor::WindowContent.
Definition at line 39 of file object_tile_editor_panel.h.
|
inlineoverridevirtual |
Human-readable name shown in menus and title bars.
Implements yaze::editor::WindowContent.
Definition at line 40 of file object_tile_editor_panel.h.
|
inlineoverridevirtual |
Material Design icon for this panel.
Implements yaze::editor::WindowContent.
Definition at line 41 of file object_tile_editor_panel.h.
References ICON_MD_GRID_ON.
|
inlineoverridevirtual |
Editor category this panel belongs to.
Implements yaze::editor::WindowContent.
Definition at line 42 of file object_tile_editor_panel.h.
|
inlineoverridevirtual |
Get display priority for menu ordering.
Reimplemented from yaze::editor::WindowContent.
Definition at line 43 of file object_tile_editor_panel.h.
|
inlineoverridevirtual |
Get preferred width for this panel (optional)
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.
|
overridevirtual |
Draw the panel content.
| p_open | Pointer 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_.
| void yaze::editor::ObjectTileEditorPanel::OpenForObject | ( | int16_t | object_id, |
| int | room_id, | ||
| DungeonRoomStore * | rooms ) |
Definition at line 46 of file object_tile_editor_panel.cc.
References current_layout_, current_object_id_, current_palette_group_, current_room_id_, is_new_object_, is_open_, ResetTransientState(), rooms_, SelectFirstCellIfAvailable(), yaze::editor::DungeonRoomStore::size(), and tile_editor_.

| void yaze::editor::ObjectTileEditorPanel::OpenForNewObject | ( | int | width, |
| int | height, | ||
| const std::string & | filename, | ||
| int16_t | object_id, | ||
| int | room_id, | ||
| DungeonRoomStore * | rooms ) |
Definition at line 70 of file object_tile_editor_panel.cc.
References yaze::zelda3::ObjectTileLayout::CreateEmpty(), current_layout_, current_object_id_, current_room_id_, is_new_object_, is_open_, ResetTransientState(), rooms_, and SelectFirstCellIfAvailable().
Referenced by yaze::editor::DungeonObjectSelector::DrawNewCustomObjectDialog().

| void yaze::editor::ObjectTileEditorPanel::Close | ( | ) |
Definition at line 86 of file object_tile_editor_panel.cc.
References current_layout_, current_object_id_, current_room_id_, is_new_object_, is_open_, ResetTransientState(), and rooms_.
Referenced by Draw(), DrawActionBar(), HandleKeyboardShortcuts(), and yaze::editor::DungeonEditorV2::RefreshRomBackedState().

|
inline |
Definition at line 53 of file object_tile_editor_panel.h.
References is_open_.
| void yaze::editor::ObjectTileEditorPanel::SetCurrentPaletteGroup | ( | const gfx::PaletteGroup & | group | ) |
Definition at line 96 of file object_tile_editor_panel.cc.
References atlas_dirty_, current_palette_group_, and preview_dirty_.
Referenced by yaze::editor::DungeonEditorV2::RefreshRomBackedState().
|
inline |
Definition at line 58 of file object_tile_editor_panel.h.
References on_object_created_.
|
private |
Definition at line 18 of file object_tile_editor_panel.cc.
References object_preview_bmp_, and tile8_atlas_bmp_.
Referenced by ResetTransientState().
|
private |
Definition at line 23 of file object_tile_editor_panel.cc.
References action_status_message_, action_status_tone_, and kNone.
Referenced by ApplyChanges(), DrawActionBar(), DrawSourceSheet(), DrawTileProperties(), HandleKeyboardShortcuts(), and ResetTransientState().
|
private |
Definition at line 28 of file object_tile_editor_panel.cc.
References action_status_message_, and action_status_tone_.
Referenced by ApplyChanges().
|
private |
Definition at line 34 of file object_tile_editor_panel.cc.
References atlas_dirty_, ClearActionStatus(), ClearRenderedBitmaps(), preview_dirty_, selected_cell_index_, selected_source_tile_, shared_object_count_, shared_tile_data_usage_override_, and show_shared_confirm_.
Referenced by Close(), OpenForNewObject(), and OpenForObject().

|
private |
Definition at line 103 of file object_tile_editor_panel.cc.
References yaze::zelda3::ObjectTileLayout::bounds_height, yaze::zelda3::ObjectTileLayout::bounds_width, current_layout_, current_object_id_, yaze::zelda3::ObjectTileLayout::custom_filename, yaze::zelda3::GetObjectName(), ICON_MD_ADD_BOX, ICON_MD_GRID_ON, yaze::zelda3::ObjectTileLayout::is_custom, and is_new_object_.
Referenced by Draw().

|
private |
Definition at line 122 of file object_tile_editor_panel.cc.
References yaze::zelda3::ObjectTileLayout::cells, current_layout_, selected_cell_index_, selected_source_tile_, and SyncSourceSelectionFromSelectedCell().
Referenced by OpenForNewObject(), and OpenForObject().

|
private |
Definition at line 133 of file object_tile_editor_panel.cc.
References current_layout_, current_object_id_, yaze::zelda3::ObjectTileLayout::is_custom, shared_tile_data_usage_override_, yaze::zelda3::ObjectTileLayout::tile_data_address, and tile_editor_.
Referenced by ApplyChanges(), DrawActionBar(), and HasSharedTileDataConflict().
|
private |
Definition at line 146 of file object_tile_editor_panel.cc.
References GetSharedTileDataUsageCount().

|
private |
Definition at line 150 of file object_tile_editor_panel.cc.
References yaze::zelda3::ObjectTileLayout::cells, current_layout_, current_room_id_, rooms_, and yaze::editor::DungeonRoomStore::size().
Referenced by ApplyChanges(), and 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().

|
private |
Definition at line 290 of file object_tile_editor_panel.cc.
References yaze::zelda3::ObjectTileLayout::bounds_height, yaze::zelda3::ObjectTileLayout::bounds_width, yaze::zelda3::ObjectTileLayout::cells, current_layout_, yaze::gfx::Bitmap::is_active(), yaze::gui::kScale, object_preview_bmp_, preview_dirty_, RenderObjectPreview(), selected_cell_index_, SyncSourceSelectionFromSelectedCell(), and yaze::gfx::Bitmap::texture().
Referenced by Draw().

|
private |
Definition at line 370 of file object_tile_editor_panel.cc.
References atlas_dirty_, yaze::zelda3::ObjectTileLayout::cells, ClearActionStatus(), current_layout_, yaze::gfx::Bitmap::is_active(), yaze::zelda3::ObjectTileEditor::kAtlasHeightPx, yaze::zelda3::ObjectTileEditor::kAtlasTileRows, yaze::zelda3::ObjectTileEditor::kAtlasTilesPerRow, yaze::zelda3::ObjectTileEditor::kAtlasWidthPx, preview_dirty_, RenderTile8Atlas(), selected_cell_index_, selected_source_tile_, source_palette_, yaze::gfx::Bitmap::texture(), and tile8_atlas_bmp_.
Referenced by Draw().

|
private |
Definition at line 469 of file object_tile_editor_panel.cc.
References yaze::zelda3::ObjectTileLayout::cells, ClearActionStatus(), current_layout_, preview_dirty_, selected_cell_index_, and SyncSourceSelectionFromSelectedCell().
Referenced by Draw().

|
private |
Definition at line 587 of file object_tile_editor_panel.cc.
References action_status_message_, action_status_tone_, ApplyChanges(), yaze::zelda3::ObjectTileLayout::cells, ClearActionStatus(), Close(), yaze::gui::ConvertColorToImVec4(), current_layout_, yaze::gui::ThemeManager::Get(), yaze::gui::ThemeManager::GetCurrentTheme(), GetSharedTileDataUsageCount(), ICON_MD_CLOSE, ICON_MD_SAVE, ICON_MD_UNDO, ICON_MD_WARNING, kError, kNone, kSuccess, kWarning, preview_dirty_, yaze::zelda3::ObjectTileLayout::RevertAll(), and SyncSourceSelectionFromSelectedCell().
Referenced by Draw().
|
private |
Definition at line 671 of file object_tile_editor_panel.cc.
References yaze::zelda3::ObjectTileLayout::cells, ClearActionStatus(), Close(), current_layout_, preview_dirty_, selected_cell_index_, and SyncSourceSelectionFromSelectedCell().
Referenced by Draw().

|
private |
Definition at line 236 of file object_tile_editor_panel.cc.
References current_layout_, current_palette_group_, current_room_id_, yaze::gfx::Bitmap::data(), object_preview_bmp_, preview_dirty_, rooms_, yaze::editor::DungeonRoomStore::size(), tile_editor_, and yaze::gfx::Bitmap::UpdateTexture().
Referenced by DrawTileGrid(), and RefreshRenderedViewsFromCurrentRoom().

|
private |
Definition at line 255 of file object_tile_editor_panel.cc.
References atlas_dirty_, current_palette_group_, current_room_id_, yaze::gfx::Bitmap::data(), rooms_, yaze::editor::DungeonRoomStore::size(), source_palette_, tile8_atlas_bmp_, tile_editor_, and yaze::gfx::Bitmap::UpdateTexture().
Referenced by DrawSourceSheet(), and RefreshRenderedViewsFromCurrentRoom().

|
private |
Definition at line 274 of file object_tile_editor_panel.cc.
References atlas_dirty_, yaze::zelda3::ObjectTileLayout::cells, current_layout_, selected_cell_index_, selected_source_tile_, and source_palette_.
Referenced by DrawActionBar(), DrawTileGrid(), DrawTileProperties(), HandleKeyboardShortcuts(), and SelectFirstCellIfAvailable().
|
private |
Definition at line 524 of file object_tile_editor_panel.cc.
References yaze::zelda3::ObjectTileLayout::cells, ClearActionStatus(), current_layout_, current_room_id_, yaze::zelda3::ObjectTileLayout::custom_filename, GetSharedTileDataUsageCount(), HasRenderableRoomContext(), ICON_MD_CHECK_CIRCLE, ICON_MD_ERROR, ICON_MD_WARNING, is_new_object_, kError, kSuccess, kWarning, yaze::zelda3::ObjectTileLayout::object_id, on_object_created_, RefreshRenderedViewsFromCurrentRoom(), SetActionStatus(), shared_object_count_, show_shared_confirm_, tile_editor_, and yaze::gfx::TileInfoToWord().
Referenced by Draw(), and DrawActionBar().
|
friend |
Definition at line 98 of file object_tile_editor_panel.h.
|
private |
Definition at line 99 of file object_tile_editor_panel.h.
Referenced by ApplyChanges(), GetSharedTileDataUsageCount(), ObjectTileEditorPanel(), OpenForObject(), RenderObjectPreview(), and RenderTile8Atlas().
|
private |
Definition at line 100 of file object_tile_editor_panel.h.
Referenced by ApplyChanges(), BuildWindowTitle(), Close(), Draw(), DrawActionBar(), DrawSourceSheet(), DrawTileGrid(), DrawTileProperties(), GetSharedTileDataUsageCount(), HandleKeyboardShortcuts(), HasRenderableRoomContext(), OpenForNewObject(), OpenForObject(), RenderObjectPreview(), SelectFirstCellIfAvailable(), and SyncSourceSelectionFromSelectedCell().
|
private |
Definition at line 101 of file object_tile_editor_panel.h.
Referenced by DrawSourceSheet(), DrawTileGrid(), DrawTileProperties(), HandleKeyboardShortcuts(), ResetTransientState(), SelectFirstCellIfAvailable(), and SyncSourceSelectionFromSelectedCell().
|
private |
Definition at line 102 of file object_tile_editor_panel.h.
Referenced by DrawSourceSheet(), ResetTransientState(), SelectFirstCellIfAvailable(), and SyncSourceSelectionFromSelectedCell().
|
private |
Definition at line 103 of file object_tile_editor_panel.h.
Referenced by DrawSourceSheet(), RenderTile8Atlas(), and SyncSourceSelectionFromSelectedCell().
|
private |
Definition at line 106 of file object_tile_editor_panel.h.
|
private |
Definition at line 107 of file object_tile_editor_panel.h.
|
private |
Definition at line 110 of file object_tile_editor_panel.h.
Referenced by ClearRenderedBitmaps(), DrawTileGrid(), and RenderObjectPreview().
|
private |
Definition at line 111 of file object_tile_editor_panel.h.
Referenced by ClearRenderedBitmaps(), DrawSourceSheet(), and RenderTile8Atlas().
|
private |
Definition at line 112 of file object_tile_editor_panel.h.
Referenced by DrawActionBar(), DrawSourceSheet(), DrawTileGrid(), DrawTileProperties(), HandleKeyboardShortcuts(), RefreshRenderedViewsFromCurrentRoom(), RenderObjectPreview(), ResetTransientState(), and SetCurrentPaletteGroup().
|
private |
Definition at line 113 of file object_tile_editor_panel.h.
Referenced by DrawSourceSheet(), RefreshRenderedViewsFromCurrentRoom(), RenderTile8Atlas(), ResetTransientState(), SetCurrentPaletteGroup(), and SyncSourceSelectionFromSelectedCell().
|
private |
Definition at line 116 of file object_tile_editor_panel.h.
Referenced by ApplyChanges(), Draw(), and ResetTransientState().
|
private |
Definition at line 117 of file object_tile_editor_panel.h.
Referenced by ApplyChanges(), Draw(), and ResetTransientState().
|
private |
Definition at line 118 of file object_tile_editor_panel.h.
Referenced by GetSharedTileDataUsageCount(), and ResetTransientState().
|
private |
Definition at line 119 of file object_tile_editor_panel.h.
Referenced by ClearActionStatus(), DrawActionBar(), and SetActionStatus().
|
private |
Definition at line 120 of file object_tile_editor_panel.h.
Referenced by ClearActionStatus(), DrawActionBar(), and SetActionStatus().
|
private |
Definition at line 123 of file object_tile_editor_panel.h.
Referenced by ApplyChanges(), BuildWindowTitle(), Close(), OpenForNewObject(), and OpenForObject().
|
private |
Definition at line 124 of file object_tile_editor_panel.h.
Referenced by ApplyChanges(), and SetObjectCreatedCallback().
|
private |
Definition at line 127 of file object_tile_editor_panel.h.
|
private |
Definition at line 128 of file object_tile_editor_panel.h.
|
private |
Definition at line 129 of file object_tile_editor_panel.h.
Referenced by ApplyChanges(), Close(), HasRenderableRoomContext(), OpenForNewObject(), OpenForObject(), RenderObjectPreview(), and RenderTile8Atlas().
|
private |
Definition at line 130 of file object_tile_editor_panel.h.
Referenced by BuildWindowTitle(), Close(), GetSharedTileDataUsageCount(), OpenForNewObject(), and OpenForObject().
|
private |
Definition at line 131 of file object_tile_editor_panel.h.
Referenced by Close(), HasRenderableRoomContext(), OpenForNewObject(), OpenForObject(), RenderObjectPreview(), and RenderTile8Atlas().
|
private |
Definition at line 132 of file object_tile_editor_panel.h.
Referenced by OpenForObject(), RenderObjectPreview(), RenderTile8Atlas(), and SetCurrentPaletteGroup().
|
private |
Definition at line 133 of file object_tile_editor_panel.h.
Referenced by Close(), Draw(), IsOpen(), OpenForNewObject(), and OpenForObject().