@@ -238,108 +238,6 @@ def invoke(cls):
238
238
strCmd = '{0};' .format (cls .kCmdName )
239
239
maya .mel .eval (strCmd ) # @UndefinedVariable
240
240
241
- class previewCmd (BaseCommand ):
242
- """
243
- Preview Model in Unity Window
244
-
245
- @ingroup UnityCommands
246
- """
247
- kIconPath = "preview.png"
248
- kLabel = 'Preview Model in Unity window'
249
- kShortLabel = 'Preview'
250
- kCmdName = "{}Preview" .format (version .pluginPrefix ())
251
- kScriptCommand = 'import maya.cmds;maya.cmds.{0}()' .format (kCmdName )
252
- kRuntimeCommand = "UnityOneClickPreview"
253
-
254
- def __init__ (self ):
255
- super (self .__class__ , self ).__init__ ()
256
-
257
- @classmethod
258
- def creator (cls ):
259
- return OpenMayaMPx .asMPxPtr (cls ())
260
-
261
- @classmethod
262
- def syntaxCreator (cls ):
263
- syntax = OpenMaya .MSyntax ()
264
- return syntax
265
-
266
- @classmethod
267
- def scriptCmd (cls ):
268
- return
269
-
270
- def doIt (self , args ):
271
-
272
- unityAppPath = maya .cmds .optionVar (q = 'UnityApp' )
273
- unityProjectPath = maya .cmds .optionVar (q = 'UnityProject' )
274
- unityTempSavePath = os .path .join (unityProjectPath , "Assets" , maya .cmds .optionVar (q = 'UnityTempSavePath' ))
275
- unityCommand = "FbxExporters.Review.TurnTable.LastSavedModel"
276
- if maya .cmds .optionVar (exists = 'UnityInstructionPath' ):
277
- instructionFile = os .path .join (unityProjectPath , "Assets" , maya .cmds .optionVar (q = 'UnityInstructionPath' ))
278
- else :
279
- self .displayError ("Missing Unity instruction file path, please re-install integration." )
280
- return
281
-
282
- # make sure the GamePipeline and fbxmaya plugins are loaded
283
- if not self .loadDependencies ():
284
- return
285
-
286
- if not self .loadUnityFbxExportSettings ():
287
- return
288
-
289
- # select the export set for export, if it exists,
290
- # otherwise take what is currently selected
291
- origSelection = maya .cmds .ls (sl = True )
292
- if self .setExists (self ._exportSet ):
293
- maya .cmds .select (self ._exportSet , r = True , ne = True )
294
-
295
- # save fbx to Assets/_safe_to_delete/
296
- savePath = unityTempSavePath
297
- maya .cmds .sysFile (savePath , makeDir = True )
298
- savePath = os .path .join (savePath , "TurnTableModel.fbx" )
299
- savePath = os .path .abspath (savePath )
300
-
301
- maya .cmds .file (savePath , force = True , options = "" , typ = "FBX export" , pr = True , es = True )
302
-
303
- # create temp file in _safe_to_delete/
304
- with open (instructionFile ,"w+" ) as f :
305
- pass
306
-
307
- if maya .cmds .about (macOS = True ):
308
- # Use 'open -a' to bring app to front if it has already been started.
309
- # Note that the unity command will not get called.
310
- melCommand = r'system("open -a \"{0}\" --args -projectPath \"{1}\" -executeMethod {2}");' \
311
- .format (unityAppPath , unityProjectPath , unityCommand )
312
-
313
- elif maya .cmds .about (linux = True ):
314
- melCommand = r'system("\"{0}\" -projectPath \"{1}\" -executeMethod {2}");' \
315
- .format (unityAppPath , unityProjectPath , unityCommand )
316
-
317
- elif maya .cmds .about (windows = True ):
318
- melCommand = r'system("start \"{0}\" \"{1}\" \"{2}\" \"-projectPath {3} -executeMethod {4}\"");' \
319
- .format (unityProjectPath + "/Assets/FbxExporters/Integrations/BringToFront.exe" ,
320
- os .path .basename (unityProjectPath ), unityAppPath ,
321
- unityProjectPath , unityCommand )
322
-
323
- else :
324
- raise NotImplementedError ("missing platform implementation for {0}" .format (maya .cmds .about (os = True )))
325
-
326
- self .displayDebug ('doIt({0})' .format (melCommand ))
327
-
328
- maya .mel .eval (melCommand )
329
-
330
- if origSelection :
331
- maya .cmds .select (cl = True )
332
- maya .cmds .select (origSelection , add = True , ne = True )
333
-
334
- @classmethod
335
- def invoke (cls ):
336
- """
337
- Invoke command using mel so that it is executed and logged to script editor log
338
- @return: void
339
- """
340
- strCmd = '{0};' .format (cls .kCmdName )
341
- maya .mel .eval (strCmd ) # @UndefinedVariable
342
-
343
241
class exportCmd (BaseCommand ):
344
242
"""
345
243
Export Model to Unity
@@ -407,62 +305,14 @@ def invoke(cls):
407
305
strCmd = '{0};' .format (cls .kCmdName )
408
306
maya .mel .eval (strCmd ) # @UndefinedVariable
409
307
410
- class configureCmd (BaseCommand ):
411
- """
412
- Configure Maya Scene for previewing and exporting to Unity
413
-
414
- @ingroup UnityCommands
415
- """
416
- kLabel = 'Configure Maya to preview and export to a Unity Project'
417
- kShortLabel = 'Configure'
418
- kCmdName = "{}Configure" .format (version .pluginPrefix ())
419
- kScriptCommand = 'import maya.cmds;maya.cmds.{0}()' .format (kCmdName )
420
- kRuntimeCommand = "UnityOneClickConfigure"
421
-
422
- def __init__ (self ):
423
- super (self .__class__ , self ).__init__ ()
424
-
425
- @classmethod
426
- def creator (cls ):
427
- return OpenMayaMPx .asMPxPtr (cls ())
428
-
429
- @classmethod
430
- def syntaxCreator (cls ):
431
- syntax = OpenMaya .MSyntax ()
432
- return syntax
433
-
434
- @classmethod
435
- def scriptCmd (cls ):
436
- return
437
-
438
- def doIt (self , args ):
439
- # make sure the GamePipeline plugin is loaded
440
- if not self .loadDependencies ():
441
- return
442
-
443
- strCmd = 'SendToUnitySetProject'
444
- self .displayDebug ('doIt {0}' .format (strCmd ))
445
- maya .mel .eval (strCmd )
446
-
447
- @classmethod
448
- def invoke (cls ):
449
- """
450
- Invoke command using mel so that it is executed and logged to script editor log
451
- @return: void
452
- """
453
- strCmd = '{0};' .format (cls .kCmdName )
454
- maya .mel .eval (strCmd ) # @UndefinedVariable
455
-
456
308
def register (pluginFn ):
457
309
"""
458
310
Register commands for plugin
459
311
@param pluginFn (MFnPlugin): plugin object passed to initializePlugin
460
312
"""
461
313
pluginFn .registerCommand (importCmd .kCmdName , importCmd .creator , importCmd .syntaxCreator )
462
- pluginFn .registerCommand (previewCmd .kCmdName , previewCmd .creator , previewCmd .syntaxCreator )
463
314
pluginFn .registerCommand (exportCmd .kCmdName , exportCmd .creator , exportCmd .syntaxCreator )
464
- pluginFn .registerCommand (configureCmd .kCmdName , configureCmd .creator , configureCmd .syntaxCreator )
465
-
315
+
466
316
return
467
317
468
318
def unregister (pluginFn ):
@@ -471,9 +321,7 @@ def unregister(pluginFn):
471
321
@param pluginFn (MFnPlugin): plugin object passed to uninitializePlugin
472
322
"""
473
323
pluginFn .deregisterCommand (importCmd .kCmdName )
474
- pluginFn .deregisterCommand (previewCmd .kCmdName )
475
324
pluginFn .deregisterCommand (exportCmd .kCmdName )
476
- pluginFn .deregisterCommand (configureCmd .kCmdName )
477
325
return
478
326
479
327
#===============================================================================
@@ -502,23 +350,13 @@ class importCmdTestCase(BaseCmdTest):
502
350
"""
503
351
__cmd__ = importCmd
504
352
505
- class previewCmdTestCase (BaseCmdTest ):
506
- """UnitTest for testing the previewCmd command
507
- """
508
- __cmd__ = previewCmd
509
-
510
353
class exportCmdTestCase (BaseCmdTest ):
511
354
"""UnitTest for testing the exportCmd command
512
355
"""
513
356
__cmd__ = exportCmd
514
357
515
- class configureCmdTestCase (BaseCmdTest ):
516
- """UnitTest for testing the configureCmd command
517
- """
518
- __cmd__ = configureCmd
519
-
520
358
# NOTE: update this for test discovery
521
- test_cases = (importCmdTestCase , previewCmdTestCase , exportCmdTestCase , configureCmdTestCase ,)
359
+ test_cases = (importCmdTestCase , exportCmdTestCase ,)
522
360
523
361
def load_tests (loader , tests , pattern ):
524
362
suite = unittest .TestSuite ()
0 commit comments