Preview:
# -- 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'))
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter