Esempio n. 1
0
def loadWeightList(nCloth, attr, filePath=None, apply=True):
    '''
	'''
    # Load Weight List
    wt = WeightList()
    wt = wt.load(filePath)

    # Apply Weight List
    if apply: setVertexWeights(nCloth, attr, wt)

    # Return Result
    return wt
Esempio n. 2
0
def loadWeightList(nCloth,attr,filePath=None,apply=True):
	'''
	'''
	# Load Weight List
	wt = WeightList()
	wt = wt.load(filePath)
	
	# Apply Weight List
	if apply: setVertexWeights(nCloth,attr,wt)
	
	# Return Result
	return wt
Esempio n. 3
0
def saveWeightList(nCloth, attr, filePath=None, force=False):
    '''
	'''
    # Build Weight List
    wt = getVertexWeights(nCloth, attr)
    wtList = WeightList(wt)

    # Save Weight List
    if filePath: filePath = wtList.saveAs(filePath, force)
    else: filePath = wtList.saveAs()

    # Return Result
    return filePath
Esempio n. 4
0
def saveWeightList(nCloth,attr,filePath=None,force=False):
	'''
	'''
	# Build Weight List
	wt = getVertexWeights(nCloth,attr)
	wtList = WeightList(wt)
	
	# Save Weight List
	if filePath: filePath = wtList.saveAs(filePath,force)
	else: filePath = wtList.saveAs()
	
	# Return Result
	return filePath
Esempio n. 5
0
    def calculateWeights(self, normalize=False, clamp=True):

        addWeights = WeightList([])
        subWeights = WeightList([])
        mulWeights = WeightList([])
        for geometry in self.weights.keys():

            for transform in self.weights[geometry].keys():
                opNum = self.getOperation(transform)
                if opNum == 0: addWeights += self.weights[geometry][transform]
                elif opNum == 1:
                    subWeights += self.weights[geometry][transform]
                elif opNum == 2:
                    mulWeights += self.weights[geometry][transform]

            self.results[geometry] = (addWeights - subWeights) * mulWeights

            if normalize:
                self.results[geometry] = self.results[geometry].normalize()
            if clamp: self.results[geometry] = self.results[geometry].clamp()
Esempio n. 6
0
    def getWeights(self):

        for geometry in self.geometry:

            self.weights[geometry] = {}

            for transform in self.weightTransforms:

                self.weights[geometry][transform] = WeightList(
                    glTools.tools.generateWeights.radialWeights(
                        geometry=geometry,
                        center=transform,
                        radius=mc.getAttr('%s.%s' %
                                          (transform, self.radiusAttrName)),
                        smooth=self.smooth))

                affect = mc.getAttr('%s.%s' % (transform, self.affectAttrName))
                self.weights[geometry][transform] *= affect