From 91b4c5fb51f0f3eccd671b75f52053f6fc8ce87f Mon Sep 17 00:00:00 2001 From: Yannick Date: Sun, 16 Apr 2023 14:46:16 +0200 Subject: [PATCH 01/13] Added a way to load aircraft from a custom location --- .../Private/JSBSimMovementComponent.cpp | 3 ++- .../Public/JSBSimMovementComponent.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index ec10857017..df4a05c177 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -406,7 +406,8 @@ void UJSBSimMovementComponent::InitializeJSBSim() FString AircraftPath(TEXT("aircraft")); FString EnginePath(TEXT("engine")); FString SystemPath(TEXT("systems")); - Exec->SetRootDir(SGPath(*RootDir)); + + Exec->SetRootDir(SGPath(bUseExternalAircraftPath ? ExternalAircraftPath : *RootDir)); Exec->SetAircraftPath(SGPath(*AircraftPath)); Exec->SetEnginePath(SGPath(*EnginePath)); Exec->SetSystemsPath(SGPath(*SystemPath)); diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h index a6b1a5b786..0445c4428d 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h @@ -189,6 +189,11 @@ class JSBSIMFLIGHTDYNAMICSMODEL_API UJSBSimMovementComponent : public UActorComp UPROPERTY(Transient, BlueprintReadOnly, VisibleAnywhere, Category = "State") FAircraftState AircraftState; + UPROPERTY(Transient, BlueprintReadOnly, VisibleAnywhere, Category = "Settings") + bool bUseExternalAircraftPath; + UPROPERTY(Transient, BlueprintReadOnly, VisibleAnywhere, Category = "Settings") + FString ExternalAircraftPath; + // Functions From 37f4e4fba35fc79a45cb49d4df698f4ff254c7b2 Mon Sep 17 00:00:00 2001 From: Yannick Date: Sun, 16 Apr 2023 15:11:51 +0200 Subject: [PATCH 02/13] Code simplification --- .../Private/JSBSimMovementComponent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index 842b550d1f..090dd1cc54 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -399,7 +399,7 @@ void UJSBSimMovementComponent::InitializeJSBSim() FString BaseDir = IPluginManager::Get().FindPlugin("JSBSimFlightDynamicsModel")->GetBaseDir(); // Add on the relative location of the third party dll and load it FString RootDirRelative = FPaths::Combine(*BaseDir, TEXT("Resources/JSBSim")); - const FString& RootDir = IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*RootDirRelative); + const FString& RootDir = bUseExternalAircraftPath ? ExternalAircraftPath : IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*RootDirRelative); UE_LOG(LogJSBSim, Display, TEXT("Initializing JSBSimFlightDynamicsModel using Data in '%s'"), *RootDir); // Set data paths... @@ -407,7 +407,7 @@ void UJSBSimMovementComponent::InitializeJSBSim() FString EnginePath(TEXT("engine")); FString SystemPath(TEXT("systems")); - Exec->SetRootDir(SGPath(bUseExternalAircraftPath ? ExternalAircraftPath : *RootDir)); + Exec->SetRootDir(SGPath(*RootDir)); Exec->SetAircraftPath(SGPath(*AircraftPath)); Exec->SetEnginePath(SGPath(*EnginePath)); Exec->SetSystemsPath(SGPath(*SystemPath)); From 6551b2b3058e3b84261bfb0798de40fd9c6923a6 Mon Sep 17 00:00:00 2001 From: Yannick Date: Sun, 16 Apr 2023 15:15:28 +0200 Subject: [PATCH 03/13] Added an event triggered when the aircraft crashed --- .../Private/JSBSimMovementComponent.cpp | 1 + .../Public/JSBSimMovementComponent.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index a3c4ba11fd..06c3fe44bb 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -683,6 +683,7 @@ void UJSBSimMovementComponent::CopyFromJSBSim() if (AircraftState.AltitudeAGLFt < -10.0 || AircraftState.AltitudeASLFt < -10.0) { Exec->SuspendIntegration(); AircraftState.Crashed = true; + AircraftCrashed.Broadcast(); } // Copy the fuel levels from JSBSim if fuel diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h index 325b01ca9e..35f4d1619a 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h @@ -35,6 +35,7 @@ namespace JSBSim { // UE Forward Declarations class AGeoReferencingSystem; +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FDelegateAircraftCrashed); UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent)) class JSBSIMFLIGHTDYNAMICSMODEL_API UJSBSimMovementComponent : public UActorComponent @@ -197,6 +198,10 @@ class JSBSIMFLIGHTDYNAMICSMODEL_API UJSBSimMovementComponent : public UActorComp UPROPERTY(Transient, BlueprintReadOnly, VisibleAnywhere, Category = "State") FAircraftState AircraftState; + // Events + UPROPERTY(VisibleAnywhere, BlueprintAssignable) + FDelegateAircraftCrashed AircraftCrashed; + // Functions From a7e4b899aa1218c394770aa65f220c78a0ef5538 Mon Sep 17 00:00:00 2001 From: Yannick Date: Sun, 16 Apr 2023 15:21:23 +0200 Subject: [PATCH 04/13] Added an array of actors that are ignored by the GroundCheck callback. --- .../Private/JSBSimMovementComponent.cpp | 3 +++ .../Public/JSBSimMovementComponent.h | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index a3c4ba11fd..461e95e669 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -206,6 +206,9 @@ double UJSBSimMovementComponent::GetAGLevel(const FVector& StartECEFLocation, FV CollisionParams.bTraceComplex = true; CollisionParams.AddIgnoredActor(Parent); + if (GroundCheckIgnoredActors.Num() > 0) + CollisionParams.AddIgnoredActors(GroundCheckIgnoredActors); + FCollisionObjectQueryParams ObjectParams = FCollisionObjectQueryParams(ECC_WorldStatic); ObjectParams.AddObjectTypesToQuery(ECC_WorldDynamic); ObjectParams.AddObjectTypesToQuery(ECC_Pawn); diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h index 325b01ca9e..7bf7a9c219 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/JSBSimMovementComponent.h @@ -197,7 +197,9 @@ class JSBSIMFLIGHTDYNAMICSMODEL_API UJSBSimMovementComponent : public UActorComp UPROPERTY(Transient, BlueprintReadOnly, VisibleAnywhere, Category = "State") FAircraftState AircraftState; - + UPROPERTY(Transient, BlueprintReadOnly, VisibleAnywhere, Category = "State") + TArray GroundCheckIgnoredActors; + // Functions /* Returns the full Aircraft name as set in the JSBSim definition file */ From 9296a5a9fa8e3569bf464a1490db72c368f58b5c Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 17 Apr 2023 13:19:45 +0200 Subject: [PATCH 05/13] Test for Android --- UnrealEngine/Config/DefaultEngine.ini | 169 ++++++++++++++++-- UnrealEngine/Config/DefaultInput.ini | 9 +- .../Source/ThirdParty/JSBSim.Build.cs | 2 +- UnrealEngine/UEReferenceApp.uproject | 5 +- 4 files changed, 161 insertions(+), 24 deletions(-) diff --git a/UnrealEngine/Config/DefaultEngine.ini b/UnrealEngine/Config/DefaultEngine.ini index 689c21b1f5..4b5f7bbc52 100644 --- a/UnrealEngine/Config/DefaultEngine.ini +++ b/UnrealEngine/Config/DefaultEngine.ini @@ -1,15 +1,25 @@ [/Script/EngineSettings.GameMapsSettings] +EditorStartupMap=/Game/Levels/StartupLevel.StartupLevel +LocalMapOptions= +TransitionMap=None +bUseSplitscreen=False +TwoPlayerSplitscreenLayout=Horizontal +ThreePlayerSplitscreenLayout=FavorTop +FourPlayerSplitscreenLayout=Grid +bOffsetPlayerGamepadIds=False +GameInstanceClass=/Script/Engine.GameInstance GameDefaultMap=/Game/Levels/StartupLevel.StartupLevel +ServerDefaultMap=/Engine/Maps/Entry.Entry GlobalDefaultGameMode=/Game/Blueprints/BP_JSBSimGameMode.BP_JSBSimGameMode_C -EditorStartupMap=/Game/Levels/StartupLevel.StartupLevel +GlobalDefaultServerGameMode=None [/Script/HardwareTargeting.HardwareTargetingSettings] -TargetedHardwareClass=Desktop -AppliedTargetedHardwareClass=Desktop -DefaultGraphicsPerformance=Maximum -AppliedDefaultGraphicsPerformance=Maximum +TargetedHardwareClass=Mobile +AppliedTargetedHardwareClass=Mobile +DefaultGraphicsPerformance=Scalable +AppliedDefaultGraphicsPerformance=Scalable [/Script/Engine.Engine] +ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/JSBSimIntegration") @@ -21,22 +31,135 @@ TinyFontName=None SmallFontName=None [/Script/Engine.RendererSettings] -r.SupportSkyAtmosphereAffectsHeightFog=True -r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True +r.Mobile.DisableVertexFog=False +r.Shadow.CSM.MaxMobileCascades=2 +r.Mobile.AntiAliasing=1 +r.Mobile.FloatPrecisionMode=0 +r.Mobile.AllowDitheredLODTransition=False +r.Mobile.VirtualTextures=False +r.Mobile.ReflectionCaptureCompression=False +r.DiscardUnusedQuality=False +r.Shaders.CompressionFormat=2 +r.AllowOcclusionQueries=True +r.MinScreenRadiusForLights=0.030000 +r.MinScreenRadiusForDepthPrepass=0.030000 +r.MinScreenRadiusForCSMDepth=0.010000 +r.PrecomputedVisibilityWarning=False +r.TextureStreaming=True +Compat.UseDXT5NormalMaps=False +r.VirtualTextures=False +r.VT.EnableAutoImport=True +r.VirtualTexturedLightmaps=False +r.VT.AnisotropicFiltering=False +r.VT.TileSize=128 +r.VT.TileBorderSize=4 +r.vt.FeedbackFactor=16 +WorkingColorSpaceChoice=sRGB +RedChromaticityCoordinate=(X=0.640000,Y=0.330000) +GreenChromaticityCoordinate=(X=0.300000,Y=0.600000) +BlueChromaticityCoordinate=(X=0.150000,Y=0.060000) +WhiteChromaticityCoordinate=(X=0.312700,Y=0.329000) +r.ClearCoatNormal=False +r.DynamicGlobalIlluminationMethod=0 +r.ReflectionMethod=2 +r.ReflectionCaptureResolution=128 +r.ReflectionEnvironmentLightmapMixBasedOnRoughness=True +r.Lumen.HardwareRayTracing=False +r.Lumen.HardwareRayTracing.LightingMode=0 +r.Lumen.TraceMeshSDFs=1 +r.Shadow.Virtual.Enable=1 +r.RayTracing=False +r.RayTracing.Shadows=False +r.RayTracing.Skylight=False +r.RayTracing.UseTextureLod=False +r.PathTracing=True +r.GenerateMeshDistanceFields=False +r.DistanceFields.DefaultVoxelDensity=0.200000 +r.AllowStaticLighting=False +r.NormalMapsForStaticLighting=False +r.ForwardShading=False +r.VertexFoggingForOpaque=True +r.SeparateTranslucency=False +r.TranslucentSortPolicy=0 +TranslucentSortAxis=(X=0.000000,Y=-1.000000,Z=0.000000) +vr.VRS.HMDFixedFoveationLevel=0 +vr.VRS.HMDFixedFoveationDynamic=False +r.CustomDepth=3 +r.CustomDepthTemporalAAJitter=True +r.PostProcessing.PropagateAlpha=0 +r.DefaultFeature.Bloom=False +r.DefaultFeature.AmbientOcclusion=False +r.DefaultFeature.AmbientOcclusionStaticFraction=True +r.DefaultFeature.AutoExposure=False +r.DefaultFeature.AutoExposure.Method=0 r.DefaultFeature.AutoExposure.Bias=0.000000 -r.UsePreExposure=True -r.DefaultFeature.MotionBlur=True +r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True +r.DefaultFeature.MotionBlur=False r.DefaultFeature.LensFlare=False r.TemporalAA.Upsampling=False -r.DefaultFeature.AntiAliasing=2 -r.DefaultFeature.AutoExposure=True -r.EyeAdaptation.EditorOnly=False -r.DefaultFeature.AutoExposure.Method=0 -r.AntiAliasingMethod=4 -r.Shadow.Virtual.Enable=1 -r.CustomDepth=3 -r.AllowStaticLighting=False -r.Vsync=1 +r.AntiAliasingMethod=0 +r.MSAACount=4 +r.DefaultFeature.LightUnits=1 +r.DefaultBackBufferPixelFormat=4 +r.Shadow.UnbuiltPreviewInGame=True +r.StencilForLODDither=False +r.EarlyZPass=3 +r.EarlyZPassOnlyMaterialMasking=False +r.Shadow.CSMCaching=False +r.DBuffer=True +r.ClearSceneMethod=1 +r.VelocityOutputPass=0 +r.Velocity.EnableVertexDeformation=2 +r.SelectiveBasePassOutputs=False +bDefaultParticleCutouts=False +fx.GPUSimulationTextureSizeX=1024 +fx.GPUSimulationTextureSizeY=1024 +r.AllowGlobalClipPlane=False +r.GBufferFormat=1 +r.MorphTarget.Mode=True +r.GPUCrashDebugging=False +vr.InstancedStereo=False +r.MobileHDR=True +vr.MobileMultiView=False +r.Mobile.UseHWsRGBEncoding=False +vr.RoundRobinOcclusion=False +vr.ODSCapture=False +r.MeshStreaming=False +r.WireframeCullThreshold=5.000000 +r.SupportStationarySkylight=True +r.SupportLowQualityLightmaps=True +r.SupportPointLightWholeSceneShadows=True +r.SupportSkyAtmosphere=True +r.SupportSkyAtmosphereAffectsHeightFog=True +r.SupportCloudShadowOnForwardLitTranslucent=False +r.Material.RoughDiffuse=False +r.Material.EnergyConservation=False +r.SkinCache.CompileShaders=False +r.SkinCache.DefaultBehavior=1 +r.SkinCache.SceneMemoryLimitInMB=128.000000 +r.Mobile.EnableStaticAndCSMShadowReceivers=True +r.Mobile.EnableMovableLightCSMShaderCulling=True +r.Mobile.EnableNoPrecomputedLightingCSMShader=False +r.Mobile.AllowDistanceFieldShadows=True +r.Mobile.AllowMovableDirectionalLights=True +r.MobileNumDynamicPointLights=4 +r.Mobile.EnableMovableSpotlights=False +r.Mobile.EnableMovableSpotlightsShadow=False +r.GPUSkin.Support16BitBoneIndex=False +r.GPUSkin.Limit2BoneInfluences=False +r.SupportDepthOnlyIndexBuffers=True +r.SupportReversedIndexBuffers=True +r.Mobile.AmbientOcclusion=False +r.GPUSkin.UnlimitedBoneInfluences=False +r.GPUSkin.UnlimitedBoneInfluencesThreshold=8 +MaxSkinBones=(Default=65536,PerPlatform=(("Mobile", 256))) +r.Mobile.PlanarReflectionMode=0 +r.Mobile.SupportsGen4TAA=True +bStreamSkeletalMeshLODs=(Default=False,PerPlatform=()) +bDiscardSkeletalMeshOptionalLODs=(Default=False,PerPlatform=()) +VisualizeCalibrationColorMaterialPath=/Engine/EngineMaterials/PPM_DefaultCalibrationColor.PPM_DefaultCalibrationColor +VisualizeCalibrationCustomMaterialPath=None +VisualizeCalibrationGrayscaleMaterialPath=/Engine/EngineMaterials/PPM_DefaultCalibrationGrayscale.PPM_DefaultCalibrationGrayscale [/Script/Engine.CollisionProfile] -Profiles=(Name="NoCollision",CollisionEnabled=NoCollision,ObjectTypeName="WorldStatic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore)),HelpMessage="No collision",bCanModify=False) @@ -107,4 +230,12 @@ bLogFiles=False bReportStats=False ConnectionType=USBOnly bUseManualIPAddress=False -ManualIPAddress= \ No newline at end of file +ManualIPAddress= + +[/Script/Slate.SlateSettings] +bExplicitCanvasChildZOrder=True + +[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings] +PackageName=com.epic.jsbsim +bPackageDataInsideApk=True + diff --git a/UnrealEngine/Config/DefaultInput.ini b/UnrealEngine/Config/DefaultInput.ini index 25f6dbc17c..9f9645d18a 100644 --- a/UnrealEngine/Config/DefaultInput.ini +++ b/UnrealEngine/Config/DefaultInput.ini @@ -110,6 +110,10 @@ bEnableMouseSmoothing=True bEnableFOVScaling=True bCaptureMouseOnLaunch=True bEnableLegacyInputScales=True +bEnableMotionControls=True +bFilterInputByPlatformUser=False +bShouldFlushPressedKeysOnViewportFocusLost=True +bEnableDynamicComponentInputBinding=True bAlwaysShowTouchInterface=False bShowConsoleOnFourFingerTap=True bEnableGestureRecognizer=False @@ -174,11 +178,12 @@ DoubleClickTime=0.200000 +AxisMappings=(AxisName="ThrottleIncrease",Scale=-1.000000,Key=Gamepad_FaceButton_Bottom) +AxisMappings=(AxisName="Flaps Increase",Scale=-1.000000,Key=Gamepad_LeftShoulder) +AxisMappings=(AxisName="Flaps Axis",Scale=1.000000,Key=None) -DefaultPlayerInputClass=/Script/Engine.PlayerInput -DefaultInputComponentClass=/Script/Engine.InputComponent +DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput +DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks -ConsoleKeys=Tilde +ConsoleKeys=Tilde ++ConsoleKeys=² [/Script/RawInput.RawInputSettings] +DeviceConfigurations=(VendorID="294B",ProductID="1900",AxisProperties=((Key=GenericUSBController_Axis1,bInverted=True,Offset=0.500000),(Key=GenericUSBController_Axis2,Offset=-0.500000)),ButtonProperties=((Key=GenericUSBController_Button1),(Key=GenericUSBController_Button2),(Key=GenericUSBController_Button3),(Key=GenericUSBController_Button4),(Key=GenericUSBController_Button5),(Key=GenericUSBController_Button6),(Key=GenericUSBController_Button7),(Key=GenericUSBController_Button8),(Key=GenericUSBController_Button9),(Key=GenericUSBController_Button10),(Key=GenericUSBController_Button11),(Key=GenericUSBController_Button12),(Key=GenericUSBController_Button13),(Key=GenericUSBController_Button14),(Key=GenericUSBController_Button15),(Key=GenericUSBController_Button16),(Key=GenericUSBController_Button17),(Key=GenericUSBController_Button18),(Key=GenericUSBController_Button19),(Key=GenericUSBController_Button20))) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim.Build.cs b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim.Build.cs index d7aa2f5915..fa813a8ecd 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim.Build.cs +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim.Build.cs @@ -11,7 +11,7 @@ public JSBSim(ReadOnlyTargetRules Target) : base(Target) bool bSupported = Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac || - Target.Platform == UnrealTargetPlatform.Linux; // Android Soon + Target.Platform == UnrealTargetPlatform.Android; // Android Soon if (!bSupported) return; diff --git a/UnrealEngine/UEReferenceApp.uproject b/UnrealEngine/UEReferenceApp.uproject index eee25d44df..e57822bdb0 100644 --- a/UnrealEngine/UEReferenceApp.uproject +++ b/UnrealEngine/UEReferenceApp.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "5.0", + "EngineAssociation": "5.1", "Category": "", "Description": "", "Modules": [ @@ -44,6 +44,7 @@ "TargetPlatforms": [ "Windows", "Linux", - "Mac" + "Mac", + "Android" ] } \ No newline at end of file From 7ef90f9afc24e9d1f9a90c7e7ecd4eb8cda43ce3 Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 17 Apr 2023 14:20:43 +0200 Subject: [PATCH 06/13] Pragma for GCC and CLANG --- .../Private/JSBSimMovementComponent.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index 3edc1c60b6..0e94ca25f9 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -4,14 +4,23 @@ #include "JSBSimMovementComponent.h" #include "JSBSimModule.h" -#pragma warning( push ) - // UE treats warning as errors. JSBSim has some warnings in its include files, so if we don't catch them inside this push/pop pragma, we won't be able to build... +#if PLATFORM_WINDOWS +#pragma warning( push ) #pragma warning( disable : 4263 ) // FGOutputType.h(151): warning C4263: 'bool JSBSim::FGOutputType::Run(void)': member function does not override any base class virtual member function #pragma warning( disable : 4264 ) // FGOutputType.h(215): warning C4264: 'bool JSBSim::FGModel::Run(bool)': no override available for virtual member function from base 'JSBSim::FGModel'; function is hidden --- And others #pragma warning( disable : 4005 ) // compiler.h(58): warning C4005: 'DEPRECATED': macro redefinition with UE_5.0\Engine\Source\Runtime\Core\Public\Windows\WindowsPlatformCompilerPreSetup.h(55): note: see previous definition of 'DEPRECATED' #pragma warning( disable : 4458 ) // FGXMLElement.h(369): error C4458: declaration of 'name' hides class member +#elif PLATFORM_LINUX || PLATFORM_MAC +#pragma GCC push +#pragma GCC diagnostic ignored "-Woverloaded-virtual" +#pragma GCC diagnostic ignored "-Wshadow" +#elif PLATFORM_ANDROID +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Woverloaded-virtual" +#pragma clang diagnostic ignored "-Wshadow" +#endif #include "FGFDMExec.h" #include "math/FGLocation.h" @@ -35,10 +44,15 @@ #include "Interfaces/IPluginManager.h" #include "simgear/props/props.hxx" +#if PLATFORM_WINDOWS #pragma warning( pop ) +#elif PLATFORM_ANDROID +#pragma clang diagnostic pop +#elif PLATFORM_LINUX || PLATFORM_MAC +#pragma GCC pop +#endif #include "UEGroundCallback.h" - #include "DrawDebugHelpers.h" #include "GeoReferencingSystem.h" #include "Components/ActorComponent.h" From c28082c98e90675b1ef9388d7339801b19df3aa6 Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 17 Apr 2023 15:09:02 +0200 Subject: [PATCH 07/13] Linux changes --- .../Private/JSBSimMovementComponent.cpp | 8 ++++---- .../Source/ThirdParty/JSBSim.Build.cs | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index 0e94ca25f9..22f04218d3 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -12,11 +12,11 @@ #pragma warning( disable : 4264 ) // FGOutputType.h(215): warning C4264: 'bool JSBSim::FGModel::Run(bool)': no override available for virtual member function from base 'JSBSim::FGModel'; function is hidden --- And others #pragma warning( disable : 4005 ) // compiler.h(58): warning C4005: 'DEPRECATED': macro redefinition with UE_5.0\Engine\Source\Runtime\Core\Public\Windows\WindowsPlatformCompilerPreSetup.h(55): note: see previous definition of 'DEPRECATED' #pragma warning( disable : 4458 ) // FGXMLElement.h(369): error C4458: declaration of 'name' hides class member -#elif PLATFORM_LINUX || PLATFORM_MAC +#elif PLATFORM_MAC #pragma GCC push #pragma GCC diagnostic ignored "-Woverloaded-virtual" #pragma GCC diagnostic ignored "-Wshadow" -#elif PLATFORM_ANDROID +#elif PLATFORM_ANDROID || PLATFORM_LINUX #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverloaded-virtual" #pragma clang diagnostic ignored "-Wshadow" @@ -46,9 +46,9 @@ #if PLATFORM_WINDOWS #pragma warning( pop ) -#elif PLATFORM_ANDROID +#elif PLATFORM_ANDROID || PLATFORM_LINUX #pragma clang diagnostic pop -#elif PLATFORM_LINUX || PLATFORM_MAC +#elif PLATFORM_MAC #pragma GCC pop #endif diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim.Build.cs b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim.Build.cs index b2e7f31447..ea974d3cf7 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim.Build.cs +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/ThirdParty/JSBSim.Build.cs @@ -11,6 +11,7 @@ public JSBSim(ReadOnlyTargetRules Target) : base(Target) bool bSupported = Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac || + Target.Platform == UnrealTargetPlatform.Linux || Target.Platform == UnrealTargetPlatform.Android; if (!bSupported) return; From b4a6a04f217a5a681038ef05f0a69269926800b5 Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 17 Apr 2023 15:30:13 +0200 Subject: [PATCH 08/13] Using CLANG Pragma on mac too --- .../Private/JSBSimMovementComponent.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index 22f04218d3..9e52d31443 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -12,14 +12,14 @@ #pragma warning( disable : 4264 ) // FGOutputType.h(215): warning C4264: 'bool JSBSim::FGModel::Run(bool)': no override available for virtual member function from base 'JSBSim::FGModel'; function is hidden --- And others #pragma warning( disable : 4005 ) // compiler.h(58): warning C4005: 'DEPRECATED': macro redefinition with UE_5.0\Engine\Source\Runtime\Core\Public\Windows\WindowsPlatformCompilerPreSetup.h(55): note: see previous definition of 'DEPRECATED' #pragma warning( disable : 4458 ) // FGXMLElement.h(369): error C4458: declaration of 'name' hides class member -#elif PLATFORM_MAC -#pragma GCC push -#pragma GCC diagnostic ignored "-Woverloaded-virtual" -#pragma GCC diagnostic ignored "-Wshadow" -#elif PLATFORM_ANDROID || PLATFORM_LINUX +#elif PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MAC #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverloaded-virtual" #pragma clang diagnostic ignored "-Wshadow" +#else +#pragma GCC push +#pragma GCC diagnostic ignored "-Woverloaded-virtual" +#pragma GCC diagnostic ignored "-Wshadow" #endif #include "FGFDMExec.h" From cebb9d5902e091432d5f7cc06b8b45df3d9922ec Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 17 Apr 2023 15:39:04 +0200 Subject: [PATCH 09/13] Added rider metadata files to the gitignore list. Added a bash script to clean the project, with the same content than the .bat for Windows. --- .gitignore | 1 + UnrealEngine/CleanProject.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 UnrealEngine/CleanProject.sh diff --git a/.gitignore b/.gitignore index d8ac2f2ade..14dbb752d6 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,4 @@ UnrealEngine/Binaries UnrealEngine/DerivedDataCache UnrealEngine/Intermediate UnrealEngine/Saved +UnrealEngine/.idea diff --git a/UnrealEngine/CleanProject.sh b/UnrealEngine/CleanProject.sh new file mode 100644 index 0000000000..3cb4fd81a5 --- /dev/null +++ b/UnrealEngine/CleanProject.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +rm *.vs +rm -rf Saved +rm -rf Binaries +rm -rf Build +rm -rf Intermediate +rm -rf DerivedDataCache +rm -rf Script + +rm -rf Plugins\JSBSimFlightDynamicsModel\Binaries +rm -rf Plugins\JSBSimFlightDynamicsModel\Intermediate From 7fa0056c311dc9741b987bc1a5539f05677e8905 Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 17 Apr 2023 18:59:16 +0200 Subject: [PATCH 10/13] Simplification --- .../Private/JSBSimMovementComponent.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index f5405bd8c0..958d7ef7f4 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -413,21 +413,17 @@ void UJSBSimMovementComponent::InitializeJSBSim() // Initialize the Models location, relatively to this plugin // Get the base directory of this plugin - FString BaseDir = IPluginManager::Get().FindPlugin("JSBSimFlightDynamicsModel")->GetBaseDir(); + const FString BaseDir = IPluginManager::Get().FindPlugin("JSBSimFlightDynamicsModel")->GetBaseDir(); // Add on the relative location of the third party dll and load it - FString RootDirRelative = FPaths::Combine(*BaseDir, TEXT("Resources/JSBSim")); + const FString RootDirRelative = FPaths::Combine(*BaseDir, TEXT("Resources/JSBSim")); const FString& RootDir = bUseExternalAircraftPath ? ExternalAircraftPath : IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*RootDirRelative); UE_LOG(LogJSBSim, Display, TEXT("Initializing JSBSimFlightDynamicsModel using Data in '%s'"), *RootDir); // Set data paths... - FString AircraftPath(TEXT("aircraft")); - FString EnginePath(TEXT("engine")); - FString SystemPath(TEXT("systems")); - Exec->SetRootDir(SGPath(TCHAR_TO_UTF8(*RootDir))); - Exec->SetAircraftPath(SGPath(TCHAR_TO_UTF8(*AircraftPath))); - Exec->SetEnginePath(SGPath(TCHAR_TO_UTF8(*EnginePath))); - Exec->SetSystemsPath(SGPath(TCHAR_TO_UTF8(*SystemPath))); + Exec->SetAircraftPath(SGPath(TCHAR_TO_UTF8(*TEXT("aircraft")))); + Exec->SetEnginePath(SGPath(TCHAR_TO_UTF8(*TEXT("engine")))); + Exec->SetSystemsPath(SGPath(TCHAR_TO_UTF8(*TEXT("systems")))); // Prepare Initial Conditions TrimNeeded = true; From 91f0df7881d6ff2955b55577305ea575a5f201b6 Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 17 Apr 2023 21:42:38 +0200 Subject: [PATCH 11/13] Added proper compiler defines --- .../Private/JSBSimMovementComponent.cpp | 12 +++++++----- .../Public/UEGroundCallback.h | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index 958d7ef7f4..35f66ac479 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -12,14 +12,16 @@ #pragma warning( disable : 4264 ) // FGOutputType.h(215): warning C4264: 'bool JSBSim::FGModel::Run(bool)': no override available for virtual member function from base 'JSBSim::FGModel'; function is hidden --- And others #pragma warning( disable : 4005 ) // compiler.h(58): warning C4005: 'DEPRECATED': macro redefinition with UE_5.0\Engine\Source\Runtime\Core\Public\Windows\WindowsPlatformCompilerPreSetup.h(55): note: see previous definition of 'DEPRECATED' #pragma warning( disable : 4458 ) // FGXMLElement.h(369): error C4458: declaration of 'name' hides class member -#elif PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MAC +#elif defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverloaded-virtual" #pragma clang diagnostic ignored "-Wshadow" -#else +#pragma clang diagnostic ignored "-Wuseless-cast" +#elif defined(__GNUC__) #pragma GCC push #pragma GCC diagnostic ignored "-Woverloaded-virtual" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wuseless-cast" #endif #include "FGFDMExec.h" @@ -44,11 +46,11 @@ #include "Interfaces/IPluginManager.h" #include "simgear/props/props.hxx" -#if PLATFORM_WINDOWS +#ifdef _MSC_VER #pragma warning( pop ) -#elif PLATFORM_ANDROID || PLATFORM_LINUX +#elif defined(__clang__) #pragma clang diagnostic pop -#elif PLATFORM_MAC +#elif defined(__GNUC__) #pragma GCC pop #endif diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/UEGroundCallback.h b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/UEGroundCallback.h index 501e917c4b..f1c1c9fd5c 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/UEGroundCallback.h +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/UEGroundCallback.h @@ -2,17 +2,34 @@ #pragma once +#ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable : 4263 ) #pragma warning( disable : 4264 ) #pragma warning( disable : 4005 ) #pragma warning( disable : 4458 ) +#elif defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Woverloaded-virtual" +#pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +#pragma GCC push +#pragma GCC diagnostic ignored "-Woverloaded-virtual" +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wuseless-cast" +#endif #include "models/FGInertial.h" #include "math/FGLocation.h" #include "math/FGColumnVector3.h" +#ifdef _MSC_VER #pragma warning( pop ) +#elif defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC pop +#endif #include "CoreMinimal.h" From e52c1e093c275b004aa9326a8c461048e9a73bd7 Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 17 Apr 2023 21:44:10 +0200 Subject: [PATCH 12/13] MS VS Version --- .../Private/JSBSimMovementComponent.cpp | 10 +++++----- .../Public/UEGroundCallback.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index 35f66ac479..84ae5c4b92 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -6,12 +6,12 @@ // UE treats warning as errors. JSBSim has some warnings in its include files, so if we don't catch them inside this push/pop pragma, we won't be able to build... -#if PLATFORM_WINDOWS +#ifdef _MSC_VER #pragma warning( push ) -#pragma warning( disable : 4263 ) // FGOutputType.h(151): warning C4263: 'bool JSBSim::FGOutputType::Run(void)': member function does not override any base class virtual member function -#pragma warning( disable : 4264 ) // FGOutputType.h(215): warning C4264: 'bool JSBSim::FGModel::Run(bool)': no override available for virtual member function from base 'JSBSim::FGModel'; function is hidden --- And others -#pragma warning( disable : 4005 ) // compiler.h(58): warning C4005: 'DEPRECATED': macro redefinition with UE_5.0\Engine\Source\Runtime\Core\Public\Windows\WindowsPlatformCompilerPreSetup.h(55): note: see previous definition of 'DEPRECATED' -#pragma warning( disable : 4458 ) // FGXMLElement.h(369): error C4458: declaration of 'name' hides class member +#pragma warning( disable : 4263 ) +#pragma warning( disable : 4264 ) +#pragma warning( disable : 4005 ) +#pragma warning( disable : 4458 ) #elif defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverloaded-virtual" diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/UEGroundCallback.h b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/UEGroundCallback.h index f1c1c9fd5c..be5671d18a 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/UEGroundCallback.h +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Public/UEGroundCallback.h @@ -12,6 +12,7 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Woverloaded-virtual" #pragma clang diagnostic ignored "-Wshadow" +#pragma clang diagnostic ignored "-Wuseless-cast" #elif defined(__GNUC__) #pragma GCC push #pragma GCC diagnostic ignored "-Woverloaded-virtual" From fe1eb9970085e6b25fa7237c24425fe3c0a3d1a1 Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 17 Apr 2023 21:55:55 +0200 Subject: [PATCH 13/13] Fixed paths --- .../Private/JSBSimMovementComponent.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp index 84ae5c4b92..1e584386b0 100644 --- a/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp +++ b/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp @@ -415,17 +415,25 @@ void UJSBSimMovementComponent::InitializeJSBSim() // Initialize the Models location, relatively to this plugin // Get the base directory of this plugin - const FString BaseDir = IPluginManager::Get().FindPlugin("JSBSimFlightDynamicsModel")->GetBaseDir(); + const FString BaseDir = IPluginManager::Get().FindPlugin("JSBSimFlightDynamicsModel")->GetBaseDir(); // Add on the relative location of the third party dll and load it - const FString RootDirRelative = FPaths::Combine(*BaseDir, TEXT("Resources/JSBSim")); + const FString RootDirRelative = FPaths::Combine(*BaseDir, TEXT("Resources/JSBSim")); + + if (bUseExternalAircraftPath && ExternalAircraftPath.IsEmpty()) + bUseExternalAircraftPath = false; + const FString& RootDir = bUseExternalAircraftPath ? ExternalAircraftPath : IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*RootDirRelative); UE_LOG(LogJSBSim, Display, TEXT("Initializing JSBSimFlightDynamicsModel using Data in '%s'"), *RootDir); // Set data paths... + FString AircraftPath(TEXT("aircraft")); + FString EnginePath(TEXT("engine")); + FString SystemPath(TEXT("systems")); + Exec->SetRootDir(SGPath(TCHAR_TO_UTF8(*RootDir))); - Exec->SetAircraftPath(SGPath(TCHAR_TO_UTF8(*TEXT("aircraft")))); - Exec->SetEnginePath(SGPath(TCHAR_TO_UTF8(*TEXT("engine")))); - Exec->SetSystemsPath(SGPath(TCHAR_TO_UTF8(*TEXT("systems")))); + Exec->SetAircraftPath(SGPath(TCHAR_TO_UTF8(*AircraftPath))); + Exec->SetEnginePath(SGPath(TCHAR_TO_UTF8(*EnginePath))); + Exec->SetSystemsPath(SGPath(TCHAR_TO_UTF8(*SystemPath))); // Prepare Initial Conditions TrimNeeded = true;