47 const float plane_co[3],
64 .calc_face_normal =
true,
72 if (!do_bisect_flip_axis) {
83 float plane_offset[4];
85 plane_offset[3] = plane[3] - bisect_distance;
110 .calc_face_normal =
true,
118 "symmetrize input=%avef direction=%i dist=%f use_shapekey=%b",
127 .calc_object_remap =
true,
144 int tot_vtargetmap = 0;
156 float plane_co[3], plane_no[3];
159 int *vtargetmap =
NULL, *vtmap_a =
NULL, *vtmap_b =
NULL;
163 mtx[axis][axis] = -1.0f;
166 if (mirror_ob !=
NULL) {
188 float ob_scale[3] = {
195 if (
LIKELY(ob_scale_max != 0.0f)) {
196 mul_v3_fl(ob_scale, 1.0f / ob_scale_max);
201 else if (do_bisect) {
210 mmd,
mesh, axis, plane_co, plane_no);
220 mesh, maxVerts * 2, maxEdges * 2, 0, maxLoops * 2, maxPolys * 2);
252 vtmap_a = vtargetmap;
253 vtmap_b = vtargetmap + maxVerts;
258 mv = mv_prev + maxVerts;
259 for (i = 0; i < maxVerts; i++,
mv++, mv_prev++) {
266 *vtmap_a = maxVerts + i;
286 for (
a = 0;
a < totshape;
a++) {
288 for (i = maxVerts; i <
result->totvert; i++) {
294 me =
result->medge + maxEdges;
295 for (i = 0; i < maxEdges; i++, me++) {
301 mp =
result->mpoly + maxPolys;
303 for (i = 0; i < maxPolys; i++, mp++) {
312 for (j = 1; j < mp->
totloop; j++) {
322 for (j = 0; j < mp->
totloop - 1; j++) {
323 ml2[j].
e = ml2[j + 1].
e;
331 ml =
result->mloop + maxLoops;
332 for (i = 0; i < maxLoops; i++, ml++) {
348 for (
a = 0;
a < totuv;
a++) {
352 for (; j-- > 0; dmloopuv++) {
354 float u = dmloopuv->
uv[0];
363 float v = dmloopuv->
uv[1];
380 const int totloop =
result->totloop;
381 const int totpoly =
result->totpoly;
386 float(*poly_normals)[3] =
MEM_mallocN(
sizeof(*poly_normals) * totpoly, __func__);
424 for (i = 0; i < maxPolys; i++, mp++) {
433 copy_v3_v3(loop_normals[mirrorj], loop_normals[j]);
434 mul_m4_v3(mtx_nor, loop_normals[mirrorj]);
436 lnors_spacearr.
lspacearr[mirrorj], loop_normals[mirrorj], clnors[mirrorj]);
449 int *flip_map =
NULL, flip_map_len = 0;
454 for (i = 0; i < maxVerts; dvert++, i++) {
456 if (do_vtargetmap && (vtargetmap[i] != -1)) {
471 if (tot_vtargetmap) {
478 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)
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)
struct Mesh * BKE_mesh_from_bmesh_for_eval_nomain(struct BMesh *bm, const struct CustomData_MeshMasks *cd_mask_extra, const struct Mesh *me_settings)
@ MESH_MERGE_VERTS_DUMP_IF_MAPPED
struct Mesh * BKE_mesh_merge_verts(struct Mesh *mesh, const int *vtargetmap, const int tot_vtargetmap, const int merge_mode)
void BKE_mesh_normals_loop_split(const struct MVert *mverts, const int numVerts, struct MEdge *medges, const int numEdges, struct MLoop *mloops, float(*r_loopnors)[3], const int numLoops, struct MPoly *mpolys, const float(*polynors)[3], const int numPolys, const bool use_split_normals, const 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_mesh_calc_normals_poly(struct MVert *mverts, float(*r_vertnors)[3], int numVerts, const struct MLoop *mloop, const struct MPoly *mpolys, int numLoops, int numPolys, float(*r_polyNors)[3], const bool only_face_normals)
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[3]) 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])
Mesh * BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd, Object *ob, const Mesh *mesh, const int axis)
void BKE_mesh_mirror_apply_mirror_on_axis(struct Main *bmain, Mesh *mesh, const int axis, const float dist)
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)
#define BMO_FLAG_DEFAULTS
bool BMO_op_callf(BMesh *bm, const int flag, const char *fmt,...)
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)
void *(* MEM_mallocN)(size_t len, const char *str)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
MLoopNorSpace ** lspacearr
struct CustomData pdata ldata
struct Object * mirror_ob