This commit is contained in:
2024-09-20 20:30:10 +02:00
commit 4fabf1a6fd
29169 changed files with 1706941 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
namespace UnityEditor.Rendering
{
/// <summary>
/// Public interface for handling a serialized object of <see cref="UnityEngine.Rendering.RenderPipelineGlobalSettings"/>
/// </summary>
public interface ISerializedRenderPipelineGlobalSettings
{
/// <summary>
/// The <see cref="SerializedObject"/>
/// </summary>
SerializedObject serializedObject { get; }
/// <summary>
/// The shader variant log level
/// </summary>
SerializedProperty shaderVariantLogLevel { get; }
/// <summary>
/// If the shader variants needs to be exported
/// </summary>
SerializedProperty exportShaderVariants { get; }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a90e1993a79bd624cac14b0b5ec32dff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
namespace UnityEditor.Rendering
{
/// <summary>
/// UI for global settings
/// </summary>
public static partial class RenderPipelineGlobalSettingsUI
{
/// <summary>
/// Draws the shader stripping settinsg
/// </summary>
/// <param name="serialized">The serialized global settings</param>
/// <param name="owner">The owner editor</param>
/// <param name="additionalShaderStrippingSettings">Pass another drawer if you want to specify additional shader stripping settings</param>
public static void DrawShaderStrippingSettings(ISerializedRenderPipelineGlobalSettings serialized, Editor owner, CoreEditorDrawer<ISerializedRenderPipelineGlobalSettings>.IDrawer additionalShaderStrippingSettings = null)
{
CoreEditorUtils.DrawSectionHeader(Styles.shaderStrippingSettingsLabel);
var oldWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = Styles.labelWidth;
EditorGUILayout.Space();
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(serialized.shaderVariantLogLevel, Styles.shaderVariantLogLevelLabel);
EditorGUILayout.PropertyField(serialized.exportShaderVariants, Styles.exportShaderVariantsLabel);
additionalShaderStrippingSettings?.Draw(serialized, owner);
}
EditorGUILayout.Space();
EditorGUIUtility.labelWidth = oldWidth;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 13200d6984455cf478e685057a79751a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
using UnityEngine;
namespace UnityEditor.Rendering
{
/// <summary>
/// UI for global settings
/// </summary>
public static partial class RenderPipelineGlobalSettingsUI
{
/// <summary>A collection of GUIContent for use in the inspector</summary>
public static class Styles
{
/// <summary>
/// Global label width
/// </summary>
public const int labelWidth = 220;
/// <summary>
/// Shader Stripping
/// </summary>
public static readonly GUIContent shaderStrippingSettingsLabel = EditorGUIUtility.TrTextContent("Shader Stripping", "Shader Stripping settings");
/// <summary>
/// Shader Variant Log Level
/// </summary>
public static readonly GUIContent shaderVariantLogLevelLabel = EditorGUIUtility.TrTextContent("Shader Variant Log Level", "Controls the level of logging of shader variant information outputted during the build process. Information appears in the Unity Console when the build finishes.");
/// <summary>
/// Export Shader Variants
/// </summary>
public static readonly GUIContent exportShaderVariantsLabel = EditorGUIUtility.TrTextContent("Export Shader Variants", "Controls whether to output shader variant information to a file.");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3559e2d167158374f8e379f4c2ec24e7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
using UnityEditor;
namespace UnityEngine.Rendering
{
[CustomEditor(typeof(RenderPipelineResources), editorForChildClasses: true)]
class RenderPipelineResourcesEditor : Editor
{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
// Add a "Reload All" button in inspector when we are in developer's mode
if (EditorPrefs.GetBool("DeveloperMode")
&& GUILayout.Button("Reload All"))
{
foreach (RenderPipelineResources t in targets)
{
if (string.IsNullOrEmpty(t.packagePath_Internal))
{
Debug.LogError($"packagePath is not set in {t.GetType().Name}. We will not be able to reload it. Skipping.");
continue;
}
foreach (var field in t.GetType().GetFields())
field.SetValue(t, null);
ResourceReloader.ReloadAllNullIn(t, t.packagePath_Internal);
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f5ff1027825046c46884c3ad73d26610
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: