From f4a3867b7dc863359f26e2e1f93970a18f7110bc Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 6 Jan 2022 13:51:57 -0800 Subject: [PATCH] Removes BinaryOperation.h/cpp from Gems/ScriptCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Libraries/Math/BinaryOperation.cpp | 137 ------------------ .../Libraries/Math/BinaryOperation.h | 46 ------ 2 files changed, 183 deletions(-) delete mode 100644 Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/BinaryOperation.cpp delete mode 100644 Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/BinaryOperation.h diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/BinaryOperation.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/BinaryOperation.cpp deleted file mode 100644 index 68621799f1..0000000000 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/BinaryOperation.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -#include "BinaryOperation.h" - -namespace ScriptCanvas -{ - namespace Nodes - { - namespace Math - { - void Sum::Reflect(AZ::ReflectContext* reflection) - { - AZ::SerializeContext* serializeContext = azrtti_cast(reflection); - if (serializeContext) - { - serializeContext->Class() - ->Version(2) - ->Field("A", &Sum::m_a) - ->Field("B", &Sum::m_b) - ; - - AZ::EditContext* editContext = serializeContext->GetEditContext(); - if (editContext) - { - editContext->Class("Sum", "Performs the sum between two numbers.") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/ScriptCanvas/Sum.png") - ; - } - - } - - AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); - if (behaviorContext) - { - behaviorContext->Class("Sum") - ->Method("In", &Sum::OnInputSignal) - ->Attribute(ScriptCanvas::Attributes::Input, true) - ->Method("Out", &Sum::SignalOutput) - ->Attribute(ScriptCanvas::Attributes::Output, true) - ->Property("A", BehaviorValueProperty(&Sum::m_a)) - ->Property("B", BehaviorValueProperty(&Sum::m_b)) - ->Property("This", BehaviorValueProperty(&Sum::m_sum)) - ; - } - } - - Sum::Sum() - : Number() - {} - - Sum::~Sum() - {} - - void Sum::OnEntry() - { - m_status = ExecutionStatus::Immediate; - m_executionMode = ExecutionStatus::Immediate; - } - - void Sum::OnInputSignal(const SlotID& slot) - { - //static const SlotID& inSlot = SlotID("In"); - - //if (slot == inSlot) - //{ - // Types::Value* result = nullptr; - - // if (auto value = azdynamic_cast(Evaluate(SlotID("This")))) - // { - // m_value = value->Get(); - // } - //} - } - - void Sum::OnExecute(double deltaTime) - { - if (m_status != ExecutionStatus::NotStarted) - { - EvaluateSlot(SlotID("GetThis")); - SignalOutput(SlotID("Out")); - } - } - - AZ::BehaviorValueParameter Sum::EvaluateSlot(const ScriptCanvas::SlotID& slotId) - { - ScriptCanvas::Slot* slot = GetSlot(slotId); - if (slot) - { - if (slot->GetType() == ScriptCanvas::SlotType::Setter) - { - if (!slot->GetConnectionList().empty()) - { - auto connection = slot->GetConnectionList()[0]; - - // Evaluate the node connected to this slot, we'll set our value according to it. - AZ::BehaviorValueParameter parameter; - ScriptCanvas::NodeServiceRequestBus::EventResult(parameter, connection.GetNodeId(), &NodeServiceRequests::EvaluateSlot, connection.GetSlotId()); - return slot->GetProperty() ? ScriptCanvas::SafeSet(parameter, slot->GetProperty()->m_setter, this) : parameter; - } - } - else if (slot->GetType() == ScriptCanvas::SlotType::Getter) - { - static const ScriptCanvas::SlotID aSlot("SetA"); - static const ScriptCanvas::SlotID bSlot("SetB"); - - // Evaluating each slot will invoke its setter which, if there is a connection it will get evaluate and - // return the connected value, otherwise we'll use the default value of the property. - EvaluateSlot(aSlot); - EvaluateSlot(bSlot); - - // Both m_a and m_b have been resolved so we'll do the sum and return it. - m_sum = m_a.Get() + m_b.Get(); - - return AZ::BehaviorValueParameter(&m_sum); - } - } - - // There was no connection to invoke a setter - return AZ::BehaviorValueParameter(); - } - - Types::Value* Sum::Evaluate(const SlotID& slot) - { - AZ_Assert(false, "Deprecated"); - return nullptr; - } - } - } -} diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/BinaryOperation.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/BinaryOperation.h deleted file mode 100644 index 48e63f93d4..0000000000 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/BinaryOperation.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -namespace ScriptCanvas -{ - class NodeVisitor; - - namespace Nodes - { - class BinaryOperation - : public Number - { - public: - - AZ_COMPONENT(BinaryOperation, "{04798FF9-50EE-487E-9433-B2C4F0FE4D37}", Node); - - static void Reflect(AZ::ReflectContext* reflection); - - BinaryOperation(); - ~BinaryOperation() override; - - void OnInputSignal(const SlotID& slot) override; - Types::Value* Evaluate(const SlotID& slot) override; - - AZ::BehaviorValueParameter EvaluateSlot(const ScriptCanvas::SlotID&) override; - - void Visit(NodeVisitor& visitor) const override { visitor.Visit(*this); } - - protected: - - Types::ValueFloat m_a; - Types::ValueFloat m_b; - Types::ValueFloat m_sum; - - }; - } -}