8
8
#include " AssetViewerSettings.h"
9
9
#include " Launch/Resources/Version.h"
10
10
#include " Components/DirectionalLightComponent.h"
11
+ #if ENGINE_MAJOR_VERSION > 4
12
+ #include " UnrealWidget.h"
13
+ #endif
11
14
12
15
#define LOCTEXT_NAMESPACE " JavascriptEditor"
13
16
14
17
PRAGMA_DISABLE_SHADOW_VARIABLE_WARNINGS
15
18
19
+ #if ENGINE_MAJOR_VERSION > 4
20
+ namespace WidgetAlias = UE::Widget;
21
+ #else
22
+ using WidgetAlias = FWidget;
23
+ #endif
24
+
16
25
class FJavascriptPreviewScene : public FAdvancedPreviewScene
17
26
{
18
27
public:
@@ -38,7 +47,7 @@ class FJavascriptPreviewScene : public FAdvancedPreviewScene
38
47
{
39
48
return SkyComponent;
40
49
}
41
- #if ENGINE_MINOR_VERSION < 23
50
+ #if ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION < 23
42
51
class USphereReflectionCaptureComponent * GetDefaultSphereReflectionComponent ()
43
52
{
44
53
return SphereReflectionComponent;
@@ -208,11 +217,11 @@ class FJavascriptEditorViewportClient : public FEditorViewportClient
208
217
}
209
218
}
210
219
211
- virtual FWidget ::EWidgetMode GetWidgetMode () const override
220
+ virtual WidgetAlias ::EWidgetMode GetWidgetMode () const override
212
221
{
213
222
if (Widget.IsValid () && Widget->OnGetWidgetMode .IsBound ())
214
223
{
215
- return (FWidget ::EWidgetMode)Widget->OnGetWidgetMode .Execute (Widget.Get ());
224
+ return (WidgetAlias ::EWidgetMode)Widget->OnGetWidgetMode .Execute (Widget.Get ());
216
225
}
217
226
else
218
227
{
@@ -265,7 +274,7 @@ class FJavascriptEditorViewportClient : public FEditorViewportClient
265
274
{
266
275
for (FActorIterator It (PreviewScene->GetWorld ()); It; ++It)
267
276
{
268
- #if ENGINE_MINOR_VERSION > 14
277
+ #if (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 14) || ENGINE_MAJOR_VERSION > 4
269
278
It->DispatchBeginPlay ();
270
279
#else
271
280
if (It->HasActorBegunPlay () == false )
@@ -447,13 +456,13 @@ class SAutoRefreshEditorViewport : public SEditorViewport
447
456
448
457
void SetWidgetMode (EJavascriptWidgetMode WidgetMode)
449
458
{
450
- EditorViewportClient->SetWidgetMode (WidgetMode == EJavascriptWidgetMode::WM_None ? FWidget ::WM_None : (FWidget ::EWidgetMode)WidgetMode);
459
+ EditorViewportClient->SetWidgetMode (WidgetMode == EJavascriptWidgetMode::WM_None ? WidgetAlias ::WM_None : (WidgetAlias ::EWidgetMode)WidgetMode);
451
460
}
452
461
453
462
EJavascriptWidgetMode GetWidgetMode ()
454
463
{
455
- FWidget ::EWidgetMode WidgetMode = EditorViewportClient->GetWidgetMode ();
456
- return FWidget ::WM_None ? EJavascriptWidgetMode::WM_None : (EJavascriptWidgetMode)WidgetMode;
464
+ WidgetAlias ::EWidgetMode WidgetMode = EditorViewportClient->GetWidgetMode ();
465
+ return WidgetAlias ::WM_None ? EJavascriptWidgetMode::WM_None : (EJavascriptWidgetMode)WidgetMode;
457
466
}
458
467
459
468
FString GetEngineShowFlags ()
@@ -508,7 +517,7 @@ class SAutoRefreshEditorViewport : public SEditorViewport
508
517
{
509
518
return PreviewScene.GetDefaultSkySphereComponent ();
510
519
}
511
- #if ENGINE_MINOR_VERSION < 23
520
+ #if ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION < 23
512
521
class USphereReflectionCaptureComponent * GetDefaultSphereReflectionComponent ()
513
522
{
514
523
return PreviewScene.GetDefaultSphereReflectionComponent ();
@@ -534,7 +543,7 @@ class SAutoRefreshEditorViewport : public SEditorViewport
534
543
UStaticMeshComponent* Component = *Itr;
535
544
if (Component && Component->GetOwner () == nullptr )
536
545
{
537
- #if ENGINE_MINOR_VERSION >= 14
546
+ #if (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 14) || ENGINE_MAJOR_VERSION > 4
538
547
auto StaticMesh = Component->GetStaticMesh ();
539
548
#else
540
549
auto StaticMesh = Component->StaticMesh ;
@@ -838,7 +847,7 @@ void UJavascriptEditorViewport::DeprojectScreenToWorld(const FVector2D &ScreenPo
838
847
FSceneViewFamilyContext ViewFamily (FSceneViewFamily::ConstructionValues ( ViewportWidget->EditorViewportClient ->Viewport , ViewportWidget->EditorViewportClient ->GetScene (), ViewportWidget->EditorViewportClient ->EngineShowFlags ));
839
848
FSceneView* View = ViewportWidget->EditorViewportClient ->CalcSceneView (&ViewFamily);
840
849
841
- #if ENGINE_MINOR_VERSION >= 14
850
+ #if (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 14) || ENGINE_MAJOR_VERSION > 4
842
851
const auto & InvViewProjMatrix = View->ViewMatrices .GetInvViewProjectionMatrix ();
843
852
#else
844
853
const auto & InvViewProjMatrix = View->ViewMatrices .GetInvViewProjMatrix ();
@@ -854,7 +863,7 @@ void UJavascriptEditorViewport::ProjectWorldToScreen(const FVector &WorldPositio
854
863
FSceneViewFamilyContext ViewFamily (FSceneViewFamily::ConstructionValues ( ViewportWidget->EditorViewportClient ->Viewport , ViewportWidget->EditorViewportClient ->GetScene (), ViewportWidget->EditorViewportClient ->EngineShowFlags ));
855
864
FSceneView* View = ViewportWidget->EditorViewportClient ->CalcSceneView (&ViewFamily);
856
865
857
- #if ENGINE_MINOR_VERSION >= 14
866
+ #if (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 14) || ENGINE_MAJOR_VERSION > 4
858
867
const auto & ViewProjMatrix = View->ViewMatrices .GetViewProjectionMatrix ();
859
868
#else
860
869
const auto & ViewProjMatrix = View->ViewMatrices .GetViewProjMatrix ();
@@ -970,7 +979,7 @@ class UStaticMeshComponent* UJavascriptEditorViewport::GetDefaultSkySphereCompon
970
979
971
980
class USphereReflectionCaptureComponent * UJavascriptEditorViewport::GetDefaultSphereReflectionComponent ()
972
981
{
973
- #if ENGINE_MINOR_VERSION < 23
982
+ #if ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION < 23
974
983
if (ViewportWidget.IsValid ())
975
984
{
976
985
return ViewportWidget->GetDefaultSphereReflectionComponent ();
0 commit comments