Example #1
0
 def createUISet(self):
     self._childLayout = pm.columnLayout( adj=True )
     with self._childLayout:
         pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.")
         for type in deformerTypes:
             deformers = pm.ls(type=type)
             for node in deformers:
                 frameLayout = pm.frameLayout( label=node.name(), collapsable = True)
                 with frameLayout:
                     with pm.rowLayout(numberOfColumns=2) :
                         pm.button( l="Del", c=pm.Callback( self.deleteNode, node))
                         pm.attrFieldSliderGrp( label="iteration", min=1, max=100, attribute=node.it)
                     with pm.rowLayout(numberOfColumns=2) :
                         pm.attrControlGrp( label="rotation consistency", attribute= node.rc)
                         pm.attrFieldSliderGrp( label="global rotation", min=-720, max=720, attribute=node.ir)
                     with pm.rowLayout(numberOfColumns=3) :
                         pm.attrControlGrp( label="blend mode", attribute= node.bm)
                         pm.attrControlGrp( label="tet mode", attribute= node.tm)
                         pm.attrControlGrp( label="area weight", attribute= node.aw)
                     with pm.rowLayout(numberOfColumns=2) :
                         pm.attrControlGrp( label="visualise energy", attribute= node.ve)
                         pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp)
                     for j in range(node.blendMesh.numElements()):
                         with pm.rowLayout(numberOfColumns=1) :
                             pm.attrFieldSliderGrp(label=node.blendWeight[j].getAlias(), min=-1.0, max=2.0, attribute= node.blendWeight[j])
    def createUISet(self):
        self._childLayout = pm.columnLayout( adj=True )
        with self._childLayout:
            pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.")
            # cageDeformer specific
            deformers = pm.ls(type=deformerTypes[0])
            for node in deformers:
                frameLayout = pm.frameLayout( label=node.name(), collapsable = True)
                with frameLayout:
                    self.createCommonAttr(node)

            # cageDeformerARAP specific
            deformers = pm.ls(type=deformerTypes[1])
            for node in deformers:
                frameLayout = pm.frameLayout( label=node.name(), collapsable = True)
                with frameLayout:
                    self.createCommonAttr(node)
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrControlGrp( label="constraint mode", attribute= node.ctm)
                        pm.attrFieldSliderGrp( label="constraint weight", min=1e-10, max=1000, attribute=node.cw)
                        pm.attrFieldSliderGrp(label="constraint radius", min=0.001, max=10.0, attribute=node.cr)
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrFieldSliderGrp( label="iteration", min=1, max=20, attribute=node.it)
                        pm.attrControlGrp( label="tet mode", attribute= node.tm)
                        pm.attrFieldSliderGrp( label="translation weight", min=0.0, max=1.0, attribute=node.tw)
	def SetupModuleSpecificControls(self):
		currentlySelectedModuleInfo = pm.textScrollList(self.UIElements["animationModule_textScroll"], query = True, selectItem = True)
		currentlySelectedModuleNamespace = None
		
		if len(currentlySelectedModuleInfo) != 0:
			currentlySelectedModuleNamespace = currentlySelectedModuleInfo[0]
			
			if currentlySelectedModuleNamespace == self.previousAnimationModule and self.selectedBlueprintModule == self.previousBlueprintModule:
				return
		
		existingControls = pm.columnLayout(self.UIElements["moduleSpecificControlsColumn"], query = True, childArray = True)
		if existingControls != None:
			pm.deleteUI(existingControls)
		
		pm.button(self.UIElements["matchingButton"], edit = True, enable = False)
		
		pm.setParent(self.UIElements["moduleSpecificControlsColumn"])
		
		moduleNameInfo = utils.FindAllModuleNames("/Modules/Animation")
		modules = moduleNameInfo[0]
		moduleNames = moduleNameInfo[1]
		
		
		if len(currentlySelectedModuleInfo) != 0:
			currentlySelectedModule = currentlySelectedModuleNamespace.rpartition("_")[0]
			
			if currentlySelectedModule in moduleNames:
				moduleWeightValue = pm.getAttr("%s:SETTINGS.%s_weight" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace))
				matchButtonEnable = moduleWeightValue > 0.0001
				
				moduleIndex = moduleNames.index(currentlySelectedModule)
				module = modules[moduleIndex]
				
				pm.attrControlGrp(attribute = "%s:%s:module_grp.levelOfDetail" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace), label = "Module LOD")
				
				mod = __import__("Animation.%s" %module, (), (), [module])
				reload(mod)
				
				moduleClass = getattr(mod, mod.CLASS_NAME)
				
				moduleInst = moduleClass("%s:%s" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace))
				
				moduleInst.UI(self.UIElements["moduleSpecificControlsColumn"])
				
				self.UIElements["moduleSpecificControls_preferenceFrame"] = pm.frameLayout(borderVisible = False, label = "preferences", collapsable = True, parent = self.UIElements["moduleSpecificControlsColumn"])
				self.UIElements["moduleSpecificControls_preferenceColumn"] = pm.columnLayout(columnAttach = ["both", 5], adjustableColumn = True, parent = self.UIElements["moduleSpecificControls_preferenceFrame"])
				
				pm.attrControlGrp(attribute = "%s:%s:module_grp.iconScale" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace), label = "Icon Scale")
				
				value = pm.getAttr("%s:%s:module_grp.overrideColor" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace)) + 1
				self.UIElements["iconColor"] = pm.colorIndexSliderGrp(label = "Icon Color", maxValue = 32, value = value, changeCommand = partial(self.IconColor_callback, currentlySelectedModuleNamespace), parent = self.UIElements["moduleSpecificControls_preferenceColumn"])
				
				moduleInst.UI_preferences(self.UIElements["moduleSpecificControls_preferenceColumn"])
				
				pm.button(self.UIElements["matchingButton"], edit = True, enable = matchButtonEnable, command = moduleInst.Match)
			
			self.previousBlueprintModule = self.selectedBlueprintModule
			self.previousAnimationModule = currentlySelectedModuleNamespace
