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

Public Types | |
| using | TileEditorCallback = std::function<void(int16_t object_id)> |
Public Member Functions | |
| ObjectSelectorContent (gfx::IRenderer *renderer, Rom *rom, DungeonCanvasViewer *canvas_viewer, std::shared_ptr< zelda3::DungeonObjectEditor > object_editor=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 | SetPlacementError (const std::string &message) |
| void | SetOpenObjectEditorCallback (std::function< void()> callback) |
| void | OpenStaticObjectEditor (int object_id) |
| void | CloseStaticObjectEditor () |
| bool | IsStaticEditorOpen () const |
| int | GetStaticEditorObjectId () const |
| void | set_tile_editor_callback (TileEditorCallback 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 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 () |
| void | DrawStaticObjectEditor () |
| void | DrawRoomValidationBar () |
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 |
| gfx::IRenderer * | renderer_ |
| std::shared_ptr< zelda3::DungeonObjectEditor > | object_editor_ |
| bool | static_editor_open_ = false |
| int | static_editor_object_id_ = -1 |
| gfx::Bitmap | static_preview_bitmap_ |
| gui::Canvas | static_preview_canvas_ {"##StaticObjectPreview", ImVec2(128, 128)} |
| zelda3::ObjectDrawInfo | static_editor_draw_info_ |
| std::unique_ptr< zelda3::ObjectParser > | object_parser_ |
| gfx::BackgroundBuffer | static_preview_buffer_ {128, 128} |
| bool | static_preview_rendered_ = false |
| std::string | last_placement_error_ |
| double | placement_error_time_ = -1.0 |
| TileEditorCallback | tile_editor_callback_ |
| 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 45 of file object_selector_content.h.
| using yaze::editor::ObjectSelectorContent::TileEditorCallback = std::function<void(int16_t object_id)> |
Definition at line 132 of file object_selector_content.h.
| yaze::editor::ObjectSelectorContent::ObjectSelectorContent | ( | gfx::IRenderer * | renderer, |
| Rom * | rom, | ||
| DungeonCanvasViewer * | canvas_viewer, | ||
| std::shared_ptr< zelda3::DungeonObjectEditor > | object_editor = nullptr ) |
Definition at line 35 of file object_selector_content.cc.
References canvas_viewer_, has_preview_object_, yaze::zelda3::RoomObject::id_, yaze::zelda3::DungeonObjectEditor::kInsert, object_editor_, object_parser_, object_selector_, OpenStaticObjectEditor(), preview_object_, yaze::editor::DungeonObjectSelector::SetObjectDoubleClickCallback(), 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 55 of file object_selector_content.h.
|
inlineoverridevirtual |
Human-readable name shown in menus and title bars.
Implements yaze::editor::WindowContent.
Definition at line 56 of file object_selector_content.h.
|
inlineoverridevirtual |
Material Design icon for this panel.
Implements yaze::editor::WindowContent.
Definition at line 57 of file object_selector_content.h.
References ICON_MD_CONSTRUCTION.
|
inlineoverridevirtual |
Editor category this panel belongs to.
Implements yaze::editor::WindowContent.
Definition at line 58 of file object_selector_content.h.
|
inlineoverridevirtual |
Get display priority for menu ordering.
Reimplemented from yaze::editor::WindowContent.
Definition at line 59 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 60 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 77 of file object_selector_content.cc.
References canvas_viewer_, DrawInteractionSummary(), DrawObjectSelector(), DrawRoomValidationBar(), DrawStaticObjectEditor(), yaze::editor::DungeonObjectInteraction::entity_coordinator(), yaze::editor::AgentUI::GetTheme(), ICON_MD_CATEGORY, 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(), yaze::gui::SectionHeader(), SetPlacementError(), static_editor_open_, 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 67 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 68 of file object_selector_content.h.
|
inline |
Definition at line 74 of file object_selector_content.h.
References object_selector_.
Referenced by yaze::editor::DungeonEditorV2::Load().
|
inline |
Definition at line 79 of file object_selector_content.h.
References current_room_id_, object_selector_, and yaze::editor::DungeonObjectSelector::set_current_room_id().

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

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

|
inline |
Definition at line 100 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 176 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 180 of file object_selector_content.cc.
Referenced by yaze::editor::DungeonEditorV2::SetAgentMode().
| void yaze::editor::ObjectSelectorContent::CancelPlacement | ( | ) |
Definition at line 622 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().

| void yaze::editor::ObjectSelectorContent::SetPlacementError | ( | const std::string & | message | ) |
Definition at line 185 of file object_selector_content.cc.
References kPlacementErrorDuration, last_placement_error_, and placement_error_time_.
Referenced by Draw(), and yaze::editor::DungeonEditorV2::HandleObjectPlaced().
|
inline |
Definition at line 118 of file object_selector_content.h.
References open_object_editor_callback_.
| void yaze::editor::ObjectSelectorContent::OpenStaticObjectEditor | ( | int | object_id | ) |
Definition at line 267 of file object_selector_content.cc.
References yaze::gfx::BackgroundBuffer::bitmap(), yaze::gfx::BackgroundBuffer::ClearBuffer(), yaze::gfx::Arena::CREATE, current_room_id_, yaze::zelda3::ObjectDrawer::DrawObject(), yaze::gfx::PaletteGroupMap::dungeon_main, yaze::gfx::PaletteGroup::empty(), yaze::gfx::BackgroundBuffer::EnsureBitmapInitialized(), yaze::zelda3::RoomObject::EnsureTilesLoaded(), yaze::editor::DungeonObjectSelector::game_data(), yaze::gfx::Arena::Get(), yaze::editor::DungeonObjectSelector::get_rooms(), yaze::zelda3::ObjectDrawer::InitializeDrawRoutines(), yaze::Rom::is_loaded(), object_parser_, object_selector_, yaze::zelda3::GameData::palette_groups, yaze::gfx::Arena::ProcessTextureQueue(), yaze::gfx::Arena::QueueTextureCommand(), renderer_, rom_, yaze::zelda3::RoomObject::SetRom(), yaze::editor::DungeonObjectSelector::SetStaticEditorObjectId(), yaze::gfx::PaletteGroup::size(), static_editor_draw_info_, static_editor_object_id_, static_editor_open_, static_preview_buffer_, static_preview_rendered_, and yaze::zelda3::RoomObject::tiles().
Referenced by ObjectSelectorContent().
| void yaze::editor::ObjectSelectorContent::CloseStaticObjectEditor | ( | ) |
Definition at line 366 of file object_selector_content.cc.
References object_selector_, yaze::editor::DungeonObjectSelector::SetStaticEditorObjectId(), static_editor_object_id_, and static_editor_open_.
Referenced by DrawStaticObjectEditor().

|
inline |
Definition at line 128 of file object_selector_content.h.
References static_editor_open_.
|
inline |
Definition at line 129 of file object_selector_content.h.
References static_editor_object_id_.
|
inline |
Definition at line 133 of file object_selector_content.h.
References tile_editor_callback_.
|
private |
Definition at line 70 of file object_selector_content.cc.
References canvas_viewer_, and canvas_viewer_provider_.
Referenced by Draw(), and DrawInteractionSummary().
|
private |
Definition at line 198 of file object_selector_content.cc.
References yaze::editor::DungeonObjectSelector::DrawObjectAssetBrowser(), and object_selector_.
Referenced by Draw().

|
private |
Definition at line 203 of file object_selector_content.cc.
References CancelPlacement(), canvas_viewer_, yaze::zelda3::GetObjectName(), yaze::editor::AgentUI::GetTheme(), has_preview_object_, ICON_MD_ADD_CIRCLE, ICON_MD_CANCEL, ICON_MD_CHECK_CIRCLE, ICON_MD_ERROR, ICON_MD_MOUSE, ICON_MD_OPEN_IN_NEW, ICON_MD_SELECT_ALL, ICON_MD_TOUCH_APP, yaze::zelda3::RoomObject::id_, yaze::editor::DungeonObjectInteraction::IsObjectLoaded(), kPlacementErrorDuration, last_placement_error_, yaze::editor::DungeonCanvasViewer::object_interaction(), open_object_editor_callback_, placement_error_time_, preview_object_, ResolveCanvasViewer(), and yaze::gui::SectionHeader().
Referenced by Draw().
|
private |
Definition at line 374 of file object_selector_content.cc.
References yaze::gui::Canvas::AddTextAt(), yaze::gui::BeginCanvas(), yaze::gfx::BackgroundBuffer::bitmap(), yaze::zelda3::ObjectDrawInfo::both_layers, yaze::gui::CanvasFrameOptions::canvas_size, yaze::gui::PreviewPanelOpts::canvas_size, CloseStaticObjectEditor(), yaze::gui::DangerButton(), yaze::gui::CanvasFrameOptions::draw_context_menu, yaze::gui::CanvasFrameOptions::draw_grid, yaze::gui::CanvasFrameOptions::draw_overlay, yaze::zelda3::ObjectDrawInfo::draw_routine_id, yaze::gui::EndCanvas(), yaze::gui::PreviewPanelOpts::ensure_texture, yaze::editor::AgentUI::GetTheme(), yaze::gui::CanvasFrameOptions::grid_step, yaze::gui::PreviewPanelOpts::grid_step, ICON_MD_BRUSH, ICON_MD_CLOSE, ICON_MD_CODE, ICON_MD_CONSTRUCTION, ICON_MD_CONTENT_COPY, ICON_MD_GRID_ON, ICON_MD_GRID_VIEW, ICON_MD_INFO, ICON_MD_LAYERS, ICON_MD_TAG, yaze::zelda3::ObjectDrawInfo::is_horizontal, yaze::zelda3::ObjectDrawInfo::is_vertical, yaze::gui::CanvasFrameOptions::render_popups, yaze::gui::PreviewPanelOpts::render_popups, yaze::gui::RenderPreviewPanel(), yaze::zelda3::ObjectDrawInfo::routine_name, static_editor_draw_info_, static_editor_object_id_, static_preview_buffer_, static_preview_canvas_, static_preview_rendered_, yaze::zelda3::ObjectDrawInfo::tile_count, and tile_editor_callback_.
Referenced by Draw().
|
private |
Definition at line 533 of file object_selector_content.cc.
References current_room_id_, yaze::editor::DungeonObjectSelector::get_rooms(), yaze::editor::AgentUI::GetTheme(), ICON_MD_DOOR_FRONT, ICON_MD_ERROR, ICON_MD_INVENTORY_2, ICON_MD_PEST_CONTROL, ICON_MD_WARNING, ICON_MD_WIDGETS, yaze::zelda3::kMaxChests, yaze::zelda3::kMaxDoors, yaze::zelda3::kMaxTileObjects, yaze::zelda3::kMaxTotalSprites, yaze::zelda3::kNumberOfRooms, object_selector_, and yaze::zelda3::DungeonValidator::ValidateRoom().
Referenced by Draw().

|
private |
Definition at line 150 of file object_selector_content.h.
Referenced by OpenStaticObjectEditor(), and SetContext().
|
private |
Definition at line 151 of file object_selector_content.h.
Referenced by CancelPlacement(), Draw(), DrawInteractionSummary(), ObjectSelectorContent(), ResolveCanvasViewer(), and SetCanvasViewer().
|
private |
Definition at line 152 of file object_selector_content.h.
Referenced by ResolveCanvasViewer(), and SetCanvasViewerProvider().
|
private |
Definition at line 153 of file object_selector_content.h.
Referenced by DrawRoomValidationBar(), OpenStaticObjectEditor(), and SetCurrentRoom().
|
private |
Definition at line 156 of file object_selector_content.h.
Referenced by CloseStaticObjectEditor(), DrawObjectSelector(), DrawRoomValidationBar(), object_selector(), ObjectSelectorContent(), OpenStaticObjectEditor(), SelectObject(), SetContext(), SetCurrentPaletteGroup(), SetCurrentRoom(), SetGameData(), and SetRooms().
|
private |
Definition at line 160 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and ObjectSelectorContent().
|
private |
Definition at line 161 of file object_selector_content.h.
Referenced by CancelPlacement(), DrawInteractionSummary(), and ObjectSelectorContent().
|
private |
Definition at line 162 of file object_selector_content.h.
Referenced by OpenStaticObjectEditor().
|
private |
Definition at line 163 of file object_selector_content.h.
Referenced by ObjectSelectorContent().
|
private |
Definition at line 166 of file object_selector_content.h.
Referenced by CloseStaticObjectEditor(), Draw(), IsStaticEditorOpen(), and OpenStaticObjectEditor().
|
private |
Definition at line 167 of file object_selector_content.h.
Referenced by CloseStaticObjectEditor(), DrawStaticObjectEditor(), GetStaticEditorObjectId(), and OpenStaticObjectEditor().
|
private |
Definition at line 168 of file object_selector_content.h.
|
private |
Definition at line 169 of file object_selector_content.h.
Referenced by DrawStaticObjectEditor().
|
private |
Definition at line 170 of file object_selector_content.h.
Referenced by DrawStaticObjectEditor(), and OpenStaticObjectEditor().
|
private |
Definition at line 171 of file object_selector_content.h.
Referenced by ObjectSelectorContent(), and OpenStaticObjectEditor().
|
private |
Definition at line 172 of file object_selector_content.h.
Referenced by DrawStaticObjectEditor(), and OpenStaticObjectEditor().
|
private |
Definition at line 173 of file object_selector_content.h.
Referenced by DrawStaticObjectEditor(), and OpenStaticObjectEditor().
|
staticconstexprprivate |
Definition at line 176 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetPlacementError().
|
private |
Definition at line 177 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetPlacementError().
|
private |
Definition at line 178 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetPlacementError().
|
private |
Definition at line 181 of file object_selector_content.h.
Referenced by DrawStaticObjectEditor(), and set_tile_editor_callback().
|
private |
Definition at line 182 of file object_selector_content.h.
Referenced by DrawInteractionSummary(), and SetOpenObjectEditorCallback().