コード例 #1
0
        public void OnSceneGUI()
        {
            if (PrefabUtility.GetPrefabType(target).Equals(PrefabType.Prefab))
            {
                return;
            }

            if (_bulkGrid.IsInheritGrid)
            {
                return;
            }

            int     iOddCount = 9;
            Vector3 _centor   = _bulkGrid.transform.position;

            for (int i = 0; i < iOddCount; ++i)
            {
                Handles.color = Color.red;
                Handles.CircleHandleCap(iOddCount + i * 3, _centor
                                        + new Vector3((i - (iOddCount - 1) / 2) * _bulkGrid.GridInterval.x, 0, 0),
                                        SceneView.currentDrawingSceneView.camera.transform.rotation, 0.05f, EventType.Repaint);
                Handles.color = Color.green;
                Handles.CircleHandleCap(iOddCount + i * 3 + 1, _centor
                                        + new Vector3(0, (i - (iOddCount - 1) / 2) * _bulkGrid.GridInterval.y, 0),
                                        SceneView.currentDrawingSceneView.camera.transform.rotation, 0.05f, EventType.Repaint);
                Handles.color = Color.blue;
                Handles.CircleHandleCap(iOddCount + i * 3 + 2, _centor
                                        + new Vector3(0, 0, (i - (iOddCount - 1) / 2) * _bulkGrid.GridInterval.z),
                                        SceneView.currentDrawingSceneView.camera.transform.rotation, 0.05f, EventType.Repaint);
            }
        }
コード例 #2
0
        protected void OnSceneGUI()
        {
            if (!this.m_DisplayGeometry)
            {
                return;
            }

            UICircularRaycastFilter filter = this.target as UICircularRaycastFilter;
            RectTransform           rt     = filter.transform as RectTransform;

            if (filter.operationalRadius == 0f)
            {
                return;
            }

            float   radius   = filter.operationalRadius;
            Vector3 position = rt.TransformPoint(new Vector3(rt.rect.center.x, rt.rect.center.y, 0f) + new Vector3(filter.offset.x, filter.offset.y, 0f));

            Canvas canvas = BaseUIUtils.FindInParents <Canvas>(filter.gameObject);

            if (canvas != null)
            {
                radius *= canvas.transform.localScale.x;
            }

            Handles.color = Color.green;
            Handles.CircleHandleCap(0, position, rt.rotation, radius, EventType.Repaint);
        }
コード例 #3
0
        private void DrawBrush(int ctrlID, Vector2 mousePos)
        {
            mousePos.y = Camera.current.pixelHeight - mousePos.y;
            Ray ray = Camera.current.ScreenPointToRay(mousePos);

            if (Physics.Raycast(ray, out brushHit, Mathf.Infinity, SavedBrushes.brushes[BrushList.index].layerMask, QueryTriggerInteraction.Ignore))
            {
                Handles.color = ObjectPainterResources.BrushColorHidden;
                Handles.CircleHandleCap(ctrlID, brushHit.point + (brushHit.normal * 0.1f), Quaternion.LookRotation(brushHit.normal), SavedBrushes.brushes[BrushList.index].brushRadius, EventType.Repaint);
                Handles.DrawLine(brushHit.point, brushHit.point + (brushHit.normal * 10));

                Handles.color = ObjectPainterResources.BrushColor;
                Handles.zTest = UnityEngine.Rendering.CompareFunction.LessEqual;
                Handles.CircleHandleCap(ctrlID, brushHit.point + (brushHit.normal * 0.1f), Quaternion.LookRotation(brushHit.normal), SavedBrushes.brushes[BrushList.index].brushRadius, EventType.Repaint);
                Handles.DrawLine(brushHit.point, brushHit.point + (brushHit.normal * 10));

                Cursor.visible = false;
                SceneView.RepaintAll();
                Handles.zTest = UnityEngine.Rendering.CompareFunction.Always;
            }
            else
            {
                Cursor.visible = true;
            }
        }
コード例 #4
0
            public override void SceneHandle(ObjectInspector inspector, FieldInspector fieldInspector)
            {
                if (fieldInspector.Field.FieldType == typeof(Vector3))
                {
                    Vector3 value = (Vector3)fieldInspector.Field.GetValue(inspector.target);

                    if (value != Vector3.zero)
                    {
                        using (new Handles.DrawingScope(fieldInspector.UseColor))
                        {
                            ExternalSize = GetExternalSize(inspector.target);
                            InternalSize = GetInternalSize(inspector.target);
                            Handles.CircleHandleCap(0, Position, Quaternion.FromToRotation(Vector3.forward, value), ExternalSize, EventType.Repaint);
                            Handles.CircleHandleCap(0, Position, Quaternion.FromToRotation(Vector3.forward, value), InternalSize, EventType.Repaint);
                            Handles.Slider(Position, value);
                        }
                    }
                }
                else if (fieldInspector.Field.FieldType == typeof(Vector2))
                {
                    Vector2 value = (Vector2)fieldInspector.Field.GetValue(inspector.target);

                    if (value != Vector2.zero)
                    {
                        using (new Handles.DrawingScope(fieldInspector.UseColor))
                        {
                            ExternalSize = GetExternalSize(inspector.target);
                            InternalSize = GetInternalSize(inspector.target);
                            Handles.CircleHandleCap(0, Position, Quaternion.FromToRotation(Vector3.forward, value), ExternalSize, EventType.Repaint);
                            Handles.CircleHandleCap(0, Position, Quaternion.FromToRotation(Vector3.forward, value), InternalSize, EventType.Repaint);
                            Handles.Slider(Position, value);
                        }
                    }
                }
            }
コード例 #5
0
    private void OnSceneGUI()
    {
        Vector3 onCompassPos  = new Vector3(targT.position.x, targT.position.y, targT.position.z + compassRad);
        Vector3 dipCompassPos = new Vector3(targT.position.x, targT.position.y - s_dipValue.floatValue, targT.position.z + compassRad);
        float   cubeSize      = 0.25f;

        // Draw markers to provide context for different values
        if (Event.current.type == EventType.Repaint)
        {
            // Create marker to denote the radius of the compass
            Handles.CircleHandleCap
            (
                0,
                targT.position,
                targT.rotation,
                compassRad,
                EventType.Repaint
            );

            // Create marker for point on compass at dip value of zero
            Handles.CubeHandleCap(0, onCompassPos, Quaternion.identity, cubeSize, EventType.Repaint);

            // Create marker for point on compass at dip value
            Handles.CubeHandleCap(1, dipCompassPos, Quaternion.identity, cubeSize, EventType.Repaint);
            Handles.Label(dipCompassPos, "Cloud Spawn\nDip");

            // Draw a line between the two points
            Handles.DrawLine(onCompassPos, dipCompassPos);
        }
    }
コード例 #6
0
ファイル: DefaultBrush.cs プロジェクト: cowtrix/Mad-Maps
        protected override void DrawSceneGizmos(MadMaps.Common.Painter.IGridManager gridManager, MadMaps.Common.Painter.Painter.InputState inputState, Rect rect, Matrix4x4 TRS)
        {
            Radius = Mathf.Clamp(Radius, 0, 32);
            //var scaledRad = gridManager.GetGridSize()*Radius;

            var translatedPlanePos = TRS.MultiplyPoint(inputState.PlanePosition);
            var translatedGridPos  = TRS.MultiplyPoint(inputState.GridPosition);
            var planeUp            = TRS.GetRotation() * Vector3.up;
            var planeForward       = TRS.GetRotation() * Vector3.forward;
            var planeRot           = Quaternion.LookRotation(planeUp, planeForward);

            Handles.color = Color.white * 0.5f;
            if (BrushShape == EBrushShape.Circle)
            {
                Handles.CircleHandleCap(-1, translatedPlanePos, planeRot,
                                        gridManager.GetGridSize() * Radius, EventType.Repaint);
            }
            else
            {
                Handles.RectangleHandleCap(-1, translatedGridPos, planeRot,
                                           gridManager.GetGridSize() * Radius, EventType.Repaint);
            }
            Handles.color = Color.white;
            if (BrushShape == EBrushShape.Circle)
            {
                Handles.CircleHandleCap(-1, translatedGridPos, planeRot,
                                        gridManager.GetGridSize() * Mathf.Max(.5f, Radius), EventType.Repaint);
            }
            else
            {
                Handles.RectangleHandleCap(-1, translatedGridPos, planeRot,
                                           gridManager.GetGridSize() * Mathf.Max(.5f, Radius), EventType.Repaint);
            }
        }
