Skip to content

Commit 5ca7f59

Browse files
committed
code review fixes
added comments + renamed variables
1 parent 4b6e259 commit 5ca7f59

File tree

3 files changed

+29
-24
lines changed

3 files changed

+29
-24
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,14 @@ public static string GetTempSavePath()
251251
return System.IO.Path.Combine(Application.dataPath, FbxExporters.Review.TurnTable.TempSavePath).Replace("\\", "/");
252252
}
253253

254+
/// <summary>
255+
/// Gets the path to the export settings file.
256+
/// Returns an absolute path with forward slashes as path separators.
257+
/// </summary>
258+
/// <returns>The export settings path.</returns>
254259
public static string GetExportSettingsPath()
255260
{
256-
return System.IO.Path.Combine (Application.dataPath,
257-
FBX_EXPORT_SETTINGS_PATH).Replace ("\\", "/");
261+
return Application.dataPath + '/' + FBX_EXPORT_SETTINGS_PATH;
258262
}
259263

260264
public static string GetPackageVersion()

Assets/Integrations/Autodesk/maya2017/scripts/unityFbxExportSettings.mel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// FBX file format
2+
FBXExportInAscii -v false;
3+
FBXExportFileVersion -v FBX201600;
4+
15
// Geometry
26
FBXExportSmoothingGroups -v false;
37
FBXExportTangents -v false;
@@ -28,7 +32,7 @@ FBXExportApplyConstantKeyReducer -v false;
2832

2933
// Geometry Cache File(s)
3034
FBXExportCacheFile -v false;
31-
//FBXExportQuickSelectSetAsCache v "";
35+
//FBXExportQuickSelectSetAsCache -v "";
3236

3337
// Constraints
3438
FBXExportConstraints -v false;
@@ -49,10 +53,6 @@ FBXExportUpAxis y;
4953

5054
FBXExportGenerateLog -v true;
5155

52-
// FBX file format
53-
FBXExportInAscii -v false;
54-
FBXExportFileVersion -v FBX201600;
55-
5656
// Misc
5757
FBXExportHardEdges -v false;
5858
FBXExportAxisConversionMethod none;

Assets/Integrations/Autodesk/maya2017/scripts/unityOneClick/commands.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434

3535
import os
3636

37-
UNITY_FBX_FILE_PATH = None
38-
UNITY_FBX_FILE_NAME = None
37+
# Global variables set on import, to be used for publishing.
38+
# The variables are set in the afterImport function (a callback for OpenMaya.MSceneMessage.kAfterImport)
39+
# in the importCmd class, and used by the publishCmd.doIt() function.
40+
unity_fbx_file_path = None
41+
unity_fbx_file_name = None
3942

4043
class BaseCommand(OpenMayaMPx.MPxCommand, LoggerMixin):
4144
"""
@@ -65,14 +68,12 @@ def loadUnityFbxExportSettings(self):
6568
"""
6669
Load the Export Settings from file
6770
"""
68-
file = maya.cmds.optionVar(q="UnityFbxExportSettings")
69-
#unityProjectPath = maya.cmds.optionVar(q='UnityProject')
70-
#file = unityProjectPath + "/Integrations/Autodesk/maya2017/scripts/unityFbxExportSettings.mel"
71-
if not os.path.isfile(file):
72-
maya.cmds.error("Failed to find Unity Fbx Export Settings at: {0}".format(file))
71+
fileName = maya.cmds.optionVar(q="UnityFbxExportSettings")
72+
if not os.path.isfile(fileName):
73+
maya.cmds.error("Failed to find Unity Fbx Export Settings at: {0}".format(fileName))
7374
return False
7475

75-
with open(file) as f:
76+
with open(fileName) as f:
7677
contents = f.read()
7778

7879
maya.mel.eval(contents)
@@ -117,10 +118,10 @@ def beforeImport(self, retCode, file, clientData):
117118
self._tempName = file.resolvedName()
118119

119120
def afterImport(self, *args, **kwargs):
120-
global UNITY_FBX_FILE_PATH
121-
global UNITY_FBX_FILE_NAME
122-
UNITY_FBX_FILE_PATH = self._tempPath
123-
UNITY_FBX_FILE_NAME = self._tempName
121+
global unity_fbx_file_path
122+
global unity_fbx_file_name
123+
unity_fbx_file_path = self._tempPath
124+
unity_fbx_file_name = self._tempName
124125

125126
def doIt(self, args):
126127
self.loadDependencies()
@@ -133,7 +134,7 @@ def doIt(self, args):
133134

134135
# Gather everything that is in the scene
135136
origItemsInScene = maya.cmds.ls(tr=True, o=True, r=True)
136-
137+
137138
strCmd = 'Import'
138139
self.displayDebug('doIt {0}'.format(strCmd))
139140
result = maya.cmds.Import()
@@ -275,10 +276,10 @@ def doIt(self, args):
275276
if not self.loadUnityFbxExportSettings():
276277
return
277278

278-
global UNITY_FBX_FILE_PATH
279-
global UNITY_FBX_FILE_NAME
280-
if UNITY_FBX_FILE_PATH and UNITY_FBX_FILE_NAME:
281-
strCmd = r'file -force -options "" -typ "FBX export" -pr -es "{0}{1}"'.format(UNITY_FBX_FILE_PATH, UNITY_FBX_FILE_NAME);
279+
global unity_fbx_file_path
280+
global unity_fbx_file_name
281+
if unity_fbx_file_path and unity_fbx_file_name:
282+
strCmd = r'file -force -options "" -typ "FBX export" -pr -es "{0}{1}"'.format(unity_fbx_file_path, unity_fbx_file_name);
282283
else:
283284
strCmd = 'SendToUnitySelection'
284285
self.displayDebug('doIt {0}'.format(strCmd))

0 commit comments

Comments
 (0)