Пример #1
0
def sculpt(*args, **kwargs):
    res = cmds.sculpt(*args, **kwargs)
    if not kwargs.get('query', kwargs.get('q', False)):
        res = _factories.maybeConvert(res, _general.PyNode)
    return res
Пример #2
0
 def sculpt(self,
            character=None,
            mod=None,
            side=None,
            name=None,
            suffix=None,
            geometry=None,
            position=[0, 0, 0],
            rotation=[0, 0, 0],
            envelope=1,
            mode='flip',
            insideMode='ring',
            maxDisplacement=0.1,
            dropoffType='linear',
            dropoffDistance=1,
            groupWithLocator=0,
            objectCentered=0,
            radius=1,
            parent=None,
            show=True,
            lockAttr=None,
            ihi=True):
     #--- this method creates a sculpt deformer
     #--- select the specified geometry
     cmds.select(geometry)
     #--- create a sculpt deformer
     node = cmds.sculpt(mode=mode,
                        insideMode=insideMode,
                        maxDisplacement=maxDisplacement,
                        dropoffType=dropoffType,
                        dropoffDistance=dropoffDistance,
                        groupWithLocator=groupWithLocator,
                        objectCentered=objectCentered)
     #--- filter the individual name
     filter_name = node[0]
     #--- create a group on top and parent the deformer under the group
     node_grp = cmds.createNode('transform')
     #--- rename the node group
     node_grp = self.__rename_node(mod=mod,
                                   side=side,
                                   name=filter_name,
                                   suffix='GRP',
                                   obj=node_grp)[0]
     #--- rename the sculpt deformer
     node = self.__rename_node(mod=mod,
                               side=side,
                               name=filter_name,
                               suffix=suffix,
                               obj=node)
     cmds.parent(node_grp, node[0])
     cmds.parent(node_grp, world=True)
     cmds.parent(node[0], node_grp)
     #--- reposition the transform of the deformer locally
     cmds.xform(node[0], translation=position, worldSpace=False)
     cmds.xform(node[0], rotation=rotation, worldSpace=False)
     #--- take care of the node's settings
     #--- envelope
     cmds.setAttr(node[-1] + '.envelope', envelope)
     #--- radius
     cmds.setAttr(node[1] + '.radius', radius)
     #--- parent the group under the specified parent
     if parent:
         if not isinstance(parent, list):
             cmds.parent(node_grp, parent)
         else:
             raise Exception("Specified parent: " + parent +
                             'is not a valid')
     #--- show or hide transform
     if not show:
         cmds.setAttr(node[0] + '.v', 0)
     #--- lock specified attributes
     if lockAttr:
         if node[-1]:
             cmds.setAttr(node[-1] + '.' + lockAttr, lock=True)
     #--- set isHistoricalInteresting attribute
     if not ihi:
         for n in node:
             cmds.setAttr(n + '.ihi', 0)
     #--- return node
     node.append(node_grp)
     return node
