Website Youtube GitHub

mGear Framework Forum

Mgear right-click functionality


Is it possible to assign the mgear viewport rightclick functionality to custom build nodes? This way things like mirror and reset could be implemented throughout the whole rig

The right click menu mirroring works in a pretty simple way, it checks for the “isCtl” attribute to see if the object is an mGear control, and if so it will mirror using config attributes and the default mgear naming conventions. To tag something as a control and add mirroring attributes:

from mgear.core import attribute
attribute.addAttribute(your_ctl, "isCtl", "bool", keyable=False)

If you want to customize the menu itself it’s defined in scripts/mgear/core/


Thanks for the reply @Aerys

By the way on the release there are some bugs with mirroring breaking some of the config attributes and some other details with namespaces… Hopefully on next release I will be able to have this fixed.

That’s great, @Aerys, thank you very much.

Thanks for posting this!

When I try to run this I get this error message, any idea what I may be missing? The controller I try this with has not been created through mGear, if that is what “object has no attribute” is caused by.

“# Error: AttributeError: file S:\Projects\Applications\mGear\scripts\mgear\core\ line 52: ‘str’ object has no attribute ‘hasAttr’ #”

Hi @Thomas_M

Beware that you need to pass it a PyMel Node object

import pymel.core as pm
from mgear.core import attribute
your_ctl = pm.PyNode("pCube1")
attribute.addAttribute(your_ctl, "isCtl", "bool", keyable=False)

And just for a bit of extra explanation why:

In this case, when it says “object”, it means a Python object. In Python, everything is an “object”. It’s not referring to a Maya node in your scene. And when it says “‘str’ object” it means a string object, which is text inside quotation marks.

So roughly, the error is telling you, “text inside quotation marks does not have an attribute called hasAttr”.

You can make the same error happen by running this line:
"My test string".hasAttr


Thanks Jerome and Chris for the quick reply and extended explanation!

More signs that I should really give Python basics some attention hah!