Exemple #1
0
    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)
                     ])
Exemple #2
0
    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)])
Exemple #3
0
def createArnoldSamplingSettings():

    pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
    pm.columnLayout(adjustableColumn=True)

    pm.text("textAASamples", font="smallBoldLabelFont", align="left")

    pm.text("textGISamples", font="smallBoldLabelFont", align="left")

    pm.text("textGlossySamples", font="smallBoldLabelFont", align="left")

    pm.text("textRefractionSamples", font="smallBoldLabelFont", align="left")

    pm.text("textTotalSamples", font="smallBoldLabelFont", align="left")

    pm.separator()

    pm.intSliderGrp(
        "ss_AA_samples",
        label="Camera (AA)",
        minValue=1,
        maxValue=10,
        fieldMinValue=-10,
        fieldMaxValue=100,
        cc=lambda *args: pm.evalDeferred(updateComputeSamples),
    )

    pm.connectControl("ss_AA_samples", "defaultArnoldRenderOptions.AASamples", index=1)
    pm.connectControl("ss_AA_samples", "defaultArnoldRenderOptions.AASamples", index=2)
    pm.connectControl("ss_AA_samples", "defaultArnoldRenderOptions.AASamples", index=3)

    pm.intSliderGrp(
        "ss_hemi_samples",
        label="Diffuse",
        maxValue=10,
        fieldMaxValue=100,
        cc=lambda *args: pm.evalDeferred(updateComputeSamples),
    )

    pm.connectControl("ss_hemi_samples", "defaultArnoldRenderOptions.GIDiffuseSamples", index=1)
    pm.connectControl("ss_hemi_samples", "defaultArnoldRenderOptions.GIDiffuseSamples", index=2)
    pm.connectControl("ss_hemi_samples", "defaultArnoldRenderOptions.GIDiffuseSamples", index=3)

    pm.intSliderGrp(
        "ss_glossy_samples",
        label="Glossy",
        maxValue=10,
        fieldMaxValue=100,
        cc=lambda *args: pm.evalDeferred(updateComputeSamples),
    )

    pm.connectControl("ss_glossy_samples", "defaultArnoldRenderOptions.GIGlossySamples", index=1)
    pm.connectControl("ss_glossy_samples", "defaultArnoldRenderOptions.GIGlossySamples", index=2)
    pm.connectControl("ss_glossy_samples", "defaultArnoldRenderOptions.GIGlossySamples", index=3)

    pm.intSliderGrp(
        "ss_refraction_samples",
        label="Refraction",
        maxValue=10,
        fieldMaxValue=100,
        cc=lambda *args: pm.evalDeferred(updateComputeSamples),
    )

    pm.connectControl("ss_refraction_samples", "defaultArnoldRenderOptions.GIRefractionSamples", index=1)
    pm.connectControl("ss_refraction_samples", "defaultArnoldRenderOptions.GIRefractionSamples", index=2)
    pm.connectControl("ss_refraction_samples", "defaultArnoldRenderOptions.GIRefractionSamples", index=3)

    pm.attrControlGrp("ss_sss_bssrdf_samples", label="SSS", attribute="defaultArnoldRenderOptions.sss_bssrdf_samples")

    pm.attrControlGrp(
        "ss_volume_indirect_samples",
        label="Volume Indirect",
        attribute="defaultArnoldRenderOptions.volume_indirect_samples",
    )

    pm.separator()

    pm.attrControlGrp(
        "ss_lock_sampling_noise",
        label="Lock Sampling Pattern",
        attribute="defaultArnoldRenderOptions.lock_sampling_noise",
    )

    pm.attrControlGrp(
        "ss_use_autobump",
        label="Use Autobump in SSS",
        attribute="defaultArnoldRenderOptions.sssUseAutobump",
        annotation="WARNING : Enabling this checkbox triples shader evaluations in SSS.",
    )

    pm.frameLayout(label="Clamping", collapse=True)

    pm.checkBoxGrp("ss_clamp_sample_values", cc=updateSamplingSettings, label="Clamp Sample Values")

    pm.connectControl("ss_clamp_sample_values", "defaultArnoldRenderOptions.use_sample_clamp", index=1)
    pm.connectControl("ss_clamp_sample_values", "defaultArnoldRenderOptions.use_sample_clamp", index=2)

    pm.checkBoxGrp("ss_clamp_sample_values_AOVs", cc=updateSamplingSettings, label="Affect AOVs")

    pm.connectControl("ss_clamp_sample_values_AOVs", "defaultArnoldRenderOptions.use_sample_clamp_AOVs", index=1)
    pm.connectControl("ss_clamp_sample_values_AOVs", "defaultArnoldRenderOptions.use_sample_clamp_AOVs", index=2)

    pm.attrControlGrp("ss_max_value", label="Max Value", attribute="defaultArnoldRenderOptions.AASampleClamp")

    pm.setParent("..")

    pm.frameLayout(label="Filter", collapse=True)

    createTranslatorMenu("defaultArnoldFilter", label="Type", nodeType="aiAOVFilter", default="gaussian")

    pm.setParent("..")
    pm.setParent("..")  # column layout

    pm.setUITemplate(popTemplate=True)
    updateArnoldFilterOptions()