public override bool SceneEdit(ref SplinePoint[] points, ref List <int> selected) { bool change = false; Camera editorCamera = SceneView.currentDrawingSceneView.camera; for (int i = 0; i < availableMergeComputers.Length; i++) { SplineDrawer.DrawSplineComputer(availableMergeComputers[i]); SplinePoint startPoint = availableMergeComputers[i].GetPoint(0); SplinePoint endPoint = availableMergeComputers[i].GetPoint(availableMergeComputers[i].pointCount - 1); Handles.color = availableMergeComputers[i].editorPathColor; if (SplineEditorHandles.CircleButton(startPoint.position, Quaternion.LookRotation(editorCamera.transform.position - startPoint.position), HandleUtility.GetHandleSize(startPoint.position) * 0.15f, 1f, availableMergeComputers[i].editorPathColor)) { Merge(i, mergeSide, MergeSide.Start, ref points); change = true; break; } if (SplineEditorHandles.CircleButton(endPoint.position, Quaternion.LookRotation(editorCamera.transform.position - endPoint.position), HandleUtility.GetHandleSize(endPoint.position) * 0.15f, 1f, availableMergeComputers[i].editorPathColor)) { Merge(i, mergeSide, MergeSide.End, ref points); change = true; break; } } Handles.color = Color.white; return(change); }
public override bool SceneEdit(ref SplinePoint[] points, ref List <int> selected) { bool change = false; if (transformer == null) { Reset(ref points, ref selected, orientation); } if (rotateNormals) { Handles.color = new Color(Color.yellow.r, Color.yellow.g, Color.yellow.b, 0.4f); for (int i = 0; i < selected.Count; i++) { Vector3 normal = points[selected[i]].normal; normal *= HandleUtility.GetHandleSize(points[selected[i]].position); Handles.DrawLine(points[selected[i]].position, points[selected[i]].position + normal); SplineEditorHandles.DrawArrowCap(points[selected[i]].position + normal, Quaternion.LookRotation(normal), HandleUtility.GetHandleSize(points[selected[i]].position)); } } Handles.color = Color.white; Quaternion lastRotation = transformer.rotation; transformer.rotation = Handles.RotationHandle(lastRotation, transformer.center); if (lastRotation != transformer.rotation) { change = true; points = transformer.GetRotated(rotateNormals, rotateTangents); } return(change); }
protected void DrawResult(SplineResult result) { SplineTracer tracer = (SplineTracer)target; Handles.color = Color.white; Handles.DrawLine(tracer.transform.position, result.position); SplineEditorHandles.DrawSolidSphere(result.position, HandleUtility.GetHandleSize(result.position) * 0.2f); Handles.color = Color.blue; Handles.DrawLine(result.position, result.position + result.direction * HandleUtility.GetHandleSize(result.position) * 0.5f); Handles.color = Color.green; Handles.DrawLine(result.position, result.position + result.normal * HandleUtility.GetHandleSize(result.position) * 0.5f); Handles.color = Color.red; Handles.DrawLine(result.position, result.position + result.right * HandleUtility.GetHandleSize(result.position) * 0.5f); Handles.color = Color.white; }
public override bool SceneEdit(ref SplinePoint[] points, ref List <int> selected) { bool change = false; for (int i = 0; i < selected.Count; i++) { if (computer.isClosed && selected[i] == computer.pointCount - 1) { continue; } Handles.color = SplinePrefs.highlightColor; Handles.DrawWireDisc(points[selected[i]].position, points[selected[i]].normal, HandleUtility.GetHandleSize(points[selected[i]].position) * 0.35f); Handles.DrawWireDisc(points[selected[i]].position, points[selected[i]].normal, HandleUtility.GetHandleSize(points[selected[i]].position) * 0.7f); Handles.color = Color.yellow; Handles.DrawLine(points[selected[i]].position, points[selected[i]].position + HandleUtility.GetHandleSize(points[selected[i]].position) * points[selected[i]].normal); Vector3 normalPos = points[selected[i]].position + points[selected[i]].normal * HandleUtility.GetHandleSize(points[selected[i]].position); Vector3 lastNormal = points[selected[i]].normal; normalPos = SplineEditorHandles.FreeMoveCircle(normalPos, HandleUtility.GetHandleSize(normalPos) * 0.15f); normalPos -= points[selected[i]].position; normalPos.Normalize(); if (normalPos == Vector3.zero) { normalPos = Vector3.up; } points[selected[i]].normal = normalPos; if (!change) { if (lastNormal != normalPos) { change = true; Quaternion delta = Quaternion.FromToRotation(lastNormal, normalPos); for (int n = 0; n < selected.Count; n++) { if (n == i) { continue; } points[selected[n]].normal = delta * points[selected[n]].normal; } return(true); } } } return(change); }
protected override void OnSceneGUI() { base.OnSceneGUI(); SplineProjector user = (SplineProjector)target; for (int i = 0; i < user.triggers.Length; i++) { if (SplineEditorHandles.DrawTrigger(user.triggers[i], user)) { trigger = i; Repaint(); } } if (user.computer == null) { return; } if (Application.isPlaying) { return; } Vector3 projectPos = user.projectTarget.position; if (user.autoProject && lastPos != projectPos) { lastPos = projectPos; user.CalculateProjection(); } if (!user.autoProject) { return; } if (user.projectResult == null) { return; } if (user.target == null) { Handles.color = Color.white; Handles.DrawLine(user.transform.position, user.projectResult.position); Handles.SphereCap(0, user.projectResult.position, Quaternion.LookRotation(user.projectResult.direction), HandleUtility.GetHandleSize(user.projectResult.position) * 0.2f); } }
protected override void OnSceneGUI() { base.OnSceneGUI(); SplineFollower user = (SplineFollower)target; for (int i = 0; i < user.triggers.Length; i++) { if (SplineEditorHandles.DrawTrigger(user.triggers[i], user)) { trigger = i; Repaint(); } } if (Application.isPlaying) { if (!user.autoFollow) { Handles.color = SplineEditorGUI.selectionColor; Handles.DrawLine(user.transform.position, user.followResult.position); Handles.SphereCap(0, user.followResult.position, Quaternion.LookRotation(user.followResult.direction), HandleUtility.GetHandleSize(user.followResult.position) * 0.2f); Handles.color = Color.white; } return; } if (user.computer == null) { return; } if (user.findStartPoint) { SplineResult result = GetFollowResult(user, user.address.Project(user.transform.position, 4, user.clipFrom, user.clipTo)); Handles.DrawLine(user.transform.position, result.position); Handles.SphereCap(0, result.position, Quaternion.LookRotation(result.direction), HandleUtility.GetHandleSize(result.position) * 0.2f); } else if (!user.autoFollow) { SplineResult result = GetFollowResult(user, user.startPercent); Handles.DrawLine(user.transform.position, result.position); Handles.SphereCap(0, result.position, Quaternion.LookRotation(result.direction), HandleUtility.GetHandleSize(result.position) * 0.2f); } }
protected override void OnSceneGUI() { base.OnSceneGUI(); SplineTracer tracer = (SplineTracer)target; if (triggerFoldout) { for (int i = 0; i < tracer.triggers.Length; i++) { SplineEditorHandles.SplineSliderGizmo gizmo = SplineEditorHandles.SplineSliderGizmo.DualArrow; switch (tracer.triggers[i].type) { case Trigger.Type.Backward: gizmo = SplineEditorHandles.SplineSliderGizmo.BackwardTriangle; break; case Trigger.Type.Forward: gizmo = SplineEditorHandles.SplineSliderGizmo.ForwardTriangle; break; case Trigger.Type.Double: gizmo = SplineEditorHandles.SplineSliderGizmo.DualArrow; break; } double last = tracer.triggers[i].position; if (SplineEditorHandles.Slider(tracer, ref tracer.triggers[i].position, tracer.triggers[i].color, tracer.triggers[i].name, gizmo) || last != tracer.triggers[i].position) { trigger = i; Repaint(); } } } if (customOffsetEditor.isOpen) { if (customOffsetEditor.DrawScene(tracer)) { tracer.Rebuild(false); } } if (customRotationEditor.isOpen) { if (customRotationEditor.DrawScene(tracer)) { tracer.Rebuild(false); } } }
public override bool SceneEdit(ref SplinePoint[] points, ref List <int> selected) { bool change = false; Camera editorCamera = SceneView.currentDrawingSceneView.camera; for (int i = 0; i < computer.pointCount; i++) { Vector3 pos = computer.GetPointPosition(i); if (SplineEditorHandles.CircleButton(pos, Quaternion.LookRotation(editorCamera.transform.position - pos), HandleUtility.GetHandleSize(pos) * 0.12f, 1f, computer.editorPathColor)) { SplitAtPoint(i, ref points); change = true; break; } } SplineResult projected = computer.Evaluate(ProjectMouse()); if (!change) { float pointValue = (float)projected.percent * (computer.pointCount - 1); int pointIndex = Mathf.FloorToInt(pointValue); float size = HandleUtility.GetHandleSize(projected.position) * 0.3f; Vector3 up = Vector3.Cross(editorCamera.transform.forward, projected.direction).normalized *size + projected.position; Vector3 down = Vector3.Cross(projected.direction, editorCamera.transform.forward).normalized *size + projected.position; Handles.color = computer.editorPathColor; Handles.DrawLine(up, down); Handles.color = Color.white; if (pointValue - pointIndex > computer.moveStep) { if (SplineEditorHandles.CircleButton(projected.position, Quaternion.LookRotation(editorCamera.transform.position - projected.position), HandleUtility.GetHandleSize(projected.position) * 0.12f, 1f, computer.editorPathColor)) { SplitAtPercent(projected.percent, ref points); change = true; } } SceneView.RepaintAll(); } Handles.color = Color.white; SplineDrawer.DrawSplineComputer(computer, 0.0, projected.percent, 1f); SplineDrawer.DrawSplineComputer(computer, projected.percent, 1.0, 0.4f); return(change); }
void SceneClipEdit() { SplineUser user = (SplineUser)target; Color col = Color.white; if (user.computer != null) { col = user.computer.editorPathColor; } double val = user.clipFrom; SplineEditorHandles.Slider(user, ref val, col, "Clip From", SplineEditorHandles.SplineSliderGizmo.ForwardTriangle); if (val != user.clipFrom) { user.clipFrom = val; } val = user.clipTo; SplineEditorHandles.Slider(user, ref val, col, "Clip To", SplineEditorHandles.SplineSliderGizmo.BackwardTriangle); if (val != user.clipTo) { user.clipTo = val; } }
public bool DrawScene(SplineUser user) { bool changed = false; bool is2D = user.rootUser.computer.is2D; SplineResult result = new SplineResult(); for (int i = 0; i < group.keys.Count; i++) { if (selected >= 0 && i != selected) { continue; } user.Evaluate(result, group.keys[i].position); matrix.SetTRS(result.position, Quaternion.LookRotation(result.direction, result.normal), Vector3.one * result.size); Vector3 pos = matrix.MultiplyPoint(group.keys[i].offset); if (is2D) { Handles.DrawLine(result.position, result.position + result.right * group.keys[i].offset.x * result.size); Handles.DrawLine(result.position, result.position - result.right * group.keys[i].offset.x * result.size); } else { Handles.DrawWireDisc(result.position, result.direction, group.keys[i].offset.magnitude * result.size); } Handles.DrawLine(result.position, pos); } if (selected >= 0 && selected < group.keys.Count) { double value = group.keys[selected].position; user.Evaluate(result, value); matrix.SetTRS(result.position, Quaternion.LookRotation(result.direction, result.normal), Vector3.one * result.size); Vector3 pos = matrix.MultiplyPoint(group.keys[selected].offset); if (editOffset) { Vector3 lastPos = pos; pos = SplineEditorHandles.FreeMoveRectangle(pos, HandleUtility.GetHandleSize(pos) * 0.1f); if (pos != lastPos) { pos = matrix.inverse.MultiplyPoint(pos); pos.z = 0f; if (is2D) { group.keys[selected].offset = Vector2.right * pos.x; } else { group.keys[selected].offset = pos; } changed = true; } } else { double lastValue = value; SplineEditorHandles.Slider(user, ref value, user.rootUser.computer.editorPathColor, "Center", SplineEditorHandles.SplineSliderGizmo.Circle, 0.6f); if (value != lastValue) { changed = true; } if (group.keys[selected].from > group.keys[selected].to) { double fromToEndDistance = 1.0 - group.keys[selected].from; double toToBeginningDistance = group.keys[selected].to; double totalDistance = fromToEndDistance + toToBeginningDistance; if (value > group.keys[selected].from) { group.keys[selected].center = DMath.InverseLerp(group.keys[selected].from, group.keys[selected].from + totalDistance, value); } else if (value < group.keys[selected].to) { group.keys[selected].center = DMath.InverseLerp(-fromToEndDistance, group.keys[selected].to, value); } } else { group.keys[selected].center = DMath.InverseLerp(group.keys[selected].from, group.keys[selected].to, value); } } value = group.keys[selected].from; SplineEditorHandles.Slider(user, ref value, user.rootUser.computer.editorPathColor, "Start", SplineEditorHandles.SplineSliderGizmo.ForwardTriangle, 1f); if (group.keys[selected].from != value) { group.keys[selected].from = value; changed = true; } value = group.keys[selected].to; SplineEditorHandles.Slider(user, ref value, user.rootUser.computer.editorPathColor, "End", SplineEditorHandles.SplineSliderGizmo.BackwardTriangle, 1f); if (group.keys[selected].to != value) { group.keys[selected].to = value; changed = true; } } return(changed); }
protected virtual void OnSceneGUI() { Node node = (Node)target; Node.Connection[] connections = node.GetConnections(); for (int i = 0; i < connections.Length; i++) { SplineDrawer.DrawSplineComputer(connections[i].computer, 0.0, 1.0, 0.5f); } bool update = false; if (position != node.transform.position) { position = node.transform.position; update = true; } if (scale != node.transform.localScale) { scale = node.transform.localScale; update = true; } if (rotation != node.transform.rotation) { rotation = node.transform.rotation; update = true; } if (update) { node.UpdateConnectedComputers(); } if (addComp == null) { if (connections.Length > 0) { bool bezier = false; for (int i = 0; i < connections.Length; i++) { if (connections[i].computer == null) { continue; } if (connections[i].computer.type == Spline.Type.Bezier) { bezier = true; continue; } } if (bezier && node.type == Node.Type.Smooth) { if (connections[0].computer != null) { SplinePoint point = node.GetPoint(0); Handles.DrawDottedLine(node.transform.position, point.tangent, 6f); Handles.DrawDottedLine(node.transform.position, point.tangent2, 6f); Vector3 lastPos = point.tangent; bool setPoint = false; point.SetTangentPosition(Handles.PositionHandle(point.tangent, node.transform.rotation)); if (lastPos != point.tangent) { setPoint = true; } lastPos = point.tangent2; point.SetTangent2Position(Handles.PositionHandle(point.tangent2, node.transform.rotation)); if (lastPos != point.tangent2) { setPoint = true; } if (setPoint) { node.SetPoint(0, point); node.UpdateConnectedComputers(); } } } } return; } SplinePoint[] points = addComp.GetPoints(); Transform camTransform = SceneView.currentDrawingSceneView.camera.transform; SplineDrawer.DrawSplineComputer(addComp, 0.0, 1.0, 0.5f); TextAnchor originalAlignment = GUI.skin.label.alignment; Color originalColor = GUI.skin.label.normal.textColor; GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUI.skin.label.normal.textColor = addComp.editorPathColor; for (int i = 0; i < availablePoints.Length; i++) { if (addComp.isClosed && i == points.Length - 1) { break; } Handles.Label(points[i].position + Camera.current.transform.up * HandleUtility.GetHandleSize(points[i].position) * 0.3f, (i + 1).ToString()); if (SplineEditorHandles.CircleButton(points[availablePoints[i]].position, Quaternion.LookRotation(-camTransform.forward, camTransform.up), HandleUtility.GetHandleSize(points[availablePoints[i]].position) * 0.1f, 2f, addComp.editorPathColor)) { AddConnection(addComp, availablePoints[i]); break; } } GUI.skin.label.alignment = originalAlignment; GUI.skin.label.normal.textColor = originalColor; }
public bool DrawScene(SplineUser user) { bool changed = false; SplineResult result = new SplineResult(); for (int i = 0; i < group.keys.Count; i++) { if (selected >= 0 && i != selected) { continue; } user.Evaluate(result, group.keys[i].position); Quaternion directionRot = Quaternion.LookRotation(result.direction, result.normal); Quaternion rot = directionRot * Quaternion.Euler(group.keys[i].rotation); SplineEditorHandles.DrawArrowCap(result.position, rot, HandleUtility.GetHandleSize(result.position)); } if (selected >= 0 && selected < group.keys.Count) { double value = group.keys[selected].position; user.Evaluate(result, value); Quaternion directionRot = Quaternion.LookRotation(result.direction, result.normal); Quaternion rot = directionRot * Quaternion.Euler(group.keys[selected].rotation); if (editRotation) { rot = Handles.RotationHandle(rot, result.position); rot = Quaternion.Inverse(directionRot) * rot; if (rot.eulerAngles != group.keys[selected].rotation) { changed = true; } group.keys[selected].rotation = rot.eulerAngles; } else { double lastValue = value; SplineEditorHandles.Slider(user, ref value, user.rootUser.computer.editorPathColor, "Center", SplineEditorHandles.SplineSliderGizmo.Circle, 0.6f); if (value != lastValue) { changed = true; } if (group.keys[selected].from > group.keys[selected].to) { double fromToEndDistance = 1.0 - group.keys[selected].from; double toToBeginningDistance = group.keys[selected].to; double totalDistance = fromToEndDistance + toToBeginningDistance; if (value > group.keys[selected].from) { group.keys[selected].center = DMath.InverseLerp(group.keys[selected].from, group.keys[selected].from + totalDistance, value); } else if (value < group.keys[selected].to) { group.keys[selected].center = DMath.InverseLerp(-fromToEndDistance, group.keys[selected].to, value); } } else { group.keys[selected].center = DMath.InverseLerp(group.keys[selected].from, group.keys[selected].to, value); } } value = group.keys[selected].from; SplineEditorHandles.Slider(user, ref value, user.rootUser.computer.editorPathColor, "Start", SplineEditorHandles.SplineSliderGizmo.ForwardTriangle, 1f); if (group.keys[selected].from != value) { group.keys[selected].from = value; changed = true; } value = group.keys[selected].to; SplineEditorHandles.Slider(user, ref value, user.rootUser.computer.editorPathColor, "End", SplineEditorHandles.SplineSliderGizmo.BackwardTriangle, 1f); if (group.keys[selected].to != value) { group.keys[selected].to = value; changed = true; } } return(changed); }
public override bool SceneEdit(ref SplinePoint[] points, ref List <int> selected) { bool change = false; Transform camTransform = SceneView.currentDrawingSceneView.camera.transform; if (focused) { if (!drag) { if (finalize) { if (rect.width > 0f && rect.height > 0f) { if (!additive) { ClearSelection(ref selected); } for (int i = 0; i < points.Length; i++) { Vector2 guiPoint = HandleUtility.WorldToGUIPoint(points[i].position); if (rect.Contains(guiPoint)) { Vector3 local = camTransform.InverseTransformPoint(points[i].position); if (local.z >= 0f) { AddPointSelection(i, ref selected); change = true; } } } } finalize = false; } } else { rectEnd = Event.current.mousePosition; rect = new Rect(Mathf.Min(rectStart.x, rectEnd.x), Mathf.Min(rectStart.y, rectEnd.y), Mathf.Abs(rectEnd.x - rectStart.x), Mathf.Abs(rectEnd.y - rectStart.y)); if (rect.width >= minimumRectSize && rect.height >= minimumRectSize) { Color col = SplinePrefs.highlightColor; if (deleteMode) { col = Color.red; } col.a = 0.4f; GUI.color = col; Handles.BeginGUI(); GUI.Box(rect, "", SplineEditorGUI.whiteBox); GUI.color = Color.white; Handles.EndGUI(); SceneView.RepaintAll(); } } } TextAnchor originalAlignment = GUI.skin.label.alignment; Color originalColor = GUI.skin.label.normal.textColor; GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUI.skin.label.normal.textColor = computer.editorPathColor; for (int i = 0; i < points.Length; i++) { if (computer.isClosed && i == points.Length - 1) { break; } bool moved = false; bool isSelected = selected.Contains(i); Vector3 lastPos = points[i].position; Handles.color = Color.clear; if (SplinePrefs.showPointNumbers && camTransform.InverseTransformPoint(points[i].position).z > 0f) { Handles.Label(points[i].position + Camera.current.transform.up * HandleUtility.GetHandleSize(points[i].position) * 0.3f, (i + 1).ToString()); } if (excludeSelected && isSelected) { SplineEditorHandles.FreeMoveRectangle(points[i].position, HandleUtility.GetHandleSize(points[i].position) * 0.1f); } else { points[i].SetPosition(SplineEditorHandles.FreeMoveRectangle(points[i].position, HandleUtility.GetHandleSize(points[i].position) * 0.1f)); } if (!change) { if (lastPos != points[i].position) { moved = true; change = true; if (isSelected) { for (int n = 0; n < selected.Count; n++) { if (selected[n] == i) { continue; } points[selected[n]].SetPosition(points[selected[n]].position + (points[i].position - lastPos)); } } else if (selectOnMove) { selected.Clear(); selected.Add(i); SceneView.RepaintAll(); } } } if (!moved) { if (SplineEditorHandles.HoverArea(points[i].position, 0.12f) && click) { if (shift) { ShiftSelect(i, points.Length, ref selected); } else if (additive) { AddPointSelection(i, ref selected); } else { SelectPoint(i, ref selected); } SceneView.RepaintAll(); change = true; } } if (!excludeSelected || !isSelected) { Handles.color = computer.editorPathColor; if (deleteMode) { Handles.color = Color.red; } else if (isSelected) { Handles.color = SplinePrefs.highlightColor; } SplineEditorHandles.DrawRectangle(points[i].position, Quaternion.LookRotation(-SceneView.currentDrawingSceneView.camera.transform.forward), HandleUtility.GetHandleSize(points[i].position) * 0.1f); } moved = false; } GUI.skin.label.alignment = originalAlignment; GUI.skin.label.normal.textColor = originalColor; if (computer.type == Spline.Type.Bezier) { Handles.color = computer.editorPathColor; for (int i = 0; i < selected.Count; i++) { Handles.DrawDottedLine(points[selected[i]].position, points[selected[i]].tangent, 6f); Handles.DrawDottedLine(points[selected[i]].position, points[selected[i]].tangent2, 6f); Vector3 lastPos = points[selected[i]].tangent; points[selected[i]].SetTangentPosition(SplineEditorHandles.FreeMoveCircle(points[selected[i]].tangent, HandleUtility.GetHandleSize(points[selected[i]].tangent) * 0.1f)); if (lastPos != points[selected[i]].tangent) { change = true; } lastPos = points[selected[i]].tangent2; points[selected[i]].SetTangent2Position(SplineEditorHandles.FreeMoveCircle(points[selected[i]].tangent2, HandleUtility.GetHandleSize(points[selected[i]].tangent2) * 0.1f)); if (lastPos != points[selected[i]].tangent2) { change = true; } } } return(change); }
public override bool SceneEdit(ref SplinePoint[] points, ref List <int> selected) { bool change = false; if (!drag) { if (finalize) { if (rect.width > 0f && rect.height > 0f) { if (!additive) { ClearSelection(ref selected); } for (int i = 0; i < points.Length; i++) { Vector2 guiPoint = HandleUtility.WorldToGUIPoint(points[i].position); if (rect.Contains(guiPoint)) { AddPointSelection(i, ref selected); change = true; } } } finalize = false; } } else { rectEnd = Event.current.mousePosition; rect = new Rect(Mathf.Min(rectStart.x, rectEnd.x), Mathf.Min(rectStart.y, rectEnd.y), Mathf.Abs(rectEnd.x - rectStart.x), Mathf.Abs(rectEnd.y - rectStart.y)); if (rect.width >= minimumRectSize && rect.height >= minimumRectSize) { Color col = SplineEditorGUI.selectionColor; if (deleteMode) { col = Color.red; } col.a = 0.4f; GUI.color = col; Handles.BeginGUI(); GUI.Box(rect, "", SplineEditorGUI.whiteBox); Handles.EndGUI(); SceneView.RepaintAll(); } } for (int i = 0; i < points.Length; i++) { if (computer.isClosed && i == points.Length - 1) { break; } bool moved = false; bool isSelected = selected.Contains(i); Vector3 lastPos = points[i].position; Handles.color = Color.clear; if (excludeSelected && isSelected) { Handles.FreeMoveHandle(points[i].position, Quaternion.identity, HandleUtility.GetHandleSize(points[i].position) * 0.1f, Vector3.zero, Handles.RectangleCap); } else { points[i].SetPosition(Handles.FreeMoveHandle(points[i].position, Quaternion.identity, HandleUtility.GetHandleSize(points[i].position) * 0.1f, Vector3.zero, Handles.RectangleCap)); } if (!change) { if (lastPos != points[i].position) { moved = true; change = true; if (isSelected) { for (int n = 0; n < selected.Count; n++) { if (selected[n] == i) { continue; } points[selected[n]].SetPosition(points[selected[n]].position + (points[i].position - lastPos)); } } else if (selectOnMove) { selected.Clear(); selected.Add(i); SceneView.RepaintAll(); } } } if (!moved && !isSelected) { if (SplineEditorHandles.HoverArea(points[i].position, 0.12f) && click) { if (additive) { AddPointSelection(i, ref selected); } else { SelectPoint(i, ref selected); } SceneView.RepaintAll(); change = true; } } if (!excludeSelected || !isSelected) { Handles.color = computer.editorPathColor; if (deleteMode) { Handles.color = Color.red; } else if (isSelected) { Handles.color = SplineEditorGUI.selectionColor; } Handles.RectangleCap(i, points[i].position, Quaternion.LookRotation(-SceneView.currentDrawingSceneView.camera.transform.forward), HandleUtility.GetHandleSize(points[i].position) * 0.1f); } moved = false; } if (computer.type == Spline.Type.Bezier) { Handles.color = computer.editorPathColor; for (int i = 0; i < selected.Count; i++) { Handles.DrawDottedLine(points[selected[i]].position, points[selected[i]].tangent, 6f); Handles.DrawDottedLine(points[selected[i]].position, points[selected[i]].tangent2, 6f); Vector3 lastPos = points[selected[i]].tangent; points[selected[i]].SetTangentPosition(Handles.FreeMoveHandle(points[selected[i]].tangent, Quaternion.identity, HandleUtility.GetHandleSize(points[selected[i]].tangent) * 0.1f, Vector3.zero, Handles.CircleCap)); if (lastPos != points[selected[i]].tangent) { change = true; } lastPos = points[selected[i]].tangent2; points[selected[i]].SetTangent2Position(Handles.FreeMoveHandle(points[selected[i]].tangent2, Quaternion.identity, HandleUtility.GetHandleSize(points[selected[i]].tangent2) * 0.1f, Vector3.zero, Handles.CircleCap)); if (lastPos != points[selected[i]].tangent2) { change = true; } } } return(change); }