File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed
Assets/Integrations/Autodesk/maya/scripts/unityOneClick Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -198,18 +198,23 @@ def doIt(self, args):
198
198
self ._tempName = None
199
199
self ._origItemsInScene = []
200
200
201
- callbackId = OpenMaya .MSceneMessage .addCheckFileCallback (OpenMaya .MSceneMessage .kBeforeImportCheck , self .beforeImport )
202
- callbackId2 = OpenMaya .MSceneMessage .addCallback (OpenMaya .MSceneMessage .kAfterImport , self .afterImport )
203
-
204
- strCmd = 'Import'
205
- self .displayDebug ('doIt {0}' .format (strCmd ))
206
- maya .cmds .Import ()
207
-
208
- OpenMaya .MMessage .removeCallback (callbackId )
209
- OpenMaya .MMessage .removeCallback (callbackId2 )
210
-
211
- if currWorkspace :
212
- maya .cmds .workspace (currWorkspace , o = True )
201
+ callbackId = None
202
+ callbackId2 = None
203
+ try :
204
+ callbackId = OpenMaya .MSceneMessage .addCheckFileCallback (OpenMaya .MSceneMessage .kBeforeImportCheck , self .beforeImport )
205
+ callbackId2 = OpenMaya .MSceneMessage .addCallback (OpenMaya .MSceneMessage .kAfterImport , self .afterImport )
206
+
207
+ strCmd = 'Import'
208
+ self .displayDebug ('doIt {0}' .format (strCmd ))
209
+ maya .cmds .Import ()
210
+ finally :
211
+ if currWorkspace :
212
+ maya .cmds .workspace (currWorkspace , o = True )
213
+
214
+ if callbackId :
215
+ OpenMaya .MMessage .removeCallback (callbackId )
216
+ if callbackId2 :
217
+ OpenMaya .MMessage .removeCallback (callbackId2 )
213
218
214
219
@classmethod
215
220
def invoke (cls ):
You can’t perform that action at this time.
0 commit comments