Merge branch 'release/0.2.4'
This commit is contained in:
+4
-2
@@ -9,8 +9,10 @@ xcuserdata/
|
||||
x64/
|
||||
.DS_Store
|
||||
.cache/
|
||||
Documentation/*
|
||||
!Documentation/Doxyfile
|
||||
SpeckleConnector/Documentation/*
|
||||
!SpeckleConnector/Documentation/Doxyfile
|
||||
SpeckleLib/Documentation/*
|
||||
!SpeckleLib/Documentation/Doxyfile
|
||||
CMakeCache.txt
|
||||
_deps/
|
||||
CMakeFiles/
|
||||
|
||||
@@ -723,16 +723,16 @@
|
||||
0867D691FE84028FC02AAC07 /* SampleObject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
21F69EED2C64FE91008B6A06 /* ActiveLib.xcodeproj */,
|
||||
21F69EC62C64C035008B6A06 /* SpeckleLib.xcodeproj */,
|
||||
219388682C4E5DE2002A0180 /* CMakeLists.txt */,
|
||||
2161FD902BF2600C006D9527 /* README.md */,
|
||||
21F69F112C677BC0008B6A06 /* Connector */,
|
||||
21F69EC62C64C035008B6A06 /* SpeckleLib.xcodeproj */,
|
||||
21F69EED2C64FE91008B6A06 /* ActiveLib.xcodeproj */,
|
||||
219388682C4E5DE2002A0180 /* CMakeLists.txt */,
|
||||
219F30412C769282009834E9 /* ConnectorTests */,
|
||||
81494D9D09DA5892006864FB /* Resource */,
|
||||
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
|
||||
034768DDFF38A45A11DB9C8B /* Products */,
|
||||
213CC4E02B1107CF00088049 /* Frameworks */,
|
||||
034768DDFF38A45A11DB9C8B /* Products */,
|
||||
2161FD902BF2600C006D9527 /* README.md */,
|
||||
81494D9D09DA5892006864FB /* Resource */,
|
||||
);
|
||||
name = SampleObject;
|
||||
sourceTree = "<group>";
|
||||
@@ -1365,7 +1365,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "mkdir -p \"$HEADER_PATH_3/ResourceObjects\"\npython3 \"$HEADER_PATH_5/Tools/CompileResources.py\" INT \"$HEADER_PATH_5/..\" \"$HEADER_PATH_6\" \"$SRCROOT\" \"$HEADER_PATH_3/ResourceObjects\" \"$SYMROOT/$CONFIGURATION/$PRODUCT_NAME.$WRAPPER_EXTENSION/Contents/Resources\"\ncp \"$HEADER_PATH_5/Inc/PkgInfo\" \"$SYMROOT/$CONFIGURATION/$PRODUCT_NAME.$WRAPPER_EXTENSION/Contents/PkgInfo\"\ntouch \"$HEADER_PATH_3/ResourceObjects/AddOnResources.stamp\"\n";
|
||||
shellScript = "mkdir -p \"$HEADER_PATH_6/ResourceObjects\"\npython3 \"$HEADER_PATH_5/Tools/CompileResources.py\" INT \"$HEADER_PATH_5/..\" \"$HEADER_PATH_6\" \"$SRCROOT\" \"$HEADER_PATH_6/ResourceObjects\" \"$SYMROOT/$CONFIGURATION/$PRODUCT_NAME.$WRAPPER_EXTENSION/Contents/Resources\"\npython3 \"$HEADER_PATH_5/Tools/CompileResources.py\" INT \"$HEADER_PATH_5/..\" \"$HEADER_PATH_3\" \"$HEADER_PATH_3\" \"$HEADER_PATH_6/ResourceObjects\" \"$SYMROOT/$CONFIGURATION/$PRODUCT_NAME.$WRAPPER_EXTENSION/Contents/Resources\"\ncp \"$HEADER_PATH_5/Inc/PkgInfo\" \"$SYMROOT/$CONFIGURATION/$PRODUCT_NAME.$WRAPPER_EXTENSION/Contents/PkgInfo\"\ntouch \"$HEADER_PATH_6/ResourceObjects/AddOnResources.stamp\"\n";
|
||||
};
|
||||
213CC3A12B1101F500088049 /* Install */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace {
|
||||
ConnectorInstance(const String& name) : ConnectorAddon{name} {
|
||||
add<ConnectorMenu>();
|
||||
add<ConnectorPalette>();
|
||||
//The connector 'owns' the model card database, so the publisher list should only hold a weak reference
|
||||
addWeak(m_modelCards.getSubscription());
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ GetAccounts::GetAccounts() : BridgeMethod{"GetAccounts", [&]() {
|
||||
return: The accounts (empty array when none defined)
|
||||
--------------------------------------------------------------------*/
|
||||
std::unique_ptr<Cargo> GetAccounts::run() const {
|
||||
Vector<Account> accounts;
|
||||
std::unique_ptr<Vector<Account>> result;
|
||||
if (auto accountDBase = connector()->getAccountDatabase(); accountDBase != nullptr)
|
||||
accounts = accountDBase->getAccounts();
|
||||
return std::make_unique<WrappedValue>(accounts);
|
||||
result = std::make_unique<Vector<Account>>(accountDBase->getAccounts());
|
||||
else
|
||||
result = std::make_unique<Vector<Account>>();
|
||||
return std::make_unique<WrappedValue>(std::move(result));
|
||||
} //GetAccounts::run
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_ADD_MODEL
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
|
||||
#include "Connector/Record/Model/CardMover.h"
|
||||
#include "Connector/Record/Model/ModelCard.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
///Argument parameter for a string
|
||||
using CardHold = active::serialise::CargoHold<active::serialise::PackageWrap, connector::record::ModelCard>;
|
||||
using CardHold = active::serialise::CargoHold<connector::record::CardMover, connector::record::ModelCard>;
|
||||
///Argument type for this method
|
||||
using ModelCardEventWrapper = speckle::interfac::browser::bridge::JSArgType<CardHold>;
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
// MARK: - Public variables (NB: Assuming to class invariants or overrides for this data, so making public for simplicity)
|
||||
|
||||
///The project location
|
||||
speckle::utility::String location; //TODO: Confirm this is an address
|
||||
///The URL of the project file (non-teamwork) or server (teamwork)
|
||||
speckle::utility::String location;
|
||||
///The project name
|
||||
speckle::utility::String name; //TODO: Assume project name rather than document (file) name - need to confirm
|
||||
speckle::utility::String name;
|
||||
///A unique, persistent ID for the project document
|
||||
speckle::utility::String ID; //TODO: should possibly be a guid - need to check
|
||||
speckle::utility::String ID;
|
||||
|
||||
// MARK: - Serialisation
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Base/GetDocumentInfo.h"
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Connector/Connector.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Base/Arg/DocumentInfo.h"
|
||||
#include "Speckle/Environment/Project.h"
|
||||
#include "Speckle/Utility/Guid.h"
|
||||
|
||||
using namespace active::container;
|
||||
using namespace active::serialise;
|
||||
@@ -28,7 +31,14 @@ GetDocumentInfo::GetDocumentInfo() : BridgeMethod{"GetDocumentInfo", [&]() {
|
||||
return: The document info
|
||||
--------------------------------------------------------------------*/
|
||||
std::unique_ptr<Cargo> GetDocumentInfo::run() const {
|
||||
///TODO: Get the document info here - returning mocked values for now
|
||||
DocumentInfo docInfo{"Somewhere", "Something", String{active::utility::Guid{true}.operator active::utility::String()}};
|
||||
return std::make_unique<WrappedValue>(docInfo);
|
||||
auto docInfo = std::make_unique<DocumentInfo>();
|
||||
if (auto project = connector()->getActiveProject().lock(); project) {
|
||||
auto info = project->getInfo();
|
||||
docInfo->name = info.name;
|
||||
if (info.path)
|
||||
docInfo->location = *info.path;
|
||||
//TODO: No suitable project ID is currently available
|
||||
docInfo->ID = Guid{true}.operator String();
|
||||
}
|
||||
return std::make_unique<WrappedValue>(std::move(docInfo));
|
||||
} //GetDocumentInfo::run
|
||||
|
||||
@@ -13,12 +13,6 @@ using namespace connector::database;
|
||||
using namespace connector::record;
|
||||
using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
using WrappedValue = active::serialise::CargoHold<ContainerWrap<Vector<ModelCard>>, Vector<ModelCard>>;
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_REMOVE_MODEL
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
|
||||
#include "Connector/Record/Model/CardMover.h"
|
||||
#include "Connector/Record/Model/ModelCard.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
///Argument parameter for a string
|
||||
using CardHold = active::serialise::CargoHold<active::serialise::PackageWrap, connector::record::ModelCard>;
|
||||
using CardHold = active::serialise::CargoHold<connector::record::CardMover, connector::record::ModelCard>;
|
||||
///Argument type for this method
|
||||
using ModelCardEventWrapper = speckle::interfac::browser::bridge::JSArgType<CardHold>;
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_UPDATE_MODEL
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
|
||||
#include "Connector/Record/Model/CardMover.h"
|
||||
#include "Connector/Record/Model/ModelCard.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
///Argument parameter for a string
|
||||
using CardHold = active::serialise::CargoHold<active::serialise::PackageWrap, connector::record::ModelCard>;
|
||||
using CardHold = active::serialise::CargoHold<connector::record::CardMover, connector::record::ModelCard>;
|
||||
///Argument type for this method
|
||||
using ModelCardEventWrapper = speckle::interfac::browser::bridge::JSArgType<CardHold>;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ GetConfig::GetConfig() : BridgeMethod{"GetConfig", [&]() {
|
||||
return: The settings
|
||||
--------------------------------------------------------------------*/
|
||||
std::unique_ptr<Cargo> GetConfig::run() const {
|
||||
ConnectorConfig config;
|
||||
///TODO: Get the accounts here - returning an empty array for testing only
|
||||
return std::make_unique<WrappedValue>(config);
|
||||
auto config = std::make_unique<ConnectorConfig>();
|
||||
///TODO: Get the data from a local SQLite database
|
||||
return std::make_unique<WrappedValue>(std::move(config));
|
||||
} //GetConfig::run
|
||||
|
||||
@@ -21,5 +21,5 @@ UpdateConfig::UpdateConfig() : BridgeMethod{"UpdateConfig", [&](const UpdateArgs
|
||||
config: The new settings
|
||||
--------------------------------------------------------------------*/
|
||||
void UpdateConfig::run(const ConnectorConfig& config) const {
|
||||
///TODO: Store the active configuration settings here
|
||||
///TODO: Store the active configuration settings in a local SQLite database
|
||||
} //UpdateConfig::run
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
|
||||
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
|
||||
#include "Connector/Record/Model/Filter/ArchicadEverythingFilter.h"
|
||||
#include "Connector/Record/Model/Filter/FilterMover.h"
|
||||
#include "Connector/Record/Model/Filter/ArchicadSelectionFilter.h"
|
||||
|
||||
using namespace active::container;
|
||||
@@ -15,7 +16,7 @@ using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
using WrappedValue = active::serialise::CargoHold<ContainerWrap<Vector<SendFilter>>, Vector<SendFilter>>;
|
||||
using WrappedValue = active::serialise::CargoHold<ContainerWrap<Vector<SendFilter>, FilterMover>, Vector<SendFilter>>;
|
||||
|
||||
}
|
||||
|
||||
@@ -33,8 +34,8 @@ GetSendFilters::GetSendFilters() : BridgeMethod{"GetSendFilters", [&]() {
|
||||
return: The send filters
|
||||
--------------------------------------------------------------------*/
|
||||
std::unique_ptr<Cargo> GetSendFilters::run() const {
|
||||
Vector<SendFilter> filters;
|
||||
auto filters = std::make_unique<Vector<SendFilter>>();
|
||||
//filters.emplace_back(ArchicadEverythingFilter{}); //TODO: Implement as required
|
||||
filters.emplace_back(ArchicadSelectionFilter{});
|
||||
return std::make_unique<WrappedValue>(filters);
|
||||
filters->emplace_back(ArchicadSelectionFilter{});
|
||||
return std::make_unique<WrappedValue>(std::move(filters));
|
||||
} //GetSendFilters::run
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
|
||||
#include "Speckle/Utility/Exception.h"
|
||||
|
||||
using namespace active::serialise;
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
@@ -10,7 +11,7 @@ using namespace speckle::utility;
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
Send::Send() : BridgeMethod{"Send", [&](UpdateArgs args) {
|
||||
Send::Send() : BridgeMethod{"Send", [&](const SendArgs& args) {
|
||||
run(args);
|
||||
}} {}
|
||||
|
||||
@@ -21,5 +22,6 @@ Send::Send() : BridgeMethod{"Send", [&](UpdateArgs args) {
|
||||
modelCardID: The ID of the madel to send
|
||||
--------------------------------------------------------------------*/
|
||||
void Send::run(const String& modelCardID) const {
|
||||
///TODO: Send the requested model
|
||||
///TODO: Find and send selected elements - the following is a placeholder
|
||||
throw Exception{"No objects were found to convert. Please update your publish filter!"};
|
||||
} //Send::run
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_SEND
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Config/Arg/ConnectorConfig.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
@@ -9,13 +10,15 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
class ConnectorConfig;
|
||||
|
||||
///Argument for a JS call to update the configuration
|
||||
using UpdateArgs = speckle::interfac::browser::bridge::JSArgType<speckle::utility::String>;
|
||||
///Argument parameter for a string
|
||||
using StringHold = active::serialise::CargoHold<active::serialise::ValueWrap<speckle::utility::String>, speckle::utility::String>;
|
||||
///Argument type for this method
|
||||
using SendArgs = speckle::interfac::browser::bridge::JSArgType<StringHold>;
|
||||
|
||||
/*!
|
||||
JS Function class to retrieve the names of the methods supported by the bridge
|
||||
JS Function class to send a specified model
|
||||
*/
|
||||
class Send : public speckle::interfac::browser::bridge::BridgeMethod<UpdateArgs, void> {
|
||||
class Send : public speckle::interfac::browser::bridge::BridgeMethod<SendArgs, void> {
|
||||
public:
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
@@ -128,6 +128,6 @@ GetComplexType::GetComplexType() : BridgeMethod{"GetComplexType", [&]() {
|
||||
return: The required object
|
||||
--------------------------------------------------------------------*/
|
||||
std::unique_ptr<Cargo> GetComplexType::run() const {
|
||||
ComplexType object;
|
||||
return std::make_unique<WrappedValue>(object);
|
||||
auto object = std::make_unique<ComplexType>();
|
||||
return std::make_unique<WrappedValue>(std::move(object));
|
||||
} //GetComplexType::run
|
||||
|
||||
@@ -8,8 +8,6 @@ Distributed under the MIT License (See accompanying file LICENSE.txt or copy at
|
||||
#include "Connector/Record/Model/ReceiverModelCard.h"
|
||||
#include "Connector/Record/Model/SenderModelCard.h"
|
||||
|
||||
using namespace active::serialise;
|
||||
using namespace active::utility;
|
||||
using namespace connector::record;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -16,10 +16,25 @@ namespace {
|
||||
|
||||
///The tag used to identify a Speckle type name value
|
||||
const char* attributeTag = "typeDiscriminator";
|
||||
///Identity for a SenderModelCard
|
||||
const char* ArchicadSelectionTypeName = "ArchicadSelectionFilter";
|
||||
///Identity for a SenderModelCard
|
||||
///Identity for selecting everything
|
||||
const char* ArchicadEverythingTypeName = "ArchicadEverythingFilter";
|
||||
///Identity for a selection filter
|
||||
const char* ArchicadSelectionTypeName = "ArchicadSelectionFilter";
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Ensure the handler is populated
|
||||
|
||||
handler: The filter handler to validate
|
||||
|
||||
return: A reference to the handler
|
||||
--------------------------------------------------------------------*/
|
||||
std::shared_ptr<active::serialise::Handler>& validateHandler(std::shared_ptr<active::serialise::Handler>& handler) {
|
||||
if (!handler->empty())
|
||||
return handler;
|
||||
handler->add<ArchicadEverythingFilter>(ArchicadEverythingTypeName);
|
||||
handler->add<ArchicadSelectionFilter>(ArchicadSelectionTypeName);
|
||||
return handler;
|
||||
} //validateHandler
|
||||
|
||||
}
|
||||
|
||||
@@ -32,8 +47,7 @@ std::shared_ptr<active::serialise::Handler> FilterMover::m_handler = std::make_s
|
||||
|
||||
handler: A package handler to reconstruct incoming packages
|
||||
--------------------------------------------------------------------*/
|
||||
FilterMover::FilterMover() : Mover{m_handler} {
|
||||
validateHandler();
|
||||
FilterMover::FilterMover() : Mover{validateHandler(m_handler)} {
|
||||
} //FilterMover::FilterMover
|
||||
|
||||
|
||||
@@ -42,8 +56,7 @@ FilterMover::FilterMover() : Mover{m_handler} {
|
||||
|
||||
outgoing: An outgoing package
|
||||
--------------------------------------------------------------------*/
|
||||
FilterMover::FilterMover(const active::serialise::Package& outgoing) : Mover{outgoing, m_handler} {
|
||||
validateHandler();
|
||||
FilterMover::FilterMover(const active::serialise::Package& outgoing) : Mover{outgoing, validateHandler(m_handler)} {
|
||||
} //FilterMover::FilterMover
|
||||
|
||||
|
||||
@@ -52,17 +65,5 @@ FilterMover::FilterMover(const active::serialise::Package& outgoing) : Mover{out
|
||||
|
||||
package: A reference to the member variable
|
||||
--------------------------------------------------------------------*/
|
||||
FilterMover::FilterMover(active::serialise::PackageUniqueWrap&& package) : Mover{std::move(package), m_handler} {
|
||||
|
||||
FilterMover::FilterMover(active::serialise::PackageUniqueWrap&& package) : Mover{std::move(package), validateHandler(m_handler)} {
|
||||
} //FilterMover::FilterMover
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Ensure the handler is populated
|
||||
--------------------------------------------------------------------*/
|
||||
void FilterMover::validateHandler() {
|
||||
if (!m_handler->empty())
|
||||
return;
|
||||
m_handler->add<ArchicadEverythingFilter>(ArchicadEverythingTypeName);
|
||||
m_handler->add<DirectSelectionSendFilter>(ArchicadSelectionTypeName);
|
||||
} //FilterMover::validateHandler
|
||||
|
||||
@@ -37,12 +37,7 @@ namespace connector::record {
|
||||
FilterMover(active::serialise::PackageUniqueWrap&& package);
|
||||
|
||||
private:
|
||||
/*!
|
||||
Ensure the handler is populated
|
||||
*/
|
||||
static void validateHandler();
|
||||
|
||||
///The handler for model card packages
|
||||
///The handler for model filter packages
|
||||
static std::shared_ptr<active::serialise::Handler> m_handler;
|
||||
};
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ bool SendFilter::fillInventory(Inventory& inventory) const {
|
||||
inventory.merge(Inventory{
|
||||
{
|
||||
{ fieldID[nameID], nameID, element },
|
||||
{ fieldID[summaryID], summaryID, element },
|
||||
{ fieldID[defaultID], defaultID, element },
|
||||
{ fieldID[summaryID], summaryID, element, !m_summary.empty() },
|
||||
{ fieldID[defaultID], defaultID, element, m_isDefault },
|
||||
},
|
||||
}.withType(&typeid(SendFilter)));
|
||||
return true;
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace {
|
||||
accountID,
|
||||
serverURLID,
|
||||
settingsID,
|
||||
expiredID,
|
||||
};
|
||||
|
||||
///Serialisation field IDs
|
||||
@@ -26,8 +27,9 @@ namespace {
|
||||
Identity{"modelId"},
|
||||
Identity{"projectId"},
|
||||
Identity{"accountId"},
|
||||
Identity{"serverURL"},
|
||||
Identity{"serverUrl"},
|
||||
Identity{"settings"},
|
||||
Identity{"expired"},
|
||||
};
|
||||
|
||||
}
|
||||
@@ -48,9 +50,16 @@ bool ModelCard::fillInventory(Inventory& inventory) const {
|
||||
{ fieldID[accountID], accountID, element },
|
||||
{ fieldID[serverURLID], serverURLID, element },
|
||||
{ fieldID[settingsID], settingsID, element },
|
||||
{ fieldID[expiredID], expiredID, element },
|
||||
},
|
||||
}.withType(&typeid(ModelCard)));
|
||||
return base::fillInventory(inventory);
|
||||
//This class has a unique serialisation tag for the record ID - override the base class ID
|
||||
inventory.merge(Inventory{
|
||||
{
|
||||
{ Identity{"modelCardId"}, active::database::record::FieldIndex::idIndex, element },
|
||||
},
|
||||
}.withType(&typeid(base::base)));
|
||||
return true;
|
||||
} //ModelCard::fillInventory
|
||||
|
||||
|
||||
@@ -76,6 +85,8 @@ Cargo::Unique ModelCard::getCargo(const Inventory::Item& item) const {
|
||||
return std::make_unique<ValueWrap<String>>(m_serverURL);
|
||||
case settingsID:
|
||||
return std::make_unique<ContainerWrap<Vector<CardSetting>>>(m_settings);
|
||||
case expiredID:
|
||||
return std::make_unique<ValueWrap<bool>>(m_isExpired);
|
||||
default:
|
||||
return nullptr; //Requested an unknown index
|
||||
}
|
||||
|
||||
@@ -108,6 +108,8 @@ namespace connector::record {
|
||||
speckle::utility::String m_serverURL;
|
||||
///Settings for the model rendering, e.g. level of detail (LoD)
|
||||
SettingList m_settings;
|
||||
///True if the card has expired
|
||||
bool m_isExpired = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace connector {
|
||||
|
||||
static const unsigned int versionMinor = 2;
|
||||
|
||||
static const unsigned int versionPatch = 3;
|
||||
static const unsigned int versionPatch = 4;
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@
|
||||
#include "Connector.grc.rc2"
|
||||
#include "ConnectorMenu.grc.rc2"
|
||||
#include "SpecklePalette.grc.rc2"
|
||||
#include "Speckle.grc.rc2"
|
||||
|
||||
#include "ConnectorFix.grc.rc2"
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ REM AC Resource build script
|
||||
ECHO "Building AC Resources"
|
||||
|
||||
if not exist "%RES_OUTPUT%" MD "%RES_OUTPUT%"
|
||||
python "%HEADER_PATH_5%\Tools\CompileResources.py" "INT" "%HEADER_PATH_5%\.." "%HEADER_PATH_6%Source" "%SYMROOT%\" "%RES_OUTPUT%" "%RES_SOURCE%\CodesignImport.apx.mui"
|
||||
python "%HEADER_PATH_5%\Tools\CompileResources.py" "INT" "%HEADER_PATH_5%\.." "%HEADER_PATH_6%\Connector" "%SYMROOT%\" "%RES_OUTPUT%" "%RES_SOURCE%\Speckle Connector.apx.mui"
|
||||
python "%HEADER_PATH_5%\Tools\CompileResources.py" "INT" "%HEADER_PATH_5%\.." "%HEADER_PATH_4%\Speckle" "%HEADER_PATH_4%" "%RES_OUTPUT%" "%RES_SOURCE%\Speckle Connector.apx.mui"
|
||||
|
||||
ECHO "Finished AC Resource"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
'STR#' 32700 "Speckle Title strings" {
|
||||
/* [ 1] */ "Untitled"
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Active/Utility/Memory.h"
|
||||
#include "Active/Utility/String.h"
|
||||
#include "Speckle/Environment/Addon.h"
|
||||
#include "Speckle/Environment/Project.h"
|
||||
#include "Speckle/Event/Type/DocStoreMergeEvent.h"
|
||||
#include "Speckle/Event/Type/ProjectEvent.h"
|
||||
#include "Speckle/Utility/Guid.h"
|
||||
@@ -93,7 +94,8 @@ namespace {
|
||||
void copyHandleToMemory(const GSHandle& handle, active::utility::Memory& memory) {
|
||||
auto storeSize = BMGetHandleSize(handle);
|
||||
memory.resize(storeSize);
|
||||
active::utility::Memory::copy(memory.data(), *handle, storeSize, storeSize);
|
||||
if ((storeSize > 0) && (*handle != nullptr))
|
||||
active::utility::Memory::copy(memory.data(), *handle, storeSize, storeSize);
|
||||
} //copyHandleToMemory
|
||||
|
||||
#endif
|
||||
@@ -174,18 +176,17 @@ bool DocumentStoreCore::handle(const DocStoreMergeEvent& event) {
|
||||
return: True if the event should be closed
|
||||
--------------------------------------------------------------------*/
|
||||
bool DocumentStoreCore::handle(const event::ProjectEvent& event) {
|
||||
#ifdef ARCHICAD
|
||||
using enum ProjectEvent::Type;
|
||||
switch (event.getType()) {
|
||||
case APINotify_Close:
|
||||
case close:
|
||||
resetStore(); //Wipe the cache, forcing a full reload when the data is requested again (after a project is opened)
|
||||
break;
|
||||
case APINotify_PreSave: case APINotify_SendChanges:
|
||||
case presave: case send:
|
||||
writeStore(); //Ensure the data is stored with the save/send
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
} //DocumentStoreCore::handle
|
||||
|
||||
@@ -221,6 +222,10 @@ active::utility::Memory DocumentStoreCore::readStore() const {
|
||||
--------------------------------------------------------------------*/
|
||||
void DocumentStoreCore::writeStore() {
|
||||
#ifdef ARCHICAD
|
||||
auto activeProject = addon()->getActiveProject();
|
||||
bool shared = false;
|
||||
if (auto project = activeProject.lock(); project && project->getInfo().isShared)
|
||||
shared = true;
|
||||
//Ensure a suitable data store exists
|
||||
if (!isExistingStore(m_id)) {
|
||||
//Create when missing
|
||||
@@ -230,7 +235,7 @@ void DocumentStoreCore::writeStore() {
|
||||
m_id.id = Guid{acID};
|
||||
}
|
||||
//Reserve the storage object in TW
|
||||
if (addon()->isSharedDocument()) {
|
||||
if (shared) {
|
||||
GS::HashTable<API_Guid, short> conflicts;
|
||||
if (auto statusCode = convertArchicadError(ACAPI_AddOnObject_ReserveObjects({Guid{m_id.id}}, &conflicts)); statusCode != nominal)
|
||||
throw std::system_error(makeError(statusCode));
|
||||
@@ -244,7 +249,7 @@ void DocumentStoreCore::writeStore() {
|
||||
if (auto statusCode = convertArchicadError(ACAPI_AddOnObject_ModifyObject(Guid{m_id.id}, nullptr, &output)); statusCode != nominal)
|
||||
throw std::system_error(makeError(statusCode));
|
||||
//Release the storage object in TW
|
||||
if (addon()->isSharedDocument()) {
|
||||
if (shared) {
|
||||
if (auto statusCode = convertArchicadError(ACAPI_AddOnObject_ReleaseObjects({Guid{m_id.id}})); statusCode != nominal)
|
||||
throw std::system_error(makeError(statusCode));
|
||||
}
|
||||
|
||||
@@ -67,6 +67,14 @@ namespace speckle::database {
|
||||
@return The requested object (nullptr on failure)
|
||||
*/
|
||||
std::unique_ptr<Obj> getObject(const ObjID& objID, std::optional<RecordID> tableID = std::nullopt, std::optional<RecordID> documentID = std::nullopt) const override;
|
||||
/*!
|
||||
Get an object in a transportable form, e.g. packaged for serialisation
|
||||
@param ID The object ID
|
||||
@param tableID Optional table ID (defaults to the first table)
|
||||
@param documentID Optional document ID (when the object is bound to a specific document)
|
||||
@return: The requested wrapped cargo (nullptr on failure)
|
||||
*/
|
||||
active::serialise::Cargo::Unique getObjectCargo(const ObjID& objID, std::optional<RecordID> tableID = std::nullopt, std::optional<RecordID> documentID = std::nullopt) const override;
|
||||
/*!
|
||||
Get all objects
|
||||
@param tableID Optional table ID (defaults to the first table)
|
||||
@@ -164,7 +172,7 @@ namespace speckle::database {
|
||||
if constexpr (std::is_same_v<ObjWrapper, Obj>)
|
||||
Transport().receive(std::forward<active::serialise::Cargo&&>(*m_cache), active::serialise::Identity{}, storedData);
|
||||
else
|
||||
Transport().receive(ObjWrapper{*m_cache}, active::serialise::Identity{}, storedData);
|
||||
Transport().receive(active::serialise::PackageWrap{*m_cache}, active::serialise::Identity{}, storedData);
|
||||
return m_cache.get();
|
||||
} //DocumentStoreEngine<Obj, ObjWrapper, Transport, ObjID>::getCache
|
||||
|
||||
@@ -186,6 +194,25 @@ namespace speckle::database {
|
||||
} //DocumentStoreEngine<Obj, ObjWrapper, Transport, ObjID>::getObject
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get an object in a transportable form, e.g. packaged for serialisation
|
||||
|
||||
index: The object index
|
||||
tableID: Optional table ID (defaults to the first table)
|
||||
documentID: Optional document ID (when the object is bound to a specific document)
|
||||
|
||||
return: The requested wrapped cargo (nullptr on failure)
|
||||
--------------------------------------------------------------------*/
|
||||
template<typename Obj, typename ObjWrapper, typename Transport, typename ObjID>
|
||||
requires DocumentStorable<Obj, ObjWrapper, Transport>
|
||||
active::serialise::Cargo::Unique DocumentStoreEngine<Obj, ObjWrapper, Transport, ObjID>::getObjectCargo(const ObjID& ID, std::optional<RecordID> tableID,
|
||||
std::optional<RecordID> documentID) const {
|
||||
if (auto object = getObject(ID, tableID, documentID); object)
|
||||
return std::make_unique<active::serialise::CargoHold<ObjWrapper, Obj>>(std::move(object));
|
||||
return nullptr;
|
||||
} //DocumentStoreEngine<Obj, ObjWrapper, Transport, ObjID>::getObject
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get all objects
|
||||
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
#include "Speckle/Environment/Addon.h"
|
||||
|
||||
#include "Speckle/Environment/Project.h"
|
||||
#include "Speckle/Event/Type/ProjectEvent.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include <ACAPinc.h>
|
||||
#endif
|
||||
|
||||
using namespace speckle::environment;
|
||||
using namespace speckle::event;
|
||||
using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
@@ -52,19 +58,15 @@ String Addon::getLocalString(short itemIndex, short resourceIndex) const {
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Determine if the active document is shared (in collaborative environments)
|
||||
Get the active project
|
||||
|
||||
return: True if the active document is shared
|
||||
return: The active project (nullptr = no open project)
|
||||
--------------------------------------------------------------------*/
|
||||
bool Addon::isSharedDocument() const {
|
||||
#ifdef ARCHICAD
|
||||
API_ProjectInfo pi{};
|
||||
ACAPI_ProjectOperation_Project(&pi);
|
||||
return pi.teamwork;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
} //Addon::isSharedDocument
|
||||
std::weak_ptr<Project> Addon::getActiveProject() const {
|
||||
if (m_activeProject)
|
||||
return m_activeProject;
|
||||
return std::weak_ptr<Project>{};
|
||||
} //Addon::getActiveProject
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
@@ -76,7 +78,9 @@ void Addon::publishExternal(const active::event::Event& event) {
|
||||
if (!logCallback())
|
||||
return;
|
||||
try {
|
||||
preprocessEvent(event);
|
||||
publish(event);
|
||||
postprocessEvent(event);
|
||||
} catch (...) {
|
||||
//Add error logging in future
|
||||
}
|
||||
@@ -147,7 +151,7 @@ speckle::environment::Addon* speckle::environment::addon() {
|
||||
|
||||
return: True if the callback can continue (false on error)
|
||||
--------------------------------------------------------------------*/
|
||||
bool speckle::environment::Addon::logCallback(bool initialise) {
|
||||
bool Addon::logCallback(bool initialise) {
|
||||
if (initialise)
|
||||
m_callDepth = 1;
|
||||
else
|
||||
@@ -162,3 +166,53 @@ bool speckle::environment::Addon::logCallback(bool initialise) {
|
||||
}
|
||||
return true;
|
||||
} //Addon::publishExternalEvent
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Preprocess an external event (allowing key add-on operations to act before other subscribers)
|
||||
|
||||
event: An incoming event
|
||||
|
||||
return: True if the event should be closed, i.e. not passed to other subscribers
|
||||
--------------------------------------------------------------------*/
|
||||
bool Addon::preprocessEvent(const active::event::Event& event) {
|
||||
if (auto projectEvent = dynamic_cast<const ProjectEvent*>(&event); projectEvent != nullptr) {
|
||||
using enum ProjectEvent::Type;
|
||||
switch (projectEvent->getType()) {
|
||||
case newDocument: case newAndReset: case open:
|
||||
m_activeProject = makeProject(); //Ensure a project object is available
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} //Addon::preprocessEvent
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Postprocess an external event (allowing key add-on operations to act after all other subscribers are complete)
|
||||
|
||||
event: An incoming (completed) event
|
||||
--------------------------------------------------------------------*/
|
||||
void Addon::postprocessEvent(const active::event::Event& event) {
|
||||
if (auto projectEvent = dynamic_cast<const ProjectEvent*>(&event); projectEvent != nullptr) {
|
||||
using enum ProjectEvent::Type;
|
||||
switch (projectEvent->getType()) {
|
||||
case close: case quit:
|
||||
m_activeProject.reset(); //Release the active project on close/quit
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} //Addon::postprocessEvent
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Make a new new project. Allows Addon subclasses to define a Project subclass with additional functions/databases
|
||||
|
||||
return: A new project instance
|
||||
--------------------------------------------------------------------*/
|
||||
std::shared_ptr<Project> Addon::makeProject() const {
|
||||
auto project = new Project; //make_shared can't use protected constructor
|
||||
return std::shared_ptr<Project>{project};
|
||||
} //Addon::makeProject
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
namespace speckle::environment {
|
||||
|
||||
class Project;
|
||||
|
||||
/*!
|
||||
A base class for an addon
|
||||
*/
|
||||
@@ -19,11 +21,7 @@ namespace speckle::environment {
|
||||
@param identity Optional name/ID for the subscriber
|
||||
*/
|
||||
Addon(const active::utility::NameID& identity);
|
||||
/*!
|
||||
Copy constructor
|
||||
@param source The object to copy
|
||||
*/
|
||||
Addon(const App& source) : App{source} {}
|
||||
Addon(const App&) = delete;
|
||||
/*!
|
||||
Destructor
|
||||
*/
|
||||
@@ -39,10 +37,10 @@ namespace speckle::environment {
|
||||
*/
|
||||
speckle::utility::String getLocalString(short itemIndex, short resourceIndex) const;
|
||||
/*!
|
||||
Determine if the active document is shared (in collaborative environments)
|
||||
@return True if the active document is shared
|
||||
Get the active project
|
||||
@return The active project (nullptr = no open project)
|
||||
*/
|
||||
bool isSharedDocument() const;
|
||||
std::weak_ptr<Project> getActiveProject() const;
|
||||
|
||||
// MARK: - Functions (mutating)
|
||||
|
||||
@@ -50,7 +48,7 @@ namespace speckle::environment {
|
||||
Set the add-on name
|
||||
@param nm The add-on name
|
||||
*/
|
||||
void setName(const speckle::utility::String& nm) { name = nm; }
|
||||
void setName(const speckle::utility::String& nm) { App::name = nm; }
|
||||
/*!
|
||||
Publish an event from an external source to subscribers
|
||||
@param event The event to publish
|
||||
@@ -75,6 +73,7 @@ namespace speckle::environment {
|
||||
Shut down event handling
|
||||
*/
|
||||
void stop() override;
|
||||
|
||||
protected:
|
||||
/*!
|
||||
Log a callback into the add-on (allows checking of re-entry)
|
||||
@@ -82,8 +81,27 @@ namespace speckle::environment {
|
||||
@return True if the callback can continue (false on error)
|
||||
*/
|
||||
bool logCallback(bool initialise = true);
|
||||
/*!
|
||||
Preprocess an external event (allowing key add-on operations to act before other subscribers)
|
||||
@param event An incoming event
|
||||
@return True if the event should be closed, i.e. not passed to other subscribers
|
||||
*/
|
||||
virtual bool preprocessEvent(const active::event::Event& event);
|
||||
/*!
|
||||
Postprocess an external event (allowing key add-on operations to act after all other subscribers are complete)
|
||||
@param event An incoming (completed) event
|
||||
*/
|
||||
virtual void postprocessEvent(const active::event::Event& event);
|
||||
/*!
|
||||
Make a new new project. Allows Addon subclasses to define a Project subclass with additional functions/databases
|
||||
@return A new project instance
|
||||
*/
|
||||
virtual std::shared_ptr<Project> makeProject() const;
|
||||
|
||||
private:
|
||||
///The active project
|
||||
std::shared_ptr<Project> m_activeProject;
|
||||
///The depth of nested callbacks - the root call starts at depth 0 (important for some entry-point initialisation)
|
||||
uint32_t m_callDepth = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "Speckle/Environment/Project.h"
|
||||
|
||||
#include "Speckle/Environment/Addon.h"
|
||||
#include "Speckle/SpeckleResource.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include <ACAPinc.h>
|
||||
#endif
|
||||
|
||||
using namespace speckle::environment;
|
||||
using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Constructor (NB: this object is assumed to be the active instance)
|
||||
|
||||
identity: Optional name/ID for the subscriber
|
||||
--------------------------------------------------------------------*/
|
||||
Project::Project() {
|
||||
} //Project::Project
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Destructor
|
||||
--------------------------------------------------------------------*/
|
||||
Project::~Project() {
|
||||
} //Project::~Project
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get information about the project
|
||||
|
||||
return: Project information
|
||||
--------------------------------------------------------------------*/
|
||||
Project::Info Project::getInfo() const {
|
||||
//Start with an untitled project - this will be replaced if a saved project is active
|
||||
Info result{addon()->getLocalString(titleStringLib, untitledProjectID)};
|
||||
#ifdef ARCHICAD
|
||||
API_ProjectInfo projectInfo;
|
||||
if (ACAPI_ProjectOperation_Project(&projectInfo) == NoError) {
|
||||
if ((projectInfo.projectName != nullptr) && !projectInfo.projectName->IsEmpty())
|
||||
result.name = *projectInfo.projectName;
|
||||
result.isShared = projectInfo.teamwork;
|
||||
if ((projectInfo.projectPath != nullptr) && !projectInfo.projectPath->IsEmpty())
|
||||
result.path = String{*projectInfo.projectPath};
|
||||
else if (projectInfo.teamwork) {
|
||||
if (projectInfo.location_team != nullptr) {
|
||||
GS::UniString path;
|
||||
if (projectInfo.location_team->ToPath(&path) == NoError)
|
||||
result.path = String{path};
|
||||
}
|
||||
} else if (projectInfo.location != nullptr) {
|
||||
GS::UniString path;
|
||||
if (projectInfo.location->ToPath(&path) == NoError)
|
||||
result.path = String{path};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
} //Project::getInfo
|
||||
@@ -0,0 +1,69 @@
|
||||
#ifndef SPECKLE_ENVIRONMENT_PROJECT
|
||||
#define SPECKLE_ENVIRONMENT_PROJECT
|
||||
|
||||
#include "Active/File/Path.h"
|
||||
#include "Speckle/Utility/String.h"
|
||||
|
||||
namespace speckle::environment {
|
||||
|
||||
class Addon;
|
||||
|
||||
/*!
|
||||
A BIM project
|
||||
|
||||
This class is currently skeletal, but is intended to be the primnary conduit for any document-based data, e.g. elements, attributes, properties
|
||||
etc. Any databases managing document-based content should be retrieved from this class rather than Add-on (or subclasses) or static functions.
|
||||
*/
|
||||
class Project {
|
||||
public:
|
||||
|
||||
// MARK: - Types
|
||||
|
||||
///Shared pointer
|
||||
using Shared = std::shared_ptr<Project>;
|
||||
///Weak pointer
|
||||
using Weak = std::weak_ptr<Project>;
|
||||
///Project information
|
||||
struct Info {
|
||||
//The project name
|
||||
utility::String name;
|
||||
//The project ID
|
||||
utility::String ID;
|
||||
//Either local path or server URL where the project is stored (nullopt if memory-based only, i.e. unsaved)
|
||||
active::file::Path::Option path;
|
||||
//True if the project is shared (cloud-based)
|
||||
bool isShared = false;
|
||||
};
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
Project(const Project&) = delete;
|
||||
/*!
|
||||
Destructor
|
||||
*/
|
||||
~Project();
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get information about the project
|
||||
@return Project information
|
||||
*/
|
||||
Info getInfo() const;
|
||||
|
||||
// MARK: - Functions (mutating)
|
||||
|
||||
protected:
|
||||
friend class speckle::environment::Addon;
|
||||
|
||||
/*!
|
||||
Default constructor
|
||||
|
||||
NB: Only the Addon class can create projects. Clients can get the active project from the running add-on.
|
||||
*/
|
||||
Project();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //SPECKLE_ENVIRONMENT_PROJECT
|
||||
@@ -17,8 +17,9 @@ namespace speckle::event {
|
||||
|
||||
/*!
|
||||
Default constructor
|
||||
*/
|
||||
ProjectSubscriber() = default;
|
||||
@param priority The subscriber priority (determines the order in which subscribers receive events)
|
||||
*/
|
||||
ProjectSubscriber(int32_t priority = 0) : active::event::Subscriber{priority} {}
|
||||
/*!
|
||||
Copy constructor
|
||||
@param source The object to copy
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#include "Speckle/Event/Type/ProjectEvent.h"
|
||||
|
||||
using namespace speckle::event;
|
||||
|
||||
#ifdef ARCHICAD
|
||||
/*--------------------------------------------------------------------
|
||||
Convert an Archicad project event type
|
||||
|
||||
return: The equivalent Speckle event type
|
||||
--------------------------------------------------------------------*/
|
||||
std::optional<ProjectEvent::Type> ProjectEvent::convert(API_NotifyEventID acEventType) {
|
||||
using enum ProjectEvent::Type;
|
||||
switch (acEventType) {
|
||||
case APINotify_New:
|
||||
return newDocument;
|
||||
case APINotify_NewAndReset:
|
||||
return newAndReset;
|
||||
case APINotify_Open:
|
||||
return open;
|
||||
case APINotify_PreSave:
|
||||
return presave;
|
||||
case APINotify_Save:
|
||||
return save;
|
||||
case APINotify_Close:
|
||||
return close;
|
||||
case APINotify_Quit:
|
||||
return quit;
|
||||
case APINotify_TempSave:
|
||||
return tempSave;
|
||||
case APINotify_SendChanges:
|
||||
return send;
|
||||
case APINotify_ReceiveChanges:
|
||||
return receive;
|
||||
default:
|
||||
return std::nullopt;
|
||||
} //ProjectEvent::convert
|
||||
}
|
||||
#endif
|
||||
@@ -6,6 +6,10 @@
|
||||
#include "Active/Utility/Guid.h"
|
||||
#include "Active/Utility/String.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include <ACAPinc.h>
|
||||
#endif
|
||||
|
||||
namespace speckle::event {
|
||||
|
||||
/*!
|
||||
@@ -14,6 +18,23 @@ namespace speckle::event {
|
||||
class ProjectEvent : public active::event::Event {
|
||||
public:
|
||||
|
||||
// MARK: - Types
|
||||
|
||||
///Common project event types
|
||||
enum class Type {
|
||||
unknown,
|
||||
newDocument,
|
||||
newAndReset,
|
||||
open,
|
||||
presave,
|
||||
save,
|
||||
close,
|
||||
quit,
|
||||
tempSave,
|
||||
send,
|
||||
receive,
|
||||
};
|
||||
|
||||
static const inline active::utility::NameID ID{active::utility::String{"project event"},
|
||||
active::utility::Guid{active::utility::String{"0ffb9ec5-2164-4fc2-aa57-17b5a1f15355"}}};
|
||||
|
||||
@@ -30,15 +51,17 @@ namespace speckle::event {
|
||||
@param param An additional parameter relevant to some project events
|
||||
*/
|
||||
ProjectEvent(API_NotifyEventID notifyEvent, int32_t param) : Event{ID} {
|
||||
m_eventID = notifyEvent;
|
||||
m_eventID = convert(notifyEvent).value_or(Type::unknown);
|
||||
m_param = param;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Get the event type
|
||||
@return The event type
|
||||
*/
|
||||
API_NotifyEventID getType() const { return m_eventID; }
|
||||
Type getType() const { return m_eventID; }
|
||||
#ifdef ARCHICAD
|
||||
/*!
|
||||
Get the event parameter
|
||||
@return The event parameter
|
||||
@@ -46,10 +69,17 @@ namespace speckle::event {
|
||||
int32_t getParam() const { return m_param; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
///The event type
|
||||
Type m_eventID;
|
||||
#ifdef ARCHICAD
|
||||
//Incoming document objects to merge
|
||||
API_NotifyEventID m_eventID;
|
||||
///An additional event parameter
|
||||
int32_t m_param;
|
||||
/*!
|
||||
Convert an Archicad project event type
|
||||
@return The equivalent Speckle event type
|
||||
*/
|
||||
static std::optional<ProjectEvent::Type> convert(API_NotifyEventID acEventType);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -56,10 +56,10 @@ BrowserBridge::~BrowserBridge() {
|
||||
|
||||
return: The supported method names
|
||||
--------------------------------------------------------------------*/
|
||||
ValueSetting BrowserBridge::getMethodNames() const {
|
||||
ValueSetting result;
|
||||
std::vector<String> BrowserBridge::getMethodNames() const {
|
||||
std::vector<String> result;
|
||||
for (const auto& method : *m_methods)
|
||||
result.emplace_back(StringValue{method->getName()});
|
||||
result.emplace_back(method->getName());
|
||||
return result;
|
||||
} //BrowserBridge::getMethodNames
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace speckle::interfac::browser::bridge {
|
||||
Constructor
|
||||
@param name The JS object name
|
||||
*/
|
||||
BrowserBridge(const speckle::utility::String& name);
|
||||
BrowserBridge(const utility::String& name);
|
||||
/*!
|
||||
Destructor
|
||||
*/
|
||||
@@ -39,7 +39,7 @@ namespace speckle::interfac::browser::bridge {
|
||||
Get the names of the methods supported by this bridge
|
||||
@return The supported method names
|
||||
*/
|
||||
active::setting::ValueSetting getMethodNames() const;
|
||||
std::vector<utility::String> getMethodNames() const;
|
||||
/*!
|
||||
Get a browser method by name
|
||||
@return A pointer to the requested method (owner does not take ownership, nullptr = failure)
|
||||
|
||||
@@ -6,6 +6,7 @@ using namespace active::serialise;
|
||||
using namespace speckle::serialise::jsbase;
|
||||
using namespace speckle::interfac::browser;
|
||||
using namespace speckle::interfac::browser::bridge;
|
||||
using namespace speckle::utility;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Constructor
|
||||
@@ -14,8 +15,7 @@ using namespace speckle::interfac::browser::bridge;
|
||||
--------------------------------------------------------------------*/
|
||||
GetBindingsMethodNames::GetBindingsMethodNames() : JSFunction{"GetBindingsMethodNames", [&]() {
|
||||
return getMethodNames();
|
||||
}} {
|
||||
} //GetBindingsMethodNames::GetBindingsMethodNames
|
||||
}} {} //GetBindingsMethodNames::GetBindingsMethodNames
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define SPECKLE_INTERFACE_BRIDGE_GET_METHOD_NAMES
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
|
||||
#include "Active/Serialise/Package/Wrapper/ValueSettingWrap.h"
|
||||
#include "Speckle/Interface/Browser/PlatformBinding.h"
|
||||
#include "Speckle/Interface/Browser/JSFunction.h"
|
||||
@@ -9,9 +10,7 @@
|
||||
|
||||
namespace speckle::interfac::browser::bridge {
|
||||
|
||||
class BrowserBridge;
|
||||
|
||||
using WrappedValue = active::serialise::CargoHold<active::serialise::ValueSettingWrap, active::setting::ValueSetting>;
|
||||
using WrappedValue = active::serialise::CargoHold<active::serialise::ContainerWrap<std::vector<utility::String>>, std::vector<utility::String>>;
|
||||
|
||||
/*!
|
||||
JS Function class to retrieve the names of the methods supported by the bridge
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace {
|
||||
errorReport = ErrorReport{defaultError};
|
||||
errorReport->message = formattedErrorMessage(errorReport->message, argument);
|
||||
//Cache the error report to be sent back to the JS caller against the request ID
|
||||
bridge.cacheResult(std::make_unique<CargoHold<PackageWrap, ErrorReport>>(*errorReport), argument.getRequestID());
|
||||
bridge.cacheResult(std::make_unique<CargoHold<PackageWrap, ErrorReport>>(std::make_unique<ErrorReport>(*errorReport)), argument.getRequestID());
|
||||
} //executeMethod
|
||||
|
||||
|
||||
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#ifndef SPECKLE_RESOURCE
|
||||
#define SPECKLE_RESOURCE
|
||||
|
||||
//String resource IDs
|
||||
enum SpeckleStringResource {
|
||||
titleStringLib = 32700,
|
||||
generalStringLib,
|
||||
notifyStringLib,
|
||||
warningStringLib,
|
||||
errorStringLib,
|
||||
};
|
||||
|
||||
|
||||
//Title strings (UI title/label for dialogs, controls, menu items etc)
|
||||
enum SpeckleTitleString {
|
||||
untitledProjectID = 1,
|
||||
};
|
||||
|
||||
|
||||
//Help strings
|
||||
enum SpecklePromptString {
|
||||
};
|
||||
|
||||
|
||||
//Information strings (in UI content, logging, reports)
|
||||
enum SpeckleInfoString {
|
||||
};
|
||||
|
||||
|
||||
//Notification strings (advice displayed in alerts)
|
||||
enum SpeckleNotifyString {
|
||||
};
|
||||
|
||||
|
||||
//Warning strings (warnings displayed in alerts)
|
||||
enum SpeckleWarningString {
|
||||
};
|
||||
|
||||
|
||||
//Error strings (errors displayed in alerts)
|
||||
enum SpeckleErrorString {
|
||||
};
|
||||
|
||||
#endif //SPECKLE_RESOURCE
|
||||
@@ -15,6 +15,9 @@
|
||||
210CC89F2C81E34400610F58 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 210CC89D2C81E34400610F58 /* Platform.cpp */; };
|
||||
210CC8A02C81E34400610F58 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 210CC89E2C81E34400610F58 /* Platform.h */; };
|
||||
212A88132AE48821001EAFE7 /* libArchicad27.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 21379E082AE47A6400A1584C /* libArchicad27.a */; platformFilters = (macos, ); };
|
||||
215F08552C99DA8D00CD343B /* Project.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 215F08512C99DA8D00CD343B /* Project.cpp */; };
|
||||
215F08562C99DA8D00CD343B /* Project.h in Headers */ = {isa = PBXBuildFile; fileRef = 215F08542C99DA8D00CD343B /* Project.h */; };
|
||||
215F08662C9B006800CD343B /* ProjectEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 215F08652C9B006700CD343B /* ProjectEvent.cpp */; };
|
||||
2193517B2C624FC100E5A69C /* MenuSubscriber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 219351782C624FC100E5A69C /* MenuSubscriber.cpp */; };
|
||||
2193519B2C6278D900E5A69C /* SelectionSubscriber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 219351992C6278D900E5A69C /* SelectionSubscriber.cpp */; };
|
||||
219351B12C62CC1A00E5A69C /* Guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 219351AC2C62CC1A00E5A69C /* Guid.cpp */; };
|
||||
@@ -106,6 +109,11 @@
|
||||
21379E082AE47A6400A1584C /* libArchicad27.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libArchicad27.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
214EA4C52BA374FD008E5358 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
|
||||
214EA4C62BA3762D008E5358 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = SOURCE_ROOT; };
|
||||
215F08512C99DA8D00CD343B /* Project.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Project.cpp; sourceTree = "<group>"; };
|
||||
215F08542C99DA8D00CD343B /* Project.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Project.h; sourceTree = "<group>"; };
|
||||
215F085B2C9AE23200CD343B /* SpeckleResource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpeckleResource.h; sourceTree = "<group>"; };
|
||||
215F08622C9AE3D200CD343B /* Speckle.grc */ = {isa = PBXFileReference; lastKnownFileType = text; path = Speckle.grc; sourceTree = "<group>"; };
|
||||
215F08652C9B006700CD343B /* ProjectEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProjectEvent.cpp; sourceTree = "<group>"; };
|
||||
2167E2782C4911E2000827D3 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
|
||||
2167E2792C4911EB000827D3 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
|
||||
2167E27C2C49121F000827D3 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
|
||||
@@ -207,6 +215,7 @@
|
||||
21F69F1B2C6A0FE2008B6A06 /* Interface */,
|
||||
21F69F952C71087A008B6A06 /* Record */,
|
||||
212A834E2AE47AD9001EAFE7 /* Serialise */,
|
||||
215F085B2C9AE23200CD343B /* SpeckleResource.h */,
|
||||
219351B02C62CC1A00E5A69C /* Utility */,
|
||||
218953A32C0C9CB00078F182 /* Version.h */,
|
||||
);
|
||||
@@ -231,6 +240,7 @@
|
||||
21F69F012C66C229008B6A06 /* Doxyfile */,
|
||||
21379E092AE47A6400A1584C /* Products */,
|
||||
21329F472BFA611C00B5C7AF /* README.md */,
|
||||
215F08612C9AE3D200CD343B /* RINT */,
|
||||
212A83422AE47AD9001EAFE7 /* Speckle */,
|
||||
219987FA2BD708BC0035E5EA /* SpeckleLibDoctest */,
|
||||
);
|
||||
@@ -245,6 +255,14 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
215F08612C9AE3D200CD343B /* RINT */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
215F08622C9AE3D200CD343B /* Speckle.grc */,
|
||||
);
|
||||
path = RINT;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
218953A92C0F29FB0078F182 /* EventTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -281,6 +299,7 @@
|
||||
children = (
|
||||
21D0BDBE2C90F36B0077E104 /* DocStoreMergeEvent.h */,
|
||||
219351892C62655700E5A69C /* MenuEvent.h */,
|
||||
215F08652C9B006700CD343B /* ProjectEvent.cpp */,
|
||||
21D0BDC62C9245E40077E104 /* ProjectEvent.h */,
|
||||
2193519C2C627E3100E5A69C /* SelectionEvent.h */,
|
||||
);
|
||||
@@ -467,6 +486,8 @@
|
||||
21F93AE92B2F406D009A2C5B /* Addon.h */,
|
||||
210CC89D2C81E34400610F58 /* Platform.cpp */,
|
||||
210CC89E2C81E34400610F58 /* Platform.h */,
|
||||
215F08512C99DA8D00CD343B /* Project.cpp */,
|
||||
215F08542C99DA8D00CD343B /* Project.h */,
|
||||
21329F632BFD452C00B5C7AF /* Environment.md */,
|
||||
);
|
||||
path = Environment;
|
||||
@@ -491,6 +512,7 @@
|
||||
21B67D002C7CE15100FD64FC /* Exception.h in Headers */,
|
||||
21D0BD2C2C86FC350077E104 /* Record.h in Headers */,
|
||||
21D0BDB42C8F8AB60077E104 /* DocumentStoreCore.h in Headers */,
|
||||
215F08562C99DA8D00CD343B /* Project.h in Headers */,
|
||||
210CC8802C80CD2A00610F58 /* BridgeChild.h in Headers */,
|
||||
21D0BD4D2C8901A00077E104 /* ServerInfo.h in Headers */,
|
||||
21D0BDB52C8F8AB60077E104 /* DocumentStoreEngine.h in Headers */,
|
||||
@@ -626,6 +648,7 @@
|
||||
21F69F812C6FF3B0008B6A06 /* BridgeArgumentWrap.cpp in Sources */,
|
||||
2193517B2C624FC100E5A69C /* MenuSubscriber.cpp in Sources */,
|
||||
21F69F612C6D0286008B6A06 /* GetBindingsMethodNames.cpp in Sources */,
|
||||
215F08662C9B006800CD343B /* ProjectEvent.cpp in Sources */,
|
||||
21D0BDBD2C90F2830077E104 /* DocStoreSubscriber.cpp in Sources */,
|
||||
21D0BDB32C8F8AB60077E104 /* DocumentStoreCore.cpp in Sources */,
|
||||
21F93AEC2B2F406E009A2C5B /* Addon.cpp in Sources */,
|
||||
@@ -641,6 +664,7 @@
|
||||
219351B32C62CC1A00E5A69C /* String.cpp in Sources */,
|
||||
219351B12C62CC1A00E5A69C /* Guid.cpp in Sources */,
|
||||
21F69F512C6CCC25008B6A06 /* BrowserBridge.cpp in Sources */,
|
||||
215F08552C99DA8D00CD343B /* Project.cpp in Sources */,
|
||||
21F69F3B2C6B880C008B6A06 /* JSBaseTransport.cpp in Sources */,
|
||||
210CC89F2C81E34400610F58 /* Platform.cpp in Sources */,
|
||||
21D0BD202C86F0280077E104 /* AccountDatabase.cpp in Sources */,
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<ClInclude Include="Speckle\Database\Storage\DocumentStore\DocumentStoreEngine.h" />
|
||||
<ClInclude Include="Speckle\Environment\Addon.h" />
|
||||
<ClInclude Include="Speckle\Environment\Platform.h" />
|
||||
<ClInclude Include="Speckle\Environment\Project.h" />
|
||||
<ClInclude Include="Speckle\Event\Subscriber\DocStoreSubscriber.h" />
|
||||
<ClInclude Include="Speckle\Event\Subscriber\MenuSubscriber.h" />
|
||||
<ClInclude Include="Speckle\Event\Subscriber\ProjectSubscriber.h" />
|
||||
@@ -58,10 +59,12 @@
|
||||
<ClInclude Include="Speckle\Record\Credentials\ServerMigration.h" />
|
||||
<ClInclude Include="Speckle\Record\Credentials\UserInfo.h" />
|
||||
<ClInclude Include="Speckle\Serialise\JSBase\JSBaseTransport.h" />
|
||||
<ClInclude Include="Speckle\SpeckleResource.h" />
|
||||
<ClInclude Include="Speckle\Utility\Exception.h" />
|
||||
<ClInclude Include="Speckle\Utility\Guid.h" />
|
||||
<ClInclude Include="Speckle\Utility\Guid64.h" />
|
||||
<ClInclude Include="Speckle\Utility\String.h" />
|
||||
<ClInclude Include="Speckle\Version.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Speckle\Database\AccountDatabase.cpp" />
|
||||
@@ -70,10 +73,12 @@
|
||||
<ClCompile Include="Speckle\Database\Storage\DocumentStore\DocumentStoreCore.cpp" />
|
||||
<ClCompile Include="Speckle\Environment\Addon.cpp" />
|
||||
<ClCompile Include="Speckle\Environment\Platform.cpp" />
|
||||
<ClCompile Include="Speckle\Environment\Project.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Subscriber\DocStoreSubscriber.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Subscriber\MenuSubscriber.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Subscriber\ProjectSubscriber.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Subscriber\SelectionSubscriber.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Type\ProjectEvent.cpp" />
|
||||
<ClCompile Include="Speckle\Interface\Browser\Bridge\BridgeArgument.cpp" />
|
||||
<ClCompile Include="Speckle\Interface\Browser\Bridge\BridgeArgumentWrap.cpp" />
|
||||
<ClCompile Include="Speckle\Interface\Browser\Bridge\BrowserBridge.cpp" />
|
||||
@@ -97,6 +102,7 @@
|
||||
<Text Include="Speckle\Serialise\CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="RINT\Speckle.grc" />
|
||||
<None Include="Speckle\Environment\Environment.md" />
|
||||
<None Include="Speckle\Event\Event.md" />
|
||||
<None Include="Speckle\Serialise\Serialisation.md" />
|
||||
|
||||
@@ -193,6 +193,15 @@
|
||||
<ClInclude Include="Speckle\Database\Storage\DocumentStore\DocumentStoreEngine.h">
|
||||
<Filter>Speckle\Database\Storage\DocumentStore</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Speckle\Environment\Project.h">
|
||||
<Filter>Speckle\Environment</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Speckle\SpeckleResource.h">
|
||||
<Filter>Speckle</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Speckle\Version.h">
|
||||
<Filter>Speckle</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Speckle\Environment\Addon.cpp">
|
||||
@@ -270,6 +279,12 @@
|
||||
<ClCompile Include="Speckle\Database\Storage\DocumentStore\DocumentStoreCore.cpp">
|
||||
<Filter>Speckle\Database\Storage\DocumentStore</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Speckle\Environment\Project.cpp">
|
||||
<Filter>Speckle\Environment</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Speckle\Event\Type\ProjectEvent.cpp">
|
||||
<Filter>Speckle\Event\Type</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="Speckle\CMakeLists.txt">
|
||||
@@ -295,5 +310,8 @@
|
||||
<None Include="Speckle\Serialise\Serialisation.md">
|
||||
<Filter>Speckle\Serialise</Filter>
|
||||
</None>
|
||||
<None Include="RINT\Speckle.grc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user