Skip to content

Commit

Permalink
Disable LogMessages if visibility set to false (#2946)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajat2004 authored Sep 1, 2020
1 parent f08f261 commit e331a31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 9 additions & 0 deletions Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ IImageWrapperModule* UAirBlueprintLib::getImageWrapperModule()
return image_wrapper_module_;
}

void UAirBlueprintLib::setLogMessagesVisibility(bool is_visible)
{
log_messages_hidden_ = !is_visible;

// if hidden, clear any existing messages
if (!is_visible && GEngine)
GEngine->ClearOnScreenDebugMessages();
}

void UAirBlueprintLib::LogMessage(const FString &prefix, const FString &suffix, LogDebugLevel level, float persist_sec)
{
if (log_messages_hidden_)
Expand Down
6 changes: 2 additions & 4 deletions Unreal/Plugins/AirSim/Source/AirBlueprintLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,8 @@ class UAirBlueprintLib : public UBlueprintFunctionLibrary
{
return log_messages_hidden_;
}
static void setLogMessagesHidden(bool is_hidden)
{
log_messages_hidden_ = is_hidden;
}
static void setLogMessagesVisibility(bool is_visible);

static void SetMeshNamingMethod(msr::airlib::AirSimSettings::SegmentationSetting::MeshNamingMethodType method)
{
mesh_naming_method_ = method;
Expand Down
3 changes: 3 additions & 0 deletions Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ void ASimModeBase::BeginPlay()

world_sim_api_.reset(new WorldSimApi(this));
api_provider_.reset(new msr::airlib::ApiProvider(world_sim_api_.get()));

UAirBlueprintLib::setLogMessagesVisibility(getSettings().log_messages_visible);

setupPhysicsLoopPeriod();

setupClockSpeed();
Expand Down

0 comments on commit e331a31

Please sign in to comment.