コード例 #1
0
        public virtual void OnAfterDeserialize()
        {
            // have to deserialize 'globals' before nodes
            m_Properties = SerializationHelper.Deserialize <INodeProperty>(m_SerializedProperties, GraphUtil.GetLegacyTypeRemapping());
            foreach (var property in m_Properties)
            {
                m_PropertyDictionary.Add(property.guid, property);
            }
            var nodes = SerializationHelper.Deserialize <INode>(m_SerializableNodes, GraphUtil.GetLegacyTypeRemapping());

            m_Nodes          = new List <INode>(nodes.Count);
            m_NodeDictionary = new Dictionary <Guid, INode>(nodes.Count);
            foreach (var node in nodes.OfType <AbstractNode>())
            {
                node.SetOwner(this);
                node.UpdateNodeAfterDeserialization();
                node.tempId = new Identifier(m_Nodes.Count);
                m_Nodes.Add(node);
                m_NodeDictionary.Add(node.guid, node);
            }

            m_SerializableNodes = null;

            m_Edges             = SerializationHelper.Deserialize <IEdge>(m_SerializableEdges, GraphUtil.GetLegacyTypeRemapping());
            m_SerializableEdges = null;
            foreach (var edge in m_Edges)
            {
                AddEdgeToNodeEdges(edge);
            }

            HashSet <SlotReference> slots = new HashSet <SlotReference>();

            foreach (var edge in m_Edges)
            {
                slots.Add(edge.inputSlot);
                slots.Add(edge.outputSlot);
            }

            foreach (var slot in slots)
            {
                RebuildEdgeCache(slot);
            }
        }
コード例 #2
0
 public string SanitizePropertyName(string displayName, Guid guid = default(Guid))
 {
     displayName = displayName.Trim();
     return(GraphUtil.SanitizeName(m_Properties.Where(p => p.guid != guid).Select(p => p.displayName), "{0} ({1})", displayName));
 }