Exemplo n.º 1
0
 def setup(self):
     """
     default setup automatically builds a UI based on metadata
     """
     if self.__class__._attribData is None:
         self.__class__._attribData = core.getAttributeData(self._arnoldNodeType)
     for paramName, attrName, label, annotation in self._attribData:
         self.addControl(attrName,
                         label if label else prettify(paramName),
                         annotation)
Exemplo n.º 2
0
 def setup(self):
     """
     default setup automatically builds a UI based on metadata
     """
     if self.__class__._attribData is None:
         self.__class__._attribData = core.getAttributeData(
             self._arnoldNodeType)
     for paramName, attrName, label, annotation in self._attribData:
         self.addControl(attrName, label if label else prettify(paramName),
                         annotation)
Exemplo n.º 3
0
def registerAutoTranslatorUI(arnoldNode, mayaNodeType, translatorName='<built-in>', skipEmpty=False):
    """
    Utility function for automatically creating a translator UI template based on an arnold
    node type.
    """
    translatorName = str(translatorName) # doesn't like unicode
    # we query the attribute data up front instead of when the translator is initialized or setup
    # so that it is done when mtoa.cmds.registerArnoldRenderer is first  called and the Arnold
    # universe is already active. otherwise, successive calls to core.getAttributeData later on cause
    # the Arnold universe to repeatedly begin and end.
    attribs = core.getAttributeData(arnoldNode)
    if skipEmpty and not attribs:
        return
    cls = type('%s_%sTemplate' % (mayaNodeType, translatorName),
               (AutoTranslatorTemplate,),
               dict(_arnoldNodeType=arnoldNode,
                    _attribData = attribs))
    registerTranslatorUI(cls, mayaNodeType, translatorName)
Exemplo n.º 4
0
def registerAutoTranslatorUI(arnoldNode,
                             mayaNodeType,
                             translatorName='<built-in>',
                             skipEmpty=False):
    """
    Utility function for automatically creating a translator UI template based on an arnold
    node type.
    """
    translatorName = str(translatorName)  # doesn't like unicode
    # we query the attribute data up front instead of when the translator is initialized or setup
    # so that it is done when mtoa.cmds.registerArnoldRenderer is first  called and the Arnold
    # universe is already active. otherwise, successive calls to core.getAttributeData later on cause
    # the Arnold universe to repeatedly begin and end.
    attribs = core.getAttributeData(arnoldNode)
    if skipEmpty and not attribs:
        return
    cls = type('%s_%sTemplate' % (mayaNodeType, translatorName),
               (AutoTranslatorTemplate, ),
               dict(_arnoldNodeType=arnoldNode, _attribData=attribs))
    registerTranslatorUI(cls, mayaNodeType, translatorName)