Skip to content

Commit

Permalink
Merge pull request #8073 from Unity-Technologies/internal/master
Browse files Browse the repository at this point in the history
Internal/master
  • Loading branch information
UnityAljosha authored May 21, 2024
2 parents 3dba009 + afa89a7 commit eb76807
Show file tree
Hide file tree
Showing 654 changed files with 34,884 additions and 9,112 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ public class StandardRenderRequest : MonoBehaviour
}
```

## Other useful information

- On [Universal Render Pipeline (URP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest/User-Render-Requests.html).

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Advanced Properties

Unity Render Pipelines components expose standard properties by default that are suitable for most use-cases.
However, there are components and Volume Overrides that include **advanced properties** which you can use to fine-tune the behavior of the component.

There is a global state per user that stores if Unity displays **advanced properties** or not.

## Exposing advanced properties within the inspector

Not every component or Volume Override includes advanced properties.
If one does, it has a contextual menu to the right of each property section header that includes additional properties. To expose advanced properties for that section, open the contextual menu and click **Advanced Properties**.

For an example, see the **Water Surface** component in [High Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest).

By default only standard properties are shown.

![](Images/Preferences/HDRP_WaterSurface_General.png)

When you select **Advanced Properties**:

![](Images/Preferences/PopUpAdvanced.png)

**Advanced Properties** become visible:

![](Images/Preferences/HDRP_WaterSurface_General_Visible.png)

For Volume Overrides, the already existing contextual menu has a **Advanced Properties** toggle as well.

## Exposing advanced properties on preferences

You can also access to this global preference by:

1. Open the **Graphics** tab in the **Preferences** window (menu: **Edit > Preferences > Graphics**).
2. Under **Properties**. Set **Advanced Properties** to **All Visible**.

![](Images/Preferences/AdvancedProperties_Settings.png)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,12 @@ void IDrawer.Draw(TData data, Editor owner)
if (m_Enabler != null && !m_Enabler(data, owner))
return;

if (m_Anim != null)
CoreEditorUtils.BeginAdditionalPropertiesHighlight(m_Anim);

for (var i = 0; i < m_ActionDrawers.Length; i++)
m_ActionDrawers[i](data, owner);

if (m_Anim != null)
if (AdvancedProperties.BeginGroup(m_Anim))
{
CoreEditorUtils.EndAdditionalPropertiesHighlight();

// While the highlight is being changed, force the Repaint of the editor
if (m_Anim.value > 0.0f)
owner?.Repaint();
for (var i = 0; i < m_ActionDrawers.Length; i++)
m_ActionDrawers[i](data, owner);
}
AdvancedProperties.EndGroup();
}

bool IDrawer.Expand(int mask) => DefaultExpand(m_ActionDrawers, mask);
Expand Down Expand Up @@ -888,6 +880,7 @@ public static IDrawer AdditionalPropertiesFoldoutGroup<TEnum, TAPEnum>(GUIConten
where TEnum : struct, IConvertible
where TAPEnum : struct, IConvertible
{
additionalContent ??= Group((s, o) => { });
return AdditionalPropertiesFoldoutGroup(foldoutTitle, foldoutMask, foldoutState, additionalPropertiesMask, additionalPropertiesState, normalContent.Draw, additionalContent.Draw, options, customMenuContextAction, otherDocumentation);
}

Expand Down Expand Up @@ -972,7 +965,10 @@ void SwitchEnabler(TData data, Editor owner)

return FoldoutGroup(foldoutTitle, foldoutMask, foldoutState, options, customMenuContextAction, Enabler, SwitchEnabler,
otherDocumentation, normalContent,
ConditionalWithAdditionalProperties((serialized, owner) => additionalPropertiesState[additionalPropertiesMask] && foldoutState[foldoutMask], additionalPropertiesState.GetAnimation(additionalPropertiesMask), additionalContent).Draw
ConditionalWithAdditionalProperties(
(serialized, owner) => additionalPropertiesState[additionalPropertiesMask] && foldoutState[foldoutMask],
AdvancedProperties.s_AnimFloat,
additionalContent).Draw
);
}
}
Expand Down
23 changes: 2 additions & 21 deletions Packages/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -822,14 +822,14 @@ static Action<Vector2> CreateMenuContextAction(Action<Vector2> contextAction, Fu
{
if (contextAction == null && (hasMoreOptions != null || customMenuContextAction != null))
{
// If no contextual menu add one for the additional properties.
// If no contextual menu add one for the advanced properties.
contextAction = pos =>
{
var menu = new GenericMenu();
if (customMenuContextAction != null)
customMenuContextAction(menu);
if (hasMoreOptions != null)
AddAdditionalPropertiesContext(menu, hasMoreOptions, toggleMoreOptions);
menu.AddAdvancedPropertiesBoolMenuItem(hasMoreOptions, toggleMoreOptions);
menu.DropDown(new Rect(pos, Vector2.zero));
};
}
Expand Down Expand Up @@ -877,12 +877,6 @@ static void ShowHelpButton(Rect contextMenuRect, string documentationURL, GUICon
Help.BrowseURL(documentationURL);
}

static void AddAdditionalPropertiesContext(GenericMenu menu, Func<bool> hasMoreOptions, Action toggleMoreOptions)
{
menu.AddItem(EditorGUIUtility.TrTextContent("Show Additional Properties"), hasMoreOptions.Invoke(), () => toggleMoreOptions.Invoke());
menu.AddItem(EditorGUIUtility.TrTextContent("Show All Additional Properties..."), false, () => CoreRenderPipelinePreferences.Open());
}

/// <summary>
/// Draw a Color Field but convert the color to gamma space before displaying it in the shader.
/// Using SetColor on a material does the conversion, but setting the color as vector3 in a constant buffer doesn't
Expand Down Expand Up @@ -1387,19 +1381,6 @@ internal static void TryToFixFilterMode(float pixelsPerPoint, Texture2D icon)

#endregion

internal static void BeginAdditionalPropertiesHighlight(AnimFloat animation)
{
var oldColor = GUI.color;
GUI.color = Color.Lerp(CoreEditorStyles.backgroundColor * oldColor, CoreEditorStyles.backgroundHighlightColor, animation.value);
EditorGUILayout.BeginVertical(CoreEditorStyles.additionalPropertiesHighlightStyle);
GUI.color = oldColor;
}

internal static void EndAdditionalPropertiesHighlight()
{
EditorGUILayout.EndVertical();
}

internal static T CreateAssetAt<T>(Scene scene, string targetName) where T : ScriptableObject
{
string path;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine.Rendering;

namespace UnityEditor.Rendering
{
Expand All @@ -12,7 +13,7 @@ public static class CoreRenderPipelinePreferences
/// <summary>
/// Path to the Render Pipeline Preferences
/// </summary>
public static readonly string corePreferencePath = "Preferences/Core Render Pipeline";
public static readonly string corePreferencePath = "Preferences/Graphics";

private static readonly List<ICoreRenderPipelinePreferencesProvider> s_Providers = new();

Expand All @@ -25,6 +26,14 @@ static void InitPreferenceProviders()
continue;
s_Providers.Add(Activator.CreateInstance(provider) as ICoreRenderPipelinePreferencesProvider);
}

s_Providers.Sort((x, y) => GetDisplayInfoOrder(x.GetType()).CompareTo(GetDisplayInfoOrder(y.GetType())));
}

static int GetDisplayInfoOrder(Type type)
{
var attribute = type.GetCustomAttribute<DisplayInfoAttribute>();
return attribute?.order ?? int.MaxValue;
}

[SettingsProvider]
Expand All @@ -38,8 +47,11 @@ static SettingsProvider PreferenceGUI()
{
foreach (var providers in s_Providers)
{
EditorGUILayout.LabelField(providers.header, EditorStyles.boldLabel);
providers.PreferenceGUI();
if (providers.header != null)
{
EditorGUILayout.LabelField(providers.header, EditorStyles.boldLabel);
providers.PreferenceGUI();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@ sealed class DebugWindowSettings : ScriptableObject
// Keep these settings in a separate scriptable object so we can handle undo/redo on them
// without the rest of the debug window interfering
public int currentStateHash;
public int selectedPanel;

public int selectedPanel
{
get => Mathf.Max(0, DebugManager.instance.PanelIndex(selectedPanelDisplayName));
set
{
var displayName = DebugManager.instance.PanelDiplayName(value);
if (!string.IsNullOrEmpty(displayName))
selectedPanelDisplayName = displayName;
}
}

public string selectedPanelDisplayName;

void OnEnable()
{
Expand Down
9 changes: 9 additions & 0 deletions Packages/com.unity.render-pipelines.core/Editor/Deprecated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@

namespace UnityEditor.Rendering
{
/// <summary>
/// Callback method that will be called when the Global Preferences for Additional Properties is changed
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
[Obsolete("This attribute is not handled anymore. Use Advanced Properties. #from(6000.0)", false)]
public sealed class SetAdditionalPropertiesVisibilityAttribute : Attribute
{
}

/// <summary>
/// This attributes tells a <see cref="VolumeComponentEditor"/> class which type of
/// <see cref="VolumeComponent"/> it's an editor for.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ public T value

/// <summary>The raw value</summary>
public uint rawValue
{ get => (uint)EditorPrefs.GetInt(m_Key); set => EditorPrefs.SetInt(m_Key, (int)value); }
{
get => (uint)EditorPrefs.GetInt(m_Key);
set => EditorPrefs.SetInt(m_Key, (int)value);
}

/// <summary>Constructor</summary>
/// <param name="key">Name of the Key in EditorPrefs to save the value</param>
public EditorPrefBoolFlags(string key) => m_Key = key;
public EditorPrefBoolFlags(string key)
{
m_Key = key;
}

/// <summary>Test if saved value is equal to the one given</summary>
/// <param name="other">Given value</param>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.Rendering;

namespace UnityEditor.Rendering
{
Expand All @@ -16,7 +18,15 @@ public interface ICoreRenderPipelinePreferencesProvider
/// <summary>
/// The header of the panel
/// </summary>
GUIContent header { get; }
GUIContent header
{
get
{
var type = GetType();
var displayTypeInfoAttribute = type.GetCustomAttribute<DisplayInfoAttribute>();
return EditorGUIUtility.TrTextContent(displayTypeInfoAttribute != null ? displayTypeInfoAttribute.name : type.Name);
}
}

/// <summary>
/// Renders the Preferences UI for this provider
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eb76807

Please sign in to comment.