Home Website Youtube GitHub

Control mirroring broken

Hi,
I am using mgear 4.0.9 and have changed side names to lowercase. It seems that mirroring is broken after for the left and right sides. I get the following error:

# Traceback (most recent call last):
# #   File "C:\Users\myname\Documents\maya\modules\scripts\mgear\core\anim_utils.py", line 1112, in mirrorPose
    applyMirror(nameSpace, dat)
# #   File "C:\Users\myname\Documents\maya\modules\scripts\mgear\core\anim_utils.py", line 1151, in applyMirror
    .format(node.name(), attr, e), mgear.sev_error)
# AttributeError: 'NoneType' object has no attribute 'name'
'NoneType' object has no attribute 'name'

Mirroring how? Please list the exact steps you are doing.

1 Like

Thanks for the reply. I am setting up names here

I asked where/how you are mirroring.

Sorry, I misunderstood. I am mirroring through viewport dropdown box.

1 Like

@chrislesage Can you please tell me how can I make it work?

  1. You can change your naming convention to use capital L and R.

  2. You can edit the code in scripts/mgear/core/anim_utils.py - Line 93 is a function swapSideLabel(name)

That function is hard coded to work with capital L and R. This is where the trouble is happening.

  1. You can wait for a potential fix. It looks like someone contributed a potential fix just 5 days ago, and Miquel needs to review it. This has been an open issue for a while:

(Moving this to Help since it is already an open bug elsewhere.)

1 Like

Thank you. I will try it out. It would be interesting to see if shared will contain the changes.

Hello, I tried to swap the RL with rl but it didn’t work. I am using 4.0.9 version.

Hi, I tried the solution and tried replacing L and R in the script but it didn’t work however, without changing the script, I am getting the following error:

# Traceback (most recent call last):
# #   File "C:\Users\Documents\scripts\mgear\core\anim_utils.py", line 1206, in mirrorPose
    applyMirror(nameSpace, dat)
# #   File "C:\Users\Documents\scripts\mgear\core\anim_utils.py", line 1249, in applyMirror
    "applyMirror failed: {0} {1}: {2}".format(node.name(), attr, e),
# AttributeError: 'NoneType' object has no attribute 'name'
'NoneType' object has no attribute 'name'

"Hi @utkarsh_6, I hope this message finds you well. I wanted to inform you that I’ve submitted a pull request to address the mirroring bug when you mirror the controller through the viewport dagmenu. This bug occurs when using custom control naming patterns or when side names ‘L’ and ‘R’ are changed.

The fix involves swapping the side label in control names based on the rig’s naming convention. It adapts dynamically by using guide data’s naming patterns to identify and swap the current side label, e.g., from ‘L’ to ‘R’ and vice versa."

You will be able to mirror them correctly once @Miquel reviews and merges this PR.

Best,

Thanks. That would be really helpful :slight_smile:

Hello,
I wanted to inform you that the function get_opposite_control(node) inside mirror_controls.py isn’t checking sides properly.
For exemple : i have a controller named “Ctrl_L_Leg_Root” but the function checks for a controller named “Ctrl_R_Reg_Root” because it replaces every “L” in naming and don’t care about naming rules.

I’m overrinding the function but would love to have a real fix !
I’m on mgear 4.2.2, maya 2023.

2 Likes

I have had this issue also and patched the code.

Here’s the link to the bug number and the current fix I have authored.

3 Likes