Пример #3
0
 def sculpt(self,
            character = None,
            mod = None,
            side = None,
            name = None,
            suffix = None,
            geometry = None,
            position = [0,0,0],
            rotation = [0,0,0],
            envelope = 1,
            mode = 'flip',
            insideMode = 'ring',
            maxDisplacement = 0.1,
            dropoffType = 'linear',
            dropoffDistance = 1,
            groupWithLocator = 0,
            objectCentered = 0,
            radius = 1,
            parent = None,
            show = True,
            lockAttr = None,
            ihi = True):
     #--- this method creates a sculpt deformer
     #--- select the specified geometry
     cmds.select(geometry)
     #--- create a sculpt deformer
     node = cmds.sculpt(mode = mode,
                        insideMode = insideMode,
                        maxDisplacement = maxDisplacement,
                        dropoffType = dropoffType,
                        dropoffDistance = dropoffDistance,
                        groupWithLocator = groupWithLocator,
                        objectCentered = objectCentered)
     #--- filter the individual name
     filter_name = node[0]
     #--- create a group on top and parent the deformer under the group
     node_grp = cmds.createNode('transform')
     #--- rename the node group
     node_grp = self.__rename_node(mod = mod,
                                   side = side,
                                   name = filter_name,
                                   suffix = 'GRP',
                                   obj = node_grp)[0]
     #--- rename the sculpt deformer
     node = self.__rename_node(mod = mod,
                               side = side,
                               name = filter_name,
                               suffix = suffix,
                               obj = node)
     cmds.parent(node_grp, node[0])
     cmds.parent(node_grp, world = True)
     cmds.parent(node[0], node_grp)
     #--- reposition the transform of the deformer locally
     cmds.xform(node[0], translation = position, worldSpace = False)
     cmds.xform(node[0], rotation = rotation, worldSpace = False)
     #--- take care of the node's settings
     #--- envelope
     cmds.setAttr(node[-1] + '.envelope', envelope)
     #--- radius
     cmds.setAttr(node[1] + '.radius', radius)
     #--- parent the group under the specified parent
     if parent:
         if not isinstance(parent, list):
             cmds.parent(node_grp, parent)
         else:
             raise Exception("Specified parent: " +
                             parent + 'is not a valid')
     #--- show or hide transform
     if not show:
         cmds.setAttr(node[0] + '.v', 0)
     #--- lock specified attributes
     if lockAttr:
         if node[-1]:
             cmds.setAttr(node[-1] + '.' + lockAttr, lock = True)
     #--- set isHistoricalInteresting attribute
     if not ihi:
         for n in node:
             cmds.setAttr(n + '.ihi', 0)
     #--- return node
     node.append(node_grp)
     return node
Пример #4
0
	sortedKeyFrameList = sorted(allParticleDictionary[curveParticleId].keys())
	if len(sortedKeyFrameList) > 1:

		for keyFrame in sortedKeyFrameList:
			pointList.append(allParticleDictionary[curveParticleId][keyFrame])
					
		curveName = "partiCurve" + str(curveParticleId)
		curveObj = mc.curve(name = curveName, p = pointList)
		locName = "locatorName" + str(curveParticleId)
		locObj = mc.spaceLocator(name = locName)
		mc.pathAnimation(locObj, stu=sortedKeyFrameList[0], etu=sortedKeyFrameList[-1] ,c=curveObj)		
		
		#For every locator we create, make a bubble and attach that to the locator in worldspace and parent in underneath
	    
		makeBubble = mc.polyCube(name="bubble" + str(curveParticleId), w=.1, h=.1, d=.1, sx=5, sy=5, sz=5)		
        mc.sculpt(makeBubble, maxDisplacement=.1)
        mc.delete(makeBubble, ch=True)		
        getPos = mc.xform(locObj, ws=True, q=True, translation=True)        
        mc.xform(makeBubble[0], t=(getPos[0], getPos[1], getPos[2]))
        mc.parent(makeBubble[0], locObj)
        randBubbleSize = random.uniform(.4,.6)#This is what will give our bubbles the random size
        mc.scale(randBubbleSize, randBubbleSize, randBubbleSize, makeBubble[0])        
        
        #Create nCloth for each bubble and set the collide strength to turn on when the bubble moves, never before.
        mc.select(makeBubble[0])
        mc.nClothCreate()
        bubbleNClothName = mc.rename("nCloth1", "bubbleCloth")
        #mc.setAttr(locObj + ".collideStrength", 0)
        mc.setKeyframe(bubbleNClothName, attribute='collideStrength', t=[sortedKeyFrameList[0], sortedKeyFrameList[-1]])
        mc.setAttr(bubbleNClothName + ".collideStrength", 0)
        mc.setKeyframe(bubbleNClothName, attribute='collideStrength', t=[sortedKeyFrameList[0]-1, sortedKeyFrameList[-1]+1])