Browse Source

Updated packages to those from Unity 6000.2.7f2

master
Nico de Poel 4 months ago
parent
commit
05226ecdcf
  1. 26
      Packages/com.unity.render-pipelines.core/Editor/MaterialUpgrader.cs
  2. 4
      Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs
  3. 2
      Packages/com.unity.render-pipelines.core/package.json
  4. 4
      Packages/com.unity.shadergraph/Editor/Data/Nodes/UV/ParallaxOcclusionMappingNode.cs
  5. 2
      Packages/com.unity.shadergraph/package.json
  6. 97
      Packages/com.unity.ugui/Editor/TMP/TMP_BaseEditorPanel.cs
  7. 18
      Packages/com.unity.ugui/Runtime/UGUI/UI/Core/Slider.cs
  8. 2
      Packages/com.unity.ugui/package.json
  9. 14
      Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs
  10. 2
      Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs
  11. 2
      Packages/com.unity.visualeffectgraph/package.json

26
Packages/com.unity.render-pipelines.core/Editor/MaterialUpgrader.cs

@ -74,6 +74,7 @@ namespace UnityEditor.Rendering
public float setVal, unsetVal; public float setVal, unsetVal;
} }
List<KeywordFloatRename> m_KeywordFloatRename = new List<KeywordFloatRename>(); List<KeywordFloatRename> m_KeywordFloatRename = new List<KeywordFloatRename>();
Dictionary<string, (string, System.Func<float, bool>)> m_ConditionalFloatRename;
/// <summary> /// <summary>
/// Type of property to rename. /// Type of property to rename.
@ -222,6 +223,20 @@ namespace UnityEditor.Rendering
dstMaterial.SetFloat(t.property, srcMaterial.IsKeywordEnabled(t.keyword) ? t.setVal : t.unsetVal); dstMaterial.SetFloat(t.property, srcMaterial.IsKeywordEnabled(t.keyword) ? t.setVal : t.unsetVal);
} }
// Handle conditional float renaming
if (m_ConditionalFloatRename != null)
{
foreach (var (oldName, (newName, condition)) in m_ConditionalFloatRename)
{
if (srcMaterial.HasProperty(oldName) &&
condition(srcMaterial.GetFloat(oldName)) &&
dstMaterial.HasProperty(newName))
{
dstMaterial.SetFloat(newName, 1.0f);
}
}
}
} }
/// <summary> /// <summary>
@ -318,6 +333,17 @@ namespace UnityEditor.Rendering
m_KeywordFloatRename.Add(new KeywordFloatRename { keyword = oldName, property = newName, setVal = setVal, unsetVal = unsetVal }); m_KeywordFloatRename.Add(new KeywordFloatRename { keyword = oldName, property = newName, setVal = setVal, unsetVal = unsetVal });
} }
/// <summary>
/// Rename a float property conditionally based on its value
/// </summary>
/// <param name="oldName">Old property name</param>
/// <param name="newName">New property name</param>
/// <param name="condition">Condition function that takes the float value and returns true if renaming should occur</param>
protected void RenameFloat(string oldName, string newName, System.Func<float, bool> condition)
{
(m_ConditionalFloatRename ??= new Dictionary<string, (string, System.Func<float, bool>)>())[oldName] = (newName, condition);
}
static MaterialUpgrader GetUpgrader(List<MaterialUpgrader> upgraders, Material material) static MaterialUpgrader GetUpgrader(List<MaterialUpgrader> upgraders, Material material)
{ {
if (material == null || material.shader == null) if (material == null || material.shader == null)

4
Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs

@ -85,7 +85,9 @@ namespace UnityEngine.Rendering
/// <param name="value">Input value.</param> /// <param name="value">Input value.</param>
public virtual void SetValue(T value) public virtual void SetValue(T value)
{ {
Assert.IsNotNull(setter);
if (setter == null)
return;
var v = ValidateValue(value); var v = ValidateValue(value);
if (v == null || !v.Equals(getter())) if (v == null || !v.Equals(getter()))

2
Packages/com.unity.render-pipelines.core/package.json

@ -14,5 +14,5 @@
"com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0",
"com.unity.rendering.light-transport": "1.0.1" "com.unity.rendering.light-transport": "1.0.1"
}, },
"_fingerprint": "317e801bb3aaa64596e4ec903cb788a0dfb07788"
"_fingerprint": "67f868dbad82414b67a47161bdeffad5498e1cc0"
} }

