Commit 2340e00e authored by Kyrium's avatar Kyrium
Browse files

fix Swatch Groups

parent 705dafa6
......@@ -239,11 +239,11 @@ void UKBFLCustomizerSubsystem::GatherInterfaces()
bool UKBFLCustomizerSubsystem::SetDefaultToSwatchGroup(TSubclassOf<UFGSwatchGroup> SwatchGroup, TSubclassOf<UFGFactoryCustomizationDescriptor_Swatch> Swatch)
{
UE_LOG(CustomizerSubsystem, Log, TEXT("SetDefaultToSwatchGroup"));
AFGBuildableSubsystem* Subsystem = AFGBuildableSubsystem::Get(this);
AFGGameState* GameState = Cast<AFGGameState>(UGameplayStatics::GetGameState(this));
AFGPlayerController* PlayerController = UKBFL_Player::GetFGController(this);
if(Subsystem && GameState && Swatch && SwatchGroup && PlayerController)
if(Subsystem && GameState && Swatch && SwatchGroup)
{
FSwatchGroupData NewGroup;
NewGroup.Swatch = Swatch;
......@@ -260,12 +260,18 @@ bool UKBFLCustomizerSubsystem::SetDefaultToSwatchGroup(TSubclassOf<UFGSwatchGrou
{
GameState->mSwatchGroupDatum.Add(NewGroup);
GameState->SetDefaultSwatchForBuildableGroup(SwatchGroup, Swatch);
PlayerController->SetDefaultSwatchForBuildableGroup(SwatchGroup, Swatch);
if(AFGPlayerController* PlayerController = UKBFL_Player::GetFGController(this))
PlayerController->SetDefaultSwatchForBuildableGroup(SwatchGroup, Swatch);
Subsystem->mColorSlotsAreDirty = true;
UE_LOG(CustomizerSubsystem, Log, TEXT("Swatch Group found and success added: %s > %s"), *SwatchGroup->GetName(), *Swatch->GetName());
}
UE_LOG(CustomizerSubsystem, Log, TEXT("Swatch Group found and success: %s > %s"), *SwatchGroup->GetName(), *Swatch->GetName());
UE_LOG(CustomizerSubsystem, Log, TEXT("Swatch Group found: %s > %s"), *SwatchGroup->GetName(), *Swatch->GetName());
return true;
}
UE_LOG(CustomizerSubsystem, Log, TEXT("Subsystem && GameState && Swatch && SwatchGroup something is invalid!"));
return false;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment