浏览代码

Disable lightLayers conditionaly to RenderPipelineSettings

/main
RSlysz 6 年前
当前提交
41d6655a
共有 4 个文件被更改,包括 45 次插入2 次删除
  1. 6
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs
  2. 7
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs
  3. 23
      com.unity.render-pipelines.core/CoreRP/Editor/SettingsDisableScope.cs
  4. 11
      com.unity.render-pipelines.core/CoreRP/Editor/SettingsDisableScope.cs.meta

6
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs


EditorGUILayout.Space();
EditorGUILayout.LabelField("Additional Settings", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
m_AdditionalLightData.lightLayers.intValue = Convert.ToInt32(EditorGUILayout.EnumFlagsField(s_Styles.lightLayer, (LightLayerEnum)m_AdditionalLightData.lightLayers.intValue));
var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline;
using (new SettingsDisableScope(hdPipeline.asset.renderPipelineSettings.supportLightLayers))
{
m_AdditionalLightData.lightLayers.intValue = Convert.ToInt32(EditorGUILayout.EnumFlagsField(s_Styles.lightLayer, (LightLayerEnum)m_AdditionalLightData.lightLayers.intValue));
}
EditorGUILayout.PropertyField(m_AdditionalLightData.affectDiffuse, s_Styles.affectDiffuse);
EditorGUILayout.PropertyField(m_AdditionalLightData.affectSpecular, s_Styles.affectSpecular);
if (m_LightShape != LightShape.Directional)

7
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs


using System.Collections.Generic;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Rendering;

protected static void Drawer_SectionCustomSettings(HDProbeUI s, SerializedHDProbe d, Editor o)
{
d.lightLayers.intValue = Convert.ToInt32(EditorGUILayout.EnumFlagsField(lightLayersContent, (LightLayerEnum)d.lightLayers.intValue));
var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline;
using (new SettingsDisableScope(hdPipeline.asset.renderPipelineSettings.supportLightLayers))
{
d.lightLayers.intValue = Convert.ToInt32(EditorGUILayout.EnumFlagsField(lightLayersContent, (LightLayerEnum)d.lightLayers.intValue));
}
EditorGUILayout.PropertyField(d.weight, weightContent);

23
com.unity.render-pipelines.core/CoreRP/Editor/SettingsDisableScope.cs


using System;
using UnityEngine;
namespace UnityEditor.Experimental.Rendering
{
public class SettingsDisableScope : IDisposable
{
bool enable;
public SettingsDisableScope(bool enable)
{
this.enable = enable;
if (!enable)
GUI.enabled = false;
}
public void Dispose()
{
if (!enable)
GUI.enabled = true;
}
}
}

11
com.unity.render-pipelines.core/CoreRP/Editor/SettingsDisableScope.cs.meta


fileFormatVersion: 2
guid: b066eb8bfc3d4cd4a8181437643343d2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存