Esempio n. 1
0
        internal void UpdateTarget(PolyShape shape = null)
        {
            if (shape != null)
            {
                m_Target = shape;
            }

            if (target is PolyShape)
            {
                polygon = ((PolyShape)target);
                SetPolyEditMode(PolyShape.PolyEditMode.Edit);
            }
            else if (target is GameObject)
            {
                PolyShape ps;
                if (((GameObject)target).transform.TryGetComponent <PolyShape>(out ps))
                {
                    polygon = ps;
                    SetPolyEditMode(PolyShape.PolyEditMode.Edit);
                }
            }

            EditorApplication.delayCall += () =>
            {
                ProBuilderEditor.selectMode = SelectMode.Object;
            };
        }
Esempio n. 2
0
    protected void OnShapeRegularPolygonMouse(Event guiEvent, int sides)
    {
        Vector2 shapePosition = MouseToShapePoint(mousePosition);

        if (guiEvent.type == EventType.MouseDown)
        {
            PolyShape newPoly = new PolyShape(shapePosition, minPolyRadius, sides);
            newPoly.colorOutline = shapeOutlineColor;
            newPoly.colorFill    = shapeFillColor;
            SetFocusedShape(newPoly);

            Repaint();
        }
        else if (guiEvent.type == EventType.MouseDrag)
        {
            PolyShape activePoly = focusedShape as PolyShape;
            if ((activePoly != null) && (activePoly.vertices.Length == sides))
            {
                Vector2 centerPosition = MouseToShapePoint(mouseDownPosition);
                float   radius         = Vector2.Distance(centerPosition, shapePosition);
                if (radius < minPolyRadius)
                {
                    return;
                }

                for (int i = 0; i < sides; i++)
                {
                    Vector2 offset = activePoly.vertices[i].position - centerPosition;
                    activePoly.vertices[i].position = centerPosition + (offset.normalized * radius);
                }
                activePoly.Dirty = true;
                Repaint();
            }
        }
    }
        public override ActionResult DoAction()
        {
            GameObject     go   = new GameObject();
            PolyShape      poly = go.AddComponent <PolyShape>();
            ProBuilderMesh pb   = poly.gameObject.AddComponent <ProBuilderMesh>();

            pb.CreateShapeFromPolygon(poly.m_Points, poly.extrude, poly.flipNormals);
            EditorUtility.InitObject(pb);

            // Special case - we don't want to reset the grid pivot because we rely on it to set the active plane for
            // interaction, regardless of whether snapping is enabled or not.
            if (ProGridsInterface.SnapEnabled() || ProGridsInterface.GridVisible())
            {
                Vector3 pivot;
                if (ProGridsInterface.GetPivot(out pivot))
                {
                    go.transform.position = pivot;
                }
            }
            MeshSelection.SetSelection(go);
            UndoUtility.RegisterCreatedObjectUndo(go, "Create Poly Shape");
            poly.polyEditMode = PolyShape.PolyEditMode.Path;


            return(new ActionResult(ActionResult.Status.Success, "Create Poly Shape"));
        }
Esempio n. 4
0
    /// <summary>
    /// New PolyShape from Unity contour data.
    /// </summary>
    /// <param name="contour">Contour data</param>
    public static PolyShape Create(BezierContour contour)
    {
        PolyShape shape = Create();

        int vertexCount = contour.Segments.Length;

        shape.vertices = new Vertex[vertexCount];

        for (int i = 0; i < vertexCount; i++)
        {
            shape.vertices[i] = new Vertex();
        }
        for (int i = 0; i < vertexCount; i++)
        {
            BezierPathSegment segment = contour.Segments[i];
            shape.vertices[i].position = segment.P0;
            shape.vertices[i].exitCP   = segment.P1;
            shape.vertices[shape.NextIndex(i)].enterCP = segment.P2;
            shape.vertices[i].segmentCurves            = true;
        }

        shape.closed = contour.Closed;

        return(shape);
    }
Esempio n. 5
0
 void LeaveTool()
 {
     //Quit Polygon edit mode and deactivate the tool
     SetPolyEditMode(PolyShape.PolyEditMode.None);
     polygon = null;
     ToolManager.RestorePreviousTool();
 }
