Skip to content

Commit 451e495

Browse files
author
AJubrey
committed
[CHANGED] path selection is now absolute and not relative
[CHANGED] integration path does not need to be in assets folder
1 parent 844ce4f commit 451e495

File tree

2 files changed

+23
-40
lines changed

2 files changed

+23
-40
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,15 @@ public override void OnInspectorGUI() {
9292
"Integrations Path:",
9393
"Relative path for saving 3D application integrations."), GUILayout.Width(LabelWidth - 3));
9494

95-
var IntegrationsPathLabel = ExportSettings.GetRelativeSavePath();
96-
if (IntegrationsPathLabel == ".") { IntegrationsPathLabel = "(Assets root)"; }
95+
var IntegrationsPathLabel = ExportSettings.GetIntegrationSavePath();
9796
EditorGUILayout.SelectableLabel(IntegrationsPathLabel,
9897
EditorStyles.textField,
9998
GUILayout.MinWidth(SelectableLabelMinWidth),
10099
GUILayout.Height(EditorGUIUtility.singleLineHeight));
101100

102-
if (GUILayout.Button(new GUIContent("...", "Browse to a new location for saving model prefabs"), EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth)))
101+
if (GUILayout.Button(new GUIContent("...", "Browse to a new location for saving 3D application integrations"), EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth)))
103102
{
104-
string initialPath = ExportSettings.GetAbsoluteSavePath();
103+
string initialPath = ExportSettings.GetIntegrationSavePath();
105104

106105
// if the directory doesn't exist, set it to the default save path
107106
// so we don't open somewhere unexpected
@@ -111,26 +110,18 @@ public override void OnInspectorGUI() {
111110
}
112111

113112
string fullPath = EditorUtility.OpenFolderPanel(
114-
"Select Model Prefabs Path", initialPath, null
113+
"Select Integrations Path", initialPath, null
115114
);
116115

117116
// Unless the user canceled, make sure they chose something in the Assets folder.
118117
if (!string.IsNullOrEmpty(fullPath))
119118
{
120-
var relativePath = ExportSettings.ConvertToAssetRelativePath(fullPath);
121-
if (string.IsNullOrEmpty(relativePath))
122-
{
123-
Debug.LogWarning("Please select a location in the Assets folder");
124-
}
125-
else
126-
{
127-
ExportSettings.SetRelativeSavePath(relativePath);
119+
ExportSettings.SetIntegrationSavePath(fullPath);
128120

129-
// Make sure focus is removed from the selectable label
130-
// otherwise it won't update
131-
GUIUtility.hotControl = 0;
132-
GUIUtility.keyboardControl = 0;
133-
}
121+
// Make sure focus is removed from the selectable label
122+
// otherwise it won't update
123+
GUIUtility.hotControl = 0;
124+
GUIUtility.keyboardControl = 0;
134125
}
135126
}
136127

@@ -296,6 +287,8 @@ public static string kDefaultAdskRoot {
296287
public bool centerObjects;
297288
public bool launchAfterInstallation;
298289

290+
public string IntegrationSavePath;
291+
299292
public int selectedDCCApp = 0;
300293

301294
/// <summary>
@@ -324,6 +317,7 @@ protected override void LoadDefaults()
324317
centerObjects = true;
325318
launchAfterInstallation = true;
326319
convertToModelSavePath = kDefaultSavePath;
320+
IntegrationSavePath = Directory.GetCurrentDirectory().ToString();
327321
dccOptionPaths = null;
328322
dccOptionNames = null;
329323
}
@@ -736,6 +730,16 @@ public static void SetRelativeSavePath(string newPath) {
736730
instance.convertToModelSavePath = NormalizePath(newPath, isRelative: true);
737731
}
738732

733+
public static string GetIntegrationSavePath()
734+
{
735+
return instance.IntegrationSavePath;
736+
}
737+
738+
public static void SetIntegrationSavePath(string newPath)
739+
{
740+
instance.IntegrationSavePath = newPath;
741+
}
742+
739743
/// <summary>
740744
/// Convert an absolute path into a relative path like what you would
741745
/// get from GetRelativeSavePath.

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,6 @@ private static string DefaultIntegrationSavePath
643643
}
644644
}
645645

646-
private static string LastIntegrationSavePath = DefaultIntegrationSavePath;
647-
648646
public static void InstallDCCIntegration ()
649647
{
650648
var dccExe = GetDCCExe ();
@@ -683,24 +681,7 @@ private static bool GetIntegrationFolder(DCCIntegration dcc){
683681
private static bool DecompressIntegrationZipFile(string zipPath, DCCIntegration dcc)
684682
{
685683
string unzipFolder;
686-
switch (Application.platform)
687-
{
688-
case RuntimePlatform.OSXEditor:
689-
unzipFolder = "/Applications/Autodesk";
690-
break;
691-
case RuntimePlatform.WindowsEditor:
692-
unzipFolder = "C:/Program Files/Autodesk";
693-
break;
694-
default:
695-
throw new System.NotImplementedException();
696-
}
697-
698-
// prompt user to enter location to unzip file IF THEY WANT TO BE PROMPTED/////
699-
unzipFolder = EditorUtility.OpenFolderPanel(string.Format("Select Location to Save {0} Integration", dcc.DccDisplayName),LastIntegrationSavePath,"");
700-
if (string.IsNullOrEmpty (unzipFolder)) {
701-
// user has cancelled, do nothing
702-
return false;
703-
}
684+
unzipFolder = EditorTools.ExportSettings.GetIntegrationSavePath();
704685

705686
// check that this is a valid location to unzip the file
706687
if (!DirectoryHasWritePermission (unzipFolder)) {
@@ -718,8 +699,6 @@ private static bool DecompressIntegrationZipFile(string zipPath, DCCIntegration
718699
}
719700
}
720701

721-
LastIntegrationSavePath = unzipFolder;
722-
723702
// if file already unzipped in this location, then prompt user
724703
// if they would like to continue unzipping or use what is there
725704
if (dcc.FolderAlreadyUnzippedAtPath (unzipFolder)) {

0 commit comments

Comments
 (0)