コード例 #7
0
        public void OnSceneGUI()
        {
            var trigger = (TriggerBase)target;

            if (trigger.rangeHandler != null && trigger.rangeHandler.Equals(null) == false)
            {
                return;
            }

            var discColor = _outOfRangeColor;

            if (Application.isPlaying && trigger.inRange)
            {
                discColor = _inRangeColor;
            }

            if (GeneralSettingsManager.instance != null && GeneralSettingsManager.instance.settings != null)
            {
                var useRange = GeneralSettingsManager.instance.settings.triggerUseDistance;

                Handles.color = discColor;
                var euler = trigger.transform.rotation.eulerAngles;
                euler.x += 90.0f;
                Handles.DrawSolidDisc(trigger.transform.position, Vector3.up, useRange);

                discColor.a  += 0.2f;
                Handles.color = discColor;

#if UNITY_2017_1_OR_NEWER
                Handles.CircleHandleCap(0, trigger.transform.position, Quaternion.Euler(euler), useRange, EventType.Repaint);
#else
                Handles.CircleCap(0, trigger.transform.position, Quaternion.Euler(euler), useRange);
#endif
            }
        }
コード例 #8
0
        void DrawBrushGizmo()
        {
            if (isPainting)
            {
                Handles.color = activeOuterColor;
            }
            else
            {
                Handles.color = passiveOuterColor;
            }

            if (mouseHitPoint.transform)
            {
                innerColor.a = brushDensity * 0.01f;

                if (GameObject.Find(MouseLocationName) == null)
                {
                    MouseLocation = new GameObject(MouseLocationName).transform;
                }
                else
                {
                    MouseLocation = GameObject.Find(MouseLocationName).transform;
                }

                MouseLocation.rotation = mouseHitPoint.transform.rotation;
                MouseLocation.forward  = mouseHitPoint.normal;

                Handles.CircleHandleCap(2, currentMousePosition, MouseLocation.rotation, brushSize, EventType.Repaint);
                Handles.color = innerColor;
                Handles.DrawSolidDisc(currentMousePosition, mouseHitPoint.normal, brushSize);
                MouseLocation.up = mouseHitPoint.normal;
            }

            Handles.BeginGUI();
            GUIStyle style = new GUIStyle();

            style.normal.textColor = Color.black;

            GUILayout.BeginArea(new Rect(currentEvent.mousePosition.x + 10, currentEvent.mousePosition.y + 10, 250, 100));

            if (displayDebugInfo)
            {
                if (selectedPrefab != null && paintObjects.IndexOf(selectedPrefab) > -1)
                {
                    GUILayout.TextField("Selected Prefab: " + selectedPrefab.GetName(), style);
                }
                else
                {
                    GUILayout.TextField("Prefab Name: NONE", style);
                }
                GUILayout.TextField("Size: " + System.Math.Round(brushSize, 2), style);
                GUILayout.TextField("Density: " + System.Math.Round((double)brushDensity, 2), style);
                GUILayout.TextField("Surface Name: " + (mouseHitPoint.collider ? mouseHitPoint.collider.name : "none"), style);
            }



            GUILayout.EndArea();
            Handles.EndGUI();
        }
コード例 #9
0
        void OnSceneGUI()
        {
            Handles.color = targetColor;

            Handles.SphereHandleCap(0, script.transform.position, Quaternion.identity, size, EventType.Repaint);

            DrawChildrenRecursive(script.transform);

            if (script.pivot != null)
            {
                Handles.color = pivotColor;
                GUI.color     = pivotColor;

                Handles.SphereHandleCap(0, script.pivot.position, Quaternion.identity, size, EventType.Repaint);

                Vector3 twistAxisWorld = script.pivot.rotation * script.twistAxis.normalized * size * 40;
                Handles.DrawLine(script.pivot.position, script.pivot.position + twistAxisWorld);
                Handles.SphereHandleCap(0, script.pivot.position + twistAxisWorld, Quaternion.identity, size, EventType.Repaint);

                Handles.CircleHandleCap(0, script.pivot.position, Quaternion.LookRotation(twistAxisWorld), size * 20, EventType.Repaint);
                Handles.Label(script.pivot.position + twistAxisWorld, twistAxisLabel);
            }

            Handles.color = Color.white;
            GUI.color     = Color.white;
        }
