Home Website Youtube GitHub

Facial Rigger, eye rigger attributes not created

Hello!

I recently updated to Maya 2024,mGear version: 4.2.2 and noticed this error popping up when mirroring eye controls.

Traceback (most recent call last):

File “D:\sun\xxxxxxxxxx\Tools\ArtistTools\maya\Common\mgear\scripts\mgear\rigbits\mirror_controls.py”, line 161, in mirror_button_pressed

self.func.mirror_selection()

File “D:\sun\xxxxxxxxxx\Tools\ArtistTools\maya\Common\mgear\scripts\mgear\rigbits\mirror_controls.py”, line 100, in mirror_selection

target = self.get_opposite_control(source)

File “D:\sun\xxxxxxxxxx\Tools\ArtistTools\maya\Common\mgear\scripts\mgear\rigbits\mirror_controls.py”, line 15, in get_opposite_control

side_l = node.attr(“L_custom_side_label”).get()

File “C:\Users/EmilioSerrano/Documents/maya/2024/scripts/site-packages\pymel\core\nodetypes.py”, line 4176, in attr

raise e

File “C:\Users/EmilioSerrano/Documents/maya/2024/scripts/site-packages\pymel\core\nodetypes.py”, line 4170, in attr

res = self._attr(attr, checkShape)

File “C:\Users/EmilioSerrano/Documents/maya/2024/scripts/site-packages\pymel\core\nodetypes.py”, line 965, in _attr

raise general.MayaAttributeError(’%s.%s’ % (self, attr))

pymel.core.general.MayaAttributeError: Maya Attribute does not exist (or is not unique):: ‘eye_R_over_ctl.L_custom_side_label’

I haven’t tweaked anything, just the default eye rigger setup and build. Once built it does not create the Custom Side label attributes. The normal mirroring is working as expected, it is just the mirroring control tool that fails.


image

I could set a postscript for adding them after building but wondering if could be easily fixed in code.

Cheers.

1 Like

Thanks @Milio for the feedback. I need to check this
I have created a ticket

2 Likes

Hello!
I also had this same problem, it worked for me to add the missing attributes. I don’t know if there is a better solution.
Here is my little contribution, I hope it is not too late.
Let me know if you have better solutions. :blush:

import pymel.core as pm

"""
This script adds custom attributes to selected objects in Maya.
If the object's name contains '_L0_' or '_L_', the attributes are set for the left side.
If the object's name contains '_R0_' or '_R_', the attributes are set for the right side.
"""

# List of attributes to add
attributes = [
    'side_label',
    'L_custom_side_label',
    'R_custom_side_label',
    'C_custom_side_label'
]

# Get selected objects
selected_objects = pm.ls(selection=True)

# Add attribute to object
def add_attribute(obj, attr_name):
    if not obj.hasAttr(attr_name):
        pm.addAttr(obj, longName=attr_name, dataType='string')

# Set attribute values based on side
def set_attributes(obj, side):
    pm.setAttr(f"{obj}.side_label", side, type="string")
    pm.setAttr(f"{obj}.L_custom_side_label", 'L', type="string")
    pm.setAttr(f"{obj}.R_custom_side_label", 'R', type="string")
    pm.setAttr(f"{obj}.C_custom_side_label", 'C', type="string")

# Iterate over selected objects
for obj in selected_objects:
    for attr in attributes:
        add_attribute(obj, attr)
    
    obj_name = obj.name()
    if '_L0_' in obj_name or '_L_' in obj_name:
        set_attributes(obj, 'L')
    elif '_R0_' in obj_name or '_R_' in obj_name:
        set_attributes(obj, 'R')

print("Attributes added and set for selected objects.")
1 Like