4
Packages/com.unity.shadergraph/Editor/Data/Nodes/UV/ParallaxOcclusionMappingNode.cs

@ -10,7 +10,7 @@ namespace UnityEditor.ShaderGraph
[Title("UV", "Parallax Occlusion Mapping")] [Title("UV", "Parallax Occlusion Mapping")]
[FormerName("UnityEditor.Experimental.Rendering.HDPipeline.ParallaxOcclusionMappingNode")] [FormerName("UnityEditor.Experimental.Rendering.HDPipeline.ParallaxOcclusionMappingNode")]
[FormerName("UnityEditor.Rendering.HighDefinition.ParallaxOcclusionMappingNode")] [FormerName("UnityEditor.Rendering.HighDefinition.ParallaxOcclusionMappingNode")]
class ParallaxOcclusionMappingNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireViewDirection, IMayRequireMeshUV
class ParallaxOcclusionMappingNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireViewDirection, IMayRequireMeshUV, IMayRequireTransform
{ {
public ParallaxOcclusionMappingNode() public ParallaxOcclusionMappingNode()
{ {
@ -220,6 +220,8 @@ $precision {GetVariableNameForSlot(kPixelDepthOffsetOutputSlotId)} = ({tmpMaxHei
"); ");
} }
public NeededTransform[] RequiresTransform(ShaderStageCapability stageCapability = ShaderStageCapability.All) => new[] { NeededTransform.WorldToObject };
public NeededCoordinateSpace RequiresViewDirection(ShaderStageCapability stageCapability = ShaderStageCapability.All) public NeededCoordinateSpace RequiresViewDirection(ShaderStageCapability stageCapability = ShaderStageCapability.All)
{ {
return NeededCoordinateSpace.Tangent; return NeededCoordinateSpace.Tangent;

2
Packages/com.unity.shadergraph/package.json

@ -48,5 +48,5 @@
"path": "Samples~/CustomMaterialPropertyDrawers" "path": "Samples~/CustomMaterialPropertyDrawers"
} }
], ],
"_fingerprint": "5516e0d9751810ec70d19bca7a5251cbecd2b5ca"
"_fingerprint": "41211273cdd1ec56cc330555ecc5be38b9ea2055"
} }

97
Packages/com.unity.ugui/Editor/TMP/TMP_BaseEditorPanel.cs

