您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

57 行
2.0 KiB

using System.Collections;
using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public abstract class SkySettingsEditor : VolumeComponentEditor
{
SerializedDataParameter m_SkyResolution;
SerializedDataParameter m_SkyExposure;
SerializedDataParameter m_SkyMultiplier;
SerializedDataParameter m_SkyRotation;
SerializedDataParameter m_EnvUpdateMode;
SerializedDataParameter m_EnvUpdatePeriod;
SerializedProperty m_UseForBaking;
public override void OnEnable()
{
var o = new PropertyFetcher<SkySettings>(serializedObject);
m_SkyResolution = Unpack(o.Find(x => x.resolution));
m_SkyExposure = Unpack(o.Find(x => x.exposure));
m_SkyMultiplier = Unpack(o.Find(x => x.multiplier));
m_SkyRotation = Unpack(o.Find(x => x.rotation));
m_EnvUpdateMode = Unpack(o.Find(x => x.updateMode));
m_EnvUpdatePeriod = Unpack(o.Find(x => x.updatePeriod));
m_UseForBaking = o.Find(x => x.useForBaking);
}
protected void CommonSkySettingsGUI()
{
PropertyField(m_SkyResolution);
PropertyField(m_SkyExposure);
PropertyField(m_SkyMultiplier);
PropertyField(m_SkyRotation);
PropertyField(m_EnvUpdateMode);
if (!m_EnvUpdateMode.value.hasMultipleDifferentValues && m_EnvUpdateMode.value.intValue == (int)EnvironementUpdateMode.Realtime)
{
EditorGUI.indentLevel++;
PropertyField(m_EnvUpdatePeriod);
EditorGUI.indentLevel--;
}
using(var scope = new EditorGUI.ChangeCheckScope())
{
EditorGUILayout.PropertyField(m_UseForBaking);
if(scope.changed)
{
(target as SkySettings).OnValidate();
}
}
}
}
}