Changeset View
Changeset View
Standalone View
Standalone View
source/blender/bmesh/operators/bmo_dupe.c
| Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | void bmo_duplicate_exec(BMesh *bm, BMOperator *op) | ||||
| bmo_mesh_copy(dupeop, bm_dst, bm); | bmo_mesh_copy(dupeop, bm_dst, bm); | ||||
| /* Output */ | /* Output */ | ||||
| /* First copy the input buffers to output buffers - original data */ | /* First copy the input buffers to output buffers - original data */ | ||||
| BMO_slot_copy(dupeop, slots_in, "geom", | BMO_slot_copy(dupeop, slots_in, "geom", | ||||
| dupeop, slots_out, "geom_orig.out"); | dupeop, slots_out, "geom_orig.out"); | ||||
| /* Now alloc the new output buffers */ | /* Now alloc the new output buffers */ | ||||
| BMO_slot_buffer_from_enabled_flag(bm, dupeop, dupeop->slots_out, "geom.out", BM_ALL_NOLOOP, DUPE_NEW); | BMO_slot_buffer_from_enabled_flag(bm_dst, dupeop, dupeop->slots_out, "geom.out", BM_ALL_NOLOOP, DUPE_NEW); | ||||
| } | } | ||||
| #if 0 /* UNUSED */ | #if 0 /* UNUSED */ | ||||
| /* executes the duplicate operation, feeding elements of | /* executes the duplicate operation, feeding elements of | ||||
| * type flag etypeflag and header flag flag to it. note, | * type flag etypeflag and header flag flag to it. note, | ||||
| * to get more useful information (such as the mapping from | * to get more useful information (such as the mapping from | ||||
| * original to new elements) you should run the dupe op manually */ | * original to new elements) you should run the dupe op manually */ | ||||
| void BMO_dupe_from_flag(BMesh *bm, int htype, const char hflag) | void BMO_dupe_from_flag(BMesh *bm, int htype, const char hflag) | ||||
| Show All 37 Lines | #define SPLIT_INPUT 1 | ||||
| BMOperator dupeop; | BMOperator dupeop; | ||||
| const bool use_only_faces = BMO_slot_bool_get(op->slots_in, "use_only_faces"); | const bool use_only_faces = BMO_slot_bool_get(op->slots_in, "use_only_faces"); | ||||
| /* initialize our sub-operator */ | /* initialize our sub-operator */ | ||||
| BMO_op_init(bm, &dupeop, op->flag, "duplicate"); | BMO_op_init(bm, &dupeop, op->flag, "duplicate"); | ||||
| BMO_slot_copy(splitop, slots_in, "geom", | BMO_slot_copy(splitop, slots_in, "geom", | ||||
| &dupeop, slots_in, "geom"); | &dupeop, slots_in, "geom"); | ||||
| BMO_slot_copy(splitop, slots_in, "dest", | |||||
| &dupeop, slots_in, "dest"); | |||||
| BMO_op_exec(bm, &dupeop); | BMO_op_exec(bm, &dupeop); | ||||
| BMO_slot_buffer_flag_enable(bm, splitop->slots_in, "geom", BM_ALL_NOLOOP, SPLIT_INPUT); | BMO_slot_buffer_flag_enable(bm, splitop->slots_in, "geom", BM_ALL_NOLOOP, SPLIT_INPUT); | ||||
| if (use_only_faces) { | if (use_only_faces) { | ||||
| BMVert *v; | BMVert *v; | ||||
| BMEdge *e; | BMEdge *e; | ||||
| BMFace *f; | BMFace *f; | ||||
| Show All 28 Lines | #define SPLIT_INPUT 1 | ||||
| } | } | ||||
| /* connect outputs of dupe to delete, exluding keep geometry */ | /* connect outputs of dupe to delete, exluding keep geometry */ | ||||
| BMO_mesh_delete_oflag_context(bm, SPLIT_INPUT, DEL_FACES); | BMO_mesh_delete_oflag_context(bm, SPLIT_INPUT, DEL_FACES); | ||||
| /* now we make our outputs by copying the dupe output */ | /* now we make our outputs by copying the dupe output */ | ||||
| BMO_slot_copy(&dupeop, slots_out, "geom.out", | BMO_slot_copy(&dupeop, slots_out, "geom.out", | ||||
| splitop, slots_out, "geom.out"); | splitop, slots_out, "geom.out"); | ||||
| BMO_slot_copy(&dupeop, slots_out, "boundary_map.out", | |||||
| splitop, slots_out, "boundary_map.out"); | |||||
| BMO_slot_copy(&dupeop, slots_out, "isovert_map.out", | |||||
| splitop, slots_out, "isovert_map.out"); | |||||
| /* cleanup */ | /* cleanup */ | ||||
| BMO_op_finish(bm, &dupeop); | BMO_op_finish(bm, &dupeop); | ||||
| #undef SPLIT_INPUT | #undef SPLIT_INPUT | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines | |||||