/* * 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 #include #include #include #include // Graph Model #include #include #include #include #include #include #include #include #include #include #include #include namespace GraphModel { void GraphModelSystemComponent::Reflect(AZ::ReflectContext* context) { // Reflect core graph classes GraphModel::Graph::Reflect(context); GraphModel::DataType::Reflect(context); GraphModelIntegration::GraphCanvasMetadata::Reflect(context); // Mime Events for Graph Canvas nodes GraphModelIntegration::CreateGraphCanvasNodeMimeEvent::Reflect(context); GraphModelIntegration::CreateNodeGroupNodeMimeEvent::Reflect(context); GraphModelIntegration::CreateCommentNodeMimeEvent::Reflect(context); // Reflect all the nodes needed to support ModuleNode GraphModel::BaseInputOutputNode::Reflect(context); GraphModel::GraphInputNode::Reflect(context); GraphModel::GraphOutputNode::Reflect(context); GraphModel::ModuleNode::Reflect(context); GraphModelIntegration::CreateInputOutputNodeMimeEvent::Reflect(context); GraphModelIntegration::CreateInputOutputNodeMimeEvent::Reflect(context); GraphModelIntegration::CreateModuleNodeMimeEvent::Reflect(context); if (AZ::SerializeContext* serialize = azrtti_cast(context)) { serialize->Class() ->Version(0) ; serialize->RegisterGenericType(); serialize->RegisterGenericType(); if (AZ::EditContext* ec = serialize->GetEditContext()) { ec->Class("GraphModel", "A generic node graph data model") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ; } } if (auto behaviorContext = azrtti_cast(context)) { behaviorContext->EBus("GraphManagerRequestBus") ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation) ->Attribute(AZ::Script::Attributes::Category, "Editor") ->Attribute(AZ::Script::Attributes::Module, GraphCanvas::EditorGraphModuleName) ->Event("GetGraph", &GraphModelIntegration::GraphManagerRequests::GetGraph) ; behaviorContext->EBus("GraphControllerRequestBus") ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation) ->Attribute(AZ::Script::Attributes::Category, "Editor") ->Attribute(AZ::Script::Attributes::Module, GraphCanvas::EditorGraphModuleName) ->Event("AddNode", &GraphModelIntegration::GraphControllerRequests::AddNode) ->Event("RemoveNode", &GraphModelIntegration::GraphControllerRequests::RemoveNode) ->Event("WrapNode", &GraphModelIntegration::GraphControllerRequests::WrapNode) ->Event("AddConnection", &GraphModelIntegration::GraphControllerRequests::AddConnection) ->Event("AddConnectionBySlotId", &GraphModelIntegration::GraphControllerRequests::AddConnectionBySlotId) ->Event("RemoveConnection", &GraphModelIntegration::GraphControllerRequests::RemoveConnection) ->Event("ExtendSlot", &GraphModelIntegration::GraphControllerRequests::ExtendSlot) ; behaviorContext->Class("GraphModelSlotId") ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation) ->Attribute(AZ::Script::Attributes::Category, "Editor") ->Attribute(AZ::Script::Attributes::Module, GraphCanvas::EditorGraphModuleName) ->Constructor() ->Constructor() ->Property("name", BehaviorValueProperty(&GraphModel::SlotId::m_name)) ->Property("subId", BehaviorValueProperty(&GraphModel::SlotId::m_subId)) ; } } void GraphModelSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) { provided.push_back(AZ_CRC("GraphModelService", 0xc798f75e)); } void GraphModelSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible) { incompatible.push_back(AZ_CRC("GraphModelService", 0xc798f75e)); } void GraphModelSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required) { AZ_UNUSED(required); } void GraphModelSystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent) { AZ_UNUSED(dependent); } void GraphModelSystemComponent::Init() { } void GraphModelSystemComponent::Activate() { m_graphControllerManager.Activate(); } void GraphModelSystemComponent::Deactivate() { m_graphControllerManager.Deactivate(); } }