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"));
        }
        public static void DoStrip(ProBuilderMesh pb)
        {
            try
            {
                GameObject go = pb.gameObject;

                Renderer ren = go.GetComponent <Renderer>();

                if (ren != null)
                {
                    EditorUtility.SetSelectionRenderState(ren, EditorSelectedRenderState.Highlight | EditorSelectedRenderState.Wireframe);
                }

                if (EditorUtility.IsPrefabAsset(go))
                {
                    return;
                }

                EditorUtility.SynchronizeWithMeshFilter(pb);

                if (pb.mesh == null)
                {
                    DestroyProBuilderMeshAndDependencies(go, pb, false);
                    return;
                }

                string cachedMeshPath;
                Mesh   cachedMesh;

                // if meshes are assets and the mesh cache is valid don't duplicate the mesh to an instance.
                if (Experimental.meshesAreAssets && EditorMeshUtility.GetCachedMesh(pb, out cachedMeshPath, out cachedMesh))
                {
                    DestroyProBuilderMeshAndDependencies(go, pb, true);
                }
                else
                {
                    Mesh m = UnityEngine.ProBuilder.MeshUtility.DeepCopy(pb.mesh);

                    DestroyProBuilderMeshAndDependencies(go, pb);

                    go.GetComponent <MeshFilter>().sharedMesh = m;
                    if (go.TryGetComponent(out MeshCollider meshCollider))
                    {
                        meshCollider.sharedMesh = m;
                    }
                }
            }
            catch {}
        }
        protected override void OnSettingsGUI()
        {
            GUILayout.Label("Fill Hole Settings", EditorStyles.boldLabel);

            EditorGUILayout.HelpBox("Fill Hole can optionally fill entire holes (default) or just the selected vertices on the hole edges.\n\nIf no elements are selected, the entire object will be scanned for holes.", MessageType.Info);

            EditorGUI.BeginChangeCheck();

            m_SelectEntirePath.value = EditorGUILayout.Toggle("Fill Entire Hole", m_SelectEntirePath);

            if (EditorGUI.EndChangeCheck())
            {
                ProBuilderSettings.Save();
            }

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Fill Hole"))
            {
                EditorUtility.ShowNotification(PerformAction().notification);
            }
        }
        public static void DoStrip(ProBuilderMesh pb)
        {
            try
            {
                GameObject go = pb.gameObject;

                Renderer ren = go.GetComponent <Renderer>();

                if (ren != null)
                {
                    EditorUtility.SetSelectionRenderState(ren, EditorUtility.GetSelectionRenderState());
                }

                if (EditorUtility.IsPrefabAsset(go))
                {
                    return;
                }

                EditorUtility.SynchronizeWithMeshFilter(pb);

                if (pb.mesh == null)
                {
                    DestroyImmediate(pb);

                    if (go.GetComponent <Entity>())
                    {
                        DestroyImmediate(go.GetComponent <Entity>());
                    }

                    return;
                }

                string cachedMeshPath;
                Mesh   cachedMesh;

                // if meshes are assets and the mesh cache is valid don't duplicate the mesh to an instance.
                if (Experimental.meshesAreAssets && EditorMeshUtility.GetCachedMesh(pb, out cachedMeshPath, out cachedMesh))
                {
                    pb.preserveMeshAssetOnDestroy = true;
                    DestroyImmediate(pb);
                    if (go.GetComponent <Entity>())
                    {
                        DestroyImmediate(go.GetComponent <Entity>());
                    }
                }
                else
                {
                    Mesh m = UnityEngine.ProBuilder.MeshUtility.DeepCopy(pb.mesh);

                    DestroyImmediate(pb);

                    if (go.GetComponent <Entity>())
                    {
                        DestroyImmediate(go.GetComponent <Entity>());
                    }

                    go.GetComponent <MeshFilter>().sharedMesh = m;
                    if (go.GetComponent <MeshCollider>())
                    {
                        go.GetComponent <MeshCollider>().sharedMesh = m;
                    }
                }
            }
            catch {}
        }