Example #1
0
    def setWeightData(self, data, normalize=True):
        """
        Args:
          data (SkinWeightData)
          normalize (bool, Optional): Defaults to True
        """
        # Construct dagPath and components
        compList = data.getComponents()
        dagPath, components = utils.getDagPathComponents(compList)

        # Construct influence indices
        influenceIndices = om.MIntArray()
        [influenceIndices.append(self.getPhysicalInfluenceIndex(inf)) for inf in data.getInfluences()]

        # Construct weights
        weights = om.MDoubleArray()
        [weights.append(w) for w in data.getWeights()]
        oldValues = om.MDoubleArray()
        self.fn.getWeights(dagPath, components, influenceIndices, oldValues)

        self.fn.setWeights(dagPath, components, influenceIndices, weights, normalize, oldValues)
Example #2
0
    def getWeightData(self, elements):
        """
        Args:
          elements (list)

        Returns:
          SkinWeightData
        """
        dagPath, components = utils.getDagPathComponents(elements)

        # Get all influences
        infs = self.listInfluences(asDagPath=False)
        influenceIndices = om.MIntArray()
        [influenceIndices.append(self.getPhysicalInfluenceIndex(inf)) for inf in infs]

        # Get all weights
        weights = om.MDoubleArray()
        self.fn.getWeights(dagPath, components, influenceIndices, weights)
        weights = [w for w in weights]

        return SkinWeightData(elements, infs, weights)