Example #1
0
    def targetSelected(self):
        sel = selected()
        targetIndex = self.targets.getSelectIndexedItem()
        if not targetIndex:
            return

        i = targetIndex[0] - 1

        targets = space.getTargetInfo(sel[0])
        targetConstraints = space._targetInfoConstraints[:]

        self.clearMultiTarget()
        if targets[i].type in [
                space.Mode.MULTI_PARENT, space.Mode.MULTI_ORIENT
        ]:

            with rowColumnLayout(nc=2, p=self.multiUI):
                state = space.serializeSpaces(sel[0])[i]

                weights = targetConstraints[i].getWeightAliasList()

                for t_i, (target, val) in enumerate(
                        zip(state['targets'], state['extra'])):
                    text(l=target[0])  # target is a pair, name and cardpath
                    f = floatField(v=val, min=0, max=1)
                    connectControl(f, weights[t_i])
Example #2
0
    def selected_ar_channel(self):
        u"""选择AR通道

        :return:
        """
        current_channel = pm.optionMenuGrp(self.ar_channel_options,
                                           q=True,
                                           value=True)
        pm.textScrollList(self.ar_item_scroll, e=True, ra=True)
        if len(self.ar_data.get_channel_joints(current_channel)) > 0:
            pm.textScrollList(
                self.ar_item_scroll,
                e=True,
                a=self.ar_data.get_channel_joints(current_channel))
            pm.textScrollList(self.ar_item_scroll, e=True, sii=1)
            self.selected_ar_item_in_scroll()

        # print(u"已选择通道:{}".format(current_channel))

        work_mode = [
            "FaceUnityPoseLib", "ArkitPoseLib"
        ][pm.radioButtonGrp(self.work_mode_control, q=True, sl=True) - 1]
        if pm.objExists(work_mode):
            pm.connectControl('arIDControlSlider',
                              '{}.{}'.format(work_mode, current_channel))

        return
Example #3
0
def connect_offset():
    py.connectControl('offset_scale', "rt_up_eye_inner_offset.scaleX",
                      "lf_up_eye_inner_offset.scaleX",
                      "rt_up_eye_mid_offset.scaleX",
                      "lf_up_eye_mid_offset.scaleX",
                      "rt_up_eye_outer_offset.scaleX",
                      "lf_up_eye_outer_offset.scaleX",
                      "rt_low_eye_outer_offset.scaleX",
                      "lf_low_eye_outer_offset.scaleX",
                      "rt_low_eye_mid_offset.scaleX",
                      "lf_low_eye_mid_offset.scaleX",
                      "rt_low_eye_inner_offset.scaleX",
                      "lf_low_eye_inner_offset.scaleX",
                      "rt_upper_cheek_offset.scaleX",
                      "lf_upper_cheek_offset.scaleX",
                      "rt_low_cheek_offset.scaleX",
                      "lf_low_cheek_offset.scaleX",
                      "rt_nose_offset.scaleX",
                      "lf_nose_offset.scaleX",
                      "rt_outer_cheek_offset.scaleX",
                      "lf_outer_cheek_offset.scaleX",
                      "rt_mouth_up_outermid_offset.scaleX",
                      "lf_mouth_up_outermid_offset.scaleX",
                      "rt_mouth_outer_offset.scaleX",
                      "lf_mouth_outer_offset.scaleX",
                      "cn_mouth_center_up_offset.scaleX",
                      "rt_mouth_up_innermid_offset.scaleX",
                      "lf_mouth_up_innermid_offset.scaleX",
                      "rt_mouth_low_innermid_offset.scaleX",
                      "lf_mouth_low_innermid_offset.scaleX",
                      "rt_mouth_low_outermid_offset.scaleX",
                      "lf_mouth_low_outermid_offset.scaleX",
                      "cn_mouth_center_low_offset.scaleX")
Example #4
0
def connect_locators():
    py.connectControl('locator_scale', "rt_up_eye_inner_L.scaleX",
                      "lf_up_eye_inner_L.scaleX",
                      "rt_up_eye_mid_L.scaleX",
                      "lf_up_eye_mid_L.scaleX",
                      "rt_up_eye_outer_L.scaleX",
                      "lf_up_eye_outer_L.scaleX",
                      "rt_low_eye_outer_L.scaleX",
                      "lf_low_eye_outer_L.scaleX",
                      "rt_low_eye_mid_L.scaleX",
                      "lf_low_eye_mid_L.scaleX",
                      "rt_low_eye_inner_L.scaleX",
                      "lf_low_eye_inner_L.scaleX",
                      "rt_upper_cheek_L.scaleX",
                      "lf_upper_cheek_L.scaleX",
                      "rt_low_cheek_L.scaleX",
                      "lf_low_cheek_L.scaleX",
                      "rt_nose_L.scaleX",
                      "lf_nose_L.scaleX",
                      "rt_outer_cheek_L.scaleX",
                      "lf_outer_cheek_L.scaleX",
                      "rt_mouth_up_outermid_L.scaleX",
                      "lf_mouth_up_outermid_L.scaleX",
                      "rt_mouth_outer_L.scaleX",
                      "lf_mouth_outer_L.scaleX",
                      "cn_mouth_center_up_L.scaleX",
                      "rt_mouth_up_innermid_L.scaleX",
                      "lf_mouth_up_innermid_L.scaleX",
                      "rt_mouth_low_innermid_L.scaleX",
                      "lf_mouth_low_innermid_L.scaleX",
                      "rt_mouth_low_outermid_L.scaleX",
                      "lf_mouth_low_outermid_L.scaleX",
                      "cn_mouth_center_low_L.scaleX",
                      "cn_head_L.scaleX",
                      "cn_head_low_jaw_L.scaleX")
	def __init__(self, lightTransform, lightType, lightShape):
		super(PointLight, self).__init__(lightTransform, lightType, lightShape)
		pm.setParent(self.indivLight_layout)
		
		pm.rowColumnLayout(nc=3)
		pm.text(l='Decay Rate', w=140, al='right')
		pm.text(l='', w=3)
		decayRate_menu = pm.optionMenu(bgc=primary_componentColor)
		pm.menuItem(l='No Decay', da=0)
		pm.menuItem(l='Linear', da=1)
		pm.menuItem(l='Quadratic', da=2)
		pm.menuItem(l='Cubic', da=3)
		pm.connectControl(decayRate_menu, lightShape+'.decayRate')
		pm.setParent(self.indivLight_layout)

		pm.rowColumnLayout(nc=2)
		pm.text(l='Shadow Settings', w=90, al='left', en=False)
		pm.separator(w=marginWidth-90, h=14)
		pm.setParent(self.indivLight_layout)

		pm.attrFieldSliderGrp(at=lightShape+'.lightRadius', cw=[[2, 75], [3, 120]], hmb=False)
		self.shadowRays_slide = pm.attrFieldSliderGrp(at=lightShape+'.shadowRays', cw=[[2, 75], [3, 120]], hmb=False)
		pm.attrFieldSliderGrp(at=lightShape+'.rayDepthLimit', cw=[[2, 75], [3, 120]], hmb=False)

		pm.setParent(lights_layout)
Example #6
0
        def replace(self, plug):
            plug = pm.Attribute(plug)
            pm.connectControl(self._coordsys.name(), plug, index=2)
            
            # populate the popup menu with coordinate systems
            self._popupMenu.deleteAllItems()
            
            with self._popupMenu:
                objects = []
                
                # include the default, if any
                if self.attr.default:
                    objects.append(self.attr.default)
                
                # add 3delight coordinate systems
                objects.extend(pm.ls(type="delightCoordinateSystem"))
                
                # TODO: add maya cameras
                
                for obj in objects:
                    pm.menuItem(label=str(obj), command=lambda arg, plug=plug, coordsys=obj: plug.set(coordsys))

                if objects:
                    pm.menuItem(divider=True)

                pm.menuItem(label="Create New Coordinate System", boldFont=True,
                            command=lambda arg, plug=plug: plug.set(self._createCoordsys()))
 def layerCreate(self, attribute):
     print "layerCreate attr", attribute
     pmAttr = pm.Attribute(attribute)
     self.thisNode = pmAttr.node()
     parent = pm.setParent(query=True)
     with pm.columnLayout(adjustableColumn=True, parent=parent):
         pm.button(label="Create New Layer")
         with pm.columnLayout(adjustableColumn=True):
             for i in range(pmAttr.numElements()):
                 with pm.frameLayout(collapsable=False,
                                     label="Layer {0}".format(i)):
                     with pm.columnLayout(adjustableColumn=True):
                         nameCtrl = pm.textFieldGrp(label="Name")
                         pm.connectControl(nameCtrl,
                                           pmAttr[i].layerName,
                                           index=2)
                         weightCtrl = pm.floatFieldGrp(label="Weight",
                                                       value1=0.0)
                         pm.connectControl(weightCtrl,
                                           pmAttr[i].layerWeight,
                                           index=2)
                         texCtrl = pm.attrColorSliderGrp(
                             at=pmAttr[i].layerTexture, label="Texture")
                         shdCtrl = pm.attrColorSliderGrp(
                             at=pmAttr[i].layerShader, label="Shader")
                     with pm.columnLayout(adjustableColumn=True):
                         with pm.rowLayout(nc=3):
                             pm.button(label="Up")
                             pm.button(label="Delete")
                             pm.button(label="Down")
Example #8
0
    def __addControl(self, ui, attrName, changeCallback=None, connectIndex=2):
        self.__uis[attrName] = ui
        attr = pm.Attribute("appleseedRenderGlobals." + attrName)
        pm.connectControl(ui, attr, index=connectIndex)

        if changeCallback:
            self.__scriptJobs[attrName] = mc.scriptJob(
                attributeChange=["appleseedRenderGlobals." + attrName, changeCallback])
Example #9
0
    def __addControl(self, ui, attrName, changeCallback=None, connectIndex=2):
        self.__uis[attrName] = ui
        attr = pm.Attribute("appleseedRenderGlobals." + attrName)
        pm.connectControl(ui, attr, index=connectIndex)

        if changeCallback:
            self.__scriptJobs[attrName] = mc.scriptJob(attributeChange=[
                "appleseedRenderGlobals." + attrName, changeCallback
            ])
Example #10
0
    def FujiRendererCreateTab(self):
        log.debug("FujiRendererCreateTab()")
        self.createGlobalsNode()
        parentForm = pm.setParent(query = True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate = True)
        scLo = self.rendererName + "ScrollLayout"

        if self.rendererTabUiDict.has_key('common'):
            self.rendererTabUiDict.pop('common')
        
        parentForm = pm.setParent(query = True)
        uiDict = {}
        self.rendererTabUiDict['common'] = uiDict
        
        with pm.scrollLayout(scLo, horizontalScrollBarThickness = 0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn = True, width = 400):
                with pm.frameLayout(label="Sampling", collapsable = True, collapse=False):                
                    self.addRenderGlobalsUIElement(attName = 'sampleJitter', uiType = 'float', displayName = 'SampleJitter', default='1.0', uiDict=uiDict)                    
                    self.addRenderGlobalsUIElement(attName = 'sample_time_range_min', uiType = 'float', displayName = 'Sample Time Range Min', default='0.0', uiDict=uiDict)                    
                    self.addRenderGlobalsUIElement(attName = 'sample_time_range_max', uiType = 'float', displayName = 'Sample Time Range Max', default='1.0', uiDict=uiDict)                    
                    self.addRenderGlobalsUIElement(attName = 'samplesX', uiType = 'int', displayName = 'Pixel Samples x', default=3, uiDict=uiDict)
                    self.addRenderGlobalsUIElement(attName = 'samplesY', uiType = 'int', displayName = 'Pixel Samples y', default=3, uiDict=uiDict)
                    pm.separator()
                    self.addRenderGlobalsUIElement(attName = 'cast_shadow', uiType = 'bool', displayName = 'Cast Shadows', default='true', uiDict=uiDict)                    
                    self.addRenderGlobalsUIElement(attName = 'max_reflect_depth', uiType = 'int', displayName = 'Max Reflection Depth', default='3', uiDict=uiDict)                    
                    self.addRenderGlobalsUIElement(attName = 'max_refract_depth', uiType = 'int', displayName = 'Max Refraction Depth', default='3', uiDict=uiDict)                    
                    self.addRenderGlobalsUIElement(attName = 'raymarch_step', uiType = 'float', displayName = 'Raymarching Stepsize', default='0.05', uiDict=uiDict)                    
                    self.addRenderGlobalsUIElement(attName = 'raymarch_shadow_step', uiType = 'float', displayName = 'Raymarching Shadow Stepsize', default='0.1', uiDict=uiDict)                    
                    self.addRenderGlobalsUIElement(attName = 'raymarch_reflect_ste', uiType = 'float', displayName = 'Raymarching Reflection Stepsize', default='0.1', uiDict=uiDict)                    
                    self.addRenderGlobalsUIElement(attName = 'raymarch_refract_ste', uiType = 'float', displayName = 'Raymarching Refraction Stepsize', default='0.1', uiDict=uiDict)                                        
                    pm.separator()
                    self.addRenderGlobalsUIElement(attName = 'doMotionBlur', uiType = 'bool', displayName = 'Motionblur:', default=False, uiDict=uiDict)
                    self.addRenderGlobalsUIElement(attName = 'doDof', uiType = 'bool', displayName = 'Depth of Field:', default=False, uiDict=uiDict)
                    
                with pm.frameLayout(label="Output", collapsable = True, collapse=False):
                    attr = pm.Attribute(self.renderGlobalsNodeName + ".imageFormat")
                    ui = pm.attrEnumOptionMenuGrp(label = "Image Format", at=self.renderGlobalsNodeName + ".imageFormat", ei = self.getEnumList(attr)) 
                    
                with pm.frameLayout(label="Filtering", collapsable = True, collapse=False):
                    attr = pm.Attribute(self.renderGlobalsNodeName + ".filtertype")
                    ui = pm.attrEnumOptionMenuGrp(label = "Filter Type", at=self.renderGlobalsNodeName + ".filtertype", ei = self.getEnumList(attr)) 
                    ui = pm.intFieldGrp(label="Filter Size:", numberOfFields = 1)
                    pm.connectControl(ui, self.renderGlobalsNodeName + ".filtersize", index = 2 )

                with pm.frameLayout(label="Renderer", collapsable = True, collapse=False):
                    self.addRenderGlobalsUIElement(attName = 'use_max_thread', uiType = 'bool', displayName = 'Use Max Threads', default='true', uiDict=uiDict)
                    self.addRenderGlobalsUIElement(attName = 'threads', uiType = 'int', displayName = 'Threads', default=8, uiDict=uiDict)
                    self.addRenderGlobalsUIElement(attName = 'tilesize', uiType = 'int', displayName = 'Tile Size', default=64, uiDict=uiDict)
                    ui = pm.intFieldGrp(label="Verbosity:", numberOfFields = 1)
                    pm.connectControl(ui, self.renderGlobalsNodeName + ".rendererVerbosity", index = 2 )
                    
                    
        pm.setUITemplate("attributeEditorTemplate", popTemplate = True)
        pm.formLayout(parentForm, edit = True, attachForm = [ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
        self.FujiRendererUpdateTab()
Example #11
0
 def connectUIElement(self, uiElement, attribute):
     
     if attribute.type() == 'enum':
         #enum is automatically connnected via attrEnumOptionMenu
         return        
     if attribute.type() == 'float3':
         #float3 == color is automatically connnected via attrColorSliderGrp
         return
     if attribute.type() == 'message':
         #no automatic connection necessary, will be controlled by other scritps
         return
     log.debug("Adding connection for {0}".format(attribute))
     pm.connectControl(uiElement, attribute, index = 2)
	def __init__(self, lightTransform, lightType, lightShape):
		self.lightLinked = pm.lightlink(query=True, shapes=False, light=lightShape)
		self.lightTransform = lightTransform
		self.lightType = lightType
		self.lightShape = lightShape

		self.lightFrame_layout = pm.frameLayout(l='{0} ({1})'.format(lightTransform, lightType), cl=True, cll=True, w=marginWidth, bgc=frameColor, ann="Settings for {0}".format(lightTransform), p=lights_layout)
		self.indivLight_layout = pm.columnLayout()

		self.warningCheck()

		pm.text(l='', h=5)
		self.nameField = pm.textFieldGrp(l='Name', text=lightTransform, cw=[2, 150], cc=self.nameChange, fcc=True)

		pm.rowColumnLayout(nc=2)
		pm.text(l='Basic Settings', w=75, al='left', en=False)
		pm.separator(w=marginWidth-75, h=14)
		pm.setParent(self.indivLight_layout)

		pm.text(l='', h=2)

		pm.rowColumnLayout(nc=5)
		pm.button(l='Select', w=(marginWidth/3)-5, al='center', bgc=primary_componentColor, c=self.selectLight)
		pm.text(l='') # GUI SPACER
		pm.button(l='Delete', w=(marginWidth/3)-5, al='center', bgc=primary_componentColor, c=self.deleteLight)
		pm.text(l='') # GUI SPACER
		pm.button(l='Duplicate', w=(marginWidth/3)-5, al='center', bgc=primary_componentColor, c=self.duplicateLight)
		pm.setParent(self.indivLight_layout)
		pm.text(l='', h=2) # GUI SPACER

		pm.attrColorSliderGrp(at=lightShape+'.color', cw=[[2, 75], [3, 120]], sb=True)
		pm.attrFieldSliderGrp(at=lightShape+'.intensity', cw=[[2, 75], [3, 120]], hmb=False)

		# pm.text(l='', h=3) # GUI SPACER
		pm.rowColumnLayout(nc=2)
		pm.text(l='', w=142) # GUI SPACER
		self.illDefault_box = pm.checkBox(l='Illuminates by Default', v=self.check_illumByDefault(), cc=self.illumDefaultCommand)
		pm.setParent(self.indivLight_layout)

		pm.rowColumnLayout(nc=3)
		pm.text(l='', w=142) # GUI SPACER
		emitDif_box = pm.checkBox(l='Emit Diffuse', w=120)
		emitSpec_box = pm.checkBox(l='Emit Specular')
		pm.setParent(self.indivLight_layout)
		pm.connectControl(emitDif_box, lightShape+'.emitDiffuse')
		pm.connectControl(emitSpec_box, lightShape+'.emitSpecular')

		pm.setParent(lights_layout)
Example #13
0
def connectUIElement(uiElement, attribute):
    
    if attribute.type() == 'color':
        #color is automatically connnected via attrEnumOptionMenu
        return        
    if attribute.type() == 'enum':
        #enum is automatically connnected via attrEnumOptionMenu
        return        
    if attribute.type() == 'float3':
        #float3 == color is automatically connnected via attrColorSliderGrp
        return
    if attribute.type() == 'message':
        #no automatic connection necessary, will be controlled by other scritps
        return
    if attribute.type() == 'vector':
        #no automatic connection necessary, will be controlled by other scritps
        return
    pm.connectControl(uiElement, attribute, index = 2)
Example #14
0
def connectUIElement(uiElement, attribute):

    if attribute.type() == 'color':
        #color is automatically connnected via attrEnumOptionMenu
        return
    if attribute.type() == 'enum':
        #enum is automatically connnected via attrEnumOptionMenu
        return
    if attribute.type() == 'float3':
        #float3 == color is automatically connnected via attrColorSliderGrp
        return
    if attribute.type() == 'message':
        #no automatic connection necessary, will be controlled by other scritps
        return
    if attribute.type() == 'vector':
        #no automatic connection necessary, will be controlled by other scritps
        return
    pm.connectControl(uiElement, attribute, index=2)
Example #15
0
 def AppleseedTranslatorCreateTab(self):
     log.debug("AppleseedTranslatorCreateTab()")
     self.createGlobalsNode()
     parentForm = pm.setParent(query=True)
     pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
     scLo = self.rendererName + "TrScrollLayout"
     
     with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
         with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn=True, width=400):
             with pm.frameLayout(label="Translator", collapsable=True, collapse=False):
                 attr = pm.Attribute(self.renderGlobalsNodeName + ".translatorVerbosity")
                 ui = pm.attrEnumOptionMenuGrp(label="Translator Verbosity", at=self.renderGlobalsNodeName + ".translatorVerbosity", ei=self.getEnumList(attr)) 
             
             with pm.frameLayout(label="{0} export".format(self.rendererName), collapsable = True, collapse=False):
                 ui = pm.checkBoxGrp(label="Export {0} Scene file (no rendering):".format(self.rendererName), value1 = False)
                 pm.connectControl(ui, self.renderGlobalsNodeName + ".exportSceneFile", index = 2 )
                 xmlDict = {}
                 self.rendererTabUiDict['xml'] = xmlDict
                 defaultXMLPath = pm.workspace.path + "/" + pm.sceneName().basename().split(".")[0] + ".Corona"
                 if not defaultXMLPath.dirname().exists():
                     defaultXMLPath.dirname().makedirs()
                 with pm.rowLayout(nc=3):
                     xmlDict['xmlFileText'] = pm.text(label = "Export to")
                     xmlDict['xmlFile'] = pm.textField(text = defaultXMLPath)
                     pm.symbolButton(image="navButtonBrowse.png", c=self.xmlFileBrowse)
                     pm.connectControl(xmlDict['xmlFile'], self.renderGlobalsNodeName + ".exportSceneFileName", index = 2 )
                     
             with pm.frameLayout(label="Optimize Textures", collapsable = True, collapse=False):
                 optiDict = {}
                 ui = pm.checkBoxGrp(label="Use Optimized Textures:", value1 = False)
                 pm.connectControl(ui, self.renderGlobalsNodeName + ".useOptimizedTextures", index = 2 )
                 with pm.rowLayout(nc=3):
                     self.rendererTabUiDict['opti'] = optiDict
                     pm.text(label="OptimizedTex Dir:")
                     optiDict['optiField'] = pm.textField(text = self.renderGlobalsNode.optimizedTexturePath.get())
                     pm.symbolButton(image="navButtonBrowse.png", c=self.dirBrowse)
                     pm.connectControl(optiDict['optiField'], self.renderGlobalsNodeName + ".optimizedTexturePath", index = 2 )
                     
             with pm.frameLayout(label="Additional Settings", collapsable=True, collapse=False):
                 ui = pm.floatFieldGrp(label="Scene scale:", value1=1.0, numberOfFields=1)
                 pm.connectControl(ui, self.renderGlobalsNodeName + ".sceneScale", index=2)
                      
     pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
     pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
Example #16
0
 def layerCreate(self, attribute):
     print "layerCreate attr", attribute
     pmAttr = pm.Attribute(attribute)
     self.thisNode = pmAttr.node()
     parent = pm.setParent(query=True)
     with pm.columnLayout(adjustableColumn=True, parent=parent):                    
         pm.button(label="Create New Layer")
         with pm.columnLayout(adjustableColumn=True):                    
             for i in range(pmAttr.numElements()):
                 with pm.frameLayout(collapsable=False, label="Layer {0}".format(i)):
                     with pm.columnLayout(adjustableColumn=True):                    
                         nameCtrl = pm.textFieldGrp(label="Name")
                         pm.connectControl(nameCtrl, pmAttr[i].layerName, index = 2)
                         weightCtrl = pm.floatFieldGrp(label="Weight", value1=0.0)
                         pm.connectControl(weightCtrl, pmAttr[i].layerWeight, index = 2)
                         texCtrl = pm.attrColorSliderGrp(at=pmAttr[i].layerTexture, label="Texture");
                         shdCtrl = pm.attrColorSliderGrp(at = pmAttr[i].layerShader, label="Shader");
                     with pm.columnLayout(adjustableColumn=True):
                         with pm.rowLayout(nc=3):
                             pm.button(label="Up")
                             pm.button(label="Delete")
                             pm.button(label="Down")
Example #17
0
def AEzFileSwitchPathReplace(fileAttribute):
    def open_file_browser(unused):
        old_path = pm.getAttr(fileAttribute)
        old_path = old_path.replace('\\', '/')
        starting_file = os.path.basename(old_path)

        # Find the absolute path to the current path, if any, and open the browser in the
        # same directory as the current path.  Why don't all Maya file browsers do this?
        starting_directory = ''
        if old_path:
            attr = pm.ls(fileAttribute)[0]
            node_name = attr.nodeName()
            absolute_path = omr.MRenderUtil.exactFileTextureName(
                old_path, False, "", node_name)
            starting_directory = os.path.dirname(absolute_path)

        options = pm.mel.eval('fileBrowserActionSetup("image", 1)')
        files = pm.fileDialog2(caption='Open',
                               okCaption='Open',
                               fileMode=1,
                               fileFilter=options[2],
                               startingDirectory=starting_directory,
                               selectFileFilter=starting_file)
        if not files:
            return
        path = files[0]
        path = path.replace('\\', '/')

        pm.setAttr(fileAttribute, path)

    pm.connectControl('filenameField', fileAttribute, fileName=True)

    pm.textField('filenameField',
                 e=True,
                 changeCommand=lambda value: pm.setAttr(fileAttribute, value))
    pm.button('browseFileSwitch', e=True, command=open_file_browser)
    return True
Example #18
0
def gui():
    '''
    Triggers the interface for zoomerate.
    '''
    
    # Warning this is causeing issues with 2012
    panel = pm.getPanel(wf=True)
    try:
        whichCam = pm.modelPanel(panel, q=1, camera=True)
    except RuntimeError:
        whichCam = pm.modelPanel('modelPanel4', q=1, camera=True)
        print 'Using: %s' % whichCam
        
    whichCamShape = pm.ls(whichCam, dag=True, shapes=True, ap=True)
    
    # Figure out what cameras to use when building the menu
    cameras = pm.ls(ca=True)
    diffCams = []
    diffCams.extend(whichCamShape)
    diffCams.extend(cameras)
    print diffCams, len(diffCams)
    
    win_name = 'zoomer_win2'
    if pm.window(win_name, ex=True):
        pm.deleteUI(win_name)
        
    win = pm.window(win_name, s=0, ip=True, iconName='zoomer', w=400, h=180,
                    t='Camera zoomeratro v1.0')
    main = pm.columnLayout()
    pm.frameLayout(borderVisible=True, labelVisible=True, labelAlign='cener', label='Zoom Options', marginWidth=5, marginHeight=5)
    pm.columnLayout()
    global which_cam_menu
    which_cam_menu = pm.optionMenuGrp(label='Camera to Zoom', cc=connect)
    pm.menuItem(label=whichCamShape[0])
    for i in xrange(len(diffCams)-1):
        pm.menuItem(label=cameras[i])
    
    horizontal_attr = '%s.horizontalFilmOffset' % whichCamShape[0]
    vertical_attr = '%s.verticalFilmOffset' % whichCamShape[0]
    overscan_attr = '%s.overscan' % whichCamShape[0]
    
    global horizontal_slider, vertical_slider, overscan_slider
    horizontal_slider = pm.floatSliderGrp(field=True, label='Horizontal', min=-3, max=3, pre=3, step=0.001)
    vertical_slider = pm.floatSliderGrp(field=True, label='Vertical', min=-3, max=3, pre=3, step=0.001)
    overscan_slider = pm.floatSliderGrp(field=True, label='Overscan', min=-3, max=3, pre=3, step=0.001)
    
    pm.connectControl(horizontal_slider, horizontal_attr)
    pm.connectControl(vertical_slider, vertical_attr)
    pm.connectControl(overscan_slider, overscan_slider)
    
    pm.button(label='Reset', c=reset)
    win.show()
Example #19
0
    def AppleseedTranslatorCreateTab(self):
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "TrScrollLayout"
        uiDict = {}
        self.rendererTabUiDict['translator'] = uiDict

        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Translator", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderGlobalsUIElement(attName='translatorVerbosity', uiType='enum', displayName='Verbosity:', default='0', uiDict=uiDict)
                with pm.frameLayout(label="appleseed Output", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderGlobalsUIElement(attName='exportMode', uiType='enum', displayName='Output Mode:', default='0', uiDict=uiDict, callback=self.AppleseedTranslatorUpdateTab)
                    with pm.rowLayout(nc=3) as uiDict['outputFilenameLayout']:
                        pm.text(label="Output Filename:")
                        uiDict['fileNameField'] = pm.textField(text=self.renderGlobalsNode.exportSceneFileName.get())
                        pm.symbolButton(image="navButtonBrowse.png", c=self.outputFileBrowse)
                        pm.connectControl(uiDict['fileNameField'], self.renderGlobalsNodeName + ".exportSceneFileName", index=2)
                with pm.frameLayout(label="Optimize Textures", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        optiDict = {}
                        ui = pm.checkBoxGrp(label="Use Optimized Textures:", value1=False)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".useOptimizedTextures", index=2)
                    with pm.rowLayout(nc=3):
                        self.rendererTabUiDict['opti'] = optiDict
                        pm.text(label="Optimized Textures Dir:")
                        optiDict['optiField'] = pm.textField(text=self.renderGlobalsNode.optimizedTexturePath.get())
                        pm.symbolButton(image="navButtonBrowse.png", c=self.dirBrowse)
                        pm.connectControl(optiDict['optiField'], self.renderGlobalsNodeName + ".optimizedTexturePath", index=2)

                with pm.frameLayout(label="Additional Settings", collapsable=True, collapse=False):
                    ui = pm.floatFieldGrp(label="Scene Scale:", value1=1.0, numberOfFields=1)
                    pm.connectControl(ui, self.renderGlobalsNodeName + ".sceneScale", index=2)

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
        self.AppleseedTranslatorUpdateTab()
Example #20
0
 def IndigoTranslatorCreateTab(self):
     log.debug("IndigoTranslatorCreateTab()")
     self.createGlobalsNode()
     parentForm = pm.setParent(query = True)
     pm.setUITemplate("attributeEditorTemplate", pushTemplate = True)
     scLo = self.rendererName + "TrScrollLayout"
     
     with pm.scrollLayout(scLo, horizontalScrollBarThickness = 0):
         with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn = True, width = 400):
             with pm.frameLayout(label="Translator", collapsable = True, collapse=False):
                 attr = pm.Attribute(self.renderGlobalsNodeName + ".translatorVerbosity")
                 ui = pm.attrEnumOptionMenuGrp(label = "Translator Verbosity", at=self.renderGlobalsNodeName + ".translatorVerbosity", ei = self.getEnumList(attr)) 
             with pm.frameLayout(label="Indigo Scene File export", collapsable = True, collapse=False):
                 ui = pm.checkBoxGrp(label="Export Indigo Scene file:", value1 = False)
                 pm.connectControl(ui, self.renderGlobalsNodeName + ".exportSceneFile", index = 2 )
                 xmlDict = {}
                 self.rendererTabUiDict['xml'] = xmlDict
                 defaultXMLPath = pm.workspace.path + "/" + pm.sceneName().basename().split(".")[0] + ".igs"
                 if not defaultXMLPath.dirname().exists():
                     defaultXMLPath.dirname().makedirs()
                 with pm.rowLayout(nc=3):
                     xmlDict['xmlFileText'] = pm.text(label = "Export to")
                     xmlDict['xmlFile'] = pm.textField(text = defaultXMLPath)
                     pm.symbolButton(image="navButtonBrowse.png", c=self.xmlFileBrowse)
                     pm.connectControl(xmlDict['xmlFile'], self.renderGlobalsNodeName + ".exportSceneFileName", index = 2 )
             with pm.frameLayout(label="Optimize Textures", collapsable = True, collapse=False):
                 optiDict = {}
                 ui = pm.checkBoxGrp(label="Use Optimized Textures:", value1 = False)
                 with pm.rowLayout(nc=3):
                     self.rendererTabUiDict['opti'] = optiDict
                     pm.text(label="OptimizedTex Dir:")
                     optiDict['optiField'] = pm.textField(text = self.renderGlobalsNode.optimizedTexturePath.get())
                     pm.symbolButton(image="navButtonBrowse.png", c=self.dirBrowse)
                     pm.connectControl(optiDict['optiField'], self.renderGlobalsNodeName + ".optimizedTexturePath", index = 2 )
             with pm.frameLayout(label="Additional Settings", collapsable = True, collapse=False):
                 ui = pm.floatFieldGrp(label="Scene scale:", value1 = 1.0, numberOfFields = 1)
                 pm.connectControl(ui, self.renderGlobalsNodeName + ".sceneScale", index = 2 )
                      
     pm.setUITemplate("attributeEditorTemplate", popTemplate = True)
     pm.formLayout(parentForm, edit = True, attachForm = [ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
Example #21
0
    def __init__(self, parent, aovObject, lockName=False):
        self.outputsChanged = True
        self.parent = parent
        self.aov = aovObject
        DARK_BLUE = [.16, .17, .2]
        aovNode = self.aov.node

        self.baseWidget = pm.cmds.columnLayout(adj=True)

        pm.cmds.rowLayout(nc=3,
                     rowAttach=([1, 'top', 2],
                                [3, 'top', 2]),
                     columnWidth3=[sum(AOV_ROW_WIDTHS)+8, sum(OUTPUT_ROW_WIDTHS)+8, 20],
                     columnAttach3=['right', 'both', 'both'])

        # AOV UI --------
        pm.cmds.rowLayout(nc=3,
                     
                     columnWidth3=AOV_ROW_WIDTHS,
                     columnAttach3=['right', 'both', 'both'])

        self.enabledCtrl = pm.cmds.checkBox(label='')
        pm.connectControl(self.enabledCtrl, aovNode.attr('enabled'))

        nameAttr = aovNode.attr('name')
        # use evalDeferred to ensure that the update happens after the aov node attribute is set
        self.nameCtrl = pm.textField(editable=not lockName,
                                # we save out the current aov name for the replaceShadingGroupDummyAttrs callback
                                changeCommand=lambda new, old=nameAttr.get(): self.aov.rename(new, old)
                                )
        pm.connectControl(self.nameCtrl, nameAttr)
        # must set editability after connecting control
        self.nameCtrl.setEditable(not lockName)
        if aovNode.isReferenced():
            # orange
            self.nameCtrl.setBackgroundColor(DARK_BLUE)

        #pm.text(label='name')
        # attrEnumOptionMenu does not work with multi-attrs and optionMenu does not work with connectControl,
        # so, unfortunately, our best option is attrEnumOptionMenuGrp
        self.channelsMenu = pm.cmds.attrEnumOptionMenuGrp(attribute=str(aovNode.attr('type')), columnWidth2=[1, 50])

        pm.setParent('..')

        pm.cmds.frameLayout(labelVisible=False)
        self.outputColumn = pm.cmds.columnLayout(adj=True, rowSpacing=2)

        # cache the list of outputs
        self.outputs = []
        for outputAttr in aovNode.attr('outputs'):
            try:
                outputRow = AOVOutputItem(self.outputColumn, outputAttr, self)
            except IndexError:
                continue
            else:
                self.outputs.append(outputRow)
                #pm.symbolButton(image="navButtonConnected.png")
                #pm.symbolButton(image="smallTrash.png")
                pm.setParent('..')

        pm.setParent('..')
        pm.setParent('..')


        aovMenuButton = pm.cmds.symbolButton(image="arrowDown.png")
#        pm.symbolButton(image="smallTrash.png",
#                        command=lambda *args: self.parent.removeAOV(aovNode))

        self.popupMenu = pm.cmds.popupMenu(parent=aovMenuButton, button=1, postMenuCommand=self.buildPopupMenu)

        pm.setParent('..')
        pm.setParent('..')
    def AppleseedRendererCreateTab(self):
        log.debug("AppleseedRendererCreateTab()")
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "ScrollLayout"
        if self.rendererTabUiDict.has_key('common'):
            self.rendererTabUiDict.pop('common')        
        uiDict = {}
        self.rendererTabUiDict['common'] = uiDict

        
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Pixel Sampler", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        # attr = pm.Attribute(self.renderGlobalsNodeName + ".pixel_renderer")
                        # ui = pm.attrEnumOptionMenuGrp(label="Pixel Sampler", at=self.renderGlobalsNodeName + ".pixel_renderer", ei=self.getEnumList(attr)) 
                        self.addRenderGlobalsUIElement(attName='pixel_renderer', uiType='enum', displayName='Pixel Sampler', default='0', uiDict=uiDict, callback=self.AppleseedRendererUpdateTab)
                        self.addRenderGlobalsUIElement(attName='minSamples', uiType='int', displayName='Min Samples', default=False, uiDict=uiDict)                        
                        self.addRenderGlobalsUIElement(attName='maxSamples', uiType='int', displayName='Max Samples', default=False, uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='maxError', uiType='float', displayName='Max Error', default=False, uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='enable_diagnostics', uiType='bool', displayName="Diagnostic AOV's", default=False, uiDict=uiDict)
                        pm.separator()
                        self.addRenderGlobalsUIElement(attName='frameRendererPasses', uiType='int', displayName='Passes', uiDict=uiDict)
                        

                with pm.frameLayout(label="Filtering", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".filtertype")
                        ui = pm.attrEnumOptionMenuGrp(label="Filter Type", at=self.renderGlobalsNodeName + ".filtertype", ei=self.getEnumList(attr)) 
                        self.addRenderGlobalsUIElement(attName='filtersize', uiType='int', displayName='Filter Size', default=False, uiDict=uiDict)
                        
                with pm.frameLayout(label="Features", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        self.addRenderGlobalsUIElement(attName='doMotionBlur', uiType='bool', displayName='Motion Blur', default=False, uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='doDof', uiType='bool', displayName='Depth Of Field', default=False, uiDict=uiDict)
                    
                with pm.frameLayout(label="Output", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".bitdepth")
                        ui = pm.attrEnumOptionMenuGrp(label="Bit Depth", at=self.renderGlobalsNodeName + ".bitdepth", ei=self.getEnumList(attr)) 
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".colorSpace")
                        ui = pm.attrEnumOptionMenuGrp(label="Color Space", at=self.renderGlobalsNodeName + ".colorSpace", ei=self.getEnumList(attr)) 
                        ui = pm.checkBoxGrp(label="Clamping:", value1=False)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".clamping", index=2)
                    
                with pm.frameLayout(label="Lighting Engine", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        self.addRenderGlobalsUIElement(attName='lightingEngine', uiType='enum', displayName='Lighting Engine', default='0', uiDict=uiDict, callback=self.AppleseedRendererUpdateTab)
                        with pm.frameLayout(label="Lighting Engine Settings", collapsable=True, collapse=False) as uiDict['LE_framelayout']:
                            with pm.columnLayout(self.rendererName + "LEColumnLayout", adjustableColumn=True, width=400) as uiDict['LE_layout']:
                                pass
                            
                with pm.frameLayout(label="Renderer", collapsable=True, collapse=True):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        self.addRenderGlobalsUIElement(attName='threads', uiType='int', displayName='Threads:', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='rendererVerbosity', uiType='int', displayName='Verbosity:', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='tilesize', uiType='int', displayName='Tile Size:', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='texCacheSize', uiType='int', displayName='Tex Cache Size (kb):', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='assemblySBVH', uiType='bool', displayName='Use SBVH Acc. for mb:', uiDict=uiDict)                        
                    
        pm.setUITemplate("renderGlobalsTemplate", popTemplate=True)                    
        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
        
        # pm.scriptJob(attributeChange=[self.renderGlobalsNode.samplingType, pm.Callback(self.KrayRendererUIUpdateCallback, "sampling")])

        # self.updateEnvironment()
        self.AppleseedRendererUpdateTab()
Example #23
0
    def KrayRendererCreateTab(self):
        log.debug("KrayRendererCreateTab()")
        self.createGlobalsNode()
        sDict = {}
        self.rendererTabUiDict['sampling'] = sDict        
        parentForm = pm.setParent(query=True)

        pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "ScrollLayout"
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Image format", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayoutA", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".diffuseModel")
                        ui = pm.attrEnumOptionMenuGrp(label="Diffuse Model", at=self.renderGlobalsNodeName + ".diffuseModel", ei=self.getEnumList(attr)) 
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".qLuminosityModel")
                        ui = pm.attrEnumOptionMenuGrp(label="Luminosity Model", at=self.renderGlobalsNodeName + ".qLuminosityModel", ei=self.getEnumList(attr)) 
                        pm.separator()
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".imageFormat")
                        ui = pm.attrEnumOptionMenuGrp(label="Image format", at=self.renderGlobalsNodeName + ".imageFormat", ei=self.getEnumList(attr)) 
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".bitdepth")
                        sDict['bitdepth'] = pm.attrEnumOptionMenuGrp(label="Bit depth", at=self.renderGlobalsNodeName + ".bitdepth", ei=self.getEnumList(attr)) 
                        sDict['jpgQuality'] = pm.intFieldGrp(label="Jpg Quality:", numberOfFields=1)
                        pm.connectControl(sDict['jpgQuality'], self.renderGlobalsNodeName + ".jpgQuality", index=2)                     
                
                with pm.frameLayout(label="Sampling", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayoutA", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".samplingType")
                        ui = pm.attrEnumOptionMenuGrp(label="Sampling Type", at=self.renderGlobalsNodeName + ".samplingType", ei=self.getEnumList(attr)) 
                        sDict['fullScreenAA'] = pm.checkBoxGrp(label="Full Screen AA:", value1=False)
                        pm.connectControl(sDict['fullScreenAA'], self.renderGlobalsNodeName + ".fullScreenAA", index=2)
                        pm.separator()
                        sDict['gridSize'] = pm.intFieldGrp(label="Grid Size:", numberOfFields=1)
                        pm.connectControl(sDict['gridSize'], self.renderGlobalsNodeName + ".gridSize", index=2)                     
                        sDict['gridRotate'] = pm.checkBoxGrp(label="Grid Rotate:", value1=False)
                        pm.connectControl(sDict['gridRotate'], self.renderGlobalsNodeName + ".rotateGrid", index=2) 
                        pm.separator()
                        ui = pm.intFieldGrp(label="Rays:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_rays", index=2)                     
                        ui = pm.intFieldGrp(label="Min Rays:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_minRays", index=2)                     
                        ui = pm.intFieldGrp(label="Max Rays:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_maxRays", index=2)                     
                        pm.separator()
                        ui = pm.intFieldGrp(label="Edge Thickness:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_thickness", index=2)                     
                        ui = pm.floatFieldGrp(label="Edge Absulut:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_edgeAbsolute", index=2)                     
                        ui = pm.floatFieldGrp(label="Edge Relative:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_relative", index=2)                     
                        pm.separator()
                        ui = pm.floatFieldGrp(label="Normal Sentitivity:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_normal", index=2)                     
                        ui = pm.floatFieldGrp(label="Z Sensitivity:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_z", index=2)                  
                        ui = pm.floatFieldGrp(label="Max Brightness:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_overburn", index=2)                    
                        ui = pm.floatFieldGrp(label="Threshold:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_threshold", index=2)                     
                        pm.separator()
                        ui = pm.intFieldGrp(label="Upsample:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".aa_upsample", index=2)      
                        ui = pm.floatFieldGrp(label="Mb Subframes:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".mb_subframes", index=2)                     
                        pm.separator()
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".pixelOrder")
                        ui = pm.attrEnumOptionMenuGrp(label="Pixel Order", at=self.renderGlobalsNodeName + ".pixelOrder", ei=self.getEnumList(attr)) 
                    
                with pm.frameLayout(label="Filtering", collapsable=True, collapse=False):
                    attr = pm.Attribute(self.renderGlobalsNodeName + ".filtertype")
                    ui = pm.attrEnumOptionMenuGrp(label="Filter Type", at=self.renderGlobalsNodeName + ".filtertype", ei=self.getEnumList(attr)) 
                    sDict['filterSize'] = pm.floatFieldGrp(label="Filter Size:", numberOfFields=1)
                    pm.connectControl(sDict['filterSize'], self.renderGlobalsNodeName + ".filtersize", index=2)
                                        
                with pm.frameLayout(label="Features", collapsable=True, collapse=False):
                    sDict['doMb'] = pm.checkBoxGrp(label="Motion Blur:")
                    pm.connectControl(sDict['doMb'], self.renderGlobalsNodeName + ".doMb", index=2)
                    sDict['doDof'] = pm.checkBoxGrp(label="Depth Of Field:")
                    pm.connectControl(sDict['doDof'], self.renderGlobalsNodeName + ".doDof", index=2)
                    sDict['camSingleSided'] = pm.checkBoxGrp(label="Render Single Sided:")
                    pm.connectControl(sDict['camSingleSided'], self.renderGlobalsNodeName + ".camSingleSided", index=2)
                    
        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.setUITemplate("renderGlobalsTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
        self.KrayRendererUpdateTab()

        self.KrayRendererUIUpdateCallback("sampling")                
        
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.samplingType, pm.Callback(self.KrayRendererUIUpdateCallback, "sampling")])
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.filtertype, pm.Callback(self.KrayRendererUIUpdateCallback, "sampling")])
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.imageFormat, pm.Callback(self.KrayRendererUIUpdateCallback, "sampling")])
Example #24
0
    def createUi(self, node=None):
        log.debug("createUi for node %s" % str(node))
        currentSegment = ""
        layoutList = []
        for att in self.attList:
            if att.kategory != None and currentSegment != att.kategory:
                log.debug("kategory %s != %s" % (currentSegment, att.kategory))
                katlist = att.kategory.split("|")
                diff = len(layoutList) - len(katlist)
                # neue liste ist kuerzer als alte, also solange dicht machen bis die laenge gleich ist
                log.debug("check diff %d" % diff)
                while diff > 0:
                    layoutList.pop()
                    pm.setParent("..")
                    pm.setParent("..")
                    diff = len(layoutList) - len(katlist)
                    log.debug("new diff %d" % diff)

                # alte liste ist nun nicht laenger als neue liste
                # durchgehen und alles dichtmachen was nicht gleich ist
                for i in range(len(layoutList)):
                    kat = katlist[i]
                    ckat = layoutList[i]
                    # wenn werte ungelich dann alles was noch kommt zumachen
                    if kat != ckat:
                        laylen = len(layoutList)
                        for n in range(i, laylen):
                            pm.setParent("..")
                            pm.setParent("..")
                            layoutList.pop(n)

                # nun sollte sichergestellt sein, dass layoutList nur noch elemente
                # enthaelt, die gleich sind, also kann man daran anknuepfen
                for i in range(len(layoutList), len(katlist)):
                    log.debug("opening layout for katlist %s %d %s" %
                              (str(katlist), i, katlist[i]))
                    self.beginUISegment(katlist[i])
                    layoutList.append(katlist[i])

                currentSegment = att.kategory

            if MAP_API_ATTR.has_key(att.type):
                log.debug("Adding element %s with displayName %s" %
                          (att.attname, att.displayname))
                attype, attypeval = MAP_API_ATTR[att.type]
                log.debug(
                    "Adding attribute named %s type %s val %s default %s" %
                    (att.attname, attype, attypeval, att.default))
                if attypeval == 'bool':
                    att.uiElement = pm.checkBoxGrp(att.attname,
                                                   numberOfCheckBoxes=1,
                                                   label1=att.displayname,
                                                   cc=Callback(
                                                       self.dimConnections,
                                                       att))
                    att.uiDimFunction = pm.checkBoxGrp
                    if node:
                        pm.connectControl(att.uiElement,
                                          node + "." + att.attname,
                                          index=2)
                if attypeval == 'int':
                    att.uiElement = pm.intFieldGrp(att.attname,
                                                   numberOfFields=1,
                                                   label=att.displayname,
                                                   value1=att.default,
                                                   cc=Callback(
                                                       self.dimConnections,
                                                       att))
                    att.uiDimFunction = pm.intFieldGrp
                    if node:
                        pm.connectControl(att.uiElement,
                                          node + "." + att.attname,
                                          index=2)
                if attypeval == 'long2':
                    if node:
                        att.uiDimFunction = pm.attrFieldGrp(
                            attribute='%s' % (node + "." + att.attname),
                            cc=Callback(self.dimConnections, att))
                if attypeval == 'float':
                    att.uiElement = pm.floatFieldGrp(att.attname,
                                                     numberOfFields=1,
                                                     label=att.displayname,
                                                     value1=att.default,
                                                     cc=Callback(
                                                         self.dimConnections,
                                                         att))
                    att.uiDimFunction = pm.floatFieldGrp
                    if node:
                        pm.connectControl(att.uiElement,
                                          node + "." + att.attname,
                                          index=2)
                if attypeval == 'float2':
                    if node:
                        att.uiDimFunction = pm.attrFieldGrp(
                            attribute='%s' % (node + "." + att.attname),
                            cc=Callback(self.dimConnections, att))
                if attypeval == 'string':
                    att.uiElement = pm.textFieldGrp(att.attname,
                                                    label=att.displayname,
                                                    text=att.default,
                                                    cc=Callback(
                                                        self.dimConnections,
                                                        att))
                    pm.connectControl(att.uiElement,
                                      node + "." + att.attname,
                                      index=2)
                    pm.textFieldGrp(att.uiElement, edit=True, text=att.default)

                if attypeval == 'enum':
                    poplist = map(list, enumerate(att.values))

                    if node:
                        nodeatt = node + "." + att.attname
                        att.uiElement = pm.attrEnumOptionMenuGrp(
                            att.attname,
                            label=att.displayname,
                            at=nodeatt,
                            ei=poplist,
                            vcc=Callback(self.dimConnections, att))
                        att.uiDimFunction = pm.attrEnumOptionMenuGrp
                    else:
                        att.uiElement = pm.attrEnumOptionMenuGrp(
                            att.attname,
                            label=att.displayname,
                            ei=poplist,
                            vcc=Callback(self.dimConnections, att))
                        att.uiDimFunction = pm.attrEnumOptionMenuGrp

                if attypeval == 'message':
                    pass

        if len(layoutList) > 0:
            for i in range(len(layoutList)):
                pm.setParent("..")
                pm.setParent("..")
