Пример #1
0
    def createBakeSet(cls,
                      bakeSetName='mrBakeSet',
                      type='texture',
                      *args,
                      **kwargs):
        ''' make a mental ray bake set and return the name '''
        #texture
        if type == 'texture':
            newBakeSet = pm.createNode('textureBakeSet',
                                       name='tex_' + bakeSetName)
            if pm.ls('textureBakePartition'):
                pm.partition(newBakeSet, add='textureBakePartition')
            else:
                pm.partition(newBakeSet, name='textureBakePartition')
        #vertex
        else:
            newBakeSet = pm.createNode('vertexBakeSet',
                                       name='vtx_' + bakeSetName)
            pm.mel.setFilterScript(newBakeSet)
            if pm.ls('vertexBakePartition'):
                pm.partition(newBakeSet, add='vertexBakePartition')
            else:
                pm.partition(newBakeSet, name='vertexBakePartition')

            pm.addAttr(newBakeSet, ln='filterSize', sn='fs', min=-1, dv=0.001)
            pm.addAttr(newBakeSet,
                       ln='filterNormalTolerance',
                       sn='fns',
                       min=0,
                       max=180,
                       dv=5)

        return newBakeSet
Пример #2
0
def create_deltaMush(bindGeo, iterations = [5, 10, 20, 30, 40]):

    smoothGeo = pm.duplicate( bindGeo, rr=True, ic=True, name=bindGeo.name() + "_smooth") [0]
    smoothGeo.addAttr("envelope", at='long', min=0, max=1, dv=1, k=True)
    smoothGeo.addAttr("partitions", at='message')

    deltaGeo = pm.duplicate( bindGeo, rr=True, ic=False, name="BS_" + bindGeo.name() + "_delta") [0]

    pm.select(deltaGeo, smoothGeo)
    pm.mel.eval("CreateWrap")
  
    smoothNodes = []
    smoothNodeSets = []
    for i in range(0, len(iterations)):
        smoothNode = pm.deformer([smoothGeo], type='smooth')[0]
        smoothNode.iterations.set(iterations[i])
        smoothGeo.envelope >> smoothNode.envelope
        smoothNodes.append(smoothNode)
          
           
        smoothNodeSet = smoothNode.message.listConnections()[0]
        smoothNodeSet.clear()
        smoothNodeSets.append(smoothNodeSet)

    for smoothNodeSet in smoothNodeSets:
        smoothNodeSet.clear()
    partition = pm.partition(smoothNodeSets)
    partition.message >> smoothGeo.partitions

    skinCls = bindGeo.getShape().listConnections(type='skinCluster')[0]    
    joints = skinCls.getInfluence()
    assign_iteration_set(joints, bindGeo, skinCls, deltaGeo)
Пример #3
0
def createPartition(objectSetNode, name='MWBevelPartition'):
    '''
    :Refernce:
        `CreatePartition;`
        `performCreatePartition false;`
        performCreatePartition in C:/Program Files/Autodesk/Maya2018/scripts/others/performCreatePartition.mel

        getCreaseSetPartition in C:\Program Files\Autodesk\Maya2018\Python\Lib\site-packages\maya\app\general\creaseSetEditor.py
    '''
    MWBevelPartition = pm.ls(name, type='partition')
    if MWBevelPartition:
        MWBevelPartition = MWBevelPartition[0]
        MWBevelPartition.addMember(objectSetNode)
        # pm.partition(objectSetNode, add=MWBevelPartition)
    else:
        MWBevelPartition = pm.partition(objectSetNode, name=name)

    return MWBevelPartition
Пример #4
0
 def createBakeSet(cls, bakeSetName='mrBakeSet', type='texture', *args, **kwargs):
   ''' make a mental ray bake set and return the name '''
   #texture
   if type == 'texture':
     newBakeSet = pm.createNode('textureBakeSet', name='tex_'+bakeSetName)
     if pm.ls('textureBakePartition'):
       pm.partition(newBakeSet, add='textureBakePartition')
     else:
       pm.partition(newBakeSet, name='textureBakePartition')
   #vertex    
   else:
     newBakeSet = pm.createNode('vertexBakeSet', name='vtx_'+bakeSetName)
     pm.mel.setFilterScript(newBakeSet)
     if pm.ls('vertexBakePartition'):
       pm.partition(newBakeSet, add='vertexBakePartition')
     else:
       pm.partition(newBakeSet, name='vertexBakePartition')
       
     pm.addAttr(newBakeSet, ln='filterSize', sn='fs', min=-1, dv=0.001)
     pm.addAttr(newBakeSet, ln='filterNormalTolerance', sn='fns', min=0, max=180, dv=5)
   
   return newBakeSet