Mll Interface

class ngSkinTools.mllInterface.PaintMode[source]

Constants for paint mode

class ngSkinTools.mllInterface.MllInterface(mesh=None)[source]

A wrapper object to call functionality from ngSkinLayer command. Most operations operate on current selection, or on target mesh that was set in advance. All edit operations are undoable.

Example usage:

from ngSkinTools.mllInterface import MllInterface

mll = MllInterface()

id = mll.createLayer('initial weights')


Set mesh we’ll be working on with in this wrapper. Use None to operate on current selection instead.

Parameters:mesh (str) – mesh node name/path

initializes layer data node setup for target mesh


returns true if layer data is available for target mesh

Return type:bool

get layer that is marked as selected on MLL side; current layer is used for many things, for example, as a paint target.

Return type:int

Returns a tuple with mesh and skin cluster node names where skinLayer data is (or can be) attached.

If current mesh (or selection) is not suitable for attaching layers, returns None

Return type:(str,str)

For initialized layer info, returns number of vertices layer manager sees in the mesh. This might be different to actual vertex count in the mesh, if mesh has post-skin cluster mesh modifiers (as vertex merge or smooth)

Return type:int

get layer name by ID

Parameters:layerId (int) – layer ID
Return type:str
setLayerName(layerId, name)[source]

set layer name by ID


Returns layer opacity as float between 0.0 and 1.0

setLayerOpacity(layerId, opacity)[source]

Set opacity for given layer. Use values between 0.0 and 1.0


Returns True, if layer on/off flag is turned on

setLayerEnabled(layerId, enabled)[source]

Turn layer on/off. Use True / False for ‘enabled’ value.


returns iterator to layer list; each element is a tuple: (layer ID, layer name)

listLayerInfluences(layerId=None, activeInfluences=True)[source]

returns iterator to layer influences. each element is a tuple (influence name,influence logical index)


returns layer mask weights as float list. if mask is not initialized, returns empty list

setLayerMask(layerId, weights)[source]

Set mask for given layer. Supply float list for weights, e.g. [0.0,1.0,0.6]. Supply empty list to set mask into uninitialized state.


returns layer DQ weights as float list. if DQ weights are not painted for this layer, returns empty list

setDualQuaternionWeights(layerId, weights)[source]

Set dual-quaternion weights for given layer. Supply float list for weights, e.g. [0.0,1.0,0.6]. Supply empty list to set into uninitialized state.

getInfluenceWeights(layerId, influence)[source]

returns influence weights as float list. :param influence: either a logical influence index or named influences “mask”, “dq”

setInfluenceWeights(layerId, influence, weights, undoEnabled=True)[source]

Set weights for given influence in a layer. Provide weights as float list; vertex count should match result of getVertCount() If weight values are higher than 1.0, they will be capped at 1.0.


remembers current weights and restores them after undo; redo restores weights that were there before first undo

setLayerWeightsBufferSize(layerId, numInfluences)[source]

sets layer weights buffer size no less than X influences

createLayer(name, forceEmpty=False)[source]

creates new layer with given name and returns it’s ID; when forceEmpty flag is set to true, layer weights will not be populated from skin cluster.

Returns:layer ID
Return type:int

Deletes given layer in target mesh


Set current layer :param int layerId: layerId earlier obtained via createLayer; can be None, will equate to having to current layer


universal way to set current paint target.

Parameters:paintTarget – influence index or named paint target: mask, dq;

if there is a named target selected, returns “mask” or “dq”; if no target is selected, returns None; otherwise returns influence index


Get axis that is used in the mirror operation. Can be one of: ‘x’, ‘y’, ‘z’, or ‘undefined’

mirrorLayerWeights(layerId, mirrorWidth=0.0, mirrorLayerWeights=True, mirrorLayerMask=True, mirrorDualQuaternion=True, mirrorDirection=1)[source]

