WindowContent for placing and managing dungeon sprites. More...
#include <sprite_editor_panel.h>
Classes | |
| struct | CachedSpritePreview |
Public Member Functions | |
| SpriteEditorPanel (int *current_room_id, DungeonRoomStore *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. | |
| std::string | GetWorkflowGroup () const override |
| Optional workflow group for hack-centric actions. | |
| void | Draw (bool *p_open) override |
| Draw the panel content. | |
| void | DrawInWorkbench () |
| void | SetCanvasViewer (DungeonCanvasViewer *viewer) |
| void | SetSpritePlacedCallback (std::function< void(const zelda3::Sprite &)> callback) |
| void | SetOpenSelectionInspectorCallback (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 | OnOpen () |
| Called when panel becomes visible. | |
| virtual void | OnClose () |
| Called when panel is hidden. | |
| 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 float | GetPreferredWidth () const |
| Get preferred width for this panel (optional) | |
| 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 | |
| void | DrawContent (bool show_room_sprites) |
| void | DrawPlacementControls () |
| void | DrawSpriteSelector (bool show_room_sprites) |
| void | DrawRoomSprites () |
| std::string | SpriteName (int sprite_id) const |
| bool | MatchesFilter (int sprite_id) const |
| const CachedSpritePreview & | GetOrCreateSpritePreview (int sprite_id, const zelda3::Room &room) |
Private Attributes | |
| int * | current_room_id_ = nullptr |
| DungeonRoomStore * | rooms_ = nullptr |
| DungeonCanvasViewer * | canvas_viewer_ = nullptr |
| std::unordered_map< int, CachedSpritePreview > | sprite_preview_cache_ |
| uint64_t | cached_graphics_revision_ = 0 |
| zelda3::SpritePreviewResourceCache | sprite_preview_resources_ |
| workbench::DungeonBrowserState | browser_state_ |
| int | selected_sprite_id_ = 0 |
| char | search_filter_ [64] = {0} |
| std::function< void(const zelda3::Sprite &) | sprite_placed_callback_ ) |
| std::function< void()> | open_selection_inspector_callback_ |
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) | |
WindowContent for placing and managing dungeon sprites.
Panel layout, filtering, and placement behavior live in the matching .cc file. Room edits continue through DungeonCanvasViewer's interaction handlers.
Definition at line 32 of file sprite_editor_panel.h.
| yaze::editor::SpriteEditorPanel::SpriteEditorPanel | ( | int * | current_room_id, |
| DungeonRoomStore * | rooms, | ||
| DungeonCanvasViewer * | canvas_viewer = nullptr ) |
Definition at line 26 of file sprite_editor_panel.cc.
|
overridevirtual |
Unique identifier for this panel.
IDs should be:
Implements yaze::editor::WindowContent.
Definition at line 33 of file sprite_editor_panel.cc.
|
overridevirtual |
Human-readable name shown in menus and title bars.
Implements yaze::editor::WindowContent.
Definition at line 37 of file sprite_editor_panel.cc.
|
overridevirtual |
Material Design icon for this panel.
Implements yaze::editor::WindowContent.
Definition at line 41 of file sprite_editor_panel.cc.
References ICON_MD_PERSON.
|
overridevirtual |
Editor category this panel belongs to.
Implements yaze::editor::WindowContent.
Definition at line 45 of file sprite_editor_panel.cc.
|
overridevirtual |
Get display priority for menu ordering.
Reimplemented from yaze::editor::WindowContent.
Definition at line 49 of file sprite_editor_panel.cc.
|
overridevirtual |
Optional workflow group for hack-centric actions.
Reimplemented from yaze::editor::WindowContent.
Definition at line 53 of file sprite_editor_panel.cc.
|
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 57 of file sprite_editor_panel.cc.
References DrawContent().
| void yaze::editor::SpriteEditorPanel::DrawInWorkbench | ( | ) |
Definition at line 61 of file sprite_editor_panel.cc.
References yaze::gui::AutoRegisterLastItem(), browser_state_, yaze::zelda3::BuildDungeonSpriteRenderPalette(), canvas_viewer_, yaze::editor::workbench::DungeonBrowserState::category, yaze::editor::DungeonCanvasViewer::current_room_id(), current_room_id_, yaze::editor::workbench::DrawDungeonBrowserControls(), yaze::editor::workbench::DrawDungeonBrowserRow(), DrawPlacementControls(), yaze::editor::DungeonRenderingHelpers::DrawSpritePreview(), yaze::editor::workbench::DungeonBrowserMatches(), yaze::editor::DungeonCanvasViewer::game_data(), GetOrCreateSpritePreview(), yaze::editor::DungeonCanvasViewer::header_read_only(), yaze::editor::DungeonCanvasViewer::IsObjectInteractionEnabled(), yaze::editor::DungeonObjectInteraction::IsSpritePlacementActive(), yaze::editor::DungeonCanvasViewer::object_interaction(), rooms_, yaze::editor::workbench::DungeonBrowserState::search, selected_sprite_id_, yaze::editor::DungeonObjectInteraction::SetSpritePlacementMode(), yaze::editor::DungeonRoomStore::size(), yaze::editor::workbench::DungeonBrowserState::sort, and SpriteName().
| void yaze::editor::SpriteEditorPanel::SetCanvasViewer | ( | DungeonCanvasViewer * | viewer | ) |
Definition at line 148 of file sprite_editor_panel.cc.
References canvas_viewer_.
Referenced by yaze::editor::DungeonEditorV2::PrepareForSessionTeardown().
| void yaze::editor::SpriteEditorPanel::SetSpritePlacedCallback | ( | std::function< void(const zelda3::Sprite &)> | callback | ) |
Definition at line 152 of file sprite_editor_panel.cc.
References sprite_placed_callback_.
| void yaze::editor::SpriteEditorPanel::SetOpenSelectionInspectorCallback | ( | std::function< void()> | callback | ) |
Definition at line 157 of file sprite_editor_panel.cc.
References open_selection_inspector_callback_.
|
private |
Definition at line 122 of file sprite_editor_panel.cc.
References canvas_viewer_, yaze::editor::DungeonCanvasViewer::current_room_id(), current_room_id_, yaze::editor::DrawDungeonEntityInspector(), DrawPlacementControls(), DrawRoomSprites(), DrawSpriteSelector(), yaze::editor::DungeonObjectInteraction::entity_coordinator(), yaze::editor::InteractionCoordinator::GetSelectedEntities(), yaze::editor::DungeonCanvasViewer::object_interaction(), rooms_, and yaze::editor::DungeonRoomStore::size().
Referenced by Draw().
|
private |
Definition at line 162 of file sprite_editor_panel.cc.
References yaze::gui::AutoRegisterLastItem(), yaze::editor::DungeonObjectInteraction::CancelPlacement(), canvas_viewer_, yaze::editor::DungeonCanvasViewer::current_room_id(), current_room_id_, yaze::editor::DungeonObjectInteraction::entity_coordinator(), yaze::editor::SpriteInteractionHandler::GetSpriteId(), yaze::editor::DungeonObjectInteraction::IsSpritePlacementActive(), yaze::editor::DungeonCanvasViewer::object_interaction(), selected_sprite_id_, yaze::editor::InteractionCoordinator::sprite_handler(), and SpriteName().
Referenced by DrawContent(), and DrawInWorkbench().
|
private |
Definition at line 235 of file sprite_editor_panel.cc.
References yaze::gui::AutoRegisterLastItem(), yaze::zelda3::BuildDungeonSpriteRenderPalette(), canvas_viewer_, yaze::editor::DungeonCanvasViewer::current_room_id(), current_room_id_, yaze::editor::DungeonRenderingHelpers::DrawSpritePreview(), yaze::editor::DungeonCanvasViewer::game_data(), GetOrCreateSpritePreview(), yaze::editor::AgentUI::GetTheme(), yaze::editor::DungeonCanvasViewer::header_read_only(), ICON_MD_CATEGORY, yaze::editor::DungeonCanvasViewer::IsObjectInteractionEnabled(), MatchesFilter(), yaze::editor::DungeonCanvasViewer::object_interaction(), search_filter_, selected_sprite_id_, yaze::editor::DungeonObjectInteraction::SetSpritePlacementMode(), and SpriteName().
Referenced by DrawContent().
|
private |
Definition at line 313 of file sprite_editor_panel.cc.
References yaze::gui::AutoRegisterLastItem(), yaze::zelda3::BuildDungeonSpriteRenderPalette(), canvas_viewer_, current_room_id_, yaze::editor::DungeonRenderingHelpers::DrawSpritePreview(), yaze::editor::DungeonObjectInteraction::entity_coordinator(), yaze::editor::DungeonCanvasViewer::game_data(), GetOrCreateSpritePreview(), yaze::editor::InteractionCoordinator::GetSelectedEntities(), yaze::editor::AgentUI::GetTheme(), ICON_MD_INFO, ICON_MD_KEY, ICON_MD_LIST, ICON_MD_OPEN_IN_NEW, ICON_MD_STAR, ICON_MD_VPN_KEY, ICON_MD_WARNING, yaze::editor::DungeonCanvasViewer::object_interaction(), open_selection_inspector_callback_, yaze::editor::DungeonObjectInteraction::SelectEntity(), and SpriteName().
Referenced by DrawContent().
|
private |
Definition at line 429 of file sprite_editor_panel.cc.
References canvas_viewer_, yaze::zelda3::ResourceLabelProvider::GetLabel(), yaze::zelda3::kSprite, yaze::editor::dungeon_project_labels::LabelsForProject(), and yaze::editor::DungeonCanvasViewer::project().
Referenced by DrawInWorkbench(), DrawPlacementControls(), DrawRoomSprites(), DrawSpriteSelector(), and MatchesFilter().
|
private |
Definition at line 435 of file sprite_editor_panel.cc.
References search_filter_, and SpriteName().
Referenced by DrawSpriteSelector().
|
private |
Definition at line 186 of file sprite_editor_panel.cc.
References yaze::project::YazeProject::assets_folder, yaze::editor::SpriteEditorPanel::CachedSpritePreview::bounds, cached_graphics_revision_, canvas_viewer_, yaze::project::YazeProject::filepath, yaze::zelda3::Room::get_gfx_buffer(), yaze::project::YazeProject::GetAbsolutePath(), yaze::zelda3::SpritePreviewResourceCache::GetGraphics(), yaze::zelda3::SpriteOamRegistry::GetLayout(), yaze::zelda3::SpriteOamRegistry::GetPreviewOverride(), yaze::zelda3::Room::graphics_revision(), yaze::project::YazeProject::hack_manifest, yaze::core::HackManifest::hack_name(), yaze::core::HackManifest::loaded(), yaze::editor::SpriteEditorPanel::CachedSpritePreview::pixels, yaze::zelda3::Sprite::preview_bounds(), yaze::zelda3::Sprite::preview_graphics(), yaze::editor::DungeonCanvasViewer::project(), yaze::zelda3::Sprite::RenderPreviewGraphics(), yaze::zelda3::Sprite::set_id(), yaze::zelda3::SpritePreviewResourceCache::SetContext(), sprite_preview_cache_, and sprite_preview_resources_.
Referenced by DrawInWorkbench(), DrawRoomSprites(), and DrawSpriteSelector().
|
private |
Definition at line 69 of file sprite_editor_panel.h.
Referenced by DrawContent(), DrawInWorkbench(), DrawPlacementControls(), DrawRoomSprites(), and DrawSpriteSelector().
|
private |
Definition at line 70 of file sprite_editor_panel.h.
Referenced by DrawContent(), and DrawInWorkbench().
|
private |
Definition at line 71 of file sprite_editor_panel.h.
Referenced by DrawContent(), DrawInWorkbench(), DrawPlacementControls(), DrawRoomSprites(), DrawSpriteSelector(), GetOrCreateSpritePreview(), SetCanvasViewer(), and SpriteName().
|
mutableprivate |
Definition at line 73 of file sprite_editor_panel.h.
Referenced by GetOrCreateSpritePreview().
|
mutableprivate |
Definition at line 74 of file sprite_editor_panel.h.
Referenced by GetOrCreateSpritePreview().
|
private |
Definition at line 75 of file sprite_editor_panel.h.
Referenced by GetOrCreateSpritePreview().
|
private |
Definition at line 78 of file sprite_editor_panel.h.
Referenced by DrawInWorkbench().
|
private |
Definition at line 79 of file sprite_editor_panel.h.
Referenced by DrawInWorkbench(), DrawPlacementControls(), and DrawSpriteSelector().
|
private |
Definition at line 80 of file sprite_editor_panel.h.
Referenced by DrawSpriteSelector(), and MatchesFilter().
|
private |
Definition at line 82 of file sprite_editor_panel.h.
Referenced by SetSpritePlacedCallback().
|
private |
Definition at line 83 of file sprite_editor_panel.h.
Referenced by DrawRoomSprites(), and SetOpenSelectionInspectorCallback().