diff --git a/Source/MobuLiveLinkPlugin2016.Build.cs b/Source/MobuLiveLinkPlugin2016.Build.cs index f47f6701..edb917fb 100644 --- a/Source/MobuLiveLinkPlugin2016.Build.cs +++ b/Source/MobuLiveLinkPlugin2016.Build.cs @@ -5,6 +5,10 @@ public class MobuLiveLinkPlugin2016 : MobuLiveLinkPluginBase { + readonly private string pythonFullVersion = "2.7.6"; + public override string PythonFullVersion => pythonFullVersion; + readonly private string pythonVersion = "27"; + public override string PythonVersion => pythonVersion; public MobuLiveLinkPlugin2016(ReadOnlyTargetRules Target) : base(Target, "2016") { } diff --git a/Source/MobuLiveLinkPlugin2017.Build.cs b/Source/MobuLiveLinkPlugin2017.Build.cs index 2af6f30a..9dc47bb8 100644 --- a/Source/MobuLiveLinkPlugin2017.Build.cs +++ b/Source/MobuLiveLinkPlugin2017.Build.cs @@ -5,12 +5,41 @@ public abstract class MobuLiveLinkPluginBase : ModuleRules { + private string version; + public string Version + { + get { return version; } + set { version = value; } + } + abstract public string PythonFullVersion + { + get; + } + abstract public string PythonVersion + { + get; + } + + private string moBuInstallFolder; + public string MotionBuilderInstallFolder + { + get { return moBuInstallFolder; } + set { moBuInstallFolder = value; } + } + + private string moBuOpenRealitySDK; + public string MotionBuilderOpenRealitySDK + { + get { return moBuOpenRealitySDK; } + set { moBuOpenRealitySDK = value; } + } public MobuLiveLinkPluginBase(ReadOnlyTargetRules Target, string MobuVersionString) : base(Target) { PrivatePCHHeaderFile = "Private/MobuLiveLinkPluginPrivatePCH.h"; bEnforceIWYU = false; bUseRTTI = true; + PrivateIncludePaths.AddRange(new string[] { @@ -36,11 +65,15 @@ public MobuLiveLinkPluginBase(ReadOnlyTargetRules Target, string MobuVersionStri { //UE_MOTIONBUILDER2017_INSTALLATIONFOLDER string MobuInstallFolder = System.Environment.GetEnvironmentVariable("UE_MOTIONBUILDER" + MobuVersionString + "_INSTALLATIONFOLDER"); + if (string.IsNullOrEmpty(MobuInstallFolder)) { MobuInstallFolder = @"C:\Program Files\Autodesk\MotionBuilder " + MobuVersionString; } + MotionBuilderInstallFolder = MobuInstallFolder; + // now MobuInstallFolder is actually MotionBuilder's SDK folder MobuInstallFolder = Path.Combine(MobuInstallFolder, "OpenRealitySDK"); + MotionBuilderOpenRealitySDK = MobuInstallFolder; if (!Directory.Exists(MobuInstallFolder)) { @@ -67,10 +100,35 @@ public MobuLiveLinkPluginBase(ReadOnlyTargetRules Target, string MobuVersionStri } } } + public void IncludePyFbSdkVersionSpecific() + { + if (Directory.Exists(MotionBuilderOpenRealitySDK)) + { + string pyFbSdkIncludeFolder = Path.Combine(MotionBuilderOpenRealitySDK, "include\\pyfbsdk"); + string pythonBoostIncludeFolder = Path.Combine(MotionBuilderOpenRealitySDK, "include\\boost"); + string pythonIncludeFolder = Path.Combine(MotionBuilderOpenRealitySDK, $"include\\python-{PythonFullVersion}\\include"); + PrivateIncludePaths.Add(pyFbSdkIncludeFolder); + PrivateIncludePaths.Add(pythonBoostIncludeFolder); + PrivateIncludePaths.Add(pythonIncludeFolder); + if (Target.Platform == UnrealTargetPlatform.Win64) + { + string LibDir = Path.Combine(MotionBuilderOpenRealitySDK, "lib\\x64"); + PublicAdditionalLibraries.Add(Path.Combine(LibDir, $"boost_python{PythonVersion}.lib")); + string pyFbSdkLibDir = Path.Combine(MotionBuilderOpenRealitySDK, $"lib\\x64\\python{PythonVersion}"); + PublicAdditionalLibraries.Add(Path.Combine(pyFbSdkLibDir, "pyfbsdk.lib")); + } + PrivateDefinitions.Add("MOBU_PYTHON_PLUGIN"); + PrivateDefinitions.Add($"FBPYTHON_VERSION={PythonVersion}"); + } + } } public class MobuLiveLinkPlugin2017 : MobuLiveLinkPluginBase { + readonly private string pythonFullVersion = "2.7.6"; + public override string PythonFullVersion => pythonFullVersion; + readonly private string pythonVersion = "27"; + public override string PythonVersion => pythonVersion; public MobuLiveLinkPlugin2017(ReadOnlyTargetRules Target) : base(Target, "2017") { } diff --git a/Source/MobuLiveLinkPlugin2017.Target.cs b/Source/MobuLiveLinkPlugin2017.Target.cs index 11eb1364..76e4a310 100644 --- a/Source/MobuLiveLinkPlugin2017.Target.cs +++ b/Source/MobuLiveLinkPlugin2017.Target.cs @@ -3,7 +3,7 @@ using UnrealBuildTool; using System; using System.IO; -using Tools.DotNETCommon; +using EpicGames.Core; using System.Runtime.CompilerServices; [SupportedPlatforms(UnrealPlatformClass.Desktop)] diff --git a/Source/MobuLiveLinkPlugin2018.Build.cs b/Source/MobuLiveLinkPlugin2018.Build.cs index b9d18ed9..23d6ee50 100644 --- a/Source/MobuLiveLinkPlugin2018.Build.cs +++ b/Source/MobuLiveLinkPlugin2018.Build.cs @@ -5,6 +5,10 @@ public class MobuLiveLinkPlugin2018 : MobuLiveLinkPluginBase { + readonly private string pythonFullVersion = "2.7.6"; + public override string PythonFullVersion => pythonFullVersion; + readonly private string pythonVersion = "27"; + public override string PythonVersion => pythonVersion; public MobuLiveLinkPlugin2018(ReadOnlyTargetRules Target) : base(Target, "2018") { } diff --git a/Source/MobuLiveLinkPlugin2019.Build.cs b/Source/MobuLiveLinkPlugin2019.Build.cs index a1cfa58a..6e25756a 100644 --- a/Source/MobuLiveLinkPlugin2019.Build.cs +++ b/Source/MobuLiveLinkPlugin2019.Build.cs @@ -5,6 +5,10 @@ public class MobuLiveLinkPlugin2019 : MobuLiveLinkPluginBase { + readonly private string pythonFullVersion = "2.7.11"; + public override string PythonFullVersion => pythonFullVersion; + readonly private string pythonVersion = "27"; + public override string PythonVersion => pythonVersion; public MobuLiveLinkPlugin2019(ReadOnlyTargetRules Target) : base(Target, "2019") { } diff --git a/Source/MobuLiveLinkPlugin2020.Build.cs b/Source/MobuLiveLinkPlugin2020.Build.cs index 8985cad0..327246aa 100644 --- a/Source/MobuLiveLinkPlugin2020.Build.cs +++ b/Source/MobuLiveLinkPlugin2020.Build.cs @@ -5,6 +5,10 @@ public class MobuLiveLinkPlugin2020 : MobuLiveLinkPluginBase { + readonly private string pythonFullVersion = "2.7.11"; + public override string PythonFullVersion => pythonFullVersion; + readonly private string pythonVersion = "27"; + public override string PythonVersion => pythonVersion; public MobuLiveLinkPlugin2020(ReadOnlyTargetRules Target) : base(Target, "2020") { } diff --git a/Source/MobuLiveLinkPlugin2022.Build.cs b/Source/MobuLiveLinkPlugin2022.Build.cs index af16378c..4e8bb520 100644 --- a/Source/MobuLiveLinkPlugin2022.Build.cs +++ b/Source/MobuLiveLinkPlugin2022.Build.cs @@ -5,8 +5,13 @@ public class MobuLiveLinkPlugin2022 : MobuLiveLinkPluginBase { + readonly private string pythonFullVersion = "3.7.7"; + public override string PythonFullVersion => pythonFullVersion; + readonly private string pythonVersion = "37"; + public override string PythonVersion => pythonVersion; public MobuLiveLinkPlugin2022(ReadOnlyTargetRules Target) : base(Target, "2022") { CppStandard = CppStandardVersion.Cpp17; + IncludePyFbSdkVersionSpecific(); } } diff --git a/Source/MobuLiveLinkPlugin2022.Target.cs b/Source/MobuLiveLinkPlugin2022.Target.cs index 7e6249c5..2fc5abca 100644 --- a/Source/MobuLiveLinkPlugin2022.Target.cs +++ b/Source/MobuLiveLinkPlugin2022.Target.cs @@ -7,5 +7,6 @@ public class MobuLiveLinkPlugin2022Target : MobuLiveLinkPluginTargetBase { public MobuLiveLinkPlugin2022Target(TargetInfo Target) : base(Target, "2022") - {} + { + } } \ No newline at end of file diff --git a/Source/MobuLiveLinkPlugin2023.Build.cs b/Source/MobuLiveLinkPlugin2023.Build.cs new file mode 100644 index 00000000..fbd4d3f3 --- /dev/null +++ b/Source/MobuLiveLinkPlugin2023.Build.cs @@ -0,0 +1,16 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +using UnrealBuildTool; +using System.IO; + +public class MobuLiveLinkPlugin2023 : MobuLiveLinkPluginBase +{ + readonly private string pythonFullVersion = "3.9.7"; + public override string PythonFullVersion => pythonFullVersion; + readonly private string pythonVersion = "39"; + public override string PythonVersion => pythonVersion; + public MobuLiveLinkPlugin2023(ReadOnlyTargetRules Target) : base(Target, "2023") + { + CppStandard = CppStandardVersion.Cpp17; + } +} diff --git a/Source/MobuLiveLinkPlugin2023.Target.cs b/Source/MobuLiveLinkPlugin2023.Target.cs new file mode 100644 index 00000000..8badfc5f --- /dev/null +++ b/Source/MobuLiveLinkPlugin2023.Target.cs @@ -0,0 +1,11 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +using UnrealBuildTool; +using System.Collections.Generic; +using System.IO; + +public class MobuLiveLinkPlugin2023Target : MobuLiveLinkPluginTargetBase +{ + public MobuLiveLinkPlugin2023Target(TargetInfo Target) : base(Target, "2023") + {} +} \ No newline at end of file diff --git a/Source/Private/MobuLiveLink.cpp b/Source/Private/MobuLiveLink.cpp index b25d174c..ee8fc47e 100644 --- a/Source/Private/MobuLiveLink.cpp +++ b/Source/Private/MobuLiveLink.cpp @@ -1,4 +1,4 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +// Copyright Epic Games, Inc. All Rights Reserved. #include "RequiredProgramMainCPPInclude.h" #include "MobuLiveLinkCommon.h" diff --git a/Source/Public/MobuLiveLinkCommon.h b/Source/Public/MobuLiveLinkCommon.h index d7cc893c..118dd960 100644 --- a/Source/Public/MobuLiveLinkCommon.h +++ b/Source/Public/MobuLiveLinkCommon.h @@ -1,4 +1,4 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +// Copyright Epic Games, Inc. All Rights Reserved. #pragma once diff --git a/Source/StreamObjects/Private/EditorActiveCameraStreamObject.cpp b/Source/StreamObjects/Private/EditorActiveCameraStreamObject.cpp index 1772bc02..a0c02385 100644 --- a/Source/StreamObjects/Private/EditorActiveCameraStreamObject.cpp +++ b/Source/StreamObjects/Private/EditorActiveCameraStreamObject.cpp @@ -1,4 +1,4 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +// Copyright Epic Games, Inc. All Rights Reserved. #include "EditorActiveCameraStreamObject.h" #include "MobuLiveLinkUtilities.h" diff --git a/Source/StreamObjects/Private/ModelStreamObject.cpp b/Source/StreamObjects/Private/ModelStreamObject.cpp index 79650da9..ab39fbd5 100644 --- a/Source/StreamObjects/Private/ModelStreamObject.cpp +++ b/Source/StreamObjects/Private/ModelStreamObject.cpp @@ -102,8 +102,12 @@ const FString FModelStreamObject::GetRootName() const bool FModelStreamObject::IsValid() const { - // By Default an object is valid if the root model is in the scene - return FBSystem().Scene->Components.Find((FBComponent*)RootModel) >= 0; + if (RootModel) + { + // By Default an object is valid if the root model is in the scene + return FBSystem().Scene->Components.Find((FBComponent*)RootModel) >= 0; + } + return false; }; void FModelStreamObject::Refresh(const TSharedPtr Provider)