diff --git a/com.unity.cinemachine/Documentation~/images/CmCameraInspector.png b/com.unity.cinemachine/Documentation~/images/CmCameraInspector.png index 795186de7..5ceda3a27 100644 Binary files a/com.unity.cinemachine/Documentation~/images/CmCameraInspector.png and b/com.unity.cinemachine/Documentation~/images/CmCameraInspector.png differ diff --git a/com.unity.cinemachine/Editor/Editors/CmCameraEditor.cs b/com.unity.cinemachine/Editor/Editors/CinemachineCameraEditor.cs similarity index 97% rename from com.unity.cinemachine/Editor/Editors/CmCameraEditor.cs rename to com.unity.cinemachine/Editor/Editors/CinemachineCameraEditor.cs index 55a635ddb..dc3ddf4c7 100644 --- a/com.unity.cinemachine/Editor/Editors/CmCameraEditor.cs +++ b/com.unity.cinemachine/Editor/Editors/CinemachineCameraEditor.cs @@ -7,7 +7,7 @@ namespace Unity.Cinemachine.Editor { [CustomEditor(typeof(CinemachineCamera))] [CanEditMultipleObjects] - class CmCameraEditor : UnityEditor.Editor + class CinemachineCameraEditor : UnityEditor.Editor { CinemachineCamera Target => target as CinemachineCamera; @@ -53,17 +53,17 @@ public override VisualElement CreateInspectorGUI() this.AddCameraStatus(ux); this.AddTransitionsSection(ux, new () { serializedObject.FindProperty(() => Target.BlendHint) }); ux.Add(new PropertyField(serializedObject.FindProperty(() => Target.Lens))); + ux.Add(new PropertyField(serializedObject.FindProperty(() => Target.Target))); ux.AddHeader("Global Settings"); this.AddGlobalControls(ux); var defaultTargetLabel = new Label() { style = { alignSelf = Align.FlexEnd, opacity = 0.5f }}; - var row = ux.AddChild(new InspectorUtility.LabeledRow("Procedural Motion", "", defaultTargetLabel)); + var row = ux.AddChild(new InspectorUtility.LabeledRow("Set Procedural Components", "", defaultTargetLabel)); row.focusable = false; row.style.paddingTop = InspectorUtility.SingleLineHeight / 2; row.style.paddingBottom = EditorGUIUtility.standardVerticalSpacing; - ux.Add(new PropertyField(serializedObject.FindProperty(() => Target.Target))); this.AddPipelineDropdowns(ux); ux.AddSpace(); diff --git a/com.unity.cinemachine/Editor/Editors/CmCameraEditor.cs.meta b/com.unity.cinemachine/Editor/Editors/CinemachineCameraEditor.cs.meta similarity index 100% rename from com.unity.cinemachine/Editor/Editors/CmCameraEditor.cs.meta rename to com.unity.cinemachine/Editor/Editors/CinemachineCameraEditor.cs.meta diff --git a/com.unity.cinemachine/Editor/Editors/CinemachineFreeLookModifierEditor.cs b/com.unity.cinemachine/Editor/Editors/CinemachineFreeLookModifierEditor.cs index 1cba5952e..7724bd07b 100644 --- a/com.unity.cinemachine/Editor/Editors/CinemachineFreeLookModifierEditor.cs +++ b/com.unity.cinemachine/Editor/Editors/CinemachineFreeLookModifierEditor.cs @@ -18,7 +18,8 @@ public override VisualElement CreateInspectorGUI() var ux = new VisualElement(); var invalidSrcMsg = ux.AddChild( - new HelpBox("No applicable components found. Must have one of: " + new HelpBox("This component will be ignored because no applicable target components are present.\n\n" + + "Applicable target components include: " + InspectorUtility.GetAssignableBehaviourNames( typeof(CinemachineFreeLookModifier.IModifierValueSource)), HelpBoxMessageType.Warning)); @@ -80,7 +81,7 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property) if (property.managedReferenceValue is not CinemachineFreeLookModifier.Modifier m) return new Label("invalid item"); - var warningText = "No applicable components found. Must have one of: " + var warningText = "No applicable targets found. Applicable targets include: " + InspectorUtility.GetAssignableBehaviourNames(m.CachedComponentType); var overlay = new VisualElement { style = { flexDirection = FlexDirection.Row, flexGrow = 1 }}; diff --git a/com.unity.cinemachine/Editor/Editors/CinemachineGroupFramingEditor.cs b/com.unity.cinemachine/Editor/Editors/CinemachineGroupFramingEditor.cs index 76f624e1a..c8764dcf8 100644 --- a/com.unity.cinemachine/Editor/Editors/CinemachineGroupFramingEditor.cs +++ b/com.unity.cinemachine/Editor/Editors/CinemachineGroupFramingEditor.cs @@ -28,7 +28,7 @@ void OnDisable() public override VisualElement CreateInspectorGUI() { var ux = new VisualElement(); - this.AddMissingCmCameraHelpBox(ux, CmPipelineComponentInspectorUtility.RequiredTargets.Group); + this.AddMissingCmCameraHelpBox(ux, CmPipelineComponentInspectorUtility.RequiredTargets.GroupLookAt); var groupSizeIsZeroHelp = ux.AddChild(new HelpBox("Group size is zero, cannot frame.", HelpBoxMessageType.Warning)); ux.Add(new PropertyField(serializedObject.FindProperty(() => Target.FramingMode))); diff --git a/com.unity.cinemachine/Editor/Editors/InputAxisControllerEditor.cs b/com.unity.cinemachine/Editor/Editors/InputAxisControllerEditor.cs index bb6e42d93..c1e638c99 100644 --- a/com.unity.cinemachine/Editor/Editors/InputAxisControllerEditor.cs +++ b/com.unity.cinemachine/Editor/Editors/InputAxisControllerEditor.cs @@ -164,7 +164,8 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property) list.BindProperty(property); var isEmptyMessage = ux.AddChild(new HelpBox( - "No applicable components found. Must have one of: " + "This component will be ignored because no applicable target components are present.\n\n" + + "Applicable target components include: " + InspectorUtility.GetAssignableBehaviourNames(typeof(IInputAxisOwner)), HelpBoxMessageType.Warning)); list.TrackPropertyWithInitialCallback( diff --git a/com.unity.cinemachine/Editor/PropertyDrawers/LensSettingsPropertyDrawer.cs b/com.unity.cinemachine/Editor/PropertyDrawers/LensSettingsPropertyDrawer.cs index 892b9dc2e..9b7dee16b 100644 --- a/com.unity.cinemachine/Editor/PropertyDrawers/LensSettingsPropertyDrawer.cs +++ b/com.unity.cinemachine/Editor/PropertyDrawers/LensSettingsPropertyDrawer.cs @@ -51,8 +51,9 @@ System.Reflection.BindingFlags bindingFlags static List m_PresetOptions; static List m_PhysicalPresetOptions; - const string k_AddPresetsLabel = "New Preset with these Settings..."; - const string k_EditPresetsLabel = "Edit Presets..."; + const string k_AddPresetsLabel = "New Palette entry with these Settings..."; + const string k_EditPresetsLabel = "Edit Palette..."; + const string k_PaletteLabel = "Palette..."; float m_PreviousAspect; protected bool HideModeOverride { get; set; } @@ -61,14 +62,14 @@ void InitPresetOptions() { m_PresetOptions ??= new List(); m_PresetOptions.Clear(); - var presets = CinemachineLensPresets.InstanceIfExists; - for (int i = 0; presets != null && i < presets.Presets.Count; ++i) - m_PresetOptions.Add(presets.Presets[i].Name); + var palette = CinemachineLensPalette.InstanceIfExists; + for (int i = 0; palette != null && i < palette.Presets.Count; ++i) + m_PresetOptions.Add(palette.Presets[i].Name); m_PresetOptions.Add(""); m_PresetOptions.Add(k_AddPresetsLabel); m_PresetOptions.Add(k_EditPresetsLabel); - var physicalPresets = CinemachinePhysicalLensPresets.InstanceIfExists; + var physicalPresets = CinemachinePhysicalLensPalette.InstanceIfExists; m_PhysicalPresetOptions ??= new List(); m_PhysicalPresetOptions.Clear(); for (int i = 0; physicalPresets != null && i < physicalPresets.Presets.Count; ++i) @@ -115,7 +116,7 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property) { modeOverrideProperty = property.FindPropertyRelative(() => s_Def.ModeOverride); modeHelp = foldout.AddChild( - new HelpBox("Lens Mode Override must be enabled in the CM Brain for Mode Override to take effect", + new HelpBox("Lens Mode Override must be enabled in the Cinemachine Brain for Mode Override to take effect", HelpBoxMessageType.Warning)); foldout.AddChild(new PropertyField(modeOverrideProperty)).TrackPropertyValue( modeOverrideProperty, (p) => InspectorUtility.RepaintGameView()); @@ -191,7 +192,7 @@ public FovPropertyControl(SerializedProperty property, bool hideLabel) : base(hi new FieldMouseDragger(m_Control).SetDragZone(Label); m_Presets = Contents.AddChild(new PopupField - { tooltip = "Custom Lens Presets", style = {flexBasis = 20, flexGrow = 1}}); + { tooltip = "Customizable Lens Palette", style = {flexBasis = 20, flexGrow = 1}}); m_Presets.RegisterValueChangedCallback(OnPresetValueChanged); ShortLabel = new Label("X") { style = { alignSelf = Align.Center, opacity = 0.5f }}; @@ -264,13 +265,13 @@ void OnLensPropertyChanged(SerializedProperty p) m_Control.SetValueWithoutNotify(v); // Sync the presets - var presets = CinemachinePhysicalLensPresets.InstanceIfExists; + var presets = CinemachinePhysicalLensPalette.InstanceIfExists; var index = presets == null ? -1 : presets.GetMatchingPreset(new () { FocalLength = v, PhysicalProperties = ReadPhysicalSettings() }); - m_Presets.SetValueWithoutNotify(index < 0 ? string.Empty : presets.Presets[index].Name); + m_Presets.SetValueWithoutNotify(index < 0 ? k_PaletteLabel : presets.Presets[index].Name); break; } case Modes.VFOV: @@ -284,9 +285,9 @@ void OnLensPropertyChanged(SerializedProperty p) m_Control.SetValueWithoutNotify(v); // Sync the presets - var presets = CinemachineLensPresets.InstanceIfExists; + var presets = CinemachineLensPalette.InstanceIfExists; var index = presets == null ? -1 : presets.GetMatchingPreset(fovProp.floatValue); - m_Presets.SetValueWithoutNotify(index < 0 ? string.Empty : presets.Presets[index].Name); + m_Presets.SetValueWithoutNotify(index < 0 ? k_PaletteLabel : presets.Presets[index].Name); break; } } @@ -366,19 +367,19 @@ void OnPresetValueChanged(ChangeEvent evt) if (GetLensMode() == Modes.Physical) { // Physical presets - var presets = CinemachinePhysicalLensPresets.Instance; - if (presets != null) + var palette = CinemachinePhysicalLensPalette.Instance; + if (palette != null) { // Edit the presets assets if desired if (evt.newValue == k_EditPresetsLabel) - Selection.activeObject = presets; + Selection.activeObject = palette; else if (evt.newValue == k_AddPresetsLabel) { - Selection.activeObject = presets; - Undo.RecordObject(presets, "add preset"); - presets.Presets.Add(new () + Selection.activeObject = palette; + Undo.RecordObject(palette, "add palette entry"); + palette.Presets.Add(new () { - Name = $"{m_Control.value}mm preset {presets.Presets.Count + 1}", + Name = $"{m_Control.value}mm preset {palette.Presets.Count + 1}", FocalLength = m_Control.value, PhysicalProperties = ReadPhysicalSettings() }); @@ -386,10 +387,10 @@ void OnPresetValueChanged(ChangeEvent evt) else { // Apply the preset - var index = presets.GetPresetIndex(evt.newValue); + var index = palette.GetPresetIndex(evt.newValue); if (index >= 0) { - var v = presets.Presets[index]; + var v = palette.Presets[index]; m_LensProperty.FindPropertyRelative(() => s_Def.FieldOfView).floatValue = FocalLengthToFov(v.FocalLength); WritePhysicalSettings(v.PhysicalProperties); m_LensProperty.serializedObject.ApplyModifiedProperties(); @@ -401,30 +402,30 @@ void OnPresetValueChanged(ChangeEvent evt) else { // Nonphysical Presets - var presets = CinemachineLensPresets.Instance; - if (presets != null) + var palette = CinemachineLensPalette.Instance; + if (palette != null) { var fovProp = m_LensProperty.FindPropertyRelative(() => s_Def.FieldOfView); // Edit the presets assets if desired if (evt.newValue == k_EditPresetsLabel) - Selection.activeObject = presets; + Selection.activeObject = palette; else if (evt.newValue == k_AddPresetsLabel) { - Selection.activeObject = presets; - Undo.RecordObject(presets, "add preset"); - presets.Presets.Add(new () + Selection.activeObject = palette; + Undo.RecordObject(palette, "add palette entry"); + palette.Presets.Add(new () { - Name = $"{fovProp.floatValue} preset {presets.Presets.Count + 1}", + Name = $"{fovProp.floatValue} preset {palette.Presets.Count + 1}", VerticalFOV = fovProp.floatValue, }); } else { // Apply the preset - var index = presets.GetPresetIndex(evt.newValue); + var index = palette.GetPresetIndex(evt.newValue); if (index >= 0) - fovProp.floatValue = presets.Presets[index].VerticalFOV; + fovProp.floatValue = palette.Presets[index].VerticalFOV; m_LensProperty.serializedObject.ApplyModifiedProperties(); } } @@ -471,15 +472,13 @@ void WritePhysicalSettings(in LensSettings.PhysicalSettings s) /// IMGUI IMPLEMENTATION (to be removed) ///=========================================================================== - static readonly GUIContent EditPresetsLabel = new ("Edit Presets..."); static readonly GUIContent HFOVLabel = new ("Horizontal FOV", "Horizontal Field of View"); static readonly GUIContent VFOVLabel = new ("Vertical FOV", "Vertical Field of View"); static readonly GUIContent FocalLengthLabel = new ("Focal Length", "The length of the lens (in mm)"); static readonly GUIContent OrthoSizeLabel = new ("Ortho Size", "When using an orthographic camera, " + "this defines the half-height, in world coordinates, of the camera view."); - static readonly GUIContent s_EmptyContent = new (" "); static readonly GUIContent AdvancedLabel = new ("Advanced"); - static readonly string AdvancedHelpboxMessage = "Lens Mode Override must be enabled in the CM Brain for Mode Override to take effect"; + static readonly string AdvancedHelpboxMessage = "Lens Mode Override must be enabled in the Cinemachine Brain for Mode Override to take effect"; static bool s_AdvancedLensExpanded; @@ -493,7 +492,6 @@ struct Snapshot Snapshot m_Snapshot; const float vSpace= 2; - const float hSpace = 2; void SnapshotCameraShadowValues(SerializedProperty property) { diff --git a/com.unity.cinemachine/Editor/Utility/CinemachineLensPresets.cs b/com.unity.cinemachine/Editor/Utility/CinemachineLensPalette.cs similarity index 91% rename from com.unity.cinemachine/Editor/Utility/CinemachineLensPresets.cs rename to com.unity.cinemachine/Editor/Utility/CinemachineLensPalette.cs index a47569acd..39538eeb3 100644 --- a/com.unity.cinemachine/Editor/Utility/CinemachineLensPresets.cs +++ b/com.unity.cinemachine/Editor/Utility/CinemachineLensPalette.cs @@ -10,22 +10,22 @@ namespace Unity.Cinemachine.Editor /// User-definable named presets for lenses. This is a Singleton asset, available in editor only /// [Serializable] - public sealed class CinemachineLensPresets : ScriptableObject + public sealed class CinemachineLensPalette : ScriptableObject { - static CinemachineLensPresets s_Instance = null; + static CinemachineLensPalette s_Instance = null; static bool s_AlreadySearched = false; /// Get the singleton instance of this object, or null if it doesn't exist - public static CinemachineLensPresets InstanceIfExists + public static CinemachineLensPalette InstanceIfExists { get { if (!s_AlreadySearched) { s_AlreadySearched = true; - var guids = AssetDatabase.FindAssets("t:CinemachineLensPresets"); + var guids = AssetDatabase.FindAssets("t:CinemachineLensPalette"); for (int i = 0; i < guids.Length && s_Instance == null; ++i) - s_Instance = AssetDatabase.LoadAssetAtPath( + s_Instance = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath(guids[i])); } return s_Instance; @@ -33,18 +33,18 @@ public static CinemachineLensPresets InstanceIfExists } /// Get the singleton instance of this object. Creates asset if nonexistent - public static CinemachineLensPresets Instance + public static CinemachineLensPalette Instance { get { if (InstanceIfExists == null) { var newAssetPath = EditorUtility.SaveFilePanelInProject( - "Create Lens Presets asset", "CinemachineLensPresets", "asset", + "Create Lens Palette asset", "CinemachineLensPalette", "asset", "This editor-only file will contain the lens presets for this project"); if (!string.IsNullOrEmpty(newAssetPath)) { - s_Instance = CreateInstance(); + s_Instance = CreateInstance(); // Create some sample presets s_Instance.Presets = new() { diff --git a/com.unity.cinemachine/Editor/Utility/CinemachineLensPresets.cs.meta b/com.unity.cinemachine/Editor/Utility/CinemachineLensPalette.cs.meta similarity index 100% rename from com.unity.cinemachine/Editor/Utility/CinemachineLensPresets.cs.meta rename to com.unity.cinemachine/Editor/Utility/CinemachineLensPalette.cs.meta diff --git a/com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPresets.cs b/com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPalette.cs similarity index 90% rename from com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPresets.cs rename to com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPalette.cs index 69bcd92ea..438d0822c 100644 --- a/com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPresets.cs +++ b/com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPalette.cs @@ -7,25 +7,25 @@ namespace Unity.Cinemachine.Editor { /// - /// User-definable named presets for lenses. This is a Singleton asset, available in editor only + /// User-definable named presets for physical lenses. This is a Singleton asset, available in editor only /// [Serializable] - public sealed class CinemachinePhysicalLensPresets : ScriptableObject + public sealed class CinemachinePhysicalLensPalette : ScriptableObject { - static CinemachinePhysicalLensPresets s_Instance = null; + static CinemachinePhysicalLensPalette s_Instance = null; static bool s_AlreadySearched = false; /// Get the singleton instance of this object, or null if it doesn't exist - public static CinemachinePhysicalLensPresets InstanceIfExists + public static CinemachinePhysicalLensPalette InstanceIfExists { get { if (!s_AlreadySearched) { s_AlreadySearched = true; - var guids = AssetDatabase.FindAssets("t:CinemachinePhysicalLensPresets"); + var guids = AssetDatabase.FindAssets("t:CinemachinePhysicalLensPalette"); for (int i = 0; i < guids.Length && s_Instance == null; ++i) - s_Instance = AssetDatabase.LoadAssetAtPath( + s_Instance = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath(guids[i])); } return s_Instance; @@ -33,18 +33,18 @@ public static CinemachinePhysicalLensPresets InstanceIfExists } /// Get the singleton instance of this object. Creates asset if nonexistent - public static CinemachinePhysicalLensPresets Instance + public static CinemachinePhysicalLensPalette Instance { get { if (InstanceIfExists == null) { var newAssetPath = EditorUtility.SaveFilePanelInProject( - "Create Lens Presets asset", "CinemachinePhysicalLensPresets", "asset", - "This editor-only file will contain the lens presets for this project"); + "Create Physical Lens Palette asset", "CinemachinePhysicalLensPalette", "asset", + "This editor-only file will contain the physical lens presets for this project"); if (!string.IsNullOrEmpty(newAssetPath)) { - s_Instance = CreateInstance(); + s_Instance = CreateInstance(); // Create some sample presets var defaultPhysical = LensSettings.Default.PhysicalProperties; diff --git a/com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPresets.cs.meta b/com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPalette.cs.meta similarity index 100% rename from com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPresets.cs.meta rename to com.unity.cinemachine/Editor/Utility/CinemachinePhysicalLensPalette.cs.meta diff --git a/com.unity.cinemachine/Editor/Utility/CmPipelineComponentInspectorUtility.cs b/com.unity.cinemachine/Editor/Utility/CmPipelineComponentInspectorUtility.cs index acac3c864..d57e50063 100644 --- a/com.unity.cinemachine/Editor/Utility/CmPipelineComponentInspectorUtility.cs +++ b/com.unity.cinemachine/Editor/Utility/CmPipelineComponentInspectorUtility.cs @@ -13,11 +13,12 @@ namespace Unity.Cinemachine.Editor /// static class CmPipelineComponentInspectorUtility { - public enum RequiredTargets { None, Tracking, LookAt, Group }; + public enum RequiredTargets { None, Tracking, LookAt, GroupLookAt }; const string k_NeedTarget = "A Tracking Target is required in the CinemachineCamera."; - const string k_NeedLookAt = "A LookAt Tracking Target is required in the CinemachineCamera."; - const string k_NeedGroup = "The Tracking or LookAt Target in the CinemachineCamera must be a Target Group."; + const string k_NeedLookAt = "A LookAt Target is required in the CinemachineCamera."; + const string k_NeedGroupTarget = "The Tracking Target in the CinemachineCamera must be a Target Group."; + const string k_NeedGroupLookAt = "The LookAt Target in the CinemachineCamera must be a Target Group."; const string k_NeedCamera = "This component is intended to be used only with a CinemachineCamera."; const string k_AddCamera = "Add\nCinemachineCamera"; const string k_DuplicateComponent = "This component is redundant and will be ignored."; @@ -34,17 +35,16 @@ public static void AddMissingCmCameraHelpBox( k_NeedCamera, HelpBoxMessageType.Warning, k_AddCamera, () => AddCmCameraToTargets(targets))); - var text = string.Empty; + var targetText = string.Empty; + var lookAtText = string.Empty; switch (requiredTargets) { - case RequiredTargets.Tracking: text = k_NeedTarget; break; - case RequiredTargets.LookAt: text = k_NeedLookAt; break; - case RequiredTargets.Group: text = k_NeedGroup; break; + case RequiredTargets.Tracking: targetText = k_NeedTarget; break; + case RequiredTargets.LookAt: targetText = k_NeedTarget; lookAtText = k_NeedLookAt; break; + case RequiredTargets.GroupLookAt: targetText = k_NeedGroupTarget; lookAtText = k_NeedGroupLookAt; break; } - VisualElement noTargetHelp = null; - if (text.Length > 0) - noTargetHelp = ux.AddChild(new HelpBox(text, HelpBoxMessageType.Warning)); - + var noTargetHelp = targetText.Length > 0 ? ux.AddChild(new HelpBox(targetText, HelpBoxMessageType.Warning)) : null; + var noLookAtHelp = lookAtText.Length > 0 ? ux.AddChild(new HelpBox(lookAtText, HelpBoxMessageType.Warning)) : null; var duplicateHelp = ux.AddChild(new HelpBox(k_DuplicateComponent, HelpBoxMessageType.Error)); // Update state @@ -55,6 +55,7 @@ public static void AddMissingCmCameraHelpBox( var noCamera = false; var noTarget = false; + var noLookAtTarget = false; var isDuplicate = false; for (int i = 0; i < targets.Length && !noCamera; ++i) { @@ -67,10 +68,9 @@ public static void AddMissingCmCameraHelpBox( switch (requiredTargets) { case RequiredTargets.Tracking: noTarget |= c.FollowTarget == null; break; - case RequiredTargets.LookAt: noTarget |= c.LookAtTarget == null; break; - case RequiredTargets.Group: noTarget |= - (c.FollowTargetAsGroup == null || !c.FollowTargetAsGroup.IsValid) - && (c.LookAtTargetAsGroup == null || !c.LookAtTargetAsGroup.IsValid); break; + case RequiredTargets.LookAt: noLookAtTarget |= c.LookAtTarget == null; break; + case RequiredTargets.GroupLookAt: + noLookAtTarget |= c.LookAtTargetAsGroup == null || !c.LookAtTargetAsGroup.IsValid; break; } if (vcam != null && vcam.GetCinemachineComponent(c.Stage) != c) isDuplicate = true; @@ -80,14 +80,15 @@ public static void AddMissingCmCameraHelpBox( var vcam = x.ComponentOwner; noCamera |= vcam == null; if (vcam != null) - vcam.UpdateTargetCache(); - switch (requiredTargets) { - case RequiredTargets.Tracking: noTarget |= noCamera || vcam.Follow == null; break; - case RequiredTargets.LookAt: noTarget |= noCamera || vcam.LookAt == null; break; - case RequiredTargets.Group: noTarget |= noCamera - || ((vcam.FollowTargetAsGroup == null || !vcam.FollowTargetAsGroup.IsValid) - && (vcam.LookAtTargetAsGroup == null || !vcam.LookAtTargetAsGroup.IsValid)); break; + vcam.UpdateTargetCache(); + switch (requiredTargets) + { + case RequiredTargets.Tracking: noTarget |= vcam.Follow == null; break; + case RequiredTargets.LookAt: noLookAtTarget |= vcam.LookAt == null; break; + case RequiredTargets.GroupLookAt: + noLookAtTarget |= vcam.LookAtTargetAsGroup == null || !vcam.LookAtTargetAsGroup.IsValid; break; + } } } else if (targets[i] is MonoBehaviour b) @@ -95,6 +96,7 @@ public static void AddMissingCmCameraHelpBox( } noCameraHelp?.SetVisible(noCamera); noTargetHelp?.SetVisible(noTarget && !noCamera); + noLookAtHelp?.SetVisible(noLookAtTarget && !noCamera); duplicateHelp?.SetVisible(isDuplicate); }); } @@ -283,9 +285,8 @@ public static void IMGUI_DrawMissingCmCameraHelpBox( { case RequiredTargets.Tracking: noTarget |= c.FollowTarget == null; break; case RequiredTargets.LookAt: noTarget |= c.LookAtTarget == null; break; - case RequiredTargets.Group: noTarget |= - (c.FollowTargetAsGroup == null || !c.FollowTargetAsGroup.IsValid) - && (c.LookAtTargetAsGroup == null || !c.LookAtTargetAsGroup.IsValid); break; + case RequiredTargets.GroupLookAt: + noTarget |= c.LookAtTargetAsGroup == null || !c.LookAtTargetAsGroup.IsValid; break; } } else if (targets[i] is CinemachineExtension x) @@ -293,14 +294,15 @@ public static void IMGUI_DrawMissingCmCameraHelpBox( var vcam = x.ComponentOwner; noCamera |= vcam == null; if (vcam != null) - vcam.UpdateTargetCache(); - switch (requiredTargets) { - case RequiredTargets.Tracking: noTarget |= noCamera || vcam.Follow == null; break; - case RequiredTargets.LookAt: noTarget |= noCamera || vcam.LookAt == null; break; - case RequiredTargets.Group: noTarget |= noCamera - || ((vcam.FollowTargetAsGroup == null || !vcam.FollowTargetAsGroup.IsValid) - && (vcam.LookAtTargetAsGroup == null || !vcam.LookAtTargetAsGroup.IsValid)); break; + vcam.UpdateTargetCache(); + switch (requiredTargets) + { + case RequiredTargets.Tracking: noTarget |= vcam.Follow == null; break; + case RequiredTargets.LookAt: noTarget |= vcam.LookAt == null; break; + case RequiredTargets.GroupLookAt: + noTarget |= vcam.LookAtTargetAsGroup == null || !vcam.LookAtTargetAsGroup.IsValid; break; + } } } } @@ -318,7 +320,7 @@ public static void IMGUI_DrawMissingCmCameraHelpBox( { case RequiredTargets.Tracking: text = k_NeedTarget; break; case RequiredTargets.LookAt: text = k_NeedLookAt; break; - case RequiredTargets.Group: text = k_NeedGroup; break; + case RequiredTargets.GroupLookAt: text = k_NeedGroupLookAt; break; } if (text.Length > 0) EditorGUILayout.HelpBox(text, MessageType.Warning);