Skip to content

Commit 242b591

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into UNI-31096-sprint34-release
2 parents 0c27860 + 24028c7 commit 242b591

File tree

2 files changed

+54
-18
lines changed

2 files changed

+54
-18
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,38 @@ public override void OnInspectorGUI() {
104104
}
105105
GUILayout.EndHorizontal ();
106106

107+
GUILayout.BeginHorizontal ();
108+
GUILayout.Label (new GUIContent (
109+
"Integrations Path:",
110+
"Installation path for 3D application integrations."), GUILayout.Width(LabelWidth - 3));
111+
112+
var IntegrationsPathLabel = ExportSettings.GetIntegrationSavePath();
113+
EditorGUILayout.SelectableLabel(IntegrationsPathLabel,
114+
EditorStyles.textField,
115+
GUILayout.MinWidth(SelectableLabelMinWidth),
116+
GUILayout.Height(EditorGUIUtility.singleLineHeight));
117+
118+
if (GUILayout.Button(new GUIContent("...", "Browse to a new installation path for 3D application integrations"), EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth)))
119+
{
120+
string initialPath = ExportSettings.GetIntegrationSavePath();
121+
122+
string fullPath = EditorUtility.OpenFolderPanel(
123+
"Select Integrations Path", initialPath, null
124+
);
125+
126+
if (!string.IsNullOrEmpty(fullPath))
127+
{
128+
ExportSettings.SetIntegrationSavePath(fullPath);
129+
130+
// Make sure focus is removed from the selectable label
131+
// otherwise it won't update
132+
GUIUtility.hotControl = 0;
133+
GUIUtility.keyboardControl = 0;
134+
}
135+
}
136+
137+
GUILayout.EndHorizontal();
138+
107139
EditorGUILayout.Space ();
108140

109141
GUILayout.BeginHorizontal ();
@@ -272,6 +304,8 @@ public static string[] DCCVendorLocations {
272304
public bool launchAfterInstallation;
273305
public int ExportFormatSelection;
274306

307+
public string IntegrationSavePath;
308+
275309
public int selectedDCCApp = 0;
276310

277311
/// <summary>
@@ -301,6 +335,7 @@ protected override void LoadDefaults()
301335
launchAfterInstallation = true;
302336
ExportFormatSelection = 0;
303337
convertToModelSavePath = kDefaultSavePath;
338+
IntegrationSavePath = Directory.GetCurrentDirectory().ToString();
304339
dccOptionPaths = null;
305340
dccOptionNames = null;
306341
}
@@ -726,6 +761,22 @@ public static void SetRelativeSavePath(string newPath) {
726761
instance.convertToModelSavePath = NormalizePath(newPath, isRelative: true);
727762
}
728763

764+
public static string GetIntegrationSavePath()
765+
{
766+
//If the save path gets messed up and ends up not being valid, just use the project folder as the default
767+
if (string.IsNullOrEmpty(instance.IntegrationSavePath.Trim()) || !Directory.Exists(instance.IntegrationSavePath))
768+
{
769+
//The project folder, above the asset folder
770+
Directory.GetCurrentDirectory().ToString();
771+
}
772+
return instance.IntegrationSavePath;
773+
}
774+
775+
public static void SetIntegrationSavePath(string newPath)
776+
{
777+
instance.IntegrationSavePath = newPath;
778+
}
779+
729780
/// <summary>
730781
/// Convert an absolute path into a relative path like what you would
731782
/// get from GetRelativeSavePath.

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -714,15 +714,6 @@ private static void ShowSuccessDialog(string dcc, int exitCode){
714714
UnityEditor.EditorUtility.DisplayDialog (title, message, "Ok");
715715
}
716716

717-
private static string DefaultIntegrationSavePath
718-
{
719-
get{
720-
return Application.dataPath;
721-
}
722-
}
723-
724-
private static string LastIntegrationSavePath = DefaultIntegrationSavePath;
725-
726717
public static void InstallDCCIntegration ()
727718
{
728719
var dccExe = GetDCCExe ();
@@ -759,18 +750,14 @@ private static bool GetIntegrationFolder(DCCIntegration dcc){
759750
if (System.IO.File.Exists (zipPath)) {
760751
return DecompressIntegrationZipFile (zipPath, dcc);
761752
}
762-
dcc.SetIntegrationFolderPath (DefaultIntegrationSavePath);
753+
dcc.SetIntegrationFolderPath (EditorTools.ExportSettings.GetIntegrationSavePath());
763754
return true;
764755
}
765756

766757
private static bool DecompressIntegrationZipFile(string zipPath, DCCIntegration dcc)
767758
{
768-
// prompt user to enter location to unzip file
769-
var unzipFolder = EditorUtility.OpenFolderPanel(string.Format("Select Location to Save {0} Integration", dcc.DccDisplayName),LastIntegrationSavePath,"");
770-
if (string.IsNullOrEmpty (unzipFolder)) {
771-
// user has cancelled, do nothing
772-
return false;
773-
}
759+
string unzipFolder;
760+
unzipFolder = EditorTools.ExportSettings.GetIntegrationSavePath();
774761

775762
// check that this is a valid location to unzip the file
776763
if (!DirectoryHasWritePermission (unzipFolder)) {
@@ -788,8 +775,6 @@ private static bool DecompressIntegrationZipFile(string zipPath, DCCIntegration
788775
}
789776
}
790777

791-
LastIntegrationSavePath = unzipFolder;
792-
793778
// if file already unzipped in this location, then prompt user
794779
// if they would like to continue unzipping or use what is there
795780
if (dcc.FolderAlreadyUnzippedAtPath (unzipFolder)) {

0 commit comments

Comments
 (0)