Integrating up through commit 90f050496

This commit is contained in:
alexpete
2021-04-07 14:03:29 -07:00
parent 8f2ed080a9
commit c2cbd430fe
2694 changed files with 285622 additions and 176874 deletions
@@ -59,6 +59,7 @@ namespace GraphCanvas
bool m_canConvertTypes = true;
DataSlotType m_dataSlotType = DataSlotType::Value;
DataValueType m_dataValueType = DataValueType::Primitive;
bool m_isUserAdded = false;
AZ::Uuid m_typeId;
AZStd::vector<AZ::Uuid> m_containerTypeIds;
@@ -83,6 +84,8 @@ namespace GraphCanvas
virtual AZ::Uuid GetDataTypeId() const = 0;
virtual void SetDataTypeId(AZ::Uuid typeId) = 0;
virtual bool IsUserSlot() const = 0;
virtual const Styling::StyleHelper* GetDataColorPalette() const = 0;
virtual size_t GetContainedTypesCount() const = 0;
@@ -206,10 +206,17 @@ namespace GraphCanvas
//////////////////////////////////////
// Extender Slot Optional Overrides
enum class ExtensionRequestReason
{
Internal,
UserRequest,
ConnectionProposal
};
// Request an extension to the node for the specified group from the specific Node and ExtenderId.
//
// Should return the appropriate slotId for the newly added slots.
virtual SlotId RequestExtension([[maybe_unused]] const NodeId& nodeId, [[maybe_unused]] const ExtenderId& extenderId)
virtual SlotId RequestExtension([[maybe_unused]] const NodeId& nodeId, [[maybe_unused]] const ExtenderId& extenderId, ExtensionRequestReason)
{
return SlotId();
}
@@ -37,6 +37,7 @@ namespace GraphCanvas
void RemoveSlotMenuAction::RefreshAction()
{
bool enableAction = false;
bool isUserSlot = false;
const AZ::EntityId& targetId = GetTargetId();
const GraphId& graphId = GetGraphId();
@@ -51,9 +52,14 @@ namespace GraphCanvas
GraphModelRequestBus::EventResult(enableAction, graphId, &GraphModelRequests::IsSlotRemovable, endpoint);
}
if (GraphUtils::IsSlotType(targetId, SlotTypes::DataSlot))
{
DataSlotRequestBus::EventResult(isUserSlot, targetId, &DataSlotRequests::IsUserSlot);
}
}
setEnabled(enableAction);
setEnabled(enableAction || isUserSlot);
}
ContextMenuAction::SceneReaction RemoveSlotMenuAction::TriggerAction(const AZ::Vector2& /*scenePos*/)
@@ -324,6 +330,7 @@ namespace GraphCanvas
void PromoteToVariableAction::RefreshAction()
{
bool enableAction = false;
bool isUserSlot = false;
const AZ::EntityId& targetId = GetTargetId();
const GraphId& graphId = GetGraphId();
@@ -333,6 +340,8 @@ namespace GraphCanvas
SlotType slotType = SlotTypes::Invalid;
SlotRequestBus::EventResult(slotType, targetId, &SlotRequests::GetSlotType);
DataSlotRequestBus::EventResult(isUserSlot, targetId, &DataSlotRequests::IsUserSlot);
if (slotType == SlotTypes::DataSlot)
{
ConnectionType connectionType = CT_Invalid;
@@ -359,7 +368,7 @@ namespace GraphCanvas
}
}
setEnabled(enableAction);
setEnabled(enableAction && !isUserSlot);
}
GraphCanvas::ContextMenuAction::SceneReaction PromoteToVariableAction::TriggerAction(const AZ::Vector2& /*scenePos*/)
@@ -95,25 +95,6 @@ namespace GraphCanvas
intermediateRoot = m_rootMaps[key];
}
/*AZStd::vector<AZStd::string> categories;
AzFramework::StringFunc::Tokenize(categoryPath, categories, "/", true, true);
for (auto it = categories.begin(); it < categories.end(); it++)
{
AZStd::string intermediatePath;
AzFramework::StringFunc::Join(intermediatePath, categories.begin(), it + 1, "/");
CategoryKey key(parentRoot, intermediatePath);
if (m_rootMaps.find(key) == m_rootMaps.end())
{
GraphCanvas::GraphCanvasTreeItem* treeItem = m_categorizerInterface.CreateCategoryNode(intermediatePath, it->c_str(), intermediateRoot);
m_rootMaps[key] = treeItem;
}
intermediateRoot = m_rootMaps[key];
}*/
return intermediateRoot;
}
@@ -124,20 +105,24 @@ namespace GraphCanvas
for (auto& mapPair : m_rootMaps)
{
if (mapPair.second->GetChildCount() == 0 && mapPair.second->AllowPruneOnEmpty())
if (mapPair.second)
{
GraphCanvas::GraphCanvasTreeItem* parentItem = mapPair.second->GetParent();
mapPair.second->DetachItem();
if (parentItem->GetChildCount() == 0 && mapPair.second->AllowPruneOnEmpty())
if (mapPair.second->GetChildCount() == 0 && mapPair.second->AllowPruneOnEmpty())
{
potentialCategories.insert(parentItem);
}
if (GraphCanvas::GraphCanvasTreeItem* parentItem = mapPair.second->GetParent())
{
if (parentItem->GetChildCount() == 0 && mapPair.second->AllowPruneOnEmpty())
{
potentialCategories.insert(parentItem);
}
}
potentialCategories.erase(mapPair.second);
deletedKeys.push_back(mapPair.first);
delete mapPair.second;
mapPair.second->DetachItem();
potentialCategories.erase(mapPair.second);
deletedKeys.push_back(mapPair.first);
}
}
}
for (const CategoryKey& key : deletedKeys)
@@ -163,30 +148,23 @@ namespace GraphCanvas
void GraphCanvasTreeCategorizer::PruneNodes(AZStd::unordered_set< GraphCanvas::GraphCanvasTreeItem*> potentialPruners)
{
AZStd::unordered_set< GraphCanvas::GraphCanvasTreeItem* > deletedRoots;
while (!potentialPruners.empty())
{
GraphCanvas::GraphCanvasTreeItem* treeItem = (*potentialPruners.begin());
potentialPruners.erase(potentialPruners.begin());
if (treeItem && treeItem->GetChildCount() == 0 && treeItem->AllowPruneOnEmpty())
{
GraphCanvas::GraphCanvasTreeItem* parentItem = static_cast<GraphCanvas::GraphCanvasTreeItem*>(treeItem->GetParent());
treeItem->DetachItem();
potentialPruners.insert(parentItem);
deletedRoots.insert(treeItem);
delete treeItem;
}
}
auto mapIter = m_rootMaps.begin();
while (mapIter != m_rootMaps.end() && !deletedRoots.empty())
{
size_t erasedCount = deletedRoots.erase(mapIter->second);
if (erasedCount > 0)
{
mapIter = m_rootMaps.erase(mapIter);
@@ -197,4 +175,4 @@ namespace GraphCanvas
}
}
}
}
}
@@ -58,4 +58,4 @@ namespace GraphCanvas
bool m_debugEnabled;
};
}
}
@@ -84,13 +84,14 @@ namespace GraphCanvas
void SignalClicked(int row);
bool SignalDoubleClicked(int row);
void SetError(const AZStd::string& errorString);
void ClearError();
protected:
bool HasError() const;
void SetError(const AZStd::string& errorString);
protected:
void PreOnChildAdded(GraphCanvasTreeItem* item) override;
void SetName(const QString& name);
@@ -68,8 +68,6 @@ namespace GraphCanvas
}
cb->setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy::AdjustToContents);
cb->showPopup();
}
else
{