Example #4
0
def createArnoldAOVTab():
    parentForm = cmds.setParent(query=True)

    aovNode = aovs.AOVInterface()
    pm.columnLayout('enableAOVs', adjustableColumn=True)

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

    pm.attrControlGrp(attribute=aovNode.node.aovMode, label='Mode')

    # the tab gets recreated from scratch each time rather than updated and each
    # time the AOVOptionMenuGrp adds itself to the AOVChanged callback list.
    # we must remove it or we'll leave behind invalid copies
    global _aovDisplayCtrl
    if _aovDisplayCtrl is not None:
        aovs.removeAOVChangedCallback(_aovDisplayCtrl.update)

    _aovDisplayCtrl = shaderTemplate.AOVOptionMenuGrp('aiOptions',
                                                      'displayAOV',
                                                      label='Render View AOV',
                                                      allowCreation=False,
                                                      includeBeauty=True,
                                                      allowEmpty=False,
                                                      allowDisable=False)
    _aovDisplayCtrl._setToChildMode()
    _aovDisplayCtrl._doSetup(aovNode.node.name() + '.displayAOV')

    pm.setParent(parentForm)

    cmds.scrollLayout('arnoldAOVsScrollLayout', horizontalScrollBarThickness=0)

    cmds.columnLayout('arnoldTabColumn', adjustableColumn=True)

    ed = ArnoldAOVEditor(aovNode)

    cmds.formLayout(parentForm,
                    edit=True,
                    af=[('enableAOVs', "top", 5), ('enableAOVs', "left", 0),
                        ('enableAOVs', "right", 0),
                        ('arnoldAOVsScrollLayout', "bottom", 0),
                        ('arnoldAOVsScrollLayout', "left", 0),
                        ('arnoldAOVsScrollLayout', "right", 0)],
                    an=[('enableAOVs', "bottom")],
                    ac=[('arnoldAOVsScrollLayout', "top", 5, 'enableAOVs')])

    pm.setUITemplate('attributeEditorTemplate', popTemplate=True)

    cmds.setParent(parentForm)
    pm.evalDeferred(ed.fixOptionMenus)
    ed.setEnabledState()
    pm.scriptJob(attributeChange=(aovNode.node.aovMode, ed.setEnabledState),
                 parent=ed.mainCol)
Example #5
0
def createArnoldAOVTab():
    parentForm = cmds.setParent(query=True)

    aovNode = aovs.AOVInterface()
    pm.columnLayout('enableAOVs', adjustableColumn=True)
    
    pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)

    pm.attrControlGrp(attribute=aovNode.node.aovMode, label='Mode')

    # the tab gets recreated from scratch each time rather than updated and each
    # time the AOVOptionMenuGrp adds itself to the AOVChanged callback list. 
    # we must remove it or we'll leave behind invalid copies
    global _aovDisplayCtrl
    if _aovDisplayCtrl is not None:
        aovs.removeAOVChangedCallback(_aovDisplayCtrl.update)

    _aovDisplayCtrl = shaderTemplate.AOVOptionMenuGrp('aiOptions', 'displayAOV', label='Render View AOV',
                                           allowCreation=False,
                                           includeBeauty=True,
                                           allowEmpty=False,
                                           allowDisable=False)
    _aovDisplayCtrl._setToChildMode()
    _aovDisplayCtrl._doSetup(aovNode.node.name() + '.displayAOV')
    
    pm.setParent(parentForm)

    cmds.scrollLayout('arnoldAOVsScrollLayout', horizontalScrollBarThickness=0)

    cmds.columnLayout('arnoldTabColumn', adjustableColumn=True)

    ed = ArnoldAOVEditor(aovNode)

    cmds.formLayout(parentForm,
               edit=True,
                    af=[('enableAOVs',"top", 5),
                        ('enableAOVs', "left", 0),
                        ('enableAOVs', "right", 0),
                        ('arnoldAOVsScrollLayout', "bottom", 0),
                        ('arnoldAOVsScrollLayout', "left", 0),
                        ('arnoldAOVsScrollLayout', "right", 0)],
                    an=[('enableAOVs', "bottom")],
                    ac=[('arnoldAOVsScrollLayout', "top", 5, 'enableAOVs')])

    pm.setUITemplate('attributeEditorTemplate', popTemplate=True)

    cmds.setParent(parentForm)
    pm.evalDeferred(ed.fixOptionMenus)
    ed.setEnabledState()
    pm.scriptJob(attributeChange = (aovNode.node.aovMode, ed.setEnabledState), parent=ed.mainCol)
