MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / StartRecording

Method StartRecording

Source/URLab/Private/Replay/MjReplayManager.cpp:305–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303// --- Control API ---
304
305void AMjReplayManager::StartRecording()
306{
307 if (bIsReplaying)
308 StopReplay();
309
310 GetLiveFrames().Empty();
311 ActiveSessionName = LiveSessionName;
312 bIsRecording = true;
313 bCacheValid = false;
314 bFirstFrameLogged = false;
315 CachedJointNames.Empty();
316
317 // Refetch Manager if BeginPlay's fetch lost the race against
318 // AAMjManager::Instance being set. Without this, recording
319 // silently captures zero frames because the OnPostStep hook
320 // below never installs.
321 if (!Manager)
322 {
323 Manager = AAMjManager::GetManager();
324 }
325
326 // Re-register the PostStep callback (it gets cleared by StopRecording)
327 // Sets OnPostStep directly rather than RegisterPostStepCallback -- replay
328 // needs exclusive control of the callback, not append-to behavior.
329 if (Manager && Manager->PhysicsEngine)
330 {
331 Manager->PhysicsEngine->OnPostStep = [this](mjModel* m, mjData* d) {
332 this->OnPostStep(m, d);
333 };
334 }
335 else
336 {
337 UE_LOG(LogURLabReplay, Warning,
338 TEXT("ReplayManager: StartRecording called but no Manager / PhysicsEngine — frames will not be captured."));
339 }
340
341 UE_LOG(LogURLabReplay, Log, TEXT("ReplayManager: Started Recording"));
342}
343
344void AMjReplayManager::StopRecording()
345{

Callers 3

RunTestMethod · 0.45
HandleRecordingMethod · 0.45
OnRecordClickedMethod · 0.45

Calls 1

OnPostStepMethod · 0.95

Tested by 1

RunTestMethod · 0.36