8#include "absl/strings/str_format.h"
22#include "imgui/imgui.h"
39 const std::string room_label =
42 : std::string(
"None");
44 bool room_dirty =
false;
45 if (
auto* rooms = viewer.
rooms(); rooms && room_id >= 0) {
46 if (
const auto* room = rooms->GetIfMaterialized(room_id)) {
47 room_dirty = room->HasUnsavedChanges();
53 ImGui::AlignTextToFramePadding();
54 ImGui::Text(tr(
"Room 0x%03X"), room_id);
58 snprintf(buf,
sizeof(buf),
"0x%03X", room_id);
59 ImGui::SetClipboardText(buf);
61 if (ImGui::IsItemHovered()) {
62 ImGui::SetTooltip(tr(
"Copy room ID (0x%03X) to clipboard"), room_id);
66 ImGui::TextColored(theme.status_warning,
"Unsaved");
69 if (
auto* rooms = viewer.
rooms();
70 rooms && room_id < static_cast<int>(rooms->size())) {
71 auto& objects = (*rooms)[room_id].GetTileObjects();
72 if (!objects.empty()) {
73 const auto selected_indices =
75 int requested_object_index =
76 selected_indices.size() == 1
77 ?
static_cast<int>(selected_indices.front())
79 ImGui::AlignTextToFramePadding();
80 ImGui::TextUnformatted(tr(
"Object"));
82 ImGui::SetNextItemWidth(74.0f);
83 bool object_index_changed =
false;
87 "##WorkbenchObjectIndex", ImGuiDataType_S32,
88 &requested_object_index,
"%d", 0,
89 {
reinterpret_cast<uintptr_t
>(rooms),
90 static_cast<uint64_t
>(room_id)});
92 "Select and locate a room object by index");
94 if (object_index_changed) {
95 const size_t target_index =
static_cast<size_t>(std::clamp(
96 requested_object_index, 0,
static_cast<int>(objects.size()) - 1));
99 objects[target_index].y());
102 if (ImGui::IsItemHovered()) {
103 ImGui::SetTooltip(tr(
"Select object index 0-%zu"),
109 ImGui::TextUnformatted(tr(
"Room: None"));
117 ImGui::PushTextWrapPos(0.0f);
119 std::string project_group_name =
122 const char* group_name =
123 project_group_name.empty() ? nullptr : project_group_name.c_str();
127 group_name = cache_it->second.c_str();
131 auto* rooms = viewer.
rooms();
132 if (rooms && room_id <
static_cast<int>(rooms->size())) {
134 (*rooms)[room_id].blockset());
141 ImGui::TextDisabled(
"%s", room_label.c_str());
144 ImGui::TextDisabled(
"%s", room_label.c_str());
146 ImGui::PopTextWrapPos();
150 if (
auto* rooms = viewer.
rooms();
151 rooms && room_id >= 0 && room_id < static_cast<int>(rooms->size())) {
152 auto& room = (*rooms)[room_id];
163 ImGui::PushID(
"InspectedEntrance");
168 "Entrance properties are open in a separate window.");
169 if (ImGui::Button(
"Show entrance window") &&
176 ImGui::EndDisabled();
188 ImGui::TextDisabled(tr(
"Room properties unavailable"));
194 ImGui::TextWrapped(
"Room transfer is open in the canvas dialog.");
DungeonRoomStore * rooms() const
int current_room_id() const
DungeonObjectInteraction & object_interaction()
bool IsObjectInteractionEnabled() const
bool header_read_only() const
DungeonRoomTransferEditorState & room_transfer_state()
const project::YazeProject * project() const
void ScrollToTile(int tile_x, int tile_y)
std::string GetId() const override
Unique identifier for this panel.
void DrawPropertiesInWorkbench()
void SetSelectedObjects(const std::vector< size_t > &indices)
std::vector< size_t > GetSelectedObjectIndices() const
static const char * GetBlocksetGroupName(uint8_t blockset)
bool room_dungeon_cache_built_
DungeonEntrancesPanel * entrance_navigator_content_
std::function< bool(const std::string &) is_standalone_tool_open_)
void FocusSelectionInspector()
void DrawInspectorShelfRoom(DungeonCanvasViewer &viewer)
void DrawPitDamageControls(int room_id)
std::unordered_map< int, std::string > room_dungeon_cache_
std::function< bool(const std::string &) open_and_focus_standalone_tool_)
void BuildRoomDungeonCache()
#define ICON_MD_CONTENT_COPY
#define ICON_MD_INVENTORY_2
const AgentUITheme & GetTheme()
std::string GetRoomLabel(const project::YazeProject *project, int room_id)
std::string GetDungeonNameForRoom(const project::YazeProject *project, int room_id)
bool BeginInspectorSection(const char *label, bool default_open)
void DrawInspectorSectionHeader(const char *label)
Editors are the view controllers for the application.
void DrawDungeonRoomTransferEditor(DungeonCanvasViewer &viewer)
void DrawDungeonDestinationEditor(DungeonCanvasViewer &viewer)
void DrawDungeonRoomPropertyFields(DungeonCanvasViewer &viewer, zelda3::Room &room, int room_id, RoomPropertyLayout layout)
void DrawDungeonChestEditor(int room_id, zelda3::Room &room, DungeonCanvasViewer &viewer)
void AutoRegisterLastItem(const std::string &widget_type, const std::string &explicit_label, const std::string &description)
Automatically register the last ImGui item.
bool InputScalarDeferred(const char *label, ImGuiDataType data_type, void *data, const char *format, ImGuiInputTextFlags flags, InputScalarTargetIdentity target_identity)