From 673bc981b60b17924da80365d9f48ec023484cfe Mon Sep 17 00:00:00 2001 From: codereader Date: Sat, 18 Jul 2020 06:13:52 +0200 Subject: [PATCH] #5231: Fix insert prefab command invocations --- radiant/ui/MapCommands.cpp | 3 ++- radiant/ui/ortho/OrthoContextMenu.cpp | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/radiant/ui/MapCommands.cpp b/radiant/ui/MapCommands.cpp index 121c7976bf..9594f7b2d9 100644 --- a/radiant/ui/MapCommands.cpp +++ b/radiant/ui/MapCommands.cpp @@ -11,7 +11,8 @@ void loadPrefabDialog(const cmd::ArgumentList& args) if (!result.prefabPath.empty()) { - GlobalCommandSystem().executeCommand(LOAD_PREFAB_AT_CMD, Vector3(0, 0, 0)); + GlobalCommandSystem().executeCommand(LOAD_PREFAB_AT_CMD, + result.prefabPath, Vector3(0, 0, 0), result.insertAsGroup); } } diff --git a/radiant/ui/ortho/OrthoContextMenu.cpp b/radiant/ui/ortho/OrthoContextMenu.cpp index b92a0b0c8d..07a48296d1 100644 --- a/radiant/ui/ortho/OrthoContextMenu.cpp +++ b/radiant/ui/ortho/OrthoContextMenu.cpp @@ -20,6 +20,7 @@ #include "ui/modelselector/ModelSelector.h" #include "ui/entitychooser/EntityClassChooser.h" +#include "ui/prefabselector/PrefabSelector.h" #include "string/convert.h" #include "scene/GroupNodeChecker.h" @@ -329,8 +330,14 @@ void OrthoContextMenu::callbackAddLight() void OrthoContextMenu::callbackAddPrefab() { - // Pass the call to the map algorithm and give the lastPoint coordinate as argument - GlobalCommandSystem().executeCommand(LOAD_PREFAB_AT_CMD, _lastPoint); + auto result = PrefabSelector::ChoosePrefab(); + + if (!result.prefabPath.empty()) + { + // Pass the call to the map algorithm and give the lastPoint coordinate as argument + GlobalCommandSystem().executeCommand(LOAD_PREFAB_AT_CMD, + result.prefabPath, _lastPoint, result.insertAsGroup); + } } void OrthoContextMenu::callbackAddSpeaker()