def createBar(name, index): ## actual standard gold bar dimensions (inches) y = 1.75 x = 7. z = 3.63 cmds.polyCube(h=y, w=x, d=z, n=fn(name, index)) cmds.scale(.94, .9, fn(name, index) + '.f[1]', xz=True) cmds.move(y / 4 + .001, y=True, relative=True) cmds.scale(.5, .5, .5) cmds.polyBevel(fn(name, index), o=.07, sg=12)
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 _createGeometry(self, name, side): #create tibia self.tibia = mc.polyCube(sx=1, sy=1, sz=1, w=2, h=50, d=2, n=name + '_tibia')[0] mc.move(0, 28, -12) self.knee = mc.polyCylinder(h=5, r=2, n=name + '_knee')[0] mc.move(0, 54, -12, r=True) mc.rotate(0, 0, '90deg') self.tibia = mc.polyUnite(self.tibia, self.knee, n=name + '_tibia')[0] self.llegArmor = mc.polyCube(w=8, h=30, d=8)[0] mc.move(0, 22, -12) mc.select(self.llegArmor + '.f[3]') mc.scale(1.5, 1, 1.5) mc.select(self.llegArmor + '.e[0]') mc.polySubdivideEdge(dv=2) mc.select(self.llegArmor + '.e[12]') mc.move(0, 2, 0, r=True) self.tibia = mc.polyUnite(self.tibia, self.llegArmor, n=name + '_tibia')[0] mc.move(0, 54, -12, self.tibia + ".scalePivot", self.tibia + ".rotatePivot") #create feamer self.femur = mc.polyCube(sx=1, sy=1, sz=1, w=3, h=50, d=3, n=name + '_feamer')[0] mc.move(0, 80, -12) self.hip = mc.polySphere(r=5, n=name + '_hip') mc.move(0, 107, -12) self.femur = mc.polyUnite(self.femur, self.hip, n=name + '_femur')[0] mc.move(0, 107, -12, self.femur + ".scalePivot", self.femur + ".rotatePivot") self._createCalfArmor(name, side) pass
def doMulti(time): for i in range(0, time / 2): #makes time/2 bubbles and sets up a bunch of random stats for them initTime = randint(0, time - 30) initX = randint(-10, 10) initZ = randint(-10, 10) xRand = randint(-5, 5) zRand = randint(-5, 5) #keyframes all the bubbles based on time that user sets in Qt slider r = .1 c = cmds.polySphere(r=r) cmds.setAttr(c[0] + ".visibility", 0) cmds.setKeyframe(time=initTime + 60) cmds.scale(11, 10, 11) cmds.move(initX, 20, initZ) cmds.setKeyframe(time=initTime + 50) cmds.setAttr(c[0] + ".visibility", 1) cmds.rotate(100, 0, 0) cmds.scale(10, 9, 9.5) cmds.setKeyframe(time=initTime + 40) cmds.move(initX + xRand, 10, initZ + zRand) cmds.rotate(60, 0, 0) cmds.setKeyframe(time=initTime + 30) cmds.move(initX, 6, initZ) cmds.rotate(0, 0, 0) cmds.setKeyframe(time=initTime + 20) cmds.move(initX, 3, initZ) cmds.scale(3, 3, 3) cmds.setKeyframe(time=initTime + 10) cmds.move(initX, 0, initZ) cmds.scale(1, .8, 1) cmds.setKeyframe(time=initTime)
def doSingle(): #keyframes a bubble, does NOT use slider r = .1 c = cmds.polySphere(r=r) cmds.setAttr(c[0] + ".visibility", 0) cmds.setKeyframe(time=60) cmds.scale(11, 10, 11) cmds.move(0, 20, 0) cmds.setKeyframe(time=50) cmds.setAttr(c[0] + ".visibility", 1) cmds.rotate(100, 0, 0) cmds.scale(10, 9, 9.5) cmds.setKeyframe(time=40) cmds.move(4, 10, 0) cmds.rotate(60, 0, 0) cmds.setKeyframe(time=30) cmds.move(0, 6, 0) cmds.rotate(0, 0, 0) cmds.setKeyframe(time=20) cmds.move(0, 3, 0) cmds.scale(3, 3, 3) cmds.setKeyframe(time=10) cmds.move(0, 0, 0) cmds.scale(1, .8, 1) cmds.setKeyframe(time=1)
def _createCalfArmor(self, name, side): p1 = mc.polySphere(r=10)[0] mc.scale(.35, 1.5, .75) mc.move(5, 0, 0) p2 = mc.polySphere(r=10)[0] mc.scale(.35, 1.5, .75) mc.move(-5, 0, 0) p3 = mc.polyCylinder(r=10, sx=40)[0] mc.rotate(0, 0, '90deg') mc.scale(1.5, 5, .75) #claf1 = mc.polyUnite(p1,p2,p3) #print calf1 #calf1 = mc.polyBoolOp(p1, p3, op=1, n='calf')[0] #calf2 = mc.polyBoolOp(calf1, p2, op=1, n='calf')[0] p4 = mc.polyCube(w=10, h=10, d=10)[0] mc.move(0, 10, -5) p5 = mc.polyCube(w=10, h=10, d=10)[0] mc.move(0, 10, -5) p6 = mc.polyCube(w=10, h=10, d=10)[0] mc.move(0, 10, -5) c1 = mc.polyBoolOp(p1, p4, op=2)[0] c2 = mc.polyBoolOp(p2, p5, op=2)[0] c3 = mc.polyBoolOp(p3, p6, op=2)[0] claf1 = mc.polyUnite(c1, c2, c3) mc.sets(e=True, forceElement=self.color1) mc.move(0, 45, -10) self.tibia = mc.polyUnite(self.tibia, claf1) t1 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=10, d=10, n='thigh')[0] t1r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] mc.scale(1, 5, 1) mc.move(0, 75, -12, r=True) t3 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='thight_armor')[0] mc.sets(e=True, forceElement=self.color1) t3r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] mc.scale(1.75, 3, 1.4) mc.move(0, 90, -9, r=True) self.femur = mc.polyUnite(self.femur, t1, t3) pass
def main(bubbleQuantity, allAtts): for i in range(bubbleQuantity): # create 50 bubbles name = 'bubble' + str(i) # name them sequentially """ first -- a random integer between 1 and 50 which represents the keyframe in which a bubble is generated """ first = random.randint(1,300) last = first + 66 # all bubbles take 66 keyframes to rise x = 10 - random.random()*20 # this makes x values in the range [-10.0,10.0] z = 10 - random.random()*20 # this makes z values in the range [-10.0,10.0] createBubble(x,z,name) cmds.currentTime(first) cmds.setKeyframe( name, v=1, at='visibility' ) cmds.setKeyframe(name) cmds.currentTime(last) ############ keyframe all attributes ############ if allAtts: cmds.scale(10,10,10, name) cmds.move(0, 20, 0, name, relative=True) cmds.setKeyframe() ################################################# ####### keyframe only necessary attributes ###### else: cmds.setKeyframe( name, v=10, at='scaleX' ) cmds.setKeyframe( name, v=10, at='scaleY' ) cmds.setKeyframe( name, v=10, at='scaleZ' ) cmds.setKeyframe( name, v=10, at='translateY' ) ################################################# cmds.currentTime(last + 1) cmds.setKeyframe( name, v=0, at='visibility' ) cmds.currentTime(1)
def _scaleItem(self, item): bbox = cmds.exactWorldBoundingBox(item) currentX = bbox[3] - bbox[0] currentY = bbox[4] - bbox[1] currentZ = bbox[5] - bbox[2] scale = float('inf') if self.x is not None: scale = min(scale, float(self.x)/float(currentX)) if self.y is not None: scale = min(scale, float(self.y)/float(currentY)) if self.z is not None: scale = min(scale, float(self.z)/float(currentZ)) if not self.grow: scale = min(scale, 1.0) if scale == 1.0: return None cmds.scale(scale, scale, scale, item, relative=True) return scale
def _scaleItem(self, item): bbox = cmds.exactWorldBoundingBox(item) currentX = bbox[3] - bbox[0] currentY = bbox[4] - bbox[1] currentZ = bbox[5] - bbox[2] scale = float('inf') if self.x is not None: scale = min(scale, float(self.x) / float(currentX)) if self.y is not None: scale = min(scale, float(self.y) / float(currentY)) if self.z is not None: scale = min(scale, float(self.z) / float(currentZ)) if not self.grow: scale = min(scale, 1.0) if scale == 1.0: return None cmds.scale(scale, scale, scale, item, relative=True) return scale
def _createGeometry(self, segmentLength, offset): voff = 9.25 mc.select(cl=True) #section 1 construction self.r_hand_p_n_1 = mc.polySphere(r=1.2, n="_n_1") mc.move(offset, voff + 0, -.5) self.r_hand_p_b_1 = mc.polyCylinder(r=.75, h=3, n="_b_1") mc.move(offset, voff + 2, -.5) self.r_hand_p_p_1 = mc.polyCube(sx=2, sy=2, sz=2, h=segmentLength, w=2, d=2) mc.move(offset, voff + 2.25 + self.segOffset, -.5) self.r_hand_p_n_2_a = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='_n_2_a') mc.move(offset + .7, voff + 3.75 + (2 * self.segOffset), -.5) #1.875 + .35 self.r_hand_p_n_2_b = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='_n_2_b') mc.move(offset - .7, voff + 3.75 + (2 * self.segOffset), -.5) #1.875 -.35 #section 1 unite self.r_hand_p_s_1 = mc.polyUnite(self.r_hand_p_n_1, self.r_hand_p_b_1, self.r_hand_p_p_1, self.r_hand_p_n_2_a, self.r_hand_p_n_2_b, n='r_hand_p_s_1')[0] mc.move(offset, voff + 0, -.5, self.r_hand_p_s_1 + ".scalePivot", self.r_hand_p_s_1 + ".rotatePivot") #section 2 construction self.r_hand_p_n_2_c = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='r_hand_p_n_2_c') mc.move(offset, voff + 3.75 + (2 * self.segOffset), -.5) self.r_hand_p_p_2 = mc.polyCube(sx=2, sy=2, sz=2, h=segmentLength, w=2, d=2) mc.move(offset, voff + 5.25 + (3 * self.segOffset), -.5) self.r_hand_p_n_3_a = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='r_hand_p_n_3_a') mc.move(offset + .7, voff + 6.75 + (4 * self.segOffset), -.5) #1.875 + .35 self.r_hand_p_n_3_b = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='r_hand_p_n_3_b') mc.move(offset - .7, voff + 6.75 + (4 * self.segOffset), -.5) #1.875 -.35 #section 2 unite self.r_hand_p_s_2 = mc.polyUnite(self.r_hand_p_n_2_c, self.r_hand_p_p_2, self.r_hand_p_n_3_a, self.r_hand_p_n_3_b, n='r_hand_p_s_2')[0] mc.move(offset, voff + 3.75 + (2 * self.segOffset), -.5, self.r_hand_p_s_2 + ".scalePivot", self.r_hand_p_s_2 + ".rotatePivot") #section 3 construction self.r_hand_p_n_3_c = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='r_hand_p_n_3_c')[0] mc.move(offset, voff + 6.75 + (4 * self.segOffset), -.5) self.r_hand_p_p_3 = mc.polyCube(sx=2, sy=2, sz=2, h=segmentLength, w=2, d=2)[0] mc.move(offset, voff + 8.25 + (5 * self.segOffset), -.5) mc.select(self.r_hand_p_p_3 + '.f[4:7]') #f[5] on a one segment mc.scale(.8, 1, .75) #section 3 unite self.r_hand_p_s_3 = mc.polyUnite(self.r_hand_p_n_3_c, self.r_hand_p_p_3, n='r_hand_p_s_3')[0] mc.move(offset, voff + 6.75 + (4 * self.segOffset), -.5, self.r_hand_p_s_3 + ".scalePivot", self.r_hand_p_s_3 + ".rotatePivot")
def createTrackNode(cls, uid, trackSetNode =None, props =None): """ A track node consists of a triangular pointer (left = red, right = green) which is selectable but only allows rotateY, translateX, and translateZ. The node has a child, a transform called inverter, which serves to counteract the scaling in x and z that is applied to the triangular node. There are two orthogonal rulers (width and length). Width and length uncertainty is represented by rectangular bars at the ends of the rulers. In Maya one can directly adjust track position (translateX and translateZ) and orientation (rotationY); other attributes are adjusted only through the UI. """ if not trackSetNode: trackSetNode = TrackSceneUtils.getTrackSetNode() if not trackSetNode: return None node = cls.getTrackNode(uid, trackSetNode=trackSetNode) if node: return node # Set up dimensional constants for the track node nodeThickness = 1.0 thetaBreadth = 0.1 thetaThickness = 0.5 barBreadth = 2.0 barThickness = 0.5 rulerBreadth = 1.0 rulerThickness = 0.25 epsilon = 1.0 # Create an isoceles triangle pointer, with base aligned with X, and # scaled by node.width. The midpoint of the base is centered on the # 'track center' and the altitude extends from that center of the track # 'anteriorly' to the perimeter of the track's profile (if present, else # estimated). The node is scaled longitudinally (in z) based on the # distance zN (the 'anterior' length of the track, in cm). The triangle # is initially 1 cm on a side. sideLength = 1.0 node = cmds.polyPrism( length=nodeThickness, sideLength=sideLength, numberOfSides=3, subdivisionsHeight=1, subdivisionsCaps=0, axis=(0, 1, 0), createUVs=0, constructionHistory=0, name='Track0')[0] # Point the triangle down the +Z axis cmds.rotate(0.0, -90.0, 0.0) # push it down below ground level so that the two rulers are just # submerged, and scale the triangle in Z to match its width (1 cm) so it # is ready to be scaled cmds.move(0, -(nodeThickness/2.0 + rulerThickness), math.sqrt(3.0)/6.0) # move the node's pivot to the 'base' of the triangle so it scales # outward from that point cmds.move( 0, 0, 0, node + ".scalePivot", node + ".rotatePivot", absolute=True) cmds.scale(2.0/math.sqrt(3.0), 1.0, 100.0) cmds.makeIdentity( apply=True, translate=True, rotate=True, scale=True, normal=False) # Set up the cadence attributes cmds.addAttr( longName='cadence_width', shortName=TrackPropEnum.WIDTH.maya, niceName='Width') cmds.addAttr( longName='cadence_widthUncertainty', shortName=TrackPropEnum.WIDTH_UNCERTAINTY.maya, niceName='Width Uncertainty') cmds.addAttr( longName='cadence_length', shortName=TrackPropEnum.LENGTH.maya, niceName='Length') cmds.addAttr( longName='cadence_lengthUncertainty', shortName=TrackPropEnum.LENGTH_UNCERTAINTY.maya, niceName='Length Uncertainty') cmds.addAttr( longName='cadence_lengthRatio', shortName=TrackPropEnum.LENGTH_RATIO.maya, niceName='Length Ratio') cmds.addAttr( longName='cadence_rotationUncertainty', shortName=TrackPropEnum.ROTATION_UNCERTAINTY.maya, niceName='Rotation Uncertainty') cmds.addAttr( longName='cadence_uniqueId', shortName=TrackPropEnum.UID.maya, dataType='string', niceName='Unique ID') # Construct a ruler representing track width, then push it down just # below ground level, and ake it non-selectable. Drive its scale by the # node's width attribute. widthRuler = cmds.polyCube( axis=(0, 1, 0), width=100.0, height=rulerThickness, depth=rulerBreadth, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='WidthRuler')[0] # Push it down to just rest on the triangular node (which is already # submerged by the thickness of the ruler and half the node thickness. cmds.move(0.0, -rulerThickness/2.0, 0.0) cmds.setAttr(widthRuler + '.overrideEnabled', 1) cmds.setAttr(widthRuler + '.overrideDisplayType', 2) # Construct a ruler representing track length and push it down the same # as the width ruler, and make it non-selectable. Its length will be # driven by the node's length attribute. lengthRuler = cmds.polyCube( axis=(0, 1, 0), width=rulerBreadth, height=rulerThickness, depth=100.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='LengthRuler')[0] cmds.move(0.0, -rulerThickness/2.0, 0.0) cmds.setAttr(lengthRuler + '.overrideEnabled', 1) cmds.setAttr(lengthRuler + '.overrideDisplayType', 2) # Now construct 'error bars' to the North, South, West, and East of the # node, to visualize uncertainty in width (West and East bars) and # length (North and South bars), and push them just below ground level, # and make them non-selectable. barN = cmds.polyCube( axis=(0,1,0), width=barBreadth, height=barThickness, depth=100.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='BarN')[0] cmds.move(0, -(barThickness/2 + rulerThickness), 0) cmds.setAttr(barN + '.overrideEnabled', 1) cmds.setAttr(barN + '.overrideDisplayType', 2) barS = cmds.polyCube( axis=(0, 1, 0), width=barBreadth, height=barThickness, depth=100.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='BarS')[0] cmds.move(0, -(barThickness/2 + rulerThickness), 0) cmds.setAttr(barS + '.overrideEnabled', 1) cmds.setAttr(barS + '.overrideDisplayType', 2) barW = cmds.polyCube( axis=(0, 1, 0), width=100.0, height=barThickness, depth=barBreadth, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='BarW')[0] cmds.move(0, -(barThickness/2 + rulerThickness), 0) cmds.setAttr(barW + '.overrideEnabled', 1) cmds.setAttr(barW + '.overrideDisplayType', 2) barE = cmds.polyCube( axis=(0, 1, 0), width=100.0, height=barThickness, depth=barBreadth, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='BarE')[0] cmds.move(0, -(barThickness/2 + rulerThickness), 0) cmds.setAttr(barE + '.overrideEnabled', 1) cmds.setAttr(barE + '.overrideDisplayType', 2) # Create two diverging lines that indicate rotation uncertainty (plus # and minus), with their pivots placed so they extend from the node # center, and each is made non-selectable. First make the indicator of # maximum (counterclockwise) estimated track rotation thetaPlus = cmds.polyCube( axis=(0, 1, 0), width=thetaBreadth, height=thetaThickness, depth=1.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='ThetaPlus')[0] cmds.setAttr(thetaPlus + '.overrideEnabled', 1) cmds.setAttr(thetaPlus + '.overrideDisplayType', 2) # Next, construct the indicator of the minimum (clockwise) estimate of # track rotation thetaMinus = cmds.polyCube( axis=(0, 1, 0), width=thetaBreadth, height=thetaThickness, depth=1.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='ThetaMinus')[0] cmds.setAttr(thetaMinus + '.overrideEnabled', 1) cmds.setAttr(thetaMinus + '.overrideDisplayType', 2) # The two width 'error bars' will be translated outward from the node # center. First, the width attribute is converted from meters (as it # comes from the database) to centimeters; the computation is available # in the output of the node 'width'. width = cmds.createNode('multiplyDivide', name='width') cmds.setAttr(width + '.operation', 1) cmds.setAttr(width + '.input1X', 100.0) cmds.connectAttr( node + '.' + TrackPropEnum.WIDTH.maya, width + '.input2X') # Translate barW in x by width/2.0; output is in xW.outputX xW = cmds.createNode('multiplyDivide', name = 'xW') cmds.setAttr(xW + '.operation', 2) cmds.connectAttr(width + '.outputX', xW + '.input1X') cmds.setAttr(xW + '.input2X', 2.0) cmds.connectAttr(xW + '.outputX', barW + '.translateX') # Translate barE in x by -width/2.0; output is in xE.outputX xE = cmds.createNode('multiplyDivide', name = 'xE') cmds.setAttr(xE + '.operation', 2) # division operation cmds.connectAttr(width + '.outputX', xE + '.input1X') cmds.setAttr(xE + '.input2X', -2.0) cmds.connectAttr(xE + '.outputX', barE + '.translateX') # Now regarding length, first convert the node.length attribute from # meters to centimeters. This computation is available in the output of # the node 'length' length = cmds.createNode('multiplyDivide', name='length') cmds.setAttr(length + '.operation', 1) cmds.setAttr(length + '.input1X', 100.0) cmds.connectAttr( node + '.' + TrackPropEnum.LENGTH.maya, length + '.input2X') # scale thetaPlus and thetaMinus by length (since they are 1 cm, # multiply by length in cm) cmds.connectAttr(length + '.outputX', thetaPlus + '.scaleZ') cmds.connectAttr(length + '.outputX', thetaMinus + '.scaleZ') # Then barN is translated forward in z by zN = lengthRatio*length # (centimeters) zN = cmds.createNode('multiplyDivide', name='zN') cmds.setAttr(zN + '.operation', 1) cmds.connectAttr( node + '.' + TrackPropEnum.LENGTH_RATIO.maya, zN + '.input1X') cmds.connectAttr(length + '.outputX', zN + '.input2X') cmds.connectAttr(zN + '.outputX', barN + '.translateZ') # Next, translate barS backward in z by (zN - length); output is in # zS.output1D zS = cmds.createNode('plusMinusAverage', name='sZ') cmds.setAttr(zS + '.operation', 2) cmds.connectAttr(zN + '.outputX', zS + '.input1D[0]') cmds.connectAttr(length + '.outputX', zS + '.input1D[1]') cmds.connectAttr(zS + '.output1D', barS + '.translateZ') # Next, compute the half length, hl = length/2.0 (centimeters) hl = cmds.createNode('multiplyDivide', name='hl') cmds.setAttr(hl + '.operation', 2) cmds.connectAttr(length + '.outputX', hl + '.input1X') cmds.setAttr(hl + '.input2X', 2.0) # Translate lengthRuler along z by zL = (zN - hl) (centimeters) zL = cmds.createNode('plusMinusAverage', name='zL') cmds.setAttr(zL + '.operation', 2) cmds.connectAttr(zN + '.outputX', zL + '.input1D[0]') cmds.connectAttr(hl + '.outputX', zL + '.input1D[1]') cmds.connectAttr(zL + '.output1D', lengthRuler + '.translateZ') # Scale the four 'error bars' to represent the width and length # uncertainties (centimeters) cmds.connectAttr( node + "." + TrackPropEnum.WIDTH_UNCERTAINTY.maya, barW + '.scaleX') cmds.connectAttr( node + "." + TrackPropEnum.WIDTH_UNCERTAINTY.maya, barE + '.scaleX') cmds.connectAttr( node + "." + TrackPropEnum.LENGTH_UNCERTAINTY.maya, barN + '.scaleZ') cmds.connectAttr( node + "." + TrackPropEnum.LENGTH_UNCERTAINTY.maya, barS + '.scaleZ') # Create an 'inverter' transform under which all the other parts are # hung as children, which counteracts scaling applied to its parent # triangular node. inverter = cmds.createNode('transform', name='inverter') # drive the inverter's .scaleX and .scaleZ as the inverse of the parent # node's scale values sx = cmds.createNode('multiplyDivide', name='sx') cmds.setAttr(sx + '.operation', 2) cmds.setAttr(sx + '.input1X', 1.0) cmds.connectAttr(node + '.scaleX', sx + '.input2X') cmds.connectAttr(sx + '.outputX', inverter + '.scaleX') sz = cmds.createNode('multiplyDivide', name='sz') cmds.setAttr(sz + '.operation', 2) cmds.setAttr(sz + '.input1X', 1.0) cmds.connectAttr(node + '.scaleZ', sz + '.input2X') cmds.connectAttr(sz + '.outputX', inverter + '.scaleZ') # Assemble the parts as children under the scale inverter node cmds.parent(lengthRuler, inverter) cmds.parent(widthRuler, inverter) cmds.parent(barN, inverter) cmds.parent(barS, inverter) cmds.parent(barW, inverter) cmds.parent(barE, inverter) cmds.parent(thetaPlus, inverter) cmds.parent(thetaMinus, inverter) cmds.parent(inverter, node) # Rotate thetaPlus and thetaMinus about the Y axis to indicate # rotational uncertainty cmds.connectAttr( node + '.' + TrackPropEnum.ROTATION_UNCERTAINTY.maya, node + '|' + inverter + '|' + thetaPlus + '.rotateY') neg = cmds.createNode('multiplyDivide', name='negative') cmds.setAttr(neg + '.operation', 1) cmds.setAttr(neg + '.input1X', -1.0) cmds.connectAttr( node + '.' + TrackPropEnum.ROTATION_UNCERTAINTY.maya, neg + '.input2X') cmds.connectAttr( neg + '.outputX', node + '|' + inverter + '|' + thetaMinus + '.rotateY') # Disable some transforms of the node cmds.setAttr(node + '.rotateX', lock=True) cmds.setAttr(node + '.rotateZ', lock=True) cmds.setAttr(node + '.scaleY', lock=True) cmds.setAttr(node + '.translateY', lock=True) # Now, the width of the triangle will be driven by its width attribute # (driving .scaleX) cmds.connectAttr(node + '.width', node + '.scaleX') # The quantity zN is used to scale length of the triangle cmds.connectAttr(zN + '.outputX', node + '.scaleZ') # Scale the 'length' (in x) of the width ruler cmds.connectAttr( node + '.width', node + '|' + inverter + '|WidthRuler.scaleX') # Scale the length of the length ruler cmds.connectAttr( node + '.length', node + '|' + inverter + '|LengthRuler.scaleZ') # Translate the track node epsilon below ground level (to reveal the # overlaid track siteMap) cmds.move(0, -epsilon, 0, node) # Initialize all the properties from the dictionary if props: cls.setTrackProps(node, props) else: print('in createTrackNode: properties not provided') return node # Add the new nodeName to the Cadence track scene set, color it, and # we're done cmds.sets(node, add=trackSetNode) cls.colorTrackNode(node, props) return node
def doFourth(): filePath4 = "C:/Users/Kyle/Downloads/tie fighter.mb" 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.file(filePath4, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='tie fighter', i=True ) cmds.file(filePath4, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='tie fighter', i=True ) cmds.file(filePath4, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='tie fighter', i=True ) cmds.select('x_wing:polySurface3') cmds.scale(.15,.15,.15) cmds.move(0,4,15) cmds.setKeyframe(time=1) cmds.move(0,4,11.7) cmds.rotate(0,-18.6,0) cmds.setKeyframe(time=30) cmds.move(6.667, 4.803,7.37) cmds.rotate(0,36,0) cmds.setKeyframe(time=60) cmds.move(-2.127, 6.86,-5.277) cmds.rotate(26.244,36,0) cmds.setKeyframe(time=120) cmds.select('tie_fighter:Tie_Droid:polySurface9') cmds.move(2,6,5) cmds.rotate(0,180,0) cmds.setKeyframe(time=1) cmds.move(5,6,1.415) cmds.rotate(0,156.849,0) cmds.setKeyframe(time=30) cmds.move(2.309,8.410,-1.272) cmds.rotate(0,214,0) cmds.setKeyframe(time=60) cmds.move(-7.6,8.410,-15.8) cmds.rotate(15,211,-27) cmds.setKeyframe(time=120) cmds.select('tie_fighter1:Tie_Droid:polySurface9') cmds.move(0,4,5) cmds.rotate(0,180,0) cmds.setKeyframe(time=1) cmds.move(3.6,4,1.49) cmds.rotate(0,153.924,0) cmds.setKeyframe(time=30) cmds.move(.64,6.118,-.19) cmds.rotate(0,212.91,0) cmds.setKeyframe(time=60) cmds.move(-9.9,6.118,-14.19) cmds.rotate(14.932,209.673,-28.310) cmds.setKeyframe(time=120) cmds.select('tie_fighter2:Tie_Droid:polySurface9') cmds.move(4,4,5) cmds.rotate(0,180,0) cmds.setKeyframe(time=1) cmds.move(7.45,4,1) cmds.rotate(0,159.3,0) cmds.setKeyframe(time=30) cmds.move(4,5.92,-2.743) cmds.rotate(0,222.231,0) cmds.setKeyframe(time=60) cmds.move(-6.65,5.92,-17.742) cmds.rotate(8,219,-19.8) cmds.setKeyframe(time=120)
import nimble from nimble import cmds kwargs = nimble.getRemoteKwargs(globals()) result = cmds.polySphere() name = result[0] offset = kwargs.get('offset', 10) cmds.move(offset, offset, offset, name) cmds.rotate(50, 20, 10, name) cmds.scale(2, 2, 2, name) response = nimble.createRemoteResponse(globals()) response.put('name', name) response.put('offset', offset)
from __future__ import print_function, absolute_import, unicode_literals, division import nimble from nimble import cmds kwargs = nimble.getRemoteKwargs(globals()) result = cmds.polySphere() name = result[0] offset = kwargs.get('offset', 10) cmds.move(offset, offset, offset, name) cmds.rotate(50, 20, 10, name) cmds.scale(2, 2, 2, name) response = nimble.createRemoteResponse(globals()) response.put('name', name) response.put('offset', offset)
def scale(self, ratio): mc.select(self.j_root) mc.scale(ratio, ratio, ratio, r=True) #Skeleton('artemie')
def create_bubbles(): size = rand(0.01, 0.04) cmds.scale(0.1, 0.3, 0.1) cmds.move(0, 0.4, 0) cube = cmds.polyCube(w=5, d=5, h=4) cmds.move(0, 1.5, 0) cmds.sets(renderable=True, noSurfaceShader=True, empty=True, name='ph' + 'SG') myShader = cmds.shadingNode('phongE', asShader=True, name='ph') #cmds.shadingNode('lambert', name= 'ph', asShader= True) cmds.setAttr(myShader + '.color', 0, 1, 1, type='double3') cmds.setAttr(myShader + '.transparency', 1, 0.6, 0.6, type='double3') cmds.select(cube) cmds.hyperShade(assign=myShader) #cmds.displaySurface(xRay=True) #cmds.connectAttr('ph'+'.outColor', 'ph'+'SG.surfaceShader') #cmds.sets(cube, edit=True, forceElement='ph'+'SG') #cmds.move (0, 2, 0) for i in range(20): # set playback range cmds.playbackOptions(minTime=i + rand(1, 4), maxTime='72') bubble = cmds.polySphere(name='bubble' + str(i), radius=rand(0.2, 0.4)) # create a sphere cmds.move(rand(-2, 2), rand(-2, 2), rand(-2, 2)) cmds.select('bubble' + str(i)) cmds.lattice(dv=(5, 6, 5), oc=True) cmds.select('ffd' + str(i + 1) + 'Lattice.pt[0:3][0:1][2]', 'ffd' + str(i + 1) + 'Lattice.pt[4][1][2]', 'ffd' + str(i + 1) + 'Lattice.pt[0:4][2:5][2]', r=True) cmds.scale(0.33, 0.33, 0.33, relative=True) cmds.select('ffd' + str(i + 1) + 'Lattice.pt[0][1][3]', 'ffd' + str(i + 1) + 'Lattice.pt[2][3][4]', r=True) cmds.move(0, 0, -0.05, relative=True) cmds.select('ffd' + str(i + 1) + 'Lattice.pt[2][3][0]') cmds.move(0, 0, 0.8, relative=True) #cmds.select('bubble'+str(i)) for time in [1, 15, 30, 45, 60, 72]: # for each frame calculate sub-steps #mc.setKeyframe( bubble, attribute='translateX', value=px, t=f ) # set keyframes cmds.setKeyframe(bubble, attribute='translateY', value=0.002 * time * i, t=time) cmds.setKeyframe(bubble, attribute='scaleX', value=size + 0.001 * time * i, t=time) cmds.setKeyframe(bubble, attribute='scaleY', value=size + 0.001 * time * i, t=time) cmds.setKeyframe(bubble, attribute='scaleZ', value=size + 0.001 * time * i, t=time)
def scale(self, ratio): mc.select(self.j_root) mc.scale(ratio, ratio, ratio, r=True) #Gundam('strike')
def drawBubble(radius, xpoint, ypoint, zpoint, name, time): """ Arguments: radius is the size of the overall shape Return: None """ y = (0, 1, 0) c = cmds.polySphere(r=radius, ax=y, cuv=2, ch=1, n=name)[0] cmds.setAttr("lambert1.transparency", 0.470085, 0.470085, 0.470085, type="double3") cmds.setAttr("lambert1.color", 0.01, 0.1, 0.470085, type="double3") rate = float(random.randrange(1, 8)) / 16 print rate i = 1 positive = True positivez = True if (xpoint < 0): positive = False if (zpoint < 0): positivez = False radius_long = radius while ypoint <= 19.9: # figure out best time step cmds.setKeyframe(name, t=i) radius_long = radius * (1 + rate) cmds.scale(1, 1, radius_long) cmds.move(xpoint, ypoint, zpoint, relative=False) cmds.select(name) response = nimble.createRemoteResponse(globals()) response.put('name', name) if (xpoint - rate < -13): xpoint += rate positive = True elif (xpoint + rate > 13): xpoint -= rate positive = False else: if (positive == True): xpoint += rate else: xpoint -= rate if (zpoint - rate < -13): zpoint += rate positivez = True elif (zpoint + rate > 13): zpoint -= rate positivez = False else: if (positivez == True): zpoint += rate else: zpoint -= rate if ypoint > 20 - radius: #ypoint = 20 print("pop") break else: ypoint = (rate + float(ypoint)) i += 3 #cmds.setKeyframe( name , at="translateY", t=time, v=xpoint + 3) return None
def _createGeometry(self, name, side): #create radius self.radius = mc.polyCube(sx=1, sy=1, sz=1, w=2, h=40, d=2, n=name + '_radius')[0] mc.move(0, 20, 0) self.elbow = mc.polyCylinder(h=5, r=2, n=name + '_elbow')[0] mc.move(0, 41, 0, r=True) mc.rotate(0, 0, '90deg') self.radius = mc.polyUnite(self.radius, self.elbow, n=name + '_radius')[0] mc.move(0, 41, 0, self.radius + ".scalePivot", self.radius + ".rotatePivot") #create humerus self.humerus = mc.polyCube(sx=1, sy=1, sz=1, w=3, h=40, d=3, n=name + '_humerus')[0] mc.move(0, 62, 0) self.shoulder = mc.polySphere(r=5, n=name + '_shoulder') mc.move(0, 84, 0) self.humerus = mc.polyUnite(self.humerus, self.shoulder, n=name + '_humerus')[0] mc.move(0, 84, 0, self.humerus + ".scalePivot", self.humerus + ".rotatePivot") pass ######### shoulders ############ t1 = mc.polyCube(sx=3, sy=3, sz=3, w=15, h=15, d=15, n='l_shoulder')[0] mc.sets(e=True, forceElement=self.color4) t1r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] #mc.scale(1,5,1) mc.move(self.sideMult * 5, 90, 0, r=True) t2 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='r_shoulder')[0] mc.sets(e=True, forceElement=self.color4) t2r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] mc.scale(1, 2.5, 1) mc.move(0, 63, 0, r=True) t3 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='r_shoulder')[0] mc.sets(e=True, forceElement=self.color1) t3r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] mc.scale(1.2, 2.25, 1) mc.move(0, 63, -1, r=True) t4 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='r_shoulder')[0] mc.sets(e=True, forceElement=self.color4) t4r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] mc.scale(1, 2.5, 1) mc.move(0, 20, 0, r=True) t5 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='r_shoulder')[0] mc.sets(e=True, forceElement=self.color1) t5r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] mc.scale(1.2, 2.25, 1.0) mc.move(0, 20, -1, r=True) self.elbowArmor = mc.polyCube(sx=3, sy=3, sz=3, w=8, h=15, d=9, n='r_shoulder')[0] mc.sets(e=True, forceElement=self.color1) t5r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] mc.move(0, 41, -1, r=True) self.humerus = mc.polyUnite(self.humerus, t1, t2, t3) self.radius = mc.polyUnite(self.radius, t4, t5)
def doThird(): filePath3 = "C:/Users/Kyle/Downloads/hangar2.mb" filePath4 = "C:/Users/Kyle/Downloads/tie fighter.mb" cmds.file(filePath3, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='hangar2', i=True) cmds.select('hangar2:pCube2') cmds.move(0, 2.872, 0) cmds.setKeyframe(time=1) cmds.file(filePath4, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='tie fighter', i=True) cmds.select('tie_fighter:Tie_Droid:polySurface9') cmds.scale(.25, .25, .25) cmds.move(.8, 5.6, 0) cmds.setKeyframe(time=1) cmds.move(.8, 5.6, 0) cmds.setKeyframe(time=15) cmds.move(.8, 5.6, 0) cmds.setKeyframe(time=30) cmds.move(.8, 3.759, 0) cmds.setKeyframe(time=45) cmds.rotate(0, 40, 0) cmds.setKeyframe(time=65) cmds.move(4.765, 3.759, 3.545) cmds.setKeyframe(time=90) cmds.move(13.514, 3.759, 12.571) cmds.setKeyframe(time=120) cmds.file(filePath4, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='tie fighter1', i=True) cmds.select('tie_fighter1:Tie_Droid:polySurface9') cmds.scale(.25, .25, .25) cmds.move(-.2, 5.6, 0) cmds.setKeyframe(time=1) cmds.setKeyframe(time=15) cmds.move(-.2, 4.377, 0) cmds.setKeyframe(time=30) cmds.setKeyframe(time=45) time.sleep(1) cmds.rotate(0, 40, 0) time.sleep(1) cmds.setKeyframe(time=65) cmds.move(3.765, 4.377, 3.545) cmds.setKeyframe(time=90) cmds.move(12.514, 4.377, 12.571) cmds.setKeyframe(time=120) time.sleep(1) cmds.file(filePath4, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='tie fighter2', i=True) cmds.select('tie_fighter2:Tie_Droid:polySurface9') cmds.scale(.25, .25, .25) cmds.move(-1.2, 5.6, 0) cmds.setKeyframe(time=1) cmds.move(-1.2, 3.729, 0) cmds.setKeyframe(time=15) cmds.setKeyframe(time=30) cmds.setKeyframe(time=45) time.sleep(1) cmds.rotate(0, 40, 0) time.sleep(1) cmds.setKeyframe(time=65) cmds.move(2.765, 3.729, 3.545) cmds.setKeyframe(time=90) cmds.move(11.514, 3.729, 12.571) cmds.setKeyframe(time=120) time.sleep(1)
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] self.toeBox = mc.polyCube(w=8, h=4, d=3, n=name + '_toeBox')[0] mc.sets(e=True, forceElement=self.color1) mc.move(0, .9, 0, r=True) #e1 mc.select(self.toeBox + '.e[1]') mc.move(0, -1, 0, r=True) self.toeBoxBase = mc.polyCube(w=8, h=4, d=3, n=name + '_toeBoxBase')[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .9, 1, r=True) #e1 mc.select(self.toeBoxBase + '.e[2]') mc.move(0, -2, 0, r=True) mc.select(self.toeBoxBase + '.e[1]') mc.move(0, -1, 0, r=True) mc.select(self.toeBoxBase + '.f[2]') mc.scale(1.25, 1, 1) mc.move(0, 0, -1, r=True) self.toeToeBox = mc.polyCube(w=8, h=3, d=3, n=name + '_toeToeBox')[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .4, 4, r=True) #f0 mc.select(self.toeToeBox + '.f[0]') mc.scale(.75, .75, 1) mc.move(0, 0, -2, self.toe + ".scalePivot", self.toe + ".rotatePivot") self.toe = mc.polyUnite(self.toe, self.toeBox) self.toe = mc.polyUnite(self.toe, self.toeToeBox) self.toe = mc.polyUnite(self.toe, self.toeBoxBase, n=name + '_toe') #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] self.archArmor = mc.polyCube(w=8, h=4, d=8)[0] mc.sets(e=True, forceElement=self.color1) mc.move(0, .9, -6, r=True) self.archArmor2 = mc.polyCube(w=8, h=4, d=8)[0] mc.sets(e=True, forceElement=self.color1) mc.move(0, 4.9, -6, r=True) mc.select(self.archArmor2 + '.e[1]') mc.move(0, -3.75, 0, r=True) mc.select(self.archArmor2 + '.e[2]') #mc.move(0,-.5,0,r=True) mc.scale(.5, 1, 1) self.archArmor3 = mc.polyCube(w=8, h=4, d=8)[0] mc.sets(e=True, forceElement=self.color1) mc.move(0, 4.9, -8.5, r=True) mc.select(self.archArmor3 + '.e[1]') mc.move(0, 0, -4, r=True) mc.scale(.5, 1, 1) mc.select(self.archArmor3 + '.e[2]') #mc.move(0,-.5,0,r=True) mc.scale(.5, 1, 1) self.archArmorBase = mc.polyCube(w=8, h=4, d=8)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .9, -6, r=True) mc.select(self.archArmorBase + '.f[0]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase + '.f[2]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase + '.e[1]') mc.move(0, -2, 0, r=True) mc.select(self.archArmorBase + '.e[2]') mc.move(0, -.5, 0, r=True) self.archArmorBase2 = mc.polyCube(w=8, h=4, d=4)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .9, -12, r=True) mc.select(self.archArmorBase2 + '.f[0]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase2 + '.f[2]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase2 + '.e[3]') mc.move(0, 1, 1.75, r=True) mc.select(self.archArmorBase2 + '.e[1]') mc.move(0, -.5, 0, r=True) self.archArmorBase3 = mc.polyCube(w=8, h=4, d=4)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, 4.9, -12, r=True) mc.select(self.archArmorBase3 + '.f[0]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase3 + '.f[2]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase3 + '.f[1]') mc.scale(.5, 1, 1) mc.move(0, -1, 0, r=True) mc.select(self.archArmorBase3 + '.e[0]') mc.move(0, -.5, 0, r=True) mc.select(self.archArmorBase3 + '.e[1]') mc.move(0, 0, -2.5, r=True) mc.select(self.archArmorBase3 + '.e[2]') mc.move(0, 0, -1.5, r=True) self.archArmorBase4 = mc.polyCube(w=8, h=4, d=4)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, 4.9, -15.5, r=True) mc.select(self.archArmorBase4 + '.f[0]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase4 + '.f[2]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase4 + '.f[1]') mc.scale(.5, 1, 1) mc.move(0, -2, 0, r=True) mc.select(self.archArmorBase4 + '.f[3]') mc.scale(1, 1, 1.25) mc.select(self.archArmorBase4 + '.e[0]') mc.move(0, -3, .5, r=True) mc.select(self.archArmorBase4 + '.e[1]') mc.move(0, 0, -2, r=True) mc.select(self.archArmorBase4 + '.e[2]') mc.move(0, 0, 1, r=True) mc.select(self.archArmorBase4 + '.e[3]') mc.move(0, -2, -.75, r=True) mc.scale(.75, 1, 1) self.archArmorBase5 = mc.polyCube(w=8, h=4, d=5)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .9, -15.6, r=True) mc.select(self.archArmorBase5 + '.f[1]') mc.move(0, -3, 0, r=True) mc.scale(1.25, 1, 1.25) mc.select(self.archArmorBase5 + '.f[2]') mc.scale(.75, 1, 1) #mc.select(self.archArmorBase5+'.e[3]') #mc.move(0,1,0,r=True) mc.select(self.archArmorBase5 + '.e[2]') mc.move(0, 1, 0, r=True) self.arch = mc.polyUnite(self.arch, self.archArmor) self.arch = mc.polyUnite(self.arch, self.archArmor2) self.arch = mc.polyUnite(self.arch, self.archArmor3) self.arch = mc.polyUnite(self.arch, self.archArmorBase2) self.arch = mc.polyUnite(self.arch, self.archArmorBase3) self.arch = mc.polyUnite(self.arch, self.archArmorBase4) self.arch = mc.polyUnite(self.arch, self.archArmorBase5) self.arch = mc.polyUnite(self.arch, self.archArmorBase, 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 _createGeometry(self, side): mc.select(cl=True) self.n_t = mc.polySphere(r=1.2, n="n_t") mc.move(self.sideModifyer * 4.5, 2, 1.5) self.b_1 = mc.polyCylinder(r=.75, h=2) mc.move(self.sideModifyer * 6.5, 2, 1.5) mc.rotate(0, 0, 90) self.s_1 = mc.polyCube(sx=1, sy=3, sz=1, h=5, w=2, d=2)[0] mc.move(self.sideModifyer * 8.5, 3.5, 1.5) mc.select(self.s_1 + '.f[7]') mc.move(-1, 0, 0, r=True) mc.select(self.s_1 + '.e[26]') mc.move(-1, 0, 0, r=True) mc.select(self.s_1 + '.e[23]') mc.move(.123, 0, 0, r=True) mc.select(self.s_1 + '.f[3]') mc.move(0, -.5, 0, r=True) self.n_2_a = mc.polyCylinder(ax=[0, 0, 1], sx=2, sy=2, sz=2, h=.6, r=1.0, n='n_2_a') mc.move(self.sideModifyer * 8.5, 6.5, 1.5 + .7) #1.875 + .35 self.n_2_b = mc.polyCylinder(ax=[0, 0, 1], sx=2, sy=2, sz=2, h=.6, r=1.0, n='n_2_b') mc.move(self.sideModifyer * 8.5, 6.5, 1.5 - .7) #1.875 -.35 self.s_1 = mc.polyUnite(self.n_t, self.s_1, self.n_2_a, self.n_2_b, self.b_1, n='segment_1') #section 2 construction self.n_2_c = mc.polyCylinder(ax=[0, 0, 1], sx=2, sy=2, sz=2, h=.6, r=1.0, n='n_2_c')[0] mc.move(self.sideModifyer * 8.5, 6.5, 1.5) self.p_2 = mc.polyCube(sx=2, sy=2, sz=2, h=4, w=2, d=2)[0] mc.move(self.sideModifyer * 8.5, 9.5, 1.5) mc.select(self.p_2 + '.f[4:7]') #f[5] on a one segment mc.scale(.8, 1, .75) #section 2 unite self.s_2 = mc.polyUnite(self.n_2_c, self.p_2, n='p_s_2')[0] mc.move(self.sideModifyer * 8.5, 6.5, 1.5, self.s_2 + ".scalePivot", self.s_2 + ".rotatePivot")
def _createGeometry(self, name): #self.spine = mc.polyCylinder(h=75,r=2,n=name+'_spine')[0] #mc.move(0,30,0) self.pelvic = mc.polyCylinder(h=40, r=2, n=name + '_pelvic')[0] mc.rotate(0, 0, '90deg') self.clavical = mc.polyCylinder(h=56, r=2, n=name + '_clavical')[0] mc.rotate(0, 0, '90deg') mc.move(0, 67, 0) #self.hip = mc.polySphere(r=5,n=name+'_hip') self.hipPlate = mc.polyCube(w=50, d=10, h=5) mc.move(0, 15, 0) self.hipPlate2 = mc.polyCube(w=8, d=5, h=35)[0] mc.move(12, 0, 15) mc.select(self.hipPlate2 + '.e[10]') mc.move(0, 3, 0, r=True) mc.select(self.hipPlate2 + '.e[0]') mc.move(0, 3, 0, r=True) mc.select(self.hipPlate2 + '.e[6]') mc.move(0, -3, 0, r=True) mc.select(self.hipPlate2 + '.e[1]') mc.move(0, -3, 0, r=True) mc.select(self.hipPlate2 + '.e[4]') mc.move(3, 0, 0, r=True) mc.select(self.hipPlate2) mc.rotate(-10, 0, 0) self.hipPlate3 = mc.polyCube(w=15, d=5, h=35)[0] mc.move(23.5, 0, 15) mc.select(self.hipPlate3 + '.e[11]') mc.move(0, 10, 0, r=True) mc.select(self.hipPlate3 + '.e[0]') mc.move(0, 3, 0, r=True) mc.select(self.hipPlate3 + '.e[7]') mc.move(-6, -3, 0, r=True) mc.select(self.hipPlate3 + '.e[1]') mc.move(0, -3, 0, r=True) mc.select(self.hipPlate3 + '.e[5]') mc.move(-3, 0, 0, r=True) mc.select(self.hipPlate3) mc.rotate(-10, 0, 0) self.hipPlate4 = mc.polyCube(w=8, d=5, h=35)[0] mc.move(-12, 0, 15) mc.select(self.hipPlate4 + '.e[11]') mc.move(0, 3, 0, r=True) mc.select(self.hipPlate4 + '.e[0]') mc.move(0, 3, 0, r=True) mc.select(self.hipPlate4 + '.e[7]') mc.move(0, -3, 0, r=True) mc.select(self.hipPlate4 + '.e[1]') mc.move(0, -3, 0, r=True) mc.select(self.hipPlate4 + '.e[5]') mc.move(-3, 0, 0, r=True) mc.select(self.hipPlate4) mc.rotate(-10, 0, 0) self.hipPlate5 = mc.polyCube(w=15, d=5, h=35)[0] mc.move(-23.5, 0, 15) mc.select(self.hipPlate5 + '.e[10]') mc.move(0, 10, 0, r=True) mc.select(self.hipPlate5 + '.e[0]') mc.move(0, 3, 0, r=True) mc.select(self.hipPlate5 + '.e[6]') mc.move(6, -3, 0, r=True) mc.select(self.hipPlate5 + '.e[1]') mc.move(0, -3, 0, r=True) mc.select(self.hipPlate5 + '.e[4]') mc.move(3, 0, 0, r=True) mc.select(self.hipPlate5) mc.rotate(-10, 0, 0) self.hipPlate = mc.polyUnite(self.hipPlate, self.hipPlate2, self.hipPlate3, self.hipPlate4, self.hipPlate5) self.crotchPlate1 = mc.polyCube(w=10, d=20, h=20)[0] mc.select(self.crotchPlate1 + '.e[3]') mc.move(0, 2, 0, r=True) mc.scale(.75, 1, 1) self.crotchPlate2 = mc.polyCube(w=10, d=10, h=20)[0] mc.move(0, 0, 15) mc.select(self.crotchPlate2 + '.e[0]') mc.move(0, 2, -5, r=True) mc.scale(.75, 1, 1) mc.select(self.crotchPlate2) self.crotchPlate1_1 = mc.duplicate(rr=True) mc.sets(e=True, forceElement=self.color1) mc.move(0, 2, -3, r=True) mc.scale(1.5, 1, 1) self.crotchPlate3 = mc.polyCube(w=10, d=20, h=10)[0] mc.move(0, 15, 10) mc.select(self.crotchPlate3 + '.e[1]') mc.move(0, 0, -6, r=True) mc.scale(.75, 1, 1) mc.select(self.crotchPlate3) self.crotchPlate3_1 = mc.duplicate(rr=True) mc.sets(e=True, forceElement=self.color1) mc.move(0, 2, -3, r=True) mc.scale(1.5, 1, 1) mc.select(self.crotchPlate3) self.crotchPlate3_2 = mc.duplicate(rr=True) mc.sets(e=True, forceElement=self.color3) mc.move(0, 0, 1, r=True) mc.scale(.75, .75, 1) #self.crotchPlate4 = mc.polyCube(w=10,d=20,h=10)[0] #mc.move(0,-15,0) self.pelvic = mc.polyUnite(self.pelvic, self.crotchPlate2, self.crotchPlate3, self.crotchPlate1_1, self.crotchPlate3_1, self.crotchPlate3_2) self.pelvic = mc.polyUnite(self.pelvic, self.crotchPlate1) self.pelvic = mc.polyUnite(self.pelvic, self.hipPlate)[0] #self.torso = mc.polyUnite(self.spine,self.pelvic,n=name)[0] self.torso = self.pelvic ######### Cockpit ############## self.cockpit = mc.polyCube(w=10, d=2, h=10)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, 25, 8, r=True) mc.select(self.cockpit + '.e[1]') mc.move(0, 5, 5, r=True) self.cockpit2 = mc.polyCube(w=10, d=2, h=10)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, 35, 10, r=True) mc.select(self.cockpit2 + '.e[1]') mc.move(0, 0, 10, r=True) mc.select(self.cockpit2 + '.e[2]') mc.move(0, 2, 10, r=True) self.cockpit = mc.polyUnite(self.cockpit, self.cockpit2) self.cockpitWall1 = mc.polyCube(w=2, h=30, d=10)[0] mc.move(0, 25, 0, r=True) mc.select(self.cockpitWall1 + '.e[1]') mc.move(0, 0, 15, r=True) self.cockpitWall2 = mc.polyCube(w=2, h=20, d=20)[0] mc.move(6.5, 32, 0, r=True) mc.select(self.cockpitWall2 + '.e[1]') mc.move(0, 0, 15, r=True) self.cockpitWall3 = mc.polyCube(w=2, h=20, d=20)[0] mc.move(-6.5, 32, 0, r=True) mc.select(self.cockpitWall3 + '.e[1]') mc.move(0, 0, 15, r=True) self.cockpitWall4 = mc.polyCube(w=2, h=20, d=20)[0] mc.move(6.5, 52, 0, r=True) mc.select(self.cockpitWall4 + '.e[0]') mc.move(0, 0, 15, r=True) self.cockpitWall5 = mc.polyCube(w=2, h=20, d=20)[0] mc.move(-6.5, 52, 0, r=True) mc.select(self.cockpitWall5 + '.e[0]') mc.move(0, 0, 15, r=True) self.cockpitWall6 = mc.polyCube(w=15, h=20, d=2) mc.move(0, 32, -10, r=True) self.cockpitWall7 = mc.polyCube(w=15, h=20, d=2) mc.move(0, 52, -10, r=True) self.cockpit = mc.polyUnite(self.cockpit, self.cockpitWall1, self.cockpitWall2, self.cockpitWall3, self.cockpitWall4, self.cockpitWall5, self.cockpitWall6, self.cockpitWall7) self.lRibs1 = mc.polyCube(w=10, d=20, h=5)[0] mc.sets(e=True, forceElement=self.color1) mc.move(12, 25, 0, r=True) mc.select(self.lRibs1 + '.e[1]') mc.move(0, 0, -2, r=True) mc.select(self.lRibs1 + '.e[2]') mc.move(0, 0, 2, r=True) mc.select(self.lRibs1 + '.e[7]') mc.move(-2, 1, 0, r=True) mc.polyBevel() self.lRibs2 = mc.polyCube(w=5, d=15, h=5)[0] mc.sets(e=True, forceElement=self.color1) mc.move(12, 30, 0, r=True) mc.select(self.lRibs2 + '.e[1]') mc.move(0, 0, -2, r=True) mc.select(self.lRibs2 + '.e[2]') mc.move(0, 0, 2, r=True) mc.select(self.lRibs2 + '.e[7]') mc.move(-2, 1, 0, r=True) mc.polyBevel() self.lRibs3 = mc.polyCube(w=2, d=20, h=10)[0] mc.sets(e=True, forceElement=self.color2) mc.move(8, 30, 0, r=True) mc.select(self.lRibs3 + '.e[1]') mc.move(0, 0, 2, r=True) mc.select(self.lRibs3 + '.e[2]') mc.move(0, 0, -2, r=True) mc.select(self.lRibs3 + '.e[7]') mc.move(2, 1, 0, r=True) mc.polyBevel() self.lRibs4 = mc.polyCube(w=8, d=30, h=10)[0] mc.sets(e=True, forceElement=self.color2) mc.move(8, 40, 0, r=True) mc.select(self.lRibs4 + '.e[1]') mc.move(0, 0, 5, r=True) mc.select(self.lRibs4 + '.e[2]') mc.move(0, 0, -2, r=True) mc.select(self.lRibs4 + '.e[7]') mc.move(5, 1, 0, r=True) mc.polyBevel() self.lRibs = mc.polyUnite(self.lRibs1, self.lRibs2, self.lRibs3, self.lRibs4) self.rRibs1 = mc.polyCube(w=10, d=20, h=5)[0] mc.sets(e=True, forceElement=self.color1) mc.move(-12, 25, 0, r=True) mc.select(self.rRibs1 + '.e[1]') mc.move(0, 0, -2, r=True) mc.select(self.rRibs1 + '.e[2]') mc.move(0, 0, 2, r=True) mc.select(self.rRibs1 + '.e[6]') mc.move(2, 1, 0, r=True) mc.polyBevel() self.rRibs2 = mc.polyCube(w=5, d=15, h=5)[0] mc.sets(e=True, forceElement=self.color1) mc.move(-12, 30, 0, r=True) mc.select(self.rRibs2 + '.e[1]') mc.move(0, 0, -2, r=True) mc.select(self.rRibs2 + '.e[2]') mc.move(0, 0, 2, r=True) mc.select(self.rRibs2 + '.e[6]') mc.move(2, 1, 0, r=True) mc.polyBevel() self.rRibs3 = mc.polyCube(w=2, d=20, h=10)[0] mc.sets(e=True, forceElement=self.color2) mc.move(-8, 30, 0, r=True) mc.select(self.rRibs3 + '.e[1]') mc.move(0, 0, 2, r=True) mc.select(self.rRibs3 + '.e[2]') mc.move(0, 0, -2, r=True) mc.select(self.rRibs3 + '.e[6]') mc.move(-2, 1, 0, r=True) mc.polyBevel() self.rRibs4 = mc.polyCube(w=8, d=30, h=10)[0] mc.sets(e=True, forceElement=self.color2) mc.move(-8, 40, 0, r=True) mc.select(self.rRibs4 + '.e[1]') mc.move(0, 0, 5, r=True) mc.select(self.rRibs4 + '.e[2]') mc.move(0, 0, -2, r=True) mc.select(self.rRibs4 + '.e[6]') mc.move(-5, 1, 0, r=True) mc.polyBevel() self.rRibs = mc.polyUnite(self.rRibs1, self.rRibs2, self.rRibs3, self.rRibs4) self.cockpit = mc.polyUnite(self.cockpit, self.lRibs, self.rRibs) ########## CHEST ############# self.chest1 = mc.polyCube(w=10, d=2, h=10)[0] mc.sets(e=True, forceElement=self.color3) mc.move(0, 47, 23, r=True) mc.select(self.chest1 + '.e[1]') mc.move(0, 0, 10, r=True) mc.select(self.chest1 + '.e[3]') mc.move(0, 2, 0, r=True) mc.select(self.chest1 + '.e[2]') mc.move(0, 0, -20, r=True) self.chest2 = mc.polyCube(w=10, d=2, h=10)[0] mc.sets(e=True, forceElement=self.color3) mc.move(0, 57, 23, r=True) mc.select(self.chest2 + '.e[0]') mc.move(0, 0, 10, r=True) mc.select(self.chest2 + '.e[3]') mc.move(0, 0, -10, r=True) mc.select(self.chest2 + '.e[2]') mc.move(0, 0, -20, r=True) self.chest3 = mc.polyCube(w=20, d=2, h=10)[0] mc.sets(e=True, forceElement=self.color3) mc.move(15, 57, 23, r=True) mc.select(self.chest3 + '.e[0]') mc.move(0, 0, 10, r=True) mc.select(self.chest3 + '.e[3]') mc.move(0, 0, -10, r=True) mc.select(self.chest3 + '.e[2]') mc.move(0, 0, -20, r=True) mc.select(self.chest3 + '.e[5]') mc.move(0, 0, -5, r=True) self.chest4 = mc.polyCube(w=20, d=2, h=10)[0] mc.sets(e=True, forceElement=self.color3) mc.move(-15, 57, 23, r=True) mc.select(self.chest4 + '.e[0]') mc.move(0, 0, 10, r=True) mc.select(self.chest4 + '.e[3]') mc.move(0, 0, -10, r=True) mc.select(self.chest4 + '.e[2]') mc.move(0, 0, -20, r=True) mc.select(self.chest4 + '.e[4]') mc.move(0, 0, -5, r=True) self.chest5 = mc.polyCube(w=10, d=2, h=5)[0] mc.sets(e=True, forceElement=self.color3) mc.move(0, 67, 13, r=True) mc.select(self.chest5 + '.e[0]') mc.move(0, -2.5, 10, r=True) mc.select(self.chest5 + '.e[3]') mc.move(0, 0, -10, r=True) mc.select(self.chest5 + '.e[2]') mc.move(0, 0, -20, r=True) mc.select(self.chest5 + '.f[1]') #mc.move(0,0,-20,r=True) mc.scale(.5, 1, .5) self.chest6 = mc.polyCube(w=20, d=2, h=5)[0] mc.sets(e=True, forceElement=self.color3) mc.move(15, 64.5, 13, r=True) mc.select(self.chest6 + '.e[0]') mc.move(0, 0, 10, r=True) mc.select(self.chest6 + '.e[3]') mc.move(0, 0, -10, r=True) mc.select(self.chest6 + '.e[2]') mc.move(0, 0, -20, r=True) mc.select(self.chest6 + '.e[5]') mc.move(0, 0, -5, r=True) mc.select(self.chest6 + '.e[1]') mc.move(0, 0, -10, r=True) self.chest7 = mc.polyCube(w=20, d=2, h=5)[0] mc.sets(e=True, forceElement=self.color3) mc.move(-15, 64.5, 13, r=True) mc.select(self.chest7 + '.e[0]') mc.move(0, 0, 10, r=True) mc.select(self.chest7 + '.e[3]') mc.move(0, 0, -10, r=True) mc.select(self.chest7 + '.e[2]') mc.move(0, 0, -20, r=True) mc.select(self.chest7 + '.e[4]') mc.move(0, 0, -5, r=True) mc.select(self.chest7 + '.e[1]') mc.move(0, 0, -10, r=True) self.chest8 = mc.polyCube(w=10, d=2, h=5)[0] mc.sets(e=True, forceElement=self.color3) mc.move(10, 67.5, 3, r=True) mc.select(self.chest8 + '.e[0]') mc.move(0, 0, 10, r=True) mc.select(self.chest8 + '.e[3]') mc.move(0, 0, -10, r=True) mc.select(self.chest8 + '.e[2]') mc.move(0, 0, -10, r=True) mc.select(self.chest8 + '.e[5]') mc.move(0, 0, -5, r=True) mc.select(self.chest8 + '.e[1]') mc.move(0, 0, -1, r=True) self.chest9 = mc.polyCube(w=10, d=2, h=5)[0] mc.sets(e=True, forceElement=self.color3) mc.move(-10, 67.5, 3, r=True) mc.select(self.chest9 + '.e[0]') mc.move(0, 0, 10, r=True) mc.select(self.chest9 + '.e[3]') mc.move(0, 0, -10, r=True) mc.select(self.chest9 + '.e[2]') mc.move(0, 0, -10, r=True) mc.select(self.chest9 + '.e[4]') mc.move(0, 0, -5, r=True) mc.select(self.chest9 + '.e[1]') mc.move(0, 0, -1, r=True) self.chest = mc.polyUnite(self.chest1, self.chest2, self.chest3, self.chest4, self.chest5, self.chest6, self.chest7, self.chest8, self.chest9) ######### shoulders ############ t1 = mc.polyCube(sx=3, sy=3, sz=3, w=15, h=15, d=15, n='l_shoulder')[0] mc.sets(e=True, forceElement=self.color4) t1r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] #mc.scale(1,5,1) mc.move(25, 67, 0, r=True) t2 = mc.polyCube(sx=3, sy=3, sz=3, w=15, h=15, d=15, n='r_shoulder')[0] mc.sets(e=True, forceElement=self.color4) t2r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] #mc.scale(1,5,1) mc.move(-25, 67, 0, r=True) self.clavical = mc.polyUnite(self.clavical, t1, t2)