Esempio n. 6
0
    /// <summary>
    /// New shape from a rectangle.
    /// </summary>
    /// <param name="rectangle">Rectangle</param>
    public static PolyShape Create(Rect rectangle)
    {
        PolyShape shape = Create();

        int vertexCount = 4;

        shape.vertices = new Vertex[vertexCount];
        for (int i = 0; i < vertexCount; i++)
        {
            shape.vertices[i] = new Vertex();
        }

        shape.vertices[0].position.x = rectangle.xMin;
        shape.vertices[0].position.y = rectangle.yMin;
        shape.vertices[1].position.x = rectangle.xMax;
        shape.vertices[1].position.y = rectangle.yMin;
        shape.vertices[2].position.x = rectangle.xMax;
        shape.vertices[2].position.y = rectangle.yMax;
        shape.vertices[3].position.x = rectangle.xMin;
        shape.vertices[3].position.y = rectangle.yMax;

        shape.closed = true;

        for (int i = 0; i < vertexCount; i++)
        {
            shape.InitializeControlPoints(i);
        }

        return(shape);
    }
Esempio n. 7
0
    protected static PolyShape Create()
    {
        //PolyShape shape = ScriptableObject.CreateInstance<PolyShape>();
        PolyShape shape = new PolyShape();

        return(shape);
    }
Esempio n. 8
0
    /// <summary>
    /// Renders the given shape into the given RenderTexture.
    /// </summary>
    public void Render(PolyShape shape, RenderTexture output)
    {
        Update();

        //Set up the mesh, using a simple line strip.
        shapeMesh.Clear();
        shapeMesh.vertices = shape.Points.Select(v => new Vector3(v.x, v.y, 0.01f)).ToArray();
        shapeMesh.SetIndices(shape.NPoints.CountSequence(1).ToArray(),
                             MeshTopology.LineStrip, 0);
        shapeMesh.UploadMeshData(false);

        //Render the shape as white on a black transparent background.
        var oldRendTex = RenderTexture.active;

        RenderTexture.active = output;
        GL.Clear(true, true, new Color(0.0f, 0.0f, 0.0f, 0.0f));
        shapeRenderMat.shader = stencilPass;
        shapeRenderMat.SetVector("_ShapeMin", shape.Min);
        shapeRenderMat.SetVector("_ShapeMax", shape.Max);
        shapeRenderMat.SetVector("_PointOnShape",
                                 MathF.Lerp(-1.0f, 1.0f,
                                            MathF.InverseLerp(shape.Min, shape.Max,
                                                              shape.GetPoint(0))));
        shapeRenderMat.SetPass(0);
        Graphics.DrawMeshNow(shapeMesh, Matrix4x4.identity);
        shapeRenderMat.shader = renderPass;
        shapeRenderMat.color  = Color.white;
        shapeRenderMat.SetPass(0);
        Graphics.DrawMeshNow(ScreenQuadRenderer.QuadMesh, Matrix4x4.identity);
        RenderTexture.active = oldRendTex;
    }
Esempio n. 9
0
    /// <summary>
    /// Subdivides the given shape for the given set of iterations.
    /// </summary>
    /// <param name="startI">The index of the iteration to start at.</param>
    /// <param name="endI">The index of the iteration to end at.</param>
    private void Subdivide(PolyShape shape, int startI, int endI)
    {
        //Define the algorithm that subdivides each segment.
        float pointVariance    = float.NaN;
        float minVarianceScale = IterationVarianceDecreaseScale / IterationVarianceDecreaseScaleVariance,
              maxVarianceScale = IterationVarianceDecreaseScale * IterationVarianceDecreaseScaleVariance;
        Func <Vector2, Vector2, float, PolyShape.SplitResult> subdivider = (start, end, variance) =>
        {
            //Perturb the midpoint using a gaussian distribution.
            Vector2 midpoint = (start + end) * 0.5f;
            float   dist     = MathF.NextGaussian() * pointVariance * variance;
            float   angle    = UnityEngine.Random.value * Mathf.PI * 2.0f;
            Vector2 pos      = midpoint + (dist * new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)));

            //The variance in the two new edges is a randomly scaled-down version of the old edge's variance.
            float newVariance1 = variance * Mathf.Lerp(minVarianceScale, maxVarianceScale,
                                                       UnityEngine.Random.value),
                  newVariance2 = variance * Mathf.Lerp(minVarianceScale, maxVarianceScale,
                                                       UnityEngine.Random.value);

            return(new PolyShape.SplitResult(pos, newVariance1, newVariance2));
        };

        //Subdivide multiple times.
        for (int i = startI; i <= endI; ++i)
        {
            pointVariance = BlotchVarianceScale.Evaluate((float)i);
            shape.Subdivide(subdivider);
        }
    }
