Home Website Youtube GitHub

Removing mGear simply but leaving skinned character

I’ve been provided a rig from an external source but it does not serve our needs.

If there a simply solution to strip all mgear constraints, dependencies and elements from the scene file without destroying the skinned mesh in itself?

The key word here is “Simple”… if there is something provide with mGear or a script that completes this the request in full, I’d be very thankful for an advice to resolve the removal of mGear.

We’re using Maya 2022.

Thanks again community!

@voxlux
mgear provides a Game Tools, you can try.
mGear 3.0: Shifter for games: Improvements

1 Like

Disconnecting all input connections from the joints and then deleting the rig should get you a clean enough scene for most purposes.

joints = pm.listRelatives("jnt_org", ad=1, type="joint")
for j in joints:
    inputConnections = j.listConnections(s=1, d=0, p=1)
    for c in inputConnections:
        c.disconnect()

pm.delete("world_ctl")
pm.delete(pm.ls(type="mgear_matrixConstraint"))
2 Likes

is this a mel script or a python script?
when i run it as a mel script i get this error :

// Error: joints = pm.listRelatives(“jnt_org”, ad=1, type=“joint”)
//
// Error: Line 1.42: Invalid use of Maya object “ad”. //

and as a python script it gives me this error :
Error: NameError: file line 1: name ‘pm’ is not defined #

this would be super usefull though i just can’t get it to run.

This script uses pymel so run this line first (I add it in usersetup.py)

import pymel.core as pm

3 Likes