Website Youtube GitHub

mGear Framework Forum

Accessing Maya sets in post step

Hello :slight_smile:

I am trying to access the Maya sets that get created while building the rig because I need to rename them.

I am trying using stepDict[“mgearRun”].groups, but this seems to return lists of items in the sets, not the sets themselves.

Anybody knows how to access the sets?

Thanks in advance! :slight_smile:

Hi Carlos,

This is everything I know about this. There might be a better way.

When Shifter creates the sets, it also connects a message attribute from the ObejctSet to an attribute on your main rig group. So you can find all the sets this way:

# List all the selection sets of the rig. This returns the PyNode of the ObjectSet nodes.
# model is the top parent of the entire rig.
rig = stepDict['mgearRun'].model
for each in rig.rigGroups.inputs():

I don’t know how you would find a specific one, except by name, or querying what types of objects are in the set. The order might be the same every time. So “controllers” might always be 1. deformers might always be 3. But I’m not sure.

# This MIGHT always be the controllers set, if the order is always the same.
# Or in the stepDict

This code is in mgear_X.X/scripts/mgear/shifter/ and you could add a key to the dictionary that actually stores the PyNode to the ObjectSet itself. That could be a nice feature request. I’m adding it to my long list of ideas.

A bunch of other stuff:

stepDict["mgearRun"].groups is a dictionary containing the groups of objects. The key is the group name, and the value is the members of the group. The name of the group and the name of the ObjectSet node do not match.

By default, these 3 show up in the dictionary of groups:


That isn’t the actual name of the sets. When the sets are created, it format the name as "[rig name]_[group name]_grp". Your rig name can be found, so you could recreate the set name, but that is not very robust:

rig = stepDict['mgearRun'].model
import mgear.shifter.custom_step as cstp

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

    def run(self, stepDict):
        for eachSet, setMembers in stepDict["mgearRun"].groups.items():
            print(eachSet) # a string of the name of the "group"
            print(setMembers) # the members in the ObjectSet node.
1 Like

Hi Chris,

Thanks a lot for your answer, I really appreciate the time you took to clarify everything!

The connection to the message attribute is what I was looking for. I should be able to have the robustness that I need with that method :slight_smile:

Thanks also for clarifying the “groups” dictionary!


1 Like