From 7baec67bf4757f398f0d9062caebc535a895eeb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=A9meryc?= Date: Mon, 17 Jul 2023 20:21:15 -0400 Subject: [PATCH] NK-113 - Open Wren Script File with Double Click --- Editor/src/ComponentsPanel/ScriptPanel.h | 12 +++++++++++- Nuake/src/Scene/Components/WrenScriptComponent.h | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Editor/src/ComponentsPanel/ScriptPanel.h b/Editor/src/ComponentsPanel/ScriptPanel.h index cad0f9d5..00f4988e 100644 --- a/Editor/src/ComponentsPanel/ScriptPanel.h +++ b/Editor/src/ComponentsPanel/ScriptPanel.h @@ -27,7 +27,7 @@ public: if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Script")) { char* file = (char*)payload->Data; - + std::string fullPath = std::string(file, 512); path = Nuake::FileSystem::AbsoluteToRelative(std::move(fullPath)); @@ -37,6 +37,16 @@ public: } component.Script = path; + + // Double click on file + if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) + { + if(!component.Script.empty()) + { + Nuake::OS::OpenIn(component.mWrenScript->GetFile()->GetAbsolutePath()); + } + } + ImGui::TableNextColumn(); ComponentTableReset(component.Script, ""); diff --git a/Nuake/src/Scene/Components/WrenScriptComponent.h b/Nuake/src/Scene/Components/WrenScriptComponent.h index d5f069e2..57bbf47c 100644 --- a/Nuake/src/Scene/Components/WrenScriptComponent.h +++ b/Nuake/src/Scene/Components/WrenScriptComponent.h @@ -39,7 +39,10 @@ namespace Nuake if (j.contains("Script")) { Script = j["Script"]; - LoadScript(Script); + if(!Script.empty()) + { + LoadScript(Script); + } } if (j.contains("mModule"))