Home Website Youtube GitHub

Rig over exisiting skeleton

Hello,

I’m looking to switch rigs on our production pipeline. We have exisiting skeleton and i wonder if it was possible through Mgear to rig over that skeleton?

Best regards.

yes it is possible. Just nee to match the guide and configuration with your existing joint structure. Later use constraints

here is a little script I did some time ago to constraint it based on proximity. But maybe a hand made 1 to 1 mapping will be better

from mgear.core import vector
import pymel.core as pm
import timeit

start = timeit.default_timer()

gJoints = pm.PyNode("spine_C0_hip_jnt").getChildren(ad=True)
meshJoints = pm.PyNode("Name of the top joint of your custom joint structure").getChildren(ad=True)
mapping = {}
for gj in gJoints:
    mindist = .09

    for mj in meshJoints:
        d = vector.getDistance2(gj, mj)
        if d < mindist:

            mapping[mj.name()] = gj


for k in mapping.keys():
    mapped =  mapping[k]
    if mapped:
        pm.parentConstraint(mapped, k, mo=True)
        pm.scaleConstraint(mapped, k, mo=True)

end = timeit.default_timer()
timeConsumed = end - start
print "{} time elapsed running".format(timeConsumed)

Cheers,
Miquel

1 Like

Thanks, i’ll keep you posted about it! :slight_smile: