def _handleEars(self):
     val = self.ears.value()
     val = float(val)/100
     if val > 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(0, val)] )
     if val < 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(1, -1 * val)] )
     if val == 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(1, 0)] )
         cmds.blendShape( "blendShape1", edit=True, w=[(0, 0)] )
 def _handleForehead(self):
     val = self.forehead.value()
     val = float(val)/100
     if val > 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(9, val)] )
     if val < 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(8, -1 * val)] )
     if val == 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(9, 0)] )
         cmds.blendShape( "blendShape1", edit=True, w=[(8, 0)] )
 def _handleMouth(self):
     val = self.mouth.value()
     val = float(val)/100
     if val > 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(5, val)] )
     if val < 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(4, -1 * val)] )
     if val == 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(5, 0)] )
         cmds.blendShape( "blendShape1", edit=True, w=[(4, 0)] )
 def _handleNose(self):
     val = self.nose.value()
     val = float(val)/100
     if val > 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(3, val)] )
     if val < 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(2, -1 * val)] )
     if val == 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(2, 0)] )
         cmds.blendShape( "blendShape1", edit=True, w=[(3, 0)] )
 def _handleEyes(self):
     val = self.eyes.value()
     val = float(val)/100
     if val > 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(7, val)] )
     if val < 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(6, -1 * val)] )
     if val == 0:
         cmds.blendShape( "blendShape1", edit=True, w=[(6, 0)] )
         cmds.blendShape( "blendShape1", edit=True, w=[(7, 0)] )
Exemplo n.º 6
0
lattice = cmd.lattice(dv=(3, 3, 3), oc=True)
cmd.select(lattice[1] + '.pt[1][2][2]', r=True)
cmd.move(-3, 0, 3, r=True)
cmd.select(lattice[1] + '.pt[0][2][1]', r=True)
cmd.move(-3, 0, 3, r=True)
cmd.select(lattice[1] + '.pt[0][2][2]', r=True)
cmd.move(-3, 0, 3, r=True)
cmd.hide()
cmd.select(sphereXMinusZPlus)
cmd.hide()

####
#i need to make more blendShapes
####

####
#blend shape setup
####
bubbleBlend = cmd.blendShape(sphereXPlus,
                             sphereXMinus,
                             sphereZPlus,
                             sphereZMinus,
                             sphereXPlusZPlus,
                             sphereXPlusZMinus,
                             sphereXMinusZPlus,
                             sphereXMinusZMinus,
                             sphereDefault,
                             n='bubbleBlend')

