Browse and place dungeon objects. More...
#include <object_selector_content.h>

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. | |
| DungeonObjectSelector & | object_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 | |
| DungeonCanvasViewer * | ResolveCanvasViewer () |
| void | DrawObjectSelector () |
| void | DrawInteractionSummary () |
Private Attributes | |
| Rom * | rom_ = nullptr |
| DungeonCanvasViewer * | canvas_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::DungeonObjectEditor > | object_editor_ |
| ToastManager * | toast_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) | |
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:
Definition at line 41 of file object_selector_content.h.
| yaze::editor::ObjectSelectorContent::ObjectSelectorContent | ( | Rom * | rom, |
| DungeonCanvasViewer * | canvas_viewer, | ||
| std::shared_ptr< zelda3::DungeonObjectEditor > | object_editor = nullptr, | ||
| ToastManager * | toast_manager = nullptr ) |
Definition at line 85 of file object_selector_content.cc.
References canvas_viewer_, has_preview_object_, yaze::zelda3::RoomObject::id_, yaze::zelda3::DungeonObjectEditor::kInsert, object_editor_, object_selector_, preview_object_, yaze::editor::DungeonCanvasViewer::SetObjectInteractionEnabled(), yaze::editor::DungeonObjectSelector::SetObjectSelectedCallback(), and yaze::editor::DungeonCanvasViewer::SetPreviewObject().

|
inlineoverridevirtual |
Unique identifier for this panel.
IDs should be:
Implements yaze::editor::WindowContent.
Definition at line 52 of file object_selector_content.h.
|
inlineoverridevirtual |
Human-readable name shown in menus and title bars.
Implements yaze::editor::WindowContent.
Definition at line 53 of file object_selector_content.h.
|
inlineoverridevirtual |
Material Design icon for this panel.
Implements yaze::editor::WindowContent.
Definition at line 54 of file object_selector_content.h.
References ICON_MD_CONSTRUCTION.
|
inlineoverridevirtual |
Editor category this panel belongs to.
Implements yaze::editor::WindowContent.
Definition at line 55 of file object_selector_content.h.
|
inlineoverridevirtual |
Get display priority for menu ordering.
Reimplemented from yaze::editor::WindowContent.
Definition at line 56 of file object_selector_content.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 57 of file object_selector_content.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 119 of file object_selector_content.cc.
References canvas_viewer_, DrawInteractionSummary(), DrawObjectSelector(), yaze::editor::DungeonObjectInteraction::entity_coordinator(), yaze::editor::DoorInteractionHandler::kDoorLimit, yaze::editor::DoorInteractionHandler::kInvalidPosition, yaze::editor::DoorInteractionHandler::kInvalidRoom, yaze::editor::SpriteInteractionHandler::kInvalidRoom, yaze::editor::TileObjectHandler::kInvalidRoom, yaze::zelda3::kMaxDoors, yaze::zelda3::kMaxTileObjects, yaze::zelda3::kMaxTotalSprites, yaze::editor::DoorInteractionHandler::kNone, yaze::editor::SpriteInteractionHandler::kNone, yaze::editor::TileObjectHandler::kNone, yaze::editor::TileObjectHandler::kObjectLimit, yaze::editor::SpriteInteractionHandler::kSpriteLimit, yaze::editor::DungeonCanvasViewer::object_interaction(), yaze::editor::TileObjectHandler::placement_block_reason(), ResolveCanvasViewer(), SetPlacementError(), and yaze::editor::InteractionCoordinator::tile_handler().
|
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.
|
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.
|
inline |
Definition at line 71 of file object_selector_content.h.
References object_selector_.
Referenced by yaze::editor::DungeonEditorV2::Load().
|
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().

|
inline |
Definition at line 80 of file object_selector_content.h.
References canvas_viewer_provider_.
|
inline |
Definition at line 83 of file object_selector_content.h.
References canvas_viewer_.
Referenced by yaze::editor::DungeonEditorV2::~DungeonEditorV2().
|
inline |
Definition at line 85 of file object_selector_content.h.
References object_selector_, yaze::editor::EditorContext::rom, rom_, and yaze::editor::DungeonObjectSelector::SetContext().

|
inline |
Definition at line 90 of file object_selector_content.h.
References object_selector_, and yaze::editor::DungeonObjectSelector::SetGameData().
Referenced by yaze::editor::DungeonEditorV2::Load(), and yaze::editor::DungeonEditorV2::SetGameData().

|
inline |
Definition at line 94 of file object_selector_content.h.
References object_selector_, and yaze::editor::DungeonObjectSelector::set_rooms().

|
inline |
Definition at line 96 of file object_selector_content.h.
References object_selector_, and yaze::editor::DungeonObjectSelector::SetCurrentPaletteGroup().
Referenced by yaze::editor::DungeonEditorV2::Load(), and yaze::editor::DungeonEditorV2::OnRoomSelected().

| 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().