コード例 #10
0
    public override void OnPreviewGUI(Rect r, GUIStyle background)
    {
        base.OnPreviewGUI(r, background);

        float size       = 0.95f * Mathf.Min(r.width, r.height);
        Rect  canvasRect = new Rect(r.center.x - 0.5f * size, r.center.y - 0.5f * size, size, size);

        PointCloudGestureTemplate template = target as PointCloudGestureTemplate;

        Vector2 center = canvasRect.center;

        float scale = 0.95f * size;

        Handles.color = Color.white;
        for (int i = 1; i < template.PointCount; ++i)
        {
            Vector2 p1 = template.GetPosition(i - 1);
            Vector2 p2 = template.GetPosition(i);

            p1.y = -p1.y;
            p2.y = -p2.y;

            p1 = center + scale * p1;
            p2 = center + scale * p2;

            if (canvasRect.width > 100)
            {
                float handleSize = canvasRect.width / 200.0f;
                Handles.CircleHandleCap(0, p1, Quaternion.identity, handleSize, EventType.MouseDown);
            }

            Handles.DrawLine(p1, p2);
        }
    }
コード例 #11
0
ファイル: MatchSpawner.cs プロジェクト: elumixor/Color-Match
            private void OnSceneGUI()
            {
                var transformPosition = spawner.transform.position;

                Handles.CircleHandleCap(0, transformPosition, Quaternion.identity, spawner.radiusThickness.x, EventType.Repaint);
                Handles.CircleHandleCap(0, transformPosition, Quaternion.identity, spawner.radiusThickness.y, EventType.Repaint);
            }
コード例 #12
0
    void OnSceneGUI()
    {
        Handles.Label(_hand.transform.position + new Vector3(0, 1, 0), "Handles Here");
        _hand.areaRadius = Handles.RadiusHandle(Quaternion.identity, _hand.transform.position, _hand.areaRadius);

        Handles.color = Color.blue;
        if (_hand.points != null && _hand.points.Length > 0)
        {
            Handles.DrawLines(_hand.points);
        }

        Handles.ArrowHandleCap(1, Vector3.forward, Quaternion.identity, 1, EventType.Repaint);

        Handles.color = Handles.xAxisColor;
        Handles.CircleHandleCap(
            0,
            _hand.transform.position + new Vector3(3f, 0f, 0f),
            _hand.transform.rotation * Quaternion.LookRotation(Vector3.right),
            1,
            EventType.Repaint
            );
        Handles.color = Handles.yAxisColor;

        float size = HandleUtility.GetHandleSize(Vector3.zero);

        Handles.DrawBezier(_hand.transform.position,
                           Vector3.zero,
                           Vector3.up,
                           -Vector3.up,
                           Color.red,
                           null,
                           size);
    }
コード例 #13
0
    void OnSceneGUI(SceneView sceneView)
    {
        if (Event.current.type == EventType.Repaint)
        {
            if (Selection.activeGameObject && Selection.activeGameObject.GetComponentsInChildren <MeshRenderer>().Length > 0)
            {
                if (space == Space.Global)
                {
                }

                var vector = indexToDirection(Mathf.Abs(( int )dir));
                //Debug.Log( vector );
                Handles.color = Color.white;
                MeshRenderer [] renderers = Selection.activeGameObject.GetComponentsInChildren <MeshRenderer>();
                Bounds          bounds    = new Bounds(Selection.activeGameObject.transform.position, Vector3.zero);
                foreach (var renderer in renderers)
                {
                    bounds.Encapsulate(renderer.bounds);
                }
                Handles.CircleHandleCap(0, Selection.activeGameObject.transform.position, Quaternion.AngleAxis(-90f, Vector3.right), radius, EventType.Repaint);
                Vector3 pos = bounds.center + Vector3.up * 3.0f;
                Handles.ArrowHandleCap(0, pos, Quaternion.FromToRotation(Vector3.forward, vector), 3.0f, EventType.Repaint);
                //Handles.ArrowHandleCap( 0 , Selection.activeGameObject.transform.position , Quaternion.LookRotation( -Vector3.right , Vector3.up ) , 1f , EventType.Repaint );
            }
        }
    }
コード例 #14
0
        //Handles:
        protected virtual void OnSceneGUI()
        {
            if (Event.current.type == EventType.Repaint)
            {
                Handles.color = _color;

                //refs:
                Transform transform = ((RampLight)target).transform;

                //directional circle:
                Handles.CircleHandleCap(
                    0,
                    transform.position,
                    transform.rotation * Quaternion.LookRotation(Vector3.forward),
                    HandleUtility.GetHandleSize(transform.position) * _size,
                    EventType.Repaint
                    );

                //draw rays:
                for (int i = 0; i < _visualRayCount; i++)
                {
                    float   degrees = (i / _visualRayCount) * 360;
                    float   radians = degrees * Mathf.Deg2Rad;
                    float   x       = Mathf.Cos(radians);
                    float   y       = Mathf.Sin(radians);
                    Vector3 pos     = new Vector3(x, y, 0) * (HandleUtility.GetHandleSize(transform.position) * _size);
                    pos = transform.TransformPoint(pos);
                    Handles.DrawLine(pos, pos + (transform.forward * (HandleUtility.GetHandleSize(transform.position) * _visualRayLength)));
                }
            }
        }
コード例 #15
0
    //----------------------------------------------------------------------------

    public void _PrimitiveCylinder(ref float radius, ref float height, Vector3 center, Quaternion rotation)
    {
        Vector3 topCenter = center + new Vector3(0f, height / 2f, 0f);
        Vector3 lowCenter = center - new Vector3(0f, height / 2f, 0f);

        Vector3 dir = topCenter - center;

        dir       = rotation * dir;
        topCenter = center + dir;

        dir       = lowCenter - center;
        dir       = rotation * dir;
        lowCenter = center + dir;

#if UNITY_5_6_OR_NEWER
        Handles.CircleHandleCap(0, topCenter, rotation * Quaternion.FromToRotation(Vector3.forward, Vector3.up), radius, EventType.Repaint);
        Handles.CircleHandleCap(0, lowCenter, rotation * Quaternion.FromToRotation(Vector3.forward, Vector3.up), radius, EventType.Repaint);
#else
        Handles.CircleCap(0, topCenter, rotation * Quaternion.FromToRotation(Vector3.forward, Vector3.up), radius);
        Handles.CircleCap(0, lowCenter, rotation * Quaternion.FromToRotation(Vector3.forward, Vector3.up), radius);
#endif
        Handles.DrawLine(topCenter + rotation * new Vector3(radius, 0f, 0f), lowCenter + rotation * new Vector3(radius, 0f, 0f));
        Handles.DrawLine(topCenter - rotation * new Vector3(radius, 0f, 0f), lowCenter - rotation * new Vector3(radius, 0f, 0f));
        Handles.DrawLine(topCenter + rotation * new Vector3(0f, 0f, radius), lowCenter + rotation * new Vector3(0f, 0f, radius));
        Handles.DrawLine(topCenter - rotation * new Vector3(0f, 0f, radius), lowCenter - rotation * new Vector3(0f, 0f, radius));
    }
コード例 #16
0
 void OnSceneGUI()
 {
     Handles.color = Color.green;
     foreach (var bossZone in controller.bosses)
     {
         Handles.CircleHandleCap(0, bossZone.transform.position, Quaternion.identity, controller.fadeDistance + bossZone.radius, EventType.Repaint);
     }
 }
コード例 #17
0
    public void OnDrawGizmos()
    {
        var temp = Handles.color;

        Handles.color = Color.yellow;
        Handles.CircleHandleCap(0, transform.position, Quaternion.Euler(90, 0, 0), radius, EventType.Repaint);
        Handles.color = temp;
    }
コード例 #18
0
 private static void CircleHandle(int id, Vector3 position, Quaternion rotation, float size, EventType eventType)
 {
     Handles.color = _fill;
     Handles.DrawSolidDisc(position, Vector3.back, size);
     Handles.color = _outline;
     Handles.DrawWireDisc(position, Vector3.back, size);
     Handles.CircleHandleCap(id, position, rotation, size, eventType);
 }
