From 7f7a041978a57ba03e3cbd712f0ae1df7781c2c4 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 22 Oct 2024 13:25:27 -0400 Subject: [PATCH] Fixes for GasaGen_AttributeSets --- .../Win64/UnrealEditor-GasaEditor.dll | 4 +- .../Gasa/AbilitySystem/GasaAbilitySystem.h | 10 +- .../Gasa/AbilitySystem/GasaAttributeSet.cpp | 70 +++++++------- .../Gasa/AbilitySystem/GasaAttributeSet.h | 91 ++++++++++--------- .../AbilitySystem/GasaAttributeSet_Inlines.h | 38 ++++---- .../GasaGen/GasaGen_AttributeSets.cpp | 58 ++++++------ 6 files changed, 137 insertions(+), 134 deletions(-) diff --git a/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll b/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll index 5170be4..aa60cb9 100644 --- a/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll +++ b/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e6d4de45e8d1f8b377c1608105ce1674d62304a7a0b1abde1afac5db1ba05bd -size 50490368 +oid sha256:5d92841f5054f1f802c4ff6b6c421045e90af0d2c6668dc24d7c542ba2e1a3e9 +size 50547200 diff --git a/Project/Source/Gasa/AbilitySystem/GasaAbilitySystem.h b/Project/Source/Gasa/AbilitySystem/GasaAbilitySystem.h index bfacf63..cf1a466 100644 --- a/Project/Source/Gasa/AbilitySystem/GasaAbilitySystem.h +++ b/Project/Source/Gasa/AbilitySystem/GasaAbilitySystem.h @@ -13,14 +13,14 @@ struct GASA_API FAttributeSetField : public FTableRowBase FAttributeSetField() : Name("Provide_Name") - , Category("Optional Category") + , Category("Provide Category") , Description("Provide Description") , BaseValue(0) , bUseMinAttribute(false) , bUseMaxAttribute(false) - , MinAttribute("Attribute behaving has minimum value") + , MinAttribute("") , MinValue(0) - , MaxAttribute("Attribute behaving has maximum value") + , MaxAttribute("") , MaxValue(0) {} virtual ~FAttributeSetField() @@ -48,13 +48,13 @@ struct GASA_API FAttributeSetField : public FTableRowBase bool bUseMaxAttribute; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMinAttribute", EditConditionHides)) - FString MinAttribute; + FName MinAttribute; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMinAttribute==false", EditConditionHides)) float MinValue; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMaxAttribute", EditConditionHides)) - FString MaxAttribute; + FName MaxAttribute; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMaxAttribute==false", EditConditionHides)) float MaxValue; diff --git a/Project/Source/Gasa/AbilitySystem/GasaAttributeSet.cpp b/Project/Source/Gasa/AbilitySystem/GasaAttributeSet.cpp index acb846d..3418eb5 100644 --- a/Project/Source/Gasa/AbilitySystem/GasaAttributeSet.cpp +++ b/Project/Source/Gasa/AbilitySystem/GasaAttributeSet.cpp @@ -1,4 +1,4 @@ -// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp +// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp #include "GasaAttributeSet.h" #include "GasaAttributeSet_Inlines.h" #include "EffectProperties.h" @@ -8,15 +8,21 @@ #include "Networking/GasaNetLibrary.h" #include "GameplayEffectExtension.h" -UGasaAttributeSet::UGasaAttributeSet() -{ - InitHealth( 100.f ); - InitMaxHealth( 100.f ); - InitMana( 50.f ); - InitMaxMana( 50.f ); -} +UGasaAttributeSet::UGasaAttributeSet() {} #pragma region Rep Notifies +void UGasaAttributeSet::Client_OnRep_Health( FGameplayAttributeData& PrevHealth ) +{ + // From GAMEPLAYATTRIBUTE_REPNOTIFY + static FProperty* UGasaAttributeSetProperty = FindFieldChecked( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) ); + GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Health, PrevHealth ); +} +void UGasaAttributeSet::Client_OnRep_Mana( FGameplayAttributeData& PrevMana ) +{ + // From GAMEPLAYATTRIBUTE_REPNOTIFY + static FProperty* UGasaAttributeSetProperty = FindFieldChecked( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) ); + GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Mana, PrevMana ); +} void UGasaAttributeSet::Client_OnRep_Strength( FGameplayAttributeData& PrevStrength ) { // From GAMEPLAYATTRIBUTE_REPNOTIFY @@ -45,24 +51,12 @@ void UGasaAttributeSet::Client_OnRep_Vigor( FGameplayAttributeData& PrevVigor ) static FProperty* UGasaAttributeSetProperty = FindFieldChecked( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Vigor ) ); GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Vigor, PrevVigor ); } -void UGasaAttributeSet::Client_OnRep_Health( FGameplayAttributeData& PrevHealth ) -{ - // From GAMEPLAYATTRIBUTE_REPNOTIFY - static FProperty* UGasaAttributeSetProperty = FindFieldChecked( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) ); - GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Health, PrevHealth ); -} void UGasaAttributeSet::Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth ) { // From GAMEPLAYATTRIBUTE_REPNOTIFY static FProperty* UGasaAttributeSetProperty = FindFieldChecked( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) ); GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxHealth, PrevMaxHealth ); } -void UGasaAttributeSet::Client_OnRep_Mana( FGameplayAttributeData& PrevMana ) -{ - // From GAMEPLAYATTRIBUTE_REPNOTIFY - static FProperty* UGasaAttributeSetProperty = FindFieldChecked( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) ); - GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Mana, PrevMana ); -} void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana ) { // From GAMEPLAYATTRIBUTE_REPNOTIFY @@ -77,6 +71,14 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat FEffectProperties Props; Props.Populate( Data ); + if ( Data.EvaluatedData.Attribute == GetHealthAttribute() ) + { + SetHealth( FMath::Clamp( GetHealth(), 0, GetMaxHealth() ) ); + } + if ( Data.EvaluatedData.Attribute == GetManaAttribute() ) + { + SetMana( FMath::Clamp( GetMana(), 0, GetMaxMana() ) ); + } if ( Data.EvaluatedData.Attribute == GetStrengthAttribute() ) { SetStrength( FMath::Clamp( GetStrength(), 0, 999.000000 ) ); @@ -93,18 +95,10 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat { SetVigor( FMath::Clamp( GetVigor(), 0, 999.000000 ) ); } - if ( Data.EvaluatedData.Attribute == GetHealthAttribute() ) - { - SetHealth( FMath::Clamp( GetHealth(), 0, GetMaxHealth() ) ); - } if ( Data.EvaluatedData.Attribute == GetMaxHealthAttribute() ) { SetMaxHealth( FMath::Clamp( GetMaxHealth(), 0, 99999.000000 ) ); } - if ( Data.EvaluatedData.Attribute == GetManaAttribute() ) - { - SetMana( FMath::Clamp( GetMana(), 0, GetMaxMana() ) ); - } if ( Data.EvaluatedData.Attribute == GetMaxManaAttribute() ) { SetMaxMana( FMath::Clamp( GetMaxMana(), 0, 99999.000000 ) ); @@ -115,6 +109,14 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute, { Super::PreAttributeChange( Attribute, NewValue ); + if ( Attribute == GetHealthAttribute() ) + { + NewValue = FMath::Clamp( NewValue, 0, GetMaxHealth() ); + } + if ( Attribute == GetManaAttribute() ) + { + NewValue = FMath::Clamp( NewValue, 0, GetMaxMana() ); + } if ( Attribute == GetStrengthAttribute() ) { NewValue = FMath::Clamp( NewValue, 0, 999.000000 ); @@ -131,18 +133,10 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute, { NewValue = FMath::Clamp( NewValue, 0, 999.000000 ); } - if ( Attribute == GetHealthAttribute() ) - { - NewValue = FMath::Clamp( NewValue, 0, GetMaxHealth() ); - } if ( Attribute == GetMaxHealthAttribute() ) { NewValue = FMath::Clamp( NewValue, 0, 99999.000000 ); } - if ( Attribute == GetManaAttribute() ) - { - NewValue = FMath::Clamp( NewValue, 0, GetMaxMana() ); - } if ( Attribute == GetMaxManaAttribute() ) { NewValue = FMath::Clamp( NewValue, 0, 99999.000000 ); @@ -153,12 +147,12 @@ void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray& O { Super::GetLifetimeReplicatedProps( OutLifetimeProps ); + DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Health ); + DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Mana ); DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Strength ); DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Intelligence ); DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Resilience ); DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Vigor ); - DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Health ); DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxHealth ); - DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Mana ); DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxMana ); } diff --git a/Project/Source/Gasa/AbilitySystem/GasaAttributeSet.h b/Project/Source/Gasa/AbilitySystem/GasaAttributeSet.h index e12ead4..bf47892 100644 --- a/Project/Source/Gasa/AbilitySystem/GasaAttributeSet.h +++ b/Project/Source/Gasa/AbilitySystem/GasaAttributeSet.h @@ -1,4 +1,4 @@ -// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp +// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp #pragma once #include "AttributeSet.h" @@ -11,28 +11,36 @@ class GASA_API UGasaAttributeSet : public UAttributeSet public: UGasaAttributeSet(); - // Primary Attribute Fields + // Vital Attributes - UPROPERTY( ReplicatedUsing = Client_OnRep_Strength, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) + UPROPERTY( ReplicatedUsing = Client_OnRep_Health, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Vital" ) + FGameplayAttributeData Health; + UPROPERTY( ReplicatedUsing = Client_OnRep_Mana, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Vital" ) + FGameplayAttributeData Mana; + + // Primary Attributes + + UPROPERTY( ReplicatedUsing = Client_OnRep_Strength, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" ) FGameplayAttributeData Strength; - UPROPERTY( ReplicatedUsing = Client_OnRep_Intelligence, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) + UPROPERTY( ReplicatedUsing = Client_OnRep_Intelligence, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" ) FGameplayAttributeData Intelligence; - UPROPERTY( ReplicatedUsing = Client_OnRep_Resilience, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) + UPROPERTY( ReplicatedUsing = Client_OnRep_Resilience, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" ) FGameplayAttributeData Resilience; - UPROPERTY( ReplicatedUsing = Client_OnRep_Vigor, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) + UPROPERTY( ReplicatedUsing = Client_OnRep_Vigor, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" ) FGameplayAttributeData Vigor; - // Vital Attribute Fields + // Secondary Attributes - UPROPERTY( ReplicatedUsing = Client_OnRep_Health, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) - FGameplayAttributeData Health; - UPROPERTY( ReplicatedUsing = Client_OnRep_MaxHealth, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) + UPROPERTY( ReplicatedUsing = Client_OnRep_MaxHealth, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" ) FGameplayAttributeData MaxHealth; - UPROPERTY( ReplicatedUsing = Client_OnRep_Mana, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) - FGameplayAttributeData Mana; - UPROPERTY( ReplicatedUsing = Client_OnRep_MaxMana, EditAnywhere, BlueprintReadWrite, Category = "Attributes" ) + UPROPERTY( ReplicatedUsing = Client_OnRep_MaxMana, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" ) FGameplayAttributeData MaxMana; + + UFUNCTION() + void Client_OnRep_Health( FGameplayAttributeData& PrevHealth ); + UFUNCTION() + void Client_OnRep_Mana( FGameplayAttributeData& PrevMana ); UFUNCTION() void Client_OnRep_Strength( FGameplayAttributeData& PrevStrength ); UFUNCTION() @@ -42,15 +50,21 @@ public: UFUNCTION() void Client_OnRep_Vigor( FGameplayAttributeData& PrevVigor ); UFUNCTION() - void Client_OnRep_Health( FGameplayAttributeData& PrevHealth ); - UFUNCTION() void Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth ); UFUNCTION() - void Client_OnRep_Mana( FGameplayAttributeData& PrevMana ); - UFUNCTION() void Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana ); #pragma region Getters + static FGameplayAttribute GetHealthAttribute() + { + static FProperty* Prop = FindFieldChecked( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) ); + return Prop; + } + static FGameplayAttribute GetManaAttribute() + { + static FProperty* Prop = FindFieldChecked( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) ); + return Prop; + } static FGameplayAttribute GetStrengthAttribute() { static FProperty* Prop = FindFieldChecked( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Strength ) ); @@ -71,48 +85,47 @@ public: static FProperty* Prop = FindFieldChecked( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Vigor ) ); return Prop; } - static FGameplayAttribute GetHealthAttribute() - { - static FProperty* Prop = FindFieldChecked( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) ); - return Prop; - } static FGameplayAttribute GetMaxHealthAttribute() { static FProperty* Prop = FindFieldChecked( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) ); return Prop; } - static FGameplayAttribute GetManaAttribute() - { - static FProperty* Prop = FindFieldChecked( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) ); - return Prop; - } static FGameplayAttribute GetMaxManaAttribute() { static FProperty* Prop = FindFieldChecked( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) ); return Prop; } + FORCEINLINE float GetHealth() const { return Health.GetCurrentValue(); } + FORCEINLINE float GetMana() const { return Mana.GetCurrentValue(); } FORCEINLINE float GetStrength() const { return Strength.GetCurrentValue(); } FORCEINLINE float GetIntelligence() const { return Intelligence.GetCurrentValue(); } FORCEINLINE float GetResilience() const { return Resilience.GetCurrentValue(); } FORCEINLINE float GetVigor() const { return Vigor.GetCurrentValue(); } - FORCEINLINE float GetHealth() const { return Health.GetCurrentValue(); } FORCEINLINE float GetMaxHealth() const { return MaxHealth.GetCurrentValue(); } - FORCEINLINE float GetMana() const { return Mana.GetCurrentValue(); } FORCEINLINE float GetMaxMana() const { return MaxMana.GetCurrentValue(); } - #pragma endregion Getters +#pragma endregion Getters #pragma region Setters - FORCEINLINE void - SetStrength( float NewVal ); + FORCEINLINE void SetHealth( float NewVal ); + FORCEINLINE void SetMana( float NewVal ); + FORCEINLINE void SetStrength( float NewVal ); FORCEINLINE void SetIntelligence( float NewVal ); FORCEINLINE void SetResilience( float NewVal ); FORCEINLINE void SetVigor( float NewVal ); - FORCEINLINE void SetHealth( float NewVal ); FORCEINLINE void SetMaxHealth( float NewVal ); - FORCEINLINE void SetMana( float NewVal ); FORCEINLINE void SetMaxMana( float NewVal ); + FORCEINLINE void InitHealth( float NewVal ) + { + Health.SetBaseValue( NewVal ); + Health.SetCurrentValue( NewVal ); + } + FORCEINLINE void InitMana( float NewVal ) + { + Mana.SetBaseValue( NewVal ); + Mana.SetCurrentValue( NewVal ); + } FORCEINLINE void InitStrength( float NewVal ) { Strength.SetBaseValue( NewVal ); @@ -133,21 +146,11 @@ public: Vigor.SetBaseValue( NewVal ); Vigor.SetCurrentValue( NewVal ); } - FORCEINLINE void InitHealth( float NewVal ) - { - Health.SetBaseValue( NewVal ); - Health.SetCurrentValue( NewVal ); - } FORCEINLINE void InitMaxHealth( float NewVal ) { MaxHealth.SetBaseValue( NewVal ); MaxHealth.SetCurrentValue( NewVal ); } - FORCEINLINE void InitMana( float NewVal ) - { - Mana.SetBaseValue( NewVal ); - Mana.SetCurrentValue( NewVal ); - } FORCEINLINE void InitMaxMana( float NewVal ) { MaxMana.SetBaseValue( NewVal ); diff --git a/Project/Source/Gasa/AbilitySystem/GasaAttributeSet_Inlines.h b/Project/Source/Gasa/AbilitySystem/GasaAttributeSet_Inlines.h index 0ceb739..93b783a 100644 --- a/Project/Source/Gasa/AbilitySystem/GasaAttributeSet_Inlines.h +++ b/Project/Source/Gasa/AbilitySystem/GasaAttributeSet_Inlines.h @@ -1,4 +1,4 @@ -// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp +// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp #pragma once #include "GasaAttributeSet.h" @@ -6,6 +6,24 @@ #pragma region Attribute Setters FORCEINLINE +void UGasaAttributeSet::SetHealth( float NewVal ) +{ + UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent(); + if ( ensure( AbilityComp ) ) + { + AbilityComp->SetNumericAttributeBase( GetHealthAttribute(), NewVal ); + }; +} +FORCEINLINE +void UGasaAttributeSet::SetMana( float NewVal ) +{ + UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent(); + if ( ensure( AbilityComp ) ) + { + AbilityComp->SetNumericAttributeBase( GetManaAttribute(), NewVal ); + }; +} +FORCEINLINE void UGasaAttributeSet::SetStrength( float NewVal ) { UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent(); @@ -42,15 +60,6 @@ void UGasaAttributeSet::SetVigor( float NewVal ) }; } FORCEINLINE -void UGasaAttributeSet::SetHealth( float NewVal ) -{ - UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent(); - if ( ensure( AbilityComp ) ) - { - AbilityComp->SetNumericAttributeBase( GetHealthAttribute(), NewVal ); - }; -} -FORCEINLINE void UGasaAttributeSet::SetMaxHealth( float NewVal ) { UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent(); @@ -60,15 +69,6 @@ void UGasaAttributeSet::SetMaxHealth( float NewVal ) }; } FORCEINLINE -void UGasaAttributeSet::SetMana( float NewVal ) -{ - UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent(); - if ( ensure( AbilityComp ) ) - { - AbilityComp->SetNumericAttributeBase( GetManaAttribute(), NewVal ); - }; -} -FORCEINLINE void UGasaAttributeSet::SetMaxMana( float NewVal ) { UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent(); diff --git a/Project/Source/GasaEditor/GasaGen/GasaGen_AttributeSets.cpp b/Project/Source/GasaEditor/GasaGen/GasaGen_AttributeSets.cpp index 8c401e0..a26a175 100644 --- a/Project/Source/GasaEditor/GasaGen/GasaGen_AttributeSets.cpp +++ b/Project/Source/GasaEditor/GasaGen/GasaGen_AttributeSets.cpp @@ -10,34 +10,18 @@ using namespace gen; #pragma push_macro("UFUNCTION") #pragma push_macro("FORCEINLINE") #pragma push_macro("ensure") +#pragma push_macro("GET_MEMBER_NAME_CHECKED") #undef UPROPERTY #undef UFUNCTION #undef FORCEINLINE #undef ensure +#undef GET_MEMBER_NAME_CHECKED -PRAGMA_DISABLE_OPTIMIZATION -void generate_AttributeSets() +void gen_attribute_set_from_table( UDataTable* table, FString asset_name ) { - // All attribute sets are tracked in Gasa's dev options for this project. - TArray< TSoftObjectPtr> AttributeSetTables = Gasa::GetDevOptions()->AttributeSets; - check( AttributeSetTables.Num() > 0 ); - - // TODO(Ed): Doing one for now - FGraphEventRef LoadTableTask; - UDataTable* AttributeSetTable = nullptr; - FGraphEventArray Prerequisites; - LoadTableTask = FFunctionGraphTask::CreateAndDispatchWhenReady( - [ & AttributeSetTable, & AttributeSetTables ]() - { - AttributeSetTable = AttributeSetTables[0].LoadSynchronous(); - }, - TStatId(), &Prerequisites, ENamedThreads::GameThread - ); - FTaskGraphInterface::Get().WaitUntilTaskCompletes(LoadTableTask); - TMap> AttributesByCategory; { - TMap< FName, uint8* > const& RowMap = AttributeSetTable->GetRowMap(); + TMap< FName, uint8* > const& RowMap = table->GetRowMap(); for (const TPair& Row : RowMap) { FAttributeSetField const* RowData = rcast( FAttributeSetField const* , Row.Value); @@ -50,11 +34,9 @@ void generate_AttributeSets() } } - FString AssetName = AttributeSetTables[0].GetAssetName(); - check( AssetName.StartsWith(TEXT("DT_") )) - AssetName = AssetName.RightChop(3); - - String str_AssetName = to_string(AssetName); + check( asset_name.StartsWith(TEXT("DT_") )) + asset_name = asset_name.RightChop(3); + String str_AssetName = to_string(asset_name); String class_name = String::fmt_buf(GlobalAllocator, "U%S", str_AssetName); String header_file_name = String::fmt_buf(GlobalAllocator, "%S.h", str_AssetName); @@ -454,10 +436,34 @@ void generate_AttributeSets() format_file(path_source_file); } } -PRAGMA_ENABLE_OPTIMIZATION + +void generate_AttributeSets() +{ + // All attribute sets are tracked in Gasa's dev options for this project. + TArray< TSoftObjectPtr> AttributeSetTables = Gasa::GetDevOptions()->AttributeSets; + check( AttributeSetTables.Num() > 0 ); + + for ( TSoftObjectPtr table : AttributeSetTables ) + { + FGraphEventRef LoadTableTask; + UDataTable* AttributeSetTable = nullptr; + FGraphEventArray Prerequisites; + LoadTableTask = FFunctionGraphTask::CreateAndDispatchWhenReady( + [ & AttributeSetTable, & AttributeSetTables ]() + { + AttributeSetTable = AttributeSetTables[0].LoadSynchronous(); + }, + TStatId(), &Prerequisites, ENamedThreads::GameThread + ); + FTaskGraphInterface::Get().WaitUntilTaskCompletes(LoadTableTask); + + gen_attribute_set_from_table( AttributeSetTable, table.GetAssetName() ); + } +} #pragma pop_macro("UPROPERTY") #pragma pop_macro("UFUNCTION") #pragma pop_macro("FORCEINLINE") #pragma pop_macro("ensure") +#pragma pop_macro("GET_MEMBER_NAME_CHECKED")