Support for MESH_OT_select_mirror
Details
Details
- Reviewers
Dalai Felinto (dfelinto) Campbell Barton (campbellbarton) - Maniphest Tasks
- T54643: Multi-Object-Mode: EditMesh Tools
Diff Detail
Diff Detail
- Repository
- rB Blender
Event Timeline
Comment Actions
Thanks for your contribution.
Your patch requires a few changes to proceed though:
- We should call ED_mesh_report_mirror_ex only once per operator (instead of once per object in the loop).
- The select mode is shared across all the edit objects, so you can still use Object *obedit = CTX_data_edit_object(C); to get the em->bm->selectmode.
- You are testing for vert, edge, face selection and then for totvert and totvertsel. Stick to the totvert && totvertsel and you should be fine.
- Also it is better to fail first (if ...) { continue}, then to indent a lot of code (which we didn't do in the original code, but now with the for loop we can do).
Comment Actions
I hope I understood everything correctly.
- I moved ED_mesh_report_mirror_ex outside of the loop.
- I added the Object *obedit = CTX_data_edit_object(C); and BMEditMesh *em = BKE_editmesh_from_object(obedit); to get the em->bm->selectmode context outside of the loop.
- I changed the if statement to check if totvert == 0 and totvertsel == 0 to continue and othervise proceed
- I moved int totmirr, tofail; outside of the loop, because othervise ED_mesh_report_mirror_ex wouldn't have access to it (I'm still super new to C++, so please check this especially. Not sure if it is correct or produces a bug, if the foor loop has 0 objects and therefore tomirr and tofail never gets set).
Thank you very much for your feedback!
Comment Actions
Not entirely. But I went ahead and implemented the changes myself.
See the final commit to see the diifferences: rB3ebe389605feee1d6956b1d5f438fed55b235e7e