Added a new name tag for sky spheres.
Minor fixes for Carla Settings. Renamed the quality DefaultLevel to QualityLevel in code and config file.
This commit is contained in:
parent
42d5127c99
commit
8f0949ba5a
|
@ -26,7 +26,7 @@ SynchronousMode=true
|
|||
SendNonPlayerAgentsInfo=false
|
||||
|
||||
[CARLA/QualitySettings]
|
||||
DefaultLevel=Epic
|
||||
QualityLevel=Epic
|
||||
|
||||
[CARLA/LevelSettings]
|
||||
; Path of the vehicle class to be used for the player. Leave empty for default.
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
[/Script/Engine.Engine]
|
||||
bSmoothFrameRate=false
|
||||
SmoothedFrameRateRange=(LowerBound=(Type="ERangeBoundTypes::Inclusive",Value=22),UpperBound=(Type="ERangeBoundTypes::Exclusive",Value=120))
|
||||
|
||||
|
||||
[/Script/HardwareTargeting.HardwareTargetingSettings]
|
||||
TargetedHardwareClass=Desktop
|
||||
AppliedTargetedHardwareClass=Desktop
|
||||
|
|
|
@ -165,7 +165,7 @@ void ACityMapMeshHolder::DeletePieces()
|
|||
|
||||
for(int32 i=roadpieces.Num()-1; i>=0; i--)
|
||||
{
|
||||
if(roadpieces[i]->Tags.Contains(UCarlaSettings::CARLA_ROAD_TAG))
|
||||
if(roadpieces[i]->ActorHasTag(UCarlaSettings::CARLA_ROAD_TAG))
|
||||
{
|
||||
roadpieces[i]->Destroy();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
// -- Static variables & constants ---------------------------------------------
|
||||
// =============================================================================
|
||||
const FName UCarlaSettings::CARLA_ROAD_TAG = FName("CARLA_ROAD");
|
||||
|
||||
const FName UCarlaSettings::CARLA_SKY_TAG = FName("CARLA_SKY");
|
||||
|
||||
// =============================================================================
|
||||
// -- Static methods -----------------------------------------------------------
|
||||
|
@ -120,9 +120,9 @@ static void LoadSettingsFromConfig(
|
|||
ConfigFile.GetInt(S_CARLA_LEVELSETTINGS, TEXT("SeedPedestrians"), Settings.SeedPedestrians);
|
||||
|
||||
// QualitySettings.
|
||||
FString sDefaultLevel;
|
||||
ConfigFile.GetString(S_CARLA_QUALITYSETTINGS, TEXT("DefaultLevel"), sDefaultLevel);
|
||||
if(!Settings.SetQualitySettingsLevel(FQualitySettings::FromString(sDefaultLevel)))
|
||||
FString sQualityLevel;
|
||||
ConfigFile.GetString(S_CARLA_QUALITYSETTINGS, TEXT("QualityLevel"), sQualityLevel);
|
||||
if(!Settings.SetQualitySettingsLevel(FQualitySettings::FromString(sQualityLevel)))
|
||||
{
|
||||
//error
|
||||
} else
|
||||
|
@ -180,15 +180,15 @@ FString FQualitySettings::ToString(EQualitySettingsLevel QualitySettingsLevel)
|
|||
return ptr->GetNameStringByIndex(static_cast<int32>(QualitySettingsLevel));
|
||||
}
|
||||
|
||||
bool UCarlaSettings::SetQualitySettingsLevel(EQualitySettingsLevel newDefaultLevel)
|
||||
bool UCarlaSettings::SetQualitySettingsLevel(EQualitySettingsLevel newQualityLevel)
|
||||
{
|
||||
if(newDefaultLevel==EQualitySettingsLevel::None)
|
||||
if(newQualityLevel==EQualitySettingsLevel::None)
|
||||
{
|
||||
UE_LOG(LogCarla ,Warning, TEXT("Quality Settings Level not set!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
DefaultQualitySettingsLevel = newDefaultLevel;
|
||||
QualitySettingsLevel = newQualityLevel;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ void UCarlaSettings::LogSettings() const
|
|||
UE_LOG(LogCarla, Log, TEXT(" * %d - %s"), i, *WeatherDescriptions[i].Name);
|
||||
}
|
||||
UE_LOG(LogCarla, Log, TEXT("[%s]"), S_CARLA_QUALITYSETTINGS);
|
||||
UE_LOG(LogCarla, Log, TEXT("Default Quality Settings = %s"), *FQualitySettings::ToString(DefaultQualitySettingsLevel));
|
||||
UE_LOG(LogCarla, Log, TEXT("Quality Settings = %s"), *FQualitySettings::ToString(QualitySettingsLevel));
|
||||
|
||||
UE_LOG(LogCarla, Log, TEXT("[%s]"), S_CARLA_SENSOR);
|
||||
UE_LOG(LogCarla, Log, TEXT("Added %d sensors."), SensorDescriptions.Num());
|
||||
|
|
|
@ -53,12 +53,12 @@ public:
|
|||
* 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
|
||||
* @param newQualityLevel Store the new quality
|
||||
*/
|
||||
bool SetQualitySettingsLevel(EQualitySettingsLevel newDefaultLevel);
|
||||
bool SetQualitySettingsLevel(EQualitySettingsLevel newQualityLevel);
|
||||
/** @return current quality settings level (could not be applied yet) */
|
||||
UFUNCTION(BlueprintCallable)
|
||||
EQualitySettingsLevel GetQualitySettingsLevel() const { return DefaultQualitySettingsLevel; }
|
||||
EQualitySettingsLevel GetQualitySettingsLevel() const { return QualitySettingsLevel; }
|
||||
|
||||
/** Load the settings based on the command-line arguments and the INI file if provided. */
|
||||
void LoadSettings();
|
||||
|
@ -98,11 +98,15 @@ public:
|
|||
* CARLA_ROAD name to tag road mesh actors
|
||||
*/
|
||||
static const FName CARLA_ROAD_TAG;
|
||||
|
||||
/**
|
||||
* CARLA_SKY name to tag the sky sphere (BPS) actors in the scenes
|
||||
*/
|
||||
static const FName CARLA_SKY_TAG;
|
||||
|
||||
private:
|
||||
|
||||
/***/
|
||||
void LoadSettingsFromFile(const FString &FilePath, bool bLogOnFailure);
|
||||
|
||||
/***/
|
||||
void ResetSensorDescriptions();
|
||||
|
||||
|
@ -184,14 +188,13 @@ public:
|
|||
private:
|
||||
/** Quality Settings level. */
|
||||
UPROPERTY(Category = "Quality Settings", VisibleAnywhere, meta =(AllowPrivateAccess="true"))
|
||||
EQualitySettingsLevel DefaultQualitySettingsLevel = EQualitySettingsLevel::None;
|
||||
EQualitySettingsLevel QualitySettingsLevel = EQualitySettingsLevel::None;
|
||||
|
||||
public:
|
||||
/** @TODO : Move Low quality vars to a generic map of structs with the quality level as key*/
|
||||
|
||||
/** Low quality Road Materials.
|
||||
* Using the index of array it will assign to the material with the same index in the mesh for each piece of road
|
||||
* @TODO: Use slots name to set it for each part of the road
|
||||
* Uses slots name to set material for each part of the road for low quality
|
||||
*/
|
||||
UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config, DisplayName="Road Materials List for Low Quality")
|
||||
TArray<FStaticMaterial> LowRoadMaterials;
|
||||
|
@ -207,14 +210,14 @@ private:
|
|||
/**
|
||||
* Default low distance for all primitive components
|
||||
*/
|
||||
UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config, meta = (ClampMin = "500.0", ClampMax = "15000.0", UIMin = "500.0", UIMax = "15000.0"))
|
||||
UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config, meta = (ClampMin = "5000.0", ClampMax = "20000.0", UIMin = "5000.0", UIMax = "20000.0"))
|
||||
float LowStaticMeshMaxDrawDistance = 10000.0f;
|
||||
|
||||
/**
|
||||
* Default low distance for roads meshes
|
||||
*/
|
||||
UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config, meta = (ClampMin = "5000.0", ClampMax = "17000.0", UIMin = "5000.0", UIMax = "17000.0"))
|
||||
float LowRoadPieceMeshMaxDrawDistance = 10000.0f;
|
||||
UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config, meta = (ClampMin = "5000.0", ClampMax = "20000.0", UIMin = "5000.0", UIMax = "20000.0"))
|
||||
float LowRoadPieceMeshMaxDrawDistance = 15000.0f;
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
@ -24,9 +24,10 @@ void UCarlaSettingsDelegate::RegisterSpawnHandler(UWorld *InWorld)
|
|||
void UCarlaSettingsDelegate::OnActorSpawned(AActor* InActor)
|
||||
{
|
||||
check(CarlaSettings!=nullptr);
|
||||
if (InActor != nullptr && IsValid(InActor) && !InActor->IsPendingKill() && !InActor->Tags.Contains(UCarlaSettings::CARLA_ROAD_TAG))
|
||||
{
|
||||
|
||||
if (InActor != nullptr && IsValid(InActor) && !InActor->IsPendingKill() &&
|
||||
!InActor->ActorHasTag(UCarlaSettings::CARLA_ROAD_TAG) &&
|
||||
!InActor->ActorHasTag(UCarlaSettings::CARLA_SKY_TAG)
|
||||
){
|
||||
TArray<UActorComponent*> components = InActor->GetComponentsByClass(UPrimitiveComponent::StaticClass());
|
||||
switch(CarlaSettings->GetQualitySettingsLevel())
|
||||
{
|
||||
|
@ -219,7 +220,12 @@ void UCarlaSettingsDelegate::SetAllActorsDrawDistance(UWorld* world, const float
|
|||
UGameplayStatics::GetAllActorsOfClass(world, AActor::StaticClass(),actors);
|
||||
for(int32 i=0; i<actors.Num(); i++)
|
||||
{
|
||||
if(!IsValid(actors[i]) || actors[i]->IsPendingKillPending() || actors[i]->ActorHasTag(UCarlaSettings::CARLA_ROAD_TAG)) continue;
|
||||
if(!IsValid(actors[i]) || actors[i]->IsPendingKillPending() ||
|
||||
actors[i]->ActorHasTag(UCarlaSettings::CARLA_ROAD_TAG) ||
|
||||
actors[i]->ActorHasTag(UCarlaSettings::CARLA_SKY_TAG)
|
||||
){
|
||||
continue;
|
||||
}
|
||||
SetActorComponentsDrawDistance(actors[i], max_draw_distance);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue