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. | |
| 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. | |
| void | DrawInWorkbench () |
| bool | DrawMinecartPalette () |
| 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) |
| void | DetachRuntimeContext () |
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 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 | |
| DungeonCanvasViewer * | ResolveCanvasViewer () |
| void | DrawObjectSelector (float minimum_grid_height=1.0f) |
| void | DrawContent (bool show_placement_summary) |
| void | DrawInteractionSummary (bool show_placement_summary) |
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 the active DungeonCanvasViewer 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 86 of file object_selector_content.cc.
References CancelPlacement(), 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(), yaze::editor::DungeonObjectSelector::SetPlacementInvalidatedCallback(), 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 |
Optional workflow group for hack-centric actions.
Reimplemented from yaze::editor::WindowContent.
Definition at line 57 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 58 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 122 of file object_selector_content.cc.
References DrawContent().

| void yaze::editor::ObjectSelectorContent::DrawInWorkbench | ( | ) |
Definition at line 132 of file object_selector_content.cc.
References DrawContent().

| bool yaze::editor::ObjectSelectorContent::DrawMinecartPalette | ( | ) |
Definition at line 127 of file object_selector_content.cc.
References yaze::editor::DungeonObjectSelector::DrawMinecartPalette(), object_selector_, and ResolveCanvasViewer().
Referenced by yaze::editor::DungeonEditorV2::ConfigureMinecartProjectCallbacks().

|
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 68 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 69 of file object_selector_content.h.
|
inline |
Definition at line 75 of file object_selector_content.h.
References object_selector_.
Referenced by yaze::editor::DungeonEditorV2::Load(), yaze::editor::DungeonEditorV2::RefreshRomBackedState(), and yaze::editor::DungeonEditorV2::SynchronizeCustomObjectAssets().
|
inline |
Definition at line 80 of file object_selector_content.h.
References current_room_id_, object_selector_, and yaze::editor::DungeonObjectSelector::set_current_room_id().
Referenced by yaze::editor::DungeonEditorV2::RefreshRomBackedState().

|
inline |
Definition at line 84 of file object_selector_content.h.
References canvas_viewer_provider_.
|
inline |
Definition at line 87 of file object_selector_content.h.
References canvas_viewer_.
|
inline |
Definition at line 89 of file object_selector_content.h.
References object_selector_, yaze::editor::EditorContext::rom, rom_, and yaze::editor::DungeonObjectSelector::SetContext().
Referenced by yaze::editor::DungeonEditorV2::RefreshRomBackedState().

|
inline |
Definition at line 94 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 98 of file object_selector_content.h.
References object_selector_, and yaze::editor::DungeonObjectSelector::set_rooms().
Referenced by yaze::editor::DungeonEditorV2::RefreshRomBackedState().

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

| void yaze::editor::ObjectSelectorContent::SelectObject | ( | int | obj_id | ) |
Definition at line 231 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 235 of file object_selector_content.cc.
Referenced by yaze::editor::DungeonEditorV2::SetAgentMode().
| void yaze::editor::ObjectSelectorContent::CancelPlacement | ( | ) |
Definition at line 425 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 DetachRuntimeContext(), DrawInteractionSummary(), ObjectSelectorContent(), and yaze::editor::DungeonEditorV2::RefreshRomBackedState().

|
inline |
Definition at line 114 of file object_selector_content.h.
References toast_manager_.
| void yaze::editor::ObjectSelectorContent::SetPlacementError | ( | const std::string & | message | ) |
Definition at line 240 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 DrawContent(), and yaze::editor::DungeonEditorV2::HandleObjectPlaced().

|
inline |
Definition at line 122 of file object_selector_content.h.
References open_object_editor_callback_.
| void yaze::editor::ObjectSelectorContent::DetachRuntimeContext | ( | ) |
Definition at line 433 of file object_selector_content.cc.
References CancelPlacement(), canvas_viewer_, canvas_viewer_provider_, yaze::editor::DungeonObjectSelector::DetachRuntimeContext(), object_editor_, object_selector_, open_object_editor_callback_, and rom_.
Referenced by yaze::editor::DungeonEditorV2::PrepareForSessionTeardown().

