123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using UnityEngine;
- using UnityEngine.Rendering;
- using UnityEngine.Rendering.Universal;
- using UnityEngine.Scripting.APIUpdating;
- namespace UnityEditor.Rendering.Universal
- {
- [CustomEditor(typeof(ForwardRendererData), true)]
- [MovedFrom("UnityEditor.Rendering.LWRP")] public class ForwardRendererDataEditor : ScriptableRendererDataEditor
- {
- private static class Styles
- {
- public static readonly GUIContent RendererTitle = new GUIContent("Forward Renderer", "Custom Forward Renderer for Universal RP.");
- public static readonly GUIContent FilteringLabel = new GUIContent("Filtering", "Controls filter rendering settings for this renderer.");
- public static readonly GUIContent OpaqueMask = new GUIContent("Opaque Layer Mask", "Controls which opaque layers this renderer draws.");
- public static readonly GUIContent TransparentMask = new GUIContent("Transparent Layer Mask", "Controls which transparent layers this renderer draws.");
- public static readonly GUIContent defaultStencilStateLabel = EditorGUIUtility.TrTextContent("Default Stencil State", "Configure stencil state for the opaque and transparent render passes.");
- public static readonly GUIContent shadowTransparentReceiveLabel = EditorGUIUtility.TrTextContent("Transparent Receive Shadows", "When disabled, none of the transparent objects will receive shadows.");
- }
- SerializedProperty m_OpaqueLayerMask;
- SerializedProperty m_TransparentLayerMask;
- SerializedProperty m_DefaultStencilState;
- SerializedProperty m_PostProcessData;
- SerializedProperty m_Shaders;
- SerializedProperty m_ShadowTransparentReceiveProp;
- private void OnEnable()
- {
- m_OpaqueLayerMask = serializedObject.FindProperty("m_OpaqueLayerMask");
- m_TransparentLayerMask = serializedObject.FindProperty("m_TransparentLayerMask");
- m_DefaultStencilState = serializedObject.FindProperty("m_DefaultStencilState");
- m_PostProcessData = serializedObject.FindProperty("postProcessData");
- m_Shaders = serializedObject.FindProperty("shaders");
- m_ShadowTransparentReceiveProp = serializedObject.FindProperty("m_ShadowTransparentReceive");
- }
- public override void OnInspectorGUI()
- {
- serializedObject.Update();
- EditorGUILayout.Space();
- EditorGUILayout.LabelField(Styles.RendererTitle, EditorStyles.boldLabel);
- EditorGUI.indentLevel++;
- EditorGUILayout.PropertyField(m_PostProcessData);
- EditorGUI.indentLevel--;
- EditorGUILayout.Space();
- EditorGUILayout.LabelField(Styles.FilteringLabel, EditorStyles.boldLabel);
- EditorGUI.indentLevel++;
- EditorGUILayout.PropertyField(m_OpaqueLayerMask, Styles.OpaqueMask);
- EditorGUILayout.PropertyField(m_TransparentLayerMask, Styles.TransparentMask);
- EditorGUI.indentLevel--;
- EditorGUILayout.Space();
- EditorGUILayout.LabelField("Shadows", EditorStyles.boldLabel);
- EditorGUI.indentLevel++;
- EditorGUILayout.PropertyField(m_ShadowTransparentReceiveProp, Styles.shadowTransparentReceiveLabel);
- EditorGUI.indentLevel--;
- EditorGUILayout.Space();
- EditorGUILayout.LabelField("Overrides", EditorStyles.boldLabel);
- EditorGUI.indentLevel++;
- EditorGUILayout.PropertyField(m_DefaultStencilState, Styles.defaultStencilStateLabel, true);
- EditorGUI.indentLevel--;
- EditorGUILayout.Space();
- serializedObject.ApplyModifiedProperties();
- base.OnInspectorGUI();
-
- if (EditorPrefs.GetBool("DeveloperMode"))
- {
- EditorGUILayout.Space();
- EditorGUILayout.PropertyField(m_Shaders, true);
- if (GUILayout.Button("Reload All"))
- {
- var resources = target as ForwardRendererData;
- resources.shaders = null;
- ResourceReloader.ReloadAllNullIn(target, UniversalRenderPipelineAsset.packagePath);
- }
- }
- }
- }
- }
|