Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,33 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <Editor/Framework/ScriptCanvasTraceUtilities.h>
#include <Editor/Framework/ScriptCanvasReporter.h>
namespace ScriptCanvas
{
class RuntimeAsset;
class RuntimeComponent;
}
namespace ScriptCanvasEditor
{
inline void RunGraph(AZStd::string_view graphPath, ScriptCanvas::ExecutionMode execution, const DurationSpec& /*duration*/, Reporter& reporter);
inline Reporter RunGraph(AZStd::string_view graphPath, ScriptCanvas::ExecutionMode execution, const DurationSpec& /*duration*/);
inline Reporter RunGraph(AZStd::string_view graphPath, const DurationSpec& duration);
inline Reporter RunGraph(AZStd::string_view graphPath, ScriptCanvas::ExecutionMode execution);
inline LoadTestGraphResult LoadTestGraph(AZStd::string_view path);
} // ScriptCanvasEditor
#include <Editor/Framework/ScriptCanvasGraphUtilities.inl>
@@ -0,0 +1,89 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <Asset/EditorAssetSystemComponent.h>
#include <AzCore/Asset/AssetManagerBus.h>
#include <AzCore/Component/TickBus.h>
#include <AzCore/IO/FileIO.h>
#include <AzCore/IO/FileIOEventBus.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <ScriptCanvas/Asset/RuntimeAsset.h>
#include <ScriptCanvas/Asset/RuntimeAssetHandler.h>
#include <ScriptCanvas/Execution/RuntimeComponent.h>
#include <Editor/Framework/ScriptCanvasTraceUtilities.h>
#include <Editor/Framework/ScriptCanvasReporter.h>
namespace ScriptCanvasEditor
{
using namespace ScriptCanvas;
inline void RunGraph(AZStd::string_view graphPath, [[maybe_unused]] ScriptCanvas::ExecutionMode execution, [[maybe_unused]] const DurationSpec& duration, Reporter& reporter)
{
TraceSuppressionBus::Broadcast(&TraceSuppressionRequests::SuppressPrintf, true);
LoadTestGraphResult loadResult = LoadTestGraph(graphPath);
TraceSuppressionBus::Broadcast(&TraceSuppressionRequests::SuppressPrintf, false);
if (loadResult.m_graph)
{
reporter.SetGraph(loadResult.m_graph->GetScriptCanvasId(), loadResult.m_graph->GetEntityId());
loadResult.m_graphEntity->Init();
TraceSuppressionBus::Broadcast(&TraceSuppressionRequests::SuppressPrintf, true);
loadResult.m_graphEntity->Activate();
TraceSuppressionBus::Broadcast(&TraceSuppressionRequests::SuppressPrintf, false);
loadResult.m_graphEntity->Deactivate();
reporter.FinishReport(loadResult.m_graph->IsInErrorState());
loadResult.m_graphEntity.reset();
}
else
{
reporter.FinishReport();
}
}
inline Reporter RunGraph(AZStd::string_view graphPath, ExecutionMode execution, const DurationSpec& duration)
{
Reporter reporter;
RunGraph(graphPath, execution, duration, reporter);
return reporter;
}
inline Reporter RunGraph(AZStd::string_view graphPath, const DurationSpec& duration)
{
return RunGraph(graphPath, ExecutionMode::Interpreted, duration);
}
inline Reporter RunGraph(AZStd::string_view graphPath, ExecutionMode execution)
{
return RunGraph(graphPath, execution, DurationSpec());
}
inline LoadTestGraphResult LoadTestGraph(AZStd::string_view graphPath)
{
AZ::Outcome< AZ::Data::Asset<ScriptCanvas::RuntimeAsset>, AZStd::string> assetOutcome = AZ::Failure(AZStd::string("asset creation failed"));
ScriptCanvasEditor::EditorAssetConversionBus::BroadcastResult(assetOutcome, &ScriptCanvasEditor::EditorAssetConversionBusTraits::CreateRuntimeAsset, graphPath);
if (assetOutcome.IsSuccess())
{
LoadTestGraphResult result;
result.m_asset = assetOutcome.GetValue();
result.m_graphEntity = AZStd::make_unique<AZ::Entity>("Loaded Graph");
result.m_graph = result.m_graphEntity->CreateComponent<ScriptCanvas::RuntimeComponent>(result.m_asset);
return result;
}
return {};
}
} // namespace ScriptCanvasEditor
@@ -0,0 +1,127 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/Component/Entity.h>
#include <AzCore/Component/EntityBus.h>
#include <AzCore/Component/EntityId.h>
#include <ScriptCanvas/Data/Data.h>
#include <ScriptCanvas/Libraries/UnitTesting/UnitTestBus.h>
#include <ScriptCanvas/Execution/RuntimeComponent.h>
#define SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_EQ(LHS, RHS)\
if(!(LHS == RHS)) { AddFailure(AZStd::string::format("Error | Expected (candidate) == (reference).\n%s", report.data())); }
#define SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_NE(LHS, RHS)\
if(!(LHS != RHS)) { AddFailure(AZStd::string::format("Error | Expected (candidate) != (reference).\n%s", report.data())); }
#define SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_GT(LHS, RHS)\
if(!(LHS > RHS)) { AddFailure(AZStd::string::format("Error | Expected (candidate) > (reference).\n%s", report.data())); }
#define SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_GE(LHS, RHS)\
if(!(LHS >= RHS)) { AddFailure(AZStd::string::format("Error | Expected (candidate) >= (reference).\n%s", report.data())); }
#define SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_LT(LHS, RHS)\
if(!(LHS < RHS)) { AddFailure(AZStd::string::format("Error | Expected (candidate) < (reference).\n%s", report.data())); }
#define SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_LE(LHS, RHS)\
if(!(LHS <= RHS)) { AddFailure(AZStd::string::format("Error | Expected (candidate) <= (reference).\n%s", report.data())); }
namespace ScriptCanvasEditor
{
using namespace ScriptCanvas;
using namespace ScriptCanvas::UnitTesting;
class Reporter
: public Bus::Handler
, public AZ::EntityBus::Handler
{
public:
Reporter();
Reporter(const ScriptCanvasId& graphID, const AZ::EntityId& entityID);
~Reporter();
void FinishReport();
void FinishReport(const bool inErrorState);
const AZStd::vector<Report>& GetCheckpoints() const;
const AZStd::vector<Report>& GetFailure() const;
const ScriptCanvasId& GetScriptCanvasId() const;
const AZStd::vector<Report>& GetSuccess() const;
bool IsActivated() const;
bool IsComplete() const;
bool IsDeactivated() const;
bool IsErrorFree() const;
bool IsReportFinished() const;
bool operator==(const Reporter& other) const;
void Reset();
void SetGraph(const ScriptCanvasId& graphID, const AZ::EntityId& entityID);
// Bus::Handler
void AddFailure(const Report& report) override;
void AddSuccess(const Report& report) override;
void Checkpoint(const Report& report) override;
void ExpectFalse(const bool value, const Report& report) override;
void ExpectTrue(const bool value, const Report& report) override;
void MarkComplete(const Report& report) override;
SCRIPT_CANVAS_UNIT_TEST_EQUALITY_OVERLOAD_OVERRIDES(ExpectEqual);
SCRIPT_CANVAS_UNIT_TEST_EQUALITY_OVERLOAD_OVERRIDES(ExpectNotEqual);
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_OVERRIDES(ExpectGreaterThan);
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_OVERRIDES(ExpectGreaterThanEqual);
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_OVERRIDES(ExpectLessThan);
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_OVERRIDES(ExpectLessThanEqual);
protected:
void OnEntityActivated(const AZ::EntityId&) override;
void OnEntityDeactivated(const AZ::EntityId&) override;
private:
bool m_graphIsActivated = false;
bool m_graphIsDeactivated = false;
bool m_graphIsComplete = false;
bool m_graphIsErrorFree = false;
bool m_isReportFinished = false;
ScriptCanvasId m_scriptCanvasId;
AZ::EntityId m_entityId;
AZStd::vector<Report> m_checkpoints;
AZStd::vector<Report> m_failures;
AZStd::vector<Report> m_successes;
}; // class Reporter
} // namespace ScriptCanvasEditor
#include "ScriptCanvasReporter.inl"
@@ -0,0 +1,311 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
namespace ScriptCanvasEditor
{
using namespace ScriptCanvas;
inline Reporter::Reporter()
{
}
inline Reporter::Reporter(const ScriptCanvasId& scriptCanvasId, const AZ::EntityId& entityID) : Reporter()
{
SetGraph(scriptCanvasId, entityID);
}
inline Reporter::~Reporter()
{
Reset();
}
inline void Reporter::Checkpoint(const Report& report)
{
if (m_isReportFinished)
{
return;
}
m_checkpoints.push_back(report);
}
inline const AZStd::vector<Report>& Reporter::GetCheckpoints() const
{
if (!m_isReportFinished)
{
AZ_Error("ScriptCanvas", false, "The report must be finished before evaluation");
}
return m_checkpoints;
}
inline const AZStd::vector<Report>& Reporter::GetFailure() const
{
if (!m_isReportFinished)
{
AZ_Error("ScriptCanvas", false, "The report must be finished before evaluation");
}
return m_failures;
}
inline const ScriptCanvasId& Reporter::GetScriptCanvasId() const
{
return m_scriptCanvasId;
}
inline const AZStd::vector<Report>& Reporter::GetSuccess() const
{
if (!m_isReportFinished)
{
AZ_Error("ScriptCanvas", false, "The report must be finished before evaluation");
}
return m_successes;
}
inline bool Reporter::IsActivated() const
{
return m_graphIsActivated;
}
inline bool Reporter::IsComplete() const
{
return m_graphIsComplete;
}
inline bool Reporter::IsDeactivated() const
{
if (!m_isReportFinished)
{
AZ_Error("ScriptCanvas", false, "The report must be finished before evaluation");
}
return m_graphIsDeactivated;
}
inline bool Reporter::IsErrorFree() const
{
if (!m_isReportFinished)
{
AZ_Error("ScriptCanvas", false, "The report must be finished before evaluation");
}
return m_graphIsErrorFree;
}
inline bool Reporter::IsReportFinished() const
{
return m_isReportFinished;
}
inline void Reporter::FinishReport()
{
if (m_isReportFinished)
{
AZ_Error("ScriptCanvas", false, "The report is already finished");
}
m_isReportFinished = true;
}
inline void Reporter::FinishReport(const bool inErrorState)
{
if (m_isReportFinished)
{
AZ_Error("ScriptCanvas", false, "The report is already finished");
}
else
{
Bus::Handler::BusDisconnect(m_scriptCanvasId);
AZ::EntityBus::Handler::BusDisconnect(m_entityId);
m_graphIsErrorFree = !inErrorState;
m_isReportFinished = true;
}
}
inline bool Reporter::operator==(const Reporter& other) const
{
if (m_isReportFinished)
{
AZ_Error("ScriptCanvas", false, "The report is already finished");
}
return m_graphIsActivated == other.m_graphIsActivated
&& m_graphIsDeactivated == other.m_graphIsDeactivated
&& m_graphIsComplete == other.m_graphIsComplete
&& m_graphIsErrorFree == other.m_graphIsErrorFree
&& m_isReportFinished == other.m_isReportFinished
&& m_failures == other.m_failures
&& m_successes == other.m_successes;
}
inline void Reporter::OnEntityActivated(const AZ::EntityId& entity)
{
if (m_entityId != entity)
{
AZ_Error("ScriptCanvas", false, "This reporter is listening to the wrong entity");
}
if (m_isReportFinished)
{
return;
}
m_graphIsActivated = true;
}
inline void Reporter::OnEntityDeactivated(const AZ::EntityId& entity)
{
if (m_entityId != entity)
{
AZ_Error("ScriptCanvas", false, "This reporter is listening to the wrong entity");
}
if (m_isReportFinished)
{
return;
}
m_graphIsDeactivated = true;
}
inline void Reporter::Reset()
{
Bus::Handler::BusDisconnect();
AZ::EntityBus::Handler::BusDisconnect();
m_graphIsActivated = false;
m_graphIsComplete = false;
m_graphIsErrorFree = false;
m_isReportFinished = false;
m_scriptCanvasId = ScriptCanvasId{};
m_entityId = AZ::EntityId{};
m_failures.clear();
}
inline void Reporter::SetGraph(const ScriptCanvasId& scriptCanvasId, const AZ::EntityId& entityID)
{
Reset();
m_scriptCanvasId = scriptCanvasId;
m_entityId = entityID;
Bus::Handler::BusConnect(m_scriptCanvasId);
AZ::EntityBus::Handler::BusConnect(m_entityId);
}
// Handler
inline void Reporter::MarkComplete(const Report& report)
{
if (m_isReportFinished)
{
return;
}
if (!report.empty())
{
Checkpoint(AZStd::string::format("MarkComplete: %s", report.data()));
}
if (m_graphIsComplete)
{
AddFailure("MarkComplete was called twice!");
}
else
{
m_graphIsComplete = true;
}
}
inline void Reporter::AddFailure(const Report& report)
{
if (m_isReportFinished)
{
return;
}
m_failures.push_back(report);
Checkpoint(AZStd::string::format("AddFailure: %s", report.data()));
}
inline void Reporter::AddSuccess(const Report& report)
{
if (m_isReportFinished)
{
return;
}
m_successes.push_back(report);
if (!report.empty())
{
Checkpoint(AZStd::string::format("AddSuccess: %s", report.data()));
}
}
inline void Reporter::ExpectFalse(const bool value, const Report& report)
{
if (value)
{
AddFailure(AZStd::string::format("Error | Expected false.\n%s", report.data()));
}
if (!report.empty())
{
Checkpoint(AZStd::string::format("ExpectFalse: %s", report.data()));
}
}
inline void Reporter::ExpectTrue(const bool value, const Report& report)
{
if (!value)
{
AddFailure(AZStd::string::format("Error | Expected true.\n%s", report.data()));
}
if (!report.empty())
{
Checkpoint(AZStd::string::format("ExpectTrue: %s", report.data()));
}
}
inline void Reporter::ExpectEqualNumber(const Data::NumberType lhs, const Data::NumberType rhs, const Report& report)
{
if (!AZ::IsClose(lhs, rhs, 0.001))
{
AddFailure(AZStd::string::format("Error | Expected near value.\n%s", report.data()));
}
if (!report.empty())
{
Checkpoint(AZStd::string::format("ExpectEqualNumber: %s", report.data()));
}
}
inline void Reporter::ExpectNotEqualNumber(const Data::NumberType lhs, const Data::NumberType rhs, const Report& report)
{
SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_NE(lhs, rhs)
if (!report.empty())
{
Checkpoint(AZStd::string::format("ExpectNotEqualNumber: %s", report.data()));
}
}
SCRIPT_CANVAS_UNIT_TEST_EQUALITY_OVERLOAD_IMPLEMENTATIONS(Reporter, ExpectEqual, SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_EQ)
SCRIPT_CANVAS_UNIT_TEST_EQUALITY_OVERLOAD_IMPLEMENTATIONS(Reporter, ExpectNotEqual, SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_NE)
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_IMPLEMENTATIONS(Reporter, ExpectGreaterThan, SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_GT)
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_IMPLEMENTATIONS(Reporter, ExpectGreaterThanEqual, SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_GE)
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_IMPLEMENTATIONS(Reporter, ExpectLessThan, SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_LT)
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_IMPLEMENTATIONS(Reporter, ExpectLessThanEqual, SCRIPT_CANVAS_UNIT_TEST_REPORTER_EXPECT_LE)
} // namespace ScriptCanvasEditor
@@ -0,0 +1,172 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/Component/Entity.h>
#include <AzCore/Component/EntityId.h>
#include <AzCore/Debug/TraceMessageBus.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzFramework/Entity/EntityContextBus.h>
#include <AzFramework/Entity/SliceEntityOwnershipServiceBus.h>
#include <ScriptCanvas/Asset/RuntimeAsset.h>
#include <ScriptCanvas/Asset/RuntimeAssetHandler.h>
#include <ScriptCanvas/Core/Core.h>
#include <ScriptCanvas/Core/Graph.h>
#include <ScriptCanvas/Core/ScriptCanvasBus.h>
#include <ScriptCanvas/Data/Data.h>
#include <ScriptCanvas/Libraries/Comparison/Comparison.h>
#include <ScriptCanvas/Libraries/Core/BehaviorContextObjectNode.h>
#include <ScriptCanvas/Libraries/Core/BinaryOperator.h>
#include <ScriptCanvas/Libraries/Core/CoreNodes.h>
#include <ScriptCanvas/Libraries/Entity/EntityRef.h>
#include <ScriptCanvas/Libraries/Libraries.h>
#include <ScriptCanvas/Libraries/Logic/Logic.h>
#include <ScriptCanvas/Libraries/Math/Math.h>
#include <ScriptCanvas/Variable/VariableBus.h>
namespace ScriptCanvas
{
class RuntimeAsset;
class RuntimeComponent;
}
namespace ScriptCanvasEditor
{
struct LoadTestGraphResult
{
AZ::Data::Asset<ScriptCanvas::RuntimeAsset> m_asset;
AZStd::unique_ptr<AZ::Entity> m_graphEntity;
ScriptCanvas::RuntimeComponent* m_graph = nullptr;
};
// how long a unit test should be allowed to execute
enum class eDuration
{
Instant = 0, // kill the test as soon as control returns from the graph
MaxSecondsOrTicks, // wait for the test for as long as ticks or seconds remain
MinSecondsOrTicks, // wait for the test until either ticks or seconds are zero
Seconds, // wait for the specified amount of seconds, regardless of ticks
Ticks, // wait for the the specified amount of ticks, regardless of seconds
};
struct DurationSpec
{
eDuration m_spec = eDuration::Instant;
size_t m_ticks = 0;
float m_seconds = 0.0f;
};
class TraceSuppressionRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
virtual void SuppressPreAssert(bool suppress) = 0;
virtual void SuppressAssert(bool suppress) = 0;
virtual void SuppressException(bool suppress) = 0;
virtual void SuppressPreError(bool suppress) = 0;
virtual void SuppressError(bool suppress) = 0;
virtual void SuppressPreWarning(bool suppress) = 0;
virtual void SuppressWarning(bool suppress) = 0;
virtual void SuppressPrintf(bool suppress) = 0;
virtual void SuppressAllOutput(bool suppress) = 0;
};
using TraceSuppressionBus = AZ::EBus<TraceSuppressionRequests>;
class TraceMessageComponent
: public AZ::Component
, protected AZ::Debug::TraceMessageBus::Handler
, protected TraceSuppressionBus::Handler
{
public:
AZ_COMPONENT(TraceMessageComponent, "{E12144CE-809D-4056-9735-4384D7DBCCDC}");
TraceMessageComponent() = default;
~TraceMessageComponent() override = default;
void Activate() override
{
AZ::Debug::TraceMessageBus::Handler::BusConnect();
TraceSuppressionBus::Handler::BusConnect();
}
void Deactivate() override
{
AZ::Debug::TraceMessageBus::Handler::BusDisconnect();
TraceSuppressionBus::Handler::BusDisconnect();
}
private:
/// \ref ComponentDescriptor::Reflect
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TraceMessageComponent, AZ::Component>()
->Version(0)
;
}
}
bool OnPreAssert(const char*, int, const char*, const char*) { return suppressPreAssert; }
bool OnAssert(const char*) { return suppressAssert; }
bool OnException(const char*) { return suppressException; }
bool OnPreError(const char*, const char*, int, const char*, const char*) { return suppressPreError; }
bool OnError(const char*, const char*) { return suppressError; }
bool OnPreWarning(const char*, const char*, int, const char*, const char*) { return suppressPreWarning; }
bool OnWarning(const char*, const char*) { return suppressWarning; }
bool OnPrintf(const char*, const char*) { return suppressPrintf; }
bool OnOutput(const char*, const char*) { return suppressAllOutput; }
void SuppressPreAssert(bool suppress) override { suppressPreAssert = suppress; }
void SuppressAssert(bool suppress)override { suppressAssert = suppress; }
void SuppressException(bool suppress) override { suppressException = suppress; }
void SuppressPreError(bool suppress) override { suppressPreError = suppress; }
void SuppressError(bool suppress) override { suppressPreError = suppress; }
void SuppressPreWarning(bool suppress) override { suppressPreWarning = suppress; }
void SuppressWarning(bool suppress) override { suppressWarning = suppress; }
void SuppressPrintf(bool suppress) override { suppressPrintf = suppress; }
void SuppressAllOutput(bool suppress) override { suppressAllOutput = suppress; }
bool suppressPreAssert = false;
bool suppressAssert = false;
bool suppressException = false;
bool suppressPreError = false;
bool suppressError = false;
bool suppressPreWarning = false;
bool suppressWarning = false;
bool suppressPrintf = false;
bool suppressAllOutput = false;
};
struct ScopedOutputSuppression
{
ScopedOutputSuppression(bool suppressState = true)
{
AZ::Debug::TraceMessageBus::BroadcastResult(m_oldSuppression, &AZ::Debug::TraceMessageEvents::OnOutput, "", "");
TraceSuppressionBus::Broadcast(&TraceSuppressionRequests::SuppressAllOutput, suppressState);
}
~ScopedOutputSuppression()
{
TraceSuppressionBus::Broadcast(&TraceSuppressionRequests::SuppressAllOutput, m_oldSuppression);
}
private:
bool m_oldSuppression = false;
};
} // ScriptCanvasEditor