/* * 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 "precompiled.h" #include #include #include #include #include namespace GraphCanvas { ////////////////////////// // PropertySlotComponent ////////////////////////// void PropertySlotComponent::Reflect(AZ::ReflectContext* reflectContext) { AZ::SerializeContext* serializeContext = azrtti_cast(reflectContext); if (serializeContext) { serializeContext->Class() ->Version(1) ->Field("PropertyId", &PropertySlotComponent::m_propertyId) ; } } AZ::Entity* PropertySlotComponent::CreatePropertySlot(const AZ::EntityId& nodeId, const AZ::Crc32& propertyId, const SlotConfiguration& slotConfiguration) { AZ::Entity* entity = SlotComponent::CreateCoreSlotEntity(); entity->CreateComponent(propertyId, slotConfiguration); entity->CreateComponent(); entity->CreateComponent(Styling::Elements::PropertySlot, nodeId); SlotConnectionFilterComponent* connectionFilter = entity->CreateComponent(); // We don't want to accept any connections. connectionFilter->AddFilter(aznew SlotTypeFilter(ConnectionFilterType::Include)); return entity; } PropertySlotComponent::PropertySlotComponent() : SlotComponent(SlotTypes::PropertySlot) { if (m_slotConfiguration.m_slotGroup == SlotGroups::Invalid) { m_slotConfiguration.m_slotGroup = SlotGroups::PropertyGroup; } } PropertySlotComponent::PropertySlotComponent(const AZ::Crc32& propertyId, const SlotConfiguration& slotConfiguration) : SlotComponent(SlotTypes::PropertySlot, slotConfiguration) , m_propertyId(propertyId) { if (m_slotConfiguration.m_slotGroup == SlotGroups::Invalid) { m_slotConfiguration.m_slotGroup = SlotGroups::PropertyGroup; } } PropertySlotComponent::~PropertySlotComponent() { } void PropertySlotComponent::Init() { SlotComponent::Init(); } void PropertySlotComponent::Activate() { SlotComponent::Activate(); PropertySlotRequestBus::Handler::BusConnect(GetEntityId()); } void PropertySlotComponent::Deactivate() { SlotComponent::Deactivate(); PropertySlotRequestBus::Handler::BusDisconnect(); } int PropertySlotComponent::GetLayoutPriority() const { // Going to want property slots to always be at the top of a display group. return std::numeric_limits().max(); } void PropertySlotComponent::SetLayoutPriority(int priority) { AZ_UNUSED(priority); } const AZ::Crc32& PropertySlotComponent::GetPropertyId() const { return m_propertyId; } AZ::Entity* PropertySlotComponent::ConstructConnectionEntity(const Endpoint& sourceEndpoint, const Endpoint& targetEndpoint, bool createModelConnection) { AZ_Error("Graph Canvas", false, "Property slots cannot have connections."); return nullptr; } }