UnityEditor.TransformManipulator.EndManipulationHandling C# (CSharp) Method

EndManipulationHandling() public static method

public static EndManipulationHandling ( ) : EventType
return EventType
        public static EventType EndManipulationHandling()
        {
            EventType type = EndEventCheck();
            if (type == EventType.MouseDown)
            {
                RecordMouseDownState(Selection.transforms);
                s_StartHandlePosition = Tools.handlePosition;
                s_StartLocalHandleOffset = Tools.localHandleOffset;
                if (s_LockHandle)
                {
                    Tools.LockHandlePosition();
                }
                Tools.LockHandleRectRotation();
                return type;
            }
            if ((s_MouseDownState != null) && ((type == EventType.MouseUp) || (GUIUtility.hotControl != s_HotControl)))
            {
                s_MouseDownState = null;
                if (s_LockHandle)
                {
                    Tools.UnlockHandlePosition();
                }
                Tools.UnlockHandleRectRotation();
                ManipulationToolUtility.DisableMinDragDifference();
            }
            return type;
        }

Usage Example

示例#1
0
        protected override void ToolGUI(SceneView view, Vector3 handlePosition, bool isStatic)
        {
            TransformManipulator.BeginManipulationHandling(false);
            EditorGUI.BeginChangeCheck();

            // The AimConstraint changes the rotation of the active object as the object is moved around in the scene.
            // This leads to very large "jumps" of the object,
            // as the move tool assumes the handle rotation to not change while the object is dragged.
            // Solution: when moving an object constrained with the AimConstraint, we ignore the rotation of the object.
            Quaternion handleRotation         = Tools.handleRotation;
            var        aimConstraintComponent = Selection.activeTransform.GetComponent <UnityEngine.Animations.AimConstraint>();

            if (aimConstraintComponent != null && aimConstraintComponent.constraintActive)
            {
                handleRotation = TransformManipulator.mouseDownHandleRotation;
            }

            Vector3 pos2 = Handles.PositionHandle(handlePosition, handleRotation);

            if (EditorGUI.EndChangeCheck() && !isStatic && TransformManipulator.HandleHasMoved(pos2))
            {
                ManipulationToolUtility.SetMinDragDifferenceForPos(handlePosition);

                if (Tools.vertexDragging)
                {
                    ManipulationToolUtility.DisableMinDragDifference();
                }

                TransformManipulator.SetPositionDelta(pos2, TransformManipulator.mouseDownHandlePosition);
            }
            TransformManipulator.EndManipulationHandling();
        }
All Usage Examples Of UnityEditor.TransformManipulator::EndManipulationHandling