Basic Exporter Template with Python; Part 5
Tue Nov 08 2022 14:15:23 GMT+0000 (UTC)
Saved by
@MaVCArt
#python
# -- Assuming "base_exporter.py" exists in sys.path
from base_exporter import ExporterBase
# -- import the modules we will need to acquire our mesh, and export it
import pymel.core as pm
class BasicMayaMeshExporter(ExporterBase):
def validate():
# -- get all meshes that conform to the name given in the options, under the "mesh_name" key
mesh = pm.ls(self.options.get('mesh_name'), geometry=True, sl=False)
# -- fail the export process if no such meshes exist
if not len(mesh):
return False
# -- if they do, continue the export process. This exporter does not enfoce the mesh name to be unique.
return True
def export():
# -- acquire the meshes and select them
meshes = pm.ls(self.options.get('mesh_name'), geometry=True, sl=True)
# -- perform the export
pm.exportSelected(self.options.get('export_path'))
content_copyCOPY
Comments