Esempio n. 10
0
    private void GenerateMesh()
    {
        //Generate the points.
        var   verts           = new PolyShape.Point[NPoints];
        float radianIncrement = Mathf.PI * -2.0f / NPoints;
        float minDist         = Radius - Variance,
              maxDist         = Radius + Variance;

        for (int i = 0; i < verts.Length; ++i)
        {
            float   radians = i * radianIncrement;
            Vector2 pos     = new Vector2(Mathf.Cos(radians),
                                          Mathf.Sin(radians));
            pos *= Mathf.Lerp(minDist, maxDist, UnityEngine.Random.value);

            verts[i] = new PolyShape.Point(pos, 1.0f);
        }
        shape = new PolyShape(verts);

        Vector3[] verts3 = null;
        int[]     tris   = null;
        shape.Triangulate(ref verts3, ref tris);

        var mf = GetComponent <MeshFilter>();

        if (mf.mesh == null)
        {
            mf.mesh = new Mesh();
        }
        mf.mesh.vertices  = verts3;
        mf.mesh.triangles = tris;
        mf.mesh.UploadMeshData(false);
    }
Esempio n. 11
0
    protected void OnShapeRectangleMouse(Event guiEvent)
    {
        Vector2 shapePosition = MouseToShapePoint(mousePosition);

        if (guiEvent.type == EventType.MouseDown)
        {
            PolyShape newRect = PolyShape.Create(shapePosition, 0f, 4);
            newRect.penToMeshScale = mouseToShapeScale;
            newRect.colorOutline   = shapeOutlineColor;
            newRect.colorFill      = shapeFillColor;
            SetFocusedShape(newRect);

            Repaint();
        }
        else if (guiEvent.type == EventType.MouseDrag)
        {
            PolyShape activeRect = focusedShape as PolyShape;
            if ((activeRect != null) && (activeRect.vertices.Length == 4))
            {
                activeRect.vertices[1].position.x = shapePosition.x;
                activeRect.vertices[2].position   = shapePosition;
                activeRect.vertices[3].position.y = shapePosition.y;
                activeRect.Dirty = true;
                Repaint();
            }
        }
    }
Esempio n. 12
0
    protected void OnShapePolygonMouse(Event guiEvent)
    {
        if (guiEvent.type == EventType.MouseDown)
        {
            Vector2 shapePosition = MouseToShapePoint(mousePosition);

            PolyShape activePoly = focusedShape as PolyShape;
            if (activePoly == null)
            {
                Vector2[] points = new Vector2[1];
                points[0] = shapePosition;

                PolyShape newPoly = PolyShape.Create(points);
                newPoly.penToMeshScale = mouseToShapeScale;
                SetFocusedShape(newPoly);
            }
            else
            {
                activePoly.LineTo(shapePosition);

                if (guiEvent.clickCount > 1)
                {
                    SetFocusedShape(null);
                }
            }

            Repaint();
        }
    }
Esempio n. 13
0
        public static void DrawCircleCornerPolygon(this PolyShape polyShape, List <Corner> cornerList, List <Side> sideList)
        {
            var count = cornerList.Count;

            for (int i = 0; i < cornerList.Count; i++)
            {
                var   curSide    = sideList[i];
                var   predSide   = sideList[(i - 1 + count) % count];
                var   predCorner = cornerList[(i - 1 + count) % count];
                var   curCorner  = cornerList[i];
                var   nextCorner = cornerList[(i + 1) % count];
                float startAngle = 0;
                float length     = 0;
                {
                    float endAngle = 0;
                    if (predSide.mode == SideMode.Flat)
                    {
                        startAngle = MathHelper.CalcCircleTangentAngle(predCorner.position, predCorner.radius, curCorner.position, curCorner.radius);
                    }
                    else
                    {
                        startAngle = MathHelper.CalcCircleTangentAngle(predSide.p2, curCorner.position, curCorner.radius);
                    }


                    if (curSide.mode == SideMode.Flat)
                    {
                        endAngle = MathHelper.CalcCircleTangentAngle(curCorner.position, curCorner.radius, nextCorner.position, nextCorner.radius);
                    }
                    else
                    {
                        endAngle = MathHelper.CalcCircleTangentAngle(curSide.p1, curCorner.position, curCorner.radius, true);
                    }
                    endAngle = Mathf.Repeat(endAngle, Mathf.PI * 2f);

                    length = endAngle - startAngle;
                    if (length < 0f)
                    {
                        length = Mathf.PI * 2f + length;
                    }
                    polyShape.DrawArc(curCorner.position, curCorner.radius, startAngle, length, curCorner.segmentCount);

                    if (curSide.mode == SideMode.CubicBezierCurve)
                    {
                        polyShape.DrawCubicBezier(new CubicBezier()
                        {
                            p0 = MathHelper.CalcDirByAngle(endAngle) * curCorner.radius + curCorner.position,
                            p1 = curSide.p1,
                            p2 = curSide.p2,
                            p3 = MathHelper.CalcDirByAngle(MathHelper.CalcCircleTangentAngle(curSide.p2, nextCorner.position, nextCorner.radius)) * nextCorner.radius + nextCorner.position,
                        }, curSide.segmentCount);
                    }
                }
            }
            if (cornerList.Count > 1)
            {
                polyShape.Add(polyShape[0]);
            }
        }
