Ejemplo n.º 1
0
 static void DrawGeneralAdvancedContent(SerializedHDLight serialized, Editor owner)
 {
     using (new EditorGUI.DisabledScope(!HDUtils.hdrpSettings.supportLightLayers))
     {
         HDEditorUtils.LightLayerMaskPropertyDrawer(s_Styles.lightLayer, serialized.serializedLightData.renderingLayerMask);
     }
 }
 protected virtual LightingExplorerTableColumn[] GetHDLightColumns()
 {
     return(new[]
     {
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Name, HDStyles.Name, null, 200),                                               // 0: Name
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.On, "m_Enabled", 25),                                       // 1: Enabled
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Enum, HDStyles.Type, "m_Type", 60),                                            // 2: Type
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Enum, HDStyles.Mode, "m_Lightmapping", 60),                                    // 3: Mixed mode
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Enum, HDStyles.Range, "m_Range", 60),                                          // 4: Range
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.ColorTemperatureMode, "m_UseColorTemperature", 100),        // 5: Color Temperature Mode
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Color, HDStyles.Color, "m_Color", 60),                                         // 6: Color
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, HDStyles.ColorTemperature, "m_ColorTemperature", 100, (r, prop, dep) => // 7: Color Temperature
         {
             if (prop.serializedObject.FindProperty("m_UseColorTemperature").boolValue)
             {
                 prop = prop.serializedObject.FindProperty("m_ColorTemperature");
                 prop.floatValue = EditorGUI.FloatField(r, prop.floatValue);
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, HDStyles.Intensity, "m_Intensity", 60, (r, prop, dep) =>                // 8: Intensity
         {
             Light light = prop.serializedObject.targetObject as Light;
             if (light == null || lightDataPairing[light].hdAdditionalLightData == null)
             {
                 EditorGUI.LabelField(r, "null");
                 return;
             }
             float intensity = lightDataPairing[light].hdAdditionalLightData.intensity;
             EditorGUI.BeginChangeCheck();
             intensity = EditorGUI.FloatField(r, intensity);
             if (EditorGUI.EndChangeCheck())
             {
                 Undo.RecordObject(lightDataPairing[light].hdAdditionalLightData, "Changed light intensity");
                 lightDataPairing[light].hdAdditionalLightData.intensity = intensity;
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, HDStyles.Unit, "m_Intensity", 60, (r, prop, dep) =>                // 9: Unit
         {
             Light light = prop.serializedObject.targetObject as Light;
             if (light == null || lightDataPairing[light].hdAdditionalLightData == null)
             {
                 EditorGUI.LabelField(r, "null");
                 return;
             }
             LightUnit unit = lightDataPairing[light].hdAdditionalLightData.lightUnit;
             EditorGUI.BeginChangeCheck();
             unit = (LightUnit)EditorGUI.EnumPopup(r, unit);
             if (EditorGUI.EndChangeCheck())
             {
                 lightDataPairing[light].hdAdditionalLightData.lightUnit = unit;
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, HDStyles.IndirectMultiplier, "m_BounceIntensity", 90),                  // 10: Indirect multiplier
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.Shadows, "m_Shadows.m_Type", 60, (r, prop, dep) =>          // 11: Shadows
         {
             EditorGUI.BeginChangeCheck();
             bool shadows = EditorGUI.Toggle(r, prop.intValue != (int)LightShadows.None);
             if (EditorGUI.EndChangeCheck())
             {
                 prop.intValue = shadows ? (int)LightShadows.Soft : (int)LightShadows.None;
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.ContactShadows, "m_Shadows.m_Type", 100, (r, prop, dep) =>  // 12: Contact Shadows
         {
             Light light = prop.serializedObject.targetObject as Light;
             if (light == null || lightDataPairing[light].additionalShadowData == null)
             {
                 EditorGUI.LabelField(r, "null");
                 return;
             }
             bool contactShadows = lightDataPairing[light].additionalShadowData.contactShadows;
             EditorGUI.BeginChangeCheck();
             contactShadows = EditorGUI.Toggle(r, contactShadows);
             if (EditorGUI.EndChangeCheck())
             {
                 lightDataPairing[light].additionalShadowData.contactShadows = contactShadows;
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Int, HDStyles.ShadowResolution, "m_Intensity", 60, (r, prop, dep) =>           // 13: Shadow resolution
         {
             Light light = prop.serializedObject.targetObject as Light;
             if (light == null || lightDataPairing[light].additionalShadowData == null)
             {
                 EditorGUI.LabelField(r, "null");
                 return;
             }
             int shadowResolution = lightDataPairing[light].additionalShadowData.shadowResolution;
             EditorGUI.BeginChangeCheck();
             shadowResolution = EditorGUI.IntField(r, shadowResolution);
             if (EditorGUI.EndChangeCheck())
             {
                 lightDataPairing[light].additionalShadowData.shadowResolution = shadowResolution;
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.AffectDiffuse, "m_Intensity", 90, (r, prop, dep) =>         // 14: Affect Diffuse
         {
             Light light = prop.serializedObject.targetObject as Light;
             if (light == null || lightDataPairing[light].hdAdditionalLightData == null)
             {
                 EditorGUI.LabelField(r, "null");
                 return;
             }
             bool affectDiffuse = lightDataPairing[light].hdAdditionalLightData.affectDiffuse;
             EditorGUI.BeginChangeCheck();
             affectDiffuse = EditorGUI.Toggle(r, affectDiffuse);
             if (EditorGUI.EndChangeCheck())
             {
                 lightDataPairing[light].hdAdditionalLightData.affectDiffuse = affectDiffuse;
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.AffectSpecular, "m_Intensity", 90, (r, prop, dep) =>        // 15: Affect Specular
         {
             Light light = prop.serializedObject.targetObject as Light;
             if (light == null || lightDataPairing[light].hdAdditionalLightData == null)
             {
                 EditorGUI.LabelField(r, "null");
                 return;
             }
             bool affectSpecular = lightDataPairing[light].hdAdditionalLightData.affectSpecular;
             EditorGUI.BeginChangeCheck();
             affectSpecular = EditorGUI.Toggle(r, affectSpecular);
             if (EditorGUI.EndChangeCheck())
             {
                 lightDataPairing[light].hdAdditionalLightData.affectSpecular = affectSpecular;
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, HDStyles.FadeDistance, "m_Intensity", 60, (r, prop, dep) =>                // 16: Fade Distance
         {
             Light light = prop.serializedObject.targetObject as Light;
             if (light == null || lightDataPairing[light].hdAdditionalLightData == null)
             {
                 EditorGUI.LabelField(r, "null");
                 return;
             }
             float fadeDistance = lightDataPairing[light].hdAdditionalLightData.fadeDistance;
             EditorGUI.BeginChangeCheck();
             fadeDistance = EditorGUI.FloatField(r, fadeDistance);
             if (EditorGUI.EndChangeCheck())
             {
                 Undo.RecordObject(lightDataPairing[light].hdAdditionalLightData, "Changed light fade distance");
                 lightDataPairing[light].hdAdditionalLightData.fadeDistance = fadeDistance;
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, HDStyles.ShadowFadeDistance, "m_Intensity", 60, (r, prop, dep) =>           // 17: Shadow Fade Distance
         {
             Light light = prop.serializedObject.targetObject as Light;
             if (light == null || lightDataPairing[light].additionalShadowData == null)
             {
                 EditorGUI.LabelField(r, "null");
                 return;
             }
             float shadowFadeDistance = lightDataPairing[light].additionalShadowData.shadowFadeDistance;
             EditorGUI.BeginChangeCheck();
             shadowFadeDistance = EditorGUI.FloatField(r, shadowFadeDistance);
             if (EditorGUI.EndChangeCheck())
             {
                 Undo.RecordObject(lightDataPairing[light].additionalShadowData, "Changed light shadow fade distance");
                 lightDataPairing[light].additionalShadowData.shadowFadeDistance = shadowFadeDistance;
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Custom, HDStyles.LightLayer, "m_RenderingLayerMask", 80, (r, prop, dep) =>     // 18: Light Layer
         {
             using (new EditorGUI.DisabledScope(!(GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset).currentPlatformRenderPipelineSettings.supportLightLayers))
             {
                 HDEditorUtils.LightLayerMaskPropertyDrawer(r, prop);
             }
         }),
         new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Custom, HDStyles.IsPrefab, "m_Intensity", 60, (r, prop, dep) =>                // 19: Prefab
         {
             Light light = prop.serializedObject.targetObject as Light;
             if (light == null)
             {
                 EditorGUI.LabelField(r, "null");
                 return;
             }
             bool isPrefab = lightDataPairing[light].isPrefab;
             if (isPrefab)
             {
                 EditorGUI.ObjectField(r, lightDataPairing[light].prefabRoot, typeof(GameObject), false);
             }
         }),
     });
 }