using UnityEngine.Experimental.Rendering ;
using UnityEngine.Experimental.Rendering.HDPipeline ;
namespace UnityEditor
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
[LightingExplorerExtensionAttribute(typeof(HDRenderPipelineAsset))]
public class HDLightExplorerExtension : DefaultLightingExplorerExtension
var lights = UnityEngine . Object . FindObjectsOfType < Light > ( ) ;
foreach ( Light light in lights )
{
var prefabRoot =
lightDataPairing [ light ] = new LightData ( light . GetComponent < HDAdditionalLightData > ( ) , light . GetComponent < AdditionalShadowData > ( ) ,
PrefabUtility . GetCorrespondingObjectFromSource ( light ) = = null ? false : true , PrefabUtility . GetCorrespondingObjectFromSource ( PrefabUtility . FindPrefabRoot ( light . gameObject ) ) ) ;
if ( PrefabUtility . GetCorrespondingObjectFromSource ( light ) ! = null ) // We have a prefab
{
lightDataPairing [ light ] = new LightData ( light . GetComponent < HDAdditionalLightData > ( ) , light . GetComponent < AdditionalShadowData > ( ) ,
true , PrefabUtility . GetCorrespondingObjectFromSource ( PrefabUtility . GetOutermostPrefabInstanceRoot ( light . gameObject ) ) ) ;
}
else
{
lightDataPairing [ light ] = new LightData ( light . GetComponent < HDAdditionalLightData > ( ) , light . GetComponent < AdditionalShadowData > ( ) , false , null ) ;
}
}
return lights ;
}
var reflectionProbes = Object . FindObjectsOfType < ReflectionProbe > ( ) ;
{
foreach ( ReflectionProbe probe in reflectionProbes )
foreach ( ReflectionProbe probe in reflectionProbes )
{
reflectionProbeDataPairing [ probe ] = probe . GetComponent < HDAdditionalReflectionData > ( ) ;
}
new LightingExplorerTableColumn ( LightingExplorerTableColumn . DataType . Color , HDStyles . Color , "m_Color" , 6 0 ) , // 6: Color
new LightingExplorerTableColumn ( LightingExplorerTableColumn . DataType . Float , HDStyles . ColorTemperature , "m_ColorTemperature" , 1 0 0 , ( r , prop , dep ) = > // 7: Color Temperature
{
if ( prop . serializedObject . FindProperty ( "m_UseColorTemperature" ) . boolValue )
if ( prop . serializedObject . FindProperty ( "m_UseColorTemperature" ) . boolValue )
{
prop = prop . serializedObject . FindProperty ( "m_ColorTemperature" ) ;
prop . floatValue = EditorGUI . FloatField ( r , prop . floatValue ) ;
bool affectSpecular = lightDataPairing [ light ] . hdAdditionalLightData . affectSpecular ;
EditorGUI . BeginChangeCheck ( ) ;
affectSpecular = EditorGUI . Toggle ( r , affectSpecular ) ;
if ( EditorGUI . EndChangeCheck ( ) )
if ( EditorGUI . EndChangeCheck ( ) )
{
lightDataPairing [ light ] . hdAdditionalLightData . affectSpecular = affectSpecular ;
}
Light light = prop . serializedObject . targetObject as Light ;
bool isPrefab = lightDataPairing [ light ] . isPrefab ;
if ( isPrefab )
if ( isPrefab )
{
}
} ) ,
} ;
new LightingExplorerTableColumn ( LightingExplorerTableColumn . DataType . Float , HDStyles . Priority , "priority" , 6 0 ) , // 3: Priority
new LightingExplorerTableColumn ( LightingExplorerTableColumn . DataType . Custom , HDStyles . VolumeProfile , "sharedProfile" , 1 0 0 , ( r , prop , dep ) = > // 4: Profile
{
if ( prop . objectReferenceValue ! = null )
if ( prop . objectReferenceValue ! = null )
EditorGUI . PropertyField ( r , prop , GUIContent . none ) ;
} ) ,
new LightingExplorerTableColumn ( LightingExplorerTableColumn . DataType . Checkbox , HDStyles . HasVisualEnvironment , "sharedProfile" , 1 0 0 , ( r , prop , dep ) = > // 5: Has Visual environment
new LightingExplorerTableColumn ( LightingExplorerTableColumn . DataType . Custom , HDStyles . SkyType , "sharedProfile" , 1 0 0 , ( r , prop , dep ) = > // 6: Sky type
{
Volume volume = prop . serializedObject . targetObject as Volume ;
if ( volumeDataPairing [ volume ] . hasVisualEnvironment )
if ( volumeDataPairing [ volume ] . hasVisualEnvironment )
{
SkyType skyType = volumeDataPairing [ volume ] . skyType ;
EditorGUI . BeginDisabledGroup ( true ) ;
new LightingExplorerTableColumn ( LightingExplorerTableColumn . DataType . Custom , HDStyles . FogType , "sharedProfile" , 1 0 0 , ( r , prop , dep ) = > // 7: Fog type
{
Volume volume = prop . serializedObject . targetObject as Volume ;
if ( volumeDataPairing [ volume ] . hasVisualEnvironment )
if ( volumeDataPairing [ volume ] . hasVisualEnvironment )
{
FogType fogType = volumeDataPairing [ volume ] . fogType ;
EditorGUI . BeginDisabledGroup ( true ) ;