Ver código fonte

Material canvas: updating comments and reserving space based on PR feedback

Signed-off-by: gadams3 <[email protected]>
gadams3 2 anos atrás
pai
commit
05e14ff95f

+ 3 - 7
Gems/GraphCanvas/Code/Source/Components/StylingComponent.cpp

@@ -137,7 +137,9 @@ namespace GraphCanvas
     {
         Styling::SelectorVector selectors = m_coreSelectors;
 
-        selectors.reserve(selectors.size() + m_dynamicSelectors.size());
+        // Reserve space for all of these selectors added in this function
+        selectors.reserve(selectors.size() + m_dynamicSelectors.size() + 3);
+
         for (auto& mapPair : m_dynamicSelectors)
         {
             selectors.emplace_back(mapPair.second);
@@ -171,12 +173,6 @@ namespace GraphCanvas
 
         // TODO collapsed and highlighted
 
-        // Why is this repeated?
-        //for (auto& mapPair : m_dynamicSelectors)
-        //{
-        //    selectors.emplace_back(mapPair.second);
-        //}
-
         return selectors;
     }
 

+ 2 - 0
Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Styling/PseudoElement.cpp

@@ -66,7 +66,9 @@ namespace GraphCanvas
             StyledEntityRequestBus::EventResult(selectors, m_real, &StyledEntityRequests::GetStyleSelectors);
             AZStd::replace(selectors.begin(), selectors.end(), m_parentSelector, m_virtualChildSelector);
 
+            // Reserve space for all of these selectors added in this function
             selectors.reserve(selectors.size() + m_dynamicSelectors.size());
+
             for (const auto& mapPair : m_dynamicSelectors)
             {
                 selectors.emplace_back(mapPair.second);

+ 1 - 1
Gems/GraphModel/Code/Source/Model/Node.cpp

@@ -376,7 +376,7 @@ namespace GraphModel
 
     bool Node::HasInputConnectionFromNode(ConstNodePtr node) const
     {
-         return AZStd::any_of(m_inputDataSlots.begin(), m_inputDataSlots.end(), [&](const auto& slotPair) {
+        return AZStd::any_of(m_inputDataSlots.begin(), m_inputDataSlots.end(), [&](const auto& slotPair) {
             const auto& slot = slotPair.second;
             AZ_Assert(slot->GetSlotDirection() == GraphModel::SlotDirection::Input, "Slots in this container must be input slots.");
             const auto& connections = slot->GetConnections();