@ -73,6 +73,7 @@ namespace TMPro.EditorUtilities
static readonly GUIContent k_TopLabel = new GUIContent("Top"); static readonly GUIContent k_TopLabel = new GUIContent("Top");
static readonly GUIContent k_RightLabel = new GUIContent("Right"); static readonly GUIContent k_RightLabel = new GUIContent("Right");
static readonly GUIContent k_BottomLabel = new GUIContent("Bottom"); static readonly GUIContent k_BottomLabel = new GUIContent("Bottom");
static readonly GUIContent[] k_MarginLabels = { k_LeftLabel, k_TopLabel, k_RightLabel, k_BottomLabel };
protected static readonly GUIContent k_ExtraSettingsLabel = new GUIContent("Extra Settings"); protected static readonly GUIContent k_ExtraSettingsLabel = new GUIContent("Extra Settings");
protected static string[] k_UiStateLabel = new string[] { "<i>(Click to collapse)</i> ", "<i>(Click to expand)</i> " }; protected static string[] k_UiStateLabel = new string[] { "<i>(Click to collapse)</i> ", "<i>(Click to expand)</i> " };
@ -80,6 +81,8 @@ namespace TMPro.EditorUtilities
static Dictionary<int, TMP_Style> k_AvailableStyles = new Dictionary<int, TMP_Style>(); static Dictionary<int, TMP_Style> k_AvailableStyles = new Dictionary<int, TMP_Style>();
protected Dictionary<int, int> m_TextStyleIndexLookup = new Dictionary<int, int>(); protected Dictionary<int, int> m_TextStyleIndexLookup = new Dictionary<int, int>();
const float kPaddingBetweenMarginFields = 5f;
protected struct Foldout protected struct Foldout
{ {
// Track Inspector foldout panel states, globally. // Track Inspector foldout panel states, globally.
@ -1126,25 +1129,7 @@ namespace TMPro.EditorUtilities
protected void DrawMargins() protected void DrawMargins()
{ {
EditorGUI.BeginChangeCheck();
DrawMarginProperty(m_MarginProp, k_MarginsLabel); DrawMarginProperty(m_MarginProp, k_MarginsLabel);
if (EditorGUI.EndChangeCheck())
{
// Value range check on margins to make sure they are not excessive.
Vector4 margins = m_MarginProp.vector4Value;
Rect textContainerSize = m_RectTransform.rect;
margins.x = Mathf.Clamp(margins.x, -textContainerSize.width, textContainerSize.width);
margins.z = Mathf.Clamp(margins.z, -textContainerSize.width, textContainerSize.width);
margins.y = Mathf.Clamp(margins.y, -textContainerSize.height, textContainerSize.height);
margins.w = Mathf.Clamp(margins.w, -textContainerSize.height, textContainerSize.height);
m_MarginProp.vector4Value = margins;
m_HavePropertiesChanged = true;
}
EditorGUILayout.Space(); EditorGUILayout.Space();
} }
@ -1410,49 +1395,70 @@ namespace TMPro.EditorUtilities
// DRAW MARGIN PROPERTY // DRAW MARGIN PROPERTY
protected void DrawMarginProperty(SerializedProperty property, GUIContent label) protected void DrawMarginProperty(SerializedProperty property, GUIContent label)
{ {
Rect rect = EditorGUILayout.GetControlRect(false, 2 * 18);
EditorGUI.BeginProperty(rect, label, property);
Rect rect = EditorGUILayout.GetControlRect(false, 2 * EditorGUIUtility.singleLineHeight);
rect.y += 2;
Rect pos0 = new Rect(rect.x, rect.y + 2, rect.width - 15, 18);
float width = rect.width + 3;
Rect pos0 = rect;
pos0.width = EditorGUIUtility.labelWidth; pos0.width = EditorGUIUtility.labelWidth;
EditorGUI.PrefixLabel(pos0, label);
Vector4 margins = property.vector4Value;
float widthB = width - EditorGUIUtility.labelWidth;
float fieldWidth = widthB / 4;
pos0.width = Mathf.Max(fieldWidth - 5, 45f);
// BeginProperty ensures that the property works correctly with prefabs
EditorGUI.BeginProperty(pos0, label, property);
// Labels
pos0.x = EditorGUIUtility.labelWidth + 15;
margins.x = DrawMarginField(pos0, "Left", margins.x);
int controlId = GUIUtility.GetControlID(FocusType.Keyboard, pos0);
pos0 = EditorGUI.PrefixLabel(pos0, controlId, label);
pos0.x += fieldWidth;
margins.y = DrawMarginField(pos0, "Top", margins.y);
pos0.x += fieldWidth;
margins.z = DrawMarginField(pos0, "Right", margins.z);
float width = rect.xMax + kPaddingBetweenMarginFields - pos0.xMin;
float fieldWidth = width / 4f;
pos0.width = Mathf.Max(fieldWidth - kPaddingBetweenMarginFields, 45f);
// Draw each margin component by iterating the serialized sub-properties
var subProperty = property.Copy();
for (int i = 0; i < 4; i++)
{
// The first Next() needs to enter the children
subProperty.Next(i == 0);
// The X (i==0) and Z (i==2) components are horizontal
var axis = i % 2 == 0 ? RectTransform.Axis.Horizontal : RectTransform.Axis.Vertical;
DrawMarginField(pos0, k_MarginLabels[i], subProperty, axis);
pos0.x += fieldWidth; pos0.x += fieldWidth;
margins.w = DrawMarginField(pos0, "Bottom", margins.w);
property.vector4Value = margins;
}
EditorGUI.EndProperty(); EditorGUI.EndProperty();
} }
float DrawMarginField(Rect position, string label, float value)
bool DrawMarginField(Rect position, GUIContent label, SerializedProperty prop, RectTransform.Axis axis)
{ {
// BeginProperty ensures that each margin field works correctly with prefabs
EditorGUI.BeginProperty(position, label, prop);
int controlId = GUIUtility.GetControlID(FocusType.Keyboard, position); int controlId = GUIUtility.GetControlID(FocusType.Keyboard, position);
EditorGUI.PrefixLabel(position, controlId, new GUIContent(label));
position.yMax -= EditorGUIUtility.singleLineHeight;
EditorGUI.PrefixLabel(position, controlId, label);
Rect dragZone = new Rect(position.x, position.y, position.width, position.height);
Rect dragZone = position;
position.y += EditorGUIUtility.singleLineHeight; position.y += EditorGUIUtility.singleLineHeight;
return EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, position, dragZone, controlId, value, EditorGUI.kFloatFieldFormatString, EditorStyles.numberField, true);
EditorGUI.BeginChangeCheck();
// Do not update the property value directly. Cache the new
// value and update the property if there was a change.
var newValue = EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, position, dragZone, controlId, prop.floatValue, EditorGUI.kFloatFieldFormatString, EditorStyles.numberField, true);
bool hasChanged = EditorGUI.EndChangeCheck();
if (hasChanged)
{
// Loop through all selected objects and calculate their minimum width/height.
float size = float.MaxValue;
foreach (TMP_Text target in serializedObject.targetObjects)
{
var rect = target.rectTransform.rect;
size = Mathf.Min(size, axis == RectTransform.Axis.Horizontal ? rect.width : rect.height);
}
// Clamp the new value to be within the size.
prop.floatValue = Mathf.Clamp(newValue, -size, size);
m_HavePropertiesChanged = true;
}
EditorGUI.EndProperty();
return hasChanged;
} }
protected void DrawPropertySlider(GUIContent label, SerializedProperty property) protected void DrawPropertySlider(GUIContent label, SerializedProperty property)
@ -1467,6 +1473,5 @@ namespace TMPro.EditorUtilities
// Special Handling of Undo / Redo Events. // Special Handling of Undo / Redo Events.
protected abstract void OnUndoRedo(); protected abstract void OnUndoRedo();
} }
} }

