@@ -38,8 +38,11 @@ public class ModelExporter : System.IDisposable
38
38
39
39
const char MayaNamespaceSeparator = ':' ;
40
40
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 = "]" ;
43
46
44
47
/// <summary>
45
48
/// Create instance of example
@@ -244,7 +247,7 @@ public void ExportTexture (Material unityMaterial, string unityPropName,
244
247
/// <summary>
245
248
/// Get the color of a material, or grey if we can't find it.
246
249
/// </summary>
247
- public FbxDouble3 ? GetMaterialColor ( Material unityMaterial , string unityPropName , float defaultValue = 1 )
250
+ public FbxDouble3 GetMaterialColor ( Material unityMaterial , string unityPropName , float defaultValue = 1 )
248
251
{
249
252
if ( ! unityMaterial ) {
250
253
return new FbxDouble3 ( defaultValue ) ;
@@ -1079,7 +1082,10 @@ private static string ConvertToMayaCompatibleName(string name)
1079
1082
1080
1083
public static string ConvertToValidFilename ( string filename )
1081
1084
{
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
+ ) ;
1083
1089
}
1084
1090
}
1085
1091
}
0 commit comments