diff --git a/.clang-format b/.clang-format deleted file mode 100644 index 54332ba..0000000 --- a/.clang-format +++ /dev/null @@ -1,105 +0,0 @@ -BasedOnStyle: WebKit - -AllowAllArgumentsOnNextLine: true -BreakConstructorInitializers: BeforeComma -BreakInheritanceList: BeforeComma -ReflowComments: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false - -AccessModifierOffset: -2 -AlignAfterOpenBracket: AlwaysBreak -AlignEscapedNewlinesLeft: true -AlignOperands: true -AlignTrailingComments: true -AlignConsecutiveDeclarations: false -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: Inline -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: false -AlwaysBreakBeforeMultilineStrings: true -AlwaysBreakTemplateDeclarations: true - -BraceWrapping: - AfterClass: true - AfterControlStatement: true - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterStruct: true - AfterUnion: true - BeforeCatch: true - BeforeElse: true - IndentBraces: false - -BinPackArguments: false -BinPackParameters: false -ExperimentalAutoDetectBinPacking: false -AllowAllParametersOfDeclarationOnNextLine: false -BreakBeforeBinaryOperators: All -BreakBeforeBraces: Allman -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: true -ColumnLimit: 79 -CommentPragmas: '^ IWYU pragma:' -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: false -IndentCaseLabels: true -IndentWidth: 2 -IndentWrappedFunctionNames: false -KeepEmptyLinesAtTheStartOfBlocks: true -Language: Cpp -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Left -SpaceAfterCStyleCast: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInCStyleCastParentheses: false -SpacesInContainerLiterals: true -SpacesInParentheses: false -SpacesInSquareBrackets: false -SpaceBeforeCpp11BracedList: false -Standard: c++20 -TabWidth: 2 -UseTab: Never -CommentPragmas: '^ clang-format:' -StatementMacros: ['E_SIGNAL', 'PROPERTY', 'W_SIGNAL', 'W_PROPERTY', 'W_SLOT'] -SortIncludes: true -IncludeBlocks: Regroup -IncludeCategories: - - Regex: '^"' - Priority: 1 - - Regex: '^<(Vst|Vst3|Audio|Magnetism|Control|ControlSurface|RemoteScenario|Explorer|Protocols|Process|State|Device|Media|Midi|JS|Curve|Inspector|Automation|Dataflow|Fx|Library|Mapping|Loop|Recording|PluginSettings|Gfx|Nodal|Pd|LV2|Mixer|Video|Effect|Execution|Engine|LocalTree)' - Priority: 2 - - Regex: '^' - Priority: 9 - - Regex: '<[[:alnum:]]+>' - Priority: 800 - diff --git a/3rdparty/OrbbecSDK_v2 b/3rdparty/OrbbecSDK_v2 new file mode 160000 index 0000000..a798662 --- /dev/null +++ b/3rdparty/OrbbecSDK_v2 @@ -0,0 +1 @@ +Subproject commit a798662ed637a41d165cd63dee1022127a49db5a diff --git a/CMakeLists.txt b/CMakeLists.txt index a49bcb8..59fab3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,31 +1,40 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) +if(NOT (WIN32 OR APPLE OR LINUX)) + return() +endif() + if(NOT TARGET score_lib_base) include("${SCORE_SOURCE_DIR}/cmake/ScoreExternalAddon.cmake") endif() project(score_addon_orbbec LANGUAGES CXX) +set(OB_BUILD_EXAMPLES 0) +set(OB_BUILD_TESTS 0) +set(OB_BUILD_DOCS 0) +set(OB_BUILD_TOOLS 0) +add_subdirectory(3rdparty/OrbbecSDK_v2 SYSTEM) + # General initialization score_common_setup() # Creation of the library add_library(score_addon_orbbec - Orbbec/Device.cpp - Orbbec/Device.hpp - Orbbec/ProtocolFactory.cpp - Orbbec/ProtocolFactory.hpp - Orbbec/ProtocolSettingsWidget.cpp - Orbbec/ProtocolSettingsWidget.hpp - Orbbec/SpecificSettings.hpp - Orbbec/SpecificSettingsSerialization.cpp + Orbbec/OrbbecInputDevice.hpp + Orbbec/OrbbecInputDevice.cpp score_addon_orbbec.hpp score_addon_orbbec.cpp ) # Link -target_link_libraries(score_addon_orbbec PUBLIC score_plugin_engine) +target_link_libraries(score_addon_orbbec PUBLIC + score_plugin_engine + score_plugin_media + score_plugin_gfx + ob::OrbbecSDK +) # Target-specific options setup_score_plugin(score_addon_orbbec) diff --git a/Orbbec/ApplicationPlugin.cpp b/Orbbec/ApplicationPlugin.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Orbbec/ApplicationPlugin.hpp b/Orbbec/ApplicationPlugin.hpp new file mode 100644 index 0000000..2c71aaf --- /dev/null +++ b/Orbbec/ApplicationPlugin.hpp @@ -0,0 +1,17 @@ +#pragma once +#include + +#include + +namespace Gfx::Orbbec +{ +class ApplicationPlugin + : public QObject + , public score::GUIApplicationPlugin +{ +public: + using GUIApplicationPlugin::GUIApplicationPlugin; + + ob::Context orbbec; +}; +} diff --git a/Orbbec/Device.cpp b/Orbbec/Device.cpp deleted file mode 100644 index 7e9dcd8..0000000 --- a/Orbbec/Device.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "Device.hpp" - -#include "SpecificSettings.hpp" - -#include - -#include - -#include -#include - -#include - -#include - -W_OBJECT_IMPL(Orbbec::DeviceImplementation) - -namespace Orbbec -{ -DeviceImplementation::DeviceImplementation( - const Device::DeviceSettings& settings, - const Explorer::DeviceDocumentPlugin& plugin, - const score::DocumentContext&) - : OwningDeviceInterface{settings} - , m_ctx{plugin} -{ - m_capas.canRefreshTree = true; - m_capas.canAddNode = false; - m_capas.canRemoveNode = false; - m_capas.canRenameNode = false; - m_capas.canSetProperties = false; - m_capas.canSerialize = false; -} - -DeviceImplementation::~DeviceImplementation() { } - -bool DeviceImplementation::reconnect() -{ - disconnect(); - - try - { - const auto& set - = m_settings.deviceSpecificSettings.value(); - qDebug() << "Orbbec created with: " << set.control; - - // Needed by most protocols: - auto& ctx = m_ctx.networkContext(); - - auto protocol = std::make_unique(); - auto dev = std::make_unique( - std::move(protocol), settings().name.toStdString()); - - m_dev = std::move(dev); - deviceChanged(nullptr, m_dev.get()); - } - catch (const std::runtime_error& e) - { - qDebug() << "Orbbec error: " << e.what(); - } - catch (...) - { - qDebug() << "Orbbec error"; - } - - return connected(); -} - -void DeviceImplementation::disconnect() -{ - OwningDeviceInterface::disconnect(); -} -} \ No newline at end of file diff --git a/Orbbec/Device.hpp b/Orbbec/Device.hpp deleted file mode 100644 index 2a08ccb..0000000 --- a/Orbbec/Device.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include - -namespace Explorer -{ -class DeviceDocumentPlugin; -} - -namespace Orbbec -{ -class DeviceImplementation final : public Device::OwningDeviceInterface -{ - W_OBJECT(DeviceImplementation) -public: - DeviceImplementation( - const Device::DeviceSettings& settings, - const Explorer::DeviceDocumentPlugin& plugin, - const score::DocumentContext& ctx); - ~DeviceImplementation(); - - bool reconnect() override; - void disconnect() override; - -private: - const Explorer::DeviceDocumentPlugin& m_ctx; -}; -} \ No newline at end of file diff --git a/Orbbec/OrbbecInputDevice.cpp b/Orbbec/OrbbecInputDevice.cpp new file mode 100644 index 0000000..c9317c8 --- /dev/null +++ b/Orbbec/OrbbecInputDevice.cpp @@ -0,0 +1,382 @@ +#include "OrbbecInputDevice.hpp" + +#include "Orbbec/ApplicationPlugin.hpp" + +#include + +#include +#include +#include +#include