From 8d8934657c3c0a84dbc6ccc58501baad02428711 Mon Sep 17 00:00:00 2001 From: David Kekesi Date: Tue, 5 Nov 2024 12:46:14 +0100 Subject: [PATCH] get the selected element ids from the modelcard instead of the application during a send operation --- .gitignore | 1 + .../Interface/Browser/Bridge/Send/Send.cpp | 17 +++++++++-------- .../Connector/Interface/ConnectorPalette.cpp | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index c182158..c69af52 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ build/ Documents/ ResourceObjects/ Install/ +enc_temp_folder/ .vs/ .vscode/ xcuserdata/ diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Send/Send.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Send/Send.cpp index 800bcfe..fc66b3f 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Send/Send.cpp +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Send/Send.cpp @@ -8,18 +8,19 @@ #include "Connector/Interface/Browser/Bridge/Send/Arg/SendError.h" #include "Connector/Interface/Browser/Bridge/Send/Arg/SendViaBrowserArgs.h" #include "Connector/Record/Collection/ProjectCollection.h" +#include "Connector/Record/Model/SenderModelCard.h" +#include "Connector/Record/Model/Filter/SendFilter.h" #include "Speckle/Database/AccountDatabase.h" #include "Speckle/Database/Content/BIMRecord.h" #include "Speckle/Interface/Browser/Bridge/BrowserBridge.h" #include "Speckle/Record/Credentials/Account.h" #include "Speckle/Serialise/Detached/Storage/DetachedMemoryStore.h" #include "Speckle/Utility/Exception.h" - #include "Speckle/Database/BIMElementDatabase.h" #include "Speckle/Environment/Project.h" #include "Speckle/Record/Element/Element.h" -using namespace speckle::record::element; +using namespace speckle::record::element; using namespace active::serialise; using namespace connector::interfac::browser::bridge; using namespace connector::record; @@ -64,14 +65,14 @@ void Send::run(const String& modelCardID) const { std::make_unique(connector()->getLocalString(errorString, noProjectOpenID), modelCardID)); return; } - //Get the selected elements + + // Get the selected elements from the modelcard auto elementDatabase = project->getElementDatabase(); - auto selected = elementDatabase->getSelection(); - if (selected.empty()) { - getBridge()->sendEvent("setModelError", - std::make_unique(connector()->getLocalString(errorString, noSelectedModelItemsID), modelCardID)); - return; + ElementIDList selected{}; + if (auto senderCard = dynamic_cast(modelCard.get())) { + selected = senderCard->getFilter().getElementIDs(); } + //Build a collection from the selected elements auto collection = std::make_unique(project); for (const auto& link : selected) { diff --git a/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp b/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp index 1190a18..214165d 100644 --- a/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp +++ b/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp @@ -228,8 +228,9 @@ void BrowserPalette::Hide() { void BrowserPalette::InitBrowserControl() { #ifdef TESTING_MODE - browser->LoadURL("https://deploy-preview-3180--boisterous-douhua-e3cefb.netlify.app/"); + //browser->LoadURL("https://deploy-preview-3180--boisterous-douhua-e3cefb.netlify.app/"); //browser->LoadURL("https://boisterous-douhua-e3cefb.netlify.app/test"); + browser->LoadURL("https://boisterous-douhua-e3cefb.netlify.app"); #else browser->LoadURL("https://boisterous-douhua-e3cefb.netlify.app/"); #endif