Skip to content

Commit 94b2640

Browse files
committed
WIP try to find or create file before failing
1 parent 76a3690 commit 94b2640

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Integrations/Autodesk/maya/scripts/unityCommands.mel

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ global string $UnityFbxAnimFileNameAttr = "unityFbxAnimFileName";
55
global string $UnityFbxNamespaceAttr = "unityFbxNamespace";
66
global string $UnityExportSetNameFormat = "^1s_UnityExportSet";
77

8+
// global string $UnityModuleName = "UnityFbxForMaya";
9+
10+
global string $UnityDefaultImportSettingsFileName = "unityFbxImportSettings.mel";
11+
global string $UnityDefaultExportSettingsFileName = "unityFbxExportSettings.mel";
12+
813
global int $UnityFbxFilePathIndex = 0;
914
global int $UnityFbxFileNameIndex = 1;
1015
global int $UnityFbxAnimFilePathIndex = 2;
@@ -28,9 +33,12 @@ global proc unityRemoveNativeMenuOnLoad(){
2833
proc int loadUnityFbxSettings(string $fileName, string $settingType){
2934
// check if the file exists
3035
if (`file -q -ex $fileName` == false){
31-
error ("Failed to find Unity Fbx "+$settingType+" Settings at: " + $fileName);
32-
return false;
36+
//error ("Failed to find Unity Fbx "+$settingType+" Settings at: " + $fileName);
37+
//return false;
38+
39+
// create file with default settings
3340
}
41+
3442
eval ("source \"" + $fileName + "\"");
3543
return true;
3644
}
@@ -46,6 +54,14 @@ proc int loadUnityFbxExportSettings(){
4654
// Load the Import Settings from a file
4755
proc int loadUnityFbxImportSettings(){
4856
$fileName = `optionVar -q "UnityFbxImportSettings"`;
57+
58+
// if no filename set (optionVar cleared), reset it to default filename
59+
if ($fileName == 0){
60+
//$modulePath = `moduleInfo -moduleName $UnityModuleName -path`;
61+
// {$modulePath}/scripts/{$UnityDefaultImportSettingsFileName}
62+
63+
}
64+
4965
return loadUnityFbxSettings($fileName, "Import");
5066
}
5167

0 commit comments

Comments
 (0)