本文整理汇总了Python中maya.cmds.hide函数的典型用法代码示例。如果您正苦于以下问题:Python hide函数的具体用法?Python hide怎么用?Python hide使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hide函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ResetTranslationManipsUsed
def ResetTranslationManipsUsed( self ):
self.NumTranslationManipsUsed = 0
# .. se hacen invisible los que hay creados ...
for manip in self.TranslationManips:
manip.DestroyTranslationScriptJobs()
cmds.hide( manip.GetGizmo() )
示例2: setAttributes
def setAttributes(self, shader):
self.setPreset(self.getPreference('Preset'))
cmds.setAttr('defaultRenderGlobals.ren', 'turtle', type='string')
cmds.setAttr('TurtleRenderOptions.renderer', 1)
for key, value in shader.shaderAttr.iteritems():
cmds.setAttr(getattr(self, shader.mode.lower()) + '.' + key, value)
cmds.setAttr('TurtleDefaultBakeLayer.tbBilinearFilter', self.renderAttr['tbBilinearFilter'])
cmds.setAttr('TurtleDefaultBakeLayer.tbEdgeDilation', self.renderAttr['tbEdgeDilation'])
cmds.setAttr('TurtleDefaultBakeLayer.tbDirectory', self.renderAttr['tbDirectory'], type='string')
if shader.mode == 'THICK':
# Isolate meshes because there is a bug with Thickness when object penetrate each others
faces = [x for x in shader.assignation if '.' in x]
if faces:
cmds.select(faces)
mel.eval("InvertSelection")
cmds.delete() # Delete and hide, or assign surfaceshader black if 'OCC'?
toHide = list(set(cmds.ls(geometry=True, long=True)) - set(shader.shapes))
if toHide:
cmds.hide(toHide)
elif shader.mode == 'RGB':
try:
attr = cmds.getAttr(shader.name + '.color')
except ValueError:
attr = cmds.getAttr(shader.name + '.outColor')
cmds.setAttr(self.rgb + '.outColor', *attr[0], type='double3')
示例3: setUp
def setUp(self):
self.targetMesh = 'testMesh'
self.numVerts = 169 # number of verts in our mesh
self.mll = MllInterface()
unittest.TestCase.setUp(self)
openMayaFile('simplemirror.ma')
cmds.hide("|y_axis")
cmds.showHidden("|x_axis")
self.mll.setCurrentMesh(self.targetMesh)
self.mll.initLayers()
self.mll.createLayer("original weights")
self.model = ie.LayerData()
self.layer = ie.Layer()
self.layer.opacity = 1.0
self.layer.enabled = True
self.layer.mask = [0.0]*self.numVerts
self.layer.mask[1] = 0.9
self.layer.mask[5] = 0.5566
self.layer.name = "imported layer"
self.model.addLayer(self.layer)
self.infl = ie.Influence()
self.layer.addInfluence(self.infl)
self.infl.influenceName = "x_axis|root|R_joint1"
self.infl.logicalIndex = 666 # use nonsense value
self.infl.weights = [0.1]*self.numVerts
self.infl.weights[3] = 0.688
self.infl.weights[4] = 0.345
示例4: create_module
def create_module(self, moduleType):
# new module dialog
moduleName, ok = QtGui.QInputDialog().getText(self, 'Add ' + moduleType + ' Module', 'Enter module name:', QtGui.QLineEdit.Normal, moduleType)
if ok and moduleName != "":
# If module with name is exist
if cmds.objExists(moduleName+":main"):
QtGui.QMessageBox.information(self, "Warning", "This module is exist.")
else:
# add module to list
item = QtGui.QListWidgetItem(moduleName)
self.modules_listWidget.addItem(item)
self.modules_listWidget.setCurrentItem(item)
# import module
cmds.file("G:/Projects New/AnimaCord/pk_rig/%s/%s_rig.mb" %(moduleType,moduleType), r=True, type="mayaBinary", namespace=moduleName)
cmds.file("G:/Projects New/AnimaCord/pk_rig/%s/%s_rig.mb" %(moduleType,moduleType), importReference=True )
cmds.parent(moduleName+":main", characterRoot)
# set module name
cmds.setAttr(moduleName+":main.moduleName", moduleName, type="string")
cmds.hide(moduleName+":controls")
cmds.select(moduleName+":main_poser")
self.update_modules_list()
示例5: _bakeObj
def _bakeObj(obj):
'''Bake animazione.'''
constrName = _getParentConstraint(obj)
constrExists = cmds.ls(constrName)
# se il constraint non esiste o non contiene keyframe esci
if not constrExists or cmds.keyframe(constrName, q=True, kc=True) == 0:
sys.stdout.write('Nothing to bake\n')
return
# primo frame
currentFrame = cmds.currentTime(q=True)
firstFrame = cmds.playbackOptions(q=True, ast=True)
cmds.currentTime(firstFrame)
# salva come lastFrame l'ultimo frame d'animazione del constraint o dell'oggetto
keyTimes = cmds.keyframe(obj, q=True, tc=True)
if not keyTimes:
keyTimes = cmds.keyframe(constrName, q=True, tc=True)
else:
keyTimes.extend(cmds.keyframe(constrName, q=True, tc=True))
lastFrame = max(keyTimes)
# se all'ultimo frame rimane attached oppure il corpo e' rigido allora usa animation end time
if max(cmds.keyframe(constrName, q=True, ev=True, t=(lastFrame, lastFrame))) > 0.0 or _getRigidBody(obj):
lastFrame = max(lastFrame, cmds.playbackOptions(q=True, aet=True))
# crea il locator
locatorName = obj + _locSfx
_setRootNamespace()
loc = cmds.spaceLocator(n=locatorName)[0]
cmds.hide(loc)
# trova il parent del gruppo PH
parent = cmds.listRelatives(_getParentHandle(obj), p=True)
if parent:
cmds.parent([loc, parent[0]])
# copia l'ordine degli assi
cmds.setAttr(loc + '.rotateOrder', cmds.getAttr(obj + '.rotateOrder'))
# copia matrice e pivot
cmds.xform(loc, m=cmds.xform(obj, q=True, m=True, ws=True), ws=True)
cmds.xform(loc, piv=cmds.xform(obj, q=True, rp=True, ws=True), ws=True)
# costringi il locator
constraint = cmds.parentConstraint(obj, loc, mo=True)[0]
# fai il bake
cmds.bakeResults(loc, at=['t', 'r'], sm=True, t=(firstFrame, lastFrame), dic=True, pok=True)
# cancella il constraint
cmds.delete(constraint)
# ripristina il frame precedente
cmds.currentTime(currentFrame)
示例6: setObjectAsCanvas
def setObjectAsCanvas(name):
cmds.polyEvaluate(f=True)
subdivSurface = cmds.polyToSubdiv(maxPolyCount=cmds.polyEvaluate(f=True), maxEdgesPerVert=32, ch=False)[0]
liveSurface = cmds.subdToNurbs(subdivSurface, ot=0, ch=False)
cmds.delete(subdivSurface)
cmds.hide(liveSurface)
cmds.makeLive(liveSurface)
return liveSurface
示例7: render
def render(self):
""" Starts the render """
try: # If MtoA was not found
defaultTranslator = cmds.getAttr("defaultArnoldDisplayDriver.aiTranslator")
except ValueError:
cmds.warning("Current renderer is not set to Arnold.")
return
cmds.setAttr("defaultArnoldDisplayDriver.aiTranslator", "aton", type="string")
# Updating the port from UI
if self.defaultPort != 0:
port = self.portSpinBox.value()
cmds.setAttr("defaultArnoldDisplayDriver.port", port)
else:
cmds.warning("Current renderer is not set to Arnold or Aton driver is not loaded.")
return
# Adding time changed callback
if self.timeChangedCB == None:
self.timeChangedCB = OM.MEventMessage.addEventCallback("timeChanged", self.timeChnaged)
# Adding selection changed callback
if self.selectionChangedCB == None:
self.selectionChangedCB = OM.MEventMessage.addEventCallback("SelectionChanged", self.selectionChanged)
try: # If render session is not started yet
cmds.arnoldIpr(mode="stop")
except RuntimeError:
pass
# Temporary makeing hidden cameras visible before scene export
hCams = [
x
for x in cmds.listCameras()
if not cmds.getAttr("%s.visibility" % x)
or not cmds.getAttr("%s.visibility" % cmds.listRelatives(x, s=1)[0])
]
for i in hCams:
cmds.showHidden(i)
try: # Start IPR
camera = self.getCamera()
cmds.arnoldIpr(cam=camera, mode="start")
except RuntimeError:
cmds.warning("Current renderer is not set to Arnold.")
# Update IPR
self.IPRUpdate()
sys.stdout.write("// Info: Aton - Render started.\n")
# Setting back to default
for i in hCams:
cmds.hide(i)
cmds.setAttr("defaultArnoldDisplayDriver.aiTranslator", defaultTranslator, type="string")
cmds.setAttr("defaultArnoldDisplayDriver.port", self.defaultPort)
示例8: renderAllLights
def renderAllLights(self, renderLights=[],useGroups=False):
lights = cmds.ls(dag=True,visible=True,lights=True, type='mentalrayIblShape')
#Check if there is any lights selected to only do those
if renderLights == [] or renderLights == None:
renderLights = cmds.ls( dag=True, sl=True , lights=True, type='mentalrayIblShape')
#if there isn't any light selected just get all the lights
if renderLights == []:
renderLights = lights
lightNames = ""
for light in renderLights:
lightNames = lightNames + light + '\n'
windowName = 'ProgressWindow'
if cmds.window(windowName, exists=True):
cmds.deleteUI(windowName)
window = cmds.window(windowName,t="Progress Report")
cmds.columnLayout()
cmds.iconTextStaticLabel( st='textOnly', l='Rendering Lights:' )
cmds.iconTextStaticLabel( st='textOnly', l=lightNames )
cmds.iconTextStaticLabel( st='textOnly', l='Process Bar' )
progressControl = cmds.progressBar(maxValue=len(renderLights), width=300)
cmds.showWindow( window )
lights = self.sortLightsByType(lights)
#-Revised--hide ibl node that is at the end of lights list (sorted previously)
if cmds.objectType( lights[-1], isType='mentalrayIblShape' ) == True:
cmds.setAttr('%s.visibleInFinalGather' % lights[-1], 0)
cmds.setAttr('%s.visibleInEnvironment' % lights[-1], 0)
cmds.hide(lights)
lightCount = 0
if useGroups==True:
renderLightsGroups = self.groupLightsByName(renderLights)
cmds.progressBar(progressControl,edit=True, maxValue=len(renderLightsGroups.keys()), width=300)
for group in renderLightsGroups:
self.renderOnlyThisLight(renderLightsGroups[group])
progressInc = cmds.progressBar(progressControl, edit=True, pr=lightCount+1)
lightCount+=1
else:
print renderLights
for light in renderLights:
self.renderOnlyThisLight(light)
progressInc = cmds.progressBar(progressControl, edit=True, pr=lightCount+1)
lightCount+=1
cmds.showHidden(lights)
#-Revised--since we sorted the lights by type we know that the lastone will be the IBL
if cmds.objectType( lights[-1], isType='mentalrayIblShape' ) == True:
cmds.setAttr('%s.visibleInFinalGather' % lights[-1], 1)
cmds.setAttr('%s.visibleInEnvironment' % lights[-1], 1)
示例9: resetVisiblity
def resetVisiblity(self):
"""
Hide all top level nodes within the scene. This is the default state for
Sandwich to always hide everything before executing a render layer
NOTE: This is only a quick solution to hide all geometries in the scene.
We still need to iterate through each layer and hide their assigned object
in order to be certain that the visibility remains correctly.
"""
mc.hide(allObjects = True)
示例10: _hide
def _hide(self):
"""
Hides everything but the dynamic control.
"""
system = cmds.listRelatives(self.pos_group, ad=True)
for item in system:
if not re.search("DyCtrl|DyFKCtrl", item, re.I):
try:
cmds.hide(item)
except ValueError:
continue
示例11: initializeBalloon
def initializeBalloon(initRadius):
mc.polySphere(sx = 12, sy = 8, n = "balloonTemp", r = initRadius)
mc.rename( "polySphere1", "balloonTempHistory")
mc.polySoftEdge( a = 180 )
mc.lattice( n = 'balloon', cp = True, dv = (2, 4, 2), objectCentered = True, ldv = (2, 3, 2), outsideLattice = True )
mc.hide()
mc.select('balloonTemp.vtx[84]', r=True)
mc.ChamferVertex()
mc.rename( "polyChamfer1", "tempChamfer" )
mc.setAttr( 'tempChamfer.width', .1 )
mc.delete( 'balloonTemp.f[72]' )
return
示例12: showHideObjects
def showHideObjects(self, *args):
'''
'''
if self._IScontextTool._mObjectsToHide:
if len(self._IScontextTool._mObjectsToHide) > 0:
bHide = cmds.checkBox(self._IShideObjectsCbx, query = True, value = True)
if bHide:
cmds.hide(self._IScontextTool._mObjectsToHide)
else:
cmds.showHidden(self._IScontextTool._mObjectsToHide)
示例13: initializeRibbon
def initializeRibbon(initWidth):
mc.polyPlane(sx = 240, sy = 2.0, n = "ribbonTemp", w = initWidth, h = 0.165)
mc.rename("polyPlane1", "ribbonTempHistory")
mc.polySoftEdge( a = 180)
mc.lattice( n = 'ribbon', cp = True, dv = (2, 4, 2), objectDentered = True, ldv = (2, 3, 2), outsideLattice = True )
mc.hide()
mc.select('ribbonTempHistory.vtx[1]', r=True )
mc.ChamferVertex()
mc.rename( "polyChamfer1", "tempChamfer" )
mc.seAttr( 'tempChamfer.width', 1)
mc.delete( 'ribbonTemp.vtx[72]' )
return
示例14: editSkin
def editSkin(self):
if self.editSkin_button.isChecked() :
self.mainPage_stackedWidget.setCurrentIndex(2)
self.editCharacter_button.setChecked(False)
self.editModules_button.setChecked(False)
for m in modules:
cmds.showHidden(m+":posers")
cmds.hide(m+":controls")
else:
self.editSkin_button.setChecked(True)
示例15: createMotionTrailNode
def createMotionTrailNode(self, masterNode):
with G.aToolsBar.createAToolsNode:
motionTrailNode = cmds.createNode("motionTrail", name="%s_motionTrailNode"%masterNode, skipSelect=True)
motionTrailShape = cmds.createNode("motionTrailShape", skipSelect=True)
motionTrailTransform = cmds.rename(cmds.listRelatives(motionTrailShape, parent=True)[0], "%s_motionTrailTransform"%masterNode)
motionTrailAttr = "%s.points"%motionTrailNode
cmds.hide(motionTrailTransform)
cmds.connectAttr("%s.worldMatrix"%masterNode, "%s.inputMatrix"%motionTrailNode, force=True)
cmds.connectAttr("%s.points"%motionTrailNode, "%sShape.points"%motionTrailTransform, force=True)
return [motionTrailTransform, motionTrailAttr, motionTrailNode]