Skip to content

Commit 319835a

Browse files
committed
fix FbxExportSettings.cs warnings
- convert some functions and member vars to properties
1 parent 9314918 commit 319835a

File tree

6 files changed

+185
-123
lines changed

6 files changed

+185
-123
lines changed

Assets/com.unity.formats.fbx.tests/FbxExportSettingsTest.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ public void TestGetSetFields ()
166166
var appDataPath = Application.dataPath.Replace (Path.AltDirectorySeparatorChar,
167167
Path.DirectorySeparatorChar);
168168

169-
var defaultAbsolutePath = ExportSettings.GetFbxAbsoluteSavePath ();
169+
var defaultAbsolutePath = ExportSettings.FbxAbsoluteSavePath;
170170
var dataPath = Path.GetFullPath (Path.Combine (appDataPath, ExportSettings.kDefaultSavePath));
171171
Assert.AreEqual (dataPath, defaultAbsolutePath);
172172

173-
var prefabDefaultAbsPath = ExportSettings.GetPrefabAbsoluteSavePath ();
173+
var prefabDefaultAbsPath = ExportSettings.PrefabAbsoluteSavePath;
174174
Assert.AreEqual (dataPath, prefabDefaultAbsPath);
175175

176176
// set; check that the saved value is platform-independent,
@@ -184,8 +184,8 @@ public void TestGetSetFields ()
184184
Assert.That (ExportSettings.GetRelativePrefabSavePaths () [0], Is.EqualTo (string.Format("Assets{0}a{0}b{0}c", forwardSlash)));
185185

186186
var platformPath = Path.Combine ("a", Path.Combine ("b", "c"));
187-
Assert.AreEqual (Path.Combine (appDataPath, platformPath), ExportSettings.GetFbxAbsoluteSavePath ());
188-
Assert.AreEqual (Path.Combine (appDataPath, platformPath), ExportSettings.GetPrefabAbsoluteSavePath ());
187+
Assert.AreEqual (Path.Combine (appDataPath, platformPath), ExportSettings.FbxAbsoluteSavePath);
188+
Assert.AreEqual (Path.Combine (appDataPath, platformPath), ExportSettings.PrefabAbsoluteSavePath);
189189

190190
ExportSettings.AddFbxSavePath ("test");
191191
ExportSettings.AddPrefabSavePath ("test2");
@@ -212,43 +212,43 @@ public void TestFindPreferredProgram ()
212212

213213
ExportSettings.instance.SetDCCOptionNames (testList);
214214

215-
int preferred = ExportSettings.instance.GetPreferredDCCApp ();
215+
int preferred = ExportSettings.instance.PreferredDCCApp;
216216
//While Maya 2017 and 3ds Max 2017 are tied for most recent, Maya 2017 (index 8) should win because we prefer Maya.
217217
Assert.AreEqual (preferred, 8);
218218

219219
ExportSettings.instance.ClearDCCOptionNames ();
220220
//Try running it with an empty list
221-
preferred = ExportSettings.instance.GetPreferredDCCApp ();
221+
preferred = ExportSettings.instance.PreferredDCCApp;
222222

223223
Assert.AreEqual (preferred, -1);
224224

225225
ExportSettings.instance.SetDCCOptionNames (null);
226226
//Try running it with a null list
227-
preferred = ExportSettings.instance.GetPreferredDCCApp ();
227+
preferred = ExportSettings.instance.PreferredDCCApp;
228228

229229
Assert.AreEqual(preferred, -1);
230230

231231
//Testing the results of only having a mayaLT install
232232
ExportSettings.instance.SetDCCOptionNames(new List<string> { ExportSettings.kMayaLtOptionName + "2018" }); //hardcoded because the constant is changed in another branch but not this one at this time
233-
preferred = ExportSettings.instance.GetPreferredDCCApp();
233+
preferred = ExportSettings.instance.PreferredDCCApp;
234234

235235
Assert.AreEqual(preferred, 0);
236236

237237
//Testing the results of only having a maya install
238238
ExportSettings.instance.SetDCCOptionNames(new List<string> { ExportSettings.kMayaOptionName + "2018" });
239-
preferred = ExportSettings.instance.GetPreferredDCCApp();
239+
preferred = ExportSettings.instance.PreferredDCCApp;
240240

241241
Assert.AreEqual(preferred, 0);
242242

243243
//Testing the results of only having a max install
244244
ExportSettings.instance.SetDCCOptionNames(new List<string> { ExportSettings.kMaxOptionName + "2018" });
245-
preferred = ExportSettings.instance.GetPreferredDCCApp();
245+
preferred = ExportSettings.instance.PreferredDCCApp;
246246

247247
Assert.AreEqual(preferred, 0);
248248

