Skip to content

Commit 38818d3

Browse files
authored
Merge pull request #95 from Unity-Technologies/UNI-22019-scene-export-set
Uni 22019 working scene remembers what to publish
2 parents 3065e50 + 40287f0 commit 38818d3

File tree

1 file changed

+17
-1
lines changed
  • Assets/Integrations/Autodesk/maya2017/scripts/unityOneClick

1 file changed

+17
-1
lines changed

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class BaseCommand(OpenMayaMPx.MPxCommand, LoggerMixin):
3939
def __init__(self):
4040
OpenMayaMPx.MPxCommand.__init__(self)
4141
LoggerMixin.__init__(self)
42+
self._exportSet = "UnityFbxExportSet"
4243

4344
def __del__(self):
4445
LoggerMixin.__del__(self)
@@ -84,9 +85,24 @@ def scriptCmd(cls):
8485
return
8586

8687
def doIt(self, args):
88+
# Gather everything that is in the scene
89+
origItemsInScene = maya.cmds.ls(tr=True, o=True, r=True)
90+
8791
strCmd = 'Import'
8892
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)
90106

91107
@classmethod
92108
def invoke(cls):

0 commit comments

Comments
 (0)