Actually⌠watch this:
nodes = cmds.ls(type='mesh', noIntermediate=True)
with pyblish_maya.maintained_selection():
cmds.select(nodes)
nodes = cmds.file(exportSelected=True,
preview=True,
constructionHistory=False,
constraints=False,
expressions=False,
channels=False,
shader=False,
force=True)
print nodes
# [u'myTesting_GEOShape', u'myTesting_GEO', u'test_GRP', u'oh_no']
with pyblish_maya.maintained_selection():
cmds.select(nodes)
nodes = cmds.file(exportSelected=True,
preview=True,
constructionHistory=False,
constraints=False,
expressions=False,
channels=False,
shader=False,
force=True)
print nodes
# [u'myTesting_GEOShape', u'myTesting_GEO', u'test_GRP', u'polySurfaceShape1', u'oh_my', u'so', u'nasty_', u'oh_no']
Doesnât help much either.
This would actually be much more succesfull with the wrapper we had around the exporter. I quickly added a preview
argument for it in my latest commit so it behaves closely like cmds.file
.
A test-run:
import pyblish_magenta.utils.maya.exporter as exporter
nodes = cmds.ls(type='mesh', noIntermediate=True)
nodes = exporter.MayaExporter.export(nodes=nodes,
constructionHistory=False,
expressions=False,
channels=False,
constraints=False,
displayLayers=False,
objectSets=False,
shader=False,
includeChildren=False,
preview=True)
print nodes
# [u'myTesting_GEOShape', u'myTesting_GEO', u'test_GRP', u'polySurfaceShape1']
nodes = exporter.MayaExporter.export(nodes=nodes,
constructionHistory=False,
expressions=False,
channels=False,
constraints=False,
displayLayers=False,
objectSets=False,
shader=False,
includeChildren=False,
preview=True)
print nodes
# [u'myTesting_GEOShape', u'myTesting_GEO', u'test_GRP', u'polySurfaceShape1']
What do you think?
Might even give it an argument like neverExpand
, soloNodes
or whatever you would call it so to make it never export anything outside of the set of nodes given, basically overriding the other arguments of the function! This could make the final extractor of the scene:
exporter.MayaExporter.export(path='C:/test.ma',
nodes=nodes,
neverExpand=True)
Itâs an exporter that gives us much more control on the Extraction, and now with the same feedback as the regular cmds.file
command.