249249
//Testing the preference priority
250250
ExportSettings.instance.SetDCCOptionNames(new List<string> { ExportSettings.kMaxOptionName + "2018", ExportSettings.kMayaOptionName + "2018", ExportSettings.kMayaLtOptionName + "2018" });
251-
preferred = ExportSettings.instance.GetPreferredDCCApp();
251+
preferred = ExportSettings.instance.PreferredDCCApp;
252252

253253
Assert.AreEqual(preferred, 1);
254254
}
@@ -485,7 +485,7 @@ private void TestLocations(Dictionary<string,List<string>> data)
485485

486486
if (data.ContainsKey("expected3DApp"))
487487
{
488-
int preferred = ExportSettings.instance.GetPreferredDCCApp ();
488+
int preferred = ExportSettings.instance.PreferredDCCApp;
489489
Assert.AreEqual(preferred, int.Parse(data["expected3DApp"][0]) );
490490
}
491491
}

Packages/com.unity.formats.fbx/Editor/Scripts/ConvertToModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public static GameObject[] CreateInstantiatedModelPrefab (
115115
}
116116

117117
var converted = new List<GameObject>();
118-
var exportOptions = ExportSettings.instance.convertToPrefabSettings.info;
118+
var exportOptions = ExportSettings.instance.ConvertToPrefabSettings.info;
119119
foreach (var go in toExport)
120120
{
121121
var convertedGO = Convert(go, exportOptions: exportOptions);
@@ -261,7 +261,7 @@ internal static GameObject GetOrCreateFbxAsset(GameObject toConvert,
261261
if (string.IsNullOrEmpty(fbxFullPath)) {
262262
// Generate a unique filename.
263263
if (string.IsNullOrEmpty (fbxDirectoryFullPath)) {
264-
fbxDirectoryFullPath = UnityEditor.Formats.Fbx.Exporter.ExportSettings.GetFbxAbsoluteSavePath();
264+
fbxDirectoryFullPath = UnityEditor.Formats.Fbx.Exporter.ExportSettings.FbxAbsoluteSavePath;
265265
} else {
266266
fbxDirectoryFullPath = Path.GetFullPath (fbxDirectoryFullPath);
267267
}
@@ -374,7 +374,7 @@ public static GameObject ApplyOrCreatePrefab(GameObject instance,
374374
if (string.IsNullOrEmpty(prefabFullPath)) {
375375
// Generate a unique filename.
376376
if (string.IsNullOrEmpty (prefabDirectoryFullPath)) {
377-
prefabDirectoryFullPath = UnityEditor.Formats.Fbx.Exporter.ExportSettings.GetPrefabAbsoluteSavePath();
377+
prefabDirectoryFullPath = UnityEditor.Formats.Fbx.Exporter.ExportSettings.PrefabAbsoluteSavePath;
378378
} else {
379379
prefabDirectoryFullPath = Path.GetFullPath (prefabDirectoryFullPath);
380380
}

Packages/com.unity.formats.fbx/Editor/Scripts/ConvertToPrefabEditorWindow.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected override void OnEnable()
8686
base.OnEnable();
8787
if (!InnerEditor)
8888
{
89-
InnerEditor = UnityEditor.Editor.CreateEditor(ExportSettings.instance.convertToPrefabSettings);
89+
InnerEditor = UnityEditor.Editor.CreateEditor(ExportSettings.instance.ConvertToPrefabSettings);
9090
}
9191
m_prefabExtLabelWidth = FbxExtLabelStyle.CalcSize(new GUIContent(".prefab")).x;
9292
}
@@ -118,10 +118,10 @@ protected override bool Export()
118118
return false;
119119
}
120120

121-
var fbxDirPath = ExportSettings.GetFbxAbsoluteSavePath();
121+
var fbxDirPath = ExportSettings.FbxAbsoluteSavePath;
122122
var fbxPath = System.IO.Path.Combine(fbxDirPath, ExportFileName + ".fbx");
123123

124-
var prefabDirPath = ExportSettings.GetPrefabAbsoluteSavePath();
124+
var prefabDirPath = ExportSettings.PrefabAbsoluteSavePath;
125125
var prefabPath = System.IO.Path.Combine(prefabDirPath, m_prefabFileName + ".prefab");
126126

127127
if (ToExport == null)
@@ -175,7 +175,7 @@ protected override bool Export()
175175
}
176176

177177
ConvertToModel.Convert(
178-
go, fbxFullPath: fbxPath, prefabFullPath: prefabPath, exportOptions: ExportSettings.instance.convertToPrefabSettings.info
178+
go, fbxFullPath: fbxPath, prefabFullPath: prefabPath, exportOptions: ExportSettings.instance.ConvertToPrefabSettings.info
179179
);
180180
return true;
181181
}
@@ -185,20 +185,20 @@ protected override bool Export()
185185
// Convert, automatically choosing a file path that won't clobber any existing files.
186186
var go = ModelExporter.GetGameObject(obj);
187187
ConvertToModel.Convert(
188-
go, fbxDirectoryFullPath: fbxDirPath, prefabDirectoryFullPath: prefabDirPath, exportOptions: ExportSettings.instance.convertToPrefabSettings.info
188+
go, fbxDirectoryFullPath: fbxDirPath, prefabDirectoryFullPath: prefabDirPath, exportOptions: ExportSettings.instance.ConvertToPrefabSettings.info
189189
);
190190
}
191191
return true;
192192
}
193193

