Fix for Quality Settings apply function
This commit is contained in:
parent
56652b769d
commit
f9ae4b3c7c
|
@ -25,6 +25,9 @@ SynchronousMode=true
|
|||
; performance.
|
||||
SendNonPlayerAgentsInfo=false
|
||||
|
||||
[CARLA/QualitySettings]
|
||||
DefaultLevel=Epic
|
||||
|
||||
[CARLA/LevelSettings]
|
||||
; Path of the vehicle class to be used for the player. Leave empty for default.
|
||||
; Paths follow the pattern "/Game/Blueprints/Vehicles/Mustang/Mustang.Mustang_C"
|
||||
|
@ -85,6 +88,7 @@ RotationYaw=0
|
|||
; depth map images instead.
|
||||
PostProcessing=Depth
|
||||
|
||||
|
||||
[CARLA/Sensor/MyLidar]
|
||||
SensorType=LIDAR_RAY_TRACE
|
||||
; Number of lasers.
|
||||
|
@ -106,6 +110,3 @@ RotationPitch=0
|
|||
RotationYaw=0
|
||||
RotationRoll=0
|
||||
|
||||
|
||||
[CARLA/QualitySettings]
|
||||
DefaultLevel=Epic
|
|
@ -131,7 +131,8 @@ void ACarlaGameModeBase::BeginPlay()
|
|||
Super::BeginPlay();
|
||||
|
||||
const auto &CarlaSettings = GameInstance->GetCarlaSettings();
|
||||
|
||||
CarlaSettings.ApplyQualitySettingsLevelPostRestart();
|
||||
|
||||
// Setup semantic segmentation if necessary.
|
||||
if (CarlaSettings.bSemanticSegmentationEnabled) {
|
||||
TagActorsForSemanticSegmentation();
|
||||
|
|
|
@ -118,9 +118,9 @@ static void LoadSettingsFromConfig(
|
|||
ConfigFile.GetString(S_CARLA_QUALITYSETTINGS, TEXT("DefaultLevel"), sDefaultLevel);
|
||||
if(!Settings.SetQualitySettingsLevel(FQualitySettings::FromString(sDefaultLevel)))
|
||||
{
|
||||
//ERROR! @TODO : fix settings
|
||||
///apply pre-restart.... @todo
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Sensors.
|
||||
FString Sensors;
|
||||
|
@ -179,14 +179,17 @@ bool UCarlaSettings::SetQualitySettingsLevel(EQualitySettingsLevel newDefaultLev
|
|||
return false;
|
||||
}
|
||||
|
||||
/*if(newDefaultLevel!=DefaultQualitySettingsLevel)
|
||||
{
|
||||
return true;
|
||||
}*/
|
||||
DefaultQualitySettingsLevel = newDefaultLevel;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void UCarlaSettings::ApplyQualitySettingsLevelPostRestart() const
|
||||
{
|
||||
UWorld *world = GetWorld();
|
||||
|
||||
if(!world) return ;
|
||||
//set the quality settings now
|
||||
switch(newDefaultLevel)
|
||||
switch(DefaultQualitySettingsLevel)
|
||||
{
|
||||
case EQualitySettingsLevel::Low: {//r.SSR.qualitylaunch commands to lower quality settings
|
||||
world->Exec(world,TEXT("r.DefaultFeature.MotionBlur 0"));
|
||||
|
@ -248,34 +251,31 @@ bool UCarlaSettings::SetQualitySettingsLevel(EQualitySettingsLevel newDefaultLev
|
|||
|
||||
}
|
||||
}*/
|
||||
|
||||
//iterate all lights, deactivate shadows
|
||||
|
||||
//iterate all directional lights, deactivate shadows
|
||||
UGameplayStatics::GetAllActorsOfClass(world, ALight::StaticClass(), actors);
|
||||
for(i=0;i<actors.Num();i++)
|
||||
{
|
||||
ALight *light = Cast<ALight>(actors[i]);
|
||||
if(light)
|
||||
//tweak directional lights
|
||||
ADirectionalLight* directionallight = Cast<ADirectionalLight>(actors[i]);
|
||||
if(directionallight)
|
||||
{
|
||||
//disable all lights shadows
|
||||
light->SetCastShadows(false);
|
||||
|
||||
//tweak directional lights
|
||||
ADirectionalLight* directionallight = Cast<ADirectionalLight>(light);
|
||||
if(directionallight)
|
||||
{
|
||||
directionallight->SetLightFunctionFadeDistance(LowLightFadeDistance);
|
||||
}
|
||||
|
||||
//disable point lights
|
||||
APointLight* pointlight = Cast<APointLight>(light);
|
||||
if(pointlight)
|
||||
{
|
||||
actors[i]->SetActorHiddenInGame(true);
|
||||
}
|
||||
directionallight->SetCastShadows(false);
|
||||
directionallight->SetLightFunctionFadeDistance(LowLightFadeDistance);
|
||||
continue;
|
||||
}
|
||||
|
||||
//disable point lights
|
||||
/*
|
||||
APointLight* pointlight = Cast<APointLight>(actors[i]);
|
||||
if(pointlight)
|
||||
{
|
||||
actors[i]->SetActorHiddenInGame(true);
|
||||
}
|
||||
*/
|
||||
//disable any other type of light
|
||||
actors[i]->SetActorHiddenInGame(true);
|
||||
}
|
||||
|
||||
|
||||
//Set all the roads the low quality material
|
||||
/*UGameplayStatics::GetAllActorsWithTag(world, FName("CARLA_ROAD"),actors);
|
||||
for(i=0; i<actors.Num(); i++)
|
||||
|
@ -304,9 +304,6 @@ bool UCarlaSettings::SetQualitySettingsLevel(EQualitySettingsLevel newDefaultLev
|
|||
|
||||
default: ;
|
||||
}
|
||||
DefaultQualitySettingsLevel = newDefaultLevel;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void UCarlaSettings::LoadSettings()
|
||||
|
|
|
@ -48,9 +48,19 @@ class CARLA_API UCarlaSettings : public UObject
|
|||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
/** Sets the new quality settings level and make changes in the game related to it. Returns the reuslt of the operation */
|
||||
|
||||
/**
|
||||
* Sets the new quality settings level and make changes in the game related to it.
|
||||
* Returns the result of the operation.
|
||||
* @note This will not apply the quality settings. Use ApplyQualitySettings functions instead
|
||||
* @param newDefaultLevel Store the new quality
|
||||
*/
|
||||
bool SetQualitySettingsLevel(EQualitySettingsLevel newDefaultLevel);
|
||||
|
||||
/** @return current quality settings level (could not be applied yet) */
|
||||
EQualitySettingsLevel GetQualitySettingsLevel() const { return DefaultQualitySettingsLevel; }
|
||||
/** @todo move to class */
|
||||
void ApplyQualitySettingsLevelPostRestart() const;
|
||||
void ApplyQualitySettingsLevelPreRestart() const{}
|
||||
/** Load the settings based on the command-line arguments and the INI file if provided. */
|
||||
void LoadSettings();
|
||||
|
||||
|
@ -164,12 +174,12 @@ public:
|
|||
/// @name Quality Settings
|
||||
// ===========================================================================
|
||||
/// @{
|
||||
public:
|
||||
private:
|
||||
/** Quality Settings level. */
|
||||
UPROPERTY(Category = "Quality Settings", VisibleAnywhere)
|
||||
UPROPERTY(Category = "Quality Settings", VisibleAnywhere, meta =(AllowPrivateAccess="true"))
|
||||
EQualitySettingsLevel DefaultQualitySettingsLevel = EQualitySettingsLevel::None;
|
||||
|
||||
|
||||
public:
|
||||
//UPROPERTY(Category = "Quality Settings", EditAnywhere, config)
|
||||
//TArray<UMaterial*> RoadMaterials;
|
||||
|
||||
|
|
Loading…
Reference in New Issue