Integrating github/staging through commit b0dd7ed
This commit is contained in:
@@ -514,8 +514,23 @@ namespace ScriptCanvasEditor
|
||||
|
||||
bool Graph::SanityCheckNodeReplacement(ScriptCanvas::Node* oldNode, ScriptCanvas::Node* newNode, AZStd::unordered_map<ScriptCanvas::SlotId, AZStd::vector<ScriptCanvas::SlotId>>& outSlotIdMap)
|
||||
{
|
||||
auto findReplacementMatch = [](const ScriptCanvas::Slot* oldSlot, const AZStd::vector<const ScriptCanvas::Slot*>& newSlots)->ScriptCanvas::SlotId
|
||||
{
|
||||
for (auto& newSlot : newSlots)
|
||||
{
|
||||
if (newSlot->GetName() == oldSlot->GetName()
|
||||
&& newSlot->GetType() == oldSlot->GetType()
|
||||
&& (newSlot->IsExecution() || newSlot->GetDataType() == oldSlot->GetDataType()))
|
||||
{
|
||||
return newSlot->GetId();
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
oldNode->CustomizeReplacementNode(newNode, outSlotIdMap);
|
||||
// Double check to make sure no stupid thing has been done
|
||||
|
||||
if (!newNode)
|
||||
{
|
||||
AZ_Warning("ScriptCanvas", false, "Replacement node can not be null.");
|
||||
@@ -523,7 +538,13 @@ namespace ScriptCanvasEditor
|
||||
}
|
||||
|
||||
AZStd::unordered_map<AZStd::string, AZStd::vector<AZStd::string>> slotNameMap = oldNode->GetReplacementSlotsMap();
|
||||
for (auto oldSlot : oldNode->GetAllSlots())
|
||||
|
||||
const auto newSlots = newNode->GetAllSlots();
|
||||
const auto oldSlots = oldNode->GetAllSlots();
|
||||
bool usingDefaults = true;
|
||||
size_t defaultMatchesFound = 0;
|
||||
|
||||
for (auto oldSlot : oldSlots)
|
||||
{
|
||||
const ScriptCanvas::SlotId oldSlotId = oldSlot->GetId();
|
||||
const AZStd::string oldSlotName = oldSlot->GetName();
|
||||
@@ -575,12 +596,30 @@ namespace ScriptCanvasEditor
|
||||
}
|
||||
outSlotIdMap.emplace(oldSlot->GetId(), newSlotIds);
|
||||
}
|
||||
else if (slotNameMap.empty())
|
||||
{
|
||||
usingDefaults = true;
|
||||
auto newSlotId = findReplacementMatch(oldSlot, newSlots);
|
||||
|
||||
if (newSlotId.IsValid())
|
||||
{
|
||||
++defaultMatchesFound;
|
||||
AZStd::vector<ScriptCanvas::SlotId> slotIds{ newSlotId };
|
||||
outSlotIdMap.emplace(oldSlot->GetId(), slotIds);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Warning("ScriptCanvas", false, "Failed to remap deprecated Node(%s) Slot(%s).", oldNode->GetNodeName().c_str(), oldSlot->GetName().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (usingDefaults && defaultMatchesFound != oldSlots.size())
|
||||
{
|
||||
AZ_Warning("ScriptCanvas", false, "Failed to remap deprecated Node(%s) not all old slots were present in the new node.", oldNode->GetNodeName().c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/RTTI/BehaviorContextUtilities.h>
|
||||
|
||||
#include <Editor/Components/IconComponent.h>
|
||||
#include <Editor/GraphCanvas/PropertySlotIds.h>
|
||||
#include <Editor/Nodes/NodeDisplayUtils.h>
|
||||
@@ -414,16 +416,7 @@ namespace ScriptCanvasEditor::Nodes
|
||||
GraphCanvas::NodeTitleRequestBus::EventResult(title, graphCanvasNodeId, &GraphCanvas::NodeTitleRequests::GetTitle);
|
||||
if (!title.empty())
|
||||
{
|
||||
if (title.ends_with("::Getter"))
|
||||
{
|
||||
AZ::StringFunc::Replace(title, "::Getter", "");
|
||||
}
|
||||
|
||||
if (displayName.ends_with("::Setter"))
|
||||
{
|
||||
AZ::StringFunc::Replace(title, "::Setter", "");
|
||||
}
|
||||
|
||||
AZ::RemovePropertyNameArtifacts(title);
|
||||
GraphCanvas::NodeTitleRequestBus::Event(graphCanvasNodeId, &GraphCanvas::NodeTitleRequests::SetTitle, title);
|
||||
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ namespace
|
||||
auto attributeData = azdynamic_cast<const AZ::Edit::AttributeData<AZ::Script::Attributes::ExcludeFlags>*>(AZ::FindAttribute(AZ::Script::Attributes::ExcludeFrom, methodIter.second->m_attributes));
|
||||
if (ShouldExcludeFromNodeList(attributeData , {}))
|
||||
{
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
RegisterMethod(nodePaletteModel, behaviorContext, categoryPath, behaviorClass, methodIter.first, *methodIter.second, behaviorClass->IsMethodOverloaded(methodIter.first));
|
||||
|
||||
Reference in New Issue
Block a user