本文整理汇总了Python中maya.cmds.editRenderLayerGlobals函数的典型用法代码示例。如果您正苦于以下问题:Python editRenderLayerGlobals函数的具体用法?Python editRenderLayerGlobals怎么用?Python editRenderLayerGlobals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了editRenderLayerGlobals函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: snapShot
def snapShot(cam, objs, renderPath):
# build the lightrig
lightRigGrp = cmds.group(em=True, name='lightRigGroup')
lightMain = cmds.directionalLight(rotation=(-20, -45, 0), intensity=0.8)
lightFill = cmds.directionalLight(rotation=(-20, 45, 0), intensity=0.4)
lightUnder = cmds.directionalLight(rotation=(75, 0, 0), intensity=0.15)
lightKey = cmds.directionalLight(rotation=(-25, 145, 0), intensity=4.0)
cmds.parent([lightMain, lightFill, lightUnder, lightKey], lightRigGrp)
# select everything, build the special shader, render, then delete everything
renderLayerName = cmds.createRenderLayer(name='tempSnapShot_rlayer', empty=True, mc=True)
cmds.editRenderLayerMembers(renderLayerName, objs)
cmds.editRenderLayerMembers(renderLayerName, lightRigGrp)
shaderNodes = buildTempShader() #build the shader
cmds.sets(objs, e=True, forceElement=shaderNodes[0]) #adding the shader here means it's in the render layer
tempImage= cmds.render(cam, layer=renderLayerName)
cmds.editRenderLayerGlobals(currentRenderLayer='defaultRenderLayer')
cmds.delete(lightRigGrp, cam, renderLayerName)
cmds.delete(shaderNodes)
# copy the thumbnail to the desired location
output = cmds.sysFile(tempImage, rename=renderPath)
if output==True:
print 'Path for thumbnail: ' + renderPath
return renderPath
return None
示例2: get_pass_names
def get_pass_names(renderer, layer):
"""Helper method to return the passes for a given layer"""
cur_layer = cmds.editRenderLayerGlobals(q=True, currentRenderLayer=True)
cmds.editRenderLayerGlobals(currentRenderLayer=layer)
pass_names = []
if renderer == zync.VRAY_RENDERER:
render_element_nodes = cmds.ls(type="VRayRenderElement")
for element in render_element_nodes:
if cmds.getAttr(element + '.enabled'):
element_attrs = cmds.listAttr(element)
vray_name_attr = [ x for x in element_attrs if re.match('vray_name_.*', x) or re.match('vray_filename_.*', x) ]
pass_names.append(cmds.getAttr(element + '.' +vray_name_attr[0]))
if renderer == zync.MENTAL_RAY_RENDERER:
pass_names.append('MasterBeauty')
render_pass_nodes = cmds.listConnections(layer + '.renderPass')
if render_pass_nodes:
for pass_ in render_pass_nodes:
print " pass %s for %s" % (pass_, layer)
if cmds.getAttr(pass_ + '.renderable'):
pass_names.append(pass_)
cmds.editRenderLayerGlobals(currentRenderLayer=cur_layer)
return pass_names
示例3: layerChanged
def layerChanged(self, index):
self.curLayer = self.renderLayer.itemText(index)
if self.curLayer == "defaultRenderLayer":
self.disableLayerOverrides()
else:
self.enableLayerOverrides()
for cache in self.ABCViewerNode:
c = self.ABCViewerNode[cache]
over = c.getLayerOverrides(self.getLayer())
if over:
self.overrideProps.setChecked(over["removeProperties"])
self.overrideShaders.setChecked(over["removeShaders"])
self.overrideDisps.setChecked(over["removeDisplacements"])
self.updateTree()
if self.hierarchyWidget.currentItem():
self.itemCLicked(self.hierarchyWidget.currentItem(), 0, force=True)
# change it in maya too
curLayer = cmds.editRenderLayerGlobals(query=1, currentRenderLayer=1)
if curLayer != self.curLayer:
cmds.editRenderLayerGlobals( currentRenderLayer=self.curLayer)
示例4: collect_layer_info
def collect_layer_info(layer, renderer):
cur_layer = cmds.editRenderLayerGlobals(q=True, currentRenderLayer=True)
cmds.editRenderLayerGlobals(currentRenderLayer=layer)
layer_info = {}
# get list of active render passes
layer_info['render_passes'] = []
if renderer == "vray" and cmds.getAttr('vraySettings.imageFormatStr') != 'exr (multichannel)' and cmds.getAttr('vraySettings.relements_enableall') != False:
pass_list = cmds.ls(type='VRayRenderElement')
pass_list += cmds.ls(type='VRayRenderElementSet')
for r_pass in pass_list:
if cmds.getAttr('%s.enabled' % (r_pass,)) == True:
layer_info['render_passes'].append(r_pass)
# get prefix information
if renderer == 'vray':
node = 'vraySettings'
attribute = 'fileNamePrefix'
elif renderer in ("sw", "mr"):
node = 'defaultRenderGlobals'
attribute = 'imageFilePrefix'
try:
layer_prefix = cmds.getAttr('%s.%s' % (node, attribute))
layer_info['prefix'] = layer_prefix
except Exception:
layer_info['prefix'] = ''
cmds.editRenderLayerGlobals(currentRenderLayer=cur_layer)
return layer_info
示例5: SubdivisionLevelChanged
def SubdivisionLevelChanged(*args):
cmds.editRenderLayerGlobals( currentRenderLayer = "defaultRenderLayer")
for mesh in cmds.listRelatives(cmds.getAttr("CMSettings.ModelName"), allDescendents = True):
try:
cmds.setAttr(mesh + "Smooth.divisions", cmds.intSlider("SubdivisionLevel",query = True, value = True))
except:
pass
示例6: NAMEmatchOverrideButton
def NAMEmatchOverrideButton(* args):
clearList()
currentLayer = mc.editRenderLayerGlobals( query=True, currentRenderLayer=True )
selectionDefiner()
for trgCt in range(len(trgCmpList)):
for srcCt in range(len(srcCmpList)):
if trgCmpList[trgCt] == srcCmpList[srcCt]:
srcObjSel = srcTrList[srcCt]
trgObjSel = trgTrList[trgCt]
mc.select(srcObjSel,replace=True)
mc.select(trgObjSel,add=True)
getLayers()
getSelectedLayers()
for actLayer in actLayerList:
for selLayer in selLayerList:
if actLayer == selLayer:
mc.editRenderLayerGlobals(currentRenderLayer=actLayer)
overrideTransfer(actLayer)
actLayerList[:]=[]
selLayerList[:]=[]
sourceObj[:]=[]
targetObjs[:]=[]
sourceShape[:]=[]
targetShapes[:]=[]
if trgCmpList[trgCt] not in srcCmpList:
print trgTrList[trgCt] + " doesn't match! "
mc.select(srcGrp,replace=True)
mc.select(trgGrp,add=True)
mc.editRenderLayerGlobals(currentRenderLayer=currentLayer)
示例7: modifySubdivisions
def modifySubdivisions(*args):
if cmds.objExists("CMForegroundPlane"):
if cmds.window("SubdivisionsTextWindow", query = True, exists = True):
cmds.deleteUI("SubdivisionsTextWindow")
SubdivisionTextClass.UpdateSubSnap()
if os.path.exists(SubdivisionTextClass.ImagePath):
cmds.window( "SubdivisionsTextWindow", title = "Subdivisions Text" )
cmds.formLayout("SubWriterLayout", numberOfDivisions=100, w = 740, h = 400)
cmds.picture( "BasePicture", image = SubdivisionTextClass.ImagePath )
cmds.editRenderLayerGlobals( currentRenderLayer = "Subdivision_0")
SubdivisionTextClass.subColor = cmds.getAttr("CMForegroundPlane.imageName")[-5]
cmds.editRenderLayerGlobals( currentRenderLayer = "defaultRenderLayer")
cmds.window( "SubdivisionsTextWindow", edit = True, w = 740, h = 400)
#Create popupMenu for images
cmds.popupMenu( "SubdivisionPopUp", parent = "BasePicture" )
cmds.menuItem( label='TopLeft' , p = "SubdivisionPopUp", c = functools.partial(SubdivisionTextClass.ChangePos, "lt") )
cmds.menuItem( label='TopRight' , p = "SubdivisionPopUp", c = functools.partial(SubdivisionTextClass.ChangePos, "rt") )
cmds.menuItem( label='BottomLeft' , p = "SubdivisionPopUp", c = functools.partial(SubdivisionTextClass.ChangePos, "lb") )
cmds.menuItem( label='BottomRight', p = "SubdivisionPopUp", c = functools.partial(SubdivisionTextClass.ChangePos, "rb") )
cmds.menuItem( label='ToggleColor', p = "SubdivisionPopUp", c = SubdivisionTextClass.toggleSubdivisionColour )
cmds.showWindow("SubdivisionsTextWindow")
else:
cmds.confirmDialog(m = "The signature camera must be created before running this tool")
示例8: setDefaultRenderState
def setDefaultRenderState(self):
if cmds.editRenderLayerGlobals( query=True, currentRenderLayer=True ) != "defaultRenderLayer":
cmds.editRenderLayerGlobals(currentRenderLayer='defaultRenderLayer')
for node in self.getAOVs:
self.getInitState = cmds.getAttr("%s.enabled" % node)
node = node.split('aiAOV_')[1]
self.defaultRenderLayerState[node] = self.getInitState
示例9: bRgb_mask
def bRgb_mask(*args):
t = "MASK"
sels = cmds.ls(sl=True)
name = get_name(t)
sf = int(cmds.textFieldGrp('start_frame', q=True, tx=True))
ef = int(cmds.textFieldGrp('end_frame', q=True, tx=True))
print len(args)
if args[0] == "ch" :
type_l = ("face", "hair", "all")
for x in type_l:
name = get_name(args[0]+"_"+x+"_"+t)
if not(cmds.objExists(name)) :
rl = make_layer(name,sf,ef,t)
elif type(args[0]) == types.StringType:
name = get_name(args[0]+"_"+t)
if not(cmds.objExists(name)) :
rl = make_layer(name, sf, ef, t)
else :
name = get_name(t)
if not(cmds.objExists(name)) :
rl = make_layer(name, sf, ef, t)
if not(cmds.objExists(name)) :
cmds.editRenderLayerGlobals(crl= rl[0])
cmds.setAttr("defaultRenderGlobals.ren", "mayaSoftware", typ='string')
maya_set()
if len(sels) != 0 : cmds.select(sels,r=True)
return name
示例10: takeSnapShot
def takeSnapShot(targetObj, renderPath, rotX=-30.0, rotY=45.0, rotZ=0.0, resX=300, resY=300, useBoundingBox=False):
'''
Take a snapshot of the selected object using the Maya renderer then move the image to a directory
'''
# build the bounding box and find it's centre
bBox = targetObj
if useBoundingBox is True:
bBox = buildBoundingBoxGeo(targetObj, noChildren=False, ignoreInv=True)
focusPoint = cmds.xform(bBox, query=True, ws=True, t=True)
# build the camera the move and orient it
tempCam = cmds.camera(ar=True, ff=3, fl=35)
camName = tempCam[1]
cmds.setAttr(camName+'.renderable', True)
cmds.setAttr(camName+'.displayFilmGate', True)
cmds.setAttr(camName+'.displayResolution', True)
cmds.setAttr(camName+'.backgroundColor', 0.5, 0.5, 0.5, type='double3') #transform
cmds.move(focusPoint[0], focusPoint[1], focusPoint[2], tempCam, ws=True)
cmds.rotate( rotX, rotY, rotZ, tempCam, ws=True)
# build the bounding box then fit the camera
cmds.select(bBox, r=True)
cmds.viewFit(camName, an = False, f = 0.9 )
if useBoundingBox is True:
cmds.delete(bBox)
# set the render globals
cmds.currentTime(1)
cmds.setAttr('defaultRenderGlobals.imageFormat', 8)
cmds.setAttr('defaultRenderQuality.edgeAntiAliasing', 0)
cmds.setAttr('defaultRenderQuality.shadingSamples', 2)
cmds.setAttr('defaultRenderQuality.maxShadingSamples', 8)
cmds.setAttr('defaultRenderQuality.useMultiPixelFilter', 1)
cmds.setAttr('defaultRenderQuality.enableRaytracing', 0)
# build the lightrig
lightRigGrp = cmds.group(em=True, name='lightRigGroup')
lightMain = cmds.directionalLight(rotation=(-20, -45, 0), intensity=0.8)
lightFill = cmds.directionalLight(rotation=(-20, 45, 0), intensity=0.4)
lightUnder = cmds.directionalLight(rotation=(75, 0, 0), intensity=0.15)
lightKey = cmds.directionalLight(rotation=(-25, 145, 0), intensity=4.0)
cmds.parent([lightMain, lightFill, lightUnder, lightKey], lightRigGrp)
cmds.rotate( rotX, rotY, rotZ, lightRigGrp, ws=True)
# select everything, build the special shader, render, then delete everything
cmds.select([targetObj, lightRigGrp], r=True)
renderLayerName = cmds.createRenderLayer(name='tempSnapShot_rlayer', mc=True)
shaderNodes = buildReverseNormalShader() #build the shader
cmds.sets(targetObj, e=True, forceElement=shaderNodes[0]) #adding the shader here means it's in the render layer
tempImage= cmds.render(camName, layer=renderLayerName, x=resX, y=resY)
cmds.editRenderLayerGlobals(currentRenderLayer='defaultRenderLayer')
cmds.delete([lightRigGrp, tempCam[0], renderLayerName, shaderNodes[0], shaderNodes[1], shaderNodes[2], shaderNodes[3]])
# copy the thumbnail to the desired location
output = cmds.sysFile(tempImage, rename=renderPath)
if output==True:
print 'Path for thumbnail: ' + renderPath
return renderPath
return None
示例11: _export_ass
def _export_ass(self):
import mtoa.cmds.arnoldRender as ar
filePath=cmds.file(q=True,sn=True)
#getting fields for version
shot_temp=self.parent.sgtk.templates["maya_shot_work"]
shotgunFields=shot_temp.get_fields(filePath)
#getting output path
area_temp=self.parent.sgtk.templates['maya_ass_export_area']
path=area_temp.apply_fields(shotgunFields).replace('\\','/')
#setting ass export path
cmds.workspace(fileRule = ['ASS', path])
#account for renderlayers
for layer in cmds.ls(type='renderLayer'):
#discarding referenced layers
if ':' not in layer:
#checking whether layer needs to be rendered
if cmds.getAttr(layer+'.renderable')==1:
cmds.editRenderLayerGlobals( currentRenderLayer=layer )
try:
ar.arnoldBatchRender('')
except Exception, e:
raise TankError("Failed to export Ass files: %s" % e)
示例12: useDefaultRenderLayer
def useDefaultRenderLayer():
""" Analisys if must use the Default Render Layer (masterLayer) checking the option in the UI.
Set to use it if need.
"""
# analisys to use the defaultRenderLayer:
useDefaultRL = cmds.checkBox('defaultRenderLayerCB', query=True, value=True)
if useDefaultRL:
cmds.editRenderLayerGlobals(currentRenderLayer='defaultRenderLayer')
示例13: reAdd
def reAdd(samplesField, spreadField, maxDistanceField):
# switch to the ao render layer
cmds.editRenderLayerGlobals(currentRenderLayer='ao')
objects = cmds.ls(g=True)
cmds.select(objects)
cmds.hyperShade(a='amb_occl_surf_shader')
changeAOSettings(samplesField, spreadField, maxDistanceField)
示例14: get_layer_override
def get_layer_override(layer, node, attribute='imageFilePrefix'):
"""Helper method to return the layer override value for the given node and attribute"""
cur_layer = cmds.editRenderLayerGlobals(q=True, currentRenderLayer=True)
cmds.editRenderLayerGlobals(currentRenderLayer=layer)
attr = '.'.join([node, attribute])
layer_override = cmds.getAttr(attr)
cmds.editRenderLayerGlobals(currentRenderLayer=cur_layer)
return layer_override
示例15: disableImagePlane
def disableImagePlane():
objs = mc.ls(typ="imagePlane")
for obj in objs:
if not mc.editRenderLayerGlobals(q=1, crl=1) == "defaultRenderLayer":
mc.editRenderLayerAdjustment(obj + ".displayMode")
mc.setAttr(obj + ".displayMode", 0)
if not mc.editRenderLayerGlobals(q=1, crl=1) == "defaultRenderLayer":
mc.editRenderLayerAdjustment(obj + ".type")
mc.setAttr(obj + ".type", 1)