Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements support for MotionBuilder 2023 #28

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions Source/MobuLiveLinkPlugin2016.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
}
Expand Down
58 changes: 58 additions & 0 deletions Source/MobuLiveLinkPlugin2017.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
{
Expand All @@ -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))
{
Expand All @@ -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")
{
}
Expand Down
2 changes: 1 addition & 1 deletion Source/MobuLiveLinkPlugin2017.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnrealBuildTool;
using System;
using System.IO;
using Tools.DotNETCommon;
using EpicGames.Core;
using System.Runtime.CompilerServices;

[SupportedPlatforms(UnrealPlatformClass.Desktop)]
Expand Down
4 changes: 4 additions & 0 deletions Source/MobuLiveLinkPlugin2018.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
}
Expand Down
4 changes: 4 additions & 0 deletions Source/MobuLiveLinkPlugin2019.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
}
Expand Down
4 changes: 4 additions & 0 deletions Source/MobuLiveLinkPlugin2020.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
}
Expand Down
5 changes: 5 additions & 0 deletions Source/MobuLiveLinkPlugin2022.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
3 changes: 2 additions & 1 deletion Source/MobuLiveLinkPlugin2022.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
public class MobuLiveLinkPlugin2022Target : MobuLiveLinkPluginTargetBase
{
public MobuLiveLinkPlugin2022Target(TargetInfo Target) : base(Target, "2022")
{}
{
}
}
16 changes: 16 additions & 0 deletions Source/MobuLiveLinkPlugin2023.Build.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
11 changes: 11 additions & 0 deletions Source/MobuLiveLinkPlugin2023.Target.cs
Original file line number Diff line number Diff line change
@@ -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")
{}
}
2 changes: 1 addition & 1 deletion Source/Private/MobuLiveLink.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright Epic Games, Inc. All Rights Reserved.
// Copyright Epic Games, Inc. All Rights Reserved.

#include "RequiredProgramMainCPPInclude.h"
#include "MobuLiveLinkCommon.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/Public/MobuLiveLinkCommon.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright Epic Games, Inc. All Rights Reserved.
// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright Epic Games, Inc. All Rights Reserved.
// Copyright Epic Games, Inc. All Rights Reserved.

#include "EditorActiveCameraStreamObject.h"
#include "MobuLiveLinkUtilities.h"
Expand Down
8 changes: 6 additions & 2 deletions Source/StreamObjects/Private/ModelStreamObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ILiveLinkProvider> Provider)
Expand Down