85 const float imat[4][4],
111 MVert *mvert = *mvert_pp;
112 MEdge *medge = *medge_pp;
113 MLoop *mloop = *mloop_pp;
114 MPoly *mpoly = *mpoly_pp;
133 int *vgroup_index_map;
134 int vgroup_index_map_len;
136 ob_src, ob_dst, &vgroup_index_map_len);
138 dvert, me->
totvert, vgroup_index_map, vgroup_index_map_len);
139 if (vgroup_index_map !=
NULL) {
145 if (ob_src != ob_dst) {
152 for (
a = 0, mvert = *mvert_pp;
a < me->
totvert;
a++, mvert++) {
181 for (
a = 0, mvert = *mvert_pp;
a < me->
totvert;
a++,
cos++, mvert++) {
209 for (
a = 0, mvert = *mvert_pp;
a < me->
totvert;
a++,
cos++, mvert++) {
223 medge->
v1 += *vertofs;
224 medge->
v2 += *vertofs;
229 if (ob_src != ob_dst) {
244 mloop->
v += *vertofs;
245 mloop->
e += *edgeofs;
255 for (b = 0; b < totcol; b++) {
256 if (ma == matar[b]) {
280 int fmap_index_map_len;
283 if (fmap_index_map !=
NULL) {
314 int max_face_set = 0;
318 if (
abs(face_sets[f]) <= *face_set_offset) {
319 if (face_sets[f] > 0) {
320 face_sets[f] += *face_set_offset;
323 face_sets[f] -= *face_set_offset;
326 max_face_set =
max_ii(max_face_set,
abs(face_sets[f]));
328 *face_set_offset = max_face_set;
345 int a, b, totcol, totmat = 0, totedge = 0, totvert = 0;
346 int totloop = 0, totpoly = 0, vertofs, *matmap =
NULL;
347 int i, haskey = 0, edgeofs, loopofs, polyofs;
348 bool ok =
false, join_parent =
false;
367 if (ob_iter->type ==
OB_MESH) {
374 totmat += ob_iter->totcol;
418 "Joining results in %d vertices, limit is %ld",
429 matar =
MEM_callocN(
sizeof(*matar) * totmat,
"join_mesh matar");
430 matmap =
MEM_callocN(
sizeof(*matmap) * totmat,
"join_mesh matmap");
468 int face_set_id_offset = 0;
474 if ((ob != ob_iter) && (ob_iter->type ==
OB_MESH)) {
478 for (dg = ob_iter->defbase.first; dg; dg = dg->
next) {
495 memcpy(fmap_new, fmap,
sizeof(
bFaceMap));
509 for (
a = 1;
a <= ob_iter->totcol;
a++) {
512 for (b = 0; b < totcol; b++) {
513 if (ma == matar[b]) {
532 if (me->
key && key) {
546 index_map[i] = key->
totkey;
553 kbn->
data =
MEM_callocN(
sizeof(
float[3]) * totvert,
"joined_shapekey");
635 if (ob_iter->type ==
OB_MESH) {
768 bool ok =
false, nonequal_verts =
false;
771 if (ob_iter == ob_active) {
775 if (ob_iter->type ==
OB_MESH) {
776 selme = (
Mesh *)ob_iter->data;
789 if (nonequal_verts) {
795 "No additional selected meshes with equal vertex count to join");
811 if (ob_iter == ob_active) {
815 if (ob_iter->type ==
OB_MESH) {
816 selme = (
Mesh *)ob_iter->data;
859 if (me_eval !=
NULL) {
869 *r_me_mirror = me_mirror;
870 *r_em_mirror = em_mirror;
915 mvert = &mvert[index];
916 vec[0] = -mvert->
co[0];
917 vec[1] = mvert->
co[1];
918 vec[2] = mvert->
co[2];
991 return (
BMVert *)(poinval);
1001 const bool use_topology)
1036 static float *editmesh_get_mirror_uv(
1037 BMEditMesh *em,
int axis,
float *uv,
float *mirrCent,
float *face_cent)
1050 vec[1] = -((uv[1]) - mirrCent[1]) + mirrCent[1];
1052 cent_vec[0] = face_cent[0];
1053 cent_vec[1] = -((face_cent[1]) - mirrCent[1]) + mirrCent[1];
1056 vec[0] = -((uv[0]) - mirrCent[0]) + mirrCent[0];
1059 cent_vec[0] = -((face_cent[0]) - mirrCent[0]) + mirrCent[0];
1060 cent_vec[1] = face_cent[1];
1071 if ((
fabsf(cent[0] - cent_vec[0]) < 0.001f) && (
fabsf(cent[1] - cent_vec[1]) < 0.001f)) {
1077 if ((
fabsf(luv->
uv[0] - vec[0]) < 0.001f) && (
fabsf(luv->
uv[1] - vec[1]) < 0.001f)) {
1104 return ((v0 * 39) ^ (
v1 * 31));
1110 if (
a->v1 == b->
v1 &&
a->v2 == b->
v2 &&
a->v3 == b->
v3 &&
a->v4 == b->
v4) {
1113 if (
a->v4 == b->
v1 &&
a->v1 == b->
v2 &&
a->v2 == b->
v3 &&
a->v3 == b->
v4) {
1116 if (
a->v3 == b->
v1 &&
a->v4 == b->
v2 &&
a->v1 == b->
v3 &&
a->v2 == b->
v4) {
1119 if (
a->v2 == b->
v1 &&
a->v3 == b->
v2 &&
a->v4 == b->
v3 &&
a->v1 == b->
v4) {
1124 if (
a->v1 == b->
v1 &&
a->v2 == b->
v2 &&
a->v3 == b->
v3) {
1127 if (
a->v3 == b->
v1 &&
a->v1 == b->
v2 &&
a->v2 == b->
v3) {
1130 if (
a->v2 == b->
v1 &&
a->v3 == b->
v2 &&
a->v1 == b->
v3) {
1148 MFace mirrormf, *mf, *hashmf, *mface;
1150 int *mirrorverts, *mirrorfaces;
1159 mirrorverts =
MEM_callocN(
sizeof(
int) * totvert,
"MirrorVerts");
1160 mirrorfaces =
MEM_callocN(
sizeof(
int[2]) * totface,
"MirrorFaces");
1162 mvert = me_eval ? me_eval->
mvert : me->
mvert;
1163 mface = me_eval ? me_eval->
mface : me->
mface;
1167 for (
a = 0,
mv = mvert;
a < totvert;
a++,
mv++) {
1174 for (
a = 0, mf = mface;
a < totface;
a++, mf++) {
1178 for (
a = 0, mf = mface;
a < totface;
a++, mf++) {
1179 mirrormf.
v1 = mirrorverts[mf->
v3];
1180 mirrormf.
v2 = mirrorverts[mf->
v2];
1181 mirrormf.
v3 = mirrorverts[mf->
v1];
1182 mirrormf.
v4 = (mf->
v4) ? mirrorverts[mf->
v4] : 0;
1185 if (mf->
v4 && mirrormf.
v4 == 0) {
1192 mirrorfaces[
a * 2] = hashmf - mface;
1196 mirrorfaces[
a * 2] = -1;
1222 if (!me || me->
totpoly == 0) {
1241 if ((*r_index) == 0 || (*r_index) > (
uint)me->
totpoly) {
1253 const float mval[2],
1264 for (ml = &mloop[mp->
loopstart]; j--; ml++) {
1266 const int v_idx = ml->
v;
1267 const float *co = mvert[v_idx].
co;
1270 if (len_test < *r_len_best) {
1271 *r_len_best = len_test;
1272 *r_v_idx_best = v_idx;
1302 const float mval_f[2] = {
UNPACK2(mval)};
1303 float len_best = FLT_MAX;
1305 MPoly *me_eval_mpoly;
1306 MLoop *me_eval_mloop;
1307 MVert *me_eval_mvert;
1308 uint me_eval_mpoly_len;
1309 const int *index_mp_to_orig;
1311 me_eval_mpoly = me_eval->
mpoly;
1312 me_eval_mloop = me_eval->
mloop;
1313 me_eval_mvert = me_eval->
mvert;
1315 me_eval_mpoly_len = me_eval->
totpoly;
1320 if (index_mp_to_orig) {
1323 for (i = 0; i < me_eval_mpoly_len; i++) {
1324 if (index_mp_to_orig[i] == poly_index) {
1336 if (poly_index < me_eval_mpoly_len) {
1339 &me_eval_mpoly[poly_index],
1349 const int *index_mv_to_orig;
1351 if (index_mv_to_orig) {
1352 v_idx_best = index_mv_to_orig[v_idx_best];
1356 if ((v_idx_best !=
ORIGINDEX_NONE) && (v_idx_best < me->totvert)) {
1357 *r_index = v_idx_best;
1384 const float UNUSED(no_f[3]),
1385 const short UNUSED(no_s[3]))
1394 if (len < data->len_best) {
1396 data->v_idx_best = index;
1409 if (!me || me->
totvert == 0) {
1429 if ((*r_index) == 0 || (*r_index) > (
uint)me->
totvert) {
1445 const float mval_f[2] = {(
float)mval[0], (
float)mval[1]};
1451 if (me_eval ==
NULL) {
1457 data.region = region;
1458 data.mval_f = mval_f;
1459 data.len_best = FLT_MAX;
1460 data.v_idx_best = -1;
1464 if (
data.v_idx_best == -1) {
1468 *r_index =
data.v_idx_best;
1481 if (cd_dvert_offset != -1) {
1509 return me->
dvert + index;
1524 const uint objects_len,
1539 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1540 Object *obedit = objects[ob_index];
1559 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1560 Object *obedit = objects[ob_index];
typedef float(TangentPoint)[2]
struct Scene * CTX_data_scene(const bContext *C)
#define CTX_DATA_BEGIN(C, Type, instance, member)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
void CustomData_copy_data_named(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count)
void CustomData_free(struct CustomData *data, int totelem)
const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX
const CustomData_MeshMasks CD_MASK_BAREMESH
void * CustomData_get_layer(const struct CustomData *data, int type)
void * CustomData_bmesh_get(const struct CustomData *data, void *block, int type)
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
bool CustomData_merge(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
void * CustomData_get(const struct CustomData *data, int index, int type)
int CustomData_get_offset(const struct CustomData *data, int type)
const CustomData_MeshMasks CD_MASK_MESH
void CustomData_reset(struct CustomData *data)
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
struct KeyBlock * BKE_keyblock_find_name(struct Key *key, const char name[])
void BKE_keyblock_copy_settings(struct KeyBlock *kb_dst, const struct KeyBlock *kb_src)
void BKE_key_sort(struct Key *key)
void BKE_keyblock_convert_from_mesh(struct Mesh *me, struct Key *key, struct KeyBlock *kb)
struct KeyBlock * BKE_keyblock_add(struct Key *key, const char *name)
struct Key * BKE_key_add(struct Main *bmain, struct ID *id)
struct ID * BKE_id_copy(struct Main *bmain, const struct ID *id)
void id_us_min(struct ID *id)
void id_us_plus(struct ID *id)
void BKE_id_free_ex(struct Main *bmain, void *idv, int flag, const bool use_flag_from_idtag)
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
void BKE_objects_materials_test_all(struct Main *bmain, struct ID *id)
void BKE_mesh_tessface_clear(struct Mesh *mesh)
struct Mesh * BKE_mesh_from_object(struct Object *ob)
int BKE_mesh_mselect_active_get(struct Mesh *me, int type)
void BKE_mesh_calc_normals(struct Mesh *me)
void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd)
void BKE_mesh_foreach_mapped_vert(struct Mesh *mesh, void(*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]), void *userData, MeshForeachFlag flag)
struct Mesh * mesh_get_eval_deform(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const struct CustomData_MeshMasks *dataMask)
struct Mesh * mesh_get_eval_final(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const struct CustomData_MeshMasks *dataMask)
void BKE_mesh_runtime_eval_to_meshkey(struct Mesh *me_deformed, struct Mesh *me, struct KeyBlock *kb)
void multiresModifier_prepare_join(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct Object *to_ob)
struct MultiresModifierData * get_multires_modifier(struct Scene *scene, struct Object *ob, bool use_first)
General operations, lookup, etc. for blender objects.
void BKE_object_apply_mat4_ex(struct Object *ob, const float mat[4][4], struct Object *parent, const float parentinv[4][4], const bool use_compat)
void BKE_object_free_derived_caches(struct Object *ob)
Functions for dealing with object face-maps.
int * BKE_object_facemap_index_map_create(struct Object *ob_src, struct Object *ob_dst, int *r_map_len)
void BKE_object_facemap_index_map_apply(int *fmap, int fmap_len, const int *map, int map_len)
struct bFaceMap * BKE_object_facemap_find_name(struct Object *ob, const char *name)
void BKE_report(ReportList *reports, ReportType type, const char *message)
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
GHash * BLI_ghash_new_ex(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info, const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void * BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
#define LISTBASE_FOREACH(type, var, list)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void invert_m4_m4_safe_ortho(float Ainv[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
Object is a sort of wrapper for general info.
uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int center[2], const uint id_min, const uint id_max, uint *dist)
uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int center[2])
bool ED_mesh_mirrtopo_recalc_check(struct BMEditMesh *em, struct Mesh *me, MirrTopoStore_t *mesh_topo_store)
void ED_mesh_mirrtopo_init(struct BMEditMesh *em, struct Mesh *me, MirrTopoStore_t *mesh_topo_store, const bool skip_em_vert_array_init)
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store)
void ED_mesh_mirror_spatial_table_begin(struct Object *ob, struct BMEditMesh *em, struct Mesh *me_eval)
void ED_mesh_mirror_spatial_table_end(struct Object *ob)
int ED_mesh_mirror_spatial_table_lookup(struct Object *ob, struct BMEditMesh *em, struct Mesh *me_eval, const float co[3])
bool ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v)
bool ED_object_iter_other(struct Main *bmain, struct Object *orig_ob, const bool include_orig, bool(*callback)(struct Object *ob, void *callback_data), void *callback_data)
void ED_object_base_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Object *ob)
void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d)
eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *region, const float co[3], float r_co[2], const eV3DProjTest flag)
void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc, struct Depsgraph *depsgraph)
void ED_view3d_select_id_validate(struct ViewContext *vc)
#define V3D_PROJ_TEST_CLIP_DEFAULT
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_index_get(ele)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMVert * BM_mesh_active_vert_get(BMesh *bm)
void BM_mesh_elem_index_ensure_ex(BMesh *bm, const char htype, int elem_offset[4])
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
void BM_face_uv_calc_center_median(const BMFace *f, const int cd_loop_uv_offset, float r_cent[2])
const Depsgraph * depsgraph
static int elem_offset(const SDNA *sdna, const char *type, const char *name, const SDNA_Struct *old)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
struct BMEditMesh * edit_mesh
struct CustomData pdata ldata
struct MDeformVert * dvert
struct Depsgraph * depsgraph
struct ReportList * reports
__forceinline const avxi abs(const avxi &a)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)