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

EditorPanel for placing and managing dungeon sprites. More...

#include <sprite_editor_panel.h>

Inheritance diagram for yaze::editor::SpriteEditorPanel:
Collaboration diagram for yaze::editor::SpriteEditorPanel:

Public Member Functions

 SpriteEditorPanel (int *current_room_id, std::array< zelda3::Room, 0x128 > *rooms, DungeonCanvasViewer *canvas_viewer=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 SetCanvasViewer (DungeonCanvasViewer *viewer)
 
void SetSpritePlacedCallback (std::function< void(const zelda3::Sprite &)> callback)
 
- 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 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.
 
void DrawWithLazyInit (bool *p_open)
 Execute lazy initialization if needed, then call Draw()
 

Private Member Functions

void DrawPlacementControls ()
 
void DrawSpriteSelector ()
 
void DrawRoomSprites ()
 
void DrawSpriteProperties ()
 
bool MatchesFilter (int sprite_id)
 
ImVec4 GetSpriteTypeColor (int sprite_id, const AgentUITheme &theme)
 
const char * GetSpriteTypeIcon (int sprite_id)
 
const char * GetSpriteCategoryName (int sprite_id)
 

Private Attributes

int * current_room_id_ = nullptr
 
std::array< zelda3::Room, 0x128 > * rooms_ = nullptr
 
DungeonCanvasViewercanvas_viewer_ = nullptr
 
int selected_sprite_id_ = 0
 
int selected_sprite_list_index_ = -1
 
int selected_category_ = 0
 
char search_filter_ [64] = {0}
 
bool placement_mode_ = false
 
std::function< void(const zelda3::Sprite &) sprite_placed_callback_ )
 

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

EditorPanel for placing and managing dungeon sprites.

This panel provides sprite selection and placement functionality for dungeon rooms, similar to ObjectEditorPanel.

See also
EditorPanel - Base interface
ObjectEditorPanel - Similar panel for tile objects

Definition at line 32 of file sprite_editor_panel.h.

Constructor & Destructor Documentation

◆ SpriteEditorPanel()

yaze::editor::SpriteEditorPanel::SpriteEditorPanel ( int * current_room_id,
std::array< zelda3::Room, 0x128 > * rooms,
DungeonCanvasViewer * canvas_viewer = nullptr )
inline

Definition at line 34 of file sprite_editor_panel.h.

Member Function Documentation

◆ GetId()

std::string yaze::editor::SpriteEditorPanel::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 45 of file sprite_editor_panel.h.

◆ GetDisplayName()

std::string yaze::editor::SpriteEditorPanel::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 46 of file sprite_editor_panel.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::EditorPanel.

Definition at line 47 of file sprite_editor_panel.h.

References ICON_MD_PERSON.

◆ GetEditorCategory()

std::string yaze::editor::SpriteEditorPanel::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 48 of file sprite_editor_panel.h.

◆ GetPriority()

int yaze::editor::SpriteEditorPanel::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 49 of file sprite_editor_panel.h.

◆ Draw()

void yaze::editor::SpriteEditorPanel::Draw ( bool * p_open)
inlineoverridevirtual

Draw the panel content.

Parameters
p_openPointer to visibility flag (nullptr if not closable)

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

Implements yaze::editor::EditorPanel.

Definition at line 55 of file sprite_editor_panel.h.

References current_room_id_, DrawPlacementControls(), DrawRoomSprites(), DrawSpriteSelector(), and rooms_.

Here is the call graph for this function:

◆ SetCanvasViewer()

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

Definition at line 78 of file sprite_editor_panel.h.

References canvas_viewer_.

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

◆ SetSpritePlacedCallback()

void yaze::editor::SpriteEditorPanel::SetSpritePlacedCallback ( std::function< void(const zelda3::Sprite &)> callback)
inline

Definition at line 82 of file sprite_editor_panel.h.

References sprite_placed_callback_.

◆ DrawPlacementControls()

void yaze::editor::SpriteEditorPanel::DrawPlacementControls ( )
inlineprivate

◆ DrawSpriteSelector()

◆ DrawRoomSprites()

void yaze::editor::SpriteEditorPanel::DrawRoomSprites ( )
inlineprivate

◆ DrawSpriteProperties()

void yaze::editor::SpriteEditorPanel::DrawSpriteProperties ( )
inlineprivate

◆ MatchesFilter()

bool yaze::editor::SpriteEditorPanel::MatchesFilter ( int sprite_id)
inlineprivate

Definition at line 385 of file sprite_editor_panel.h.

References yaze::zelda3::ResolveSpriteName(), search_filter_, and selected_category_.

Referenced by DrawSpriteSelector().

Here is the call graph for this function:

◆ GetSpriteTypeColor()

ImVec4 yaze::editor::SpriteEditorPanel::GetSpriteTypeColor ( int sprite_id,
const AgentUITheme & theme )
inlineprivate

◆ GetSpriteTypeIcon()

const char * yaze::editor::SpriteEditorPanel::GetSpriteTypeIcon ( int sprite_id)
inlineprivate

◆ GetSpriteCategoryName()

const char * yaze::editor::SpriteEditorPanel::GetSpriteCategoryName ( int sprite_id)
inlineprivate

Definition at line 440 of file sprite_editor_panel.h.

Referenced by DrawSpriteSelector().

Member Data Documentation

◆ current_room_id_

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

Definition at line 451 of file sprite_editor_panel.h.

Referenced by Draw(), DrawRoomSprites(), and DrawSpriteProperties().

◆ rooms_

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

Definition at line 452 of file sprite_editor_panel.h.

Referenced by Draw().

◆ canvas_viewer_

DungeonCanvasViewer* yaze::editor::SpriteEditorPanel::canvas_viewer_ = nullptr
private

◆ selected_sprite_id_

int yaze::editor::SpriteEditorPanel::selected_sprite_id_ = 0
private

Definition at line 456 of file sprite_editor_panel.h.

Referenced by DrawPlacementControls(), and DrawSpriteSelector().

◆ selected_sprite_list_index_

int yaze::editor::SpriteEditorPanel::selected_sprite_list_index_ = -1
private

Definition at line 457 of file sprite_editor_panel.h.

Referenced by DrawRoomSprites(), and DrawSpriteProperties().

◆ selected_category_

int yaze::editor::SpriteEditorPanel::selected_category_ = 0
private

Definition at line 458 of file sprite_editor_panel.h.

Referenced by DrawSpriteSelector(), and MatchesFilter().

◆ search_filter_

char yaze::editor::SpriteEditorPanel::search_filter_[64] = {0}
private

Definition at line 459 of file sprite_editor_panel.h.

Referenced by DrawSpriteSelector(), and MatchesFilter().

◆ placement_mode_

bool yaze::editor::SpriteEditorPanel::placement_mode_ = false
private

Definition at line 460 of file sprite_editor_panel.h.

Referenced by DrawPlacementControls(), and DrawSpriteSelector().

◆ sprite_placed_callback_

std::function<void(const zelda3::Sprite&) yaze::editor::SpriteEditorPanel::sprite_placed_callback_)
private

Definition at line 462 of file sprite_editor_panel.h.

Referenced by SetSpritePlacedCallback().


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