SkinningTools.Maya.tools.skinCluster

Module Contents

Classes

SoftSkinBuilder

this class handles the buildup of a skincluster using selections

Functions

AvarageVertex(selection, useDistance, weightAverageWindow=None, progressBar=None)

grouped function that allows multiple ways of averaging vertices based on how its selected

Copy2MultVertex(selection, lastSelected, progressBar=None)

copy information between vertices

avgVertex(vertices, lastSelected, progressBar=None)

smooth a vertex’s skinning information based on order of selection

checkBasePose(skinCluster)

check if the current object is in bindpose, using the prebind matrices and the worldmatrices of the joints

combineSkinnedMeshes(meshes, progressBar=None)

combine multiple skinned meshes into 1 single skinned mesh

doSkinPercent(bone, value, operation=0)

simple function to quickly set weights with the given value

execCopySourceTarget(TargetSkinCluster, SourceSkinCluster, TargetSelection, SourceSelection, smoothValue=1, progressBar=None)

copy skincluster information from one vertex group to another based on closest proximity

extractSkinnedShells(components, progressBar=None)

extract a selection of components as a new mesh with the same skinning info

forceCompareInfluences(meshes)

force the joints on the current meshes to be shared, this to make sure we cannot apply weights to joints that dont exist on the skincluster

freezeSkinnedMesh(inMesh, progressBar=None)

‘freeze’ a skinned mesh, remove construction history and transform information

getVertOverMaxInfluence(inObject, maxInfValue=8, progressBar=None)

get the information of the objects skincluster on if there are too many joints driving a single vertex

hammerVerts(inSelection, needsReturn=True, progressBar=None)

a quick and dirty way of smoothing vertex selection

hardSkinSelectionShells(selection, progressBar=False)

use the current selection to define islands that are clustered togehter and make sure that each island shares the same skinning information

keepOnlySelectedInfluences(fullSelection, jointOnlySelection, inverse=False, progressBar=None)

use the selection of joints and components to tell which joints are allowed to drive the current components

neighbourAverage(components, warningPopup=True, progressBar=None)

force smooth skinning based on the current selection

seperateSkinnedObject(inMesh, progressBar=None)

seperate a skinned mesh that has different polygroups combined into multiple objects with skinning information intact

setMaxJointInfluences(inObject=None, maxInfValue=8, progressBar=None)

set the information of the objects skincluster if there are too many joints driving a single vertex to be under that limit

smoothAndSmoothNeighbours(input, both=False, growing=False, full=True, progressBar=None)

a function that can walk over a mesh selection smooth the mesh gradually

switchVertexWeight(vertex1, vertex2, progressBar=None)

swap information between 2 skinned vertices

transferClosestSkinning(objects, smoothValue, progressBar=None)

copy skincluster information from one object to others based on closest proximity

transferSkinning(baseSkin, otherSkins, inPlace=True, sAs=True, uvSpace=False, progressBar=None)

copy skincluster information from one object to others

transferUvToSkinnedObject(meshSource, meshTarget, sourceMap='map1', targetMap='map1', progressBar=None)

a way to copy uv map information from a static mesh to a skinned mesh without breaking the history stack

SkinningTools.Maya.tools.skinCluster._DEBUG
class SkinningTools.Maya.tools.skinCluster.SoftSkinBuilder(progressBar=None)

this class handles the buildup of a skincluster using selections the base of the infromation is gathered from the object itself

the user can then alter the weights using direct selection and assiging the values or it can use the soft selection to define a bigger selection and smooth weights

addSoftSkinInfo(self, bone)

add skinning info to the bone based on current selection

Parameters

bone (string) – name of the bone to assign data too

analyzeSkin(self, inMesh, pre=True)

analyze the current skin, get information from the given mesh and fill the constructor

Parameters
  • inMesh (string) – the mesh to analyze

  • pre (bool) – if True will set the current info to be pre-analyzed, if False will leave the function alone

Note pre

unused, this one will be used later to check if we are going to add, replace or create weights from scratch

Returns

list of current joints influencing the mesh

Return type

list

getVerts(self, bone)

get the vertices currently influenced by the given bone

Parameters

bone (string) – name of the bone to get information from

Returns

list of vertices influenced

Return type

list

removeData(self, bone)

remove the data associated with given bone

Todo

figure out what to do with the original weights!

Parameters

bone (string) – name of the bone to clear the date off

setSoftSkinInfo(self, inMesh, add=True)

set the skinning info to the mesh

Parameters
  • inMesh (string) – name of the mesh to assignt the data to

  • add (bool) – if True will add the info to the existing information, if False will override the information

SkinningTools.Maya.tools.skinCluster.AvarageVertex(selection, useDistance, weightAverageWindow=None, progressBar=None)

grouped function that allows multiple ways of averaging vertices based on how its selected

Parameters
  • selection (list) – list of components

  • useDistance (bool) – if True the weight is measured by the distance between elements, if False weight is measured by the amount in the selection

  • weightAverageWindow (falloffCurveUI) – name of the skinned mesh to cleanup

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.Copy2MultVertex(selection, lastSelected, progressBar=None)

copy information between vertices

Parameters
  • selection (list) – the selection of vertices that will get the information

  • lastSelected (string) – the vertex we gather information from

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed, vertices if requested

Return type

bool

SkinningTools.Maya.tools.skinCluster.avgVertex(vertices, lastSelected, progressBar=None)

smooth a vertex’s skinning information based on order of selection

Parameters
  • vertices (list) – list of vertices to gather information from

  • lastSelected (list) – last selected object can get the average information

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.checkBasePose(skinCluster)

check if the current object is in bindpose, using the prebind matrices and the worldmatrices of the joints :note: only compare worldspace translate values as precision might be difficult here

Parameters

skinCluster (string) – the current skincluster to check

Returns

True if the setup is in bindpose, False if not

Return type

bool

SkinningTools.Maya.tools.skinCluster.combineSkinnedMeshes(meshes, progressBar=None)

combine multiple skinned meshes into 1 single skinned mesh

Parameters
  • meshes (list) – list of meshes to combine

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

the mesh that is created

Return type

string

SkinningTools.Maya.tools.skinCluster.doSkinPercent(bone, value, operation=0)

simple function to quickly set weights with the given value

Parameters
  • bone (list) – joint to change the weight influence of

  • value (float) – value to set the weight

  • operation (int) – the operation on how to treat the weight

Note operation

= { 0:removes the values, 1:sets the values, 2: adds the values}

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.execCopySourceTarget(TargetSkinCluster, SourceSkinCluster, TargetSelection, SourceSelection, smoothValue=1, progressBar=None)

copy skincluster information from one vertex group to another based on closest proximity

Parameters
  • TargetSkinCluster (string) – the skincluster to gather information from

  • SourceSkinCluster (string) – the skincluster to send information to

  • TargetSelection (list) – the vertex selection to copy from

  • SourceSelection (list) – the vertex selection to copy to

  • smoothValue (int) – amount of closest positions to gather data from

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed, vertices if requested

Return type

bool

SkinningTools.Maya.tools.skinCluster.extractSkinnedShells(components, progressBar=None)

extract a selection of components as a new mesh with the same skinning info

Parameters
  • components (list) – list of components that define the new mesh

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

the mesh that is created

Return type

string

SkinningTools.Maya.tools.skinCluster.forceCompareInfluences(meshes)

force the joints on the current meshes to be shared, this to make sure we cannot apply weights to joints that dont exist on the skincluster

Parameters

meshes (list) – the meshes on which all joints need to be shared

Returns

True if the joints are the same for all meshes, False if not

Return type

bool

SkinningTools.Maya.tools.skinCluster.freezeSkinnedMesh(inMesh, progressBar=None)

‘freeze’ a skinned mesh, remove construction history and transform information

Parameters
  • inMesh (string) – name of the skinned mesh to cleanup

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.getVertOverMaxInfluence(inObject, maxInfValue=8, progressBar=None)

get the information of the objects skincluster on if there are too many joints driving a single vertex

Parameters
  • inObject (string) – the object to gather information from

  • maxInfValue (int) – the amount of joints that are allowed to deform a vertex at once

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

vertices that have too much influences, dictionary on the specific vertex on how many influences are present

Return type

list

SkinningTools.Maya.tools.skinCluster.hammerVerts(inSelection, needsReturn=True, progressBar=None)