コード例 #19
0
        public static void DrawCircle(Vector3 position, Quaternion rotation, float radius)
        {
#if UNITY_5_5_OR_NEWER
            Handles.CircleHandleCap(0, position, rotation, radius, EventType.Repaint);
#else
            Handles.CircleCap(0, position, rotation, radius);
#endif
        }
コード例 #20
0
 private void DrawRect(int controlID, Vector3 position, Quaternion rotation, float size, EventType eventType)
 {
     Handles.color = new Color(0.0f, 1.0f, 1.0f, 0.2f);
     Handles.DrawSolidDisc(position, Vector3.back, size);
     Handles.color = Color.cyan;
     Handles.DrawWireDisc(position, Vector3.back, size);
     Handles.CircleHandleCap(controlID, position, rotation, size, eventType);
 }
コード例 #21
0
 private void OnDrawGizmos()
 {
     Handles.color = Color.green;
     Handles.CircleHandleCap(0, transform.position + Vector3.up * 0.01f, Quaternion.Euler(90.0f, 0.0f, 0.0f), 0.5f, EventType.Repaint);
     Handles.ArrowHandleCap(0, GizmoPosition, Quaternion.Euler(90.0f, 0.0f, 0.0f), 1.0f, EventType.Repaint);
     Handles.color = Color.blue;
     Handles.ArrowHandleCap(0, transform.position + transform.forward * 0.5f, transform.rotation, 0.5f, EventType.Repaint);
 }
コード例 #22
0
		public static void DrawCircleCap(int controlID, Vector3 position, Quaternion rotation, float size)
		{
#if UNITY_2017_1_OR_NEWER
			Handles.CircleHandleCap(controlID, position, rotation, size, EventType.Repaint);
#else
			Handles.CircleCap(controlID, position, rotation, size);
#endif
		}
コード例 #23
0
        public static void DrawSphereArrow(Color newColor, Vector3 position, Quaternion rotation, float sizeRatio = 1f)
        {
            Color old = Handles.color;

            Handles.color = newColor;
            Handles.CircleHandleCap(0, position, rotation, HandleUtility.GetHandleSize(position) * sizeRatio, EventType.Repaint);
            Handles.color = old;
        }
コード例 #24
0
 //https://forum.unity.com/threads/how-can-i-draw-a-circle-around-the-mouse-pointer-on-scene-view.474273/
 private static void DrawCircleBrush(Color color, float size)
 {
     Handles.color = color;
     // Circle
     Handles.CircleHandleCap(0, Event.current.mousePosition, Quaternion.identity, size, EventType.Repaint);
     // Cross Center
     Handles.DrawLine(Event.current.mousePosition + Vector2.left, Event.current.mousePosition + Vector2.right);
     Handles.DrawLine(Event.current.mousePosition + Vector2.up, Event.current.mousePosition + Vector2.down);
 }
コード例 #25
0
    private static void DrawHemisphere(Vector3 position, Quaternion rotation, float radius)
    {
        var left    = rotation * Vector3.left;
        var forward = rotation * Vector3.forward;

        Handles.CircleHandleCap(0, position, rotation * _x90, radius, EventType.Repaint);
        Handles.DrawWireArc(position, left, forward, 180, radius);
        Handles.DrawWireArc(position, forward, -left, 180, radius);
    }
