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

#include <custom_collision_panel.h>

Inheritance diagram for yaze::editor::CustomCollisionPanel:
Collaboration diagram for yaze::editor::CustomCollisionPanel:

Public Member Functions

 CustomCollisionPanel (DungeonCanvasViewer *viewer, DungeonObjectInteraction *interaction)
 
std::string GetId () const override
 Unique identifier for this panel.
 
std::string GetWorkflowGroup () const override
 Optional workflow group for hack-centric actions.
 
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.
 
void SetCanvasViewer (DungeonCanvasViewer *viewer)
 
void SetInteraction (DungeonObjectInteraction *interaction)
 
void Draw (bool *p_open) override
 Draw the panel content.
 
absl::Status ImportCollisionRooms (const std::vector< zelda3::CustomCollisionRoomEntry > &entries, std::string_view source_label="import")
 
absl::Status ImportCollisionJson (std::string_view json_content, std::string_view source_label="import")
 
absl::Status ExportCollisionToFile (const DungeonRoomStore &rooms, const std::string &path)
 
const std::string & last_io_status () const
 
const std::string & last_io_error () const
 
- 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 int GetPriority () const
 Get display priority for menu ordering.
 
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()
 

Static Public Member Functions

static absl::StatusOr< std::vector< zelda3::CustomCollisionRoomEntry > > CollectRoomEntries (const DungeonRoomStore &rooms)
 
static void ApplyRoomEntry (const zelda3::CustomCollisionRoomEntry &entry, zelda3::Room *room)
 

Private Attributes

DungeonCanvasViewer * viewer_ = nullptr
 
DungeonObjectInteraction * interaction_ = nullptr
 
std::string last_io_status_
 
std::string last_io_error_
 

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

Definition at line 19 of file custom_collision_panel.h.

Constructor & Destructor Documentation

◆ CustomCollisionPanel()

yaze::editor::CustomCollisionPanel::CustomCollisionPanel ( DungeonCanvasViewer * viewer,
DungeonObjectInteraction * interaction )
inline

Definition at line 21 of file custom_collision_panel.h.

Member Function Documentation

◆ GetId()

std::string yaze::editor::CustomCollisionPanel::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 25 of file custom_collision_panel.h.

◆ GetWorkflowGroup()

std::string yaze::editor::CustomCollisionPanel::GetWorkflowGroup ( ) const
inlineoverridevirtual

Optional workflow group for hack-centric actions.

Returns
Non-empty group name to surface this panel in hack workflows.

Reimplemented from yaze::editor::WindowContent.

Definition at line 26 of file custom_collision_panel.h.

◆ GetDisplayName()

std::string yaze::editor::CustomCollisionPanel::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 27 of file custom_collision_panel.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::WindowContent.

Definition at line 28 of file custom_collision_panel.h.

References ICON_MD_GRID_ON.

◆ GetEditorCategory()

std::string yaze::editor::CustomCollisionPanel::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 29 of file custom_collision_panel.h.

◆ SetCanvasViewer()

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

◆ SetInteraction()

void yaze::editor::CustomCollisionPanel::SetInteraction ( DungeonObjectInteraction * interaction)
inline

◆ Draw()

void yaze::editor::CustomCollisionPanel::Draw ( bool * p_open)
overridevirtual

Draw the panel content.

Parameters
p_openPointer 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 23 of file custom_collision_panel.cc.

