@@ -100,6 +100,32 @@ public override void OnInspectorGUI() {
100
100
GUILayout . EndHorizontal ( ) ;
101
101
102
102
EditorGUILayout . Space ( ) ;
103
+
104
+ GUILayout . BeginHorizontal ( ) ;
105
+ GUILayout . Label ( new GUIContent (
106
+ "Maya Application:" ,
107
+ "Maya location to install plugins to." ) ) ;
108
+
109
+ // dropdown to select Maya version to use
110
+ var options = ExportSettings . GetMayaOptions ( ) ;
111
+ // make sure we never initially have browse selected
112
+ if ( exportSettings . selectedMayaApp == options . Length - 1 ) {
113
+ exportSettings . selectedMayaApp = 0 ;
114
+ }
115
+ int result = EditorGUILayout . Popup ( exportSettings . selectedMayaApp , options ) ;
116
+ if ( result == options . Length - 1 ) {
117
+ string mayaPath = EditorUtility . OpenFilePanel ( "Select Maya Application" , ExportSettings . kDefaultAdskRoot , "exe" ) ;
118
+ if ( ! string . IsNullOrEmpty ( mayaPath ) ) {
119
+ ExportSettings . AddMayaOption ( mayaPath ) ;
120
+ Repaint ( ) ;
121
+ }
122
+ } else {
123
+ exportSettings . selectedMayaApp = result ;
124
+ }
125
+
126
+
127
+ GUILayout . EndHorizontal ( ) ;
128
+
103
129
if ( GUILayout . Button ( "Install Maya Integration" ) ) {
104
130
FbxExporters . Editor . IntegrationsUI . InstallMayaIntegration ( ) ;
105
131
}
@@ -120,11 +146,27 @@ public class ExportSettings : ScriptableSingleton<ExportSettings>
120
146
{
121
147
public const string kDefaultSavePath = "." ;
122
148
149
+ /// <summary>
150
+ /// The path where all the different versions of Maya are installed
151
+ /// by default. Depends on the platform.
152
+ /// </summary>
153
+ public const string kDefaultAdskRoot =
154
+ #if UNITY_EDITOR_OSX
155
+ "/Applications/Autodesk"
156
+ #elif UNITY_EDITOR_LINUX
157
+ "/usr/autodesk"
158
+ #else // WINDOWS
159
+ "C:/Program Files/Autodesk"
160
+ #endif
161
+ ;
162
+
123
163
// Note: default values are set in LoadDefaults().
124
164
public bool weldVertices ;
125
165
public bool mayaCompatibleNames ;
126
166
public bool centerObjects ;
127
167
168
+ public int selectedMayaApp = 0 ;
169
+
128
170
[ SerializeField ]
129
171
public UnityEngine . Object turntableScene ;
130
172
@@ -141,13 +183,52 @@ public class ExportSettings : ScriptableSingleton<ExportSettings>
141
183
[ SerializeField ]
142
184
string convertToModelSavePath ;
143
185
186
+ //[SerializeField]
187
+ // List of paths in order that they appear in the option list
188
+ private System . Collections . Generic . List < string > mayaOptionPaths ;
189
+ //[SerializeField]
190
+ // Dictionary of path -> display name
191
+ private System . Collections . Generic . Dictionary < string , string > mayaAppOptions ;
192
+
144
193
protected override void LoadDefaults ( )
145
194
{
146
195
weldVertices = true ;
147
196
mayaCompatibleNames = true ;
148
197
centerObjects = true ;
149
198
convertToModelSavePath = kDefaultSavePath ;
150
199
turntableScene = null ;
200
+ mayaAppOptions = null ;
201
+ }
202
+
203
+ public static GUIContent [ ] GetMayaOptions ( ) {
204
+ if ( instance . mayaAppOptions == null ) {
205
+ instance . mayaAppOptions = new System . Collections . Generic . Dictionary < string , string > ( ) ;
206
+ instance . mayaAppOptions . Add ( "c:/" , "Maya2017" ) ;
207
+ instance . mayaAppOptions . Add ( "d:/" , "Maya2018" ) ;
208
+
209
+ instance . mayaOptionPaths = new System . Collections . Generic . List < string > ( ) { "c:/" , "d:/" } ;
210
+ }
211
+ GUIContent [ ] optionArray = new GUIContent [ instance . mayaAppOptions . Count + 1 ] ;
212
+ for ( int i = 0 ; i < instance . mayaOptionPaths . Count ; i ++ ) {
213
+ optionArray [ i ] = new GUIContent (
214
+ instance . mayaAppOptions [ instance . mayaOptionPaths [ i ] ] ,
215
+ instance . mayaOptionPaths [ i ]
216
+ ) ;
217
+ }
218
+ optionArray [ optionArray . Length - 1 ] = new GUIContent ( "Browse" ) ;
219
+
220
+ return optionArray ;
221
+ }
222
+
223
+ public static void AddMayaOption ( string newOption ) {
224
+ var mayaAppOptions = instance . mayaAppOptions ;
225
+ if ( mayaAppOptions . ContainsKey ( newOption ) ) {
226
+ instance . selectedMayaApp = instance . mayaOptionPaths . IndexOf ( newOption ) ;
227
+ return ;
228
+ }
229
+ mayaAppOptions . Add ( newOption , "Custom Maya Location" ) ;
230
+ instance . mayaOptionPaths . Add ( newOption ) ;
231
+ instance . selectedMayaApp = instance . mayaOptionPaths . Count - 1 ;
151
232
}
152
233
153
234
public static string GetTurnTableSceneName ( ) {
0 commit comments