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

Browse and place dungeon objects. More...

#include <object_selector_content.h>

Inheritance diagram for yaze::editor::ObjectSelectorContent:

Public Member Functions

 ObjectSelectorContent (Rom *rom, DungeonCanvasViewer *canvas_viewer, std::shared_ptr< zelda3::DungeonObjectEditor > object_editor=nullptr, ToastManager *toast_manager=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.
 
float GetPreferredWidth () const override
 Get preferred width for this panel (optional)
 
void Draw (bool *p_open) override
 Draw the panel content.
 
void OnOpen () override
 Called when panel becomes visible.
 
void OnClose () override
 Called when panel is hidden.
 
DungeonObjectSelectorobject_selector ()
 
void SetCurrentRoom (int room_id)
 
void SetCanvasViewerProvider (std::function< DungeonCanvasViewer *()> provider)
 
void SetCanvasViewer (DungeonCanvasViewer *viewer)
 
void SetContext (EditorContext ctx)
 
void SetGameData (zelda3::GameData *game_data)
 
void SetRooms (DungeonRoomStore *rooms)
 
void SetCurrentPaletteGroup (const gfx::PaletteGroup &group)
 
void SelectObject (int obj_id)
 
void SetAgentOptimizedLayout (bool enabled)
 
void CancelPlacement ()
 
void SetToastManager (ToastManager *toast_manager)
 
void SetPlacementError (const std::string &message)
 
void SetOpenObjectEditorCallback (std::function< void()> callback)
 
- 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 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 Member Functions

DungeonCanvasViewerResolveCanvasViewer ()
 
void DrawObjectSelector ()
 
void DrawInteractionSummary ()
 

Private Attributes

Romrom_ = nullptr
 
DungeonCanvasViewercanvas_viewer_ = nullptr
 
std::function< DungeonCanvasViewer *()> canvas_viewer_provider_
 
int current_room_id_ = 0
 
DungeonObjectSelector object_selector_
 
zelda3::RoomObject preview_object_ {0, 0, 0, 0, 0}
 
bool has_preview_object_ = false
 
std::shared_ptr< zelda3::DungeonObjectEditorobject_editor_
 
ToastManagertoast_manager_ = nullptr
 
std::string last_placement_error_
 
double placement_error_time_ = -1.0
 
std::function< void()> open_object_editor_callback_
 

Static Private Attributes

static constexpr double kPlacementErrorDuration = 2.0
 

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

Browse and place dungeon objects.

This content owns object browsing and placement. Selection editing lives in ObjectEditorContent so the selector can stay focused on choosing assets and initiating placement.

Features:

  • Object browser with graphical previews
  • Placement initiation and feedback
  • Object templates for common patterns
See also
WindowContent - Base interface
DungeonObjectSelector - Object browser component

Definition at line 41 of file object_selector_content.h.

Constructor & Destructor Documentation

◆ ObjectSelectorContent()

Member Function Documentation

◆ GetId()

std::string yaze::editor::ObjectSelectorContent::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 52 of file object_selector_content.h.

◆ GetDisplayName()

std::string yaze::editor::ObjectSelectorContent::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 53 of file object_selector_content.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 54 of file object_selector_content.h.

References ICON_MD_CONSTRUCTION.

◆ GetEditorCategory()

std::string yaze::editor::ObjectSelectorContent::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 55 of file object_selector_content.h.

◆ GetPriority()

int yaze::editor::ObjectSelectorContent::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 56 of file object_selector_content.h.

◆ GetPreferredWidth()

float yaze::editor::ObjectSelectorContent::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 57 of file object_selector_content.h.

◆ Draw()

◆ OnOpen()

void yaze::editor::ObjectSelectorContent::OnOpen ( )
inlineoverridevirtual

Called when panel becomes visible.

Use this to initialize state, load resources, or start animations. Called after the panel is shown but before first Draw().

Reimplemented from yaze::editor::WindowContent.

Definition at line 64 of file object_selector_content.h.

◆ OnClose()

void yaze::editor::ObjectSelectorContent::OnClose ( )
inlineoverridevirtual

Called when panel is hidden.

Use this to cleanup state, release resources, or save state. Called after the panel is hidden.

Reimplemented from yaze::editor::WindowContent.

Definition at line 65 of file object_selector_content.h.

◆ object_selector()

DungeonObjectSelector & yaze::editor::ObjectSelectorContent::object_selector ( )
inline

Definition at line 71 of file object_selector_content.h.

References object_selector_.

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

◆ SetCurrentRoom()

void yaze::editor::ObjectSelectorContent::SetCurrentRoom ( int room_id)
inline

Definition at line 76 of file object_selector_content.h.

References current_room_id_, object_selector_, and yaze::editor::DungeonObjectSelector::set_current_room_id().

Here is the call graph for this function:

◆ SetCanvasViewerProvider()

void yaze::editor::ObjectSelectorContent::SetCanvasViewerProvider ( std::function< DungeonCanvasViewer *()> provider)
inline

Definition at line 80 of file object_selector_content.h.

References canvas_viewer_provider_.

◆ SetCanvasViewer()

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

Definition at line 83 of file object_selector_content.h.

References canvas_viewer_.

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

◆ SetContext()

void yaze::editor::ObjectSelectorContent::SetContext ( EditorContext ctx)
inline

Definition at line 85 of file object_selector_content.h.

References object_selector_, yaze::editor::EditorContext::rom, rom_, and yaze::editor::DungeonObjectSelector::SetContext().

Here is the call graph for this function:

◆ SetGameData()

void yaze::editor::ObjectSelectorContent::SetGameData ( zelda3::GameData * game_data)
inline

◆ SetRooms()

void yaze::editor::ObjectSelectorContent::SetRooms ( DungeonRoomStore * rooms)
inline

Definition at line 94 of file object_selector_content.h.

References object_selector_, and yaze::editor::DungeonObjectSelector::set_rooms().

Here is the call graph for this function:

◆ SetCurrentPaletteGroup()

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

◆ SelectObject()

void yaze::editor::ObjectSelectorContent::SelectObject ( int obj_id)

Definition at line 205 of file object_selector_content.cc.

References object_selector_, and yaze::editor::DungeonObjectSelector::SelectObject().

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

Here is the call graph for this function:

◆ SetAgentOptimizedLayout()

void yaze::editor::ObjectSelectorContent::SetAgentOptimizedLayout ( bool enabled)

◆ CancelPlacement()

void yaze::editor::ObjectSelectorContent::CancelPlacement ( )

◆ SetToastManager()

void yaze::editor::ObjectSelectorContent::SetToastManager ( ToastManager * toast_manager)
inline

Definition at line 110 of file object_selector_content.h.

References toast_manager_.

◆ SetPlacementError()

void yaze::editor::ObjectSelectorContent::SetPlacementError ( const std::string & message)

◆ SetOpenObjectEditorCallback()

void yaze::editor::ObjectSelectorContent::SetOpenObjectEditorCallback ( std::function< void()> callback)
inline

Definition at line 118 of file object_selector_content.h.

References open_object_editor_callback_.

◆ ResolveCanvasViewer()

DungeonCanvasViewer * yaze::editor::ObjectSelectorContent::ResolveCanvasViewer ( )
private

Definition at line 112 of file object_selector_content.cc.

References canvas_viewer_, and canvas_viewer_provider_.

Referenced by Draw(), and DrawInteractionSummary().

◆ DrawObjectSelector()

void yaze::editor::ObjectSelectorContent::DrawObjectSelector ( )
private

Definition at line 230 of file object_selector_content.cc.

References yaze::editor::DungeonObjectSelector::DrawObjectAssetBrowser(), and object_selector_.

Referenced by Draw().

Here is the call graph for this function:

◆ DrawInteractionSummary()

void yaze::editor::ObjectSelectorContent::DrawInteractionSummary ( )
private

Member Data Documentation

◆ rom_

Rom* yaze::editor::ObjectSelectorContent::rom_ = nullptr
private

Definition at line 133 of file object_selector_content.h.

Referenced by SetContext().

◆ canvas_viewer_

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

◆ canvas_viewer_provider_

std::function<DungeonCanvasViewer*()> yaze::editor::ObjectSelectorContent::canvas_viewer_provider_
private

Definition at line 135 of file object_selector_content.h.

Referenced by ResolveCanvasViewer(), and SetCanvasViewerProvider().

◆ current_room_id_

int yaze::editor::ObjectSelectorContent::current_room_id_ = 0
private

Definition at line 136 of file object_selector_content.h.

Referenced by DrawInteractionSummary(), and SetCurrentRoom().

◆ object_selector_

◆ preview_object_

zelda3::RoomObject yaze::editor::ObjectSelectorContent::preview_object_ {0, 0, 0, 0, 0}
private

Definition at line 143 of file object_selector_content.h.

Referenced by DrawInteractionSummary(), and ObjectSelectorContent().

◆ has_preview_object_

bool yaze::editor::ObjectSelectorContent::has_preview_object_ = false
private

◆ object_editor_

std::shared_ptr<zelda3::DungeonObjectEditor> yaze::editor::ObjectSelectorContent::object_editor_
private

Definition at line 145 of file object_selector_content.h.

Referenced by ObjectSelectorContent().

◆ toast_manager_

ToastManager* yaze::editor::ObjectSelectorContent::toast_manager_ = nullptr
private

◆ kPlacementErrorDuration

constexpr double yaze::editor::ObjectSelectorContent::kPlacementErrorDuration = 2.0
staticconstexprprivate

Definition at line 149 of file object_selector_content.h.

Referenced by DrawInteractionSummary(), and SetPlacementError().

◆ last_placement_error_

std::string yaze::editor::ObjectSelectorContent::last_placement_error_
private

Definition at line 150 of file object_selector_content.h.

Referenced by DrawInteractionSummary(), and SetPlacementError().

◆ placement_error_time_

double yaze::editor::ObjectSelectorContent::placement_error_time_ = -1.0
private

Definition at line 151 of file object_selector_content.h.

Referenced by DrawInteractionSummary(), and SetPlacementError().

◆ open_object_editor_callback_

std::function<void()> yaze::editor::ObjectSelectorContent::open_object_editor_callback_
private

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