예제 #1
0
        internal static void LockHandleRectRotation()
        {
            Bounds bounds = InternalEditorUtility.CalculateSelectionBoundsInSpace(handlePosition, handleRotation, rectBlueprintMode);

            s_LockHandleRectAxis       = GetRectAxisForViewDir(bounds, handleRotation, SceneView.currentDrawingSceneView.camera.transform.forward);
            s_LockHandleRectAxisActive = true;
        }
예제 #2
0
        internal static Vector3 GetHandlePosition()
        {
            Transform activeTransform = Selection.activeTransform;

            if (activeTransform == null)
            {
                return(new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity));
            }
            Vector3   vector2   = handleOffset + (handleRotation * localHandleOffset);
            PivotMode pivotMode = get.m_PivotMode;

            if (pivotMode != PivotMode.Center)
            {
                if (pivotMode != PivotMode.Pivot)
                {
                    return(new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity));
                }
            }
            else
            {
                if (current == UnityEditor.Tool.Rect)
                {
                    return(((Vector3)(handleRotation * InternalEditorUtility.CalculateSelectionBoundsInSpace(Vector3.zero, handleRotation, rectBlueprintMode).center)) + vector2);
                }
                return(InternalEditorUtility.CalculateSelectionBounds(true, false).center + vector2);
            }
            if (((current == UnityEditor.Tool.Rect) && rectBlueprintMode) && InternalEditorUtility.SupportsRectLayout(activeTransform))
            {
                return(activeTransform.parent.TransformPoint(new Vector3(activeTransform.localPosition.x, activeTransform.localPosition.y, 0f)) + vector2);
            }
            return(activeTransform.position + vector2);
        }
예제 #3
0
        internal static Vector3 GetHandlePosition()
        {
            Transform activeTransform = Selection.activeTransform;

            if (!activeTransform)
            {
                return(new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity));
            }
            Vector3   b         = Tools.handleOffset + Tools.handleRotation * Tools.localHandleOffset;
            PivotMode pivotMode = Tools.get.m_PivotMode;

            if (pivotMode != PivotMode.Center)
            {
                if (pivotMode != PivotMode.Pivot)
                {
                    return(new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity));
                }
                if (Tools.current == Tool.Rect && Tools.rectBlueprintMode && InternalEditorUtility.SupportsRectLayout(activeTransform))
                {
                    return(activeTransform.parent.TransformPoint(new Vector3(activeTransform.localPosition.x, activeTransform.localPosition.y, 0f)) + b);
                }
                return(activeTransform.position + b);
            }
            else
            {
                if (Tools.current == Tool.Rect)
                {
                    return(Tools.handleRotation * InternalEditorUtility.CalculateSelectionBoundsInSpace(Vector3.zero, Tools.handleRotation, Tools.rectBlueprintMode).center + b);
                }
                return(InternalEditorUtility.CalculateSelectionBounds(true, false).center + b);
            }
        }
예제 #4
0
        internal static Vector3 GetHandlePosition()
        {
            Transform activeTransform = Selection.activeTransform;

            if (!(bool)((Object)activeTransform))
            {
                return(new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity));
            }
            Vector3 vector3 = Tools.handleOffset + Tools.handleRotation * Tools.localHandleOffset;

            switch (Tools.get.m_PivotMode)
            {
            case PivotMode.Center:
                if (Tools.current == Tool.Rect)
                {
                    return(Tools.handleRotation * InternalEditorUtility.CalculateSelectionBoundsInSpace(Vector3.zero, Tools.handleRotation, Tools.rectBlueprintMode).center + vector3);
                }
                return(InternalEditorUtility.CalculateSelectionBounds(true, false).center + vector3);

            case PivotMode.Pivot:
                if (Tools.current == Tool.Rect && Tools.rectBlueprintMode && InternalEditorUtility.SupportsRectLayout(activeTransform))
                {
                    return(activeTransform.parent.TransformPoint(new Vector3(activeTransform.localPosition.x, activeTransform.localPosition.y, 0.0f)) + vector3);
                }
                return(activeTransform.position + vector3);

            default:
                return(new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity));
            }
        }
예제 #5
0
        internal static Vector3 GetHandlePosition()
        {
            Transform t = Selection.activeTransform;

            if (!t)
            {
                return(new Vector3(Mathf.Infinity, Mathf.Infinity, Mathf.Infinity));
            }

            Vector3 totalOffset = handleOffset + handleRotation * localHandleOffset;

            using (s_GetHandlePositionMarker.Auto())
            {
                switch (get.m_PivotMode)
                {
                case PivotMode.Center:
                {
                    if (current == Tool.Rect)
                    {
                        return(handleRotation * InternalEditorUtility
                               .CalculateSelectionBoundsInSpace(Vector3.zero, handleRotation, rectBlueprintMode)
                               .center + totalOffset);
                    }
                    else
                    {
                        return(InternalEditorUtility.CalculateSelectionBounds(true, false).center + totalOffset);
                    }
                }

                case PivotMode.Pivot:
                {
                    if (current == Tool.Rect && rectBlueprintMode && InternalEditorUtility.SupportsRectLayout(t))
                    {
                        return(t.parent.TransformPoint(new Vector3(t.localPosition.x, t.localPosition.y, 0)) +
                               totalOffset);
                    }
                    else
                    {
                        return(t.position + totalOffset);
                    }
                }

                default:
                {
                    return(new Vector3(Mathf.Infinity, Mathf.Infinity, Mathf.Infinity));
                }
                }
            }
        }
예제 #6
0
 internal static void LockHandleRectRotation()
 {
     Tools.s_LockHandleRectAxis       = Tools.GetRectAxisForViewDir(InternalEditorUtility.CalculateSelectionBoundsInSpace(Tools.handlePosition, Tools.handleRotation, Tools.rectBlueprintMode), Tools.handleRotation, SceneView.currentDrawingSceneView.camera.transform.forward);
     Tools.s_LockHandleRectAxisActive = true;
 }