Skip to content

Fix LogError on 5.1 editor starturp#441

Closed
a-dmg wants to merge 1 commit intoShadowfallStudios:mainfrom
a-dmg:fix-editor-statup-LogError
Closed

Fix LogError on 5.1 editor starturp#441
a-dmg wants to merge 1 commit intoShadowfallStudios:mainfrom
a-dmg:fix-editor-statup-LogError

Conversation

@a-dmg
Copy link

@a-dmg a-dmg commented Mar 7, 2023

Dear @dyanikoglu ,

I would like to propose this simple commit that silences a set of LogError on editor startup (v5.1). Those interfere with other plugins' logs at start-up and could be annoying.

Here is a sample of the LogError I have:

...
Error        LogClass                  StructProperty FALSAnimCharacterInformation::AimingRotation is not initialized properly. Module:ALSV4_CPP File:Public/Library/ALSAnimationStructLibrary.h
Error        LogClass                  StructProperty FALSAnimCharacterInformation::CharacterActorRotation is not initialized properly. Module:ALSV4_CPP File:Public/Library/ALSAnimationStructLibrary.h
Error        LogClass                  StructProperty FALSAnimCharacterInformation::Velocity is not initialized properly. Module:ALSV4_CPP File:Public/Library/ALSAnimationStructLibrary.h
Error        LogClass                  StructProperty FALSAnimCharacterInformation::RelativeVelocityDirection is not initialized properly. Module:ALSV4_CPP File:Public/Library/ALSAnimationStructLibrary.h
Error        LogClass                  StructProperty FALSAnimCharacterInformation::Acceleration is not initialized properly. Module:ALSV4_CPP File:Public/Library/ALSAnimationStructLibrary.h
Error        LogClass                  StructProperty FALSAnimCharacterInformation::MovementInput is not initialized properly. Module:ALSV4_CPP File:Public/Library/ALSAnimationStructLibrary.h
Error        LogClass                  StructProperty FALSAnimGraphAimingValues::SmoothedAimingRotation is not initialized properly. Module:ALSV4_CPP File:Public/Library/ALSAnimationStructLibrary.h
Error        LogClass                  StructProperty FALSAnimGraphAimingValues::SpineRotation is not initialized properly. Module:ALSV4_CPP File:Public/Library/ALSAnimationStructLibrary.h
Error        LogClass                  StructProperty FALSAnimGraphAimingValues::AimingAngle is not initialized properly. 
...

Let me know if there is some stuff you want to change?

Thank you for your awesome job with ALS-Community!

Cheers,
Alice

This commits adds default values to struct's members without
a proper default initializer. Thus silencing LogError on
startup for member considered not initialized properly.
@KITATUS
Copy link

KITATUS commented Apr 9, 2023

Would it not be better to go through and instead of making the struct messier with these instead "fix" the structs so they are properly laid out by moving all of the variables into constructors? Example:

`
USTRUCT(BlueprintType)
struct FALSHitFX : public FTableRowBase
{
GENERATED_BODY()

UPROPERTY(EditAnywhere, Category = "Surface")
TEnumAsByte<enum EPhysicalSurface> SurfaceType;

UPROPERTY(EditAnywhere, Category = "Sound")
TSoftObjectPtr<USoundBase> Sound;

UPROPERTY(EditAnywhere, Category = "Sound")
EALSSpawnType SoundSpawnType;

UPROPERTY(EditAnywhere, Category = "Sound", meta = (EditCondition = "SoundSpawnType == EALSSpawnType::Attached"))
TEnumAsByte<enum EAttachLocation::Type> SoundAttachmentType;

UPROPERTY(EditAnywhere, Category = "Sound")
FVector SoundLocationOffset;

UPROPERTY(EditAnywhere, Category = "Sound")
FRotator SoundRotationOffset;

UPROPERTY(EditAnywhere, Category = "Decal")
TSoftObjectPtr<UMaterialInterface> DecalMaterial;

UPROPERTY(EditAnywhere, Category = "Decal")
EALSSpawnType DecalSpawnType;

UPROPERTY(EditAnywhere, Category = "Decal", meta = (EditCondition = "DecalSpawnType == EALSSpawnType::Attached"))
TEnumAsByte<enum EAttachLocation::Type> DecalAttachmentType;

UPROPERTY(EditAnywhere, Category = "Decal")
float DecalLifeSpan;

UPROPERTY(EditAnywhere, Category = "Decal")
FVector DecalSize;

UPROPERTY(EditAnywhere, Category = "Decal")
FVector DecalLocationOffset;

UPROPERTY(EditAnywhere, Category = "Decal")
FRotator DecalRotationOffset;

UPROPERTY(EditAnywhere, Category = "Niagara")
TSoftObjectPtr<UNiagaraSystem> NiagaraSystem;

UPROPERTY(EditAnywhere, Category = "Niagara")
EALSSpawnType NiagaraSpawnType;

UPROPERTY(EditAnywhere, Category = "Niagara", meta = (EditCondition = "NiagaraSpawnType == EALSSpawnType::Attached"))
TEnumAsByte<enum EAttachLocation::Type> NiagaraAttachmentType;

UPROPERTY(EditAnywhere, Category = "Niagara")
FVector NiagaraLocationOffset;

UPROPERTY(EditAnywhere, Category = "Niagara")
FRotator NiagaraRotationOffset;

FALSHitFX()
{
	SurfaceType = EPhysicalSurface::SurfaceType1;
	Sound = nullptr;
	SoundSpawnType = EALSSpawnType::Attached;
	SoundAttachmentType = EAttachLocation::Type::KeepRelativeOffset;
	SoundLocationOffset = FVector();
	SoundRotationOffset = FRotator();
	DecalMaterial = nullptr;
	DecalSpawnType = EALSSpawnType::Attached;
	DecalAttachmentType = EAttachLocation::Type::KeepRelativeOffset;
	DecalLifeSpan = 10.0f;
	DecalSize = FVector();
	DecalLocationOffset = FVector();
	DecalRotationOffset = FRotator();
	NiagaraSystem = nullptr;
	NiagaraSpawnType = EALSSpawnType::Attached;
	NiagaraAttachmentType = EAttachLocation::Type::KeepRelativeOffset;
	NiagaraLocationOffset = FVector();
	NiagaraRotationOffset = FRotator();
}
`

@a-dmg
Copy link
Author

a-dmg commented Apr 13, 2023

@KITATUS Thanks for your suggestion! However, declaring members with default values doesn't make the struct messier. Assigning them within the constructor is not a good idea, in my opinion, as this leaves room for mistakes such as forgetting to default initialize one member (again) and lead to this error again:

...
Error        LogClass                  StructProperty FALSAnimCharacterInformation::AimingRotation is not initialized properly. Module:ALSV4_CPP File:Public/Library/ALSAnimationStructLibrary.h
...

@dyanikoglu
Copy link
Member

Fixed in dev branch. Closed.

@dyanikoglu dyanikoglu closed this Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants