def add_custom_aov(self, *args): if self.renderer == "arnold": st.newAOVPrompt() elif self.renderer == "mentalRay": result = pm.promptDialog(button=[u'创建', u'取消'], defaultButton='Create', message=u'mentalRay aov', title=u'创建aov') if result == u'创建': new_aov = pm.promptDialog(query=1, text=1) self.add_mr_aov(new_aov)
def buildAOVFrame(self, nodeAttr): # TODO: move this into AttributeEditorTemplate self._setActiveNodeAttr(nodeAttr) nodeAttr = pm.Attribute(nodeAttr) aovList = aovs.getAOVs() self.updateNetworkData() self.updateCustomArrayData(nodeAttr, aovList) pm.setUITemplate('attributeEditorTemplate', pushTemplate=True) pm.cmds.frameLayout(label='AOVs', collapse=False) pm.cmds.columnLayout(adjustableColumn=True) pm.cmds.frameLayout(label='Surface Shader AOVs', collapse=False) pm.cmds.columnLayout(adjustableColumn=True) pm.cmds.rowLayout(nc=2) pm.cmds.text(label='') pm.cmds.button( label='AOV Browser', c=lambda *args: aoveditor.arnoldAOVBrowser( listAOVGroups=True, nodeTypes=self.networkNodeTypes)) pm.setParent('..') # rowLayout pm.cmds.frameLayout(labelVisible=False, collapsable=False) self.networkCol = pm.cmds.columnLayout(adjustableColumn=True) self.buildNetworkAOVs(nodeAttr, aovList) pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.cmds.frameLayout(label='Other AOVs', collapse=False) pm.cmds.columnLayout(adjustableColumn=True) pm.cmds.rowLayout(nc=2) pm.cmds.text(label='') pm.cmds.button(label='Add Custom', c=lambda *args: shaderTemplate.newAOVPrompt()) pm.setParent('..') # rowLayout pm.cmds.frameLayout(labelVisible=False, collapsable=False) self.otherCol = pm.cmds.columnLayout(adjustableColumn=True) self.buildOtherAOVs(nodeAttr, aovList) pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.setUITemplate('attributeEditorTemplate', popTemplate=True)
def buildAOVFrame(self, nodeAttr): # TODO: move this into AttributeEditorTemplate self._setActiveNodeAttr(nodeAttr) nodeAttr = pm.Attribute(nodeAttr) aovList = aovs.getAOVs() self.updateNetworkData() self.updateCustomArrayData(nodeAttr, aovList) pm.setUITemplate('attributeEditorTemplate', pushTemplate=True) pm.cmds.frameLayout(label='AOVs', collapse=False) pm.cmds.columnLayout(adjustableColumn=True) pm.cmds.frameLayout(label='Surface Shader AOVs', collapse=False) pm.cmds.columnLayout(adjustableColumn=True) pm.cmds.rowLayout(nc=2) pm.cmds.text(label='') pm.cmds.button(label='AOV Browser', c=lambda *args: aoveditor.arnoldAOVBrowser(listAOVGroups=True, nodeTypes=self.networkNodeTypes)) pm.setParent('..') # rowLayout pm.cmds.frameLayout(labelVisible=False, collapsable=False) self.networkCol = pm.cmds.columnLayout(adjustableColumn=True) self.buildNetworkAOVs(nodeAttr, aovList) pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.cmds.frameLayout(label='Other AOVs', collapse=False) pm.cmds.columnLayout(adjustableColumn=True) pm.cmds.rowLayout(nc=2) pm.cmds.text(label='') pm.cmds.button(label='Add Custom', c=lambda *args: shaderTemplate.newAOVPrompt()) pm.setParent('..') # rowLayout pm.cmds.frameLayout(labelVisible=False, collapsable=False) self.otherCol = pm.cmds.columnLayout(adjustableColumn=True) self.buildOtherAOVs(nodeAttr, aovList) pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.setParent('..') # columnLayout pm.setParent('..') # frameLayout pm.setUITemplate('attributeEditorTemplate', popTemplate=True)
def __init__(self, aovNode=None): self.waitingToRefresh = False self.aovControls = [] self.optionMenus = [] self.aovRows = {} self.renderOptions = aovs.AOVInterface() if aovNode is None else aovNode self.mainCol = pm.cmds.columnLayout('arnoldAOVMainColumn') # global drivers pm.cmds.frameLayout('arnoldDisplayDriverFrame', label='Default Drivers', width=WIDTH, collapsable=True, collapse=True) pm.cmds.columnLayout(adj=True) for attr in self.renderOptions.node.drivers: driver = attr.inputs() if driver: pm.cmds.rowLayout(nc=2, columnAttach2=['both', 'right'], adjustableColumn=1, rowAttach=[2, 'top', 5]) pm.cmds.columnLayout(adj=True) templates.createTranslatorMenu(driver[0], label=utils.prettify(driver[0].name()), nodeType='aiAOVDriver') pm.cmds.setParent('..') pm.cmds.symbolButton(image="navButtonConnected.png", command=Callback(pm.select, driver)) pm.cmds.setParent('..') pm.setParent(self.mainCol) pm.cmds.frameLayout('arnoldAOVBrowserFrame', label='AOV Browser', width=WIDTH, collapsable=True, collapse=False, height=200) self.browser = AOVBrowser(self.renderOptions) pm.setParent(self.mainCol) pm.cmds.frameLayout('arnoldAOVPrimaryFrame', label='AOVs', width=WIDTH, collapsable=True, collapse=False) self.aovCol = pm.cmds.columnLayout('arnoldAOVListColumn', adj=True) pm.cmds.rowLayout('arnoldAOVButtonRow', nc=3, columnWidth3=[140, 100, 100], columnAttach3=['right', 'both', 'both']) pm.cmds.text(label='') pm.cmds.button(label='Add Custom', c=lambda *args: shaderTemplate.newAOVPrompt()) pm.cmds.button(label='Delete All', c=lambda *args: (self.renderOptions.removeAOVs(self.aovRows.keys()), \ hooks.setupDefaultAOVs(self.renderOptions))) pm.setParent('..') # rowLayout pm.cmds.separator(style='in') pm.rowLayout(nc=4, columnWidth4=[130, 66, 80, 40], columnAttach4=['both', 'both', 'both', 'both']) pm.cmds.text(label='name') pm.cmds.text(label='data') pm.cmds.text(label='driver') pm.cmds.text(label='filter') pm.cmds.setParent('..') # rowLayout pm.cmds.separator(style='in') # pm.text(_uiName('prefixLbl'), align='center', label='Prefix', parent=form) # pm.textField(_uiName('prefixFld'), enable=False, text='', parent=form, changeCommand=Callback(setAOVPrefix, aovnode)) self.browser.populate() # add all control rows self.addRows() aovs.addAOVChangedCallback(self.refresh, 'aoveditor') # update AOV imageFormat of all rows when the default imageFormat changes. a scriptJob will suffice here pm.scriptJob(parent=self.aovCol, attributeChange=[self.renderOptions.node.imageFormat.name(), lambda *args: pm.evalDeferred(self.refresh)])
def __init__(self, aovNode=None): self.waitingToRefresh = False self.aovControls = [] self.optionMenus = [] self.aovRows = {} self.renderOptions = aovs.AOVInterface( ) if aovNode is None else aovNode self.mainCol = pm.cmds.columnLayout('arnoldAOVMainColumn') # global drivers pm.cmds.frameLayout('arnoldDisplayDriverFrame', label='Default Drivers', width=WIDTH, collapsable=True, collapse=True) pm.cmds.columnLayout(adj=True) for attr in self.renderOptions.node.drivers: driver = attr.inputs() if driver: pm.cmds.rowLayout(nc=2, columnAttach2=['both', 'right'], adjustableColumn=1, rowAttach=[2, 'top', 5]) pm.cmds.columnLayout(adj=True) templates.createTranslatorMenu(driver[0], label=utils.prettify( driver[0].name()), nodeType='aiAOVDriver') pm.cmds.setParent('..') pm.cmds.symbolButton(image="navButtonConnected.png", command=Callback(pm.select, driver)) pm.cmds.setParent('..') pm.setParent(self.mainCol) pm.cmds.frameLayout('arnoldAOVBrowserFrame', label='AOV Browser', width=WIDTH, collapsable=True, collapse=False, height=200) self.browser = AOVBrowser(self.renderOptions) pm.setParent(self.mainCol) pm.cmds.frameLayout('arnoldAOVPrimaryFrame', label='AOVs', width=WIDTH, collapsable=True, collapse=False) self.aovCol = pm.cmds.columnLayout('arnoldAOVListColumn', adj=True) pm.cmds.rowLayout('arnoldAOVButtonRow', nc=3, columnWidth3=[140, 100, 100], columnAttach3=['right', 'both', 'both']) pm.cmds.text(label='') pm.cmds.button(label='Add Custom', c=lambda *args: shaderTemplate.newAOVPrompt()) pm.cmds.button(label='Delete All', c=lambda *args: (self.renderOptions.removeAOVs(self.aovRows.keys()), \ hooks.setupDefaultAOVs(self.renderOptions))) pm.setParent('..') # rowLayout pm.cmds.separator(style='in') pm.rowLayout(nc=4, columnWidth4=[130, 66, 80, 40], columnAttach4=['both', 'both', 'both', 'both']) pm.cmds.text(label='name') pm.cmds.text(label='data') pm.cmds.text(label='driver') pm.cmds.text(label='filter') pm.cmds.setParent('..') # rowLayout pm.cmds.separator(style='in') # pm.text(_uiName('prefixLbl'), align='center', label='Prefix', parent=form) # pm.textField(_uiName('prefixFld'), enable=False, text='', parent=form, changeCommand=Callback(setAOVPrefix, aovnode)) self.browser.populate() # add all control rows self.addRows() aovs.addAOVChangedCallback(self.refresh, 'aoveditor') # update AOV imageFormat of all rows when the default imageFormat changes. a scriptJob will suffice here pm.scriptJob(parent=self.aovCol, attributeChange=[ self.renderOptions.node.imageFormat.name(), lambda *args: pm.evalDeferred(self.refresh) ])
def create_custom_aov(self): aov_name = st.newAOVPrompt() if aov_name: self.display_label.setText('<font color=#00FF00><b>//[OF] info: %s aov create successful!!!</b></font>' % aov_name[0]) else: self.display_label.setText('')