示例#1
0
        public ChiselNodeSelection this[ChiselNode node]
        {
            get
            {
                if (!nodeSelectionLookup.TryGetValue(node, out ChiselNodeSelection nodeSelection))
                {
                    Undo.RecordObject(Selection, "Select node");
                    nodeSelection = new ChiselNodeSelection {
                        node = node
                    };
                    nodeSelectionLookup[node] = nodeSelection;
                    return(nodeSelection);
                }

                Debug.Assert(nodeSelection.node == node);
                return(nodeSelection);
            }
        }
示例#2
0
 void ISerializationCallbackReceiver.OnAfterDeserialize()
 {
     _instance = this; // We know that *this* instance is valid, so we ensure that we're initialized
     nodeSelectionLookup.Clear();
     for (int i = topologySelection.Length - 1; i >= 0; i--)
     {
         var brushSelection = topologySelection[i];
         if (!brushSelection.node)
         {
             continue;
         }
         brushSelection.OnAfterDeserialize();
         if (!nodeSelectionLookup.TryGetValue(brushSelection.node, out ChiselNodeSelection nodeSelection))
         {
             nodeSelection = new ChiselNodeSelection {
                 node = brushSelection.node
             };
             nodeSelectionLookup[brushSelection.node] = nodeSelection;
         }
         nodeSelection[brushSelection.index] = brushSelection;
     }
     topologySelection = null;
 }