Example #25
0
def connect(*args):
    horizontal_attr, vertical_attr, overscan_attr = update()
    pm.connectControl(horizontal_slider, horizontal_attr)
    pm.connectControl(vertical_slider, vertical_attr)
    pm.connectControl(overscan_slider, overscan_attr)    
Example #26
0
    def OpenMayaCommonGlobalsCreateTab(self):
        scLo = "scrollLayout"
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        if self.rendererTabUiDict.has_key("common"):
            self.rendererTabUiDict.pop("common")
        uiDict = {}
        self.rendererTabUiDict["common"] = uiDict
        clo = "clo"

        with pm.frameLayout(clo, labelVisible=False, collapsable=False, mw=8, mh=5, borderVisible=False):
            with pm.columnLayout(adj=True):
                uiDict["imgpath"] = pm.text(label="Path:", align="left", font="smallBoldLabelFont")
                uiDict["imgname"] = pm.text(label="File Name:", align="left", font="smallBoldLabelFont")
                uiDict["imgsize"] = pm.text(label="Image Size:", align="left", font="smallBoldLabelFont")

        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0) as sl:
            with pm.columnLayout("commonTabColumn", adjustableColumn=True, width=400) as ctc:
                with pm.frameLayout(label="File Output", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        uiDict["fileNamePrefixField"] = pm.textFieldGrp(
                            label="File Name Prefix:", cc=self.updateFileNamePrefix
                        )
                        pm.connectControl(
                            uiDict["fileNamePrefixField"], pm.SCENE.defaultRenderGlobals.imageFilePrefix, index=2
                        )
                        pm.attrEnumOptionMenuGrp(
                            "imageMenuMayaSW", label="Image Format:", attribute=self.renderNode.imageFormat
                        )
                        formats = self.renderNode.imageFormat.getEnums().keys()
                        if "EXR" in formats:
                            with pm.columnLayout("exrOptionsLayout", adjustableColumn=True, width=400) as uiDict[
                                "exrOptionsLayout"
                            ]:
                                self.addRenderGlobalsUIElement(
                                    attName="exrDataTypeHalf",
                                    uiType="bool",
                                    displayName="Half Float",
                                    default="false",
                                    uiDict={},
                                )
                                self.addRenderGlobalsUIElement(
                                    attName="exrMergeChannels",
                                    uiType="bool",
                                    displayName="Merge passes",
                                    default="true",
                                    uiDict={},
                                )

                        uiDict["imageNumbering"] = pm.optionMenuGrp(
                            label="Frame/Animation ext:", changeCommand=self.setFrameNumbering
                        )
                        for value in ["name.ext", "name.#.ext"]:
                            pm.menuItem(value)
                        if self.defaultGlobals.animation.get():
                            uiDict["imageNumbering"].setSelect(2)

                        self.addRenderDefaultGlobalsUIElement(
                            attName="extensionPadding", uiType="int", displayName="Frame Padding:", uiDict=uiDict
                        )

                with pm.frameLayout(label="Frame Range", collapsable=True, collapse=False) as frameRangeLayout:
                    uiDict["frameRangeLayout"] = frameRangeLayout
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderDefaultGlobalsUIElement(
                            attName="startFrame", uiType="float", displayName="Start Frame:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="endFrame", uiType="float", displayName="End Frame:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="byFrameStep", uiType="float", displayName="By Frame:", uiDict=uiDict
                        )

                with pm.frameLayout(label="Renderable Cameras", collapsable=True, collapse=False) as uiDict[
                    "camerasFrame"
                ]:
                    self.createCamerasUI(uiDict)

                with pm.frameLayout(label="Image Size", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        uiDict["imageSizePresets"] = pm.optionMenuGrp(label="Presets:", changeCommand=self.setImageSize)
                        for imgFormat in self.imageFormatData:
                            pm.menuItem(imgFormat[0])

                        self.addRenderDefaultResGlobalsUIElement(
                            attName="aspectLock", uiType="bool", displayName="Maintain aspect ratio", uiDict=uiDict
                        )
                        self.addRenderDefaultResGlobalsUIElement(
                            attName="width",
                            uiType="int",
                            displayName="Width:",
                            uiDict=uiDict,
                            callback=pm.Callback(self.updateImageSize, "width"),
                        )
                        self.addRenderDefaultResGlobalsUIElement(
                            attName="height",
                            uiType="int",
                            displayName="Height:",
                            uiDict=uiDict,
                            callback=pm.Callback(self.updateImageSize, "height"),
                        )
                        self.addRenderDefaultResGlobalsUIElement(
                            attName="deviceAspectRatio",
                            uiType="float",
                            displayName="Device Aspect:",
                            uiDict=uiDict,
                            callback=pm.Callback(self.updateImageSize, "devAsp"),
                        )

                with pm.frameLayout(label="Render Scripts", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderDefaultGlobalsUIElement(
                            attName="preMel", uiType="string", displayName="Pre Render Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="postMel", uiType="string", displayName="Post Render Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="preRenderLayerMel", uiType="string", displayName="Pre Layer Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="postRenderLayerMel", uiType="string", displayName="Post Layer Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="preRenderMel", uiType="string", displayName="Pre Frame Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="postRenderMel", uiType="string", displayName="Post Frame Mel:", uiDict=uiDict
                        )

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(
            parentForm,
            edit=True,
            attachForm=[
                (clo, "right", 0),
                (clo, "left", 0),
                (clo, "top", 0),
                (scLo, "bottom", 0),
                (scLo, "left", 0),
                (scLo, "right", 0),
            ],
            attachControl=[(scLo, "top", 0, clo)],
        )
        self.OpenMayaCommonGlobalsUpdateTab()
        self.updateExrUI()
        self.updateImageSize(["width"])
        self.updateFileNamePrefix()
        pm.scriptJob(attributeChange=(self.renderNode.imageFormat, self.updateExrUI), parent=parentForm)
        defrw = pm.SCENE.defaultResolution.width
        defrh = pm.SCENE.defaultResolution.height
        defrd = pm.SCENE.defaultResolution.deviceAspectRatio
        pm.scriptJob(attributeChange=(defrw, pm.Callback(self.updateImageSize, ["width"])), runOnce=True)
        pm.scriptJob(attributeChange=(defrh, pm.Callback(self.updateImageSize, ["height"])), runOnce=True)
        pm.scriptJob(attributeChange=(defrd, pm.Callback(self.updateImageSize, ["devAsp"])), runOnce=True)
        pm.scriptJob(event=("SelectionChanged", self.selectionChangedEvent))
Example #27
0
 def _addControl(self, ui, attrName, connectIndex=2):
     self._uis[attrName] = ui
     attr = pm.Attribute("appleseedRenderGlobals." + attrName)
     pm.connectControl(ui, attr, index=connectIndex)
Example #28
0
    def AppleseedEnvironmentCreateTab(self):
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "AOScrollLayout"
        envDict = {}
        self.rendererTabUiDict['environment'] = envDict
        uiDict = envDict
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Environment Lighting", collapsable=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".environmentType")
                        envDict['environmentType'] = pm.attrEnumOptionMenuGrp(label="Environment Type", at=self.renderGlobalsNodeName + ".environmentType", ei=self.getEnumList(attr))

                with pm.frameLayout(label="Environment Colors", collapsable=False) as envDict['commonEnvFrame']:
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        ui = pm.floatFieldGrp(label="Environment Intensity:", value1=1.0, numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".environmentIntensity", index=2)
                        envDict['environmentColor'] = pm.attrColorSliderGrp(label="Environment Color:", at=self.renderGlobalsNodeName + ".environmentColor")
                        envDict['gradientHorizon'] = pm.attrColorSliderGrp(label="Gradient Horizon Color:", at=self.renderGlobalsNodeName + ".gradientHorizon")
                        envDict['gradientZenit'] = pm.attrColorSliderGrp(label="Gradient Zenith Color:", at=self.renderGlobalsNodeName + ".gradientZenit")
                        envDict['environmentMap'] = pm.attrColorSliderGrp(label="Environment Map:", at=self.renderGlobalsNodeName + ".environmentMap")
                        self.addRenderGlobalsUIElement(attName='latlongHoShift', uiType='float', displayName='Lat-Long Horizontal Shift:', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='latlongVeShift', uiType='float', displayName='Lat-Long Vertical Shift:', uiDict=uiDict)

                with pm.frameLayout(label="Physical Sky", collapsable=False) as envDict['pysSkyFrame']:
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".skyModel")
                        envDict['pskModel'] = pm.attrEnumOptionMenuGrp(label="Sky Model:", at=self.renderGlobalsNodeName + ".skyModel", ei=self.getEnumList(attr))
                        uiDict['sunLightOptionMenu'] = pm.optionMenuGrp(label="Sun Light:", changeCommand=self.updateSunLightOptionMenu)
                        envDict['pskGrAlbedo'] = pm.floatFieldGrp(label="Ground Albedo:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskGrAlbedo'], self.renderGlobalsNodeName + ".ground_albedo", index=2)
                        envDict['pskGrHShit'] = pm.floatFieldGrp(label="Horizon Shift:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskGrHShit'], self.renderGlobalsNodeName + ".horizon_shift", index=2)
                        envDict['pskLumMulti'] = pm.floatFieldGrp(label="Luminance Multiplier:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskLumMulti'], self.renderGlobalsNodeName + ".luminance_multiplier", index=2)
                        envDict['pskSatMulti'] = pm.floatFieldGrp(label="Saturation Multiplier:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskSatMulti'], self.renderGlobalsNodeName + ".saturation_multiplier", index=2)
                        envDict['pskTurb'] = pm.floatFieldGrp(label="Turbidity:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskTurb'], self.renderGlobalsNodeName + ".turbidity", index=2)
                        envDict['pskTurbMin'] = pm.floatFieldGrp(label="Turbidity Min:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskTurbMin'], self.renderGlobalsNodeName + ".turbidity_min", index=2)
                        envDict['pskTurbMax'] = pm.floatFieldGrp(label="Turbidity Max:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskTurbMax'], self.renderGlobalsNodeName + ".turbidity_max", index=2)

                with pm.frameLayout(label="OSL", collapsable=False) as envDict['oslFrame']:
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        envDict['environmentOSL'] = pm.attrColorSliderGrp(label="OSL Background", at=self.renderGlobalsNodeName + ".environmentOSL")

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.environmentType, pm.Callback(self.uiCallback, tab="environment")])
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.skyModel, pm.Callback(self.uiCallback, tab="environment")])
        self.updateEnvironment()
Example #29
0
    def __init__(self, parent, aovObject, lockName=False):
        self.outputsChanged = True
        self.parent = parent
        self.aov = aovObject
        DARK_BLUE = [.16, .17, .2]
        aovNode = self.aov.node

        self.baseWidget = pm.cmds.columnLayout(adj=True)

        pm.cmds.rowLayout(nc=3,
                          rowAttach=([1, 'top', 2], [3, 'top', 2]),
                          columnWidth3=[
                              sum(AOV_ROW_WIDTHS) + 8,
                              sum(OUTPUT_ROW_WIDTHS) + 8, 20
                          ],
                          columnAttach3=['right', 'both', 'both'])

        # AOV UI --------
        pm.cmds.rowLayout(nc=3,
                          columnWidth3=AOV_ROW_WIDTHS,
                          columnAttach3=['right', 'both', 'both'])

        self.enabledCtrl = pm.cmds.checkBox(label='')
        pm.connectControl(self.enabledCtrl, aovNode.attr('enabled'))

        nameAttr = aovNode.attr('name')
        # use evalDeferred to ensure that the update happens after the aov node attribute is set
        self.nameCtrl = pm.textField(
            editable=not lockName,
            # we save out the current aov name for the replaceShadingGroupDummyAttrs callback
            changeCommand=lambda new, old=nameAttr.get(): self.aov.rename(
                new, old))
        pm.connectControl(self.nameCtrl, nameAttr)
        # must set editability after connecting control
        self.nameCtrl.setEditable(not lockName)
        if aovNode.isReferenced():
            # orange
            self.nameCtrl.setBackgroundColor(DARK_BLUE)

        #pm.text(label='name')
        # attrEnumOptionMenu does not work with multi-attrs and optionMenu does not work with connectControl,
        # so, unfortunately, our best option is attrEnumOptionMenuGrp
        self.channelsMenu = pm.cmds.attrEnumOptionMenuGrp(attribute=str(
            aovNode.attr('type')),
                                                          columnWidth2=[1, 50])

        pm.setParent('..')

        pm.cmds.frameLayout(labelVisible=False)
        self.outputColumn = pm.cmds.columnLayout(adj=True, rowSpacing=2)

        # cache the list of outputs
        self.outputs = []
        for outputAttr in aovNode.attr('outputs'):
            try:
                outputRow = AOVOutputItem(self.outputColumn, outputAttr, self)
            except IndexError:
                continue
            else:
                self.outputs.append(outputRow)
                #pm.symbolButton(image="navButtonConnected.png")
                #pm.symbolButton(image="smallTrash.png")
                pm.setParent('..')

        pm.setParent('..')
        pm.setParent('..')

        aovMenuButton = pm.cmds.symbolButton(image="arrowDown.png")
        #        pm.symbolButton(image="smallTrash.png",
        #                        command=lambda *args: self.parent.removeAOV(aovNode))

        self.popupMenu = pm.cmds.popupMenu(parent=aovMenuButton,
                                           button=1,
                                           postMenuCommand=self.buildPopupMenu)

        pm.setParent('..')
        pm.setParent('..')
Example #30
0
    def KrayPhotonsCreateTab(self):
        log.debug("KrayPhotonsCreateTab()")
        self.createGlobalsNode()
        photonsDict = {}
        self.rendererTabUiDict['photons'] = photonsDict
        causticDict = {}
        self.rendererTabUiDict['caustic'] = causticDict

        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "PhotonsScrollLayout"
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Photons", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        ui = pm.floatFieldGrp(label="GI Resolution:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".giResolution", index=2)                     
                        ui = pm.checkBoxGrp(label="GI Resolution Auto:")
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".giResolutionAuto", index=2)                     
                        ui = pm.checkBoxGrp(label="Preview Photons:")
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".previewPhotons", index=2)                     
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".photonMapType")
                        ui = pm.attrEnumOptionMenuGrp(label="Photon Map Type", at=self.renderGlobalsNodeName + ".photonMapType", ei=self.getEnumList(attr)) 
                        ui = pm.intFieldGrp(label="Photons:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".photonCount", index=2)                         
                        ui = pm.floatFieldGrp(label="Power:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".photonPower", index=2)                     
                        ui = pm.floatFieldGrp(label="NBlur:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".photonNBlur", index=2) 
                        ui = pm.floatFieldGrp(label="Precache Dist:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".photonPrecacheDist", index=2) 
                        ui = pm.floatFieldGrp(label="Precache Blur:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".photonPrecacheBlur", index=2) 
                        pm.separator() 
                        ui = pm.checkBoxGrp(label="Auto Photons:")
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".photonUseAutoPhotons", index=2)                     
                        ui = pm.floatFieldGrp(label="Auto Photons Low:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".photonAutoPhotonsLow", index=2)                     
                        ui = pm.floatFieldGrp(label="Auto Photons High:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".photonAutoPhotonsHigh", index=2)                     
                        ui = pm.floatFieldGrp(label="Auto Photons Steps:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".photonAutoPhotonsSteps", index=2)                     
                        
                with pm.frameLayout(label="Caustics", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        ui = pm.checkBoxGrp(label="Add To Lightmap:")
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".causticsAddToLightmap", index=2)                     
                        pm.separator()
                        ui = pm.intFieldGrp(label="Caustic Photons:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".causticsCount", index=2)                         
                        ui = pm.floatFieldGrp(label="Caustic Power:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".causticsPower", index=2)                     
                        ui = pm.floatFieldGrp(label="Caustic NBlur:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".causticsNBlur", index=2)                     
                        pm.separator()
                        ui = pm.checkBoxGrp(label="Caustic Auto Photons:")
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".causticsUseAutoPhotons", index=2)                     
                        ui = pm.floatFieldGrp(label="Caustic Auto Low:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".causticsAutoPhotonsLow", index=2)                     
                        ui = pm.floatFieldGrp(label="Caustic Auto High:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".causticsAutoPhotonsHigh", index=2)                     
                        ui = pm.floatFieldGrp(label="Caustic Auto Steps:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".causticsAutoPhotonsSteps", index=2)                     
                    

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
Example #31
0
    def FujiRendererCreateTab(self):
        log.debug("FujiRendererCreateTab()")
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "ScrollLayout"

        if self.rendererTabUiDict.has_key('common'):
            self.rendererTabUiDict.pop('common')

        parentForm = pm.setParent(query=True)
        uiDict = {}
        self.rendererTabUiDict['common'] = uiDict

        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout",
                                 adjustableColumn=True,
                                 width=400):
                with pm.frameLayout(label="Sampling",
                                    collapsable=True,
                                    collapse=False):
                    self.addRenderGlobalsUIElement(attName='sampleJitter',
                                                   uiType='float',
                                                   displayName='SampleJitter',
                                                   default='1.0',
                                                   uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='sample_time_range_min',
                        uiType='float',
                        displayName='Sample Time Range Min',
                        default='0.0',
                        uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='sample_time_range_max',
                        uiType='float',
                        displayName='Sample Time Range Max',
                        default='1.0',
                        uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='samplesX',
                        uiType='int',
                        displayName='Pixel Samples x',
                        default=3,
                        uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='samplesY',
                        uiType='int',
                        displayName='Pixel Samples y',
                        default=3,
                        uiDict=uiDict)
                    pm.separator()
                    self.addRenderGlobalsUIElement(attName='cast_shadow',
                                                   uiType='bool',
                                                   displayName='Cast Shadows',
                                                   default='true',
                                                   uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='max_reflect_depth',
                        uiType='int',
                        displayName='Max Reflection Depth',
                        default='3',
                        uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='max_refract_depth',
                        uiType='int',
                        displayName='Max Refraction Depth',
                        default='3',
                        uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='raymarch_step',
                        uiType='float',
                        displayName='Raymarching Stepsize',
                        default='0.05',
                        uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='raymarch_shadow_step',
                        uiType='float',
                        displayName='Raymarching Shadow Stepsize',
                        default='0.1',
                        uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='raymarch_reflect_ste',
                        uiType='float',
                        displayName='Raymarching Reflection Stepsize',
                        default='0.1',
                        uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='raymarch_refract_ste',
                        uiType='float',
                        displayName='Raymarching Refraction Stepsize',
                        default='0.1',
                        uiDict=uiDict)
                    pm.separator()
                    self.addRenderGlobalsUIElement(attName='doMotionBlur',
                                                   uiType='bool',
                                                   displayName='Motionblur:',
                                                   default=False,
                                                   uiDict=uiDict)
                    self.addRenderGlobalsUIElement(
                        attName='doDof',
                        uiType='bool',
                        displayName='Depth of Field:',
                        default=False,
                        uiDict=uiDict)

                with pm.frameLayout(label="Output",
                                    collapsable=True,
                                    collapse=False):
                    attr = pm.Attribute(self.renderGlobalsNodeName +
                                        ".imageFormat")
                    ui = pm.attrEnumOptionMenuGrp(
                        label="Image Format",
                        at=self.renderGlobalsNodeName + ".imageFormat",
                        ei=self.getEnumList(attr))

                with pm.frameLayout(label="Filtering",
                                    collapsable=True,
                                    collapse=False):
                    attr = pm.Attribute(self.renderGlobalsNodeName +
                                        ".filtertype")
                    ui = pm.attrEnumOptionMenuGrp(
                        label="Filter Type",
                        at=self.renderGlobalsNodeName + ".filtertype",
                        ei=self.getEnumList(attr))
                    ui = pm.intFieldGrp(label="Filter Size:", numberOfFields=1)
                    pm.connectControl(ui,
                                      self.renderGlobalsNodeName +
                                      ".filtersize",
                                      index=2)

                with pm.frameLayout(label="Renderer",
                                    collapsable=True,
                                    collapse=False):
                    self.addRenderGlobalsUIElement(
                        attName='use_max_thread',
                        uiType='bool',
                        displayName='Use Max Threads',
                        default='true',
                        uiDict=uiDict)
                    self.addRenderGlobalsUIElement(attName='threads',
                                                   uiType='int',
                                                   displayName='Threads',
                                                   default=8,
                                                   uiDict=uiDict)
                    self.addRenderGlobalsUIElement(attName='tilesize',
                                                   uiType='int',
                                                   displayName='Tile Size',
                                                   default=64,
                                                   uiDict=uiDict)
                    ui = pm.intFieldGrp(label="Verbosity:", numberOfFields=1)
                    pm.connectControl(ui,
                                      self.renderGlobalsNodeName +
                                      ".rendererVerbosity",
                                      index=2)

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm,
                      edit=True,
                      attachForm=[(scLo, "top", 0), (scLo, "bottom", 0),
                                  (scLo, "left", 0), (scLo, "right", 0)])
        self.FujiRendererUpdateTab()
Example #32
0
 def KrayFinalGatheringCreateTab(self):
     log.debug("KrayFinalGatheringCreateTab()")
     self.createGlobalsNode()
     parentForm = pm.setParent(query=True)
     pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
     scLo = self.rendererName + "PhotonsScrollLayout"
     with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
         with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
             with pm.frameLayout(label="Photons frame", collapsable=True, collapse=False):
                 with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                     ui = pm.floatFieldGrp(label="Threshold:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgThreshold", index=2)
                     pm.separator()                     
                     ui = pm.intFieldGrp(label="Min Rays:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgMinRays", index=2) 
                     ui = pm.intFieldGrp(label="Max Rays:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgMaxRays", index=2) 
                     ui = pm.floatFieldGrp(label="Prerender:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPrerender", index=2)                     
                     ui = pm.intFieldGrp(label="Passes:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPasses", index=2) 
                     pm.separator()                     
                     ui = pm.floatFieldGrp(label="Sploth Detect:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSplotchDetect", index=2)                     
                     ui = pm.floatFieldGrp(label="Sensitivity:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSensitivity", index=2)  
                     pm.separator()                     
                     ui = pm.checkBoxGrp(label="FG Reflections:", value1=False)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgReflections", index=2) 
                     ui = pm.checkBoxGrp(label="FG Refractions:", value1=False)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgRefractions", index=2)                   
                     pm.separator()                     
                     ui = pm.floatFieldGrp(label="Spatial Tolerance:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSpatialTolerance", index=2)  
                     ui = pm.floatFieldGrp(label="Angular Tolerance:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgAngularTolerance", index=2)  
                     ui = pm.floatFieldGrp(label="FG Min Dist:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgDistMin", index=2)  
                     ui = pm.floatFieldGrp(label="FG Dist Max:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgDistMax", index=2)  
                     ui = pm.floatFieldGrp(label="Density/Brightness:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgBrightness", index=2)  
                     pm.separator()                     
                     ui = pm.intFieldGrp(label="Path Passes:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPathPasses", index=2)  
                     ui = pm.floatFieldGrp(label="Corner Dist:", numberOfFields=1)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgCornerDist", index=2)  
                     ui = pm.checkBoxGrp(label="Show Samples:", value1=False)
                     pm.connectControl(ui, self.renderGlobalsNodeName + ".fgShowSamples", index=2) 
                     
     pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
     pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
Example #33
0
    def AppleseedRendererCreateTab(self):
        log.debug("AppleseedRendererCreateTab()")
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "ScrollLayout"
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Sampling", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        ui = pm.checkBoxGrp(label="Adaptive Sampling:", value1=False, cc=self.AppleseedRendererUpdateTab)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".adaptiveSampling", index=2)
                        self.rendererTabUiDict['minSamples'] = pm.intFieldGrp(label="Samples min:", value1=2, numberOfFields=1)
                        pm.connectControl(self.rendererTabUiDict['minSamples'], self.renderGlobalsNodeName + ".minSamples", index=2)
                        ui = pm.intFieldGrp(label="Samples max:", value1=16, numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".maxSamples", index=2)
                        self.rendererTabUiDict['maxError'] = pm.floatFieldGrp(label="Max Error:", value1=0.01, numberOfFields=1)
                        pm.connectControl(self.rendererTabUiDict['maxError'], self.renderGlobalsNodeName + ".maxError", index=2)
                        pm.separator()
                        ui = pm.checkBoxGrp(label="Motionblur:", value1=False)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".doMotionBlur", index=2)
                        ui = pm.checkBoxGrp(label="Depth Of Field:", value1=False)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".doDof", index=2)
                    
                with pm.frameLayout(label="Output", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        #attr = pm.Attribute(self.renderGlobalsNodeName + ".imageFormat")
                        #ui = pm.attrEnumOptionMenuGrp(label = "Image Format", at=self.renderGlobalsNodeName + ".imageFormat", ei = self.getEnumList(attr)) 
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".bitdepth")
                        ui = pm.attrEnumOptionMenuGrp(label="Bit Depth", at=self.renderGlobalsNodeName + ".bitdepth", ei=self.getEnumList(attr)) 
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".colorSpace")
                        ui = pm.attrEnumOptionMenuGrp(label="Color Space", at=self.renderGlobalsNodeName + ".colorSpace", ei=self.getEnumList(attr)) 
                        ui = pm.checkBoxGrp(label="Clamping:", value1=False)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".clamping", index=2)
                    
                with pm.frameLayout(label="Filtering", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".filtertype")
                        ui = pm.attrEnumOptionMenuGrp(label="Filter Type", at=self.renderGlobalsNodeName + ".filtertype", ei=self.getEnumList(attr)) 
                        ui = pm.intFieldGrp(label="Filter Size:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".filtersize", index=2)

                with pm.frameLayout(label="Lighting", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".lightingEngine")
                        ui = pm.attrEnumOptionMenuGrp(label="Lighting Engine", at=self.renderGlobalsNodeName + ".lightingEngine", ei=self.getEnumList(attr)) 
                        ui = pm.intFieldGrp(label="Max Trace Depth:", value1=4, numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".maxTraceDepth", index=2)
                        ui = pm.checkBoxGrp(label="Caustics:", value1=False)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".caustics", index=2)
                        with pm.frameLayout(label="Advanced Lighting", collapsable=True, collapse=True):
                            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                                ui = pm.intFieldGrp(label="Diffuse Depth:", value1=4, numberOfFields=1)
                                pm.connectControl(ui, self.renderGlobalsNodeName + ".diffuseDepth", index=2)
                                ui = pm.intFieldGrp(label="Glossy Depth:", value1=4, numberOfFields=1)
                                pm.connectControl(ui, self.renderGlobalsNodeName + ".glossyDepth", index=2)
                                ui = pm.intFieldGrp(label="Direct Light Samples:", value1=4, numberOfFields=1)
                                pm.connectControl(ui, self.renderGlobalsNodeName + ".directLightSamples", index=2)

                    
                with pm.frameLayout(label="Renderer", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        ui = pm.intFieldGrp(label="Threads:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".threads", index=2)
                        ui = pm.intFieldGrp(label="Verbosity:", numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".rendererVerbosity", index=2)
                        ui = pm.intFieldGrp(label="Tile Size:", value1=32, numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".tilesize", index=2)
                        ui = pm.checkBoxGrp(label="Use SBVH Acceleration for mb:", value1=False)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".assemblySBVH", index=2)
                    
        pm.setUITemplate("renderGlobalsTemplate", popTemplate=True)                    
        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
        
        #pm.scriptJob(attributeChange=[self.renderGlobalsNode.samplingType, pm.Callback(self.KrayRendererUIUpdateCallback, "sampling")])

        #self.updateEnvironment()
        self.AppleseedRendererUpdateTab()
	def __init__(self, lightTransform, lightType, lightShape):
		super(SpotLight, self).__init__(lightTransform, lightType, lightShape)
		pm.setParent(self.indivLight_layout)

		pm.rowColumnLayout(nc=3)
		pm.text(l='Decay Rate', w=140, al='right')
		pm.text(l='', w=3)
		decayRate_menu = pm.optionMenu(bgc=primary_componentColor)
		pm.menuItem(l='No Decay', da=0)
		pm.menuItem(l='Linear', da=1)
		pm.menuItem(l='Quadratic', da=2)
		pm.menuItem(l='Cubic', da=3)
		pm.connectControl(decayRate_menu, lightShape+'.decayRate')
		pm.setParent(self.indivLight_layout)

		pm.attrFieldSliderGrp(at=lightShape+'.coneAngle', cw=[[2, 75], [3, 120]], hmb=False)
		pm.attrFieldSliderGrp(at=lightShape+'.penumbraAngle', cw=[[2, 75], [3, 120]], hmb=False)
		pm.attrFieldSliderGrp(at=lightShape+'.dropoff', cw=[[2, 75], [3, 120]], hmb=False)

		pm.rowColumnLayout(nc=2)
		pm.text(l='Shadow Settings', w=90, al='left', en=False)
		pm.separator(w=marginWidth-90, h=14)
		pm.setParent(self.indivLight_layout)

		pm.attrFieldSliderGrp(at=lightShape+'.lightRadius', cw=[[2, 75], [3, 120]], hmb=False)
		self.shadowRays_slide = pm.attrFieldSliderGrp(at=lightShape+'.shadowRays', cw=[[2, 75], [3, 120]], hmb=False)
		pm.attrFieldSliderGrp(at=lightShape+'.rayDepthLimit', cw=[[2, 75], [3, 120]], hmb=False)

		pm.rowColumnLayout(nc=2)
		pm.text(l='Mental Ray Settings', w=106, al='left', en=False)
		pm.separator(w=marginWidth-106, h=14)
		pm.setParent(self.indivLight_layout)

		pm.rowColumnLayout(nc=2)
		pm.text(l='', w=142) # GUI SPACER
		self.areaLight_box = pm.checkBox(l='Area Light', cc=self.MR_settings_enable)
		pm.connectControl(self.areaLight_box, lightShape+'.areaLight')
		pm.setParent(self.indivLight_layout)

		pm.rowColumnLayout(nc=3)
		self.areaType_text = pm.text(l='Type', w=140, al='right')
		pm.text(l='', w=3)
		self.areaType_menu = pm.optionMenu(bgc=primary_componentColor)
		pm.menuItem(l='Rectangle', da=0)
		pm.menuItem(l='Disc', da=1)
		pm.menuItem(l='Sphere', da=2)
		pm.menuItem(l='Cylinder', da=3)
		pm.menuItem(l='Custom', da=4)
		pm.connectControl(self.areaType_menu, lightShape+'.areaType')
		pm.setParent(self.indivLight_layout)

		self.highSamples = pm.intFieldGrp(numberOfFields=2, label='High Samples')
		self.highSampLimit = pm.intFieldGrp(numberOfFields=1, label='High Sample Limit')
		self.lowSamples = pm.intFieldGrp(numberOfFields=2, label='Low Samples')
		pm.connectControl(self.highSamples, lightShape+'.areaSamplingU', index=2)
		pm.connectControl(self.highSamples, lightShape+'.areaSamplingV', index=3)
		pm.connectControl(self.highSampLimit, lightShape+'.areaLowLevel', index=2)
		pm.connectControl(self.lowSamples, lightShape+'.areaLowSamplingU', index=2)
		pm.connectControl(self.lowSamples, lightShape+'.areaLowSamplingV', index=3)
		# self.highSamples = pm.attrFieldGrp(l='High Samples', at=lightShape+'.areaSampling')
		# self.highSampLimit = pm.attrFieldGrp(l='High Sample Limit', at=lightShape+'.areaLowLevel')
		# # self.lowSamples = pm.attrFieldGrp(l='Low Samples', at=lightShape+'.areaLowSampling')

		pm.rowColumnLayout(nc=2)
		pm.text(l='', w=142) # GUI SPACER
		self.visibility_box = pm.checkBox(l='Visible')
		pm.connectControl(self.visibility_box, lightShape+'.areaVisible')
		pm.setParent(self.indivLight_layout)
		self.MR_settings_enable()

		pm.rowColumnLayout(nc=2)
		pm.text(l='Barn Doors Settings', w=106, al='left', en=False)
		pm.separator(w=marginWidth-106, h=14)
		pm.setParent(self.indivLight_layout)

		pm.rowColumnLayout(nc=2)
		pm.text(l='', w=142) # GUI SPACER
		self.barnDoors_box = pm.checkBox(l='Barn Doors', cc=self.barnDoors_enable)
		pm.connectControl(self.barnDoors_box, lightShape+'.barnDoors')
		pm.setParent(self.indivLight_layout)

		self.leftBarn = pm.attrFieldSliderGrp(at=lightShape+'.leftBarnDoor', cw=[[2, 75], [3, 120]])
		self.rightBarn = pm.attrFieldSliderGrp(at=lightShape+'.rightBarnDoor', cw=[[2, 75], [3, 120]])
		self.topBarn = pm.attrFieldSliderGrp(at=lightShape+'.topBarnDoor', cw=[[2, 75], [3, 120]])
		self.bottomBarn = pm.attrFieldSliderGrp(at=lightShape+'.bottomBarnDoor', cw=[[2, 75], [3, 120]])
		self.barnDoors_enable()

		pm.setParent(lights_layout)
Example #35
0
    def createUi(self, node = None):
        log.debug("createUi for node %s" % str(node))
        currentSegment = ""
        layoutList = []        
        for att in self.attList:            
            if att.kategory!=None and currentSegment != att.kategory:
                log.debug("kategory %s != %s" % (currentSegment, att.kategory ))
                katlist = att.kategory.split("|")
                diff = len(layoutList) - len(katlist)
                # neue liste ist kuerzer als alte, also solange dicht machen bis die laenge gleich ist
                log.debug("check diff %d" % diff)                
                while diff > 0:
                    layoutList.pop()
                    pm.setParent("..")
                    pm.setParent("..")
                    diff = len(layoutList) - len(katlist)
                    log.debug("new diff %d" % diff)

                # alte liste ist nun nicht laenger als neue liste
                # durchgehen und alles dichtmachen was nicht gleich ist
                for i in range(len(layoutList)):
                    kat = katlist[i]
                    ckat = layoutList[i]
                    # wenn werte ungelich dann alles was noch kommt zumachen
                    if kat != ckat:
                        laylen = len(layoutList)
                        for n in range(i, laylen):
                            pm.setParent("..")
                            pm.setParent("..")
                            layoutList.pop(n)
                
                # nun sollte sichergestellt sein, dass layoutList nur noch elemente
                # enthaelt, die gleich sind, also kann man daran anknuepfen
                for i in range(len(layoutList), len(katlist)):
                    log.debug("opening layout for katlist %s %d %s" % (str(katlist), i, katlist[i]))
                    self.beginUISegment(katlist[i])          
                    layoutList.append(katlist[i])
                
                currentSegment = att.kategory                  
                                
            if MAP_API_ATTR.has_key(att.type):
                log.debug("Adding element %s with displayName %s" % (att.attname,att.displayname))
                attype, attypeval = MAP_API_ATTR[att.type]
                log.debug("Adding attribute named %s type %s val %s default %s" % (att.attname, attype, attypeval, att.default))
                if attypeval == 'bool':
                    att.uiElement = pm.checkBoxGrp( att.attname,  numberOfCheckBoxes = 1, label1 = att.displayname, cc = Callback(self.dimConnections,att))
                    att.uiDimFunction = pm.checkBoxGrp
                    if node:
                        pm.connectControl(att.uiElement, node + "." + att.attname, index = 2 )
                if attypeval == 'int':
                    att.uiElement = pm.intFieldGrp( att.attname, numberOfFields=1, label=att.displayname, value1=att.default, cc = Callback(self.dimConnections,att))
                    att.uiDimFunction = pm.intFieldGrp
                    if node:
                        pm.connectControl(att.uiElement, node + "." + att.attname, index = 2 )
                if attypeval == 'long2':
                    if node:
                        att.uiDimFunction = pm.attrFieldGrp( label = att.displayname, attribute='%s' % (node + "." + att.attname), cc = Callback(self.dimConnections,att))
                if attypeval == 'float':
                    att.uiElement = pm.floatFieldGrp( att.attname, numberOfFields=1, label=att.displayname, value1=att.default, cc = Callback(self.dimConnections,att))
                    att.uiDimFunction = pm.floatFieldGrp
                    if node:
                        pm.connectControl(att.uiElement, node + "." + att.attname, index = 2 )
                if attypeval == 'float2':
                    if node:
                        att.uiDimFunction = pm.attrFieldGrp( attribute='%s' % (node + "." + att.attname), cc = Callback(self.dimConnections,att))
                if attypeval == 'string':
                    att.uiElement = pm.textFieldGrp( att.attname, label=att.displayname, text=att.default, cc = Callback(self.dimConnections,att))
                    pm.connectControl(att.uiElement, node + "." + att.attname, index = 2 )
                    pm.textFieldGrp(att.uiElement, edit=True, text = att.default)

                if attypeval == 'enum':
                    poplist = map(list, enumerate(att.values))
                    
                    if node:
                        nodeatt = node + "." + att.attname
                        att.uiElement = pm.attrEnumOptionMenuGrp(att.attname, label = att.displayname, at=nodeatt, ei = poplist, vcc = Callback(self.dimConnections,att))            
                        att.uiDimFunction = pm.attrEnumOptionMenuGrp
                    else:
                        att.uiElement = pm.attrEnumOptionMenuGrp(att.attname, label = att.displayname, ei = poplist, vcc = Callback(self.dimConnections,att))            
                        att.uiDimFunction = pm.attrEnumOptionMenuGrp
                    
                if attypeval == 'message':
                    pass
                
        if len(layoutList) > 0:
            for i in range(len(layoutList)):
                pm.setParent("..")
                pm.setParent("..")
Example #36
0
def createArnoldTextureSettings():
    """The patched version of the original file
    """
    import pymel.core as pm
    import maya.cmds as cmds
    import pymel.versions as versions
    from mtoa.ui.globals import settings

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

    pm.attrControlGrp(
        'autotx',
        cc=settings.updateAutoTxSettings,
        label="Auto-convert Textures to TX (Disabled in Anima)",
        attribute='defaultArnoldRenderOptions.autotx',
        enable=False
    )

    pm.attrControlGrp('use_existing_tiled_textures',
                      label="Use Existing TX Textures",
                      attribute='defaultArnoldRenderOptions.use_existing_tiled_textures')

    # disable autotx
    pm.setAttr('defaultArnoldRenderOptions.autotx', 0)
    settings.updateAutoTxSettings()
    cmds.separator()

    # don't create texture_automip for 2017 as autoTx is ON by default
    maya_version = versions.shortName()
    if int(float(maya_version)) < 2017:
        pm.attrControlGrp('texture_automip',
                          label="Auto-mipmap",
                          attribute='defaultArnoldRenderOptions.textureAutomip')

    pm.attrControlGrp('texture_accept_unmipped',
                      label="Accept Unmipped",
                      attribute='defaultArnoldRenderOptions.textureAcceptUnmipped')

    cmds.separator()

    pm.checkBoxGrp('ts_autotile',
                   cc=settings.updateAutotileSettings,
                   label='',
                   label1='Auto-tile')

    pm.connectControl('ts_autotile', 'defaultArnoldRenderOptions.autotile',
                      index=2)

    pm.intSliderGrp('ts_texture_autotile',
                    label="Tile Size",
                    minValue=16,
                    maxValue=64,
                    fieldMinValue=16,
                    fieldMaxValue=1024
                    )

    pm.connectControl('ts_texture_autotile',
                      'defaultArnoldRenderOptions.textureAutotile', index=1)
    pm.connectControl('ts_texture_autotile',
                      'defaultArnoldRenderOptions.textureAutotile', index=2)
    pm.connectControl('ts_texture_autotile',
                      'defaultArnoldRenderOptions.textureAutotile', index=3)

    '''pm.attrControlGrp('texture_autotile',
                        label="Auto-tile Size",
                        attribute='defaultArnoldRenderOptions.textureAutotile')'''

    pm.attrControlGrp('texture_accept_untiled',
                      label="Accept Untiled",
                      attribute='defaultArnoldRenderOptions.textureAcceptUntiled')

    pm.attrControlGrp('texture_max_memory_MB',
                      label="Max Cache Size (MB)",
                      attribute='defaultArnoldRenderOptions.textureMaxMemoryMB')

    pm.attrControlGrp('texture_max_open_files',
                      label="Max Open Files",
                      attribute='defaultArnoldRenderOptions.textureMaxOpenFiles')

    cmds.separator()

    cmds.attrControlGrp('texture_diffuse_blur',
                        label="Diffuse Blur",
                        attribute='defaultArnoldRenderOptions.textureDiffuseBlur')

    # cmds.attrControlGrp('texture_glossy_blur',
    #                     label="Glossy Blur",
    #                     attribute='defaultArnoldRenderOptions.textureGlossyBlur')

    pm.setParent('..')

    pm.setUITemplate(popTemplate=True)
 def _addControl(self, ui, attrName, connectIndex=2):
     self._uis[attrName] = ui
     pm.connectControl(ui,
                       "customMayaRendererGlobalsNode." + attrName,
                       index=connectIndex)
Example #38
0
def gui():
    '''
    Triggers the interface for zoomerate.
    '''

    # Warning this is causeing issues with 2012
    panel = pm.getPanel(wf=True)
    try:
        whichCam = pm.modelPanel(panel, q=1, camera=True)
    except RuntimeError:
        whichCam = pm.modelPanel('modelPanel4', q=1, camera=True)
        print 'Using: %s' % whichCam

    whichCamShape = pm.ls(whichCam, dag=True, shapes=True, ap=True)

    # Figure out what cameras to use when building the menu
    cameras = pm.ls(ca=True)
    diffCams = []
    diffCams.extend(whichCamShape)
    diffCams.extend(cameras)
    print diffCams, len(diffCams)

    win_name = 'zoomer_win2'
    if pm.window(win_name, ex=True):
        pm.deleteUI(win_name)

    win = pm.window(win_name,
                    s=0,
                    ip=True,
                    iconName='zoomer',
                    w=400,
                    h=180,
                    t='Camera zoomeratro v1.0')
    main = pm.columnLayout()
    pm.frameLayout(borderVisible=True,
                   labelVisible=True,
                   labelAlign='cener',
                   label='Zoom Options',
                   marginWidth=5,
                   marginHeight=5)
    pm.columnLayout()
    global which_cam_menu
    which_cam_menu = pm.optionMenuGrp(label='Camera to Zoom', cc=connect)
    pm.menuItem(label=whichCamShape[0])
    for i in xrange(len(diffCams) - 1):
        pm.menuItem(label=cameras[i])

    horizontal_attr = '%s.horizontalFilmOffset' % whichCamShape[0]
    vertical_attr = '%s.verticalFilmOffset' % whichCamShape[0]
    overscan_attr = '%s.overscan' % whichCamShape[0]

    global horizontal_slider, vertical_slider, overscan_slider
    horizontal_slider = pm.floatSliderGrp(field=True,
                                          label='Horizontal',
                                          min=-3,
                                          max=3,
                                          pre=3,
                                          step=0.001)
    vertical_slider = pm.floatSliderGrp(field=True,
                                        label='Vertical',
                                        min=-3,
                                        max=3,
                                        pre=3,
                                        step=0.001)
    overscan_slider = pm.floatSliderGrp(field=True,
                                        label='Overscan',
                                        min=-3,
                                        max=3,
                                        pre=3,
                                        step=0.001)

    pm.connectControl(horizontal_slider, horizontal_attr)
    pm.connectControl(vertical_slider, vertical_attr)
    pm.connectControl(overscan_slider, overscan_slider)

    pm.button(label='Reset', c=reset)
    win.show()
Example #39
0
def createArnoldTextureSettings():
    """The patched version of the original file
    """
    import pymel.core as pm
    import maya.cmds as cmds
    import pymel.versions as versions
    from mtoa.ui.globals import settings

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

    pm.attrControlGrp('autotx',
                      cc=settings.updateAutoTxSettings,
                      label="Auto-convert Textures to TX (Disabled in Anima)",
                      attribute='defaultArnoldRenderOptions.autotx',
                      enable=False)

    pm.attrControlGrp(
        'use_existing_tiled_textures',
        label="Use Existing TX Textures",
        attribute='defaultArnoldRenderOptions.use_existing_tiled_textures')

    # disable autotx
    pm.setAttr('defaultArnoldRenderOptions.autotx', 0)
    settings.updateAutoTxSettings()
    cmds.separator()

    # don't create texture_automip for 2017 as autoTx is ON by default
    maya_version = versions.shortName()
    if int(float(maya_version)) < 2017:
        pm.attrControlGrp(
            'texture_automip',
            label="Auto-mipmap",
            attribute='defaultArnoldRenderOptions.textureAutomip')

    pm.attrControlGrp(
        'texture_accept_unmipped',
        label="Accept Unmipped",
        attribute='defaultArnoldRenderOptions.textureAcceptUnmipped')

    cmds.separator()

    pm.checkBoxGrp('ts_autotile',
                   cc=settings.updateAutotileSettings,
                   label='',
                   label1='Auto-tile')

    pm.connectControl('ts_autotile',
                      'defaultArnoldRenderOptions.autotile',
                      index=2)

    pm.intSliderGrp('ts_texture_autotile',
                    label="Tile Size",
                    minValue=16,
                    maxValue=64,
                    fieldMinValue=16,
                    fieldMaxValue=1024)

    pm.connectControl('ts_texture_autotile',
                      'defaultArnoldRenderOptions.textureAutotile',
                      index=1)
    pm.connectControl('ts_texture_autotile',
                      'defaultArnoldRenderOptions.textureAutotile',
                      index=2)
    pm.connectControl('ts_texture_autotile',
                      'defaultArnoldRenderOptions.textureAutotile',
                      index=3)
    '''pm.attrControlGrp('texture_autotile',
                        label="Auto-tile Size",
                        attribute='defaultArnoldRenderOptions.textureAutotile')'''

    pm.attrControlGrp(
        'texture_accept_untiled',
        label="Accept Untiled",
        attribute='defaultArnoldRenderOptions.textureAcceptUntiled')

    pm.attrControlGrp(
        'texture_max_memory_MB',
        label="Max Cache Size (MB)",
        attribute='defaultArnoldRenderOptions.textureMaxMemoryMB')

    pm.attrControlGrp(
        'texture_max_open_files',
        label="Max Open Files",
        attribute='defaultArnoldRenderOptions.textureMaxOpenFiles')

    cmds.separator()

    cmds.attrControlGrp(
        'texture_diffuse_blur',
        label="Diffuse Blur",
        attribute='defaultArnoldRenderOptions.textureDiffuseBlur')

    # cmds.attrControlGrp('texture_glossy_blur',
    #                     label="Glossy Blur",
    #                     attribute='defaultArnoldRenderOptions.textureGlossyBlur')

    pm.setParent('..')

    pm.setUITemplate(popTemplate=True)
Example #40
0
def connect(*args):
    horizontal_attr, vertical_attr, overscan_attr = update()
    pm.connectControl(horizontal_slider, horizontal_attr)
    pm.connectControl(vertical_slider, vertical_attr)
    pm.connectControl(overscan_slider, overscan_attr)
	def __init__(self, shape):
		self.lightShape = shape
		self.lightTransform = pm.listRelatives(self.lightShape, parent=True, fullPath=True)[0]

		self.existingPath = pm.getAttr(self.lightShape+'.texture')
		if self.existingPath == None:
			self.existingPath = ''

		iblFrame_layout = pm.frameLayout(l='{0} ({1})'.format(self.lightTransform, 'mentalrayIbl'), cl=True, cll=True, w=marginWidth, bgc=frameColor, ann="Settings for {0}".format(self.lightTransform), p=lights_layout)
		ibl_layout = pm.columnLayout()

		pm.text(l='', h=5)
		self.nameField = pm.textFieldGrp(l='Name', text=self.lightTransform, cw=[2, 150], cc=self.nameChange, fcc=True)

		pm.rowColumnLayout(nc=2)
		pm.text(l='Basic Settings', w=75, al='left', en=False)
		pm.separator(w=marginWidth-75, h=14)
		pm.setParent(ibl_layout)
		
		pm.rowColumnLayout(nc=3)
		pm.text(l='Mapping', w=140, al='right')
		pm.text(l='', w=3)
		mapping_menu = pm.optionMenu(bgc=primary_componentColor)
		pm.menuItem(l='Spherical', da=0)
		pm.menuItem(l='Angular', da=1)
		pm.connectControl(mapping_menu, self.lightShape+'.mapping')
		pm.setParent(ibl_layout)

		pm.rowColumnLayout(nc=3)
		pm.text(l='Type', w=140, al='right')
		pm.text(l='', w=3)
		self.type_menu = pm.optionMenu(bgc=primary_componentColor, cc=self.iblSettings_enabled)
		pm.menuItem(l='Image File', da=0)
		pm.menuItem(l='Texture', da=1)
		pm.connectControl(self.type_menu, self.lightShape+'.type')
		pm.setParent(ibl_layout)

		pm.text(l='', h=2)
		pm.rowColumnLayout(nc=2, cw=[2, 18])
		self.ibl_filePath = pm.textFieldGrp(label='Image Name', text=self.existingPath, cw=[2, 170], cc=self.updatePath)
		self.nav_btn = pm.iconTextButton(style='iconOnly', c=self.browse_btn, ann='Browse for file', image1=get_icon_path('folder_icon.png'))
		pm.setParent(ibl_layout)

		self.texture = pm.attrColorSliderGrp(l='Texture', at=self.lightShape+'.color', cw=[[2, 75], [3, 120]], sb=True)

		pm.rowColumnLayout(nc=2)
		pm.text(l='Render Stats', w=69, al='left', en=False)
		pm.separator(w=marginWidth-69, h=14)
		pm.setParent(ibl_layout)

		pm.rowColumnLayout(nc=2)
		pm.text(l='', w=142) # GUI SPACER
		primVis_box = pm.checkBox(l='Primary Visibilty')
		pm.connectControl(primVis_box, self.lightShape+'.primaryVisibility')

		pm.text(l='', w=142) # GUI SPACER
		visEnv_box = pm.checkBox(l='Visible as Environment')
		pm.connectControl(visEnv_box, self.lightShape+'.visibleInEnvironment')

		pm.text(l='', w=142) # GUI SPACER
		visRefl_box = pm.checkBox(l='Visible In Secondary Reflections')
		pm.connectControl(visRefl_box, self.lightShape+'.visibleInReflections')

		pm.text(l='', w=142) # GUI SPACER
		visRefr_box = pm.checkBox(l='Visible In Refractions')
		pm.connectControl(visRefr_box, self.lightShape+'.visibleInRefractions')

		pm.text(l='', w=142) # GUI SPACER
		visFG_box = pm.checkBox(l='Visible In Final Gather')
		pm.connectControl(visFG_box, self.lightShape+'.visibleInFinalGather')

		pm.text(l='', w=142) # GUI SPACER
		self.envColorFX_box = pm.checkBox(l='Adjust Environment Color Effects', cc=self.iblSettings_enabled)
		pm.connectControl(self.envColorFX_box, self.lightShape+'.overrideEnvColorFx')
		
		pm.text(l='', w=142) # GUI SPACER
		self.envInvert_box = pm.checkBox(l='Invert')
		pm.connectControl(self.envInvert_box, self.lightShape+'.envInvert')
		pm.setParent(ibl_layout)

		self.envColorGain = pm.attrColorSliderGrp(l='Color Gain', at=self.lightShape+'.envColorGain', cw=[[2, 75], [3, 120]], sb=True)
		self.envColorOffset = pm.attrColorSliderGrp(l='Color Offset', at=self.lightShape+'.envColorOffset', cw=[[2, 75], [3, 120]], sb=True)

		pm.rowColumnLayout(nc=2)
		pm.text(l='', w=142) # GUI SPACER
		self.fgColorFX_box = pm.checkBox(l='Adjust Final Gather Color Effects', cc=self.iblSettings_enabled)
		pm.connectControl(self.fgColorFX_box, self.lightShape+'.overrideFgColorFx')
		
		pm.text(l='', w=142) # GUI SPACER
		self.fgInvert_box = pm.checkBox(l='Invert')
		pm.connectControl(self.fgInvert_box, self.lightShape+'.fgInvert')
		pm.setParent(ibl_layout)

		self.fgColorGain = pm.attrColorSliderGrp(l='Color Gain', at=self.lightShape+'.fgColorGain', cw=[[2, 75], [3, 120]], sb=True)
		self.fgColorOffset = pm.attrColorSliderGrp(l='Color Offset', at=self.lightShape+'.fgColorOffset', cw=[[2, 75], [3, 120]], sb=True)

		self.iblSettings_enabled()
		pm.setParent(lights_layout)
    def AppleseedEnvironmentCreateTab(self):
        log.debug("AppleseedEnvironmentCreateTab()")
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "AOScrollLayout"
        envDict = {}
        self.rendererTabUiDict['environment'] = envDict
        uiDict = envDict
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Environment Lighting", collapsable=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".environmentType")
                        envDict['environmentType'] = pm.attrEnumOptionMenuGrp(label="Environemnt Type", at=self.renderGlobalsNodeName + ".environmentType", ei=self.getEnumList(attr)) 
                        
                with pm.frameLayout(label="Environment Colors", collapsable=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        ui = pm.floatFieldGrp(label="Environemnt Intensity:", value1=1.0, numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".environmentIntensity", index=2)                    
                        envDict['environmentColor'] = pm.attrColorSliderGrp(label="Environment Color", at=self.renderGlobalsNodeName + ".environmentColor")
                        envDict['gradientHorizon'] = pm.attrColorSliderGrp(label="Gradient Horizon", at=self.renderGlobalsNodeName + ".gradientHorizon")
                        envDict['gradientZenit'] = pm.attrColorSliderGrp(label="Gradient Zenit", at=self.renderGlobalsNodeName + ".gradientZenit")
                        envDict['environmentMap'] = pm.attrColorSliderGrp(label="Environment Map", at=self.renderGlobalsNodeName + ".environmentMap")
                        self.addRenderGlobalsUIElement(attName='latlongHoShift', uiType='float', displayName='LatLong Horiz Shift:', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='latlongVeShift', uiType='float', displayName='LatLong Vertical Shift:', uiDict=uiDict)
#                         envDict['latLongHShift'] = pm.floatFieldGrp(label="LatLong Horiz Shift:", value1=1.0, numberOfFields=1)
#                         pm.connectControl(envDict['latLongHShift'], self.renderGlobalsNodeName + ".latlongHoShift", index=2)
#                         envDict['latLongVShift'] = pm.floatFieldGrp(label="LatLong Vertical Shift:", value1=1.0, numberOfFields=1)
#                         pm.connectControl(envDict['latLongVShift'], self.renderGlobalsNodeName + ".latlongVeShift", index=2)
                    
                with pm.frameLayout(label="Physical Sky", collapsable=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".skyModel")
                        envDict['pskModel'] = pm.attrEnumOptionMenuGrp(label="Sky Model", at=self.renderGlobalsNodeName + ".skyModel", ei=self.getEnumList(attr)) 
                        pm.separator()
                        envDict['pskUsePhySun'] = pm.checkBoxGrp(label="Use Physical Sun:", value1=False, cc=pm.Callback(self.uiCallback, tab="environment"))
                        pm.connectControl(envDict['pskUsePhySun'], self.renderGlobalsNodeName + ".physicalSun", index=2)                    
                        envDict['pskPhySun'] = pm.textFieldGrp(label="Sunobject:", text="", editable=False) 
                        envDict['pskSunExitMulti'] = pm.floatFieldGrp(label="sunExitance Multiplier:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskSunExitMulti'], self.renderGlobalsNodeName + ".sunExitanceMultiplier", index=2)             
                        # pm.connectControl(envDict['pskPhySun'], self.renderGlobalsNodeName + ".physicalSunConnection", index=2)                                                                   
                        pm.separator()
                        envDict['pskGrAlbedo'] = pm.floatFieldGrp(label="Ground Albedo:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskGrAlbedo'], self.renderGlobalsNodeName + ".ground_albedo", index=2)                    
                        envDict['pskGrHShit'] = pm.floatFieldGrp(label="Horizon Shift:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskGrHShit'], self.renderGlobalsNodeName + ".horizon_shift", index=2)                    
                        envDict['pskLumMulti'] = pm.floatFieldGrp(label="Luminance Multiplier:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskLumMulti'], self.renderGlobalsNodeName + ".luminance_multiplier", index=2)                    
                        envDict['pskSatMulti'] = pm.floatFieldGrp(label="Saturation Multiplier:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskSatMulti'], self.renderGlobalsNodeName + ".saturation_multiplier", index=2)                    
                        # envDict['pskSunAzi'] = pm.floatFieldGrp(label="Sun Azimut:", value1=1.0, numberOfFields=1)
                        # pm.connectControl(envDict['pskSunAzi'], self.renderGlobalsNodeName + ".sun_phi", index=2)                    
                        # envDict['pskSunEle'] = pm.floatFieldGrp(label="Sun Elevation:", value1=1.0, numberOfFields=1)
                        # pm.connectControl(envDict['pskSunEle'], self.renderGlobalsNodeName + ".sun_theta", index=2)                    
                        envDict['pskTurb'] = pm.floatFieldGrp(label="Turbidity:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskTurb'], self.renderGlobalsNodeName + ".turbidity", index=2)                    
                        envDict['pskTurbMax'] = pm.floatFieldGrp(label="Turbidity Max:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskTurbMax'], self.renderGlobalsNodeName + ".turbidity_max", index=2)                    
                        envDict['pskTurbMin'] = pm.floatFieldGrp(label="Turbidity Min:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskTurbMin'], self.renderGlobalsNodeName + ".turbidity_min", index=2)
                    
        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
        
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.environmentType, pm.Callback(self.uiCallback, tab="environment")])        
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.skyModel, pm.Callback(self.uiCallback, tab="environment")])   
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.physicalSun, pm.Callback(self.uiCallback, tab="environment")])   
        
        self.updateEnvironment()     
Example #43
0
    def OpenMayaCommonGlobalsCreateTab(self):
        scLo = "scrollLayout"
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        if self.rendererTabUiDict.has_key('common'):
            self.rendererTabUiDict.pop('common')
        uiDict = {}
        self.rendererTabUiDict['common'] = uiDict
        clo = "clo"

        with pm.frameLayout(clo,
                            labelVisible=False,
                            collapsable=False,
                            mw=8,
                            mh=5,
                            borderVisible=False):
            with pm.columnLayout(adj=True):
                uiDict['imgpath'] = pm.text(label="Path:",
                                            align="left",
                                            font="smallBoldLabelFont")
                uiDict['imgname'] = pm.text(label="File Name:",
                                            align="left",
                                            font="smallBoldLabelFont")
                uiDict['imgsize'] = pm.text(label="Image Size:",
                                            align="left",
                                            font="smallBoldLabelFont")

        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0) as sl:
            with pm.columnLayout("commonTabColumn",
                                 adjustableColumn=True,
                                 width=400) as ctc:
                with pm.frameLayout(label="File Output",
                                    collapsable=True,
                                    collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        uiDict['fileNamePrefixField'] = pm.textFieldGrp(
                            label="File Name Prefix:",
                            cc=self.updateFileNamePrefix)
                        pm.connectControl(
                            uiDict['fileNamePrefixField'],
                            pm.SCENE.defaultRenderGlobals.imageFilePrefix,
                            index=2)
                        pm.attrEnumOptionMenuGrp(
                            "imageMenuMayaSW",
                            label="Image Format:",
                            attribute=self.renderNode.imageFormat)
                        formats = self.renderNode.imageFormat.getEnums().keys()
                        if "EXR" in formats:
                            with pm.columnLayout(
                                    "exrOptionsLayout",
                                    adjustableColumn=True,
                                    width=400) as uiDict['exrOptionsLayout']:
                                self.addRenderGlobalsUIElement(
                                    attName='exrDataTypeHalf',
                                    uiType='bool',
                                    displayName='Half Float',
                                    default='false',
                                    uiDict={})
                                self.addRenderGlobalsUIElement(
                                    attName='exrMergeChannels',
                                    uiType='bool',
                                    displayName='Merge passes',
                                    default='true',
                                    uiDict={})

                        uiDict['imageNumbering'] = pm.optionMenuGrp(
                            label="Frame/Animation ext:",
                            changeCommand=self.setFrameNumbering)
                        for value in ["name.ext", "name.#.ext"]:
                            pm.menuItem(value)
                        if self.defaultGlobals.animation.get():
                            uiDict['imageNumbering'].setSelect(2)

                        self.addRenderDefaultGlobalsUIElement(
                            attName='extensionPadding',
                            uiType='int',
                            displayName='Frame Padding:',
                            uiDict=uiDict)

                with pm.frameLayout(label="Frame Range",
                                    collapsable=True,
                                    collapse=False) as frameRangeLayout:
                    uiDict['frameRangeLayout'] = frameRangeLayout
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderDefaultGlobalsUIElement(
                            attName='startFrame',
                            uiType='float',
                            displayName='Start Frame:',
                            uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(
                            attName='endFrame',
                            uiType='float',
                            displayName='End Frame:',
                            uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(
                            attName='byFrameStep',
                            uiType='float',
                            displayName='By Frame:',
                            uiDict=uiDict)

                with pm.frameLayout(label="Renderable Cameras",
                                    collapsable=True,
                                    collapse=False) as uiDict['camerasFrame']:
                    self.createCamerasUI(uiDict)

                with pm.frameLayout(label="Image Size",
                                    collapsable=True,
                                    collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        uiDict['imageSizePresets'] = pm.optionMenuGrp(
                            label="Presets:", changeCommand=self.setImageSize)
                        for imgFormat in self.imageFormatData:
                            pm.menuItem(imgFormat[0])

                        self.addRenderDefaultResGlobalsUIElement(
                            attName='aspectLock',
                            uiType='bool',
                            displayName='Maintain aspect ratio',
                            uiDict=uiDict)
                        self.addRenderDefaultResGlobalsUIElement(
                            attName='width',
                            uiType='int',
                            displayName='Width:',
                            uiDict=uiDict,
                            callback=pm.Callback(self.updateImageSize,
                                                 "width"))
                        self.addRenderDefaultResGlobalsUIElement(
                            attName='height',
                            uiType='int',
                            displayName='Height:',
                            uiDict=uiDict,
                            callback=pm.Callback(self.updateImageSize,
                                                 "height"))
                        self.addRenderDefaultResGlobalsUIElement(
                            attName='deviceAspectRatio',
                            uiType='float',
                            displayName='Device Aspect:',
                            uiDict=uiDict,
                            callback=pm.Callback(self.updateImageSize,
                                                 "devAsp"))

                with pm.frameLayout(label="Render Scripts",
                                    collapsable=True,
                                    collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderDefaultGlobalsUIElement(
                            attName='preMel',
                            uiType='string',
                            displayName='Pre Render Mel:',
                            uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(
                            attName='postMel',
                            uiType='string',
                            displayName='Post Render Mel:',
                            uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(
                            attName='preRenderLayerMel',
                            uiType='string',
                            displayName='Pre Layer Mel:',
                            uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(
                            attName='postRenderLayerMel',
                            uiType='string',
                            displayName='Post Layer Mel:',
                            uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(
                            attName='preRenderMel',
                            uiType='string',
                            displayName='Pre Frame Mel:',
                            uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(
                            attName='postRenderMel',
                            uiType='string',
                            displayName='Post Frame Mel:',
                            uiDict=uiDict)

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm,
                      edit=True,
                      attachForm=[(clo, "right", 0), (clo, "left", 0),
                                  (clo, "top", 0), (scLo, "bottom", 0),
                                  (scLo, "left", 0), (scLo, "right", 0)],
                      attachControl=[(scLo, "top", 0, clo)])
        self.OpenMayaCommonGlobalsUpdateTab()
        self.updateExrUI()
        self.updateImageSize(["width"])
        self.updateFileNamePrefix()
        pm.scriptJob(attributeChange=(self.renderNode.imageFormat,
                                      self.updateExrUI),
                     parent=parentForm)
        defrw = pm.SCENE.defaultResolution.width
        defrh = pm.SCENE.defaultResolution.height
        defrd = pm.SCENE.defaultResolution.deviceAspectRatio
        pm.scriptJob(attributeChange=(defrw,
                                      pm.Callback(self.updateImageSize,
                                                  ["width"])),
                     runOnce=True)
        pm.scriptJob(attributeChange=(defrh,
                                      pm.Callback(self.updateImageSize,
                                                  ["height"])),
                     runOnce=True)
        pm.scriptJob(attributeChange=(defrd,
                                      pm.Callback(self.updateImageSize,
                                                  ["devAsp"])),
                     runOnce=True)
        pm.scriptJob(event=("SelectionChanged", self.selectionChangedEvent))
Example #44
0
    def KrayEnvironmentCreateTab(self):
        log.debug("KrayEnvironmentCreateTab()")
        self.createGlobalsNode()
        envDict = {}
        self.rendererTabUiDict['environment'] = envDict
        bgDict = {}
        self.rendererTabUiDict['background'] = bgDict
        
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "EnvScrollLayout"
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Background", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".backgroundType")
                        ui = pm.attrEnumOptionMenuGrp(label="Background Type", at=self.renderGlobalsNodeName + ".backgroundType", ei=self.getEnumList(attr)) 
                        bgDict['environmentColor'] = pm.attrColorSliderGrp(label="Background Color", at=self.renderGlobalsNodeName + ".environmentColor")
                        bgDict['gradientHorizon'] = pm.attrColorSliderGrp(label="Horizon Color", at=self.renderGlobalsNodeName + ".gradientHorizon")
                        bgDict['gradientZenit'] = pm.attrColorSliderGrp(label="Zenith Color", at=self.renderGlobalsNodeName + ".gradientZenit")
                        bgDict['nadir'] = pm.attrColorSliderGrp(label="Bottom Color", at=self.renderGlobalsNodeName + ".nadir")
                        bgDict['groundAlbedo'] = pm.attrColorSliderGrp(label="Ground Albedo", at=self.renderGlobalsNodeName + ".groundAlbedo")
                        pm.separator()
                        bgDict['environmentMap'] = pm.attrColorSliderGrp(label="Environment Map", at=self.renderGlobalsNodeName + ".environmentMap")
                        bgDict['environmentMap2'] = pm.attrColorSliderGrp(label="Environment Map 2", at=self.renderGlobalsNodeName + ".environmentMap2")
                        pm.separator()
                        bgDict['sunDir'] = pm.attrFieldGrp(label="Sun Direction:", at=self.renderGlobalsNodeName + ".sunDir")
                        bgDict['zenithDir'] = pm.attrFieldGrp(label="Zenith Direction:", at=self.renderGlobalsNodeName + ".zenithDir")
                        bgDict['orientation'] = pm.attrFieldGrp(label="Orientation:", at=self.renderGlobalsNodeName + ".orientation")
                        pm.separator()
                        bgDict['skyGamma'] = pm.floatFieldGrp(label="Sky Gamma:", numberOfFields=1)
                        pm.connectControl(bgDict['skyGamma'], self.renderGlobalsNodeName + ".skyGamma", index=2)                       
                        bgDict['groundGamma'] = pm.floatFieldGrp(label="Ground Gamma:", numberOfFields=1)
                        pm.connectControl(bgDict['groundGamma'], self.renderGlobalsNodeName + ".groundGamma", index=2)                       
                        bgDict['turbidity'] = pm.floatFieldGrp(label="Turbidity:", numberOfFields=1)
                        pm.connectControl(bgDict['turbidity'], self.renderGlobalsNodeName + ".turbidity", index=2)   
                        bgDict['exposure'] = pm.floatFieldGrp(label="Exposure:", numberOfFields=1)
                        pm.connectControl(bgDict['exposure'], self.renderGlobalsNodeName + ".exposure", index=2)   
                        bgDict['sunIntensity'] = pm.floatFieldGrp(label="Sun Intensity:", numberOfFields=1)
                        pm.connectControl(bgDict['sunIntensity'], self.renderGlobalsNodeName + ".sunIntensity", index=2)  
                        pm.separator()
                        bgDict['solidAngle'] = pm.floatFieldGrp(label="Solid Angle:", numberOfFields=1)
                        pm.connectControl(bgDict['solidAngle'], self.renderGlobalsNodeName + ".solidAngle", index=2)   
                        bgDict['sunSpotAngle'] = pm.floatFieldGrp(label="Sun Spot Angle:", numberOfFields=1)
                        pm.connectControl(bgDict['sunSpotAngle'], self.renderGlobalsNodeName + ".sunSpotAngle", index=2)   
                with pm.frameLayout(label="Environment", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".environmentType")
                        ui = pm.attrEnumOptionMenuGrp(label="Environment Type", at=self.renderGlobalsNodeName + ".environmentType", ei=self.getEnumList(attr)) 
                                      


        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.setUITemplate("renderGlobalsTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])

        self.KrayRendererUIUpdateCallback("environment")                
        self.KrayRendererUIUpdateCallback("background")                

        pm.scriptJob(attributeChange=[self.renderGlobalsNode.backgroundType, pm.Callback(self.KrayRendererUIUpdateCallback, "background")])
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.environmentType, pm.Callback(self.KrayRendererUIUpdateCallback, "environment")])
Example #45
0
    def AppleseedRendererCreateTab(self):
        log.debug("AppleseedRendererCreateTab()")
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "ScrollLayout"
        if self.rendererTabUiDict.has_key('common'):
            self.rendererTabUiDict.pop('common')        
        uiDict = {}
        self.rendererTabUiDict['common'] = uiDict

        
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Pixel Sampler", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        #attr = pm.Attribute(self.renderGlobalsNodeName + ".pixel_renderer")
                        #ui = pm.attrEnumOptionMenuGrp(label="Pixel Sampler", at=self.renderGlobalsNodeName + ".pixel_renderer", ei=self.getEnumList(attr)) 
                        self.addRenderGlobalsUIElement(attName = 'pixel_renderer', uiType = 'enum', displayName = 'Pixel Sampler', default='0', uiDict=uiDict, callback=self.AppleseedRendererUpdateTab)
                        self.addRenderGlobalsUIElement(attName='minSamples', uiType='int', displayName='Min Samples', default=False, uiDict=uiDict)                        
                        self.addRenderGlobalsUIElement(attName='maxSamples', uiType='int', displayName='Max Samples', default=False, uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='maxError', uiType='float', displayName='Max Error', default=False, uiDict=uiDict)
                        pm.separator()
                        self.addRenderGlobalsUIElement(attName='frameRendererPasses', uiType='int', displayName='Passes', uiDict=uiDict)
                        

                with pm.frameLayout(label="Filtering", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".filtertype")
                        ui = pm.attrEnumOptionMenuGrp(label="Filter Type", at=self.renderGlobalsNodeName + ".filtertype", ei=self.getEnumList(attr)) 
                        self.addRenderGlobalsUIElement(attName='filtersize', uiType='int', displayName='Filter Size', default=False, uiDict=uiDict)
                        
                with pm.frameLayout(label="Features", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        self.addRenderGlobalsUIElement(attName='doMotionBlur', uiType='bool', displayName='Motion Blur', default=False, uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='doDof', uiType='bool', displayName='Depth Of Field', default=False, uiDict=uiDict)
                    
                with pm.frameLayout(label="Output", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".bitdepth")
                        ui = pm.attrEnumOptionMenuGrp(label="Bit Depth", at=self.renderGlobalsNodeName + ".bitdepth", ei=self.getEnumList(attr)) 
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".colorSpace")
                        ui = pm.attrEnumOptionMenuGrp(label="Color Space", at=self.renderGlobalsNodeName + ".colorSpace", ei=self.getEnumList(attr)) 
                        ui = pm.checkBoxGrp(label="Clamping:", value1=False)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".clamping", index=2)
                    
                with pm.frameLayout(label="Lighting Engine", collapsable=True, collapse=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".lightingEngine")
                        ui = pm.attrEnumOptionMenuGrp(label="Lighting Engine", at=self.renderGlobalsNodeName + ".lightingEngine", ei=self.getEnumList(attr)) 
                        with pm.frameLayout(label="Common Settings", collapsable=True, collapse=False):
                            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                                self.addRenderGlobalsUIElement(attName='maxTraceDepth', uiType='int', displayName='Max Trace Depth', uiDict=uiDict)                        
                                self.addRenderGlobalsUIElement(attName='rr_min_path_length', uiType='float', displayName='RR Min Path Len', uiDict=uiDict)                        
                                self.addRenderGlobalsUIElement(attName='enable_caustics', uiType='bool', displayName='Enable Caustics', default=False, uiDict=uiDict)
                                self.addRenderGlobalsUIElement(attName='enable_ibl', uiType='bool', displayName='Enable IBL', default=False, uiDict=uiDict)
                                self.addRenderGlobalsUIElement(attName='enable_dl', uiType='bool', displayName='Enable Direct Light', default=False, uiDict=uiDict)
                                
                                self.addRenderGlobalsUIElement(attName='directLightSamples', uiType='int', displayName='Direct Light Samples', uiDict=uiDict)                        
                                self.addRenderGlobalsUIElement(attName='environmentSamples', uiType='int', displayName='Environment Samples', uiDict=uiDict)                        
                                
                                self.addRenderGlobalsUIElement(attName='diffuseDepth', uiType='int', displayName='Diffuse Depth', uiDict=uiDict)
                                self.addRenderGlobalsUIElement(attName='glossyDepth', uiType='int', displayName='Glossy Depth', uiDict=uiDict)
                                self.addRenderGlobalsUIElement(attName='max_ray_intensity', uiType='float', displayName='Max Ray Intensity', uiDict=uiDict)                        

                        uiDict["SPPM Settings"] = pm.frameLayout(label="SPPM Settings", collapsable=True, collapse=False)
                        with uiDict["SPPM Settings"]:
                            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                                self.addRenderGlobalsUIElement(attName='sppmAlpha', uiType='float', displayName='Alpha', uiDict=uiDict)                        
                                self.addRenderGlobalsUIElement(attName='env_photons_per_pass', uiType='int', displayName='Env Photons PP', uiDict=uiDict)
                                self.addRenderGlobalsUIElement(attName='light_photons_per_pass', uiType='int', displayName='Light Photons PP', uiDict=uiDict)
                                self.addRenderGlobalsUIElement(attName='photons_per_pass', uiType='int', displayName='Photons PP', uiDict=uiDict)
                                self.addRenderGlobalsUIElement(attName='max_photons_per_estimate', uiType='int', displayName='Max Photons Per Estimate', uiDict=uiDict)
                                self.addRenderGlobalsUIElement(attName='initial_radius', uiType='float', displayName='Initial Radius', uiDict=uiDict)                        
                                
                with pm.frameLayout(label="Renderer", collapsable=True, collapse=True):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        self.addRenderGlobalsUIElement(attName='threads', uiType='int', displayName='Threads:', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='rendererVerbosity', uiType='int', displayName='Verbosity:', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='tilesize', uiType='int', displayName='Tile Size:', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='texCacheSize', uiType='int', displayName='Tex Cache Size (kb):', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='assemblySBVH', uiType='bool', displayName='Use SBVH Acc. for mb:', uiDict=uiDict)                        
                    
        pm.setUITemplate("renderGlobalsTemplate", popTemplate=True)                    
        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
        
        # pm.scriptJob(attributeChange=[self.renderGlobalsNode.samplingType, pm.Callback(self.KrayRendererUIUpdateCallback, "sampling")])

        # self.updateEnvironment()
        self.AppleseedRendererUpdateTab()
Example #46
0
 def LuxEnvironmentCreateTab(self, dummy = None):
     log.debug("LuxEnvironmentCreateTab()")
     self.createGlobalsNode()
     
     if self.rendererTabUiDict.has_key('environment'):
         self.rendererTabUiDict.pop('environment')
     
     parentForm = pm.setParent(query=True)
     pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
     scLo = self.rendererName + "ENScrollLayout"
     envDict = {}
     self.rendererTabUiDict['environment'] = envDict
     with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
         with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
             with pm.frameLayout(label="Environment Lighting", collapsable=False):
                 with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                     envDict['pskSkyUse'] = pm.checkBoxGrp(label="Use physical Sky:", value1=True, cc=pm.Callback(self.uiCallback, tab="environment"))
                     pm.connectControl(envDict['pskSkyUse'], self.renderGlobalsNodeName + ".usePhysicalSky", index=2)             
                     envDict['pskUsePhySun'] = pm.checkBoxGrp(label="Use Physical Sun:", value1=False, cc=pm.Callback(self.uiCallback, tab="environment"))
                     pm.connectControl(envDict['pskUsePhySun'], self.renderGlobalsNodeName + ".physicalSun", index=2)                    
                     envDict['pskPhySun'] = pm.textFieldGrp(label="Sun Object:", text="", editable=False) 
                     pm.separator()
                     envDict['pskSunGain'] = pm.floatFieldGrp(label="Sun Gain:", value1=1.0, numberOfFields=1)
                     pm.connectControl(envDict['pskSunGain'], self.renderGlobalsNodeName + ".sunGain", index=2)             
                     envDict['pskTurb'] = pm.floatFieldGrp(label="Turbidity:", value1=1.0, numberOfFields=1)
                     pm.connectControl(envDict['pskTurb'], self.renderGlobalsNodeName + ".turbidity", index=2)                    
                     envDict['pskSamples'] = pm.floatFieldGrp(label="Samples:", value1=1.0, numberOfFields=1)
                     pm.connectControl(envDict['pskSamples'], self.renderGlobalsNodeName + ".skySamples", index=2)                    
                     envDict['pskRelSize'] = pm.floatFieldGrp(label="Sun Size:", value1=1.0, numberOfFields=1)
                     pm.connectControl(envDict['pskRelSize'], self.renderGlobalsNodeName + ".sunRelSize", index=2)                    
                 
     pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
     pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
     
     pm.scriptJob(attributeChange=[self.renderGlobalsNode.physicalSun, pm.Callback(self.uiCallback, tab="environment")])   
     
     self.updateEnvironment()