private static void SceneGUIEaseBased() { CameraPathDelayList pointList = _cameraPath.delayList; Camera sceneCamera = Camera.current; int pointCount = pointList.realNumberOfPoints; for (int i = 0; i < pointCount; i++) { CameraPathDelay point = pointList[i]; if (_cameraPath.enableUndo) { Undo.RecordObject(point, "Modifying Ease Curves"); } if (Vector3.Dot(sceneCamera.transform.forward, point.worldPosition - sceneCamera.transform.position) < 0) { continue; } string pointLabel = ""; if (point == pointList.introPoint) { pointLabel += "start point"; } else if (point == pointList.outroPoint) { pointLabel += "end point"; } else { pointLabel += point.displayName; if (point.time > 0) { pointLabel += "\ndelay: " + point.time.ToString("F2") + " sec"; } else { pointLabel += "\ndelay indefinitely"; } } Handles.Label(point.worldPosition, pointLabel); float pointHandleSize = HandleUtility.GetHandleSize(point.worldPosition) * HANDLE_SCALE; Handles.color = (i == selectedPointIndex) ? _cameraPath.selectedPointColour : _cameraPath.unselectedPointColour; if (Handles.Button(point.worldPosition, Quaternion.identity, pointHandleSize, pointHandleSize, Handles.DotCap)) { ChangeSelectedPointIndex(i); GUI.changed = true; } // float unitPercent = 0.5f; Vector3 easeUp = Vector3.up * _cameraPath.pathLength * 0.1f; Handles.color = CameraPathColours.RED; if (point != pointList.outroPoint) { float outroEasePointPercent = _cameraPath.GetOutroEasePercentage(point); Vector3 outroEasePoint = _cameraPath.GetPathPosition(outroEasePointPercent, true); Vector3 outroeaseDirection = _cameraPath.GetPathDirection(outroEasePointPercent, false); Handles.Label(outroEasePoint, "Ease Out\n" + point.displayName); Vector3 newPosition = Handles.Slider(outroEasePoint, outroeaseDirection); float movement = Vector3.Distance(outroEasePoint, newPosition); if (movement > Mathf.Epsilon) { float newPercent = NearestmMousePercentage(); float curvePercent = _cameraPath.GetCurvePercentage(_cameraPath.delayList.GetPoint(point.index), _cameraPath.delayList.GetPoint(point.index + 1), newPercent); point.outroEndEasePercentage = curvePercent; } float percentWidth = (outroEasePointPercent - point.percent); // float easeSpace = _cameraPath.pathLength * percentWidth; // float easeLength = unitPercent / percentWidth; float percentMovement = percentWidth / 10.0f; for (float e = point.percent; e < outroEasePointPercent; e += percentMovement) { float eB = e + percentMovement; Vector3 lineStart = _cameraPath.GetPathPosition(e, true); Vector3 lineEnd = _cameraPath.GetPathPosition(eB, true); Handles.DrawLine(lineStart, lineEnd); float animCurvePercentA = (e - point.percent) / percentWidth; float animCurvePercentB = (eB - point.percent) / percentWidth; Vector3 lineEaseUpA = easeUp * point.outroCurve.Evaluate(animCurvePercentA); Vector3 lineEaseUpB = easeUp * point.outroCurve.Evaluate(animCurvePercentB); Handles.DrawLine(lineStart + lineEaseUpA, lineEnd + lineEaseUpB); } } if (point != pointList.introPoint) { float introEasePointPercent = _cameraPath.GetIntroEasePercentage(point); Vector3 introEasePoint = _cameraPath.GetPathPosition(introEasePointPercent, true); Vector3 introEaseDirection = _cameraPath.GetPathDirection(introEasePointPercent, false); Handles.color = CameraPathColours.RED; Handles.Label(introEasePoint, "Ease In\n" + point.displayName); Vector3 newPosition = Handles.Slider(introEasePoint, -introEaseDirection); float movement = Vector3.Distance(introEasePoint, newPosition); if (movement > Mathf.Epsilon) { float newPercent = NearestmMousePercentage(); float curvePercent = 1 - _cameraPath.GetCurvePercentage(_cameraPath.delayList.GetPoint(point.index - 1), _cameraPath.delayList.GetPoint(point.index), newPercent); point.introStartEasePercentage = curvePercent; } float percentWidth = (point.percent - introEasePointPercent); // float easeSpace = _cameraPath.pathLength * percentWidth; // float easeLength = unitPercent / percentWidth; float percentMovement = percentWidth / 10.0f; for (float e = introEasePointPercent; e < point.percent; e += percentMovement) { float eB = e + percentMovement; Vector3 lineStart = _cameraPath.GetPathPosition(e, true); Vector3 lineEnd = _cameraPath.GetPathPosition(eB, true); Handles.DrawLine(lineStart, lineEnd); float animCurvePercentA = (e - introEasePointPercent) / percentWidth; float animCurvePercentB = (eB - introEasePointPercent) / percentWidth; Vector3 lineEaseUpA = easeUp * point.introCurve.Evaluate(animCurvePercentA); Vector3 lineEaseUpB = easeUp * point.introCurve.Evaluate(animCurvePercentB); Handles.DrawLine(lineStart + lineEaseUpA, lineEnd + lineEaseUpB); } } } }