|
private |
Definition at line 115 of file object_selector_content.cc.
References canvas_viewer_, and canvas_viewer_provider_.
Referenced by DrawContent(), DrawInteractionSummary(), and DrawMinecartPalette().
|
private |
Definition at line 256 of file object_selector_content.cc.
References yaze::editor::DungeonObjectSelector::DrawObjectAssetBrowser(), and object_selector_.
Referenced by DrawContent().

|
private |
Definition at line 136 of file object_selector_content.cc.
References canvas_viewer_, DrawInteractionSummary(), DrawObjectSelector(), yaze::editor::DungeonObjectInteraction::entity_coordinator(), yaze::editor::TileObjectHandler::kChestValidation, 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::DoorInteractionHandler::kStorageValidation, yaze::editor::SpriteInteractionHandler::kStorageValidation, yaze::editor::DungeonCanvasViewer::object_interaction(), yaze::editor::TileObjectHandler::placement_block_reason(), ResolveCanvasViewer(), SetPlacementError(), and yaze::editor::InteractionCoordinator::tile_handler().
Referenced by Draw(), and DrawInWorkbench().
|
private |
Definition at line 261 of file object_selector_content.cc.
References yaze::editor::BuildDungeonSelectionSnapshot(), CancelPlacement(), 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_CHECK_CIRCLE, ICON_MD_DOOR_FRONT, ICON_MD_ERROR, ICON_MD_INVENTORY_2, ICON_MD_MANAGE_SEARCH, ICON_MD_PEST_CONTROL, ICON_MD_SELECT_ALL, ICON_MD_WARNING, ICON_MD_WIDGETS, yaze::zelda3::IsStatefulChestObjectId(), 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, object_selector_, yaze::editor::ObjectMulti, yaze::editor::ObjectSingle, open_object_editor_callback_, placement_error_time_, ResolveCanvasViewer(), yaze::editor::DungeonRoomStore::size(), yaze::editor::Sprite, toast_manager_, yaze::zelda3::UsesRoomObjectStream(), and yaze::zelda3::DungeonValidator::ValidateRoom().
Referenced by DrawContent().
|
private |
Definition at line 139 of file object_selector_content.h.
Referenced by DetachRuntimeContext(), and SetContext().
|
private |
Definition at line 140 of file object_selector_content.h.
Referenced by CancelPlacement(), DetachRuntimeContext(), DrawContent(), ObjectSelectorContent(), ResolveCanvasViewer(), and SetCanvasViewer().
|
private |
Definition at line 141 of file object_selector_content.h.
Referenced by DetachRuntimeContext(), ResolveCanvasViewer(), and SetCanvasViewerProvider().
|
private |
Definition at line 142 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetCurrentRoom().
|
private |
Definition at line 145 of file object_selector_content.h.
Referenced by DetachRuntimeContext(), DrawInteractionSummary(), DrawMinecartPalette(), DrawObjectSelector(), object_selector(), ObjectSelectorContent(), SelectObject(), SetContext(), SetCurrentPaletteGroup(), SetCurrentRoom(), SetGameData(), and SetRooms().
|
private |
Definition at line 149 of file object_selector_content.h.
Referenced by ObjectSelectorContent().
|
private |
Definition at line 150 of file object_selector_content.h.
Referenced by CancelPlacement(), DrawInteractionSummary(), and ObjectSelectorContent().
|
private |
Definition at line 151 of file object_selector_content.h.
Referenced by DetachRuntimeContext(), and ObjectSelectorContent().
|
private |
Definition at line 152 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), SetPlacementError(), and SetToastManager().
|
staticconstexprprivate |
Definition at line 155 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetPlacementError().
|
private |
Definition at line 156 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetPlacementError().
|
private |
Definition at line 157 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetPlacementError().
|
private |
Definition at line 159 of file object_selector_content.h.
Referenced by DetachRuntimeContext(), DrawInteractionSummary(), and SetOpenObjectEditorCallback().