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

WindowContent for displaying room graphics blocks. More...

#include <room_graphics_content.h>

Inheritance diagram for yaze::editor::RoomGraphicsContent:

Classes

struct  SheetPreviewMetadata
 

Public Types

using AssignmentCallback = std::function<absl::Status(int, int, int)>
 
using UsageCallback
 

Public Member Functions

 RoomGraphicsContent ()
 
 RoomGraphicsContent (int *current_room_id, DungeonRoomStore *rooms, gfx::IRenderer *renderer=nullptr)
 
 ~RoomGraphicsContent () override
 
void SetCurrentPaletteGroup (const gfx::PaletteGroup &group)
 Set the current palette group for graphics rendering.
 
void SetAssignmentCallback (AssignmentCallback callback)
 
void SetUsageCallback (UsageCallback callback)
 
void DetachRuntimeContext ()
 
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.
 
std::string GetWorkflowGroup () const override
 Optional workflow group for hack-centric actions.
 
float GetPreferredWidth () const override
 Get preferred width for this panel (optional)
 
void Draw (bool *p_open) override
 Draw the panel content.
 
- 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 WindowPresentationPolicy GetPresentationPolicy () const
 How this content is hosted and advertised by workspace chrome.
 
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 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 bool HasExactPreferredWidth () const
 Whether GetPreferredWidth() is an exact content width.
 
virtual float GetPreferredHeight () const
 Get preferred height for this panel (optional)
 
virtual bool PrefersFloating () const
 
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 Member Functions

void RefreshSheetPreviews (const zelda3::Room &room)
 
void DrawAssignmentControls (const zelda3::Room &room)
 
void DrawAssignmentPicker (const zelda3::Room &room)
 
void DrawSharedUsage (int roomset)
 
void ClearPickerPreviews ()
 

Private Attributes

int * current_room_id_ = nullptr
 
DungeonRoomStore * rooms_ = nullptr
 
gfx::IRenderer * renderer_ = nullptr
 
gui::Canvas room_gfx_canvas_
 
std::array< gfx::Bitmap, 16 > sheet_previews_
 
std::array< SheetPreviewMetadata, 16 > sheet_preview_metadata_ {}
 
std::array< uint8_t, 16 > preview_block_ids_ {}
 
int preview_room_id_ = -1
 
uint64_t preview_graphics_revision_ = 0
 
bool preview_cache_valid_ = false
 
bool show_source_trace_ = false
 
bool runtime_detached_ = false
 
int selected_slot_ = 3
 
int selection_room_ = -1
 
int selection_group_ = -1
 
int pending_sheet_ = -1
 
bool show_picker_ = false
 
std::string assignment_error_
 
AssignmentCallback assignment_callback_
 
UsageCallback usage_callback_
 
std::map< int, gfx::Bitmap > picker_previews_
 
gui::AdaptiveSheetScaleMode sheet_scale_mode_
 
gfx::PaletteGroup current_palette_group_
 
bool palette_dirty_ = true
 

Friends

struct RoomGraphicsContentTestAccess
 

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

WindowContent for displaying room graphics blocks.

This panel shows the graphics blocks used by the current room, displaying an adaptive grid of 128x32 graphics blocks.

See also
WindowContent - Base interface

Definition at line 37 of file room_graphics_content.h.

Member Typedef Documentation

◆ AssignmentCallback

using yaze::editor::RoomGraphicsContent::AssignmentCallback = std::function<absl::Status(int, int, int)>

Definition at line 62 of file room_graphics_content.h.

◆ UsageCallback

Initial value:
std::function<absl::StatusOr<zelda3::RoomsetUsageReport>(int)>

Definition at line 66 of file room_graphics_content.h.

Constructor & Destructor Documentation

◆ RoomGraphicsContent() [1/2]

yaze::editor::RoomGraphicsContent::RoomGraphicsContent ( )
inline

Definition at line 40 of file room_graphics_content.h.

◆ RoomGraphicsContent() [2/2]

yaze::editor::RoomGraphicsContent::RoomGraphicsContent ( int * current_room_id,
DungeonRoomStore * rooms,
gfx::IRenderer * renderer = nullptr )
inline

Definition at line 44 of file room_graphics_content.h.

◆ ~RoomGraphicsContent()

yaze::editor::RoomGraphicsContent::~RoomGraphicsContent ( )
override

Definition at line 40 of file room_graphics_content.cc.

References ClearPickerPreviews(), yaze::gfx::Arena::Get(), yaze::gfx::Arena::RetireBitmap(), and sheet_previews_.

Here is the call graph for this function:

Member Function Documentation

◆ SetCurrentPaletteGroup()

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

Set the current palette group for graphics rendering.

Parameters
groupThe palette group from the current room

Definition at line 57 of file room_graphics_content.h.

References current_palette_group_, and palette_dirty_.

Referenced by yaze::editor::DungeonEditorV2::HandleDungeonPaletteChanged(), yaze::editor::DungeonEditorV2::OnRoomSelected(), yaze::editor::DungeonEditorV2::RefreshRomBackedState(), and yaze::editor::DungeonEditorV2::RefreshRoomMetadataViews().

◆ SetAssignmentCallback()

void yaze::editor::RoomGraphicsContent::SetAssignmentCallback ( AssignmentCallback callback)
inline

Definition at line 63 of file room_graphics_content.h.

References assignment_callback_.

◆ SetUsageCallback()

void yaze::editor::RoomGraphicsContent::SetUsageCallback ( UsageCallback callback)
inline

Definition at line 68 of file room_graphics_content.h.

References usage_callback_.

◆ DetachRuntimeContext()

void yaze::editor::RoomGraphicsContent::DetachRuntimeContext ( )

◆ GetId()

std::string yaze::editor::RoomGraphicsContent::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 78 of file room_graphics_content.h.

◆ GetDisplayName()

std::string yaze::editor::RoomGraphicsContent::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 79 of file room_graphics_content.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 80 of file room_graphics_content.h.

References ICON_MD_IMAGE.

◆ GetEditorCategory()

std::string yaze::editor::RoomGraphicsContent::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 81 of file room_graphics_content.h.

◆ GetPriority()

int yaze::editor::RoomGraphicsContent::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 82 of file room_graphics_content.h.

◆ GetWorkflowGroup()

std::string yaze::editor::RoomGraphicsContent::GetWorkflowGroup ( ) const
inlineoverridevirtual

Optional workflow group for hack-centric actions.

Returns
Non-empty group name to surface this panel in hack workflows.

Reimplemented from yaze::editor::WindowContent.

Definition at line 83 of file room_graphics_content.h.

◆ GetPreferredWidth()

float yaze::editor::RoomGraphicsContent::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 84 of file room_graphics_content.h.

◆ Draw()

void yaze::editor::RoomGraphicsContent::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 327 of file room_graphics_content.cc.

References assignment_callback_, assignment_error_, yaze::gui::AutoRegisterLastItem(), yaze::gui::AutoSmallButton(), yaze::gui::BeginCanvas(), yaze::gui::CanvasFrameOptions::canvas_size, ClearPickerPreviews(), yaze::gui::AdaptiveSheetGridLayout::columns, yaze::gui::AdaptiveSheetGridLayout::content_height, yaze::gui::AdaptiveSheetGridLayout::content_width, current_room_id_, yaze::editor::CurrentDungeonWindowContext(), yaze::gui::BitmapPreviewOptions::dest_pos, yaze::gui::BitmapPreviewOptions::dest_size, yaze::gui::CanvasFrameOptions::draw_context_menu, yaze::gui::BitmapPreviewOptions::draw_context_menu, yaze::gui::CanvasFrameOptions::draw_grid, yaze::gui::BitmapPreviewOptions::draw_grid, yaze::gui::CanvasFrameOptions::draw_overlay, yaze::gui::BitmapPreviewOptions::draw_overlay, DrawAssignmentControls(), yaze::gui::DrawBitmapPreview(), yaze::gui::EndCanvas(), yaze::gui::BitmapPreviewOptions::ensure_texture, yaze::gfx::Arena::Get(), yaze::zelda3::CustomObjectManager::Get(), yaze::gui::GetOutlineVec4(), yaze::gui::GetTextSecondaryVec4(), yaze::gui::Canvas::global_scale(), ICON_MD_BUG_REPORT, yaze::gui::AdaptiveSheetGridLayout::item_height, yaze::gui::AdaptiveSheetGridLayout::item_width, pending_sheet_, yaze::gfx::Arena::ProcessTextureQueue(), RefreshSheetPreviews(), yaze::gui::CanvasFrameOptions::render_popups, yaze::gui::BitmapPreviewOptions::render_popups, renderer_, yaze::gui::ResolveAdaptiveSheetGridLayout(), room_gfx_canvas_, rooms_, runtime_detached_, selected_slot_, selection_group_, selection_room_, sheet_preview_metadata_, sheet_previews_, sheet_scale_mode_, show_picker_, show_source_trace_, yaze::editor::DungeonRoomStore::size(), usage_callback_, and yaze::gui::Canvas::zero_point().

◆ RefreshSheetPreviews()

◆ DrawAssignmentControls()

◆ DrawAssignmentPicker()

◆ DrawSharedUsage()

void yaze::editor::RoomGraphicsContent::DrawSharedUsage ( int roomset)
private

Definition at line 63 of file room_graphics_content.cc.

References yaze::gui::AutoRegisterLastItem(), and usage_callback_.

Referenced by DrawAssignmentControls().

Here is the call graph for this function:

◆ ClearPickerPreviews()

void yaze::editor::RoomGraphicsContent::ClearPickerPreviews ( )
private

Definition at line 47 of file room_graphics_content.cc.

References yaze::gfx::Arena::Get(), picker_previews_, and yaze::gfx::Arena::RetireBitmap().

Referenced by Draw(), DrawAssignmentControls(), and ~RoomGraphicsContent().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ RoomGraphicsContentTestAccess

friend struct RoomGraphicsContentTestAccess
friend

Definition at line 93 of file room_graphics_content.h.

Member Data Documentation

◆ current_room_id_

int* yaze::editor::RoomGraphicsContent::current_room_id_ = nullptr
private

Definition at line 113 of file room_graphics_content.h.

Referenced by DetachRuntimeContext(), and Draw().

◆ rooms_

DungeonRoomStore* yaze::editor::RoomGraphicsContent::rooms_ = nullptr
private

◆ renderer_

gfx::IRenderer* yaze::editor::RoomGraphicsContent::renderer_ = nullptr
private

Definition at line 115 of file room_graphics_content.h.

Referenced by DetachRuntimeContext(), and Draw().

◆ room_gfx_canvas_

gui::Canvas yaze::editor::RoomGraphicsContent::room_gfx_canvas_
private

Definition at line 116 of file room_graphics_content.h.

Referenced by Draw().

◆ sheet_previews_

std::array<gfx::Bitmap, 16> yaze::editor::RoomGraphicsContent::sheet_previews_
private

Definition at line 117 of file room_graphics_content.h.

Referenced by Draw(), RefreshSheetPreviews(), and ~RoomGraphicsContent().

◆ sheet_preview_metadata_

std::array<SheetPreviewMetadata, 16> yaze::editor::RoomGraphicsContent::sheet_preview_metadata_ {}
private

Definition at line 118 of file room_graphics_content.h.

Referenced by Draw(), and RefreshSheetPreviews().

◆ preview_block_ids_

std::array<uint8_t, 16> yaze::editor::RoomGraphicsContent::preview_block_ids_ {}
private

Definition at line 119 of file room_graphics_content.h.

Referenced by RefreshSheetPreviews().

◆ preview_room_id_

int yaze::editor::RoomGraphicsContent::preview_room_id_ = -1
private

Definition at line 120 of file room_graphics_content.h.

Referenced by RefreshSheetPreviews().

◆ preview_graphics_revision_

uint64_t yaze::editor::RoomGraphicsContent::preview_graphics_revision_ = 0
private

Definition at line 121 of file room_graphics_content.h.

Referenced by RefreshSheetPreviews().

◆ preview_cache_valid_

bool yaze::editor::RoomGraphicsContent::preview_cache_valid_ = false
private

Definition at line 122 of file room_graphics_content.h.

Referenced by RefreshSheetPreviews().

◆ show_source_trace_

bool yaze::editor::RoomGraphicsContent::show_source_trace_ = false
private

Definition at line 123 of file room_graphics_content.h.

Referenced by Draw().

◆ runtime_detached_

bool yaze::editor::RoomGraphicsContent::runtime_detached_ = false
private

Definition at line 124 of file room_graphics_content.h.

Referenced by DetachRuntimeContext(), and Draw().

◆ selected_slot_

int yaze::editor::RoomGraphicsContent::selected_slot_ = 3
private

Definition at line 125 of file room_graphics_content.h.

Referenced by Draw(), DrawAssignmentControls(), and DrawAssignmentPicker().

◆ selection_room_

int yaze::editor::RoomGraphicsContent::selection_room_ = -1
private

Definition at line 126 of file room_graphics_content.h.

Referenced by Draw().

◆ selection_group_

int yaze::editor::RoomGraphicsContent::selection_group_ = -1
private

Definition at line 127 of file room_graphics_content.h.

Referenced by Draw().

◆ pending_sheet_

int yaze::editor::RoomGraphicsContent::pending_sheet_ = -1
private

Definition at line 128 of file room_graphics_content.h.

Referenced by Draw(), DrawAssignmentControls(), and DrawAssignmentPicker().

◆ show_picker_

bool yaze::editor::RoomGraphicsContent::show_picker_ = false
private

Definition at line 129 of file room_graphics_content.h.

Referenced by Draw(), DrawAssignmentControls(), and DrawAssignmentPicker().

◆ assignment_error_

std::string yaze::editor::RoomGraphicsContent::assignment_error_
private

Definition at line 130 of file room_graphics_content.h.

Referenced by Draw(), DrawAssignmentControls(), and DrawAssignmentPicker().

◆ assignment_callback_

AssignmentCallback yaze::editor::RoomGraphicsContent::assignment_callback_
private

◆ usage_callback_

UsageCallback yaze::editor::RoomGraphicsContent::usage_callback_
private

◆ picker_previews_

std::map<int, gfx::Bitmap> yaze::editor::RoomGraphicsContent::picker_previews_
private

Definition at line 133 of file room_graphics_content.h.

Referenced by ClearPickerPreviews(), and DrawAssignmentPicker().

◆ sheet_scale_mode_

gui::AdaptiveSheetScaleMode yaze::editor::RoomGraphicsContent::sheet_scale_mode_
private
Initial value:

Definition at line 134 of file room_graphics_content.h.

Referenced by Draw().

◆ current_palette_group_

gfx::PaletteGroup yaze::editor::RoomGraphicsContent::current_palette_group_
private

Definition at line 138 of file room_graphics_content.h.

Referenced by SetCurrentPaletteGroup().

◆ palette_dirty_

bool yaze::editor::RoomGraphicsContent::palette_dirty_ = true
private

Definition at line 139 of file room_graphics_content.h.

Referenced by RefreshSheetPreviews(), and SetCurrentPaletteGroup().


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