| void yaze::editor::ObjectSelectorContent::SetAgentOptimizedLayout | ( | bool | enabled | ) |
Definition at line 209 of file object_selector_content.cc.
Referenced by yaze::editor::DungeonEditorV2::SetAgentMode().
| void yaze::editor::ObjectSelectorContent::CancelPlacement | ( | ) |
Definition at line 389 of file object_selector_content.cc.
References yaze::editor::DungeonObjectInteraction::CancelPlacement(), canvas_viewer_, yaze::editor::DungeonCanvasViewer::ClearPreviewObject(), has_preview_object_, and yaze::editor::DungeonCanvasViewer::object_interaction().
Referenced by DrawInteractionSummary().

|
inline |
Definition at line 110 of file object_selector_content.h.
References toast_manager_.
| void yaze::editor::ObjectSelectorContent::SetPlacementError | ( | const std::string & | message | ) |
Definition at line 214 of file object_selector_content.cc.
References yaze::editor::kError, kPlacementErrorDuration, last_placement_error_, placement_error_time_, yaze::editor::ToastManager::Show(), and toast_manager_.
Referenced by Draw(), and yaze::editor::DungeonEditorV2::HandleObjectPlaced().

|
inline |
Definition at line 118 of file object_selector_content.h.
References open_object_editor_callback_.
|
private |
Definition at line 112 of file object_selector_content.cc.
References canvas_viewer_, and canvas_viewer_provider_.
Referenced by Draw(), and DrawInteractionSummary().
|
private |
Definition at line 230 of file object_selector_content.cc.
References yaze::editor::DungeonObjectSelector::DrawObjectAssetBrowser(), and object_selector_.
Referenced by Draw().

|
private |
Definition at line 235 of file object_selector_content.cc.
References yaze::editor::BuildDungeonSelectionSnapshot(), CancelPlacement(), canvas_viewer_, current_room_id_, yaze::editor::Door, yaze::editor::EntityMulti, yaze::editor::DungeonObjectSelector::get_rooms(), yaze::editor::GetDungeonSelectionKindLabel(), yaze::editor::GetDungeonSelectionSummaryText(), yaze::zelda3::GetObjectName(), yaze::editor::GetPlacementSummaryColor(), yaze::editor::AgentUI::GetTheme(), has_preview_object_, ICON_MD_ADD_CIRCLE, ICON_MD_CANCEL, ICON_MD_CATEGORY, ICON_MD_CHECK_CIRCLE, ICON_MD_DOOR_FRONT, ICON_MD_ERROR, ICON_MD_INFO, ICON_MD_INVENTORY_2, ICON_MD_MANAGE_SEARCH, ICON_MD_MOUSE, ICON_MD_PEST_CONTROL, ICON_MD_SELECT_ALL, ICON_MD_WARNING, ICON_MD_WIDGETS, yaze::zelda3::RoomObject::id_, yaze::editor::DungeonObjectInteraction::IsObjectLoaded(), yaze::editor::Item, yaze::zelda3::kMaxChests, yaze::zelda3::kMaxDoors, yaze::zelda3::kMaxTileObjects, yaze::zelda3::kMaxTotalSprites, yaze::zelda3::kNumberOfRooms, kPlacementErrorDuration, last_placement_error_, yaze::editor::Mixed, yaze::editor::DungeonCanvasViewer::object_interaction(), object_selector_, yaze::editor::ObjectMulti, yaze::editor::ObjectSingle, open_object_editor_callback_, placement_error_time_, preview_object_, ResolveCanvasViewer(), yaze::editor::DungeonRoomStore::size(), yaze::editor::Sprite, toast_manager_, and yaze::zelda3::DungeonValidator::ValidateRoom().
Referenced by Draw().
|
private |
Definition at line 133 of file object_selector_content.h.
Referenced by SetContext().
|
private |
Definition at line 134 of file object_selector_content.h.
Referenced by CancelPlacement(), Draw(), DrawInteractionSummary(), ObjectSelectorContent(), ResolveCanvasViewer(), and SetCanvasViewer().
|
private |
Definition at line 135 of file object_selector_content.h.
Referenced by ResolveCanvasViewer(), and SetCanvasViewerProvider().
|
private |
Definition at line 136 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetCurrentRoom().
|
private |
Definition at line 139 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), DrawObjectSelector(), object_selector(), ObjectSelectorContent(), SelectObject(), SetContext(), SetCurrentPaletteGroup(), SetCurrentRoom(), SetGameData(), and SetRooms().
|
private |
Definition at line 143 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and ObjectSelectorContent().
|
private |
Definition at line 144 of file object_selector_content.h.
Referenced by CancelPlacement(), DrawInteractionSummary(), and ObjectSelectorContent().
|
private |
Definition at line 145 of file object_selector_content.h.
Referenced by ObjectSelectorContent().
|
private |
Definition at line 146 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), SetPlacementError(), and SetToastManager().
|
staticconstexprprivate |
Definition at line 149 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetPlacementError().
|
private |
Definition at line 150 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetPlacementError().
|
private |
Definition at line 151 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetPlacementError().
|
private |
Definition at line 153 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetOpenObjectEditorCallback().