rjSkinningTools.softSelectionToWeights package

Module contents

Convert soft selection to skin weights.

https://github.com/robertjoosten/rjSkinningTools/raw/master/softSelectionToWeights/README.png

Link to Video

Installation

Copy the rjSkinningTools folder to your Maya scripts directory

C:/Users/<USER>/Documents/maya/scripts

Usage

Display UI

import rjSkinningTools.softSelectionToWeights.ui
rjSkinningTools.softSelectionToWeights.ui.show()    

Note

Convert soft selection into skin weights. More influences can be added by clicking the plus button. When more influences are added these weights are automatically blended. The influence and soft selection can be reselected by right clicking the influence widget and using the context menu.

Skin cluster settings like max influences and normalization will be taken into account when applying the skin weights.

Code

rjSkinningTools.softSelectionToWeights.getSoftSelection()

Query the soft selection in the scene. If no soft selection is made empty lists will be returned. The active selection will be returned for easy reselection. The data structure of the soft selection weight is as followed.

data = {
mesh:{
{index:weight}, {index:weight},

}

}

Returns:Active selection list for re-selection and weight data.
Return type:tuple(OpenMaya.MSelectionList, dict)
rjSkinningTools.softSelectionToWeights.setSkinWeights(mesh, meshData, influences, filler=None)

Calculate and set the new skin weights. If no skin cluster is attached to the mesh, one will be created and all weights will be set to 1 with the filler influence. If a skin cluster does exist, the current weights will be used to blend the new weights. Maintaining of maximum influences and normalization of the weights will be taken into account if these attributes are set on the skin cluster.

meshData = {
mesh:{
{index:{
influence:weight, influence:weight,

}, {index:{

influence:weight, influence:weight,

},

}

}

Parameters:
  • mesh (str) –
  • meshData (dict) – skinning data for the mesh
  • influences (list) – list of (new) influences
  • filler (str) – Filler joint if no skin cluster is detected