From f662571bbe45cca21cb40ef110d37300bd466f58 Mon Sep 17 00:00:00 2001 From: spape Date: Mon, 31 May 2021 11:54:02 +0200 Subject: [PATCH 1/6] Adding "Linux Support" --- DTrackPlugin.uplugin | 4 ++-- Readme.md | 5 +---- Source/DTrackPlugin/Public/DTrackSDKHandler.h | 16 +++++++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/DTrackPlugin.uplugin b/DTrackPlugin.uplugin index 9c1ff21..c655f1c 100644 --- a/DTrackPlugin.uplugin +++ b/DTrackPlugin.uplugin @@ -17,12 +17,12 @@ { "Name": "DTrackPlugin", "Type": "Runtime", - "WhitelistPlatforms": [ "Win64" ] + "WhitelistPlatforms": [ "Win64" , "Linux" ] }, { "Name": "DTrackInput", "Type": "Runtime", - "WhitelistPlatforms": [ "Win64" ] + "WhitelistPlatforms": [ "Win64" , "Linux" ] } ], "Plugins": [ diff --git a/Readme.md b/Readme.md index 1292d0e..791ac9e 100644 --- a/Readme.md +++ b/Readme.md @@ -6,9 +6,6 @@ This is a plug-in for the Unreal Engine with the purpose of native integration o ## Prerequisites - Unreal Engine 4.23 or later -- Windows -- Microsoft Visual Studio 2015 or later (Express or Community Edition should suffice) - ## Installation @@ -17,7 +14,7 @@ This is a plug-in for the Unreal Engine with the purpose of native integration o - Adapt the _.uplugin_ file to the version of your _UnrealEditor_:
The `EngineVersion` key in the file _DTrackPlugin.uplugin_ comes with a default value corresponding to the latest tested _UE4Editor_ version (e.g. `"EngineVersion": "4.25.0"`).
If you are using an _UE4Editor_ version with a different minor version number (e.g. 4.23 instead of 4.25), you should adjust this value (e.g. to `"EngineVersion": "4.23.0"`). ### Install into the global Engine plugin folder -- Compile the plugin manually:
*<UE4Dir>\Engine\Build\BatchFiles\RunUAT.bat* BuildPlugin -Plugin=*/Path/to/DTrackPlugin.uplugin* -TargetPlatforms=Win64 -Package=*<OutDir>* -Rocket +- Compile the plugin manually:
*<UE4Dir>\Engine\Build\BatchFiles\RunUAT.bat* BuildPlugin -Plugin=*/Path/to/DTrackPlugin.uplugin* -TargetPlatforms=*<Win64/Linux>* -Package=*<OutDir>* -Rocket - Copy *<OutDir>* to *<UE4Dir>\Engine\Plugins\DTrackPlugin* diff --git a/Source/DTrackPlugin/Public/DTrackSDKHandler.h b/Source/DTrackPlugin/Public/DTrackSDKHandler.h index dec4fa2..3a2e206 100644 --- a/Source/DTrackPlugin/Public/DTrackSDKHandler.h +++ b/Source/DTrackPlugin/Public/DTrackSDKHandler.h @@ -28,12 +28,18 @@ #include "ILiveLinkSource.h" -// Avoid 'warning C4005' when including DTrackSDK -#include "Windows/AllowWindowsPlatformTypes.h" -#include "Windows/PreWindowsApi.h" +#if PLATFORM_WINDOWS + // Avoid 'warning C4005' when including DTrackSDK + #include "Windows/AllowWindowsPlatformTypes.h" + #include "Windows/PreWindowsApi.h" +#endif + #include "DTrackSDK.hpp" -#include "Windows/PostWindowsApi.h" -#include "Windows/HideWindowsPlatformTypes.h" + +#if PLATFORM_WINDOWS + #include "Windows/PostWindowsApi.h" + #include "Windows/HideWindowsPlatformTypes.h" +#endif #include "HAL/Runnable.h" #include "HAL/ThreadSafeBool.h" From 94e35c3db6a57ec8dc70562b125462c5ef4fde6d Mon Sep 17 00:00:00 2001 From: "RZ-WIN\\rolv" Date: Mon, 31 May 2021 14:26:54 +0200 Subject: [PATCH 2/6] Adding special Flystick buttons instead of Gamepad button mappings --- .../Private/DTrackFlystickInputDevice.cpp | 24 ++++++++-------- .../DTrackInput/Private/DTrackInputModule.cpp | 28 ++++++++++++++++++- .../DTrackInput/Private/DTrackInputModule.h | 19 ++++++++++++- 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/Source/DTrackInput/Private/DTrackFlystickInputDevice.cpp b/Source/DTrackInput/Private/DTrackFlystickInputDevice.cpp index 2cbdc9d..a4fa800 100644 --- a/Source/DTrackInput/Private/DTrackFlystickInputDevice.cpp +++ b/Source/DTrackInput/Private/DTrackFlystickInputDevice.cpp @@ -52,18 +52,18 @@ FDTrackFlystickInputDevice::FDTrackFlystickInputDevice(const TSharedRef< FGeneri ModularFeatures.OnModularFeatureRegistered().AddRaw(this, &FDTrackFlystickInputDevice::on_modular_feature_registerd); } - m_button_mapping.Add( EKeys::Gamepad_LeftTrigger.GetFName() ); - m_button_mapping.Add( EKeys::Gamepad_FaceButton_Bottom.GetFName() ); - m_button_mapping.Add( EKeys::Gamepad_FaceButton_Right.GetFName() ); - m_button_mapping.Add( EKeys::Gamepad_FaceButton_Left.GetFName() ); - m_button_mapping.Add( EKeys::Gamepad_FaceButton_Top.GetFName() ); - m_button_mapping.Add( EKeys::Gamepad_DPad_Up.GetFName() ); - m_button_mapping.Add( EKeys::Gamepad_DPad_Down.GetFName() ); - m_button_mapping.Add( EKeys::Gamepad_DPad_Right.GetFName() ); - m_button_mapping.Add( EKeys::Gamepad_DPad_Left.GetFName() ); - - m_joystick_mapping.Add( EKeys::Gamepad_LeftX.GetFName() ); - m_joystick_mapping.Add( EKeys::Gamepad_LeftY.GetFName() ); + m_button_mapping.Add( FDTrackInputModule::FlystickTrigger.GetFName() ); + m_button_mapping.Add( FDTrackInputModule::FlystickButton1.GetFName() ); + m_button_mapping.Add( FDTrackInputModule::FlystickButton2.GetFName() ); + m_button_mapping.Add( FDTrackInputModule::FlystickButton3.GetFName() ); + m_button_mapping.Add( FDTrackInputModule::FlystickButton4.GetFName() ); + m_button_mapping.Add( FDTrackInputModule::FlystickButton5.GetFName() ); + m_button_mapping.Add( FDTrackInputModule::FlystickButton6.GetFName() ); + m_button_mapping.Add( FDTrackInputModule::FlystickButton7.GetFName() ); + m_button_mapping.Add( FDTrackInputModule::FlystickButton8.GetFName() ); + + m_joystick_mapping.Add( FDTrackInputModule::FlystickThumbstickX.GetFName() ); + m_joystick_mapping.Add( FDTrackInputModule::FlystickThumbstickY.GetFName() ); } FDTrackFlystickInputDevice::~FDTrackFlystickInputDevice() { diff --git a/Source/DTrackInput/Private/DTrackInputModule.cpp b/Source/DTrackInput/Private/DTrackInputModule.cpp index df501e4..30e5f40 100644 --- a/Source/DTrackInput/Private/DTrackInputModule.cpp +++ b/Source/DTrackInput/Private/DTrackInputModule.cpp @@ -32,9 +32,35 @@ DEFINE_LOG_CATEGORY(LogDTrackInput); - +/* Keys */ +const FKey FDTrackInputModule::FlystickTrigger = FKey("Flystick_Trigger"); +const FKey FDTrackInputModule::FlystickButton1 = FKey("Flystick_Button_1"); +const FKey FDTrackInputModule::FlystickButton2 = FKey("Flystick_Button_2"); +const FKey FDTrackInputModule::FlystickButton3 = FKey("Flystick_Button_3"); +const FKey FDTrackInputModule::FlystickButton4 = FKey("Flystick_Button_4"); +const FKey FDTrackInputModule::FlystickButton5 = FKey("Flystick_Button_5"); +const FKey FDTrackInputModule::FlystickButton6 = FKey("Flystick_Button_6"); +const FKey FDTrackInputModule::FlystickButton7 = FKey("Flystick_Button_7"); +const FKey FDTrackInputModule::FlystickButton8 = FKey("Flystick_Button_8"); +/* Axis */ +const FKey FDTrackInputModule::FlystickThumbstickX = FKey("Flystick_Thumbstick_X"); +const FKey FDTrackInputModule::FlystickThumbstickY = FKey("Flystick_Thumbstick_Y"); TSharedPtr< class IInputDevice > FDTrackInputModule::CreateInputDevice(const TSharedRef< FGenericApplicationMessageHandler >& InMessageHandler) { + EKeys::AddMenuCategoryDisplayInfo(FlystickKeyCategory, FText::AsCultureInvariant("A.R.T. Flystick"), TEXT("GraphEditor.PadEvent_16x")); + + EKeys::AddKey(FKeyDetails(FlystickTrigger, FText::AsCultureInvariant("Flystick Trigger"), FKeyDetails::GamepadKey, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickButton1, FText::AsCultureInvariant("Flystick Button 1"), FKeyDetails::GamepadKey, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickButton2, FText::AsCultureInvariant("Flystick Button 2"), FKeyDetails::GamepadKey, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickButton3, FText::AsCultureInvariant("Flystick Button 3"), FKeyDetails::GamepadKey, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickButton4, FText::AsCultureInvariant("Flystick Button 4"), FKeyDetails::GamepadKey, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickButton5, FText::AsCultureInvariant("Flystick Button 5"), FKeyDetails::GamepadKey, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickButton6, FText::AsCultureInvariant("Flystick Button 6"), FKeyDetails::GamepadKey, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickButton7, FText::AsCultureInvariant("Flystick Button 7"), FKeyDetails::GamepadKey, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickButton8, FText::AsCultureInvariant("Flystick Button 8"), FKeyDetails::GamepadKey, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickThumbstickX, FText::AsCultureInvariant("Flystick Thumbstick X"), FKeyDetails::GamepadKey | FKeyDetails::Axis1D, FlystickKeyCategory)); + EKeys::AddKey(FKeyDetails(FlystickThumbstickY, FText::AsCultureInvariant("Flystick Thumbstick Y"), FKeyDetails::GamepadKey | FKeyDetails::Axis1D, FlystickKeyCategory)); + return TSharedPtr< class IInputDevice >(new FDTrackFlystickInputDevice(InMessageHandler)); } diff --git a/Source/DTrackInput/Private/DTrackInputModule.h b/Source/DTrackInput/Private/DTrackInputModule.h index d0c78e5..ed2ad90 100644 --- a/Source/DTrackInput/Private/DTrackInputModule.h +++ b/Source/DTrackInput/Private/DTrackInputModule.h @@ -28,6 +28,7 @@ #include "IDTrackInputModule.h" +#include "InputCoreTypes.h" class FDTrackFlystickInputDevice; class ILiveLinkClient; @@ -42,7 +43,23 @@ DECLARE_LOG_CATEGORY_EXTERN(LogDTrackInput, Log, All); class FDTrackInputModule : public IDTrackInputModule { public: - + + /* Category */ + const FName FlystickKeyCategory = FName("ART_Flystick"); + /* Keys */ + static const FKey FlystickTrigger; + static const FKey FlystickButton1; + static const FKey FlystickButton2; + static const FKey FlystickButton3; + static const FKey FlystickButton4; + static const FKey FlystickButton5; + static const FKey FlystickButton6; + static const FKey FlystickButton7; + static const FKey FlystickButton8; + /* Axis */ + static const FKey FlystickThumbstickX; + static const FKey FlystickThumbstickY; + //~ Begin IInputDeviceModule implementation virtual TSharedPtr< class IInputDevice > CreateInputDevice(const TSharedRef< FGenericApplicationMessageHandler >& InMessageHandler) override; //~ End IInputDeviceModule implementation From 885842d8d8c65483906fc470bab70952e9a0e5a2 Mon Sep 17 00:00:00 2001 From: ROLV Date: Thu, 9 Dec 2021 17:26:50 +0100 Subject: [PATCH 3/6] Fixing the re-appling of presets and re-starting of LiveLink --- .gitignore | 74 +++++++++++++++++++ DTrackPlugin.uplugin | 1 - .../Private/DTrackLiveLinkSource.cpp | 7 +- Source/DTrackPlugin/Private/DTrackPlugin.cpp | 7 +- .../Public/DTrackLiveLinkSource.h | 3 + 5 files changed, 84 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6582eaf --- /dev/null +++ b/.gitignore @@ -0,0 +1,74 @@ +# Visual Studio 2015 user specific files +.vs/ + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app +*.ipa + +# These project files can be generated by the engine +*.xcodeproj +*.xcworkspace +*.sln +*.suo +*.opensdf +*.sdf +*.VC.db +*.VC.opendb + +# Precompiled Assets +SourceArt/**/*.png +SourceArt/**/*.tga + +# Binary Files +Binaries/* +Plugins/*/Binaries/* + +# Builds +Build/* + +# Whitelist PakBlacklist-.txt files +!Build/*/ +Build/*/** +!Build/*/PakBlacklist*.txt + +# Don't ignore icon files in Build +!Build/**/*.ico + +# Built data for maps +*_BuiltData.uasset + +# Configuration files generated by the Editor +Saved/* + +# Compiled source files for the engine to use +Intermediate/* +Plugins/*/Intermediate/* + +# Cache files for the editor to use +DerivedDataCache/* diff --git a/DTrackPlugin.uplugin b/DTrackPlugin.uplugin index c655f1c..af216ee 100644 --- a/DTrackPlugin.uplugin +++ b/DTrackPlugin.uplugin @@ -10,7 +10,6 @@ "DocsURL": "https://github.com/ar-tracking/UnrealDTrackPlugin", "MarketplaceURL": "", "SupportURL": "https://ar-tracking.com/", - "EngineVersion": "4.25.0", "CanContainContent": false, "Installed" : true, "Modules": [ diff --git a/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp b/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp index b8c9393..3f0368e 100644 --- a/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp +++ b/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp @@ -29,6 +29,7 @@ #include "DTrackPlugin.h" #include "DTrackLiveLinkSourceSettings.h" #include "DTrackSDKHandler.h" +#include "DTrackLiveLinkRole.h" #include "ILiveLinkClient.h" #include "Misc/App.h" #include "Roles/LiveLinkAnimationRole.h" @@ -48,12 +49,15 @@ void FDTrackLiveLinkSource::ReceiveClient(ILiveLinkClient* InClient, FGuid InSou m_client = InClient; m_source_guid = InSourceGuid; - m_sdk_handler = MakeUnique(this); + if (!m_sdk_handler.IsValid()) { + m_sdk_handler = MakeUnique(this); + } } void FDTrackLiveLinkSource::InitializeSettings(ULiveLinkSourceSettings* InSettings) { m_source_settings = CastChecked(InSettings); + reset_datamaps(); m_sdk_handler->start_listening(m_source_settings->m_server_settings); } @@ -290,6 +294,7 @@ void FDTrackLiveLinkSource::reset_datamaps() { bool FDTrackLiveLinkSource::RequestSourceShutdown() { m_sdk_handler->Stop(); + reset_datamaps(); return true; } diff --git a/Source/DTrackPlugin/Private/DTrackPlugin.cpp b/Source/DTrackPlugin/Private/DTrackPlugin.cpp index 412f023..f50b230 100644 --- a/Source/DTrackPlugin/Private/DTrackPlugin.cpp +++ b/Source/DTrackPlugin/Private/DTrackPlugin.cpp @@ -65,14 +65,9 @@ TSharedPtr FDTrackPlugin::create_livelink_source() { if (!m_livelink_source.IsValid()) { m_livelink_source = MakeShared(); - return m_livelink_source; } - else { - return m_livelink_source; - } - - return nullptr; + return m_livelink_source; } void FDTrackPlugin::handle_app_pre_exit() { diff --git a/Source/DTrackPlugin/Public/DTrackLiveLinkSource.h b/Source/DTrackPlugin/Public/DTrackLiveLinkSource.h index 9c4d764..bc30b42 100644 --- a/Source/DTrackPlugin/Public/DTrackLiveLinkSource.h +++ b/Source/DTrackPlugin/Public/DTrackLiveLinkSource.h @@ -36,6 +36,9 @@ class FDTrackSDKHandler; class ILiveLinkClient; +/** +* Singleton class generated by FDTrackPlugin (DTrackPlugin.cpp) +*/ class DTRACKPLUGIN_API FDTrackLiveLinkSource : public ILiveLinkSource { public: From 805fed46141b960fc7b2ad11903c02566a858650 Mon Sep 17 00:00:00 2001 From: Sebi Date: Fri, 29 Apr 2022 16:39:52 +0200 Subject: [PATCH 4/6] Adding a function to fetch the body names from unreal First version, currently not tested --- .../DTrackPlugin/Private/DTrackLiveLinkSource.cpp | 13 +++++++++++-- Source/DTrackPlugin/Private/DTrackSDKHandler.cpp | 5 +++++ Source/DTrackPlugin/Public/DTrackSDKHandler.h | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp b/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp index 3f0368e..330b914 100644 --- a/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp +++ b/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp @@ -121,8 +121,18 @@ void FDTrackLiveLinkSource::handle_body_data_anythread(double n_worldtime, doubl } else { + FString subject_name; + std::string body_name = ""; + if(m_sdk_handler->get_body_name(n_itemId, body_name)) + { + subject_name = UTF8_TO_TCHAR(body_name.c_str()); + } + else + { + subject_name = FString::Printf(TEXT("DTrack-Body-%02d"), n_itemId); + } + //Body data always consists of Location and Rotation. No need to make verification to resend static data - const FString subject_name = FString::Printf(TEXT("DTrack-Body-%02d"), n_itemId); key = FLiveLinkSubjectKey(m_source_guid, *subject_name); m_body_subjects.Add(n_itemId, key); @@ -213,7 +223,6 @@ void FDTrackLiveLinkSource::handle_flystick_input_anythread(double n_worldtime, } } else { - const FString subject_name = FString::Printf(TEXT("DTrack-FlystickInput-%02d"), n_itemId); key = FLiveLinkSubjectKey(m_source_guid, *subject_name); m_flystick_input_subjects.Add(n_itemId, key); diff --git a/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp b/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp index e0f3f13..d735abb 100644 --- a/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp +++ b/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp @@ -94,6 +94,11 @@ void FDTrackSDKHandler::stop_listening() { } } +bool FDTrackSDKHandler::get_body_name(uint32 body_index, std::string body_name) +{ + return m_dtrack->getParam(TCHAR_TO_UTF8(*FString::Printf(TEXT("body desc standard b%02d"), body_index)), body_name); +} + bool FDTrackSDKHandler::is_active() const { return m_is_active; } diff --git a/Source/DTrackPlugin/Public/DTrackSDKHandler.h b/Source/DTrackPlugin/Public/DTrackSDKHandler.h index 3a2e206..45ceed1 100644 --- a/Source/DTrackPlugin/Public/DTrackSDKHandler.h +++ b/Source/DTrackPlugin/Public/DTrackSDKHandler.h @@ -67,6 +67,9 @@ class DTRACKPLUGIN_API FDTrackSDKHandler : public FRunnable // Stops the server listening thread if any and stop measurements on the SDK void stop_listening(); + // Get the name for a specific body index + bool get_body_name(uint32 body_index, std::string body_name); + public: // Returns true if connection to server is active From 2f69b38e22521bbdfc52050dfe204f4de02402e5 Mon Sep 17 00:00:00 2001 From: ROLV Date: Tue, 3 May 2022 12:14:27 +0200 Subject: [PATCH 5/6] Fixing the starting and body name retrieval --- Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp | 3 ++- Source/DTrackPlugin/Private/DTrackSDKHandler.cpp | 4 ++-- Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h | 6 +++--- Source/DTrackPlugin/Public/DTrackSDKHandler.h | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp b/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp index 330b914..e7ab51b 100644 --- a/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp +++ b/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp @@ -125,11 +125,12 @@ void FDTrackLiveLinkSource::handle_body_data_anythread(double n_worldtime, doubl std::string body_name = ""; if(m_sdk_handler->get_body_name(n_itemId, body_name)) { + body_name.erase(std::remove(body_name.begin(), body_name.end(), '\"'), body_name.end()); //Removing quotes subject_name = UTF8_TO_TCHAR(body_name.c_str()); } else { - subject_name = FString::Printf(TEXT("DTrack-Body-%02d"), n_itemId); + subject_name = FString::Printf(TEXT("Unknown-DTrack-Body-%02d"), n_itemId); } //Body data always consists of Location and Rotation. No need to make verification to resend static data diff --git a/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp b/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp index d735abb..8eef0fc 100644 --- a/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp +++ b/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp @@ -94,9 +94,9 @@ void FDTrackSDKHandler::stop_listening() { } } -bool FDTrackSDKHandler::get_body_name(uint32 body_index, std::string body_name) +bool FDTrackSDKHandler::get_body_name(uint32 body_index, std::string& body_name) { - return m_dtrack->getParam(TCHAR_TO_UTF8(*FString::Printf(TEXT("body desc standard b%02d"), body_index)), body_name); + return m_dtrack->getParam(TCHAR_TO_UTF8(*FString::Printf(TEXT("body desc standard b%02d"), body_index + 1)), body_name); } bool FDTrackSDKHandler::is_active() const { diff --git a/Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h b/Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h index 3eaaba4..4f56da8 100644 --- a/Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h +++ b/Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h @@ -58,13 +58,13 @@ struct FDTrackServerSettings UPROPERTY(EditAnywhere, Category = "Server Settings", meta = (DisplayName = "DTrack Data Port", ToolTip = "Port your server sends data to")) int32 m_dtrack_server_port = 5000; - //UPROPERTY(EditAnywhere, Category = "Server Settings", meta = (DisplayName = "Start DTrack Measurement", ToolTip = "Start measurement via the DTrack2 TCP command channel")) + UPROPERTY(EditAnywhere, Category = "Server Settings", meta = (DisplayName = "Start DTrack Measurement", ToolTip = "Start measurement via the DTrack2 TCP command channel")) bool m_dtrack_start_mea = false; - //UPROPERTY(EditAnywhere, Category = "Server Settings", meta = (DisplayName = "DTrack Server IP", ToolTip = "IP of DTrack server host for starting measurement")) + UPROPERTY(EditAnywhere, Category = "Server Settings", meta = (DisplayName = "DTrack Server IP", ToolTip = "IP of DTrack server host for starting measurement")) FString m_dtrack_server_ip = "127.0.0.1"; - //UPROPERTY(EditAnywhere, Category = "Server Settings", meta = (DisplayName = "DTrack Room Calibration", ToolTip = "Set this according to your DTrack system's room calibration")) + UPROPERTY(EditAnywhere, Category = "Server Settings", meta = (DisplayName = "DTrack Room Calibration", ToolTip = "Set this according to your DTrack system's room calibration")) EDTrackCoordinateSystemType m_coordinate_system = EDTrackCoordinateSystemType::CST_Unreal_Adapted; }; diff --git a/Source/DTrackPlugin/Public/DTrackSDKHandler.h b/Source/DTrackPlugin/Public/DTrackSDKHandler.h index 45ceed1..7b0d020 100644 --- a/Source/DTrackPlugin/Public/DTrackSDKHandler.h +++ b/Source/DTrackPlugin/Public/DTrackSDKHandler.h @@ -68,7 +68,7 @@ class DTRACKPLUGIN_API FDTrackSDKHandler : public FRunnable void stop_listening(); // Get the name for a specific body index - bool get_body_name(uint32 body_index, std::string body_name); + bool get_body_name(uint32 body_index, std::string& body_name); public: From 7d0a3e52b8ceab4448359ed738f712b6290a7526 Mon Sep 17 00:00:00 2001 From: Sebi Date: Wed, 4 May 2022 14:58:03 +0200 Subject: [PATCH 6/6] Allowing to open the TCP connection without actually using it to start the measurement. Attention, this plugin still blocks the DTrack2 software from connecting to the controller. --- Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp | 2 +- Source/DTrackPlugin/Private/DTrackSDKHandler.cpp | 6 +++--- Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp b/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp index e7ab51b..9780f01 100644 --- a/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp +++ b/Source/DTrackPlugin/Private/DTrackLiveLinkSource.cpp @@ -130,7 +130,7 @@ void FDTrackLiveLinkSource::handle_body_data_anythread(double n_worldtime, doubl } else { - subject_name = FString::Printf(TEXT("Unknown-DTrack-Body-%02d"), n_itemId); + subject_name = FString::Printf(TEXT("DTrack-Body-%02d"), n_itemId); } //Body data always consists of Location and Rotation. No need to make verification to resend static data diff --git a/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp b/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp index 8eef0fc..a42662f 100644 --- a/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp +++ b/Source/DTrackPlugin/Private/DTrackSDKHandler.cpp @@ -193,12 +193,12 @@ uint32 FDTrackSDKHandler::Run() { m_is_connecting = true; - if (CopiedSettings.m_dtrack_start_mea) { - UE_LOG(LogDTrackPlugin, Verbose, TEXT("Connecting to DTrack2 server with IP '%s' on port '%d'."), *CopiedSettings.m_dtrack_server_ip, m_server_settings.m_dtrack_server_port); + if (!CopiedSettings.m_dtrack_server_ip.IsEmpty()) { + UE_LOG(LogDTrackPlugin, Verbose, TEXT("Connecting to DTrack2 server with IP '%s' and listening on port '%d'."), *CopiedSettings.m_dtrack_server_ip, m_server_settings.m_dtrack_server_port); m_dtrack = MakeUnique(TCHAR_TO_UTF8(*CopiedSettings.m_dtrack_server_ip), CopiedSettings.m_dtrack_server_port); } else { - UE_LOG(LogDTrackPlugin, Verbose, TEXT("Connecting to DTrack server on port '%d'."), CopiedSettings.m_dtrack_server_port); + UE_LOG(LogDTrackPlugin, Verbose, TEXT("Listening to DTrack on port '%d'."), CopiedSettings.m_dtrack_server_port); m_dtrack = MakeUnique(CopiedSettings.m_dtrack_server_port); } diff --git a/Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h b/Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h index 4f56da8..f876438 100644 --- a/Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h +++ b/Source/DTrackPlugin/Public/DTrackLiveLinkSourceSettings.h @@ -62,7 +62,7 @@ struct FDTrackServerSettings bool m_dtrack_start_mea = false; UPROPERTY(EditAnywhere, Category = "Server Settings", meta = (DisplayName = "DTrack Server IP", ToolTip = "IP of DTrack server host for starting measurement")) - FString m_dtrack_server_ip = "127.0.0.1"; + FString m_dtrack_server_ip = ""; UPROPERTY(EditAnywhere, Category = "Server Settings", meta = (DisplayName = "DTrack Room Calibration", ToolTip = "Set this according to your DTrack system's room calibration")) EDTrackCoordinateSystemType m_coordinate_system = EDTrackCoordinateSystemType::CST_Unreal_Adapted;