static HDLightUI() { Inspector = CED.Group( CED.AdvancedFoldoutGroup(s_Styles.generalHeader, Expandable.General, k_ExpandedState, (serialized, owner) => GetAdvanced(Advanceable.General, serialized, owner), (serialized, owner) => SwitchAdvanced(Advanceable.General, serialized, owner), DrawGeneralContent, DrawGeneralAdvancedContent ), CED.AdvancedFoldoutGroup(s_Styles.shapeHeader, Expandable.Shape, k_ExpandedState, (serialized, owner) => GetAdvanced(Advanceable.Shape, serialized, owner), (serialized, owner) => SwitchAdvanced(Advanceable.Shape, serialized, owner), DrawShapeContent, DrawShapeAdvancedContent ), CED.AdvancedFoldoutGroup(s_Styles.emissionHeader, Expandable.Emission, k_ExpandedState, (serialized, owner) => GetAdvanced(Advanceable.Emission, serialized, owner), (serialized, owner) => SwitchAdvanced(Advanceable.Emission, serialized, owner), DrawEmissionContent, DrawEmissionAdvancedContent ), CED.FoldoutGroup(s_Styles.volumetricHeader, Expandable.Volumetric, k_ExpandedState, DrawVolumetric), #if ENABLE_RAYTRACING CED.Conditional((serialized, owner) => serialized.editorLightShape != LightShape.Tube, #else CED.Conditional((serialized, owner) => serialized.editorLightShape != LightShape.Rectangle && serialized.editorLightShape != LightShape.Tube, #endif CED.AdvancedFoldoutGroup(s_Styles.shadowHeader, Expandable.Shadows, k_ExpandedState, (serialized, owner) => GetAdvanced(Advanceable.Shadow, serialized, owner), (serialized, owner) => SwitchAdvanced(Advanceable.Shadow, serialized, owner), CED.Group( CED.FoldoutGroup(s_Styles.shadowMapSubHeader, Expandable.ShadowMap, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent | FoldoutOption.NoSpaceAtEnd, DrawShadowMapContent), CED.Conditional((serialized, owner) => GetAdvanced(Advanceable.Shadow, serialized, owner) && k_ExpandedState[Expandable.ShadowMap], CED.Group(GroupOption.Indent, DrawShadowMapAdvancedContent)), CED.space, // Very High setting CED.Conditional((serialized, owner) => HasShadowQualitySettingsUI(HDShadowQuality.VeryHigh, serialized, owner), CED.FoldoutGroup(s_Styles.veryHighShadowQualitySubHeader, Expandable.ShadowQuality, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent, DrawVeryHighShadowSettingsContent)), // High setting CED.Conditional((serialized, owner) => HasShadowQualitySettingsUI(HDShadowQuality.High, serialized, owner), CED.FoldoutGroup(s_Styles.highShadowQualitySubHeader, Expandable.ShadowQuality, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent, DrawHighShadowSettingsContent)), CED.Conditional((serialized, owner) => HasShadowQualitySettingsUI(HDShadowQuality.Medium, serialized, owner), CED.FoldoutGroup(s_Styles.mediumShadowQualitySubHeader, Expandable.ShadowQuality, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent, DrawMediumShadowSettingsContent)), CED.Conditional((serialized, owner) => HasShadowQualitySettingsUI(HDShadowQuality.Low, serialized, owner), CED.FoldoutGroup(s_Styles.lowShadowQualitySubHeader, Expandable.ShadowQuality, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent, DrawLowShadowSettingsContent)), #if ENABLE_RAYTRACING CED.Conditional((serialized, owner) => serialized.editorLightShape != LightShape.Rectangle && serialized.editorLightShape != LightShape.Tube, #endif CED.FoldoutGroup(s_Styles.contactShadowsSubHeader, Expandable.ContactShadow, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent | FoldoutOption.NoSpaceAtEnd, DrawContactShadowsContent) #if ENABLE_RAYTRACING ), #else , #endif CED.Conditional((serialized, owner) => serialized.settings.isBakedOrMixed || serialized.settings.isCompletelyBaked, CED.space, CED.FoldoutGroup(s_Styles.bakedShadowsSubHeader, Expandable.BakedShadow, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent | FoldoutOption.NoSpaceAtEnd, DrawBakedShadowsContent)) ), CED.noop //will only add parameter in first sub header ) ) ); //quicker than standard reflection as it is compiled var paramLabel = Expression.Parameter(typeof(GUIContent), "label"); var paramProperty = Expression.Parameter(typeof(SerializedProperty), "property"); var paramSettings = Expression.Parameter(typeof(LightEditor.Settings), "settings"); System.Reflection.MethodInfo sliderWithTextureInfo = typeof(EditorGUILayout) .GetMethod( "SliderWithTexture", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static, null, System.Reflection.CallingConventions.Any, new[] { typeof(GUIContent), typeof(SerializedProperty), typeof(float), typeof(float), typeof(float), typeof(Texture2D), typeof(GUILayoutOption[]) }, null); var sliderWithTextureCall = Expression.Call( sliderWithTextureInfo, paramLabel, paramProperty, Expression.Constant((float)typeof(LightEditor.Settings).GetField("kMinKelvin", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetRawConstantValue()), Expression.Constant((float)typeof(LightEditor.Settings).GetField("kMaxKelvin", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetRawConstantValue()), Expression.Constant((float)typeof(LightEditor.Settings).GetField("kSliderPower", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetRawConstantValue()), Expression.Field(paramSettings, typeof(LightEditor.Settings).GetField("m_KelvinGradientTexture", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)), Expression.Constant(null, typeof(GUILayoutOption[]))); var lambda = Expression.Lambda<Action<GUIContent, SerializedProperty, LightEditor.Settings>>(sliderWithTextureCall, paramLabel, paramProperty, paramSettings); SliderWithTexture = lambda.Compile(); }