fix(grid): find()/findAll() descend into grids again
McRFPy_API::find_in_collection gated its descent into a grid's entities and overlay children on derived_type() == PyObjectsEnum::UIGRID — dead since #252, because every mcrfpy.Grid in a scene graph is a UIGRIDVIEW. Named entities and named child drawables inside a Grid were simply unfindable. Uses the UIDrawable::asGridData() virtual added by #355 rather than adding a UIGRIDVIEW arm next to the dead UIGRID one, which would only relocate the bug. Two defects found in review of the now-reachable code: - find_in_grid_entities built Entity wrappers with a raw tp_alloc, bypassing the PythonObjectCache lookup every other entity accessor performs. When the duplicate wrapper was deallocated, PyUIEntityType's tp_dealloc unconditionally ran `self->data->pyobject = nullptr`, dropping the entity's #266 strong identity reference without a DECREF. It now consults the cache first, exactly as UIEntityCollection::getitem does, so find('hero') returns the user's Hero instance rather than a base Entity. - With N views sharing one GridData (the split-screen/minimap case), the asGridData() recursion visited the shared data once per view, so findAll() returned every grid entity and child N times. find_in_collection now threads a visited-GridData set. closes #357 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
85e4bbec07
commit
086c886d70
3 changed files with 248 additions and 50 deletions
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue