Fix dagmenu right-click crash on Maya 2025#625
Open
BramVR wants to merge 3 commits intomgear-dev:masterfrom
Open
Fix dagmenu right-click crash on Maya 2025#625BramVR wants to merge 3 commits intomgear-dev:masterfrom
BramVR wants to merge 3 commits intomgear-dev:masterfrom
Conversation
cmds.controller(query=True, children=True) causes a C++ segfault in Maya 2025 when traversing certain controller tag nodes. This crashes Maya with no Python traceback, making it uncatchable by try/except. Replace cmds.controller with direct cmds.listConnections traversal of the controller tag .children and .controllerObject attributes. Also adds a seen_tags set to prevent infinite loops from circular tag references.
_get_switch_node_attrs matches any keyable user-defined attribute
ending with "ref" or "follow", but does not check attribute type.
String attributes like guide_loc_ref match and cause downstream
errors when the menu builder calls enumName on a non-enum attribute,
resulting in a NoneType.split(":") crash.
Add attribute type filter to skip string/typed attributes, and add a
null guard on the enumName query result before calling .split(":").
There was a problem hiding this comment.
Pull request overview
Fixes Maya 2025 right-click dagmenu crashes by avoiding a Maya 2025 cmds.controller segfault during controller tag traversal, and by preventing non-enum/string attributes from being treated as space-switch attributes when building the menu.
Changes:
- Reworked
get_all_tag_children()to traverse controller tags viacmds.listConnections()(with cycle protection) instead ofcmds.controller(). - Updated
_get_switch_node_attrs()to skipstring/typedattributes to avoid false-positive space-switch matches. - Added a guard for
enumNamebeingNonebefore splitting, avoiding anAttributeErrorin the space-switch menu builder.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| release/scripts/mgear/core/pickWalk.py | Replaces cmds.controller traversal with listConnections traversal + cycle protection to avoid Maya 2025 C++ segfault. |
| release/scripts/mgear/core/dagmenu.py | Filters non-switch attribute types earlier and guards enum parsing to prevent incorrect menu items / runtime errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
If the same child tag is connected from multiple parent tags, it could be queued and processed multiple times. Mark it as seen immediately when encountered instead of only when processed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cmds.controllerC++ segfault inget_all_tag_childrenthat crashes Maya 2025 on right-click (fixes cmds.controller segfault crashes Maya 2025 on dagmenu right-click #623)_get_switch_node_attrsthat matches string attributes as space-switch enums (fixes dagmenu _get_switch_node_attrs matches string attributes as space-switch attrs #624)Changes
pickWalk.py —
get_all_tag_childrenReplace
cmds.controller(query=True, children=True)with directcmds.listConnectionstraversal of controller tag.childrenand.controllerObjectattributes.cmds.controllerhas a C++ bug in Maya 2025 that segfaults on certain controller tag nodes. Also adds aseen_tagsset to prevent infinite loops from circular tag references.dagmenu.py —
_get_switch_node_attrsAdd attribute type check to skip
string/typedattributes, since space-switch attributes are always enum or numeric. String attributes likeguide_loc_refending in"ref"were matching as false positives.dagmenu.py — space-switch menu builder
Add null guard on
cmds.addAttr(query=True, enumName=True)result before calling.split(":"). Non-enum attributes returnNone, causing anAttributeError.Testing
Tested with Maya 2025 on a production rig with full controller tag hierarchy (body → spine → neck → arms → hands → fingers). Right-click menu works correctly on all control types (body, spine, arm, single and multi-selection).