mgear-dev / rigbits

Rigging tools and boilerplate functions for rigging.
MIT License
10 stars 14 forks source link

Mirror Controls Tool #25

Closed tokejepsen closed 5 years ago

tokejepsen commented 5 years ago

Related forum thread: http://forum.mgear-framework.com/t/control-mirror-tool/531

miquelcampos commented 5 years ago

@tokejepsen just on thing

The tool assume that the controllers_grp is always name "rig_controllersgrp" but the prefix "rig" is indeed the name you set in the rig name setting image

Maybe not the best solution but here is how I search for the group (cough cough... Maya set :P )

import pymel.core as pm
rig_models = [item for item in pm.ls(transforms=True) if item.hasAttr("is_rig")]
for g in rig_models[0].rigGroups.inputs():
    if g.name().endswith("controllers_grp"):
        ct_grp = g
        break

print g

# with cmds is a little faster
import pymel.core as pm
import maya.cmds as cm
rig_models = [item for item in cm.ls(transforms=True) if cm.attributeQuery("is_rig", node=item, exists=True)]
for g in pm.PyNode(rig_models[0]).rigGroups.inputs():
    if g.name().endswith("controllers_grp"):
        ct_grp = g
        break

print g
tokejepsen commented 5 years ago

The tool assume that the controllers_grp is always name "rig_controllersgrp" but the prefix "rig" is indeed the name you set in the rig name setting

Didn't think about that. Thanks :)

Updated the PR.

miquelcampos commented 5 years ago

that was fast!

tokejepsen commented 5 years ago

that was fast!

Well you gave me the solution :)