From d28cada53cad9dc6bf6366028ec9644e9c9b3d3f Mon Sep 17 00:00:00 2001 From: Gregory Labute Date: Tue, 7 Jan 2025 15:05:03 -0500 Subject: [PATCH] add isdelayed to near and far clip plane fields (#1032) --- com.unity.cinemachine/CHANGELOG.md | 3 +++ .../Editor/PropertyDrawers/LensSettingsPropertyDrawer.cs | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/com.unity.cinemachine/CHANGELOG.md b/com.unity.cinemachine/CHANGELOG.md index 26a8e43b6..059c9e9e3 100644 --- a/com.unity.cinemachine/CHANGELOG.md +++ b/com.unity.cinemachine/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - CameraDeactivated events were not sent consistently when a blend interrupted another blend before completion. - CameraActivated events were not sent consistently when activation was due to timeline blends. +### Changed +- Added delayed processing to near and far clip plane inspector fields for the CinemachineCamera lens. + ## [3.1.2] - 2024-10-01 diff --git a/com.unity.cinemachine/Editor/PropertyDrawers/LensSettingsPropertyDrawer.cs b/com.unity.cinemachine/Editor/PropertyDrawers/LensSettingsPropertyDrawer.cs index fb433e7b4..7e33795c5 100644 --- a/com.unity.cinemachine/Editor/PropertyDrawers/LensSettingsPropertyDrawer.cs +++ b/com.unity.cinemachine/Editor/PropertyDrawers/LensSettingsPropertyDrawer.cs @@ -97,7 +97,9 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property) var innerFovControl = foldout.AddChild(new FovPropertyControl(property, false)); var nearClip = property.FindPropertyRelative(() => s_Def.NearClipPlane); - foldout.AddChild(new PropertyField(nearClip)).RegisterValueChangeCallback((evt) => + var nearClipField = foldout.AddChild(new PropertyField(nearClip)); + nearClipField.OnInitialGeometry(() => nearClipField.SafeSetIsDelayed()); + nearClipField.RegisterValueChangeCallback((evt) => { if (!IsOrtho(property) && nearClip.floatValue < 0.01f) { @@ -105,7 +107,8 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property) property.serializedObject.ApplyModifiedPropertiesWithoutUndo(); } }); - foldout.Add(new PropertyField(property.FindPropertyRelative(() => s_Def.FarClipPlane))); + var farClipField = foldout.AddChild(new PropertyField(property.FindPropertyRelative(() => s_Def.FarClipPlane))); + farClipField.OnInitialGeometry(() => farClipField.SafeSetIsDelayed()); foldout.Add(new PropertyField(property.FindPropertyRelative(() => s_Def.Dutch))); var physical = foldout.AddChild(new PropertyField(property.FindPropertyRelative(() => s_Def.PhysicalProperties)));