StopEditing() public method

public StopEditing ( ) : void
return void
        void OnSelectionChanged()
        {
            if (EditorTools.EditorTools.IsActiveTool(this))
            {
                polyUtility.StopEditing();
            }
            var collider = target as Collider2D;

            if (EditorTools.EditorTools.IsActiveTool(this) && IsAvailable() && collider != null)
            {
                polyUtility.StartEditing(collider);
            }
        }
 void OnActiveToolChanging()
 {
     if (EditorTools.EditorTools.IsActiveTool(this))
     {
         m_PolyUtility.StopEditing();
     }
 }
 void TryEndEditing()
 {
     if (EditorTools.EditorTools.IsActiveTool(this))
     {
         m_PolyUtility.StopEditing();
         m_AdjacentEdgeUtility.StopEditing();
     }
 }
Example #4
0
        // Copy collider from sprite if it is drag&dropped to the inspector
        private void HandleDragAndDrop(Rect targetRect)
        {
            if (Event.current.type != EventType.DragPerform && Event.current.type != EventType.DragUpdated)
            {
                return;
            }

            // Check we're dropping onto the polygon collider editor.
            if (!targetRect.Contains(Event.current.mousePosition))
            {
                return;
            }

            foreach (var obj in DragAndDrop.objectReferences.Where(obj => obj is Sprite || obj is Texture2D))
            {
                DragAndDrop.visualMode = DragAndDropVisualMode.Copy;

                if (Event.current.type == EventType.DragPerform)
                {
                    var sprite = obj is Sprite ? obj as Sprite : SpriteUtility.TextureToSprite(obj as Texture2D);

                    // Copy collider to all selected components
                    foreach (var collider in targets.Select(target => target as PolygonCollider2D))
                    {
                        Vector2[][] paths;
                        UnityEditor.Sprites.SpriteUtility.GenerateOutlineFromSprite(sprite, 0.25f, 200, true, out paths);
                        collider.pathCount = paths.Length;
                        for (int i = 0; i < paths.Length; ++i)
                        {
                            collider.SetPath(i, paths[i]);
                        }

                        // Stop editing
                        m_PolyUtility.StopEditing();

                        DragAndDrop.AcceptDrag();
                    }
                }

                return;
            }

            DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;
        }
 protected override void OnEditEnd()
 {
     m_PolyUtility.StopEditing();
 }