Skip to content

Commit 0484de4

Browse files
committed
remove ConvertToValidFilename from ConvertToModel
using the one in FbxExporter instead
1 parent 94bb32c commit 0484de4

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

Assets/FbxExporters/Editor/ConvertToModel.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public class ConvertToModel : System.IDisposable
2121
const string MenuItemName1 = "Assets/Convert To Model";
2222
const string MenuItemName2 = "GameObject/Convert To Model";
2323

24-
const string RegexCharStart = "[";
25-
const string RegexCharEnd = "]";
26-
2724
/// <summary>
2825
/// Clean up this class on garbage collection
2926
/// </summary>
@@ -140,12 +137,6 @@ private static List<GameObject> OnConvertInPlace (GameObject [] unityActiveGOs)
140137
return result;
141138
}
142139

143-
private static string ConvertToValidFilename(string filename)
144-
{
145-
return System.Text.RegularExpressions.Regex.Replace (filename,
146-
RegexCharStart + new string(Path.GetInvalidFileNameChars()) + RegexCharEnd, "_");
147-
}
148-
149140
private static void SetupImportedGameObject(GameObject orig, GameObject imported)
150141
{
151142
Transform importedTransform = imported.transform;

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ public class ModelExporter : System.IDisposable
3838

3939
const char MayaNamespaceSeparator = ':';
4040

41-
// replace invalid chars with this string
42-
const string InvalidCharReplacement = "_";
41+
// replace invalid chars with this one
42+
const char InvalidCharReplacement = '_';
43+
44+
const string RegexCharStart = "[";
45+
const string RegexCharEnd = "]";
4346

4447
/// <summary>
4548
/// Create instance of example
@@ -244,7 +247,7 @@ public void ExportTexture (Material unityMaterial, string unityPropName,
244247
/// <summary>
245248
/// Get the color of a material, or grey if we can't find it.
246249
/// </summary>
247-
public FbxDouble3? GetMaterialColor (Material unityMaterial, string unityPropName, float defaultValue = 1)
250+
public FbxDouble3 GetMaterialColor (Material unityMaterial, string unityPropName, float defaultValue = 1)
248251
{
249252
if (!unityMaterial) {
250253
return new FbxDouble3(defaultValue);
@@ -1079,7 +1082,10 @@ private static string ConvertToMayaCompatibleName(string name)
10791082

10801083
public static string ConvertToValidFilename(string filename)
10811084
{
1082-
return System.Text.RegularExpressions.Regex.Replace (filename, "[" + new string(Path.GetInvalidFileNameChars()) + "]", InvalidCharReplacement);
1085+
return System.Text.RegularExpressions.Regex.Replace (filename,
1086+
RegexCharStart + new string(Path.GetInvalidFileNameChars()) + RegexCharEnd,
1087+
InvalidCharReplacement.ToString()
1088+
);
10831089
}
10841090
}
10851091
}

0 commit comments

Comments
 (0)