def checkShadeMode(self, nodeName): fullAttr = '%s.%s' % (nodeName, 'shade_mode') shadeModeValue = pm.getAttr(fullAttr) if shadeModeValue == 3: pm.editorTemplate(dimControl=(nodeName, 'aoDistance', False)) else: pm.editorTemplate(dimControl=(nodeName, 'aoDistance', True))
def checkNearAtten(self, nodeName): fullAttr = '%s.%s'%(nodeName, "use_near_atten") rawValue = pm.getAttr(fullAttr) dim = not rawValue pm.editorTemplate(dimControl=(nodeName, "nearStart", dim)) pm.editorTemplate(dimControl=(nodeName, "nearEnd", dim))
def checkNearAtten(self, nodeName): fullAttr = '%s.%s' % (nodeName, "use_near_atten") rawValue = pm.getAttr(fullAttr) dim = not rawValue pm.editorTemplate(dimControl=(nodeName, "nearStart", dim)) pm.editorTemplate(dimControl=(nodeName, "nearEnd", dim))
def checkReflectionFresnel(self, nodeName): fullAttr = '%s.%s' % (nodeName, "Fresnel_use_IOR") fresIorValue = pm.getAttr(fullAttr) fullAttr = '%s.%s' % (nodeName, "Fresnel") refFresValue = pm.getAttr(fullAttr) dim = (refFresValue is False) or (fresIorValue is True) pm.editorTemplate(dimControl=(nodeName, "Krn", dim))
def checkSpecularFresnel(self, nodeName): fullAttr = '%s.%s' % (nodeName, "Fresnel_use_IOR") fresIorValue = pm.getAttr(fullAttr) fullAttr = '%s.%s' % (nodeName, "specular_Fresnel") specFresValue = pm.getAttr(fullAttr) dim = (specFresValue is False) or (fresIorValue is True) pm.editorTemplate(dimControl=(nodeName, "Ksn", dim))
def checkFresnelUseIOR(self, nodeName): fullAttr = '%s.%s'%(nodeName, "Fresnel_use_IOR") fresIorValue = pm.getAttr(fullAttr) fullAttr = '%s.%s'%(nodeName, "specular_Fresnel") specFresValue = pm.getAttr(fullAttr) dim = (specFresValue is False) or (fresIorValue is True) pm.editorTemplate(dimControl=(nodeName, "Ksn", dim)) fullAttr = '%s.%s'%(nodeName, "Fresnel") refFresValue = pm.getAttr(fullAttr) dim = (refFresValue is False) or (fresIorValue is True) pm.editorTemplate(dimControl=(nodeName, "Krn", dim))
def checkSpecularFresnel(self, nodeName): dimSpec1 = not self.thisNode.enable_spec1.get() dimSpec2 = not self.thisNode.enable_spec2.get() specAtt = pm.Attribute(nodeName + ".specular_Fresnel") specAtt2 = pm.Attribute(nodeName + ".specular_Fresnel2") iorAtt2 = pm.Attribute(nodeName + ".Fresnel_use_IOR") specFres = specAtt.get() specFres2 = specAtt2.get() fresIorValue = iorAtt2.get() dim = (specFres is False) or (fresIorValue is True) or dimSpec1 pm.editorTemplate(dimControl=(nodeName, "Ksn", dim)) dim = (specFres2 is False) or (fresIorValue is True) or dimSpec2 pm.editorTemplate(dimControl=(nodeName, "Ksn2", dim))
def emissionSource(self, nodeName): source = self.nodeAttr('emission_source') sourceVal = pm.getAttr(source) print sourceVal if (sourceVal == 0): pm.editorTemplate(dimControl=(nodeName, "emission", False)) pm.editorTemplate(dimControl=(nodeName, "emissionChannel", True)) else: pm.editorTemplate(dimControl=(nodeName, "emission", True)) pm.editorTemplate(dimControl=(nodeName, "emissionChannel", False))
def emissionSource(self, nodeName): source = self.nodeAttr('emission_source') sourceVal = pm.getAttr(source) print sourceVal if(sourceVal == 0): pm.editorTemplate(dimControl=(nodeName, "emission", False)) pm.editorTemplate(dimControl=(nodeName, "emissionChannel", True)) else: pm.editorTemplate(dimControl=(nodeName, "emission", True)) pm.editorTemplate(dimControl=(nodeName, "emissionChannel", False))
def scatteringSource(self, nodeName): source = self.nodeAttr('scattering_source') sourceVal = pm.getAttr(source) print sourceVal if(sourceVal == 0): pm.editorTemplate(dimControl=(nodeName, "scattering", False)) pm.editorTemplate(dimControl=(nodeName, "scatteringChannel", True)) else: pm.editorTemplate(dimControl=(nodeName, "scattering", True)) pm.editorTemplate(dimControl=(nodeName, "scatteringChannel", False))
def scatteringSource(self, nodeName): source = self.nodeAttr('scattering_source') sourceVal = pm.getAttr(source) print sourceVal if (sourceVal == 0): pm.editorTemplate(dimControl=(nodeName, "scattering", False)) pm.editorTemplate(dimControl=(nodeName, "scatteringChannel", True)) else: pm.editorTemplate(dimControl=(nodeName, "scattering", True)) pm.editorTemplate(dimControl=(nodeName, "scatteringChannel", False))
def arnoldDimControlIfFalse(node, target, source): dim = not arnoldGetDimValue(node, source) pm.editorTemplate(dimControl=(node, target, dim))
def checkRaw(self, nodeName): fullAttr = '%s.%s'%(nodeName, "raw") rawValue = pm.getAttr(fullAttr) dim = rawValue pm.editorTemplate(dimControl=(nodeName, "maxDisplace", dim))
def ArnoldVolumeTypeChange(nodeName): type = cmds.getAttr(nodeName + '.type') dim = (type == 0) # "Custom" pm.editorTemplate(dimControl=(nodeName, "filename", dim)) pm.editorTemplate(dimControl=(nodeName, "grids", dim)) pm.editorTemplate(dimControl=(nodeName, "frame", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityGrids", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityScale", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityFps", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityShutterStart", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityShutterEnd", dim)) pm.editorTemplate(dimControl=(nodeName, "dso", not dim)) pm.editorTemplate(dimControl=(nodeName, "data", not dim))
def AEzFileSwitchTemplate(nodeName): pm.editorTemplate(beginScrollLayout=True) pm.editorTemplate(beginLayout='File Switch Attributes', collapse=False) # Unfortunately, these only work if they're strings of global MEL functions # and can't take a Python function like most APIs. pm.editorTemplate('AEzFileSwitchPathNew', 'AEzFileSwitchPathReplace', 'highResolution', callCustom=True) pm.editorTemplate('AEzFileSwitchPathNew', 'AEzFileSwitchPathReplace', 'lowResolution', callCustom=True) pm.editorTemplate('useHighRes', addControl=True) pm.editorTemplate('override', addControl=True) pm.editorTemplate('zFileSwitchRefreshNew', 'zFileSwitchRefreshReplace', 'output', callCustom=True) pm.editorTemplate(endLayout=True) pm.mel.eval('AEabstractBaseCreateTemplate %s' % nodeName) pm.editorTemplate(addExtraControls=True) pm.editorTemplate(endScrollLayout=True)
def checkRaw(self, nodeName): fullAttr = '%s.%s' % (nodeName, "raw") rawValue = pm.getAttr(fullAttr) dim = rawValue pm.editorTemplate(dimControl=(nodeName, "maxDisplace", dim))
def beginLayout(self, label): pm.editorTemplate(collapse=False, beginLayout=label)
def endLayout(self): pm.editorTemplate(endLayout=True)
def checkPrimarySpecularFresnel(self, nodeName): fullAttr = '%s.%s'%(nodeName, 'specular_enable_fresnel_falloff') useFresnel = pm.getAttr(fullAttr) dim = not useFresnel pm.editorTemplate(dimControl=(nodeName, 'specularIor', dim))
def __init__(self, nodeName): node = pm.PyNode(nodeName) if node.type() == 'lambert': pm.editorTemplate(beginLayout="Mantra Raytrace Options") self.addControl("mtm_refrBlur", "Refraction Blur") self.addControl("mtm_refrSamples", "Refraction Samples") pm.editorTemplate(endLayout=True) if node.type() in ['phong', 'phongE', 'blinn']: pm.editorTemplate(beginLayout="Mantra Raytrace Options") self.addControl("mtm_refrBlur", "Refraction Blur") self.addControl("mtm_refrSamples", "Refraction Samples") self.addControl("mtm_reflBlur", "Reflection Blur") self.addControl("mtm_reflSamples", "Reflection Samples") self.addControl("mtm_oren", "Use OrenNayar diffuse") self.addControl("mtm_fresnel", "Fresnel Value") pm.editorTemplate(endLayout=True) if node.type() in ['spotLight']: pm.editorTemplate(beginLayout="Mantra SpotLight Options") self.addControl("mtm_deepShadowMap", "Use Deep Shadow Maps") self.addControl("mtm_spread", "Shadow Spread") self.addControl("mtm_bias", "Shadow Bias") self.addControl("mtm_blur", "Shadow Blur") self.addControl("mtm_shadowQuality", "Shadow Quality") self.addControl("mtm_samplingQuality", "Sampling Quality") self.addControl("mtm_activeRadius", "Active Radius") self.addControl("mtm_surfaceShaders", "Use SurfaceShaders") self.addControl("mtm_fastShadows", "Use SimpleShadows") pm.editorTemplate(endLayout=True) if node.type() in ['pointLight', 'directionalLight']: pm.editorTemplate(beginLayout="Mantra Light Options") self.addControl("mtm_samplingQuality", "Sampling Quality") self.addControl("mtm_activeRadius", "Active Radius") self.addControl("mtm_surfaceShaders", "Use SurfaceShaders") self.addControl("mtm_fastShadows", "Use SimpleShadows") pm.editorTemplate(endLayout=True) if node.type() in ['areaLight']: pm.editorTemplate(beginLayout="Mantra Light Options") self.addControl("mtm_samplingQuality", "Sampling Quality") self.addControl("mtm_normalizeArea", "Normalize Area") self.addControl("mtm_activeRadius", "Active Radius") self.addControl("mtm_areaType", "Area Light Shape") self.addControl("mtm_useLightGeometry", "Use Geometry") self.addControl("mtm_lightGeometry", "Light Geometry") self.addControl("mtm_renderLightGeometry", "Render Light Geometry") self.addControl("mtm_surfaceShaders", "Use SurfaceShaders") self.addControl("mtm_fastShadows", "Use SimpleShadows") pm.editorTemplate(endLayout=True) if node.type() == 'mesh': pm.editorTemplate(beginLayout="Mantra Mesh Options") #self.addControl("mtm_renderAsSubdiv", "Render As Subdiv") pm.editorTemplate("mtm_renderAsSubdiv", ac=True, label="Render As Subdiv") pm.editorTemplate(endLayout=True) if node.type() == 'nurbsCurve': pm.editorTemplate(beginLayout="Mantra NurbsCurve Options") #self.addControl("mtm_renderAsSubdiv", "Render As Subdiv") pm.editorTemplate("primaryVisibility", ac=True, label="Primary Visibility") pm.editorTemplate(endLayout=True) pm.editorTemplate(beginLayout=pm.mel.uiRes("m_AEdependNodeTemplate.kNodeBehavior")) pm.editorTemplate("caching", ac=True) pm.editorTemplate("nodeState", ac=True) pm.editorTemplate(endLayout=True)
def addControl(self, attname, displayname): pm.editorTemplate(attname, addDynamicControl=True, label=displayname)
def buildMantraTemplates(self, nodeName): self.thisNode = pm.PyNode(nodeName) if self.node.type() == 'lambert': pm.editorTemplate(beginLayout="Mantra Raytrace Options") self.addControl("mtm_refrBlur", "Refraction Blur") self.addControl("mtm_refrSamples", "Refraction Samples") pm.editorTemplate(endLayout=True) if self.node.type() in ['phong', 'phongE', 'blinn']: pm.editorTemplate(beginLayout="Mantra Raytrace Options") self.addControl("mtm_refrBlur", "Refraction Blur") self.addControl("mtm_refrSamples", "Refraction Samples") self.addControl("mtm_reflBlur", "Reflection Blur") self.addControl("mtm_reflSamples", "Reflection Samples") self.addControl("mtm_oren", "Use OrenNayar diffuse") self.addControl("mtm_fresnel", "Fresnel Value") pm.editorTemplate(endLayout=True) if self.node.type() in ['spotLight']: pm.editorTemplate(beginLayout="Mantra SpotLight Options") self.addControl("mtm_deepShadowMap", "Use Deep Shadow Maps") self.addControl("mtm_spread", "Shadow Spread") self.addControl("mtm_bias", "Shadow Bias") self.addControl("mtm_blur", "Shadow Blur") self.addControl("mtm_shadowQuality", "Shadow Quality") self.addControl("mtm_samplingQuality", "Sampling Quality") self.addControl("mtm_activeRadius", "Active Radius") self.addControl("mtm_surfaceShaders", "Use SurfaceShaders") self.addControl("mtm_fastShadows", "Use SimpleShadows") pm.editorTemplate(endLayout=True) if self.node.type() in ['pointLight', 'directionalLight']: pm.editorTemplate(beginLayout="Mantra Light Options") self.addControl("mtm_samplingQuality", "Sampling Quality") self.addControl("mtm_activeRadius", "Active Radius") self.addControl("mtm_surfaceShaders", "Use SurfaceShaders") self.addControl("mtm_fastShadows", "Use SimpleShadows") pm.editorTemplate(endLayout=True) if self.node.type() in ['areaLight']: pm.editorTemplate(beginLayout="Mantra Light Options") self.addControl("mtm_samplingQuality", "Sampling Quality") self.addControl("mtm_normalizeArea", "Normalize Area") self.addControl("mtm_activeRadius", "Active Radius") self.addControl("mtm_areaType", "Area Light Shape") self.addControl("mtm_useLightGeometry", "Use Geometry") self.addControl("mtm_lightGeometry", "Light Geometry") self.addControl("mtm_renderLightGeometry", "Render Light Geometry") self.addControl("mtm_surfaceShaders", "Use SurfaceShaders") self.addControl("mtm_fastShadows", "Use SimpleShadows") pm.editorTemplate(endLayout=True) if self.node.type() == 'mesh': pm.editorTemplate(beginLayout="Mantra Mesh Options") #self.addControl("mtm_renderAsSubdiv", "Render As Subdiv") pm.editorTemplate("mtm_renderAsSubdiv", ac=True, label="Render As Subdiv") pm.editorTemplate(endLayout=True) if self.node.type() == 'nurbsCurve': pm.editorTemplate(beginLayout="Mantra NurbsCurve Options") pm.editorTemplate("primaryVisibility", ac=True, label="Primary Visibility") pm.editorTemplate(endLayout=True)
def ArnoldVolumeTypeChange(nodeName): type = cmds.getAttr(nodeName + ".type") dim = type == 0 # "Custom" pm.editorTemplate(dimControl=(nodeName, "filename", dim)) pm.editorTemplate(dimControl=(nodeName, "grids", dim)) pm.editorTemplate(dimControl=(nodeName, "frame", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityGrids", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityScale", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityFps", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityShutterStart", dim)) pm.editorTemplate(dimControl=(nodeName, "velocityShutterEnd", dim)) pm.editorTemplate(dimControl=(nodeName, "dso", not dim)) pm.editorTemplate(dimControl=(nodeName, "data", not dim))
def __init__(self, nodeName): node = pm.PyNode(nodeName) if node.type() == 'lambert': pm.editorTemplate(beginLayout="Mantra Raytrace Options") self.addControl("mtm_refrBlur", "Refraction Blur") self.addControl("mtm_refrSamples", "Refraction Samples") pm.editorTemplate(endLayout=True) if node.type() in ['phong', 'phongE', 'blinn']: pm.editorTemplate(beginLayout="Mantra Raytrace Options") self.addControl("mtm_refrBlur", "Refraction Blur") self.addControl("mtm_refrSamples", "Refraction Samples") self.addControl("mtm_reflBlur", "Reflection Blur") self.addControl("mtm_reflSamples", "Reflection Samples") pm.editorTemplate(endLayout=True) if node.type() == 'mesh': pm.editorTemplate(beginLayout="Mantra Mesh Options") #self.addControl("mtm_renderAsSubdiv", "Render As Subdiv") pm.editorTemplate("mtm_renderAsSubdiv", ac=True, label="Render As Subdiv") pm.editorTemplate(endLayout=True) pm.editorTemplate(beginLayout=pm.mel.uiRes("m_AEdependNodeTemplate.kNodeBehavior")) pm.editorTemplate("caching", ac=True) pm.editorTemplate("nodeState", ac=True) pm.editorTemplate(endLayout=True)