Context overrides are neat and useful.
But can you trick bpy.ops.mesh.select_linked
to only operate on a specific mesh or trick it into only using a specific, designated vert/face as its ‘source’ instead of its standard behavior of operating on all selected components in edit mode? I’m guessing that the context overrides system won’t work for this because (I assume) that the edit mode mesh and the current selection are not part of the context but I figured I would ask anyway in case I’m missing something. (I might be missing something. It gets the objects from the view layer?)
For example if you had 5 separate objects in edit mode (or 1 object with 5 loose pieces), and each of them had 1 face selected, when you run select_linked the standard behavior is to select linked for all 5 objects simultaneously. But if you only wanted select_linked to operate on 1 of the objects without altering the selection of the other 4 could that be done?
I could iterate over each mesh to build a list of every selected component
selected_components = [v for v in bm.verts if v.select]
then run
bpy.ops.mesh.select_all(action='DESELECT')
then select only the 1 component that I’m interested in and run select_linked
so that it only operates on the loose piece connected to that 1 component,
and finally re-select everything from selected_components
That would have the desired effect but that first step of iterating over every component in every mesh is a heavy operation on a high-poly mesh which is exactly what I want to avoid in the first place.
The alternative, I guess, is to write my own select_linked operator from scratch since the one built into Blender doesn’t have the functionality I desire.