Skip to content

Commit 16b1647

Browse files
committed
Fixed some ui bugs
1 parent cc2256a commit 16b1647

10 files changed

+24
-11
lines changed

Editor/Editors/Components/FunctionTimeline.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public FunctionViewer()
330330
{
331331
var title = new Label("Selected function information");
332332
title.AddToClassList("area-title");
333-
var content = new ScrollView(ScrollViewMode.VerticalAndHorizontal);
333+
var content = new ScrollView(ScrollViewMode.Vertical);
334334
content.AddToClassList("area-content");
335335

336336
_name = new LabelField("Name", "");
@@ -401,6 +401,8 @@ public LabelField(string label, string value)
401401
_labelField.AddToClassList("unity-base-field__label");
402402
_labelField.AddToClassList("unity-base-text-field__label");
403403
_labelField.AddToClassList("unity-text-field__label");
404+
_labelField.AddToClassList("label-field-title");
405+
_valueField.AddToClassList("label-field-value");
404406

405407
Add(_labelField);
406408
Add(_valueField);
@@ -475,7 +477,7 @@ public ModuleViewer()
475477
{
476478
var title = new Label("Function's module base info");
477479
title.AddToClassList("area-title");
478-
var content = new ScrollView(ScrollViewMode.VerticalAndHorizontal);
480+
var content = new ScrollView(ScrollViewMode.Vertical);
479481
_content = content;
480482
_content.AddToClassList("area-content");
481483

Editor/Editors/Drawers/EnablePropertyDrawer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property)
2222
foldout.text = property.displayName;
2323
foldout.RegisterValueChangedCallback((e) => property.isExpanded = e.newValue);
2424
foldout.value = property.isExpanded;
25+
2526
foldout.Add(template);
2627
_root.Add(foldout);
2728

Editor/Editors/Drawers/FunctionPropertyDrawer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property)
2121
foldout.text = property.displayName;
2222
foldout.RegisterValueChangedCallback((e) => property.isExpanded = e.newValue);
2323
foldout.value = property.isExpanded;
24+
25+
var nameField = template.Q<TextField>("Name");
26+
nameField.RegisterValueChangedCallback(evt => foldout.text = evt.newValue);
27+
2428
foldout.Add(template);
2529
_root.Add(foldout);
2630

Editor/Editors/Drawers/ShaderPropertyDrawer.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,14 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property)
4848
foldout.RegisterValueChangedCallback((e) => property.isExpanded = e.newValue);
4949
foldout.value = property.isExpanded;
5050

51+
var nameField = template.Q<TextField>("Name");
52+
nameField.RegisterValueChangedCallback(evt => foldout.text = evt.newValue);
5153
var enumField = template.Q<EnumField>("TypeField");
5254
var valueContainer = template.Q<VisualElement>("ValueContainer");
5355

5456
var type = property.FindPropertyRelative("Type");
5557
var defaultValue = property.FindPropertyRelative("DefaultValue");
56-
57-
5858

59-
6059
var propType = GetPropertyTypeFromSerializedProperty(type.stringValue);
6160

6261
enumField.value = propType;
@@ -222,7 +221,7 @@ private void UpdateValueContainer(SerializedProperty defaultValue, SerializedPro
222221
}
223222

224223
if (vfi) colorValue = new Color(fv[0], fv[1], fv[2], fv[3]);
225-
else SetPropDefaultValue(defaultValue,$"({fv[0]}, {fv[1]}, {fv[2]}, {fv[3]})");
224+
else SetPropDefaultValue(defaultValue,$"({colorValue[0]}, {colorValue[1]}, {colorValue[2]}, {colorValue[3]})");
226225
var clfield = new ColorField { value = colorValue, label = "Default value" };
227226
field = clfield;
228227
clfield.RegisterValueChangedCallback(e => SetPropDefaultValue(defaultValue,$"({e.newValue[0]}, {e.newValue[1]}, {e.newValue[2]}, {e.newValue[3]})"));
@@ -276,8 +275,6 @@ private void UpdateValueContainer(SerializedProperty defaultValue, SerializedPro
276275

277276
private static PropertyType GetPropertyTypeFromSerializedProperty(string propType)
278277
{
279-
280-
281278
switch (propType.Trim())
282279
{
283280
case "Float": return PropertyType.Float;

Editor/Editors/Drawers/VariablePropertyDrawer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property)
2626
foldout.Add(template);
2727
_root.Add(foldout);
2828

29+
var nameField = template.Q<TextField>("Name");
30+
nameField.RegisterValueChangedCallback(evt => foldout.text = evt.newValue);
2931
var typeField = template.Q<EnumField>("Type");
3032
var customTypeField = template.Q<VisualElement>("CustomType");
3133

Editor/Resources/MSS/MSSUIElements/EnablePropertyDrawer.uxml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<ui:TextField picking-mode="Ignore" label="Name" binding-path="Name" />
33
<ui:TextField picking-mode="Ignore" label="Display Name" binding-path="DisplayName" />
44
<uie:IntegerField label="Enable Value" value="0" binding-path="EnableValue" />
5+
<VRLabs.ModularShaderSystem.InspectorList show-elements-text="false" binding-path="Attributes" />
56
</ui:UXML>

Editor/Resources/MSS/MSSUIElements/FunctionPropertyDrawer.uxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements">
2-
<ui:TextField picking-mode="Ignore" label="Name" binding-path="Name" />
2+
<ui:TextField name="Name" picking-mode="Ignore" label="Name" binding-path="Name" />
33
<ui:TextField picking-mode="Ignore" label="Append After" binding-path="AppendAfter" />
44
<uie:IntegerField label="Queue" value="100" binding-path="Queue" />
55
<uie:PropertyField binding-path="ShaderFunctionCode" label="Function Code" focusable="true" />

Editor/Resources/MSS/MSSUIElements/FunctionTimelineStyle.uss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,10 @@ Foldout > Toggle
145145
.selected-variable
146146
{
147147
background-color: rgba(255,255,0,0.2);
148+
}
149+
150+
.label-field-value
151+
{
152+
white-space: normal;
153+
flex-shrink: 1;
148154
}

Editor/Resources/MSS/MSSUIElements/ShaderPropertyDrawer.uxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements">
2-
<ui:TextField label="Name" binding-path="Name" />
2+
<ui:TextField name="Name" label="Name" binding-path="Name" />
33
<ui:TextField label="Display Name" binding-path="DisplayName" />
44
<uie:EnumField name="TypeField" label="Type" type="VRLabs.ModularShaderSystem.PropertyType, Assembly-CSharp-Editor" />
55
<ui:VisualElement name="ValueContainer" />
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements">
2-
<ui:TextField picking-mode="Ignore" label="Name" binding-path="Name" />
2+
<ui:TextField name="Name" picking-mode="Ignore" label="Name" binding-path="Name" />
33
<uie:EnumField name="Type" label="Type" type="VRLabs.ModularShaderSystem.VariableType, Assembly-CSharp-Editor" binding-path="Type" />
44
<ui:TextField name="CustomType" picking-mode="Ignore" label="Custom Type" binding-path="CustomType" />
55
</ui:UXML>

0 commit comments

Comments
 (0)