The Great ScriptCanvas Purge, Part II

Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
chcurran
2021-07-01 17:08:16 -07:00
parent 0e8f8e5a7f
commit fea83b0b51
25 changed files with 54 additions and 468 deletions
@@ -34,7 +34,6 @@
#include <ScriptCanvas/Libraries/Core/UnaryOperator.h>
#include <ScriptCanvas/Libraries/Core/BinaryOperator.h>
#include <ScriptCanvas/Libraries/Core/EBusEventHandler.h>
#include <ScriptCanvas/Libraries/Core/ErrorHandler.h>
#include <ScriptCanvas/Libraries/Core/FunctionDefinitionNode.h>
#include <ScriptCanvas/Libraries/Core/Method.h>
#include <ScriptCanvas/Libraries/Core/Start.h>
@@ -95,7 +94,6 @@ namespace ScriptCanvas
void Graph::Reflect(AZ::ReflectContext* context)
{
Data::PropertyMetadata::Reflect(context);
Data::Type::Reflect(context);
Nodes::UnaryOperator::Reflect(context);
Nodes::UnaryExpression::Reflect(context);
@@ -29,8 +29,7 @@ namespace ScriptCanvas
friend class Node;
friend class GraphVariable;
friend class PureData;
public:
AZ_CLASS_ALLOCATOR(ModifiableDatumView, AZ::SystemAllocator, 0);
@@ -316,9 +316,6 @@ namespace ScriptCanvas
#define SCRIPT_CANVAS_GENERICS_TO_VM(GenericClass, ReflectClass, BehaviorContext, CategoryName)\
GenericClass::Reflect<ReflectClass>(BehaviorContext, ScriptCanvas::Translation::Context::GetCategoryLibraryName(CategoryName).c_str());
#define SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(GenericClass, BehaviorContext, CategoryName)\
GenericClass::Reflect(BehaviorContext, ScriptCanvas::Translation::Context::GetCategoryLibraryName(CategoryName).c_str());
template<typename... t_Node>
class RegistrarGeneric
{
@@ -335,13 +332,6 @@ namespace ScriptCanvas
SCRIPT_CANVAS_CALL_ON_INDEX_SEQUENCE(nodes.push_back({ azrtti_typeid<t_Node>(), AZ::AzTypeInfo<t_Node>::Name() }));
}
static void Reflect(AZ::BehaviorContext* behaviorContext, const char* libraryName)
{
auto reflection = behaviorContext->Class<RegistrarGeneric<t_Node...>>(libraryName);
reflection->Attribute(AZ::ScriptCanvasAttributes::VariableCreationForbidden, AZ::AttributeIsValid::IfPresent)->Attribute(AZ::ScriptCanvasAttributes::Internal::ImplementedAsNodeGeneric, true);
SCRIPT_CANVAS_CALL_ON_INDEX_SEQUENCE(reflection->Method(t_Node::GetNodeFunctionName(), t_Node::GetFunction())->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List | AZ::Script::Attributes::ExcludeFlags::Documentation));
}
template<typename t_Library>
static void Reflect(AZ::BehaviorContext* behaviorContext, const char* libraryName)
{
@@ -99,8 +99,6 @@ namespace ScriptCanvas
void Core::InitNodeRegistry(NodeRegistry& nodeRegistry)
{
using namespace ScriptCanvas::Nodes::Core;
AddNodeToRegistry<Core, Error>(nodeRegistry);
AddNodeToRegistry<Core, ErrorHandler>(nodeRegistry);
AddNodeToRegistry<Core, Method>(nodeRegistry);
AddNodeToRegistry<Core, MethodOverloaded>(nodeRegistry);
AddNodeToRegistry<Core, Start>(nodeRegistry);
@@ -122,8 +120,6 @@ namespace ScriptCanvas
AZStd::vector<AZ::ComponentDescriptor*> Core::GetComponentDescriptors()
{
return AZStd::vector<AZ::ComponentDescriptor*>({
ScriptCanvas::Nodes::Core::Error::CreateDescriptor(),
ScriptCanvas::Nodes::Core::ErrorHandler::CreateDescriptor(),
ScriptCanvas::Nodes::Core::Method::CreateDescriptor(),
ScriptCanvas::Nodes::Core::MethodOverloaded::CreateDescriptor(),
ScriptCanvas::Nodes::Core::Start::CreateDescriptor(),
@@ -11,8 +11,6 @@
// shared code
#include "EBusEventHandler.h"
#include "Error.h"
#include "ErrorHandler.h"
#include "ExtractProperty.h"
#include "FunctionDefinitionNode.h"
#include "ForEach.h"
@@ -1,84 +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 "Error.h"
#include <ScriptCanvas/Core/Graph.h>
#include <ScriptCanvas/Core/Contracts/ContractRTTI.h>
#include <ScriptCanvas/Core/Contracts/ConnectionLimitContract.h>
namespace ScriptCanvas
{
namespace Nodes
{
namespace Core
{
void Error::OnInit()
{
{
ExecutionSlotConfiguration slotConfiguration("In", ConnectionType::Input);
AddSlot(slotConfiguration);
}
{
DynamicDataSlotConfiguration slotConfiguration;
slotConfiguration.m_name = "This";
slotConfiguration.m_dynamicDataType = DynamicDataType::Any;
slotConfiguration.SetConnectionType(ConnectionType::Output);
AddSlot(slotConfiguration); // \todo for testing only, we need to ability to arbitrarily connect nodes themeselve to slots (as input to function call or error handling) or directly (as the flow of execution with arrows if easier to read...)
}
{
DataSlotConfiguration slotConfiguration;
slotConfiguration.m_name = "Description";
slotConfiguration.SetConnectionType(ConnectionType::Input);
slotConfiguration.ConfigureDatum(AZStd::move(Datum(AZStd::move(Data::Type::String()), Datum::eOriginality::Copy)));
AddSlot(slotConfiguration);
}
}
void Error::OnInputSignal(const SlotId&)
{
const Datum* input = FindDatum(GetSlotId("Description"));
if (const Data::StringType* desc = input ? input->GetAs<Data::StringType>() : nullptr)
{
SCRIPTCANVAS_REPORT_ERROR((*this), desc->data());
}
else
{
// \todo get a more descriptive default error report
SCRIPTCANVAS_REPORT_ERROR((*this), "Undescribed error");
}
}
void Error::Reflect(AZ::ReflectContext* reflectContext)
{
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflectContext))
{
serializeContext->Class<Error, Node>()
->Version(0)
;
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<Error>("Error", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Category, "Utilities/Debug")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/ScriptCanvas/Error.png")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
}
}
}
}
}
}
@@ -1,34 +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 <ScriptCanvas/Core/Node.h>
namespace ScriptCanvas
{
namespace Nodes
{
namespace Core
{
class Error
: public Node
{
public:
AZ_COMPONENT(Error, "{C6928F30-87BA-4FFE-A3C0-B6096C161DD0}", Node);
static void Reflect(AZ::ReflectContext* reflection);
bool IsDeprecated() const override { return true; }
protected:
void OnInit() override;
void OnInputSignal(const SlotId&) override;
};
}
}
}
@@ -1,73 +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 "ErrorHandler.h"
#include <ScriptCanvas/Core/Contracts/ConnectionLimitContract.h>
#include <ScriptCanvas/Core/Contracts/ContractRTTI.h>
namespace ScriptCanvas
{
namespace Nodes
{
namespace Core
{
const char* ErrorHandler::k_sourceName = "Source";
void ErrorHandler::OnInit()
{
{
ExecutionSlotConfiguration slotConfiguration("Out", ConnectionType::Output);
AddSlot(slotConfiguration);
}
{
DynamicDataSlotConfiguration slotConfiguration;
slotConfiguration.m_name = k_sourceName;
slotConfiguration.SetConnectionType(ConnectionType::Input);
slotConfiguration.m_dynamicDataType = DynamicDataType::Any;
// \todo split node abstractions into executable and !executable
AZStd::vector<AZ::Uuid> forbiddenTypes{ azrtti_typeid<PureData>() };
auto func = [forbiddenTypes]() { return aznew ContractRTTI(forbiddenTypes, ContractRTTI::Flags::Exclusive); };
ContractDescriptor descriptor{ AZStd::move(func) };
slotConfiguration.m_contractDescs.emplace_back(descriptor);
AddSlot(slotConfiguration);
}
}
AZStd::vector<AZStd::pair<Node*, const SlotId>> ErrorHandler::GetSources() const
{
return ModConnectedNodes(*GetSlot(GetSlotId(k_sourceName)));
}
void ErrorHandler::Reflect(AZ::ReflectContext* reflectContext)
{
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflectContext))
{
serializeContext->Class<ErrorHandler, Node>()
->Version(0)
;
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<ErrorHandler>("Error Handler", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Category, "Utilities/Debug")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/ScriptCanvas/ErrorHandler.png")
;
}
}
}
}
}
}
@@ -1,37 +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 <ScriptCanvas/Core/Node.h>
namespace ScriptCanvas
{
namespace Nodes
{
namespace Core
{
class ErrorHandler
: public Node
{
public:
AZ_COMPONENT(ErrorHandler, "{CF23B5A6-827C-4364-9714-EA99612D6CAE}", Node);
static void Reflect(AZ::ReflectContext* reflection);
AZStd::vector<AZStd::pair<Node*, const SlotId>> GetSources() const;
bool IsDeprecated() const override { return true; }
protected:
static const char* k_sourceName;
void OnInit() override;
};
}
}
}
@@ -70,7 +70,7 @@ namespace ScriptCanvas
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(reflection))
{
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(EntityNodes::Registrar, behaviorContext, EntityNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(EntityNodes::Registrar, Entity, behaviorContext, EntityNodes::k_categoryName);
}
ScriptCanvas::Entity::RotateMethod::Reflect(reflection);
@@ -12,6 +12,21 @@
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/containers/unordered_map.h>
#define REFLECT_MATH_LIBRARY_TYPE(MathType, Guid)\
struct MathType\
{\
AZ_TYPE_INFO(MathType, Guid);\
static void Reflect(AZ::ReflectContext* reflection)\
{\
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflection))\
{\
serializeContext->Class<MathType>()\
->Version(0)\
;\
}\
}\
};
namespace AZ
{
class ReflectContext;
@@ -13,6 +13,26 @@
namespace ScriptCanvas
{
namespace Nodes
{
namespace Math
{
REFLECT_MATH_LIBRARY_TYPE(AABB, "{AB0C2753-680E-47AD-8277-66B3AC01C659}");
REFLECT_MATH_LIBRARY_TYPE(Color, "{6CC7B2F9-F551-4CB8-A713-4149959AE337}");
REFLECT_MATH_LIBRARY_TYPE(CRC, "{D8B65A5B-38FF-4B41-9FA4-FCA080D75625}");
REFLECT_MATH_LIBRARY_TYPE(Matrix3x3, "{8C5F6959-C2C4-46D9-9FCD-4DC234E7732D}");
REFLECT_MATH_LIBRARY_TYPE(Matrix4x4, "{537AB179-E23C-492D-8EF7-53845A2DB163}");
REFLECT_MATH_LIBRARY_TYPE(OBB, "{8CBDA3B7-9DCD-4A04-A12C-123C322CA63A}");
REFLECT_MATH_LIBRARY_TYPE(Plane, "{F2C799DF-2CC1-4DD8-91DC-18C2D517BAB0}");
REFLECT_MATH_LIBRARY_TYPE(Quaternion, "{9BE75E2E-AA07-4767-9BF3-905C289EB38A}");
REFLECT_MATH_LIBRARY_TYPE(Random, "{D9DF1385-6C5C-4E41-94CA-8B10E9D8FAAF}");
REFLECT_MATH_LIBRARY_TYPE(Transform, "{59E0EF87-352C-4CFB-A810-5B8752BDD1EF}");
REFLECT_MATH_LIBRARY_TYPE(Vector2, "{FD1BFADF-BA1F-4AFC-819B-ABA1F22AE6E6}");
REFLECT_MATH_LIBRARY_TYPE(Vector3, "{53EA7604-E3AE-4E88-BE0E-66CBC488A7DB}");
REFLECT_MATH_LIBRARY_TYPE(Vector4, "{66027D7A-FCD1-4592-93E5-EB4B7F4BD671}");
}
}
namespace Library
{
void Math::Reflect(AZ::ReflectContext* reflection)
@@ -37,22 +57,20 @@ namespace ScriptCanvas
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(reflection))
{
using namespace ScriptCanvas::Nodes::Math;
SCRIPT_CANVAS_GENERICS_TO_VM(AABBNodes::Registrar, AABB, behaviorContext, AABBNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(ColorNodes::Registrar, Color, behaviorContext, ColorNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(CRCNodes::Registrar, CRC, behaviorContext, CRCNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(MathNodes::Registrar, Math, behaviorContext, MathNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(Matrix3x3Nodes::Registrar, Matrix3x3, behaviorContext, Matrix3x3Nodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(Matrix4x4Nodes::Registrar, Matrix4x4, behaviorContext, Matrix4x4Nodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(OBBNodes::Registrar, OBB, behaviorContext, OBBNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(PlaneNodes::Registrar, Plane, behaviorContext, PlaneNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(QuaternionNodes::Registrar, Quaternion, behaviorContext, QuaternionNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(RandomNodes::Registrar, Random, behaviorContext, RandomNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(AABBNodes::Registrar, behaviorContext, AABBNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(CRCNodes::Registrar, behaviorContext, CRCNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(ColorNodes::Registrar, behaviorContext, ColorNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(Matrix3x3Nodes::Registrar, behaviorContext, Matrix3x3Nodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(Matrix4x4Nodes::Registrar, behaviorContext, Matrix4x4Nodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(OBBNodes::Registrar, behaviorContext, OBBNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(PlaneNodes::Registrar, behaviorContext, PlaneNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(QuaternionNodes::Registrar, behaviorContext, QuaternionNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(TransformNodes::Registrar, behaviorContext, TransformNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(Vector2Nodes::Registrar, behaviorContext, Vector2Nodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(Vector3Nodes::Registrar, behaviorContext, Vector3Nodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM_LIBRARY_ONLY(Vector4Nodes::Registrar, behaviorContext, Vector4Nodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(TransformNodes::Registrar, Transform, behaviorContext, TransformNodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(Vector2Nodes::Registrar, Vector2, behaviorContext, Vector2Nodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(Vector3Nodes::Registrar, Vector3, behaviorContext, Vector3Nodes::k_categoryName);
SCRIPT_CANVAS_GENERICS_TO_VM(Vector4Nodes::Registrar, Vector4, behaviorContext, Vector4Nodes::k_categoryName);
}
Nodes::Internal::ExpressionNodeBase::Reflect(reflection);