Example #6
0
 def createCommonAttr(self,node,deformerType):
     with pm.rowLayout(numberOfColumns=len(self.probes[node])+2) :
         pm.button( l="Delete deformer", c=pm.Callback( self.deleteNode, node))
         pm.button( l="Add selection to probes", c=pm.Callback( self.addSelectedProbe, node, deformerType) )
         for j in range(len(self.probes[node])):
             pm.button( l=self.probes[node][j].name(), c=pm.Callback( self.deleteProbe, node, j) )
     with pm.rowLayout(numberOfColumns=2) :
         pm.attrControlGrp( label="blend mode", attribute= node.bm)
         #            pm.attrControlGrp( label="world mode", attribute= node.worldMode)
         pm.attrControlGrp( label="rotation consistency", attribute= node.rc)
     with pm.rowLayout(numberOfColumns=4) :
         pm.attrControlGrp( label="Weight mode", attribute= node.wtm)
         pm.attrFieldSliderGrp(label="effect radius", min=0.001, max=20.0, attribute=node.er)
         pm.attrControlGrp( label="normalise weight", attribute= node.nw)
         pm.attrControlGrp( label="normExponent", attribute=node.ne)
 def createCommonAttr(self,node,deformerType):
     with pm.rowLayout(numberOfColumns=len(self.probes[node])+2) :
         pm.button( l="Delete deformer", c=pm.Callback( self.deleteNode, node))
         pm.button( l="Add selection to probes", c=pm.Callback( self.addSelectedProbe, node, deformerType) )
         for j in range(len(self.probes[node])):
             pm.button( l=self.probes[node][j].name(), c=pm.Callback( self.deleteProbe, node, j) )
     with pm.rowLayout(numberOfColumns=2) :
         pm.attrControlGrp( label="blend mode", attribute= node.bm)
         #            pm.attrControlGrp( label="world mode", attribute= node.worldMode)
         pm.attrControlGrp( label="rotation consistency", attribute= node.rc)
     with pm.rowLayout(numberOfColumns=4) :
         pm.attrControlGrp( label="Weight mode", attribute= node.wtm)
         pm.attrFieldSliderGrp(label="effect radius", min=0.001, max=20.0, attribute=node.er)
         pm.attrControlGrp( label="normalise weight", attribute= node.nw)
         pm.attrControlGrp( label="normExponent", attribute=node.ne)
