feat: Add GUI Automation Tool for Tile Placement

- Introduced the HandleGuiPlaceTileCommand function to facilitate tile placement via GUI automation, enhancing the tool's capabilities for user interaction.
- Updated the ToolDispatcher to include the new command, allowing for seamless integration into the existing command structure.
- Enhanced the AgentChatWidget to initialize default labels for resource tools, improving the user experience with visual feedback on label loading status.
- Improved error handling and user messaging for better clarity during tile placement operations.
This commit is contained in:
scawful
2025-10-05 06:04:18 -04:00
parent 38915a5162
commit 8b9f838054
6 changed files with 136 additions and 2 deletions

View File

@@ -22,6 +22,7 @@
#include "app/editor/system/toast_manager.h"
#include "app/gui/icons.h"
#include "app/core/project.h"
#include "app/rom.h"
#include "imgui/imgui.h"
#include "imgui/misc/cpp/imgui_stdlib.h"
@@ -115,6 +116,30 @@ AgentChatWidget::AgentChatWidget() {
void AgentChatWidget::SetRomContext(Rom* rom) {
agent_service_.SetRomContext(rom);
// ALWAYS initialize embedded labels for resource tools (default Zelda3 labels)
if (rom && rom->is_loaded() && rom->resource_label()) {
if (!rom->resource_label()->labels_loaded_) {
core::YazeProject project;
// Initialize embedded default labels (all Zelda3 resources)
auto labels_status = project.InitializeEmbeddedLabels();
if (labels_status.ok()) {
rom->resource_label()->labels_ = project.resource_labels;
rom->resource_label()->labels_loaded_ = true;
if (toast_manager_) {
toast_manager_->Show(
ICON_MD_CHECK_CIRCLE " Default Zelda3 labels loaded for AI tools",
ToastType::kSuccess, 2.5f);
}
} else if (toast_manager_) {
toast_manager_->Show(
ICON_MD_WARNING " Warning: Could not load default labels",
ToastType::kWarning, 3.0f);
}
}
}
}
void AgentChatWidget::SetToastManager(ToastManager* toast_manager) {