Home Website Youtube GitHub

Pre and Post scripts sharing

While mGear is an awesome tool, it does sometimes require customization when a deadline is approaching.

This thread is meant to serve as a collection for all pre and post scripts people might want to share to the community.

4 Likes

ngSkinTools Importer

I was missing a way of importing ngSkinTools exports with layers, so I made this post script:

Usage
Export your skinning with https://www.ngskintools.com/. Name a folder next to the current maya file {maya_filename}.skin and save the skinning in there with {mesh_name}.json.

7 Likes

Studio Library Importer

I was missing a way to import deformation animation when rebuilding.

Usage
Export your animation with https://www.studiolibrary.com/, name it the same as the maya file and save it next to the maya file you are working with. You can also just copy/rename the folder from an existing library.
Now just add the post script to the settings.

The script will search the directory of the currently opened maya file, find {maya_filename}.anim folder and apply the animation to rig.

6 Likes

Cool idea. I’ll try to find some of mine that are not too specific to our characters.

This one maybe should have been a bug report. When I move my character hundreds of units, the mouth curves slowly begin to collapse. I fix it like this:

# a hack or solution? Mouth wires don't follow rig 100% unless you crank up the dropoffDistance.
# So when the character moves large distances, the mouth slowly begins to collapse.
for each in pm.ls(type='wire'):
    each.dropoffDistance[0].set(100)
2 Likes

@Toke_Stuart_Jepsen and @chrislesage

Thanks guys! for sharing all this with the community :smiley:

This is super good idea!

EDIT: Just pinned it globally in the forum :slight_smile:

1 Like

Eyes Rigger Importer

Usage

Name a folder next to the current maya file {maya_filename}.eyes and export your eye config there.

1 Like

Delta Mush Importer

Usage
Export your delta mush weights with Deform > Export Weights as json. Name a folder next to the current maya file “delta_mush” and name the file {maya_filename}.{mesh_name}.json.

2 Likes

Does Deform -> Export Weights actually work for you? It has been completely unusable for me, spitting out useless data and/or importing mangled data.

Yeah, it works. I export json files and import by index. Any of the other import options like “nearest” doesn’t really work for me.

BTW I’m on Maya 2019, maybe that makes a difference.

Maybe a better idea than sharing the scripts here, would be to include them in the distribution so they can be git versioned?

@Toke_Stuart_Jepsen maybe a gist?

Sure, I’ll do that instead.

With gists or posting you might forget to update the online version, but with a git repository you can see there are changes to be staged/pushed.

Hey guys, can anyone here guide us how to use these pre and post scripts? Some of us here are not TDs and all the code just looks confusing. Some visual aid would be of great assistance. I must also confess that Github is also very confusing to me.

1 Like

Hey @Ross_Daniel

Could you give us an example of which script you want to try?
There are some description of usage for some of the scripts, but don’t know where that documentation is failing you.

Can you just do a screen recording of you using anyone?

Hey @Toke_Stuart_Jepsen

Sharing the same sentiment as Daniel, I think the non full-time TD folk (such as myself) could benefit from basic fail-safe instructions on how to implement the custom steps at a local level, from a specified path.
What parts of the code can be copied from a resource template and what should be changed by the user (i.e. the path).

I think if there were such examples of:

  • import geo pre script
  • import skin pack post script
  • import face rig/lips rig/eyes rig/brows rig (I know the brows created by @Krzym aren’t official, just suggesting) post script
  • import shapes/blendshapes post script
  • import gimmick joints post script

Then even non coder can go through the full process and be able to readjust and rebuild the rig.
Some of these appear in Miguel’s workshop on YouTube, but it’s a bit complicated to follow (Different videos, different timings, sometimes he runs into errors because he writes the scripts and not uses a template and he’s using environment settings).

I know that I keep struggling with some of these and keep having to ask forum members for help.
I already nailed down the geo and skin steps, but am now trying to get the facial rigs to work.

Thank you.

1 Like

Hey @Tsahi,
I think a simple introduction to Python would help you a lot. Not saying that you should code anything, but it’s helpful to automatize repetitive tasks. Just to understand how load/unload modules and how to use some functions.

For example, to load facials, you need to load facial scripts first, and then call their functions with given parameters (in this example, JSON configs).

import mgear.shifter.custom_step as cstp
import pymel.core as pm

from mgear.rigbits import facial_rigger  #mGear\scripts\mgear\rigbits\facial_rigger 
from mgear.custom import brow_rigger2 #mGear\scripts\mgear\custom\brow_rigger2.py


class CustomShifterStep(cstp.customShifterMainStep):
    def __init__(self):
        self.name = "testscript"

    def run(self, stepDict):
        facial_rigger.eye_rigger.rig_from_file(r"D:\Dropbox\L_eyeSetup.eyes")
        facial_rigger.eye_rigger.rig_from_file(r"D:\Dropbox\R_eyeSetup.eyes")
        facial_rigger.lips_rigger.rig_from_file(r"D:\Dropbox\lipSetup.lips")
        brow_rigger2.browsFromfile(r"D:\Dropbox\browSetup.brows")

        return

If something is not working, you need to check the modules you’re trying to load.
For example, facial_rigger folder from the script above is located here, and it may vary if you have different mGear version.

mGear\scripts\mgear\rigbits\facial_rigger

@Miquel @Toke_Stuart_Jepsen Maybe it would be nice to create that support category for python scripts, just to keep that topic clean, just with pre/post scripts?

1 Like

@Krzym I think I understood these basic principles, and yet I’m struggling with it as we speak.

BTW- in the brows rig I downloaded from your Dropbox the file is called brow_rigger.py and not brow_rigger2.py
Couldn’t find any link in that thread leading to a brow_rigger2.

Sorry, I didn’t keep track of that. This will be consistent when I’ll have some time to update. You’ll need to use brow_rigger then and it should work just fine.

1 Like