Skip to content

Commit 3ab807a

Browse files
committed
fix wording + log which files got updated
1 parent c905772 commit 3ab807a

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,23 +190,29 @@ public override void OnInspectorGUI() {
190190

191191
var repairMissingScripts = new GUIContent (
192192
"Run Component Updater",
193-
"Repair missing FbxPrefab scripts in text assets");
193+
"If the forum package 1.1.0b1 was previously installed, then links to the FbxPrefab component in your assets will need updating." +
194+
" Run this button to update all FbxPrefab references in your text serialized prefabs and scene files.");
195+
194196
if (GUILayout.Button (repairMissingScripts)) {
195197
var componentUpdater = new FbxExporters.Editor.RepairMissingScripts ();
196198
var filesToRepairCount = componentUpdater.GetAssetsToRepairCount ();
199+
var dialogTitle = "FBX Exporter Component Updater";
197200
if (filesToRepairCount > 0) {
198-
bool result = UnityEditor.EditorUtility.DisplayDialog ("Component Updater",
199-
string.Format("Found {0} text assets with components requiring update.\n\n" +
201+
bool result = UnityEditor.EditorUtility.DisplayDialog (dialogTitle,
202+
string.Format("Found {0} text asset(s) with components requiring update.\n\n" +
200203
"If you choose 'Go Ahead', the components in these text serialized assets " +
201204
"will be automatically updated to work with the latest FBX exporter.\n" +
202205
"You should make a backup before proceeding.", filesToRepairCount),
203206
"I Made a Backup. Go Ahead!", "No Thanks");
204207
if (result) {
205208
componentUpdater.ReplaceGUIDInTextAssets ();
209+
} else {
210+
var assetsToRepair = componentUpdater.GetAssetsToRepair ();
211+
Debug.LogFormat ("Failed to update the FbxPrefab components in the following files: {0}", string.Join (", ", assetsToRepair));
206212
}
207213
} else {
208-
UnityEditor.EditorUtility.DisplayDialog ("Component Updater",
209-
"Couldn't find any text assets requiring update", "Ok");
214+
UnityEditor.EditorUtility.DisplayDialog (dialogTitle,
215+
"Couldn't find any text assets that require updating", "Ok");
210216
}
211217
}
212218

Assets/FbxExporters/Editor/FbxExporterRepairMissingScripts.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,28 @@ private static string CurrentPackageSearchID {
3838
}
3939

4040
private string[] m_assetsToRepair;
41+
private string[] AssetsToRepair{
42+
get{
43+
if (m_assetsToRepair == null) {
44+
m_assetsToRepair = FindAssetsToRepair ();
45+
}
46+
return m_assetsToRepair;
47+
}
48+
}
4149

4250
public RepairMissingScripts(){
43-
m_assetsToRepair = GetAssetsToRepair ();
51+
4452
}
4553

4654
public int GetAssetsToRepairCount(){
47-
return (m_assetsToRepair != null) ? m_assetsToRepair.Length : 0;
55+
return AssetsToRepair.Length;
56+
}
57+
58+
public string[] GetAssetsToRepair(){
59+
return AssetsToRepair;
4860
}
4961

50-
public static string[] GetAssetsToRepair()
62+
public static string[] FindAssetsToRepair()
5163
{
5264
// search project for assets containing old GUID
5365

@@ -97,12 +109,8 @@ private static bool AssetNeedsRepair(string filePath)
97109

98110
public bool ReplaceGUIDInTextAssets ()
99111
{
100-
if (m_assetsToRepair == null) {
101-
return false;
102-
}
103-
104112
bool replacedGUID = false;
105-
foreach (string file in m_assetsToRepair) {
113+
foreach (string file in AssetsToRepair) {
106114
replacedGUID |= ReplaceGUIDInFile (file);
107115
}
108116
if (replacedGUID) {
@@ -154,6 +162,8 @@ private static bool ReplaceGUIDInFile (string path)
154162
if (modified) {
155163
File.Delete (path);
156164
File.Move (tmpFile, path);
165+
166+
Debug.LogFormat("Updated FbxPrefab components in file {0}", path);
157167
return true;
158168
} else {
159169
File.Delete (tmpFile);

0 commit comments

Comments
 (0)