From 6e1905bea75ab6ba32aa2b4696b8e5c95fe75c55 Mon Sep 17 00:00:00 2001 From: nsubiron Date: Tue, 27 Feb 2018 18:14:06 +0100 Subject: [PATCH] Remove some actors and components ticks and visibility --- .../Plugins/Carla/Source/Carla/Agent/AgentComponent.cpp | 9 +++++++++ .../Plugins/Carla/Source/Carla/Agent/AgentComponent.h | 2 ++ .../Carla/Source/Carla/Traffic/TrafficSignBase.cpp | 3 +++ .../Carla/Source/Carla/Vehicle/VehicleSpawnerBase.cpp | 7 +++++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Agent/AgentComponent.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Agent/AgentComponent.cpp index 3cef8518e..547081e2a 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Agent/AgentComponent.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Agent/AgentComponent.cpp @@ -20,6 +20,15 @@ static FDataRouter &GetDataRouter(UWorld *World) return GameMode->GetDataRouter(); } +UAgentComponent::UAgentComponent(const FObjectInitializer& ObjectInitializer) + : Super(ObjectInitializer) +{ + bVisible = false; + bHiddenInGame = true; + bShouldUpdatePhysicsVolume = false; + PrimaryComponentTick.bCanEverTick = false; +} + void UAgentComponent::AcceptVisitor(IAgentComponentVisitor &Visitor) const { unimplemented(); diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Agent/AgentComponent.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Agent/AgentComponent.h index a272af4d3..7262e1e89 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Agent/AgentComponent.h +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Agent/AgentComponent.h @@ -22,6 +22,8 @@ class CARLA_API UAgentComponent : public USceneComponent public: + UAgentComponent(const FObjectInitializer& ObjectInitializer); + uint32 GetId() const { return GetTypeHash(this); diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/TrafficSignBase.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/TrafficSignBase.cpp index 3320febbe..1d9ef1a39 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/TrafficSignBase.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/TrafficSignBase.cpp @@ -9,6 +9,8 @@ ATrafficSignBase::ATrafficSignBase(const FObjectInitializer &ObjectInitializer) : Super(ObjectInitializer) { + PrimaryActorTick.bCanEverTick = false; + RootComponent = ObjectInitializer.CreateDefaultSubobject(this, TEXT("SceneRootComponent")); RootComponent->SetMobility(EComponentMobility::Static); @@ -16,4 +18,5 @@ ATrafficSignBase::ATrafficSignBase(const FObjectInitializer &ObjectInitializer) TrafficSignAgentComponent = CreateDefaultSubobject(TEXT("TrafficSignAgentComponent")); TrafficSignAgentComponent->SetupAttachment(RootComponent); + TrafficSignAgentComponent->SetMobility(EComponentMobility::Static); } diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/VehicleSpawnerBase.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/VehicleSpawnerBase.cpp index 839bf8398..0292fe784 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/VehicleSpawnerBase.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/VehicleSpawnerBase.cpp @@ -35,8 +35,11 @@ static AWheeledVehicleAIController *GetController(ACarlaWheeledVehicle *Vehicle) // ============================================================================= // Sets default values -AVehicleSpawnerBase::AVehicleSpawnerBase(const FObjectInitializer& ObjectInitializer) : - Super(ObjectInitializer) {} +AVehicleSpawnerBase::AVehicleSpawnerBase(const FObjectInitializer& ObjectInitializer) + : Super(ObjectInitializer) +{ + PrimaryActorTick.bCanEverTick = false; +} void AVehicleSpawnerBase::BeginPlay() {