References yaze::gui::AutoRegisterLastItem(), yaze::editor::DungeonObjectInteraction::BeginCustomCollisionMutation(), CollectRoomEntries(), yaze::editor::DungeonCanvasViewer::current_room_id(), yaze::editor::DungeonObjectInteraction::EndCustomCollisionMutation(), ExportCollisionToFile(), yaze::util::FileDialogOptions::filters, yaze::editor::InteractionModeManager::GetMode(), yaze::editor::InteractionModeManager::GetModeState(), yaze::editor::AgentUI::GetTheme(), yaze::zelda3::Zelda3Labels::GetTileTypeNames(), yaze::zelda3::HasCustomCollisionDataRegion(), yaze::zelda3::HasCustomCollisionPointerTable(), yaze::zelda3::HasCustomCollisionWriteSupport(), yaze::editor::DungeonCanvasViewer::HasRooms(), ICON_MD_CHECK_CIRCLE, ICON_MD_DOWNLOAD, ICON_MD_ERROR, ICON_MD_INFO, ICON_MD_UPLOAD, ICON_MD_WARNING, ImportCollisionJson(), interaction_, yaze::Rom::is_loaded(), yaze::zelda3::kCustomCollisionDataSoftEnd, yaze::zelda3::kCustomCollisionRoomPointers, yaze::zelda3::kNumberOfRooms, last_io_error_, last_io_status_, yaze::util::LoadFile(), yaze::editor::DungeonObjectInteraction::mode_manager(), yaze::editor::ModeState::paint_collision_value, yaze::editor::PaintCollision, yaze::editor::DungeonCanvasViewer::rom(), yaze::editor::DungeonCanvasViewer::rooms(), yaze::editor::Select, yaze::editor::DungeonCanvasViewer::set_show_custom_collision_overlay(), yaze::editor::InteractionModeManager::SetMode(), yaze::editor::DungeonCanvasViewer::show_custom_collision_overlay(), yaze::util::FileDialogWrapper::ShowOpenFileDialog(), yaze::util::FileDialogWrapper::ShowSaveFileDialog(), yaze::Rom::vector(), and viewer_.

Referenced by yaze::editor::DungeonWorkbenchContent::DrawWorkbenchTool().

◆ CollectRoomEntries()

◆ ApplyRoomEntry()

void yaze::editor::CustomCollisionPanel::ApplyRoomEntry ( const zelda3::CustomCollisionRoomEntry & entry,
zelda3::Room * room )
static

◆ ImportCollisionRooms()

◆ ImportCollisionJson()

absl::Status yaze::editor::CustomCollisionPanel::ImportCollisionJson ( std::string_view json_content,
std::string_view source_label = "import" )

Definition at line 344 of file custom_collision_panel.cc.

References ImportCollisionRooms(), last_io_error_, last_io_status_, and yaze::zelda3::LoadCustomCollisionRoomsFromJsonString().

Referenced by Draw().

Here is the call graph for this function:

◆ ExportCollisionToFile()

absl::Status yaze::editor::CustomCollisionPanel::ExportCollisionToFile ( const DungeonRoomStore & rooms,
const std::string & path )

Definition at line 356 of file custom_collision_panel.cc.

References CollectRoomEntries(), yaze::zelda3::DumpCustomCollisionRoomsToJsonString(), last_io_error_, and last_io_status_.

Referenced by Draw().

Here is the call graph for this function:

◆ last_io_status()

const std::string & yaze::editor::CustomCollisionPanel::last_io_status ( ) const
inline

Definition at line 51 of file custom_collision_panel.h.

References last_io_status_.

◆ last_io_error()

const std::string & yaze::editor::CustomCollisionPanel::last_io_error ( ) const
inline

Definition at line 52 of file custom_collision_panel.h.

References last_io_error_.

Member Data Documentation

◆ viewer_

DungeonCanvasViewer* yaze::editor::CustomCollisionPanel::viewer_ = nullptr
private

Definition at line 55 of file custom_collision_panel.h.

Referenced by Draw(), ImportCollisionRooms(), and SetCanvasViewer().

◆ interaction_

DungeonObjectInteraction* yaze::editor::CustomCollisionPanel::interaction_ = nullptr
private

Definition at line 56 of file custom_collision_panel.h.

Referenced by Draw(), ImportCollisionRooms(), and SetInteraction().

◆ last_io_status_

std::string yaze::editor::CustomCollisionPanel::last_io_status_
private

◆ last_io_error_

std::string yaze::editor::CustomCollisionPanel::last_io_error_
private

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