This issue has been driving me nuts and if not fixed, makes all my selection add-ons useless.
I've done a TON of testing and found when it occurs.
This is how it works:
When you select any geometry with any select operator(bpy or bmesh) and the code is executed by a custom operator, the redo panel will deselect the geometry selected by the script and only leave one unselected.
As you can see the operator is super bare bones, no junk code, yet the issue still occurs.
To confirm that this is a fault with a custom operator, I selected the edges with the same code, just without the operator. And I didn't run into any issues.
The demo speaks for it self:
I have no idea how this not already a big issue. I haven't seen anybody complain about this. But with this behaviour it tells me that it's a bug. I wish do death that I could fix it, but it seems I can't.
If anybody has any idea what's going on, please share it!
I also wanna note that I have rolled back my Blender to the most vanilla, factory settings possible. No addons are running and I'm using the default keymap.
Here's the code for testing:
import bpy
import bmesh
from bpy.types import Operator
class OT_SELECT_WITH_OPERATOR(Operator):
bl_idname= "view3d.select_with_operator"
bl_label = "Select With Operator"
def execute(self, context):
print('run')
obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
for e in bm.edges:
e.select = True
bmesh.update_edit_mesh(me, True)
return{'FINISHED'}
def register():
bpy.utils.register_class(OT_SELECT_WITH_OPERATOR)
def unregister():
bpy.utils.unregister_class(OT_SELECT_WITH_OPERATOR)
if __name__ == "__main__":
register()