Add variable, datum sanity for user added slots
Signed-off-by: carlitosan <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -97,7 +97,7 @@ namespace GraphCanvas
|
||||
// Only want to try to convert to references when we have no connections
|
||||
if (!hasConnections)
|
||||
{
|
||||
DataSlotRequestBus::EventResult(acceptConnection, sourceEndpoint.GetSlotId(), &DataSlotRequests::CanConvertToReference);
|
||||
DataSlotRequestBus::EventResult(acceptConnection, sourceEndpoint.GetSlotId(), &DataSlotRequests::CanConvertToReference, false);
|
||||
}
|
||||
}
|
||||
else if (targetType == DataSlotType::Value)
|
||||
@@ -115,7 +115,7 @@ namespace GraphCanvas
|
||||
// Only want to try to convert to references when we have no connections
|
||||
if (!hasConnections)
|
||||
{
|
||||
DataSlotRequestBus::EventResult(acceptConnection, targetEndpoint.GetSlotId(), &DataSlotRequests::CanConvertToReference);
|
||||
DataSlotRequestBus::EventResult(acceptConnection, targetEndpoint.GetSlotId(), &DataSlotRequests::CanConvertToReference, false);
|
||||
}
|
||||
}
|
||||
else if (sourceType == DataSlotType::Value)
|
||||
|
||||
+2
-2
@@ -92,7 +92,7 @@ namespace GraphCanvas
|
||||
}
|
||||
else if (sourceSlotType == DataSlotType::Reference)
|
||||
{
|
||||
DataSlotRequestBus::EventResult(converted, GetTargetSlotId(), &DataSlotRequests::ConvertToReference);
|
||||
DataSlotRequestBus::EventResult(converted, GetTargetSlotId(), &DataSlotRequests::ConvertToReference, false);
|
||||
}
|
||||
}
|
||||
else if (m_dragContext == DragContext::MoveSource)
|
||||
@@ -103,7 +103,7 @@ namespace GraphCanvas
|
||||
}
|
||||
else if (targetSlotType == DataSlotType::Reference)
|
||||
{
|
||||
DataSlotRequestBus::EventResult(converted, GetSourceSlotId(), &DataSlotRequests::ConvertToReference);
|
||||
DataSlotRequestBus::EventResult(converted, GetSourceSlotId(), &DataSlotRequests::ConvertToReference, false);
|
||||
}
|
||||
}
|
||||
else if (m_dragContext == DragContext::TryConnection)
|
||||
|
||||
@@ -294,9 +294,9 @@ namespace GraphCanvas
|
||||
}
|
||||
}
|
||||
|
||||
bool DataSlotComponent::ConvertToReference()
|
||||
bool DataSlotComponent::ConvertToReference(bool isNewSlot)
|
||||
{
|
||||
if (CanConvertToReference())
|
||||
if (CanConvertToReference(isNewSlot))
|
||||
{
|
||||
AZ::EntityId nodeId = GetNode();
|
||||
GraphId graphId;
|
||||
@@ -307,7 +307,7 @@ namespace GraphCanvas
|
||||
ScopedGraphUndoBlocker undoBlocker(graphId);
|
||||
|
||||
bool convertedToReference = false;
|
||||
GraphModelRequestBus::EventResult(convertedToReference, graphId, &GraphModelRequests::ConvertSlotToReference, Endpoint(nodeId, GetEntityId()));
|
||||
GraphModelRequestBus::EventResult(convertedToReference, graphId, &GraphModelRequests::ConvertSlotToReference, Endpoint(nodeId, GetEntityId()), isNewSlot);
|
||||
|
||||
if (convertedToReference)
|
||||
{
|
||||
@@ -326,8 +326,9 @@ namespace GraphCanvas
|
||||
return m_dataSlotType == DataSlotType::Reference;
|
||||
}
|
||||
|
||||
bool DataSlotComponent::CanConvertToReference() const
|
||||
bool DataSlotComponent::CanConvertToReference([[maybe_unused]] bool isNewSlot) const
|
||||
{
|
||||
// #sc_user_slot_variable_ux make sure this can be converted to reference, or created as one
|
||||
bool canToggleReference = false;
|
||||
|
||||
if (m_canConvertSlotTypes && DataSlotUtils::IsValueDataSlotType(m_dataSlotType) && !HasConnections())
|
||||
@@ -336,7 +337,7 @@ namespace GraphCanvas
|
||||
GraphId graphId;
|
||||
|
||||
SceneMemberRequestBus::EventResult(graphId, nodeId, &SceneMemberRequests::GetScene);
|
||||
GraphModelRequestBus::EventResult(canToggleReference, graphId, &GraphModelRequests::CanConvertSlotToReference, Endpoint(nodeId, GetEntityId()));
|
||||
GraphModelRequestBus::EventResult(canToggleReference, graphId, &GraphModelRequests::CanConvertSlotToReference, Endpoint(nodeId, GetEntityId()), isNewSlot);
|
||||
}
|
||||
|
||||
return canToggleReference;
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace GraphCanvas
|
||||
////
|
||||
|
||||
// DataSlotRequestBus
|
||||
bool ConvertToReference() override;
|
||||
bool CanConvertToReference() const override;
|
||||
bool ConvertToReference(bool isNewSlot = false) override;
|
||||
bool CanConvertToReference(bool isNewSlot = false) const override;
|
||||
|
||||
bool ConvertToValue() override;
|
||||
bool CanConvertToValue() const override;
|
||||
|
||||
@@ -70,8 +70,8 @@ namespace GraphCanvas
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
using BusIdType = AZ::EntityId;
|
||||
|
||||
virtual bool ConvertToReference() = 0;
|
||||
virtual bool CanConvertToReference() const = 0;
|
||||
virtual bool ConvertToReference(bool isNewSlot = false) = 0;
|
||||
virtual bool CanConvertToReference(bool isNewSlot = false) const = 0;
|
||||
|
||||
virtual bool ConvertToValue() = 0;
|
||||
virtual bool CanConvertToValue() const = 0;
|
||||
|
||||
@@ -125,12 +125,12 @@ namespace GraphCanvas
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool ConvertSlotToReference([[maybe_unused]] const Endpoint& endpoint)
|
||||
virtual bool ConvertSlotToReference([[maybe_unused]] const Endpoint& endpoint, [[maybe_unused]] bool isNewSlot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool CanConvertSlotToReference([[maybe_unused]] const Endpoint& endpoint)
|
||||
virtual bool CanConvertSlotToReference([[maybe_unused]] const Endpoint& endpoint, [[maybe_unused]] bool isNewSlot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -145,12 +145,13 @@ namespace GraphCanvas
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool CanPromoteToVariable([[maybe_unused]] const Endpoint& endpoint) const
|
||||
virtual bool CanPromoteToVariable([[maybe_unused]] const Endpoint& endpoint, [[maybe_unused]] bool isNewSlot = false) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool PromoteToVariableAction([[maybe_unused]] const Endpoint& endpoint)
|
||||
virtual bool PromoteToVariableAction([[maybe_unused]] const Endpoint& endpoint
|
||||
, [[maybe_unused]] bool isNewSlot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
+5
-5
@@ -258,7 +258,7 @@ namespace GraphCanvas
|
||||
if (DataSlotUtils::IsValueDataSlotType(dataSlotType))
|
||||
{
|
||||
setText("Convert to Reference");
|
||||
DataSlotRequestBus::EventResult(canToggleState, targetId, &DataSlotRequests::CanConvertToReference);
|
||||
DataSlotRequestBus::EventResult(canToggleState, targetId, &DataSlotRequests::CanConvertToReference, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -291,7 +291,7 @@ namespace GraphCanvas
|
||||
|
||||
if (DataSlotUtils::IsValueDataSlotType(dataSlotType))
|
||||
{
|
||||
DataSlotRequestBus::EventResult(toggledState, targetId, &DataSlotRequests::ConvertToReference);
|
||||
DataSlotRequestBus::EventResult(toggledState, targetId, &DataSlotRequests::ConvertToReference, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -345,14 +345,14 @@ namespace GraphCanvas
|
||||
|
||||
if (DataSlotUtils::IsValueDataSlotType(dataSlotType))
|
||||
{
|
||||
DataSlotRequestBus::EventResult(enableAction, targetId, &DataSlotRequests::CanConvertToReference);
|
||||
DataSlotRequestBus::EventResult(enableAction, targetId, &DataSlotRequests::CanConvertToReference, false);
|
||||
|
||||
if (enableAction)
|
||||
{
|
||||
Endpoint endpoint;
|
||||
SlotRequestBus::EventResult(endpoint, targetId, &SlotRequests::GetEndpoint);
|
||||
|
||||
GraphModelRequestBus::EventResult(enableAction, graphId, &GraphModelRequests::CanPromoteToVariable, endpoint);
|
||||
GraphModelRequestBus::EventResult(enableAction, graphId, &GraphModelRequests::CanPromoteToVariable, endpoint, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,7 +371,7 @@ namespace GraphCanvas
|
||||
SlotRequestBus::EventResult(endpoint, targetId, &SlotRequests::GetEndpoint);
|
||||
|
||||
bool promotedElement = false;
|
||||
GraphModelRequestBus::EventResult(promotedElement, graphId, &GraphModelRequests::PromoteToVariableAction, endpoint);
|
||||
GraphModelRequestBus::EventResult(promotedElement, graphId, &GraphModelRequests::PromoteToVariableAction, endpoint, false);
|
||||
|
||||
if (promotedElement)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user