File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Assets/Integrations/Autodesk/maya2017/scripts/unityOneClick Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ class BaseCommand(OpenMayaMPx.MPxCommand, LoggerMixin):
39
39
def __init__ (self ):
40
40
OpenMayaMPx .MPxCommand .__init__ (self )
41
41
LoggerMixin .__init__ (self )
42
+ self ._exportSet = "UnityFbxExportSet"
42
43
43
44
def __del__ (self ):
44
45
LoggerMixin .__del__ (self )
@@ -84,9 +85,24 @@ def scriptCmd(cls):
84
85
return
85
86
86
87
def doIt (self , args ):
88
+ # Gather everything that is in the scene
89
+ origItemsInScene = maya .cmds .ls (tr = True , o = True , r = True )
90
+
87
91
strCmd = 'Import'
88
92
self .displayDebug ('doIt {0}' .format (strCmd ))
89
- maya .mel .eval (strCmd )
93
+ result = maya .cmds .Import ()
94
+
95
+ # figure out what has been added after import
96
+ itemsInScene = maya .cmds .ls (tr = True , o = True , r = True )
97
+ newItems = list (set (itemsInScene ) - set (origItemsInScene ))
98
+
99
+ # Get or create the Unity Fbx Export Set
100
+ allSets = maya .cmds .listSets (allSets = True )
101
+ if not self ._exportSet in allSets :
102
+ # couldn't find export set so create it
103
+ maya .cmds .sets (name = self ._exportSet )
104
+
105
+ maya .cmds .sets (newItems , add = self ._exportSet )
90
106
91
107
@classmethod
92
108
def invoke (cls ):
You can’t perform that action at this time.
0 commit comments