18
Packages/com.unity.ugui/Runtime/UGUI/UI/Core/Slider.cs

@ -2,6 +2,10 @@ using System;
using UnityEngine.Events; using UnityEngine.Events;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngine.UI namespace UnityEngine.UI
{ {
[AddComponentMenu("UI/Slider", 34)] [AddComponentMenu("UI/Slider", 34)]
@ -428,10 +432,17 @@ namespace UnityEngine.UI
Set(m_Value, false); Set(m_Value, false);
// Update rects since they need to be initialized correctly. // Update rects since they need to be initialized correctly.
UpdateVisuals(); UpdateVisuals();
#if UNITY_EDITOR
Undo.undoRedoEvent -= OnUndoRedoEvent;
Undo.undoRedoEvent += OnUndoRedoEvent;
#endif
} }
protected override void OnDisable() protected override void OnDisable()
{ {
#if UNITY_EDITOR
Undo.undoRedoEvent -= OnUndoRedoEvent;
#endif
m_Tracker.Clear(); m_Tracker.Clear();
base.OnDisable(); base.OnDisable();
} }
@ -553,6 +564,13 @@ namespace UnityEngine.UI
UpdateVisuals(); UpdateVisuals();
} }
#if UNITY_EDITOR
void OnUndoRedoEvent(in UndoRedoInfo undo)
{
UpdateVisuals();
}
#endif
enum Axis enum Axis
{ {
Horizontal = 0, Horizontal = 0,

2
Packages/com.unity.ugui/package.json

@ -19,5 +19,5 @@
"com.unity.modules.ui": "1.0.0", "com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0" "com.unity.modules.imgui": "1.0.0"
}, },
"_fingerprint": "e375ff18e90f823f9c3d4ffbc1532d6cde85ed48"
"_fingerprint": "f250afc9b68ddb0d3ebf8e3274ec22b51a03153c"
} }

