Home Website Youtube GitHub

Naming convention and ngSkinTool mirroring

Hello,

I’ve just started using mGear 3.4 but I find myself having quality-of-life issues with using ngSkinTool and mGear in the same pipeline.
The thing is ngSkinTool, to mirror properly the weights, relies on inputs from the users indicating the suffix or prefix defining the side of the skinned joint. However the mGear naming convention works differently. How do you guys work around this without changing the inputs for every joint you try to mirror the skin of?

Hello @KevinBorjonPiron

Here is the script to create the mirrror in ngSkinntools (not sure if will work with ngskintools 2.0 I am still using the old version)

from ngSkinTools.mllInterface import MllInterface
import pymel.core as pm
oSel = pm.selected()[0]
oJnt = [x.fullPath() for x in pm.skinCluster(oSel, query=True, influence=True)]
mll = MllInterface()
mll.setCurrentMesh(pm.selected()[0].name())
ii = mll.listInfluenceIndexes()
ip = mll.listInfluencePaths()
inf_dict = {}
for id, i in zip(ii, ip):
    inf_dict[i] = id
mirror_dict = {}
for x in oJnt:
    if "_L" in x and x.replace("_L", "_R") in oJnt:
        mirror_dict[inf_dict[x]] = inf_dict[x.replace("_L", "_R")]
        mirror_dict[inf_dict[x.replace("_L", "_R")]] = inf_dict[x]
mll.setManualMirrorInfluences(mirror_dict)

select the geometry with the nGskintools active and run the script :wink:

3 Likes

Yeah it’s not ideal. I run into a lot of trouble too.

I use a similar script to Miquel, and sometimes it doesn’t work.

One thing I do is make sure not to use any joints that are at the exact same position. I skip one of the elbow and one of the knee joints. And then if you avoid any overlapping joints, usually ngSkin is good at matching the joints by space.

Another trick, if you can’t get past overlapping joints is to make a fake joint underneath your skin joint, offset it in position, and skin to that instead.

image

I am also working on a few issues in the skinning scripts, and I am going to make a PR that makes the lips and eyes joints have symmetrical naming. That might help with ngSkin a bit too.

2 Likes