public void CancelDraw() { if (preview != null) { preview.Destroy(); preview = null; } }
void CreateNewTube() { preview = new MeshTubePreview() { Polygon = Polygon2d.MakeCircle(Radius, nSlices) }; preview.Create(scene.NewSOMaterial, scene.RootGameObject); smoother = new InPlaceIterativeCurveSmooth() { Curve = preview.Curve, Alpha = 0.2f }; }
public void EndDraw() { if (preview.Curve.ArcLength > 2 * Radius) { // store undo/redo record for new primitive PolyTubeSO tubeSO = preview.BuildSO(scene.DefaultSOMaterial, 1.0f); scene.History.PushChange( new AddSOChange() { scene = scene, so = tubeSO, bKeepWorldPosition = false }); scene.History.PushInteractionCheckpoint(); } preview.Destroy(); preview = null; SavedSettings.Save("DrawTubeTool_radius", radius); }