bmo_split_edges.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * ***** BEGIN GPL LICENSE BLOCK *****
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software Foundation,
  16. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. *
  18. * Contributor(s): Campbell Barton
  19. *
  20. * ***** END GPL LICENSE BLOCK *****
  21. */
  22. /** \file blender/bmesh/operators/bmo_split_edges.c
  23. * \ingroup bmesh
  24. *
  25. * Just a wrapper around #BM_mesh_edgesplit
  26. */
  27. #include "BLI_utildefines.h"
  28. #include "bmesh.h"
  29. #include "bmesh_tools.h"
  30. #include "intern/bmesh_operators_private.h" /* own include */
  31. /* keep this operator fast, its used in a modifier */
  32. void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
  33. {
  34. const bool use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
  35. BM_mesh_elem_hflag_disable_all(bm, BM_EDGE, BM_ELEM_TAG, false);
  36. BMO_slot_buffer_hflag_enable(bm, op->slots_in, "edges", BM_EDGE, BM_ELEM_TAG, false);
  37. if (use_verts) {
  38. /* this slows down the operation but its ok because the modifier doesn't use */
  39. BMO_slot_buffer_hflag_enable(bm, op->slots_in, "verts", BM_VERT, BM_ELEM_TAG, false);
  40. }
  41. /* this is where everything happens */
  42. BM_mesh_edgesplit(bm, use_verts, true, false);
  43. BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_TAG);
  44. }