Example #8
0
    def createUISet(self):
        self._childLayout = pm.columnLayout(adj=True)
        with self._childLayout:
            pm.text(
                l="Click cage mesh first, then shift+click target mesh, and click the menu item."
            )
            # cageDeformer specific
            deformers = pm.ls(type=deformerTypes[0])
            for node in deformers:
                frameLayout = pm.frameLayout(label=node.name(),
                                             collapsable=True)
                with frameLayout:
                    self.createCommonAttr(node)

            # cageDeformerARAP specific
            deformers = pm.ls(type=deformerTypes[1])
            for node in deformers:
                frameLayout = pm.frameLayout(label=node.name(),
                                             collapsable=True)
                with frameLayout:
                    self.createCommonAttr(node)
                    with pm.rowLayout(numberOfColumns=3):
                        pm.attrControlGrp(label="constraint mode",
                                          attribute=node.ctm)
                        pm.attrFieldSliderGrp(label="constraint weight",
                                              min=0.001,
                                              max=1000,
                                              attribute=node.cw)
                        pm.attrFieldSliderGrp(label="constraint radius",
                                              min=0.001,
                                              max=10.0,
                                              attribute=node.cr)
                    with pm.rowLayout(numberOfColumns=3):
                        pm.attrFieldSliderGrp(label="iteration",
                                              min=1,
                                              max=20,
                                              attribute=node.it)
                        pm.attrControlGrp(label="tet mode", attribute=node.tm)
                        pm.attrFieldSliderGrp(label="translation weight",
                                              min=0.0,
                                              max=1.0,
                                              attribute=node.tw)
 def createUISet(self):
     self._childLayout = pm.columnLayout( adj=True )
     with self._childLayout:
         pm.text(l="Click target mesh, then shift+click end mesh")
         self.deformers = pm.ls(type=deformerTypes[0])
         for node in self.deformers:
             frameLayout = pm.frameLayout( label=node.name(), collapsable = True)
             with frameLayout:
                 pm.button( l="Del", c=pm.Callback( self.deleteNode, node))
                 pm.attrControlGrp( label="active", attribute= node.active)
                 pm.attrFieldSliderGrp(label="delta", min=0.001, max=5.0, attribute=node.delta)
                 pm.attrFieldSliderGrp(label="shapeMatching", min=0.1, max=10.0, attribute=node.smw)
     #
         self.deformers = pm.ls(type=deformerTypes[1])
         for node in self.deformers:
             frameLayout = pm.frameLayout( label=node.name(), collapsable = True)
             with frameLayout:
                 pm.button( l="Del", c=pm.Callback( self.deleteNode, node))
                 pm.attrControlGrp( label="active", attribute= node.active)
                 pm.attrFieldSliderGrp(label="delta", min=0.001, max=5.0, attribute=node.delta)
                 pm.attrFieldSliderGrp(label="stiffness", min=0.001, max=10.0, attribute=node.stf)
                 pm.attrFieldSliderGrp(label="attenuation", min=0.001, max=1.0, attribute=node.att)
	def UI(self, _parentLayout):
		
		pm.setParent(_parentLayout)
		
		pm.separator(style = "in", parent = _parentLayout)
		
		niceName = utils.StripAllNamespaces(self.controlObject)[1]
		pm.text(label = niceName)
		
		pm.attrControlGrp(attribute = "%s.display" %self.controlObject, label = "Visibility")
		
		if self.translation == [True, True, True]:
			pm.attrControlGrp(attribute = "%s.translate" %self.controlObject, label = "Translate")
		else:
			if self.translation[0] == True:
				pm.attrControlGrp(attribute = "%s.translateX" %self.controlObject, label = "Translate X")
			
			if self.translation[1] == True:
				pm.attrControlGrp(attribute = "%s.translateY" %self.controlObject, label = "Translate Y")
			
			if self.translation[2] == True:
				pm.attrControlGrp(attribute = "%s.translateZ" %self.controlObject, label = "Translate Z")
		
		
		if self.rotation == [True, True, True]:
			pm.attrControlGrp(attribute = "%s.rotate" %self.controlObject, label = "Rotate")
		else:
			if self.rotation[0] == True:
				pm.attrControlGrp(attribute = "%s.rotateX" %self.controlObject, label = "Rotate X")
	
			if self.rotation[1] == True:
				pm.attrControlGrp(attribute = "%s.rotateY" %self.controlObject, label = "Rotate Y")
	
			if self.rotation[2] == True:
				pm.attrControlGrp(attribute = "%s.rotateZ" %self.controlObject, label = "Rotate Z")
		
		
		if self.globalScale == True:
			pm.attrControlGrp(attribute = "%s.globalScale" %self.controlObject, label = "Scale")
 def createUISet(self):
     self._childLayout = pm.columnLayout( adj=True )
     with self._childLayout:
         pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.")
         self.deformers = pm.ls(type="cage")
         for i in range(len(self.deformers)):
             frameLayout = pm.frameLayout( label=self.deformers[i].name(), collapsable = True)
             with frameLayout:
                 with pm.rowLayout(numberOfColumns=3) :
                     pm.button( l="Del", c=pm.Callback( self.deleteNode, self.deformers[i].name()))
                     pm.attrControlGrp( label="cage mode", attribute= self.deformers[i].cgm)
                     pm.attrControlGrp( label="blend mode", attribute= self.deformers[i].bm)
                 with pm.rowLayout(numberOfColumns=3) :
                     pm.attrControlGrp( label="rotation consistency", attribute= self.deformers[i].rc)
                     pm.attrControlGrp( label="Frechet sum", attribute= self.deformers[i].fs)                        
         self.deformers = pm.ls(type="cageARAP")
         for i in range(len(self.deformers)):
             frameLayout = pm.frameLayout( label=self.deformers[i].name(), collapsable = True)
             with frameLayout:
                 with pm.rowLayout(numberOfColumns=4) :
                     pm.button( l="Del", c=pm.Callback( self.deleteNode, self.deformers[i].name()))
                     pm.attrControlGrp( label="cage mode", attribute= self.deformers[i].cgm)
                     pm.attrControlGrp( label="blend mode", attribute= self.deformers[i].bm)
                     pm.attrControlGrp( label="constraint mode", attribute= self.deformers[i].constraintMode)
                 with pm.rowLayout(numberOfColumns=3) :
                     pm.attrControlGrp( label="rotation consistency", attribute= self.deformers[i].rc)
                     pm.attrControlGrp( label="Frechet sum", attribute= self.deformers[i].fs)                        
                     pm.attrControlGrp( label="constraint weight", attribute= self.deformers[i].constraintWeight)
Example #12
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 createCommonAttr(self,node):
     with pm.rowLayout(numberOfColumns=4):
         pm.button( l="Delete deformer", c=pm.Callback( self.deleteNode, node ))
         pm.button( l="Set selected as cage", c=pm.Callback( self.setCage, node))
         pm.attrControlGrp( label="cage mode", attribute= node.cgm)
         pm.attrControlGrp( label="blend mode", attribute= node.bm)
     with pm.rowLayout(numberOfColumns=4) :
         pm.attrControlGrp( label="normalise cage tet", attribute= node.nr)
         pm.attrControlGrp( label="area weight", attribute= node.aw)
         pm.attrControlGrp( label="positive weight", attribute= node.posw)
         pm.attrControlGrp( label="normalise weight", attribute= node.nw)
     with pm.rowLayout(numberOfColumns=3) :
         pm.attrControlGrp( label="rotation consistency", attribute= node.rc)
         pm.attrControlGrp( label="Frechet sum", attribute= node.fs)
         pm.attrControlGrp( label="symmetrise face", attribute= node.sf)
     with pm.rowLayout(numberOfColumns=4) :
         pm.attrControlGrp( label="Weight mode", attribute= node.wtm)
         pm.attrControlGrp( label="normExponent", attribute=node.ne)
         pm.attrFieldSliderGrp(label="effect radius", min=0.001, max=20.0, attribute=node.er)