コード例 #26
0
    private void OnSceneGUI()
    {
        if (drawPoints)
        {
            HandleUtility.AddDefaultControl(GetHashCode());

            var pick_new_vert = GrindSplineUtils.PickNearestVertexToCursor(out var pos);

            if (pick_new_vert)
            {
                nearestVert = pos;
            }

            HandleUtility.Repaint();

            Handles.color = Color.green;

            if (grindSpline.transform.childCount > 0)
            {
                Handles.DrawAAPolyLine(3f, grindSpline.transform.GetChild(grindSpline.transform.childCount - 1).position, nearestVert);
            }

            var label = "Shift Click : Add Point\n" +
                        $"Space : Confirm\n" +
                        $"Escape : Cancel";

            var offset = Vector3.up * Mathf.Lerp(0.1f, 1f, Mathf.Clamp01(SceneView.currentDrawingSceneView.cameraDistance / 4));

            Handles.Label(nearestVert + offset, label, new GUIStyle("whiteLabel")
            {
                richText = true, fontSize = 14, fontStyle = FontStyle.Bold
            });
            Handles.CircleHandleCap(0, nearestVert, Quaternion.LookRotation(SceneView.currentDrawingSceneView.camera.transform.forward), 0.02f, EventType.Repaint);

            if (Event.current == null)
            {
                return;
            }

            if (Event.current.type == EventType.MouseUp && Event.current.button == 0 && Event.current.modifiers.HasFlag(EventModifiers.Shift))
            {
                GrindSplineUtils.AddPoint(grindSpline, nearestVert);
            }

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Space)
            {
                drawPoints = false;
                Repaint();
            }

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
            {
                drawPoints = false;
                Repaint();
            }
        }
    }
コード例 #27
0
ファイル: PointListDrawer.cs プロジェクト: framefap/ARproject
    static void DrawAddPointHandle(int controlId, Vector3 position, Quaternion rotation, float size, EventType eventType)
    {
        Handles.color = Color.black;
        Handles.CircleHandleCap(controlId, position, rotation, size, eventType);
        Handles.DrawSolidDisc(position, uiNormal, size);

        Handles.color = Color.white;
        Handles.DrawSolidDisc(position, uiNormal, size * 0.2f);
    }
コード例 #28
0
ファイル: SoapHandles.cs プロジェクト: medvedya/UShape
        private static void PosCap(int controlId, Vector3 position, Quaternion rotation, float size, EventType eventType)
        {
            Handles.CircleHandleCap(controlId, position, rotation, size, eventType);
            var tmp = Handles.color;

            Handles.color = Color.black;
            Handles.DrawWireDisc(position, rotation * Vector3.forward, size * 1.1f);
            Handles.color = tmp;
        }
コード例 #29
0
    public static void OnSceneGUI_SplineDrawingCommon(Editor editor, GrindSpline grindSpline, string lmbLabel, ref bool vertexSnap, ref Vector3 pointPosition)
    {
        HandleUtility.AddDefaultControl(editor.GetHashCode());

        Handles.BeginGUI();
        {
            var r = new Rect(10, SceneView.currentDrawingSceneView.camera.pixelHeight - 30 * 3 + 10, 400, 30 * 4);

            GUILayout.BeginArea(r);
            GUILayout.BeginVertical(new GUIStyle("box"));

            var label = $"{lmbLabel}\n" +
                        $"V : Toggle Vertex Snap\n" +
                        $"Space : Confirm\n" +
                        $"Escape : Cancel";

            GUILayout.Label($"<color=white>{label}</color>", new GUIStyle("label")
            {
                richText = true, fontSize = 14, fontStyle = FontStyle.Bold
            });
            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
        Handles.EndGUI();

        if (Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.V)
        {
            vertexSnap = !vertexSnap;
        }

        if (vertexSnap)
        {
            if (GrindSplineUtils.SnapToVertexAtCursor(out var pos))
            {
                pointPosition = pos;
            }
        }
        else
        {
            if (GrindSplineUtils.SnapToSurfaceAtCursor(out var pos))
            {
                pointPosition = pos;
            }
        }

        HandleUtility.Repaint();

        Handles.color = Color.cyan;

        if (grindSpline != null && grindSpline.PointsContainer.childCount > 0)
        {
            Handles.DrawAAPolyLine(3f, grindSpline.PointsContainer.GetChild(grindSpline.PointsContainer.childCount - 1).position, pointPosition);
        }

        Handles.CircleHandleCap(0, pointPosition, Quaternion.LookRotation(SceneView.currentDrawingSceneView.camera.transform.forward), 0.02f, EventType.Repaint);
    }
コード例 #30
0
    public override void DrawGizmos(Color tColor)
    {
#if UNITY_EDITOR
        FixedPointF radius = mRadius;
        Vector3     pos    = mTrans.Position.value;
        Gizmos.color  = tColor;
        Handles.color = tColor;
        Handles.CircleHandleCap(0, pos, Quaternion.Euler(90, 0, 0), radius.value, EventType.Repaint);
#endif
    }