cmd.blendShape(bubbleBlend, edit=True, w=[(0, 1), (1, .3)])
Exemplo n.º 7
0
    def _handleBubbles2Button(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()
        '''

        '''
        i have a problem of select not adding
        '''

        sphereDefault = cmd.polySphere(n='sphereDefault')[0]
        cmds.select(sphereDefault)
        cmd.setKeyframe()

        cmd.setKeyframe()
        #print sphereDefault

        sphereXPlus = cmd.polySphere(n='sphereXPlus')[0]
        cmd.move(0, 0, 5, r=True)
        lattice = cmd.lattice(dv=(3, 3, 3), oc=True)
        cmd.select(lattice[1]+'.pt[2][2][2]', r=True)
        cmd.move(3, 0, 0, r=True)
        cmd.select(lattice[1]+'.pt[2][2][1]', r=True, add=True)
        cmd.move(3, 0, 0, r=True)
        cmd.select(lattice[1]+'.pt[2][2][0]', r=True, add=True)
        cmd.move(3, 0, 0, r=True)
        cmd.hide()
        cmd.select(sphereXPlus)
        cmd.hide()

        sphereXMinus = cmd.polySphere(n='sphereXMinus')[0]
        cmd.move(0, 0, 10, r=True)
        lattice = cmd.lattice(dv=(3, 3, 3), oc=True)
        cmd.select(lattice[1]+'.pt[0][2][2]', r=True)
        cmd.move(-3, 0, 0, r=True)
        cmd.select(lattice[1]+'.pt[0][2][1]', r=True, add=True)
        cmd.move(-3, 0, 0, r=True)
        cmd.select(lattice[1]+'.pt[0][2][0]', r=True, add=True)
        cmd.move(-3, 0, 0, r=True)
        cmd.hide()
        cmd.select(sphereXMinus)
        cmd.hide()

        sphereZPlus = cmd.polySphere(n='sphereZPlus')[0]
        cmd.move(0,0,15,r=True)
        lattice = cmd.lattice(dv=(3, 3, 3), oc=True)
        cmd.select(lattice[1]+'.pt[0][2][2]', r=True)
        cmd.move(0, 0, 3, r=True)
        cmd.select(lattice[1]+'.pt[1][2][2]', r=True)
        cmd.move(0, 0, 3, r=True)
        cmd.select(lattice[1]+'.pt[2][2][2]', r=True)
        cmd.move(0, 0, 3, r=True)
        cmd.hide()
        cmd.select(sphereZPlus)
        cmd.hide()

        sphereZMinus = cmd.polySphere(n='sphereZMinus')[0]
        cmd.move(0,0,20,r=True)
        lattice = cmd.lattice(dv=(3, 3, 3), oc=True)
        cmd.select(lattice[1]+'.pt[0][2][0]', r=True)
        cmd.move(0, 0, -3, r=True)
        cmd.select(lattice[1]+'.pt[1][2][0]', r=True)
        cmd.move(0, 0, -3, r=True)
        cmd.select(lattice[1]+'.pt[2][2][0]', r=True)
        cmd.move(0, 0, -3, r=True)
        cmd.hide()
        cmd.select(sphereZMinus)
        cmd.hide()

        sphereXPlusZPlus = cmd.polySphere(n='sphereXPlusZPlus')[0]
        cmd.move(0,0,25,r=True)
        lattice = cmd.lattice(dv=(3, 3, 3), oc=True)
        cmd.select(lattice[1]+'.pt[2][2][2]', r=True)
        cmd.move(3, 0, 3, r=True)
        cmd.select(lattice[1]+'.pt[2][2][1]', r=True)
        cmd.move(3, 0, 3, r=True)
        cmd.select(lattice[1]+'.pt[1][2][2]', r=True)
        cmd.move(3, 0, 3, r=True)
        cmd.hide()
        cmd.select(sphereXPlusZPlus)
        cmd.hide()

        sphereXPlusZMinus = cmd.polySphere(n='sphereXPlusZMinus')[0]
        cmd.move(0,0,30,r=True)
        lattice = cmd.lattice(dv=(3, 3, 3), oc=True)
        cmd.select(lattice[1]+'.pt[2][2][0]', r=True)
        cmd.move(3, 0, -3, r=True)
        cmd.select(lattice[1]+'.pt[2][2][1]', r=True)
        cmd.move(3, 0, -3, r=True)
        cmd.select(lattice[1]+'.pt[1][2][0]', r=True)
        cmd.move(3, 0, -3, r=True)
        cmd.hide()
        cmd.select(sphereXPlusZMinus)
        cmd.hide()

        sphereXMinusZMinus = cmd.polySphere(n='sphereXPMinusZMinus')[0]
        cmd.move(0,0,35,r=True)
        lattice = cmd.lattice(dv=(3, 3, 3), oc=True)
        cmd.select(lattice[1]+'.pt[1][2][0]', r=True)
        cmd.move(-3, 0, -3, r=True)
        cmd.select(lattice[1]+'.pt[0][2][1]', r=True)
        cmd.move(-3, 0, -3, r=True)
        cmd.select(lattice[1]+'.pt[0][2][0]', r=True)
        cmd.move(-3, 0, -3, r=True)
        cmd.hide()
        cmd.select(sphereXMinusZMinus)
        cmd.hide()

        sphereXMinusZPlus = cmd.polySphere(n='sphereXPMinusZPlus')[0]
        cmd.move(0,0,40,r=True)
        lattice = cmd.lattice(dv=(3, 3, 3), oc=True)
        cmd.select(lattice[1]+'.pt[1][2][2]', r=True)
        cmd.move(-3, 0, 3, r=True)
        cmd.select(lattice[1]+'.pt[0][2][1]', r=True)
        cmd.move(-3, 0, 3, r=True)
        cmd.select(lattice[1]+'.pt[0][2][2]', r=True)
        cmd.move(-3, 0, 3, r=True)
        cmd.hide()
        cmd.select(sphereXMinusZPlus)
        cmd.hide()

        ####
        #i need to make more blendShapes
        ####

        ####
        #blend shape setup
        ####
        bubbleBlend = cmd.blendShape(sphereXPlus, sphereXMinus, sphereZPlus, sphereZMinus, sphereXPlusZPlus, sphereXPlusZMinus,
                       sphereXMinusZPlus, sphereXMinusZMinus, sphereDefault, n='bubbleBlend' )

        #cmd.blendShape(bubbleBlend, edit=True, w=[(0,1),(1,.3)])

        for i in range(0,100,1):
            randX = rand.choice(range(-50,50,1))
            randZ = rand.choice(range(-50,50,1))

            sphereDefault = cmd.polySphere(n='sphereDefault')[0]
            bubbleBlend = cmd.blendShape(sphereXPlus, sphereXMinus, sphereZPlus, sphereZMinus, sphereXPlusZPlus, sphereXPlusZMinus,
                            sphereXMinusZPlus, sphereXMinusZMinus, sphereDefault, n='bubbleBlend' )
            cmds.select(sphereDefault)



            startTime = rand.choice(range(1, 600, 1))
            cmd.currentTime(1)
            cmd.move(randX, 0, randZ, a=True)
            cmd.setKeyframe()
            for j in range(startTime, 600, 2):
                x = rand.choice(decRange)
                y = 5*rand.choice(decRange2)
                z = rand.choice(decRange)
                cmd.currentTime(i)
                cmd.select(sphereDefault)
                cmd.move(x,y,z,r=True)
                cmd.setKeyframe()
                cmd.blendShape(bubbleBlend, edit=True,
                                   w=[(0,rand.choice(decRange)),
                                      (1,rand.choice(decRange)),
                                      (2,rand.choice(decRange)),
                                      (3,rand.choice(decRange)),
                                      (4,rand.choice(decRange)),
                                      (5,rand.choice(decRange)),
                                      (6,rand.choice(decRange)),
                                      (7,rand.choice(decRange))])
                cmd.setKeyframeBlendshapeTargetWts()
            response = nimble.createRemoteResponse(globals())