Home Website Youtube GitHub

Guide Template Export Custom step

Hello,

Is there a way instead of going through mgear UI and exporting a guide to write a custom step where I can export/import the guide with a script? I couldn’t find any info on this maybe someone figured it out?

many thanks,
Vito

I have a custom_step.py file that loads custom_steps saved in the same folder as the asset. So all rigs get this step and a few other master steps added to them. But this then enables per-rig steps.

Does this help?

Hey Dave thanks for coming back to me, I’m not sure what you mean exactly but I would try to elaborate more. If you have another spare minute to check this.

My current setup is my scripts/post/pre separate guide folder and separate skin folder per project. I’m working on simple stuff so what I do atm is I load my file and click on mgear UI / import guide template and then build. I’m trying to eliminate that. I want to make either a shelf button to import guides from ( i have defined guide paths ) straight away into the scene and then I would like to use guide_manager.build_from_selection() in the same script so basically I just open the file and it builds. But I don’t know how to call a guide? what is the function for " import guide template " ? eventually the goal would be building or rebuilding without opening maya but that’s too advanced for me atm so this solution would really help

Is this of any use to you? I was able to put this together by reading the source code.


guide_path = r"SomeFilePath.sgt"
# path to your saved template file

def import_mgear_guide(path):
    '''
    loads the template into memory and then builds the template in your scene
    '''
    import mgear.shifter.io as io
    template = io._import_guide_template(path)
    io.import_partial_guide(conf=template)

def build_guide():
    '''
    A guide has the attribute "Is Model".  This will build all guides in the scene.
    '''
    pm.select([n.node() for n in pm.ls("*.ismodel")])
    from mgear.shifter import guide_manager
    guide_manager.build_from_selection()

# Use like this
import_mgear_guide(guide_path)
build_guide()
2 Likes

OH! Yes, that’s exactly what I was looking for this is great! thanks once again. Works great!