a quick and dirty way of smoothing vertex selection

Parameters
  • inSelection (list) – the selection of vertices that will be smoothed

  • needsReturn (bool) – if True will return a vertex list of affected vertices, if False will return default value

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed, vertices if requested

Return type

bool, list

SkinningTools.Maya.tools.skinCluster.hardSkinSelectionShells(selection, progressBar=False)

use the current selection to define islands that are clustered togehter and make sure that each island shares the same skinning information

Parameters
  • selection (list) – list of components

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

the current selection

Return type

list

SkinningTools.Maya.tools.skinCluster.keepOnlySelectedInfluences(fullSelection, jointOnlySelection, inverse=False, progressBar=None)

use the selection of joints and components to tell which joints are allowed to drive the current components

Parameters
  • fullSelection (bool) – list of meshes and joints

  • fullSelection – list of only joints

  • fullSelection – if True will remove the current joints from the selection, if False will make sure only these joints drive the components

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.neighbourAverage(components, warningPopup=True, progressBar=None)

force smooth skinning based on the current selection

Parameters
  • components (list) – current list of components

  • warningPopup (bool) – if True will open a popup when the selection might take too long, if False will not use the popup

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.seperateSkinnedObject(inMesh, progressBar=None)

seperate a skinned mesh that has different polygroups combined into multiple objects with skinning information intact

Parameters
  • inMesh (string) – the skinned mesh to split in multiple

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.setMaxJointInfluences(inObject=None, maxInfValue=8, progressBar=None)

set the information of the objects skincluster if there are too many joints driving a single vertex to be under that limit

Parameters
  • inObject (string) – the object to gather information from

  • maxInfValue (int) – the amount of joints that are allowed to deform a vertex at once

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed,

Return type

bool

SkinningTools.Maya.tools.skinCluster.smoothAndSmoothNeighbours(input, both=False, growing=False, full=True, progressBar=None)

a function that can walk over a mesh selection smooth the mesh gradually

Parameters
  • input (list) – list components

  • both (bool) – if True will smooth both the inner and outer part of the selection, if False will only smooth outside of the current selection

  • growing (bool) – if True smooth and convert the selection to the outer shell of current selection, if False will keep the same selection

  • full (bool) – if True will get any component in the outer selection that is close to the current vertex, if False will only select vertices connected by an edge

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

list of vertices in the new selection

Return type

list

SkinningTools.Maya.tools.skinCluster.switchVertexWeight(vertex1, vertex2, progressBar=None)

swap information between 2 skinned vertices

Parameters
  • vertex1 (string) – the first vertex to use skin info

  • vertex2 (string) – the second vertex to use skin info

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.transferClosestSkinning(objects, smoothValue, progressBar=None)

copy skincluster information from one object to others based on closest proximity

Parameters
  • objects (list) – objects to use for data, first selected will be used to gather data, the rest will be copied to

  • smoothValue (int) – amount of closest positions to gather data from

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.transferSkinning(baseSkin, otherSkins, inPlace=True, sAs=True, uvSpace=False, progressBar=None)

copy skincluster information from one object to others

Parameters
  • baseSkin (string) – objects to use for data

  • otherSkins (list) – objects that will get the data from the baseskin

  • inPlace (bool) – if True will delete the history on other objects before applying the skin (building new skincluster info), if False will build on top of existing skincluster info

  • sAs (bool) – if True will use surface association method to copy over information, if False will use a brute force approach

  • uvSpace (bool) – if True will use uv space information to copy skin, if False will use closest vertex position

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool

SkinningTools.Maya.tools.skinCluster.transferUvToSkinnedObject(meshSource, meshTarget, sourceMap='map1', targetMap='map1', progressBar=None)

a way to copy uv map information from a static mesh to a skinned mesh without breaking the history stack

Parameters
  • meshSource (string) – the static mesh that holds correct uv information

  • meshTarget (string) – the skinned mesh that needs to get uv information

  • sourceMap (string) – the uv map to get information from

  • targetMap (string) – the uv map to send information to

  • progressBar (QProgressBar) – progress bar instance to be used for progress display, if None it will print the progress instead

Returns

True if the function is completed

Return type

bool