private void InitialiseLists() { if (this._orientationList == null) { this._orientationList = base.get_gameObject().AddComponent <CameraPathOrientationList>(); } if (this._fovList == null) { this._fovList = base.get_gameObject().AddComponent <CameraPathFOVList>(); } if (this._tiltList == null) { this._tiltList = base.get_gameObject().AddComponent <CameraPathTiltList>(); } if (this._speedList == null) { this._speedList = base.get_gameObject().AddComponent <CameraPathSpeedList>(); } if (this._eventList == null) { this._eventList = base.get_gameObject().AddComponent <CameraPathEventList>(); } if (this._delayList == null) { this._delayList = base.get_gameObject().AddComponent <CameraPathDelayList>(); } this._orientationList.Init(this); this._fovList.Init(this); this._tiltList.Init(this); this._speedList.Init(this); this._eventList.Init(this); this._delayList.Init(this); }
private void InitialiseLists() { if(_orientationList == null) _orientationList = gameObject.AddComponent<CameraPathOrientationList>();// ScriptableObject.CreateInstance<CameraPathOrientationList>(); if (_fovList == null) _fovList = gameObject.AddComponent<CameraPathFOVList>();//ScriptableObject.CreateInstance<CameraPathFOVList>(); if (_tiltList == null) _tiltList = gameObject.AddComponent<CameraPathTiltList>();//ScriptableObject.CreateInstance<CameraPathTiltList>(); if (_speedList == null) _speedList = gameObject.AddComponent<CameraPathSpeedList>();//ScriptableObject.CreateInstance<CameraPathSpeedList>(); if (_eventList == null) _eventList = gameObject.AddComponent<CameraPathEventList>();//ScriptableObject.CreateInstance<CameraPathEventList>(); if (_delayList == null) _delayList = gameObject.AddComponent<CameraPathDelayList>();//ScriptableObject.CreateInstance<CameraPathDelayList>(); _orientationList.Init(this); _fovList.Init(this); _tiltList.Init(this); _speedList.Init(this); _eventList.Init(this); _delayList.Init(this); }
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); } } } }
private static void SceneGUIDelayBased() { DisplayAtPoint(); 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 Delay Point"); } if (Vector3.Dot(sceneCamera.transform.forward, point.worldPosition - sceneCamera.transform.position) < 0) { continue; } string pointLabel = ""; if (point == pointList.introPoint) { pointLabel += "start point"; if (point.time > 0) { pointLabel += "\ndelay: " + point.time.ToString("F2") + " sec"; } else { pointLabel += "\nNo delay"; } } 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; } if (i == selectedPointIndex) { CPPSlider(point); } } }