diff --git a/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/GraphDataPropertyDrawer.cs b/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/GraphDataPropertyDrawer.cs index 021c587f054..64eabe68e85 100644 --- a/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/GraphDataPropertyDrawer.cs +++ b/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/GraphDataPropertyDrawer.cs @@ -96,6 +96,7 @@ void RegisterActionToUndo(string actionName) // Create foldout var foldout = new Foldout() { text = targetName, value = foldoutActive, name = "foldout" }; element.Add(foldout); + foldout.AddToClassList("MainFoldout"); foldout.RegisterValueChangedCallback(evt => { // Update foldout value and rebuild diff --git a/com.unity.shadergraph/Editor/Generation/Contexts/TargetPropertyGUIContext.cs b/com.unity.shadergraph/Editor/Generation/Contexts/TargetPropertyGUIContext.cs index 1f64879804c..108d8f204aa 100644 --- a/com.unity.shadergraph/Editor/Generation/Contexts/TargetPropertyGUIContext.cs +++ b/com.unity.shadergraph/Editor/Generation/Contexts/TargetPropertyGUIContext.cs @@ -10,6 +10,10 @@ namespace UnityEditor.ShaderGraph [GenerationAPI] internal class TargetPropertyGUIContext : VisualElement { + const int kIndentWidthInPixel = 15; + + public int globalIndentLevel {get; set;} = 0; + public TargetPropertyGUIContext() { @@ -43,29 +47,23 @@ public void AddProperty(string label, int indentLevel, BaseField field, Ev notifyValueChanged.RegisterValueChangedCallback(evt); } - string labelText = ""; - for (var i = 0; i < indentLevel; i++) - { - labelText += " "; - } - labelText += label; - var propertyRow = new PropertyRow(new Label(labelText)); + var propertyRow = new PropertyRow(new Label(label)); + ApplyPadding(propertyRow, indentLevel); propertyRow.Add(field); this.hierarchy.Add(propertyRow); } public void AddLabel(string label, int indentLevel) { - string labelText = ""; - for (var i = 0; i < indentLevel; i++) - { - labelText += " "; - } - labelText += label; - - var propertyRow = new PropertyRow(new Label(labelText)); + var propertyRow = new PropertyRow(new Label(label)); + ApplyPadding(propertyRow, indentLevel); this.hierarchy.Add(propertyRow); } + + void ApplyPadding(PropertyRow row, int indentLevel) + { + row.Q(className: "unity-label").style.marginLeft = (globalIndentLevel + indentLevel) * kIndentWidthInPixel; + } } } diff --git a/com.unity.shadergraph/Editor/Resources/Styles/InspectorView.uss b/com.unity.shadergraph/Editor/Resources/Styles/InspectorView.uss index ccd6137f8c3..5aa67a04bce 100644 --- a/com.unity.shadergraph/Editor/Resources/Styles/InspectorView.uss +++ b/com.unity.shadergraph/Editor/Resources/Styles/InspectorView.uss @@ -1,8 +1,3 @@ -.unity-label { - padding: 5px 2px 2px; - margin: 2px 4px; -} - .InspectorView { position:absolute; justify-content: flex-start; @@ -65,3 +60,9 @@ font-size: 11px; color: #606060; } + +.MainFoldout { + background-color: #383838; + border-color: #1F1F1F; + border-top-width: 1px; +} \ No newline at end of file diff --git a/com.unity.shadergraph/Editor/Resources/Styles/PropertyRow.uss b/com.unity.shadergraph/Editor/Resources/Styles/PropertyRow.uss index 775aa955fff..40f0cff21d9 100644 --- a/com.unity.shadergraph/Editor/Resources/Styles/PropertyRow.uss +++ b/com.unity.shadergraph/Editor/Resources/Styles/PropertyRow.uss @@ -19,6 +19,8 @@ PropertyRow > #container{ } PropertyRow > #container > #label { + flex-grow: 5; + min-width: 92px; width: 92px; font-size: 12px; margin-right: 4px;