mgear-dev / mgear4

mGear v.4.x.x (python 3 ready) https://mgear4.readthedocs.io
MIT License
264 stars 93 forks source link

attribute.py returns None and fails, if all channels are hidden #175

Closed chris-lesage closed 11 months ago

chris-lesage commented 1 year ago

http://forum.mgear-framework.com/t/select-all-controls-reset-not-working/3231/2

If a controller has all attributes hidden, then right-clicking on the control causes an error, and attempting to reset controls on the selection causes an error.

Right click: # Error: TypeError: file \mgear_4.0.9\release\scripts\mgear\core\dagmenu.py line 570: 'NoneType' object is not iterable

And resetting the control: Error: TypeError: file \mgear_4.0.9\release\scripts\mgear\core\attribute.py line 949: ‘NoneType’ object is not iterable


The proposed fix for both errors is to return an empty list when no channel is found, rather than None:

Line 1076 of attribute.py

attrs = pm.channelBox(get_channelBox(), q=True, sma=True)

should become:

attrs = pm.channelBox(get_channelBox(), q=True, sma=True) or []

Line 1082 of attribute.py

        else:
            return None

should become

        else:
            return []
chris-lesage commented 1 year ago

This is recreated in Maya 2020, 2022, and 2023, and seems to affect any version of Maya and mGear.

miquelcampos commented 11 months ago

Hi @chris-lesage I have fixed this one. it was about time 😅