Recently, a customer asked a question about creating UI for deformers. The deformer nodes in Maya are created with a table for deformer attributes e.g.,
But for deformer plugins, if you don’t have an AETemplate assigned for it, it looks like this, which is not as easy to understand and has extra, but unnecessary details…
The first thought is about reusing the AETemplates in scripts. Unfortunately, it wasn’t created with MEL and you can’t find it inside of scripts/AETemplates. AETemplate of some nodes in Maya were created with Python and Qt and stored inside Python/Lib/site-packages/maya/internal/nodes/morph.
import maya
maya.utils.loadStringResourcesForModule(__name__)
import maya.internal.common.ae.template as aetemplate
import maya.internal.nodes.weightgeometryfilter.ae_template as ae
import maya.cmds as cmds
class AETemplate(ae.AETemplate):
def buildUI(self, nodeName):
...
As you can see, it inherits from another AETemplate from weightgeometryfilter and the latter geometryfilter. All we want to do is to create our AETemplate based on geometryfilter template, like below:
import maya.internal.common.ae.template as aetemplate
import maya.internal.nodes.geometryfilter.ae_template as ae
class AETemplate(ae.AETemplate):
def buildUI(self, nodeName):
self.suppress('weightList')
super(AETemplate, self).buildUI(nodeName)
Save it to a place where Maya Python can load it as a package(e.g., site-packages), and create a __init__.py for it like below. My package name is myaetemplates and the module name is AEbasicMorphTemplate.
from . import AEbasicMorphTemplate
At last, we want to register for basicMorph node in Maya. To make things easier, we can use Flux, the UI library for Mash to register it.
import maya.app.flux.ae.api as loader
loader.registerTemplate('myaetemplates.AEbasicMorphTemplate.AETemplate', 'basicMorph')
Comments
You can follow this conversation by subscribing to the comment feed for this post.