Skip to content

Commit e7b2ad7

Browse files
USS style file InputActionImporterEditor.uss created
1 parent 01d9ba5 commit e7b2ad7

3 files changed

Lines changed: 50 additions & 12 deletions

File tree

Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ internal class InputActionImporterEditor : ScriptedImporterEditor
1919
public override VisualElement CreateInspectorGUI()
2020
{
2121
var root = new VisualElement();
22+
root.styleSheets.Add(AssetDatabase.LoadAssetAtPath<StyleSheet>(
23+
InputActionsEditorConstants.PackagePath +
24+
"/InputSystem/Editor/AssetImporter/InputActionImporterEditor.uss"));
2225
var inputActionAsset = GetAsset();
2326

2427
// ScriptedImporterEditor in 2019.2 now requires explicitly updating the SerializedObject
@@ -36,15 +39,12 @@ public override VisualElement CreateInspectorGUI()
3639
{
3740
text = GetOpenEditorButtonText(inputActionAsset)
3841
};
39-
editButton.style.height = 30;
40-
editButton.style.marginTop = 4;
41-
editButton.style.marginBottom = 4;
42+
editButton.AddToClassList("input-action-importer-editor__edit-button");
4243
editButton.SetEnabled(inputActionAsset != null);
4344
root.Add(editButton);
4445

4546
var projectWideContainer = new VisualElement();
46-
projectWideContainer.style.marginTop = 6;
47-
projectWideContainer.style.marginBottom = 6;
47+
projectWideContainer.AddToClassList("input-action-importer-editor__project-wide-container");
4848
root.Add(projectWideContainer);
4949
BuildProjectWideSection(projectWideContainer, inputActionAsset);
5050

@@ -113,12 +113,11 @@ private void BuildCodeGenerationSection(VisualElement root, InputActionAsset inp
113113
}
114114

115115
var pathRow = new VisualElement();
116-
pathRow.style.flexDirection = FlexDirection.Row;
117-
pathRow.style.alignItems = Align.Center;
116+
pathRow.AddToClassList("input-action-importer-editor__path-row");
118117
codeGenContainer.Add(pathRow);
119118

120119
var pathField = new TextField("C# Class File") { bindingPath = "m_WrapperCodePath" };
121-
pathField.style.flexGrow = 1;
120+
pathField.AddToClassList("input-action-importer-editor__path-field");
122121
pathField.AddToClassList(BaseField<string>.alignedFieldUssClassName);
123122
SetupPlaceholder(pathField, defaultFileName);
124123
pathRow.Add(pathField);
@@ -141,7 +140,7 @@ private void BuildCodeGenerationSection(VisualElement root, InputActionAsset inp
141140
{
142141
text = "…"
143142
};
144-
browseButton.style.width = 25;
143+
browseButton.AddToClassList("input-action-importer-editor__browse-button");
145144
pathRow.Add(browseButton);
146145

147146
// Class name
@@ -204,9 +203,7 @@ private static void SetupPlaceholder(TextField textField, string placeholder)
204203

205204
var placeholderLabel = new Label(placeholder);
206205
placeholderLabel.pickingMode = PickingMode.Ignore;
207-
placeholderLabel.style.position = Position.Absolute;
208-
placeholderLabel.style.opacity = 0.5f;
209-
placeholderLabel.style.paddingLeft = 2;
206+
placeholderLabel.AddToClassList("input-action-importer-editor__placeholder");
210207

211208
textField.RegisterCallback<GeometryChangedEvent>(_ =>
212209
{
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.input-action-importer-editor__edit-button {
2+
height: 30px;
3+
margin-top: 4px;
4+
margin-bottom: 4px;
5+
}
6+
7+
.input-action-importer-editor__project-wide-container {
8+
margin-top: 6px;
9+
margin-bottom: 6px;
10+
}
11+
12+
.input-action-importer-editor__path-row {
13+
flex-direction: row;
14+
align-items: center;
15+
}
16+
17+
.input-action-importer-editor__path-field {
18+
flex-grow: 1;
19+
}
20+
21+
.input-action-importer-editor__browse-button {
22+
width: 25px;
23+
}
24+
25+
.input-action-importer-editor__placeholder {
26+
position: absolute;
27+
opacity: 0.5;
28+
padding-left: 2px;
29+
}

Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.uss.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)