Jelajahi Sumber

Fixed missing __repr__ method on GraphModelSlotId (#16978)

* Fixed missing __repr__ method on GraphModelSlotId
* applied review feedback

Signed-off-by: Luis Sempé <[email protected]>
Luis Sempé 1 tahun lalu
induk
melakukan
579488ba09

+ 5 - 0
Gems/GraphModel/Code/Include/GraphModel/Model/Slot.h

@@ -67,6 +67,11 @@ namespace GraphModel
 
         AZStd::size_t GetHash() const;
 
+        AZStd::string ToString() const
+        {
+            return AZStd::string::format("GraphModelSlotId(%s,%d)", m_name.c_str(), m_subId);
+        }
+
         SlotName m_name;
         SlotSubId m_subId = 0;
     };

+ 1 - 0
Gems/GraphModel/Code/Source/Model/Slot.cpp

@@ -46,6 +46,7 @@ namespace GraphModel
                 ->Attribute(AZ::Script::Attributes::Module, "editor.graph")
                 ->Constructor<const SlotName&>()
                 ->Constructor<const SlotName&, SlotSubId>()
+                ->Method("__repr__", &SlotId::ToString)
                 ->Method("IsValid", &SlotId::IsValid)
                 ->Method("GetHash", &SlotId::GetHash)
                 ->Property("name", BehaviorValueProperty(&SlotId::m_name))