Skip to content

Commit 584f78f

Browse files
author
David
committed
Possible fixup for PlayInEditor 4.25 changes.
This involves some code moving which will be executed at different times. Builds but not really tested.
1 parent c0a0089 commit 584f78f

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

Source/UnrealEnginePython/Private/UObject/UEPyCapture.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,21 @@ struct FInEditorMultiCapture : TSharedFromThis<FInEditorMultiCapture>
105105
}
106106
}
107107

108+
// should I move this into PlaySession also??
109+
108110
// cleanup from previous run
109111
BackedUpPlaySettings.Empty();
110112

111113
FObjectWriter(PlayInEditorSettings, BackedUpPlaySettings);
112114

115+
#if ENGINE_MINOR_VERSION >= 25
116+
// can I move this from here to PlaySession??
117+
// otherwise need to store the settings somehow
118+
// currently assuming no changes to default PlayInEditorSettings between the Dequeue and PlaySession
119+
//OverridePlaySettings(PlayInEditorSettings);
120+
#else
113121
OverridePlaySettings(PlayInEditorSettings);
122+
#endif
114123

115124
//CurrentCaptureObject->AddToRoot();
116125
CurrentCaptureObject->OnCaptureFinished().AddRaw(this, &FInEditorMultiCapture::OnEnd);
@@ -156,10 +165,45 @@ struct FInEditorMultiCapture : TSharedFromThis<FInEditorMultiCapture>
156165

157166

158167
#if ENGINE_MINOR_VERSION >= 25
168+
// we also need access to this
169+
const FMovieSceneCaptureSettings& Settings = CurrentCaptureObject->GetSettings();
170+
171+
// as commented this is from Editor/MovieSceneCaptureDialog/Private/MovieSceneCaptureDialogModule.cpp
172+
// and this is where that source code sets the custom window now
173+
TSharedRef<SWindow> CustomWindow = SNew(SWindow)
174+
.Title(FText::FromString("Movie Render - Preview"))
175+
.AutoCenter(EAutoCenter::PrimaryWorkArea)
176+
.UseOSWindowBorder(true)
177+
.FocusWhenFirstShown(false)
178+
.ActivationPolicy(EWindowActivationPolicy::Never)
179+
.HasCloseButton(true)
180+
.SupportsMaximize(false)
181+
.SupportsMinimize(true)
182+
.MaxWidth(Settings.Resolution.ResX)
183+
.MaxHeight(Settings.Resolution.ResY)
184+
.SizingRule(ESizingRule::FixedSize);
185+
186+
FSlateApplication::Get().AddWindow(CustomWindow);
187+
188+
// is there any reason NOT to call this here??
189+
ULevelEditorPlaySettings* PlayInEditorSettings = GetMutableDefault<ULevelEditorPlaySettings>();
190+
OverridePlaySettings(PlayInEditorSettings);
191+
192+
159193
// this is supposed to be how it works but cant figure out where is bAtPlayerStart
160194
// well basically because this is just ignored!!
195+
// note that 3rd param is bInSimulateInEditor - which only sets play_params.WorldType if true
196+
// (see code in Editor/UnrealEd/Private/PlayLevel.cpp)
161197
FRequestPlaySessionParams play_params;
162198
play_params.DestinationSlateViewport = nullptr;
199+
//play_params.WorldType = EPlaySessionWorldType::SimulateInEditor;
200+
201+
// NO - we have a big problem - this is in same function in MovieSceneCaptureDialogModule.cpp
202+
// - not clear how we get this here - unless we call OverridePlaySettings in this function as above
203+
play_params.EditorPlaySettings = PlayInEditorSettings;
204+
205+
play_params.CustomPIEWindow = CustomWindow;
206+
163207
GEditor->RequestPlaySession(play_params);
164208
#else
165209
GEditor->RequestPlaySession(true, nullptr, false);
@@ -176,6 +220,10 @@ struct FInEditorMultiCapture : TSharedFromThis<FInEditorMultiCapture>
176220
PlayInEditorSettings->CenterNewWindow = true;
177221
PlayInEditorSettings->LastExecutedPlayModeType = EPlayModeType::PlayMode_InEditorFloating;
178222

223+
#if ENGINE_MINOR_VERSION >= 25
224+
// this is complicated - instead of specifying here we need to specify in FRequestPlaySessionParams
225+
// but that means this needs to be done in the PlaySession function
226+
#else
179227
TSharedRef<SWindow> CustomWindow = SNew(SWindow)
180228
.Title(FText::FromString("Movie Render - Preview"))
181229
.AutoCenter(EAutoCenter::PrimaryWorkArea)
@@ -194,6 +242,7 @@ struct FInEditorMultiCapture : TSharedFromThis<FInEditorMultiCapture>
194242
FSlateApplication::Get().AddWindow(CustomWindow);
195243

196244
PlayInEditorSettings->CustomPIEWindow = CustomWindow;
245+
#endif
197246

198247
// Reset everything else
199248
PlayInEditorSettings->GameGetsMouseControl = false;

0 commit comments

Comments
 (0)