Skip to content

Commit 0e1ed9a

Browse files
committed
set Unity project as workspace on Import
switch back to prev workspace once import complete
1 parent 44bd834 commit 0e1ed9a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ global proc configureUnityOneClick(
88
optionVar -stringValue "UnityTempSavePath" $unityTempSavePath;
99
optionVar -stringValue "UnityFbxExportSettings" $unityFbxExportSettings;
1010
optionVar -intValue "UnityOneClick_Headless" $headless;
11-
12-
// set project as the current workspace
13-
workspace -o $unityProject;
1411

1512
// configure auto load of plugin
1613
if (`pluginInfo -q -loaded unityOneClickPlugin` == false)

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ def afterImport(self, *args, **kwargs):
177177

178178
def doIt(self, args):
179179
self.loadDependencies()
180+
181+
# set Unity project as the current workspace
182+
currWorkspace = maya.cmds.workspace(o=True, q=True)
183+
unityProject = maya.cmds.optionVar(q='UnityProject')
184+
if unityProject:
185+
maya.cmds.workspace(unityProject, o=True)
180186

181187
self._tempPath = None
182188
self._tempName = None
@@ -191,6 +197,9 @@ def doIt(self, args):
191197

192198
OpenMaya.MMessage.removeCallback(callbackId)
193199
OpenMaya.MMessage.removeCallback(callbackId2)
200+
201+
if currWorkspace:
202+
maya.cmds.workspace(currWorkspace, o=True)
194203

195204
@classmethod
196205
def invoke(cls):

0 commit comments

Comments
 (0)