L5 : option de diagnostic -LPDumpVars (contenu des variables de GI au demarrage et a la fin)

Dump de MeshSexRace en -game : 24 corps, Mesh vide au demarrage pour tous
(chargement a la demande), 6 corps legacy jamais charges (LegacyPercentage=0).
Presets de quete : race Daz.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
edujiro5972 2026-09-29 09:50:00 +02:00
parent 8bada02b9b
commit 58016141e8
2 changed files with 57 additions and 0 deletions

View file

@ -6,7 +6,11 @@
#include "GeneralProjectSettings.h" #include "GeneralProjectSettings.h"
#include "HAL/FileManager.h" #include "HAL/FileManager.h"
#include "HAL/IConsoleManager.h" #include "HAL/IConsoleManager.h"
#include "Engine/GameInstance.h"
#include "Misc/App.h" #include "Misc/App.h"
#include "Misc/CommandLine.h"
#include "Misc/Parse.h"
#include "UObject/UnrealType.h"
#include "Misc/EngineVersion.h" #include "Misc/EngineVersion.h"
#include "Misc/OutputDevice.h" #include "Misc/OutputDevice.h"
#include "Misc/Paths.h" #include "Misc/Paths.h"
@ -124,10 +128,56 @@ void ULPSessionLogSubsystem::Initialize(FSubsystemCollectionBase& Collection)
} }
LogStartupSummary(); LogStartupSummary();
DumpRequestedVariables(TEXT("demarrage"));
}
void ULPSessionLogSubsystem::DumpRequestedVariables(const TCHAR* When) const
{
FString List;
if (!FParse::Value(FCommandLine::Get(), TEXT("LPDumpVars="), List, false))
{
return;
}
const UGameInstance* GI = GetGameInstance();
if (!GI)
{
return;
}
TArray<FString> Names;
List.ParseIntoArray(Names, TEXT(","), true);
for (const FString& Name : Names)
{
const FProperty* Prop = GI->GetClass()->FindPropertyByName(FName(*Name));
if (!Prop)
{
UE_LOG(LogLifePlay, Warning, TEXT("[dump %s] %s : variable introuvable sur %s"), When, *Name, *GI->GetClass()->GetName());
continue;
}
if (const FArrayProperty* ArrayProp = CastField<FArrayProperty>(Prop))
{
FScriptArrayHelper Helper(ArrayProp, ArrayProp->ContainerPtrToValuePtr<void>(GI));
UE_LOG(LogLifePlay, Display, TEXT("[dump %s] %s : %d element(s)"), When, *Name, Helper.Num());
for (int32 i = 0; i < Helper.Num(); ++i)
{
FString Text;
ArrayProp->Inner->ExportTextItem_Direct(Text, Helper.GetRawPtr(i), nullptr, const_cast<UGameInstance*>(GI), PPF_None);
UE_LOG(LogLifePlay, Display, TEXT("[dump %s] %s[%d] = %s"), When, *Name, i, *Text.Left(600));
}
}
else
{
FString Text;
Prop->ExportTextItem_Direct(Text, Prop->ContainerPtrToValuePtr<void>(GI), nullptr, const_cast<UGameInstance*>(GI), PPF_None);
UE_LOG(LogLifePlay, Display, TEXT("[dump %s] %s = %s"), When, *Name, *Text.Left(600));
}
}
} }
void ULPSessionLogSubsystem::Deinitialize() void ULPSessionLogSubsystem::Deinitialize()
{ {
DumpRequestedVariables(TEXT("fin"));
LogSessionSummary(); LogSessionSummary();
if (Counter.IsValid()) if (Counter.IsValid())

View file

@ -31,6 +31,13 @@ public:
private: private:
void LogStartupSummary() const; void LogStartupSummary() const;
/**
* Diagnostic (lot L5) : ecrit dans le journal le contenu des variables de l'instance de
* jeu (GI) nommees sur la ligne de commande, par exemple -LPDumpVars=MeshSexRace,LegacyPercentage.
* Un tableau est ecrit element par element. Sans l'option, ne fait rien.
*/
void DumpRequestedVariables(const TCHAR* When) const;
TSharedPtr<FLPLogCounter> Counter; TSharedPtr<FLPLogCounter> Counter;
double StartTime = 0.0; double StartTime = 0.0;
}; };