コード例 #1
0
 public void CancelDraw()
 {
     if (preview != null)
     {
         preview.Destroy();
         preview = null;
     }
 }
コード例 #2
0
        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
            };
        }
コード例 #3
0
        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);
        }