Home Website Youtube GitHub

Accessing Guide Info in CustomStep

Hi folks,
Is there an easy way to grab info about the guide that has been selected to trigger the current build in a pre custom step.

In particular, I’m looking to grab the name of the guide node that is being operated on when guide_manager.build_from_selection()
was called.

Welcome Toby,

Yes, first if you don’t know if you make a new script from the mGear GUI, it gives you some automatic boilerplate. Did you do that already?

If yes, you can access the guide like this, in the run method that has “stepDict” as one of the parameters:

        myModel = stepDict['mgearRun'].model

If you didn’t create the boilerplate, just make a test script from the GUI and grab what it gives you. Or here is an excerpt of one of my scripts, with some inline comments:

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

class CustomShifterStep(cstp.customShifterMainStep):
    def __init__(self):
        # Here I grab the rig name too and store it as a class property:
        # I think there is a way to get the name from the stepDict too, but this is what I figured out first and kept using.
        self.charName = pm.PyNode('guide').rig_name.get()
        self.myModel = stepDict['mgearRun'].model

    def run(self, stepDict):
        
        return


1 Like

Some more information about the stepDict:

Hi Chris, thanks for getting back to me.

I am using the standard CustomShifterStep boiler plate. I think I’ve ended up answering my own question but I’ll detail it out here for posterity in case anyone else finds it useful.

For pipeline reasons we are using “Rig” as the .model (top node) name and then adding “{char_name}:” namespace when the rig is referenced into an animation scene. I was trying to find an alternative to the Rig Name attribute for identifying the rig.

In the end, I’ve used Rig Name attribute and in a post step renamed the .model (top node) of the rig using the examples you outline here: