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)
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)
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)
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)