194194
protected override ExportOptionsSettingsSerializeBase SettingsObject
195195
{
196-
get { return ExportSettings.instance.convertToPrefabSettings.info; }
196+
get { return ExportSettings.instance.ConvertToPrefabSettings.info; }
197197
}
198198
#if UNITY_2018_1_OR_NEWER
199199
protected override void ShowPresetReceiver()
200200
{
201-
ShowPresetReceiver(ExportSettings.instance.convertToPrefabSettings);
201+
ShowPresetReceiver(ExportSettings.instance.ConvertToPrefabSettings);
202202
}
203203
#endif
204204
protected override void CreateCustomUI()

Packages/com.unity.formats.fbx/Editor/Scripts/ExportModelEditorWindow.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,8 @@ protected bool IsTimelineAnim {
478478
set{
479479
m_isTimelineAnim = value;
480480
if (m_isTimelineAnim) {
481-
m_previousInclude = ExportSettings.instance.exportModelSettings.info.ModelAnimIncludeOption;
482-
ExportSettings.instance.exportModelSettings.info.SetModelAnimIncludeOption(ExportSettings.Include.Anim);
481+
m_previousInclude = ExportSettings.instance.ExportModelSettings.info.ModelAnimIncludeOption;
482+
ExportSettings.instance.ExportModelSettings.info.SetModelAnimIncludeOption(ExportSettings.Include.Anim);
483483
}
484484
if (InnerEditor) {
485485
var exportModelSettingsEditor = InnerEditor as ExportModelSettingsEditor;
@@ -507,7 +507,7 @@ protected bool SingleHierarchyExport {
507507

508508
protected override ExportOptionsSettingsSerializeBase SettingsObject
509509
{
510-
get { return ExportSettings.instance.exportModelSettings.info; }
510+
get { return ExportSettings.instance.ExportModelSettings.info; }
511511
}
512512

513513
private ExportSettings.Include m_previousInclude = ExportSettings.Include.ModelAndAnim;
@@ -572,7 +572,7 @@ protected override void OnEnable ()
572572
{
573573
base.OnEnable ();
574574
if (!InnerEditor) {
575-
InnerEditor = UnityEditor.Editor.CreateEditor (ExportSettings.instance.exportModelSettings);
575+
InnerEditor = UnityEditor.Editor.CreateEditor (ExportSettings.instance.ExportModelSettings);
576576
this.SingleHierarchyExport = m_singleHierarchyExport;
577577
this.IsTimelineAnim = m_isTimelineAnim;
578578
}
@@ -589,7 +589,7 @@ protected void OnDisable()
589589
protected virtual void RestoreSettings()
590590
{
591591
if (IsTimelineAnim) {
592-
ExportSettings.instance.exportModelSettings.info.SetModelAnimIncludeOption(m_previousInclude);
592+
ExportSettings.instance.ExportModelSettings.info.SetModelAnimIncludeOption(m_previousInclude);
593593
SaveExportSettings ();
594594
}
595595
}
@@ -600,7 +600,7 @@ protected override bool Export(){
600600
Debug.LogError ("FbxExporter: Please specify an fbx filename");
601601
return false;
602602
}
603-
var folderPath = ExportSettings.GetFbxAbsoluteSavePath ();
603+
var folderPath = ExportSettings.FbxAbsoluteSavePath;
604604
var filePath = System.IO.Path.Combine (folderPath, ExportFileName + ".fbx");
605605

606606
if (!OverwriteExistingFile (filePath)) {
@@ -618,7 +618,7 @@ protected override bool Export(){
618618
#if UNITY_2018_1_OR_NEWER
619619
protected override void ShowPresetReceiver ()
620620
{
621-
ShowPresetReceiver (ExportSettings.instance.exportModelSettings);
621+
ShowPresetReceiver (ExportSettings.instance.ExportModelSettings);
622622
}
623623
#endif
624624
}

0 commit comments

Comments
 (0)