Esempio n. 14
0
    private static VectorShape ParseContour(BezierContour contour, Matrix2D transform)
    {
        VectorShape vectorShape = new PolyShape(contour);

        vectorShape.TransformBy(transform);

        return(vectorShape);
    }
Esempio n. 15
0
        public override void OnWillBeDeactivated()
#endif
        {
            if (polygon != null && polygon.polyEditMode != PolyShape.PolyEditMode.None)
            {
                SetPolyEditMode(PolyShape.PolyEditMode.None);
            }

            polygon = null;
        }
    public static void OpenTestWindow()
    {
        VectorShapeEditor testWindow = EditorWindow.GetWindow(typeof(VectorShapeEditor)) as VectorShapeEditor;

        testWindow.titleContent.text = "Testing...";

        PointShape testPoint = new PointShape(-2, 0);

        testPoint.colorOutline = Color.black;

        PolyShape testLine = new PolyShape(new Vector2(-1, 0), 0.4f, 4);

        testLine.colorOutline = Color.black;
        for (int i = 0; i < testLine.vertices.Length; i++)
        {
            testLine.vertices[i].segmentCurves = true;
        }
        testLine.closed = false;

        CircleShape testCircle = new CircleShape(new Vector2(0, 0), 0.4f);

        testCircle.colorOutline = Color.black;

        PolyShape testPoly3 = new PolyShape(new Vector2(1, 2), 0.45f, 3);

        testPoly3.colorOutline = Color.black;
        PolyShape testPoly4 = new PolyShape(new Vector2(1, 1), 0.50f, 4);

        testPoly4.colorOutline = Color.black;
        testPoly4.RotateAround(new Vector2(1, 1), 45);
        PolyShape testPoly5 = new PolyShape(new Vector2(1, 0), 0.45f, 5);

        testPoly5.colorOutline = Color.black;
        PolyShape testPoly6 = new PolyShape(new Vector2(1, -1), 0.45f, 6);

        testPoly6.colorOutline = Color.black;
        testPoly6.RotateAround(new Vector2(1, -1), 30);

        PolyShape testShape = new PolyShape(new Vector2(2, 0), 0.4f, 4);

        testShape.colorOutline = Color.black;
        for (int i = 0; i < testShape.vertices.Length; i++)
        {
            testShape.vertices[i].segmentCurves = true;
        }

        testWindow.backgroundColor = Color.white;
        testWindow.Shapes          = new List <VectorShape>()
        {
            testPoint, testLine, testCircle, testPoly3, testPoly4, testPoly5, testPoly6, testShape
        };
        //testWindow.Selection = new List<VectorShape>() { testLine, testShape, testPoly5 };
        testWindow.Focus();
    }
Esempio n. 17
0
    /// <summary>
    /// New polygon start from a single origin point.
    /// </summary>
    /// <param name="point">Starting point for polygon</param>
    public static PolyShape Create(Vector2 point)
    {
        PolyShape shape = Create();

        shape.vertices             = new Vertex[1];
        shape.vertices[0]          = new Vertex();
        shape.vertices[0].position = point;

        shape.closed = false;

        return(shape);
    }
