diff --git a/com.unity.cinemachine/CHANGELOG.md b/com.unity.cinemachine/CHANGELOG.md index 7497fa3ff..533e82f14 100644 --- a/com.unity.cinemachine/CHANGELOG.md +++ b/com.unity.cinemachine/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - CameraActivated events were not sent consistently when activation was due to timeline blends. - Bugfix: FramingTransposer with a dead zone would sometimes drift. - Fixed the Radial Axis input axis in the CinemachineOrbitalFollow component to map to the y axis. -- The Deoccluder failed to reset its state when initially enabled. +- The Deoccluder failed to reset its state when initially enabled, and sometimes caused small spurious camera rotations. ### Changed - Added delayed processing to near and far clip plane inspector fields for the CinemachineCamera lens. diff --git a/com.unity.cinemachine/Editor/Obsolete/CinemachineVirtualCameraEditor.cs b/com.unity.cinemachine/Editor/Obsolete/CinemachineVirtualCameraEditor.cs index d51f4e127..99d0da750 100644 --- a/com.unity.cinemachine/Editor/Obsolete/CinemachineVirtualCameraEditor.cs +++ b/com.unity.cinemachine/Editor/Obsolete/CinemachineVirtualCameraEditor.cs @@ -223,76 +223,6 @@ static CreatePipelineWithUndo() }; } } - - // Because the cinemachine components are attached to hidden objects, their - // gizmos don't get drawn by default. We have to do it explicitly. - [InitializeOnLoad] - static class CollectGizmoDrawers - { - static CollectGizmoDrawers() - { - m_GizmoDrawers = new Dictionary(); - string definedIn = typeof(CinemachineComponentBase).Assembly.GetName().Name; - Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); - foreach (Assembly assembly in assemblies) - { - // Note that we have to call GetName().Name. Just GetName() will not work. - if ((!assembly.GlobalAssemblyCache) - && ((assembly.GetName().Name == definedIn) - || assembly.GetReferencedAssemblies().Any(a => a.Name == definedIn))) - { - try - { - foreach (var type in assembly.GetTypes()) - { - try - { - bool added = false; - foreach (var method in type.GetMethods( - BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static)) - { - if (added) - break; - if (!method.IsStatic) - continue; - var attributes = method.GetCustomAttributes(typeof(DrawGizmo), true) as DrawGizmo[]; - foreach (var a in attributes) - { - if (typeof(CinemachineComponentBase).IsAssignableFrom(a.drawnType) && !a.drawnType.IsAbstract) - { - m_GizmoDrawers.Add(a.drawnType, method); - added = true; - break; - } - } - } - } - catch (Exception) {} // Just skip uncooperative types - } - } - catch (Exception) {} // Just skip uncooperative assemblies - } - } - } - public static Dictionary m_GizmoDrawers; - } - - [DrawGizmo(GizmoType.Active | GizmoType.InSelectionHierarchy, typeof(CinemachineVirtualCamera))] - static void DrawVirtualCameraGizmos(CinemachineVirtualCamera vcam, GizmoType selectionType) - { - var pipeline = vcam.GetComponentPipeline(); - if (pipeline != null) - { - foreach (var c in pipeline) - { - if (c != null && CollectGizmoDrawers.m_GizmoDrawers.TryGetValue(c.GetType(), out var method)) - { - if (method != null) - method.Invoke(null, new object[] {c, selectionType}); - } - } - } - } } } #endif diff --git a/com.unity.cinemachine/Editor/Obsolete/ObsoletePropertyDrawers.cs b/com.unity.cinemachine/Editor/Obsolete/ObsoletePropertyDrawers.cs index 64063cabf..3424ab705 100644 --- a/com.unity.cinemachine/Editor/Obsolete/ObsoletePropertyDrawers.cs +++ b/com.unity.cinemachine/Editor/Obsolete/ObsoletePropertyDrawers.cs @@ -348,5 +348,13 @@ public override void OnGUI(Rect rect, SerializedProperty property, GUIContent la } } } + + partial class OutputChannelsPropertyDrawer : PropertyDrawer + { + public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.PropertyField(rect, property, label); + } + } } #endif diff --git a/com.unity.cinemachine/Editor/PropertyDrawers/OutputChannelsPropertyDrawer.cs b/com.unity.cinemachine/Editor/PropertyDrawers/OutputChannelsPropertyDrawer.cs index dbc63875d..75c90938f 100644 --- a/com.unity.cinemachine/Editor/PropertyDrawers/OutputChannelsPropertyDrawer.cs +++ b/com.unity.cinemachine/Editor/PropertyDrawers/OutputChannelsPropertyDrawer.cs @@ -7,7 +7,7 @@ namespace Unity.Cinemachine.Editor { [CustomPropertyDrawer(typeof(OutputChannels))] - class OutputChannelsPropertyDrawer : PropertyDrawer + partial class OutputChannelsPropertyDrawer : PropertyDrawer { public override VisualElement CreatePropertyGUI(SerializedProperty property) { diff --git a/com.unity.cinemachine/Runtime/Behaviours/CinemachineDeoccluder.cs b/com.unity.cinemachine/Runtime/Behaviours/CinemachineDeoccluder.cs index 2f2e466b7..4a2c27998 100644 --- a/com.unity.cinemachine/Runtime/Behaviours/CinemachineDeoccluder.cs +++ b/com.unity.cinemachine/Runtime/Behaviours/CinemachineDeoccluder.cs @@ -461,14 +461,11 @@ protected override void PostPipelineStageCallback( newCamPos = state.GetCorrectedPosition(); // Adjust the damping bypass to account for the displacement - if (hasLookAt) + if (hasLookAt && displacement.sqrMagnitude > Epsilon) { // Restore the lookAt offset - if (displacement.sqrMagnitude > Epsilon) - { - var q = Quaternion.LookRotation(lookAtPoint - newCamPos, up); - state.RawOrientation = q.ApplyCameraRotation(-lookAtScreenOffset, up); - } + var q = Quaternion.LookRotation(lookAtPoint - newCamPos, up); + state.RawOrientation = q.ApplyCameraRotation(-lookAtScreenOffset, up); if (vcam.PreviousStateIsValid && extra.StateIsValid) { var dir0 = extra.PreviousCameraPosition - lookAtPoint;