-
Notifications
You must be signed in to change notification settings - Fork 126
Description
Description
_get_switch_node_attrs() in dagmenu.py matches any keyable user-defined attribute whose name ends with a given suffix (e.g. "ref", "follow"), but does not check the attribute type. String attributes like guide_loc_ref match the "ref" suffix and are returned as space-switch attributes.
Impact
-
False positive matching:
guide_loc_ref(a string attribute with value"root") is treated as a space-switch enum, causing incorrectui_hostdetermination and bogus menu items. -
NoneType crash: When the false-positive string attribute reaches the space-switch menu builder,
cmds.addAttr(query=True, enumName=True)returnsNonefor a non-enum attribute. The code calls.split(":")directly on the result, raisingAttributeError: 'NoneType' object has no attribute 'split'.
Steps to Reproduce
- Have a control with a string attribute ending in
"ref"(e.g.guide_loc_ref) but no real space-switch enum attributes - Right-click on that control
- The dagmenu either shows incorrect space-switch items or crashes with an AttributeError
Note: In practice this is currently masked by the cmds.controller segfault (#XXX) which crashes Maya before this code is reached.
Proposed Fix
- Add an attribute type check in
_get_switch_node_attrsto skip attributes of type"string"or"typed", since space-switch attributes are always enum or numeric. - Add a null guard on the
enumNamequery result before calling.split(":").
Metadata
Metadata
Assignees
Labels
Type
Projects
Status