Esempio n. 18
0
 void LeaveTool(bool restoreLastMode = true)
 {
     //Quit Polygon edit mode and deactivate the tool
     SetPolyEditMode(PolyShape.PolyEditMode.None);
     polygon = null;
     ToolManager.RestorePreviousTool();
     if (restoreLastMode)
     {
         //EditorApplication.delayCall += () => ProBuilderEditor.ResetToLastSelectMode();
         ProBuilderEditor.ResetToLastSelectMode();
     }
 }
Esempio n. 19
0
        public override void OnWillBeDeactivated()
#endif
        {
            if (polygon != null && polygon.polyEditMode != PolyShape.PolyEditMode.None)
            {
                SetPolyEditMode(PolyShape.PolyEditMode.None);
            }

            polygon = null;

#if UNITY_2020_2_OR_NEWER
            EditorApplication.delayCall += () => CheckForSelectModeAfterToolQuit();
#endif
        }
Esempio n. 20
0
        public Platform(string fillHex, string strokeHex, Vector2[] vertexes, Texture2D texture)
        {
            this.fillHex   = fillHex;
            this.fillColor = getRgba(fillHex);
            this.texture   = texture;

            shape = new PolyShape(vertexes, this.fillColor, texture);

            if (!string.IsNullOrWhiteSpace(strokeHex))
            {
                this.strokeColor = getRgba(strokeHex);
                shape.Tint       = strokeColor;
            }
        }
Esempio n. 21
0
        public static void DrawCircleCornerPolyShape(this PolyShape polyShape, Rect rect, IRectSideCornerListProvider sideCornerListPropvider)
        {
            var sideCornerList = sideCornerListPropvider.SideCornerList;

            for (int i = 0; i < sideCornerList.Count; i++)
            {
                var item = sideCornerList[i];
                cornerList.Add(item.corner.ToCorner(rect));
                sideList.Add(item.side.ToSide(rect));
            }
            polyShape.Clear();
            polyShape.DrawCircleCornerPolygon(cornerList, sideList);
            cornerList.Clear();
            sideList.Clear();
        }
Esempio n. 22
0
    /// <summary>
    /// Generates a new BaseShape value.
    /// The InstanceShape will be replaced with this value as well.
    /// </summary>
    /// <param name="render">
    /// If true, the base shape will immediately be rendered to "RenderedShape".
    /// </param>
    /// <param name="renderInto">
    /// If "render" is true, this is the texture that will be rendered into.
    /// Pass null to render into "RenderedShape".
    /// </param>
    public void GenerateBaseBlotch(bool render = false, RenderTexture renderInto = null)
    {
        Update();

        //Generate an initial shape by perturbing a circle.
        BaseShape = new PolyShape(1.0f - InitialBlotchVariation, InitialBlotchVariation,
                                  InitialBlotchPoints, InitialVarianceSpread);

        Subdivide(BaseShape, 0, InitialBlotchIterations - 1);

        if (render)
        {
            Render(baseShape, renderInto == null ? RenderedShape : renderInto);
        }
    }
Esempio n. 23
0
        void OnSelectModeChanged(SelectMode selectMode)
        {
            if (!ToolManager.IsActiveTool(this))
            {
                return;
            }

            if (MeshSelection.activeMesh)
            {
                PolyShape shape = MeshSelection.activeMesh.GetComponent <PolyShape>();
                if (shape != null && shape != polygon || selectMode != SelectMode.Object)
                {
                    LeaveTool(false);
                }
            }
        }
Esempio n. 24
0
        public static void DrawEllipse(this PolyShape polyShape, Rect rect, int segmentCount)
        {
            float segmentSize = PI2 / (float)segmentCount;

            for (int i = 0; i < segmentCount; i++)
            {
                float a     = i * segmentSize;
                var   dir   = new Vector2(Mathf.Cos(a) / 2f, Mathf.Sin(a) / 2);
                var   point = new Point()
                {
                    position = Vector2.Scale(dir, rect.size) + rect.position + rect.size / 2f,
                    normal   = dir
                };
                polyShape.Add(point);
            }
        }
Esempio n. 25
0
        public static void DrawCubicBezier(this PolyShape polyShape, CubicBezier bezier, int segmentCount)
        {
            float segmentSize = 1f / segmentCount;

            for (int i = 0; i < segmentCount; i++)
            {
                var   t   = i * segmentSize;
                var   dir = bezier.CalculateCubicBezierDerivative(t).normalized;
                Point p   = new Point()
                {
                    position = bezier.CalculateCubicBezierPoint(t),
                    normal   = new Vector2(dir.y, -dir.x)
                };
                polyShape.TryAddPoint(p);
            }
        }
Esempio n. 26
0
        public static void DrawArc(this PolyShape polyShape, Vector2 position, float raduis, float startAngle, float length, int segmentCountForFull)
        {
            int   segmentCount = (int)(length / (PI2 / segmentCountForFull));
            float segmentSize  = length / (float)segmentCount;

            for (int i = 0; i <= segmentCount; i++)
            {
                float a      = i * segmentSize + startAngle;
                var   normal = new Vector2(Mathf.Cos(a), Mathf.Sin(a));
                var   point  = new Point()
                {
                    normal   = normal,
                    position = position + raduis * normal
                };
                polyShape.TryAddPoint(point);
            }
        }
Esempio n. 27
0
        private void OnObjectSelectionChanged()
        {
            if (polygon == null)
            {
                return;
            }

            if (MeshSelection.activeMesh)
            {
                PolyShape shape = MeshSelection.activeMesh.GetComponent <PolyShape>();
                if (shape != null && shape != polygon)
                {
                    //Quit Polygon edit mode and deactivate the tool
                    SetPolyEditMode(PolyShape.PolyEditMode.None);
                }
            }
        }
        protected override ActionResult PerformActionImplementation()
        {
            if (!CanCreateNewPolyShape())
            {
                return(new ActionResult(ActionResult.Status.Canceled, "Canceled Create Poly Shape"));
            }

            GameObject go = new GameObject("PolyShape");

            UndoUtility.RegisterCreatedObjectUndo(go, "Create Poly Shape");
            PolyShape      poly = Undo.AddComponent <PolyShape>(go);
            ProBuilderMesh pb   = Undo.AddComponent <ProBuilderMesh>(go);

            pb.CreateShapeFromPolygon(poly.m_Points, poly.extrude, poly.flipNormals);
            EditorUtility.InitObject(pb);

            // Special case - we don't want to reset the grid pivot because we rely on it to set the active plane for
            // interaction, regardless of whether snapping is enabled or not.
            if (ProGridsInterface.SnapEnabled() || ProGridsInterface.GridVisible())
            {
                Vector3 pivot;
                if (ProGridsInterface.GetPivot(out pivot))
                {
                    go.transform.position = pivot;
                }
            }
            MeshSelection.SetSelection(go);
            poly.polyEditMode = PolyShape.PolyEditMode.Path;

            ProBuilderEditor.selectMode = SelectMode.Object;

            m_Tool = ScriptableObject.CreateInstance <PolyShapeTool>();
            ((PolyShapeTool)m_Tool).polygon = poly;
            ToolManager.SetActiveTool(m_Tool);

            Undo.RegisterCreatedObjectUndo(m_Tool, "Open PolyShape Tool");

            MenuAction.onPerformAction         += ActionPerformed;
            ToolManager.activeToolChanging     += LeaveTool;
            ProBuilderEditor.selectModeChanged += OnSelectModeChanged;

            MeshSelection.objectSelectionChanged += OnObjectSelectionChanged;

            return(new ActionResult(ActionResult.Status.Success, "Create Poly Shape"));
        }
Esempio n. 29
0
    public static void OpenTestWindow()
    {
        VectorShapeEditor testWindow = EditorWindow.GetWindow(typeof(VectorShapeEditor)) as VectorShapeEditor;

        testWindow.titleContent.text = "New Shape";

        EllipseShape testEllipse = new EllipseShape(Vector2.one, 1f, 2f, 22.5f);

        testEllipse.colorOutline = Color.green;
        PolyShape testRect = new PolyShape(testEllipse.ShapeBounds);

        testWindow.Shapes = new List <VectorShape>()
        {
            testEllipse, testRect
        };

        testWindow.Focus();
    }
Esempio n. 30
0
 public void OnPolyShapeProviderChange(IPolyShapeProvider oldObj, IPolyShapeProvider newObj)
 {
     if (oldObj != null)
     {
         oldObj.OnPolyShapeChange -= Draw;
     }
     if (newObj != null)
     {
         newObj.OnPolyShapeChange += Draw;
         lastPolyShape             = newObj.Poly;
     }
     else
     {
         lastPolyShape = null;
     }
     needGenerateMesh = true;
     SetVerticesDirty();
 }