Example #14
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 #15
0
    def create(self):
        
        
        
        self.main_layout = pm.columnLayout(adjustableColumn= True, width= 400)
       
        main_frame = pm.frameLayout( label='%s' % (self.light), collapsable= True)
        pm.frameLayout( label='Light Attributes', collapsable= True)
        pm.attrColorSliderGrp( at='%s.color' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrFieldSliderGrp(at='%s.intensity' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrFieldSliderGrp(at='%s.coneAngle' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrFieldSliderGrp(at='%s.penumbraAngle' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrFieldSliderGrp(at='%s.dropoff' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrEnumOptionMenu( label='Decay Rate', attribute='%s.decayRate' % (self.light) )
        
        pm.setParent(main_frame)
        pm.frameLayout(label= 'Shadows', collapsable= True)
        pm.attrColorSliderGrp( at='%s.shadowColor' % (self.light),
                              columnWidth4= [100, 75, 175, 50])
        self.check_box = pm.checkBox(label= 'Use Ray Trace Shadows',
                        changeCommand= pm.Callback(self.shadows))
        
        self.light_radius = pm.attrFieldSliderGrp( at='%s.lightRadius' % (self.light),
                                enable= False, columnWidth4= [100, 75, 175, 50])
        
        self.shadow_rays = pm.attrFieldSliderGrp( at='%s.shadowRays' % (self.light),
                                enable= False, columnWidth4= [100, 75, 175, 50])
        
        self.ray_depth = pm.attrFieldSliderGrp( at='%s.rayDepthLimit' % (self.light),
                                enable= False, columnWidth4= [100, 75, 175, 50])

        pm.setParent(main_frame)
        pm.frameLayout(label= 'Decay Regions', collapsable= True)
        # useDecayRegions
        decay_regions_value = pm.getAttr('%s.useDecayRegions' % (self.light))
        self.decay_check_box = pm.checkBox(label= 'Use Decay Regions',
                        value= decay_regions_value, 
                    changeCommand= pm.Callback(self.chane_decay_regions))

        pm.attrControlGrp(attribute= '%s.startDistance1' % (self.light))
        pm.attrControlGrp(attribute= '%s.endDistance1' % (self.light))

        pm.attrControlGrp(attribute= '%s.startDistance2' % (self.light))
        pm.attrControlGrp(attribute= '%s.endDistance2' % (self.light))

        pm.attrControlGrp(attribute= '%s.startDistance3' % (self.light))
        pm.attrControlGrp(attribute= '%s.endDistance3' % (self.light))
       
        pm.setParent(main_frame)
        pm.rowColumnLayout(numberOfColumns= 2, columnWidth= [200, 200])
        pm.button(label= 'Select Light', width= 200, command= pm.Callback(self.select))
        pm.button(label= 'Save Preset', width= 200, command= pm.Callback(self.preset))
        pm.button(label= 'Hide', command= pm.Callback(self.hide))
        pm.button(label= 'Show',  command= pm.Callback(self.show))
        return self.main_layout
    def createUISet(self):
        self._childLayout = pm.columnLayout( adj=True )
        with self._childLayout:
            self.deformers = [pm.ls(type=deformerTypes[i]) for i in range(len(deformerTypes))]
            for i in range(len(deformerTypes)):
                for node in self.deformers[i]:
                    self.probes[node] = pm.listConnections(node.pm)
            # "probeDeformer" specific
            for node in self.deformers[0]:
                frameLayout = pm.frameLayout( label=node.name(), collapsable = True)
                with frameLayout:
                    self.createRamp(node)
                    self.createCommonAttr(node, deformerTypes[0])
                    indices = cmds.getAttr(node+".pm", multiIndices=True)
                    if indices:
                        for j in indices:
                            with pm.rowLayout(numberOfColumns=1) :
                                pm.attrFieldSliderGrp(label=node.prw[j].getAlias(), min=0, max=10.0, attribute=node.prw[j])
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrControlGrp( label="Frechet sum", attribute= node.fs)
                        pm.attrControlGrp( label="visualisation", attribute= node.vm)
                        pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp)

            # "probeDeformerARAP" specific
            for node in self.deformers[1]:
                frameLayout = pm.frameLayout( label=node.name(), collapsable = True)
                with frameLayout:
                    self.createRamp(node)
                    self.createCommonAttr(node, deformerTypes[1])
                    indices = cmds.getAttr(node+".pm", multiIndices=True)
                    if indices:
                        for j in indices:
                            with pm.rowLayout(numberOfColumns=2) :
                                pm.attrFieldSliderGrp(label=node.prw[j].getAlias(), min=0, max=1.0, attribute=node.prw[j])
                                pm.attrFieldSliderGrp(label=node.prcr[j].getAlias(), min=0, max=1.0, attribute=node.prcr[j])
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.button( l="Set supervisor", c=pm.Callback( self.setSupervisor, node))
                        pm.attrControlGrp( label="tet mode", attribute= node.tm)
                        pm.attrFieldSliderGrp( label="translation weight", min=0.0, max=1.0, attribute=node.tw)
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrControlGrp( label="constraint mode", attribute= node.ctm)
                        pm.attrFieldSliderGrp( label="constraint weight", min=0.001, max=1000, attribute=node.cw)
                        pm.attrFieldSliderGrp(label="constraint radius", min=0.001, max=10.0, attribute=node.cr)
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrFieldSliderGrp( label="iteration", min=1, max=20, attribute=node.it)
                        pm.attrControlGrp( label="visualisation", attribute= node.vm)
                        pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp)
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrControlGrp( label="stiffness mode", attribute=node.stiffnessMode)
Example #17
0
    def createUISet(self):
        self._childLayout = pm.columnLayout( adj=True )
        with self._childLayout:
            self.deformers = [pm.ls(type=deformerTypes[i]) for i in range(len(deformerTypes))]
            for i in range(len(deformerTypes)):
                for node in self.deformers[i]:
                    self.probes[node] = pm.listConnections(node.pm)
            # "probeDeformer" specific
            for node in self.deformers[0]:
                frameLayout = pm.frameLayout( label=node.name(), collapsable = True)
                with frameLayout:
                    self.createRamp(node)
                    self.createCommonAttr(node, deformerTypes[0])
                    indices = cmds.getAttr(node+".pm", multiIndices=True)
                    if indices:
                        for j in indices:
                            with pm.rowLayout(numberOfColumns=1) :
                                pm.attrFieldSliderGrp(label=node.prw[j].getAlias(), min=0, max=10.0, attribute=node.prw[j])
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrControlGrp( label="Frechet sum", attribute= node.fs)
                        pm.attrControlGrp( label="visualisation", attribute= node.vm)
                        pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp)

            # "probeDeformerARAP" specific
            for node in self.deformers[1]:
                frameLayout = pm.frameLayout( label=node.name(), collapsable = True)
                with frameLayout:
                    self.createRamp(node)
                    self.createCommonAttr(node, deformerTypes[1])
                    indices = cmds.getAttr(node+".pm", multiIndices=True)
                    if indices:
                        for j in indices:
                            with pm.rowLayout(numberOfColumns=2) :
                                pm.attrFieldSliderGrp(label=node.prw[j].getAlias(), min=0, max=1.0, attribute=node.prw[j])
                                pm.attrFieldSliderGrp(label=node.prcr[j].getAlias(), min=0, max=1.0, attribute=node.prcr[j])
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.button( l="Set supervisor", c=pm.Callback( self.setSupervisor, node))
                        pm.attrControlGrp( label="tet mode", attribute= node.tm)
                        pm.attrFieldSliderGrp( label="translation weight", min=0.0, max=1.0, attribute=node.tw)
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrControlGrp( label="constraint mode", attribute= node.ctm)
                        pm.attrFieldSliderGrp( label="constraint weight", min=0.001, max=1000, attribute=node.cw)
                        pm.attrFieldSliderGrp(label="constraint radius", min=0.001, max=10.0, attribute=node.cr)
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrFieldSliderGrp( label="iteration", min=1, max=20, attribute=node.it)
                        pm.attrControlGrp( label="visualisation", attribute= node.vm)
                        pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp)
                    with pm.rowLayout(numberOfColumns=3) :
                        pm.attrControlGrp( label="stiffness mode", attribute=node.stiffnessMode)
Example #18
0
 def createUISet(self):
     self._childLayout = pm.columnLayout(adj=True)
     with self._childLayout:
         pm.text(
             l="Click cage mesh first, then shift+click target mesh, and click the menu item."
         )
         self.deformers = pm.ls(type="cage")
         for i in range(len(self.deformers)):
             frameLayout = pm.frameLayout(label=self.deformers[i].name(),
                                          collapsable=True)
             with frameLayout:
                 with pm.rowLayout(numberOfColumns=3):
                     pm.button(l="Del",
                               c=pm.Callback(self.deleteNode,
                                             self.deformers[i].name()))
                     pm.attrControlGrp(label="cage mode",
                                       attribute=self.deformers[i].cgm)
                     pm.attrControlGrp(label="blend mode",
                                       attribute=self.deformers[i].bm)
                 with pm.rowLayout(numberOfColumns=3):
                     pm.attrControlGrp(label="rotation consistency",
                                       attribute=self.deformers[i].rc)
                     pm.attrControlGrp(label="Frechet sum",
                                       attribute=self.deformers[i].fs)
         self.deformers = pm.ls(type="cageARAP")
         for i in range(len(self.deformers)):
             frameLayout = pm.frameLayout(label=self.deformers[i].name(),
                                          collapsable=True)
             with frameLayout:
                 with pm.rowLayout(numberOfColumns=4):
                     pm.button(l="Del",
                               c=pm.Callback(self.deleteNode,
                                             self.deformers[i].name()))
                     pm.attrControlGrp(label="cage mode",
                                       attribute=self.deformers[i].cgm)
                     pm.attrControlGrp(label="blend mode",
                                       attribute=self.deformers[i].bm)
                     pm.attrControlGrp(
                         label="constraint mode",
                         attribute=self.deformers[i].constraintMode)
                 with pm.rowLayout(numberOfColumns=3):
                     pm.attrControlGrp(label="rotation consistency",
                                       attribute=self.deformers[i].rc)
                     pm.attrControlGrp(label="Frechet sum",
                                       attribute=self.deformers[i].fs)
                     pm.attrControlGrp(
                         label="constraint weight",
                         attribute=self.deformers[i].constraintWeight)
Example #19
0
 def createCommonAttr(self, node):
     with pm.rowLayout(numberOfColumns=4):
         pm.button(l="Delete deformer",
                   c=pm.Callback(self.deleteNode, node))
         pm.button(l="Set selected as cage",
                   c=pm.Callback(self.setCage, node))
         pm.attrControlGrp(label="cage mode", attribute=node.cgm)
         pm.attrControlGrp(label="blend mode", attribute=node.bm)
     with pm.rowLayout(numberOfColumns=3):
         pm.attrControlGrp(label="normalise cage tet", attribute=node.nr)
         pm.attrControlGrp(label="symmetrise face", attribute=node.sf)
         pm.attrControlGrp(label="area weight", attribute=node.aw)
     with pm.rowLayout(numberOfColumns=2):
         pm.attrControlGrp(label="rotation consistency", attribute=node.rc)
         pm.attrControlGrp(label="Frechet sum", attribute=node.fs)
     with pm.rowLayout(numberOfColumns=4):
         pm.attrControlGrp(label="Weight mode", attribute=node.wtm)
         pm.attrControlGrp(label="normExponent", attribute=node.ne)
         pm.attrFieldSliderGrp(label="effect radius",
                               min=0.001,
                               max=20.0,
                               attribute=node.er)
         pm.attrControlGrp(label="normalise weight", attribute=node.nw)
Example #20
0
 def createCommonAttr(self, node, deformerType):
     with pm.rowLayout(numberOfColumns=3):
         pm.button(l="Add selection to ctrl points",
                   c=pm.Callback(self.addSelectedProbe, node, deformerType))
         pm.button(l="Delete deformer",
                   c=pm.Callback(self.deleteNode, node))
         pm.attrControlGrp(label="Poisson", attribute=node.poisson)
     with pm.rowLayout(numberOfColumns=4):
         pm.attrControlGrp(label="MLS mode", attribute=node.mlsm)
         pm.attrControlGrp(label="area weight", attribute=node.aw)
         pm.attrControlGrp(label="neighbour weighting",
                           attribute=node.nghbrw)
         pm.attrFieldSliderGrp(label="iteration",
                               min=1,
                               max=20,
                               attribute=node.it)
     with pm.rowLayout(numberOfColumns=4):
         pm.attrControlGrp(label="Weight mode", attribute=node.wtm)
         pm.attrFieldSliderGrp(label="effect radius",
                               min=0.001,
                               max=20.0,
                               attribute=node.er)
         pm.attrControlGrp(label="normalise weight", attribute=node.nw)
         pm.attrControlGrp(label="normExponent", attribute=node.ne)
     with pm.rowLayout(numberOfColumns=4):
         pm.attrControlGrp(label="tet mode", attribute=node.tm)
         pm.attrControlGrp(label="constraint mode", attribute=node.ctm)
         pm.attrFieldSliderGrp(label="constraint weight",
                               min=0.001,
                               max=1000,
                               attribute=node.cw)
         pm.attrFieldSliderGrp(label="constraint radius",
                               min=0.001,
                               max=10.0,
                               attribute=node.cr)
Example #21
0
    def inspectProperties(self, *args):

        modeSet = ["FK", "IK", "IK/FK"]
        rotOrderSet = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"]
        guideModeSet = ["Final", "WIP"]

        # apply changes
        def applyCloseGuide(root, *args):
            if pm.attributeQuery("mode", node=root, ex=True):
                root.attr("mode").set(guideModeSet.index(pMode.getValue()))
            pm.select(root, r=True)

            pm.deleteUI(window, window=True)

        def skinLoad(root, *args):
            startDir = root.attr("skin").get()
            filePath = pm.fileDialog2(dialogStyle=2,
                                      fileMode=1,
                                      startingDirectory=startDir,
                                      fileFilter='mGear skin (*%s)' %
                                      skin.FILE_EXT)
            if not filePath:
                return
            if not isinstance(filePath, basestring):
                filePath = filePath[0]

            root.attr("skin").set(filePath)

        def applyCloseComp(root, *args):
            newName = pName.getText()
            newSide = pSide.getValue()
            newIndex = pIndex.getValue1()
            if pm.attributeQuery("mode", node=root, ex=True):
                root.attr("mode").set(modeSet.index(pMode.getValue()))
            if pm.attributeQuery("default_rotorder", node=root, ex=True):
                root.attr("default_rotorder").set(
                    rotOrderSet.index(pRotOrder.getValue()))

            guide = shifter.RigGuide()
            guide.updateProperties(root, newName, newSide, newIndex)
            pm.select(root, r=True)

            pm.deleteUI(window, window=True)

        if pm.window("compProperties", exists=True):
            pm.deleteUI("compProperties")

        oSel = pm.selected()
        if oSel:
            root = oSel[0]
        else:
            mgear.log("Select one root Guide or component to edit properties",
                      mgear.sev_error)
            return

        if pm.attributeQuery("comp_type", node=root, ex=True):
            #property window constructor
            customAttr = pm.listAttr(root, ud=True)

            window = pm.window(title=root.name())
            pm.columnLayout(adjustableColumn=True, cal="right")

            for attr in customAttr:

                if attr == "comp_name":
                    fl = pm.formLayout()
                    oriVal = root.attr("comp_name").get()
                    pName = pm.textFieldGrp(l="comp_name")
                    pm.setParent('..')
                    pm.formLayout(fl, e=True, af=(pName, "left", 0))
                    pName.setText(oriVal)

                elif attr == "comp_side":
                    sideSet = ["C", "L", "R"]
                    fl = pm.formLayout()
                    pSide = pm.optionMenu(l="comp_side")
                    pSide.addMenuItems(sideSet)
                    pSide.setWidth(120)
                    pm.setParent('..')
                    pm.formLayout(fl, e=1, af=(pSide, "left", 90))
                    oriVal = root.attr("comp_side").get()
                    pSide.setValue(oriVal)
                elif attr == "mode":
                    fl = pm.formLayout()
                    pMode = pm.optionMenu(l="mode")
                    pMode.addMenuItems(modeSet)
                    pMode.setWidth(120)
                    pm.setParent('..')
                    pm.formLayout(fl, e=1, af=(pMode, "left", 115))
                    oriVal = root.attr("mode").get()
                    pMode.setValue(modeSet[oriVal])

                elif attr == "default_rotorder":
                    fl = pm.formLayout()
                    pRotOrder = pm.optionMenu(l="default_rotorder")
                    pRotOrder.addMenuItems(rotOrderSet)
                    pRotOrder.setWidth(140)
                    pm.setParent('..')
                    pm.formLayout(fl, e=1, af=(pRotOrder, "left", 60))
                    oriVal = root.attr("default_rotorder").get()
                    pRotOrder.setValue(rotOrderSet[oriVal])

                elif attr == "comp_index":
                    fl = pm.formLayout()
                    oriVal = root.attr("comp_index").get()
                    pIndex = pm.intFieldGrp(v1=oriVal, l="comp_index")
                    pm.setParent('..')
                    pm.formLayout(fl, e=True, af=(pIndex, "left", 0))

                else:
                    editable = True
                    if attr == "comp_type":
                        editable = False
                    pm.columnLayout(cal="right")
                    pm.attrControlGrp(attribute=root.attr(attr),
                                      po=True,
                                      en=editable)
                    pm.setParent('..')

            pm.button(label='Apply',
                      command=partial(applyCloseComp, root),
                      h=100)
            pm.setParent('..')
            pm.showWindow(window)

        elif pm.attributeQuery("ismodel", node=root, ex=True):
            #property window constructor
            customAttr = pm.listAttr(root, ud=True)

            window = pm.window(title=root.name())
            pm.columnLayout(adjustableColumn=True, cal="right")

            for attr in customAttr:
                if attr.split("_")[-1] not in ["r", "g", "b"]:
                    if attr == "mode":
                        fl = pm.formLayout()
                        pMode = pm.optionMenu(l="mode")
                        pMode.addMenuItems(guideModeSet)
                        pMode.setWidth(120)
                        pm.setParent('..')
                        pm.formLayout(fl, e=1, af=(pMode, "left", 115))
                        oriVal = root.attr("mode").get()
                        pMode.setValue(guideModeSet[oriVal])
                    elif attr == "skin":
                        pm.columnLayout(cal="right")
                        pm.attrControlGrp(attribute=root.attr(attr), po=True)
                        pm.setParent('..')
                        pm.button(label='Load Skin ',
                                  command=partial(skinLoad, root))

                    else:
                        pm.columnLayout(cal="right")
                        pm.attrControlGrp(attribute=root.attr(attr), po=True)
                        pm.setParent('..')

            pm.button(label='Apply',
                      command=partial(applyCloseGuide, root),
                      h=50)
            pm.setParent('..')
            pm.showWindow(window)

        else:
            mgear.log("Select a root Guide or component to edit properties",
                      mgear.sev_error)
            return
Example #22
0
def adjustAll(*arg):
    xyz = pm.window(title="XYZ Adjust", s=True, wh=(100, 50))
    with pm.columnLayout(adj=True):
        pm.text(l="Adjust the Min & Max values")
        pm.attrControlGrp(l="X Min", attribute="An_range.oldMinX")
        pm.attrControlGrp(l="X Max", attribute="An_range.oldMaxX")
        pm.attrControlGrp(l="Y Min", attribute="An_range.oldMinY")
        pm.attrControlGrp(l="Y Max", attribute="An_range.oldMaxY")
        pm.attrControlGrp(l="Z Min", attribute="An_range.oldMinZ")
        pm.attrControlGrp(l="Z Max", attribute="An_range.oldMaxZ")
    pm.showWindow(xyz)