public SerializedHDShadowInitParameters(SerializedProperty root) { this.root = root; directionalShadowMapDepthBits = root.Find((HDShadowInitParameters s) => s.directionalShadowsDepthBits); serializedPunctualAtlasInit.shadowMapResolution = root.Find((HDShadowInitParameters s) => s.punctualLightShadowAtlas.shadowAtlasResolution); serializedAreaAtlasInit.shadowMapResolution = root.Find((HDShadowInitParameters s) => s.areaLightShadowAtlas.shadowAtlasResolution); serializedPunctualAtlasInit.shadowMapDepthBits = root.Find((HDShadowInitParameters s) => s.punctualLightShadowAtlas.shadowAtlasDepthBits); serializedAreaAtlasInit.shadowMapDepthBits = root.Find((HDShadowInitParameters s) => s.areaLightShadowAtlas.shadowAtlasDepthBits); serializedPunctualAtlasInit.useDynamicViewportRescale = root.Find((HDShadowInitParameters s) => s.punctualLightShadowAtlas.useDynamicViewportRescale); serializedAreaAtlasInit.useDynamicViewportRescale = root.Find((HDShadowInitParameters s) => s.areaLightShadowAtlas.useDynamicViewportRescale); maxShadowRequests = root.Find((HDShadowInitParameters s) => s.maxShadowRequests); shadowResolutionDirectional = new SerializedShadowResolutionSetting(root.Find((HDShadowInitParameters s) => s.shadowResolutionDirectional)); shadowResolutionPunctual = new SerializedShadowResolutionSetting(root.Find((HDShadowInitParameters s) => s.shadowResolutionPunctual)); shadowResolutionArea = new SerializedShadowResolutionSetting(root.Find((HDShadowInitParameters s) => s.shadowResolutionArea)); maxDirectionalShadowMapResolution = root.Find((HDShadowInitParameters s) => s.maxDirectionalShadowMapResolution); maxPunctualShadowMapResolution = root.Find((HDShadowInitParameters s) => s.maxPunctualShadowMapResolution); maxAreaShadowMapResolution = root.Find((HDShadowInitParameters s) => s.maxAreaShadowMapResolution); shadowFilteringQuality = root.Find((HDShadowInitParameters s) => s.shadowFilteringQuality); supportScreenSpaceShadows = root.Find((HDShadowInitParameters s) => s.supportScreenSpaceShadows); maxScreenSpaceShadows = root.Find((HDShadowInitParameters s) => s.maxScreenSpaceShadows); }
public static void ValueGUI <T>(this SerializedShadowResolutionSetting self, GUIContent label) { var rect = GUILayoutUtility.GetRect(0, float.Epsilon, 0, EditorGUIUtility.singleLineHeight); // Magic Number !! rect.x += 3; rect.width -= 6; // Magic Number !! var contentRect = EditorGUI.PrefixLabel(rect, label); EditorGUI.showMixedValue = self.values.hasMultipleDifferentValues; var count = self.values.arraySize; if (typeof(T) == typeof(bool)) { var labels = new GUIContent[count]; Array.Copy(k_Full, labels, count); var values = new bool[count]; for (var i = 0; i < count; ++i) { values[i] = self.values.GetArrayElementAtIndex(i).boolValue; } EditorGUI.BeginChangeCheck(); MultiField(contentRect, labels, values); if (EditorGUI.EndChangeCheck()) { for (var i = 0; i < count; ++i) { self.values.GetArrayElementAtIndex(i).boolValue = values[i]; } } } else if (typeof(T) == typeof(int)) { var labels = new GUIContent[count]; Array.Copy(k_Shorts, labels, count); var values = new int[count]; for (var i = 0; i < count; ++i) { values[i] = self.values.GetArrayElementAtIndex(i).intValue; } EditorGUI.BeginChangeCheck(); MultiField(contentRect, labels, values); if (EditorGUI.EndChangeCheck()) { for (var i = 0; i < count; ++i) { self.values.GetArrayElementAtIndex(i).intValue = values[i]; } } } else if (typeof(T) == typeof(float)) { var labels = new GUIContent[count]; Array.Copy(k_Shorts, labels, count); var values = new float[count]; for (var i = 0; i < count; ++i) { values[i] = self.values.GetArrayElementAtIndex(i).floatValue; } EditorGUI.BeginChangeCheck(); MultiField(contentRect, labels, values); if (EditorGUI.EndChangeCheck()) { for (var i = 0; i < count; ++i) { self.values.GetArrayElementAtIndex(i).floatValue = values[i]; } } } EditorGUI.showMixedValue = false; }