def _handleCreateBall(self): cmds.polySphere(name='ball', r=2, sx=20, sy=20, ax=[0, 1, 0]) cmds.polyColorPerVertex(rgb=(1, 1, 1), cdo=True) cmds.select('ball.f[380:399]', 'ball.f[320:339]', 'ball.f[280:299]', 'ball.f[240:259]', 'ball.f[200:219]', 'ball.f[160:179]', 'ball.f[120:139]', 'ball.f[80:99]', 'ball.f[40:59]', 'ball.f[0:19]') cmds.polyColorPerVertex(rgb=(1, 0, 0), cdo=True) cmds.select('ball') cmds.nonLinear( type='squash')
def _handleArm(self): time.sleep(2) ctime = cmds.currentTime(query=True) cmds.select('arm_L') cmds.setAttr('arm_L.rx', 0) cmds.setKeyframe() cmds.currentTime(ctime + 10) cmds.setAttr('arm_L.rx', -90) cmds.setKeyframe() cmds.currentTime(ctime + 15) cmds.setAttr('arm_L.rx', -180) cmds.setKeyframe() cmds.currentTime(ctime + 25) cmds.setAttr('arm_L.rx', -180) cmds.setKeyframe() cmds.currentTime(ctime + 35) cmds.setAttr('arm_L.rx', 0) cmds.setKeyframe()
def _handleExampleButton(self): time = 120 d = cmds.polyCylinder(r=15, h=20, sx=40, sy=10, sz=1, ax=(0, 0, 0), rcp=0, cuv=2, ch=1, n='CylinderContainer')[0] cmds.move(0, 10, 0) cmds.select(d) response = nimble.createRemoteResponse(globals()) response.put('name', d) num = self.NumBubbles.value() bubble = "bubble" for i in range(num): randomX = random.randrange(-10, 10) randomY = random.randrange(1, 2) randomZ = random.randrange(-10, 10) circleShape(randomX, randomY, randomZ, bubble, 1, None, time) bubble = "bubble" + str(i)
def _createGeometry(self, name, side): #build toe self.side = side self.name = name self.toe = mc.polyCube(sx=2, sy=2, sz=2, w=5, h=2, d=3, n=name + '_toe')[0] self.ball = mc.polyCylinder(h=5, n=name + '_ball')[0] mc.move(0, 0, -2, r=True) mc.rotate(0, 0, '90deg') self.toe = mc.polyUnite(self.toe, self.ball, n=name + '_toe')[0] mc.move(0, 0, -2, self.toe + ".scalePivot", self.toe + ".rotatePivot") #build arch self.arch = mc.polyCube(w=5, d=10, n=name + '_arch')[0] mc.move(0, 0, -7, r=True) #mc.select(f[8]-f[11]) mc.select(self.arch + '.f[2]') mc.move(0, 3, 0, r=True) self.ankle = mc.polySphere(r=2.5)[0] mc.move(0, 3, -12, r=True) self.arch = mc.polyUnite(self.arch, self.ankle, n=name + '_arch')[0] mc.move(0, 3, -12, self.arch + ".scalePivot", self.arch + ".rotatePivot") #self.heal = mc.polyCube(sx=2, sy=2, sz=2,w=5, h=3, n=name+'_heal') pass
def _handleRun(self): def rotate_limbs(angle): cmds.select('arm_L') cmds.setAttr('arm_L.rx', angle) cmds.setKeyframe(at='rotateX') cmds.select('arm_R') cmds.setAttr('arm_R.rx', -angle) cmds.setKeyframe(at='rotateX') cmds.select('left_L') cmds.setAttr('left_L.rx', -angle) cmds.setKeyframe(at='rotateX') cmds.select('leg_R') cmds.setAttr('leg_R.rx', angle) cmds.setKeyframe(at='rotateX') def change_height(height): cmds.select('Lego_Group') cmds.setAttr('Lego_Group.ty', height) cmds.setKeyframe(at='translateY') ctime = cmds.currentTime(query=True) cmds.select('Lego_Group') cmds.setAttr('Lego_Group.tz', 0) cmds.setKeyframe(at='translateZ') for index in range(1, 5): rotate_limbs(0) change_height(0) ctime += 5 cmds.currentTime(ctime) rotate_limbs(90) change_height(3) ctime += 5 cmds.currentTime(ctime) rotate_limbs(0) change_height(0) ctime += 5 cmds.currentTime(ctime) rotate_limbs(-90) change_height(3) ctime += 5 cmds.currentTime(ctime) rotate_limbs(0) change_height(0) cmds.select('Lego_Group') cmds.setAttr('Lego_Group.tz', 65) cmds.setKeyframe(at='translateZ')
def runFrom(bodyName, startTime, endTime): mc.select(bodyName) #first we start mc.currentTime(startTime+24) mc.setKeyframe(attribute='translateZ', v=-60) mc.currentTime(endTime) mc.setKeyframe(attribute='translateZ', v=0) mc.currentTime(startTime) mc.setKeyframe(attribute='rotateX', v=0) mc.currentTime(startTime+24) mc.setKeyframe(attribute='rotateX', v=385) mc.currentTime(endTime-24) mc.setKeyframe(attribute='rotateX', v=385) mc.currentTime(endTime) mc.setKeyframe(attribute='rotateX', v=360) left_leg = findName('leg_R') right_leg = findName('left_L') rTime = startTime lTime = startTime + 6 startVal = 0 while (lTime+12) < endTime: rTime = rTime + 12 lTime = lTime + 12 legRotate(right_leg, rTime, rTime+12, startVal, startVal + 360) legRotate(left_leg, lTime, lTime+12, startVal, startVal+360) startVal = startVal + 360 mc.select(right_leg) mc.currentTime(endTime+1) mc.rotate(0,0,0) mc.currentTime(startTime)
def _handleBall(self): power = self.powerBox.value() ctime = cmds.currentTime(query=True) cmds.select('ball') cmds.setAttr('ball.ty', 0) cmds.setAttr('ball.tz', 0) cmds.setAttr('ball.rx', 0) cmds.setAttr('ball.ry', 0) cmds.setAttr('ball.rz', 0) cmds.setKeyframe() cmds.keyTangent('ball', inTangentType='linear', outTangentType='linear', time=(ctime, ctime)) ctime += 5 * power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 2 * power) cmds.setKeyframe(at='translateY') ctime += 5 * power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 0) cmds.setKeyframe(at='translateY') #cmds.keyTangent('ball', inTangentType='linear', outTangentType='linear', time=(ctime,ctime)) ctime += 3 * power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 1.5 * power) cmds.setKeyframe(at='translateY') ctime += 3 * power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 0) cmds.setKeyframe(at='translateY') #cmds.keyTangent('ball', inTangentType='linear', outTangentType='linear', time=(ctime,ctime)) ctime += power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 0.5 * power) cmds.setKeyframe(at='translateY') ctime += power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 0) cmds.setKeyframe(at='translateY') #cmds.keyTangent('ball', inTangentType='linear', outTangentType='linear', time=(ctime,ctime)) ctime += power cmds.currentTime(ctime) cmds.setAttr('ball.tz', 16 * power) cmds.setAttr('ball.ty', 0) cmds.setAttr('ball.rx', 300 * power) cmds.setAttr('ball.ry', 240 * power) cmds.setAttr('ball.rz', 240 * power) cmds.setKeyframe()
def _handlePerturb(self): """ This perturbs the selected object. """ selectedObjects = cmds.ls(selection=True, long=True) vertsList = [] for object in selectedObjects: totalVerts = cmds.polyEvaluate(object, vertex=True) for number in range(totalVerts): vertsList.append(object + '.vtx[{number}]'.format(number=number)) for vert in vertsList: min = float(self.minInput.displayText()) max = float(self.maxInput.displayText()) randNumX = random.uniform(min, max) randNumY = random.uniform(min, max) randNumZ = random.uniform(min, max) cmds.select(vert, replace=True) cmds.move(randNumX, randNumY, randNumZ, relative=True) cmds.select(selectedObjects, replace=True)
def _handleChromeTex(self): if materials.npchromeSG == None: materials.npchrome() Sphere = mc.polySphere(r=5, n='texChromephere')[0] mc.select(cl=True) mc.select(Sphere) mc.sets(e=True, forceElement=materials.npchromeSG)
def _handlePlasticBlue(self): if materials.blueCPlasticSG == None: materials.blueClearPlastic() Sphere = mc.polySphere(r=5, n='bluePlasticSphere')[0] mc.select(cl=True) mc.select(Sphere) mc.sets(e=True, forceElement=materials.blueCPlasticSG)
def _handleShinyGold(self): if materials.shinyGoldSG == None: materials.shinyGold() Sphere = mc.polySphere(r=5, n='shinyGoldSphere')[0] mc.select(cl=True) mc.select(Sphere) mc.sets(e=True, forceElement=materials.shinyGoldSG)
def _handleSilver(self): if materials.silverSG == None: materials.silver() Sphere = mc.polySphere(r=5, n='sliverSphere')[0] mc.select(cl=True) mc.select(Sphere) mc.sets(e=True, forceElement=materials.silverSG)
def _handleBlueAA(self): if materials.blueAASG == None: materials.blueAnodizedAluminum() Sphere = mc.polySphere(r=5, n='blueAASphere')[0] mc.select(cl=True) mc.select(Sphere) mc.sets(e=True, forceElement=materials.blueAASG)
def _handleBlueFM(self): if materials.blueFMSG == None: materials.blueFineMetallic() Sphere = mc.polySphere(r=5, n='blueFMSphere')[0] mc.select(cl=True) mc.select(Sphere) mc.sets(e=True, forceElement=materials.blueFMSG)
def _handleBubbleButton(self): """ This callback creates a polygonal sphere in the Maya scene. it then translates it. """ decRange = np.arange(-1,1,.1) decRange2 = np.arange(0,1,.1) r = 2 a = 2.0*r y = (0, 1, 0) # y up c = cmds.polySphere( r=r, sx=10, sy=10, ax=y, cuv=2, ch=1, n='Bubble')[0] cmds.select(c) cmd.setKeyframe() cmd.setKeyframe() for i in range(1,300,5): x = rand.choice(decRange) y = 5*rand.choice(decRange2) z = rand.choice(decRange) cmd.currentTime(i) cmd.move(x,y,z,r=True) cmd.setKeyframe() response = nimble.createRemoteResponse(globals()) response.put('name', c)
def _handleRedAA(self): if materials.redAASG == None: materials.redAnodizedAluminum() print materials.redAASG Sphere = mc.polySphere(r=5, n='redAASphere')[0] mc.select(cl=True) mc.select(Sphere) mc.sets(e=True, forceElement=materials.redAASG)
def _perturb(self, selectObj): cmds.select(selectObj) total = cmds.polyEvaluate(v=True) for i in range(0, total): x = random.uniform(0, 0.7) y = random.uniform(0, 0.7) z = random.uniform(0, 0.7) cmds.polyMoveVertex(selectObj+'.vtx['+str(i)+']', lt=[x, y, z])
def moveFemur(self, xrotate, yrotate, zrotate): femur = self.getGundamFemur() mc.select(femur[0]) mc.rotate(xrotate, yrotate, zrotate) mc.setKeyframe(femur[0], t=self.timel) mc.select(femur[1]) mc.rotate(xrotate, yrotate, zrotate) mc.setKeyframe(femur[1], t=self.timel)
def moveFeet(self, xrotate, yrotate, zrotate): feets = self.getGundamFeet() mc.select(feets[0]) mc.rotate(xrotate, yrotate, zrotate) mc.setKeyframe(feets[0], t=self.timel) mc.select(feets[1]) mc.rotate(xrotate, yrotate, zrotate) mc.setKeyframe(feets[1], t=self.timel)
def bAlter(bName, timeFrame, changeVal, chStr): mc.select(bName) startTime = mc.currentTime(query=True) endTime = startTime + timeFrame rotBy = mc.getAttr(bName+ "." + chStr) + changeVal mc.setKeyframe(attribute=chStr) mc.currentTime(endTime) mc.setKeyframe(attribute=chStr, v=rotBy)
def moveHip(self, xrotate, yrotate, zrotate): hips = self.getGundamHip() mc.select(hips[0]) mc.rotate(-xrotate, yrotate, zrotate) mc.setKeyframe(hips[0], t=self.timel) mc.select(hips[1]) mc.rotate(-xrotate, -yrotate, zrotate) mc.setKeyframe(hips[1], t=self.timel)
def _handleBall(self): power = self.powerBox.value() ctime = cmds.currentTime(query=True) cmds.select('ball') cmds.setAttr('ball.ty', 0) cmds.setAttr('ball.tz', 0) cmds.setAttr('ball.rx', 0) cmds.setAttr('ball.ry', 0) cmds.setAttr('ball.rz', 0) cmds.setKeyframe() cmds.keyTangent('ball', inTangentType='linear', outTangentType='linear', time=(ctime,ctime)) ctime += 5*power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 2*power) cmds.setKeyframe(at='translateY') ctime += 5*power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 0) cmds.setKeyframe(at='translateY') #cmds.keyTangent('ball', inTangentType='linear', outTangentType='linear', time=(ctime,ctime)) ctime += 3*power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 1.5*power) cmds.setKeyframe(at='translateY') ctime += 3*power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 0) cmds.setKeyframe(at='translateY') #cmds.keyTangent('ball', inTangentType='linear', outTangentType='linear', time=(ctime,ctime)) ctime += power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 0.5*power) cmds.setKeyframe(at='translateY') ctime += power cmds.currentTime(ctime) cmds.setAttr('ball.ty', 0) cmds.setKeyframe(at='translateY') #cmds.keyTangent('ball', inTangentType='linear', outTangentType='linear', time=(ctime,ctime)) ctime += power cmds.currentTime(ctime) cmds.setAttr('ball.tz', 16*power) cmds.setAttr('ball.ty', 0) cmds.setAttr('ball.rx', 300*power) cmds.setAttr('ball.ry', 240*power) cmds.setAttr('ball.rz', 240*power) cmds.setKeyframe()
def _CreateSphereButton(self): """ This callback creates a polygonal cylinder in the Maya scene. """ sphere = cmds.polySphere(r=50.0, name='sphere1') cmds.select(sphere) response = nimble.createRemoteResponse(globals()) response.put('name', sphere)
def _makeCyl(self): r = 50 a = 2.0*r y = (0, 1, 0) c = cmds.polyCylinder( r=r, h=5, sx=40, sy=1, sz=1, ax=y, rcp=0, cuv=2, ch=1, n='exampleCylinder')[0] cmds.select(c) response = nimble.createRemoteResponse(globals()) response.put('name', c)
def bAlter(bName, timeFrame, changeVal, chStr): mc.select(bName) startTime = mc.currentTime(query=True) endTime = startTime + timeFrame rotBy = mc.getAttr(bName+ "." + chStr) + changeVal mc.setKeyframe(attribute=chStr) mc.currentTime(endTime) mc.setKeyframe(attribute=chStr, v=rotBy) mc.currentTime(startTimeTime)
def _CreateCubeButton(self): """ This callback creates a polygonal cylinder in the Maya scene. """ cube = cmds.polyCube(w=50,h=50,d=50,name="cube1") cmds.select(cube) response = nimble.createRemoteResponse(globals()) response.put('name', cube)
def _CreateCubeButton(self): """ This callback creates a polygonal cylinder in the Maya scene. """ cube = cmds.polyCube(w=50, h=50, d=50, name="cube1") cmds.select(cube) response = nimble.createRemoteResponse(globals()) response.put('name', cube)
def _createJoints(self, side): mc.select(cl=True) self.j_thumb_1 = mc.joint(p=(self.sideModifyer*2.25,-1.5,1.25)) mc.select(cl=True) mc.parent(self.r_hand_n_t, self.j_thumb_1) pass
def createLayer(self, layer, useExisting =True): """ Creates a display layer with the specified name. """ if useExisting and cmds.objExists(layer): return priorSelection = MayaUtils.getSelectedTransforms() cmds.select(clear=True) cmds.createDisplayLayer(name=layer) MayaUtils.setSelection(priorSelection)
def doSecond(): filePath = "C:/Users/Kyle/Downloads/x_wing/x_wing.mb" cmds.file(filePath, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='x_wing', i=True ) cmds.select('x_wing:polySurface3') cmds.scale(.1,.1,.1) cmds.move(0,10,10) cmds.setKeyframe(time=1) cmds.move(0,10,-10) cmds.setKeyframe(time=120)
def selectTrack(self, track, setFocus =True): """ Select the node corresponding to this track model instance, then focus the camera upon this node. """ if track: node = self.getTrackNode(track) cmds.select(node) if setFocus: self.setCameraFocus() else: cmds.select(clear=True)
def handleEyebrowsDwnBtn(self): global eyebrowsActAmt global eyebrowsIncAmt btmCapAmt = -0.014 cmds.select("eyebrowsClusterHandle") eyebrowsActAmt -= eyebrowsIncAmt if eyebrowsActAmt >= btmCapAmt: print eyebrowsActAmt cmds.move(0, eyebrowsActAmt, 0) else: eyebrowsActAmt = btmCapAmt
def handleDownBtn(self): global smileActAmt global incAmt btmCapAmt = -0.032 cmds.select("smileClusterHandle") smileActAmt -= incAmt if smileActAmt >= btmCapAmt: print smileActAmt cmds.move(0, smileActAmt, 0) else: smileActAmt = btmCapAmt
def handleUpBtn(self): global smileActAmt global incAmt topCapAmt = 0.016 cmds.select("smileClusterHandle") smileActAmt += incAmt if smileActAmt <= topCapAmt: print smileActAmt cmds.move(0, smileActAmt, 0) else: smileActAmt = topCapAmt
def handleSchnauzUpBtn(self): global schnauzActAmt global incAmt topCapAmt = 0.028 cmds.select("schnauzClusterHandle") schnauzActAmt += incAmt if schnauzActAmt <= topCapAmt: print schnauzActAmt cmds.move(0, schnauzActAmt, 0) else: schnauzActAmt = topCapAmt
def handleEyebrowsUpBtn(self): global eyebrowsActAmt global eyebrowsIncAmt topCapAmt = 0.021 cmds.select("eyebrowsClusterHandle") eyebrowsActAmt += eyebrowsIncAmt if eyebrowsActAmt <= topCapAmt: print eyebrowsActAmt cmds.move(0, eyebrowsActAmt, 0) else: eyebrowsActAmt = topCapAmt
def handleSchnauzDownBtn(self): global schnauzActAmt global incAmt btmCapAmt = 0.000 cmds.select("schnauzClusterHandle") schnauzActAmt -= incAmt if schnauzActAmt >= btmCapAmt: print schnauzActAmt cmds.move(0, schnauzActAmt, 0) else: schnauzActAmt = btmCapAmt
def selectTracks(self, tracks): """ Given a list of tracks, first compiles a list of track nodes then has Maya select them. """ nodes = list() for t in tracks: nodes.append(self.getTrackNode(t)) # and pass that list to Maya to be selected if len(nodes) > 0: cmds.select(nodes)
def selectAllTracks(self): """ All tracks are selected, by accumulating a list of all track nodes in the trackway layers. """ layers = cmds.ls( type='displayLayer') nodes = list() for layer in layers: if layer.endswith(self.LAYER_SUFFIX): nodes.extend(cmds.editDisplayLayerMembers( layer, query=True, noRecurse=True)) cmds.select(nodes)
def handleSchnauzUpBtn(self): global schnauzActAmt global incAmt topCapAmt = 0.028 cmds.select('schnauzClusterHandle') schnauzActAmt += incAmt if schnauzActAmt <= topCapAmt: print schnauzActAmt cmds.move(0, schnauzActAmt, 0) else: schnauzActAmt = topCapAmt
def handleUpBtn(self): global smileActAmt global incAmt topCapAmt = 0.016 cmds.select('smileClusterHandle') smileActAmt += incAmt if smileActAmt <= topCapAmt: print smileActAmt cmds.move(0, smileActAmt, 0) else: smileActAmt = topCapAmt
def handleDownBtn(self): global smileActAmt global incAmt btmCapAmt = -0.032 cmds.select('smileClusterHandle') smileActAmt -= incAmt if smileActAmt >= btmCapAmt: print smileActAmt cmds.move(0, smileActAmt, 0) else: smileActAmt = btmCapAmt
def handleEyebrowsDwnBtn(self): global eyebrowsActAmt global eyebrowsIncAmt btmCapAmt = -0.014 cmds.select('eyebrowsClusterHandle') eyebrowsActAmt -= eyebrowsIncAmt if eyebrowsActAmt >= btmCapAmt: print eyebrowsActAmt cmds.move(0, eyebrowsActAmt, 0) else: eyebrowsActAmt = btmCapAmt
def handleEyebrowsUpBtn(self): global eyebrowsActAmt global eyebrowsIncAmt topCapAmt = 0.021 cmds.select('eyebrowsClusterHandle') eyebrowsActAmt += eyebrowsIncAmt if eyebrowsActAmt <= topCapAmt: print eyebrowsActAmt cmds.move(0, eyebrowsActAmt, 0) else: eyebrowsActAmt = topCapAmt
def handleSchnauzDownBtn(self): global schnauzActAmt global incAmt btmCapAmt = 0.000 cmds.select('schnauzClusterHandle') schnauzActAmt -= incAmt if schnauzActAmt >= btmCapAmt: print schnauzActAmt cmds.move(0, schnauzActAmt, 0) else: schnauzActAmt = btmCapAmt
def selectToken(self, uid, setFocus =True, closeup =True): """ Select the node corresponding to this UID, then focusses the camera upon that node. """ node = self.getTokenNodeName(uid) if not node: return cmds.select(node) if setFocus: self.setCameraFocus(closeup)
def _handleExampleButton(self): """ This callback creates a polygonal cylinder in the Maya scene. """ r = 50 a = 2.0*r y = (0, 1, 0) c = cmds.polyCylinder( r=r, h=5, sx=40, sy=1, sz=1, ax=y, rcp=0, cuv=2, ch=1, n='exampleCylinder')[0] cmds.select(c) response = nimble.createRemoteResponse(globals()) response.put('name', c)
def MoveVertex(min, max): cmds.select(ado=True) selected = cmds.ls(selection=True, long=True) for object in selected: total = cmds.polyEvaluate(object, vertex=True) for i in range(total): randNumX = random.uniform(min, max) randNumY = random.uniform(min, max) randNumZ = random.uniform(min, max) vertex = object+'.vtx['+str(i)+']' cmds.select(vertex) cmds.move(randNumX, randNumY, randNumZ, relative=True)
def handleBallBtn(self): cmds.select('ball') cmds.currentTime(74) cmds.setKeyframe('ball') cmds.currentTime(112) cmds.move(-0.757, 6.434, 15.831) cmds.rotate(9.208, 17.386, -368.887) cmds.setKeyframe('ball') cmds.currentTime(144) cmds.move(-0.772, 0.637, 22.462) cmds.rotate(9.208, 17.386, -368.887) cmds.setKeyframe('ball')
def _checkType(self): highBound = float(self.HightBound.text()) lowBound = float(self.LowBound.text()) curvature = float(self.Curvature.text()) factor = float(self.Factor.text()) cmds.select(created+'2') if self.BendRadioButton.isChecked(): type= 'bend' cmds.nonLinear( type='bend', highBound=highBound, lowBound=lowBound, curvature=curvature) if self.SquashRadioButton.isChecked(): type = 'squash' cmds.nonLinear( type='squash', highBound=highBound, lowBound=lowBound, factor=factor) print type return type
def handleScriptBtn(self): cmds.select('arm_R') cmds.currentTime(1) cmds.setKeyframe('arm_R', at='rotateX') cmds.currentTime(20) cmds.rotate(-142.85, 0, 0) cmds.setKeyframe('arm_R', at='rotateX') cmds.currentTime(32) cmds.rotate(-142.85, 0, 0) cmds.setKeyframe('arm_R', at='rotateX') cmds.currentTime(48) cmds.rotate(0, 0, 0) cmds.setKeyframe('arm_R', at='rotateX')
def createRenderEnvironment(self): lightName = 'scenic_light1' if not cmds.objExists(lightName): lightName = cmds.directionalLight(name=lightName, intensity=0.5) cmds.move(0, 2500, 0, lightName) cmds.rotate('-45deg', '-45deg', 0, lightName) lightName = 'scenic_light2' if not cmds.objExists(lightName): lightName = cmds.directionalLight(name=lightName, intensity=0.5) cmds.move(0, 2500, 0, lightName) cmds.rotate('-45deg', '135deg', 0, lightName) floorName = 'floor' if not cmds.objExists(floorName): floorName = cmds.polyPlane(width=10000, height=10000, name=floorName)[0] shader, shaderEngine = self.createShader('Whiteout_Surface', 'surfaceShader') cmds.setAttr(shader + '.outColor', 1.0, 1.0, 1.0, type='double3') cmds.select([floorName]) cmds.sets(forceElement=shaderEngine)
def _handleKick(self): ctime = cmds.currentTime(query=True) cmds.select('leg_R') cmds.setAttr('leg_R.rx', 0) cmds.setKeyframe() cmds.currentTime(ctime + 10) cmds.setAttr('leg_R.rx', 90) cmds.setKeyframe() cmds.currentTime(ctime + 20) cmds.setAttr('leg_R.rx', -90) cmds.setKeyframe() cmds.currentTime(ctime + 30) cmds.setAttr('leg_R.rx', 0) cmds.setKeyframe() cmds.currentTime(ctime + 15)
def findPrevious(cls, start=False): prints = cls.getTargets(1) if not prints: return False selection = [] for p in prints: prev = p while True: prevs = cls.getPrevious(target=prev) if not prevs: break prev = prevs[0] # Breaks on the first find if the previous was selected if not start: break if prev not in selection: selection.append(prev) cmds.select(selection)
def findNext(cls, end =False): prints = cls.getTargets(1) if not prints: return False selection = [] for p in prints: next = p while True: nexts = cls.getNext(next) if not nexts: break next = nexts[0] # Breaks on the first find if the next was selected if not end: break if next not in selection: selection.append(next) cmds.select(selection)
def _handleArm(self): ctime = cmds.currentTime(query=True) cmds.select('arm_L') cmds.setAttr('arm_L.rx', 0) cmds.setKeyframe() cmds.currentTime(ctime + 10) cmds.setAttr('arm_L.rx', -90) cmds.setKeyframe() cmds.currentTime(ctime + 15) cmds.setAttr('arm_L.rx', -180) cmds.setKeyframe() cmds.currentTime(ctime + 25) cmds.setAttr('arm_L.rx', -180) cmds.setKeyframe() cmds.currentTime(ctime + 35) cmds.setAttr('arm_L.rx', 0) cmds.setKeyframe()
def rotate_limbs(angle): cmds.select('arm_L') cmds.setAttr('arm_L.rx', angle) cmds.setKeyframe(at='rotateX') cmds.select('arm_R') cmds.setAttr('arm_R.rx', -angle) cmds.setKeyframe(at='rotateX') cmds.select('left_L') cmds.setAttr('left_L.rx', -angle) cmds.setKeyframe(at='rotateX') cmds.select('leg_R') cmds.setAttr('leg_R.rx', angle) cmds.setKeyframe(at='rotateX')