Mirror weights in a layer.

  • layerId (int) – id of a target layer
  • mirrorWidth (float) – width of a seam axis
  • mirrorLayerMask (bool) – should mask be mirrored?
  • mirrorLayerWeights (bool) – should weights be mirrored?
  • mirrorDualQuaternion (bool) – should dual quaternion blend weights be mirrored?
  • mirrorDirection (int) – direction to mirror; use MirrorDirection constants for reference.
Parameters:influencesMapping (dict) – a “source->destination”
configureVertexMirrorMapping(mirrorAxis, vertexTransferMode)[source]
  • mirrorAxis – ‘X’, ‘Y’ or ‘Z’
  • vertexTransferMode – ‘uvSpace’, ‘closestPoint’

starts batch data update mode, putting layer data into suspended state - certain internal updates are switched off, making multiple layer data changes like setLayerWeights or setLayerOpacity run faster; updates will take place when endDataUpdate is called.

begin..endDataUpdate() pairs can be stacked (e.g. methods inside begin..end can call begin..end themselves) - updates will resume only when most outer pair finishes executing.


end batch update.


a helper method to use in a “with” statement, e.g.:

with mll.batchUpdateContext():

this is the same as:

setWeightsReferenceMesh(vertices, triangles)[source]

create an in-memory reference mesh with layer manager initialized; this mesh and layer info can be accessed later by setting target mesh to MllInterface.TARGET_REFERENCE_MESH.

  • vertices (list) – a float array, listing x y z for first vertex, then second, etc;
  • triangles (list) – an int array, listing vertex IDs for first triangle, then second, etc.
Returns:a list of floats, where each three values is a vertex XYZ for reference mesh vertices
Returns:a list of integers, where each three values describe mesh vert IDs that make up a triangle in the reference mesh
Returns:current value of “influence limit per vertex” setting for this mesh. 0 is returned when there’s no limit.

Set max number of influences permitted for this mesh/skin cluster. This limit will be applied as a post-processing filter, before writting data to skin cluster.

See ngSkinTools user manual for more info on this mechanic.

Parameters:limit (int) – max number of influences allowed; provide 0 or None to remove the limit.
Returns:list of logical indexes for all influences in this skin cluster
Returns:list of influence names for all influences in this skin cluster

Returns coordinates for influence pivots for all influences in this skin cluster;

Returns:a list where each element is 3-float tuple, e.g. `[(1.0,2.0,3.0),(0,0,0),...]`

Returns a list of influences in this skin cluster, where each influence is represented as importExport.InfluenceInfo.

Return type:List[ngSkinTools.importExport.InfluenceInfo]
transferWeights(targetMesh, influencesMapping, vertexTransferMode=None)[source]

Transfer weights from self.mesh onto the targetMesh. Layers are always appended to the list of existing layers; if you wish to replace old layers, delete them after the transfer (doing so before might deform the mesh and mess up vertex transfer associations).

  • targetMesh (str) – a mesh to perform transfer to
  • influencesMapping (dict) – a dictionary of [source influence logical ID]->destination influence logical ID
  • vertexTransferMode (str) – “closestPoint”,”uvSpace” or “vertexId”

Merges given layer the layer below it.

Parameters:layerId (int) – layer to be merged
pruneWeights(layerId=None, threshold=0.01)[source]

Remove weights in influence weights lower than provided threshold; upscale remaining weights, preserving transparency of the layer.

  • layerId (int) – layer to be processed; if not provided, will use currently active layer
  • threshold (float) – weights below this value will be set to 0
pruneMask(layerId=None, threshold=0.01)[source]

remove weights in layer mask lower than provided threshold;

setPaintMode(mode, intensity)[source]

Sets paint mode (replace,add,..) and it’s intensity

Parameters:mode – use PaintMode constants for that
class ngSkinTools.mllInterface.BatchUpdateContext(mll)[source]

A helper class for MllInterface.batchUpdateContext() method, helping implement “with” statement setup/teardown functionality