Skip to content

Commit 0868d2c

Browse files
committed
use native function
1 parent 23070fd commit 0868d2c

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

Assets/Integrations/Autodesk/maya/scripts/unityCommands.mel

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,6 @@ proc string checkNamespaceNeedsUpdate(string $unitySet, string $unityFbxNamespac
129129
return $unityFbxNamespace;
130130
}
131131

132-
global proc string formValidObjectName(string $input)
133-
{
134-
string $output = "";
135-
for ($n = 1 ; $n < size($input)+1 ; $n++)
136-
{
137-
string $char = `substring $input $n $n`;
138-
// if starting with a number, add underscore before number
139-
if ($n == 1 && `match "[0-9]" $char` != "")
140-
$output += ("_"+$char);
141-
// if character is alphanumeric, or underscore, add character
142-
else if (`match "[a-zA-Z0-9\_]" $char` != "")
143-
$output += $char;
144-
// otherwise replace with underscore
145-
else
146-
$output += "_";
147-
}
148-
return $output;
149-
}
150-
151132
proc importFile(string $filePathStr){
152133
// get the global variables
153134
global string $UnityExportSets[];
@@ -173,7 +154,7 @@ proc importFile(string $filePathStr){
173154

174155
$fileNameWithoutExt = match("[^@]+", $fileNameWithoutExt);
175156
}
176-
$fileNameWithoutExt = formValidObjectName($fileNameWithoutExt);
157+
$fileNameWithoutExt = formValidObjectName($fileNameWithoutExt);
177158

178159
$unityExportSet = `format -stringArg $fileNameWithoutExt $UnityExportSetNameFormat`;
179160

0 commit comments

Comments
 (0)