14
Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs

@ -7,7 +7,7 @@ namespace UnityEditor.VFX.UI
{ {
class VFXEnumValuePopup : VisualElement, INotifyValueChanged<long> class VFXEnumValuePopup : VisualElement, INotifyValueChanged<long>
{ {
DropdownField m_DropDownButton;
readonly DropdownField m_DropDownButton;
long m_Value; long m_Value;
public IEnumerable<string> choices => m_DropDownButton.choices; public IEnumerable<string> choices => m_DropDownButton.choices;
@ -32,26 +32,20 @@ namespace UnityEditor.VFX.UI
set => SetValueAndNotify(value); set => SetValueAndNotify(value);
} }
public void SetValueAndNotify(long newValue)
private void SetValueAndNotify(long newValue)
{ {
if (!EqualityComparer<long>.Default.Equals(value, newValue)) if (!EqualityComparer<long>.Default.Equals(value, newValue))
{ {
using (ChangeEvent<long> evt = ChangeEvent<long>.GetPooled(value, newValue))
{
using var evt = ChangeEvent<long>.GetPooled(value, newValue);
evt.target = this; evt.target = this;
SetValueWithoutNotify(newValue); SetValueWithoutNotify(newValue);
m_DropDownButton.value = m_DropDownButton.choices[(int)m_Value];
SendEvent(evt); SendEvent(evt);
} }
} }
}
public void SetValueWithoutNotify(long newValue) public void SetValueWithoutNotify(long newValue)
{ {
if (newValue >= 0 && newValue < m_DropDownButton.choices.Count)
{
m_Value = newValue;
}
m_Value = Math.Clamp(newValue, 0, m_DropDownButton.choices.Count - 1); m_Value = Math.Clamp(newValue, 0, m_DropDownButton.choices.Count - 1);
} }
} }

2
Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs

@ -624,7 +624,7 @@ namespace UnityEditor.VFX.UI
if (m_Field is IVFXNotifyValueChanged<U> vfxNotifyValueChanged) if (m_Field is IVFXNotifyValueChanged<U> vfxNotifyValueChanged)
vfxNotifyValueChanged.SetValueWithoutNotify(value, force); vfxNotifyValueChanged.SetValueWithoutNotify(value, force);
else else
m_Field.SetValueWithoutNotify(value);
m_Field.value = value;
} }
catch (System.Exception ex) catch (System.Exception ex)
{ {

2
Packages/com.unity.visualeffectgraph/package.json

@ -36,5 +36,5 @@
] ]
} }
], ],
"_fingerprint": "6d3d05586bc2aab621743074b2ce44852b579423"
"_fingerprint": "7835942a56c9513d672c10fa1c3a99a2c633fc98"
} }
Loading…
Cancel
Save