31 const float plane_co[3],
48 .calc_face_normal =
true,
49 .calc_vert_normal =
true,
57 if (!do_bisect_flip_axis) {
68 float plane_offset[4];
70 plane_offset[3] = plane[3] - bisect_distance;
95 .calc_face_normal =
true,
96 .calc_vert_normal =
true,
104 "symmetrize input=%avef direction=%i dist=%f use_shapekey=%b",
113 .calc_object_remap =
true,
123 const bool use_correct_order_on_merge)
127 int tot_vtargetmap = 0;
139 float plane_co[3], plane_no[3];
142 int *vtargetmap =
NULL, *vtmap_a =
NULL, *vtmap_b =
NULL;
146 mtx[axis][axis] = -1.0f;
149 if (mirror_ob !=
NULL) {
171 float ob_scale[3] = {
178 if (
LIKELY(ob_scale_max != 0.0f)) {
179 mul_v3_fl(ob_scale, 1.0f / ob_scale_max);
184 else if (do_bisect) {
193 mmd,
mesh, axis, plane_co, plane_no);
203 mesh, maxVerts * 2, maxEdges * 2, 0, maxLoops * 2, maxPolys * 2);
235 vtmap_a = vtargetmap;
236 vtmap_b = vtargetmap + maxVerts;
241 mv = mv_prev + maxVerts;
242 for (i = 0; i < maxVerts; i++,
mv++, mv_prev++) {
259 if (use_correct_order_on_merge) {
277 *vtmap_a = maxVerts + i;
299 for (
a = 0;
a < totshape;
a++) {
301 for (i = maxVerts; i <
result->totvert; i++) {
307 me =
result->medge + maxEdges;
308 for (i = 0; i < maxEdges; i++, me++) {
314 mp =
result->mpoly + maxPolys;
316 for (i = 0; i < maxPolys; i++, mp++) {
325 for (j = 1; j < mp->
totloop; j++) {
335 for (j = 0; j < mp->
totloop - 1; j++) {
336 ml2[j].
e = ml2[j + 1].
e;
344 ml =
result->mloop + maxLoops;
345 for (i = 0; i < maxLoops; i++, ml++) {
361 for (
a = 0;
a < totuv;
a++) {
365 for (; j-- > 0; dmloopuv++) {
367 float u = dmloopuv->
uv[0];
376 float v = dmloopuv->
uv[1];
393 const int totloop =
result->totloop;
394 const int totpoly =
result->totpoly;
427 for (i = 0; i < maxPolys; i++, mp++) {
436 copy_v3_v3(loop_normals[mirrorj], loop_normals[j]);
437 mul_m4_v3(mtx_nor, loop_normals[mirrorj]);
439 lnors_spacearr.
lspacearr[mirrorj], loop_normals[mirrorj], clnors[mirrorj]);
452 int flip_map_len = 0;
455 for (i = 0; i < maxVerts; dvert++, i++) {
457 if (use_correct_order_on_merge && do_vtargetmap && (vtargetmap[i + maxVerts] != -1)) {
460 else if (!use_correct_order_on_merge && do_vtargetmap && (vtargetmap[i] != -1)) {
476 if (tot_vtargetmap) {
483 if (mesh_bisect !=
NULL) {
typedef float(TangentPoint)[2]
int CustomData_number_of_layers(const struct CustomData *data, int type)
bool CustomData_has_layer(const struct CustomData *data, int type)
void * CustomData_get_layer_n(const struct CustomData *data, int type, int n)
void * CustomData_get_layer(const struct CustomData *data, int type)
void CustomData_copy_data(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count)
void BKE_id_free(struct Main *bmain, void *idv)
const float(* BKE_mesh_poly_normals_ensure(const struct Mesh *mesh))[3]
@ MESH_MERGE_VERTS_DUMP_IF_MAPPED
struct Mesh * BKE_mesh_new_nomain_from_template(const struct Mesh *me_src, int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
struct BMesh * BKE_mesh_to_bmesh_ex(const struct Mesh *me, const struct BMeshCreateParams *create_params, const struct BMeshFromMeshParams *convert_params)
const float(* BKE_mesh_vertex_normals_ensure(const struct Mesh *mesh))[3]
struct Mesh * BKE_mesh_from_bmesh_for_eval_nomain(struct BMesh *bm, const struct CustomData_MeshMasks *cd_mask_extra, const struct Mesh *me_settings)
struct Mesh * BKE_mesh_merge_verts(struct Mesh *mesh, const int *vtargetmap, int tot_vtargetmap, int merge_mode)
void BKE_mesh_normals_loop_split(const struct MVert *mverts, const float(*vert_normals)[3], int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, float(*r_loopnors)[3], int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, bool use_split_normals, float split_angle, MLoopNorSpaceArray *r_lnors_spacearr, short(*clnors_data)[2], int *r_loop_to_poly)
void BKE_lnor_spacearr_free(MLoopNorSpaceArray *lnors_spacearr)
void BKE_lnor_space_custom_normal_to_data(MLoopNorSpace *lnor_space, const float custom_lnor[3], short r_clnor_data[2])
MINLINE float max_fff(float a, float b, float c)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
MINLINE float plane_point_side_v3(const float plane[4], const float co[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void unit_m4(float m[4][4])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
#define mul_m4_series(...)
void transpose_m4(float R[4][4])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3(float r[3])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE bool is_zero_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
#define CD_MASK_ORIGINDEX
@ MOD_MIR_BISECT_FLIP_AXIS_X
@ MOD_MIR_BISECT_FLIP_AXIS_Z
@ MOD_MIR_BISECT_FLIP_AXIS_Y
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
Mesh * BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(MirrorModifierData *mmd, const Mesh *mesh, int axis, const float plane_co[3], float plane_no[3])
void BKE_mesh_mirror_apply_mirror_on_axis(struct Main *bmain, Mesh *mesh, const int axis, const float dist)
Mesh * BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd, Object *ob, const Mesh *mesh, const int axis, const bool use_correct_order_on_merge)
void BM_mesh_bisect_plane(BMesh *bm, const float plane[4], const bool use_snap_center, const bool use_tag, const short oflag_center, const short oflag_new, const float eps)
void BM_vert_kill(BMesh *bm, BMVert *v)
#define BM_ITER_MESH_MUTABLE(ele, ele_next, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMeshParams *params)
bool BMO_op_callf(BMesh *bm, int flag, const char *fmt,...)
#define BMO_FLAG_DEFAULTS
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
MLoopNorSpace ** lspacearr
struct Object * mirror_ob