@@ -102,13 +102,44 @@ void OnGUI ()
102
102
GUILayout . BeginHorizontal ( ) ;
103
103
EditorGUILayout . LabelField ( new GUIContent (
104
104
"Export Name:" ,
105
- "Filename to save model to." ) , GUILayout . Width ( LabelWidth - FieldOffset ) ) ;
105
+ "Filename to save model to." ) , GUILayout . Width ( LabelWidth - 3 ) ) ;
106
106
107
- m_exportFileName = EditorGUILayout . TextField ( m_exportFileName ) ;
107
+ // Show the export name with an uneditable ".fbx" at the end
108
+ EditorGUILayout . BeginVertical ( ) ;
109
+ var style = new GUIStyle ( EditorStyles . textField ) ;
110
+ EditorGUILayout . BeginHorizontal ( style , GUILayout . Height ( EditorGUIUtility . singleLineHeight ) ) ;
111
+ EditorGUI . indentLevel -- ;
112
+
113
+ var textFieldStyle = new GUIStyle ( GUIStyle . none ) ;
114
+ textFieldStyle . alignment = TextAnchor . LowerCenter ;
115
+ textFieldStyle . margin = new RectOffset ( 0 , 0 , 0 , 0 ) ;
116
+ var padding = textFieldStyle . padding ;
117
+ padding . left = 0 ;
118
+ padding . right = 0 ;
119
+ textFieldStyle . padding = padding ;
120
+ textFieldStyle . clipping = TextClipping . Clip ;
121
+
122
+ var textFieldSize = textFieldStyle . CalcSize ( new GUIContent ( m_exportFileName ) ) ;
123
+ m_exportFileName = EditorGUILayout . TextField ( m_exportFileName , textFieldStyle , GUILayout . Width ( textFieldSize . x + 5 ) , GUILayout . MinWidth ( 5 ) ) ;
124
+ m_exportFileName = ModelExporter . ConvertToValidFilename ( m_exportFileName ) ;
125
+
126
+ var labelStyle = new GUIStyle ( GUIStyle . none ) ;
127
+ labelStyle . alignment = TextAnchor . MiddleLeft ;
128
+ labelStyle . richText = true ;
129
+ labelStyle . margin = new RectOffset ( 0 , 0 , 0 , 0 ) ;
130
+ labelStyle . padding = new RectOffset ( 0 , 0 , 0 , 0 ) ;
131
+ labelStyle . contentOffset = new Vector2 ( - 7 , 0 ) ;
132
+ var fbxLabelWidth = labelStyle . CalcSize ( new GUIContent ( ".fbx" ) ) . x ;
133
+ EditorGUILayout . LabelField ( "<color=#808080ff>.fbx</color>" , labelStyle , GUILayout . Width ( fbxLabelWidth ) ) ;
134
+ EditorGUI . indentLevel ++ ;
135
+
136
+ EditorGUILayout . EndHorizontal ( ) ;
137
+ EditorGUILayout . EndVertical ( ) ;
138
+ /*m_exportFileName = EditorGUILayout.TextField (m_exportFileName);
108
139
if (!m_exportFileName.EndsWith (".fbx")) {
109
140
m_exportFileName += ".fbx";
110
141
}
111
- m_exportFileName = ModelExporter . ConvertToValidFilename ( m_exportFileName ) ;
142
+ m_exportFileName = ModelExporter.ConvertToValidFilename(m_exportFileName);*/
112
143
GUILayout . EndHorizontal ( ) ;
113
144
114
145
GUILayout . BeginHorizontal ( ) ;
0 commit comments