protected override void OnGeneratorDeselected(ChiselBrush generator) { if (generator.definition.IsValid) { CommitChanges(); } else { CancelChanges(); } ChiselTopologySelectionManager.DeselectAll(generator); activeOutlines.Remove(generator); }
protected override void OnGeneratorDeselected(ChiselBrushComponent generator) { if (generator.definition.IsValid) { CommitChanges(); } else { CancelChanges(); } ChiselTopologySelectionManager.DeselectAll(generator); activeOutlines.Remove(generator); if (generator.definition.EnsurePlanarPolygons()) { generator.OnValidate(); } }
void ISerializationCallbackReceiver.OnBeforeSerialize() { _instance = this; // We know that *this* instance is valid, so we ensure that we're initialized var nodeSelectionList = new List <ChiselTopologySelection>(); foreach (var nodeSelection in nodeSelectionLookup.Values) { if (!nodeSelection.node) { continue; } foreach (var brushMeshSelection in nodeSelection.brushMeshSelections.Values) { brushMeshSelection.OnBeforeSerialize(); nodeSelectionList.Add(brushMeshSelection); } } topologySelection = nodeSelectionList.ToArray(); }
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; }