Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-06-04 09:06:14 +02:00
commit 5b64301834
60 changed files with 422 additions and 419 deletions

@ -212,20 +212,21 @@ ccl_device_intersect void scene_intersect_local(KernelGlobals *kg,
{ {
#ifdef __OBJECT_MOTION__ #ifdef __OBJECT_MOTION__
if(kernel_data.bvh.have_motion) { if(kernel_data.bvh.have_motion) {
return bvh_intersect_local_motion(kg, bvh_intersect_local_motion(kg,
&ray, &ray,
local_isect, local_isect,
local_object, local_object,
lcg_state, lcg_state,
max_hits); max_hits);
return;
} }
#endif /* __OBJECT_MOTION__ */ #endif /* __OBJECT_MOTION__ */
return bvh_intersect_local(kg, bvh_intersect_local(kg,
&ray, &ray,
local_isect, local_isect,
local_object, local_object,
lcg_state, lcg_state,
max_hits); max_hits);
} }
#endif #endif

@ -246,20 +246,22 @@ ccl_device_inline void BVH_FUNCTION_NAME(KernelGlobals *kg,
switch(kernel_data.bvh.bvh_layout) { switch(kernel_data.bvh.bvh_layout) {
#ifdef __QBVH__ #ifdef __QBVH__
case BVH_LAYOUT_BVH4: case BVH_LAYOUT_BVH4:
return BVH_FUNCTION_FULL_NAME(QBVH)(kg, BVH_FUNCTION_FULL_NAME(QBVH)(kg,
ray, ray,
local_isect, local_isect,
local_object, local_object,
lcg_state, lcg_state,
max_hits); max_hits);
break;
#endif #endif
case BVH_LAYOUT_BVH2: case BVH_LAYOUT_BVH2:
return BVH_FUNCTION_FULL_NAME(BVH)(kg, BVH_FUNCTION_FULL_NAME(BVH)(kg,
ray, ray,
local_isect, local_isect,
local_object, local_object,
lcg_state, lcg_state,
max_hits); max_hits);
break;
} }
kernel_assert(!"Should not happen"); kernel_assert(!"Should not happen");
} }

@ -249,4 +249,4 @@ classes = (
ProjectApply, ProjectApply,
ProjectEdit, ProjectEdit,
SaveDirty, SaveDirty,
) )

@ -35,4 +35,4 @@ class MASK_MT_add(Menu):
classes = ( classes = (
MASK_MT_add, MASK_MT_add,
) )

@ -184,4 +184,4 @@ class PlayRenderedAnim(Operator):
classes = ( classes = (
PlayRenderedAnim, PlayRenderedAnim,
) )

@ -140,4 +140,4 @@ classes = (
SequencerCrossfadeSounds, SequencerCrossfadeSounds,
SequencerCutMulticam, SequencerCutMulticam,
SequencerDeinterlaceSelectedMovies, SequencerDeinterlaceSelectedMovies,
) )

@ -118,7 +118,7 @@ class DOPESHEET_HT_header(Header):
row = layout.row(align=True) row = layout.row(align=True)
row.template_header() row.template_header()
# XXX: perhaps our mode menu can be retired eventually when we get editor submodes in the main menu? # XXX: perhaps our mode menu can be retired eventually when we get editor submodes in the main menu?
layout.prop(st, "mode", text="") layout.prop(st, "mode", text="")

@ -292,7 +292,7 @@ class TIME_PT_keyframing_settings(TimelinePanelButtons, Panel):
col = layout.column(align=True) col = layout.column(align=True)
col.label("New Keyframe Type:") col.label("New Keyframe Type:")
col.prop(toolsettings, "keyframe_type", text="") col.prop(toolsettings, "keyframe_type", text="")
col = layout.column(align=True) col = layout.column(align=True)
col.label("Auto Keyframing:") col.label("Auto Keyframing:")
row = col.row() row = col.row()

@ -119,7 +119,7 @@ typedef struct BMEdge {
/* the list of loops around the edge (use l->radial_prev/next) /* the list of loops around the edge (use l->radial_prev/next)
* to access the other loops using the edge */ * to access the other loops using the edge */
struct BMLoop *l; struct BMLoop *l;
/* disk cycle pointers /* disk cycle pointers
* relative data: d1 indicates indicates the next/prev edge around vertex v1 and d2 does the same for v2 */ * relative data: d1 indicates indicates the next/prev edge around vertex v1 and d2 does the same for v2 */
BMDiskLink v1_disk_link, v2_disk_link; BMDiskLink v1_disk_link, v2_disk_link;
@ -229,7 +229,7 @@ typedef struct BMesh {
int toolflag_index; int toolflag_index;
struct BMOperator *currentop; struct BMOperator *currentop;
CustomData vdata, edata, ldata, pdata; CustomData vdata, edata, ldata, pdata;
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
@ -241,10 +241,10 @@ typedef struct BMesh {
* make sure they're in sync! * make sure they're in sync!
* Only use when the edit mesh cant be accessed - campbell */ * Only use when the edit mesh cant be accessed - campbell */
short selectmode; short selectmode;
/* ID of the shape key this bmesh came from */ /* ID of the shape key this bmesh came from */
int shapenr; int shapenr;
int totflags; int totflags;
ListBase selected; ListBase selected;

@ -712,7 +712,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
/* safety check */ /* safety check */
BLI_assert(i == bm_old->totvert); BLI_assert(i == bm_old->totvert);
BM_ITER_MESH_INDEX (e, &iter, bm_old, BM_EDGES_OF_MESH, i) { BM_ITER_MESH_INDEX (e, &iter, bm_old, BM_EDGES_OF_MESH, i) {
e_new = BM_edge_create(bm_new, e_new = BM_edge_create(bm_new,
vtable[BM_elem_index_get(e->v1)], vtable[BM_elem_index_get(e->v1)],
@ -730,7 +730,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
/* safety check */ /* safety check */
BLI_assert(i == bm_old->totedge); BLI_assert(i == bm_old->totedge);
BM_ITER_MESH_INDEX (f, &iter, bm_old, BM_FACES_OF_MESH, i) { BM_ITER_MESH_INDEX (f, &iter, bm_old, BM_FACES_OF_MESH, i) {
BM_elem_index_set(f, i); /* set_inline */ BM_elem_index_set(f, i); /* set_inline */

@ -158,7 +158,7 @@ BMEdge *BM_edge_create(
if ((create_flag & BM_CREATE_NO_DOUBLE) && (e = BM_edge_exists(v1, v2))) if ((create_flag & BM_CREATE_NO_DOUBLE) && (e = BM_edge_exists(v1, v2)))
return e; return e;
e = BLI_mempool_alloc(bm->epool); e = BLI_mempool_alloc(bm->epool);
@ -286,7 +286,7 @@ static BMLoop *bm_face_boundary_add(
BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool); BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool);
#endif #endif
BMLoop *l = bm_loop_create(bm, startv, starte, f, NULL /* starte->l */, create_flag); BMLoop *l = bm_loop_create(bm, startv, starte, f, NULL /* starte->l */, create_flag);
bmesh_radial_loop_append(starte, l); bmesh_radial_loop_append(starte, l);
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
@ -295,7 +295,7 @@ static BMLoop *bm_face_boundary_add(
#else #else
f->l_first = l; f->l_first = l;
#endif #endif
return l; return l;
} }
@ -330,7 +330,7 @@ BMFace *BM_face_copy(
do { do {
if (copy_edges) { if (copy_edges) {
BMVert *v1, *v2; BMVert *v1, *v2;
if (l_iter->e->v1 == verts[i]) { if (l_iter->e->v1 == verts[i]) {
v1 = verts[i]; v1 = verts[i];
v2 = verts[(i + 1) % f->len]; v2 = verts[(i + 1) % f->len];
@ -339,7 +339,7 @@ BMFace *BM_face_copy(
v2 = verts[i]; v2 = verts[i];
v1 = verts[(i + 1) % f->len]; v1 = verts[(i + 1) % f->len];
} }
edges[i] = BM_edge_create(bm_dst, v1, v2, l_iter->e, BM_CREATE_NOP); edges[i] = BM_edge_create(bm_dst, v1, v2, l_iter->e, BM_CREATE_NOP);
} }
else { else {
@ -347,11 +347,11 @@ BMFace *BM_face_copy(
} }
i++; i++;
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
f_copy = BM_face_create(bm_dst, verts, edges, f->len, NULL, BM_CREATE_SKIP_CD); f_copy = BM_face_create(bm_dst, verts, edges, f->len, NULL, BM_CREATE_SKIP_CD);
BM_elem_attrs_copy(bm_src, bm_dst, f, f_copy); BM_elem_attrs_copy(bm_src, bm_dst, f, f_copy);
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
l_copy = BM_FACE_FIRST_LOOP(f_copy); l_copy = BM_FACE_FIRST_LOOP(f_copy);
do { do {
@ -463,12 +463,12 @@ BMFace *BM_face_create(
lastl->next = l; lastl->next = l;
lastl = l; lastl = l;
} }
startl->prev = lastl; startl->prev = lastl;
lastl->next = startl; lastl->next = startl;
f->len = len; f->len = len;
if (!(create_flag & BM_CREATE_SKIP_CD)) { if (!(create_flag & BM_CREATE_SKIP_CD)) {
if (f_example) { if (f_example) {
BM_elem_attrs_copy(bm, bm, f_example, f); BM_elem_attrs_copy(bm, bm, f_example, f);
@ -563,7 +563,7 @@ int bmesh_elem_check(void *element, const char htype)
if (head->htype != htype) if (head->htype != htype)
return IS_WRONG_TYPE; return IS_WRONG_TYPE;
switch (htype) { switch (htype) {
case BM_VERT: case BM_VERT:
{ {
@ -830,12 +830,12 @@ void BM_face_edges_kill(BMesh *bm, BMFace *f)
BMLoop *l_iter; BMLoop *l_iter;
BMLoop *l_first; BMLoop *l_first;
int i = 0; int i = 0;
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do { do {
edges[i++] = l_iter->e; edges[i++] = l_iter->e;
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
for (i = 0; i < f->len; i++) { for (i = 0; i < f->len; i++) {
BM_edge_kill(bm, edges[i]); BM_edge_kill(bm, edges[i]);
} }
@ -851,12 +851,12 @@ void BM_face_verts_kill(BMesh *bm, BMFace *f)
BMLoop *l_iter; BMLoop *l_iter;
BMLoop *l_first; BMLoop *l_first;
int i = 0; int i = 0;
l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do { do {
verts[i++] = l_iter->v; verts[i++] = l_iter->v;
} while ((l_iter = l_iter->next) != l_first); } while ((l_iter = l_iter->next) != l_first);
for (i = 0; i < f->len; i++) { for (i = 0; i < f->len; i++) {
BM_vert_kill(bm, verts[i]); BM_vert_kill(bm, verts[i]);
} }
@ -979,7 +979,7 @@ void BM_edge_kill(BMesh *bm, BMEdge *e)
bmesh_disk_edge_remove(e, e->v1); bmesh_disk_edge_remove(e, e->v1);
bmesh_disk_edge_remove(e, e->v2); bmesh_disk_edge_remove(e, e->v2);
bm_kill_only_edge(bm, e); bm_kill_only_edge(bm, e);
} }
@ -1159,11 +1159,11 @@ static bool bm_vert_is_manifold_flagged(BMVert *v, const char api_flag)
if (!l) { if (!l) {
return false; return false;
} }
if (BM_edge_is_boundary(l->e)) { if (BM_edge_is_boundary(l->e)) {
return false; return false;
} }
do { do {
if (!BM_ELEM_API_FLAG_TEST(l->f, api_flag)) if (!BM_ELEM_API_FLAG_TEST(l->f, api_flag))
return false; return false;
@ -1361,7 +1361,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
BM_face_kill(bm, faces[i]); BM_face_kill(bm, faces[i]);
} }
} }
BLI_array_free(edges); BLI_array_free(edges);
BLI_array_free(deledges); BLI_array_free(deledges);
BLI_array_free(delverts); BLI_array_free(delverts);
@ -1562,7 +1562,7 @@ BMFace *bmesh_kernel_split_face_make_edge(
BM_CHECK_ELEMENT(e); BM_CHECK_ELEMENT(e);
BM_CHECK_ELEMENT(f); BM_CHECK_ELEMENT(f);
BM_CHECK_ELEMENT(f2); BM_CHECK_ELEMENT(f2);
return f2; return f2;
} }
@ -1664,7 +1664,7 @@ BMVert *bmesh_kernel_split_edge_make_vert(BMesh *bm, BMVert *tv, BMEdge *e, BMEd
is_first = false; is_first = false;
l->radial_next = l->radial_prev = NULL; l->radial_next = l->radial_prev = NULL;
} }
bmesh_radial_loop_append(l_new->e, l_new); bmesh_radial_loop_append(l_new->e, l_new);
bmesh_radial_loop_append(l->e, l); bmesh_radial_loop_append(l->e, l);
} }
@ -1784,7 +1784,7 @@ BMEdge *bmesh_kernel_join_edge_kill_vert(
if (BM_vert_in_edge(e_kill, v_kill) == 0) { if (BM_vert_in_edge(e_kill, v_kill) == 0) {
return NULL; return NULL;
} }
if (bmesh_disk_count_at_most(v_kill, 3) == 2) { if (bmesh_disk_count_at_most(v_kill, 3) == 2) {
#ifndef NDEBUG #ifndef NDEBUG
int valence1, valence2; int valence1, valence2;
@ -2122,10 +2122,10 @@ BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEd
/* join the two loop */ /* join the two loop */
l_f1->prev->next = l_f2->next; l_f1->prev->next = l_f2->next;
l_f2->next->prev = l_f1->prev; l_f2->next->prev = l_f1->prev;
l_f1->next->prev = l_f2->prev; l_f1->next->prev = l_f2->prev;
l_f2->prev->next = l_f1->next; l_f2->prev->next = l_f1->next;
/* if l_f1 was baseloop, make l_f1->next the base. */ /* if l_f1 was baseloop, make l_f1->next the base. */
if (BM_FACE_FIRST_LOOP(f1) == l_f1) if (BM_FACE_FIRST_LOOP(f1) == l_f1)
BM_FACE_FIRST_LOOP(f1) = l_f1->next; BM_FACE_FIRST_LOOP(f1) = l_f1->next;
@ -2137,11 +2137,11 @@ BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEd
newlen = f1->len; newlen = f1->len;
for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < newlen; i++, l_iter = l_iter->next) for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < newlen; i++, l_iter = l_iter->next)
l_iter->f = f1; l_iter->f = f1;
/* remove edge from the disk cycle of its two vertices */ /* remove edge from the disk cycle of its two vertices */
bmesh_disk_edge_remove(l_f1->e, l_f1->e->v1); bmesh_disk_edge_remove(l_f1->e, l_f1->e->v1);
bmesh_disk_edge_remove(l_f1->e, l_f1->e->v2); bmesh_disk_edge_remove(l_f1->e, l_f1->e->v2);
/* deallocate edge and its two loops as well as f2 */ /* deallocate edge and its two loops as well as f2 */
if (bm->etoolflagpool) { if (bm->etoolflagpool) {
BLI_mempool_free(bm->etoolflagpool, ((BMEdge_OFlag *)l_f1->e)->oflags); BLI_mempool_free(bm->etoolflagpool, ((BMEdge_OFlag *)l_f1->e)->oflags);
@ -2165,7 +2165,7 @@ BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEd
/* validate the new loop cycle */ /* validate the new loop cycle */
edok = bmesh_loop_validate(f1); edok = bmesh_loop_validate(f1);
BMESH_ASSERT(edok != false); BMESH_ASSERT(edok != false);
return f1; return f1;
} }
@ -2600,7 +2600,7 @@ void bmesh_kernel_edge_separate(
BLI_assert(l_sep->e == e); BLI_assert(l_sep->e == e);
BLI_assert(e->l); BLI_assert(e->l);
if (BM_edge_is_boundary(e)) { if (BM_edge_is_boundary(e)) {
BLI_assert(0); /* no cut required */ BLI_assert(0); /* no cut required */
return; return;

@ -105,7 +105,7 @@ void BMO_mesh_delete_oflag_tagged(BMesh *bm, const short oflag, const char htype
bmo_remove_tagged_edges(bm, oflag); bmo_remove_tagged_edges(bm, oflag);
} }
if (htype & BM_VERT) { if (htype & BM_VERT) {
bmo_remove_tagged_verts(bm, oflag); bmo_remove_tagged_verts(bm, oflag);
} }
} }

@ -160,7 +160,7 @@ int BM_mesh_edgeloops_find(
BMEdge **edges = MEM_mallocN(sizeof(*edges) * edges_len, __func__); BMEdge **edges = MEM_mallocN(sizeof(*edges) * edges_len, __func__);
BLI_stack_pop_n_reverse(edge_stack, edges, BLI_stack_count(edge_stack)); BLI_stack_pop_n_reverse(edge_stack, edges, BLI_stack_count(edge_stack));
BLI_stack_free(edge_stack); BLI_stack_free(edge_stack);
for (uint i = 0; i < edges_len; i += 1) { for (uint i = 0; i < edges_len; i += 1) {
e = edges[i]; e = edges[i];
if (BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG)) { if (BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG)) {

@ -152,7 +152,7 @@ void BM_data_interp_face_vert_edge(
l_v = l_iter; l_v = l_iter;
l_v2 = l_iter->prev; l_v2 = l_iter->prev;
} }
if (!l_v1 || !l_v2) { if (!l_v1 || !l_v2) {
return; return;
} }
@ -260,15 +260,15 @@ static int compute_mdisp_quad(
mid_v3_v3v3(p, l->prev->v->co, l->v->co); mid_v3_v3v3(p, l->prev->v->co, l->v->co);
mid_v3_v3v3(n, l->next->v->co, l->v->co); mid_v3_v3v3(n, l->next->v->co, l->v->co);
copy_v3_v3(v1, l_f_center); copy_v3_v3(v1, l_f_center);
copy_v3_v3(v2, p); copy_v3_v3(v2, p);
copy_v3_v3(v3, l->v->co); copy_v3_v3(v3, l->v->co);
copy_v3_v3(v4, n); copy_v3_v3(v4, n);
sub_v3_v3v3(e1, v2, v1); sub_v3_v3v3(e1, v2, v1);
sub_v3_v3v3(e2, v3, v4); sub_v3_v3v3(e2, v3, v4);
return 1; return 1;
} }
@ -331,7 +331,7 @@ static bool mdisp_in_mdispquad(
{ {
float v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3]; float v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3];
float eps = FLT_EPSILON * 4000; float eps = FLT_EPSILON * 4000;
if (is_zero_v3(l_src->v->no)) if (is_zero_v3(l_src->v->no))
BM_vert_normal_update_all(l_src->v); BM_vert_normal_update_all(l_src->v);
if (is_zero_v3(l_dst->v->no)) if (is_zero_v3(l_dst->v->no))
@ -341,17 +341,17 @@ static bool mdisp_in_mdispquad(
/* expand quad a bit */ /* expand quad a bit */
mid_v3_v3v3v3v3(c, v1, v2, v3, v4); mid_v3_v3v3v3v3(c, v1, v2, v3, v4);
sub_v3_v3(v1, c); sub_v3_v3(v2, c); sub_v3_v3(v1, c); sub_v3_v3(v2, c);
sub_v3_v3(v3, c); sub_v3_v3(v4, c); sub_v3_v3(v3, c); sub_v3_v3(v4, c);
mul_v3_fl(v1, 1.0f + eps); mul_v3_fl(v2, 1.0f + eps); mul_v3_fl(v1, 1.0f + eps); mul_v3_fl(v2, 1.0f + eps);
mul_v3_fl(v3, 1.0f + eps); mul_v3_fl(v4, 1.0f + eps); mul_v3_fl(v3, 1.0f + eps); mul_v3_fl(v4, 1.0f + eps);
add_v3_v3(v1, c); add_v3_v3(v2, c); add_v3_v3(v1, c); add_v3_v3(v2, c);
add_v3_v3(v3, c); add_v3_v3(v4, c); add_v3_v3(v3, c); add_v3_v3(v4, c);
if (!quad_co(v1, v2, v3, v4, p, l_src->v->no, r_uv)) if (!quad_co(v1, v2, v3, v4, p, l_src->v->no, r_uv))
return 0; return 0;
mul_v2_fl(r_uv, (float)(res - 1)); mul_v2_fl(r_uv, (float)(res - 1));
mdisp_axis_from_quad(v1, v2, v3, v4, r_axis_x, r_axis_y); mdisp_axis_from_quad(v1, v2, v3, v4, r_axis_x, r_axis_y);
@ -478,14 +478,14 @@ void BM_loop_interp_multires_ex(
MDisps *md_dst; MDisps *md_dst;
float v1[3], v2[3], v3[3], v4[3] = {0.0f, 0.0f, 0.0f}, e1[3], e2[3]; float v1[3], v2[3], v3[3], v4[3] = {0.0f, 0.0f, 0.0f}, e1[3], e2[3];
float axis_x[3], axis_y[3]; float axis_x[3], axis_y[3];
/* ignore 2-edged faces */ /* ignore 2-edged faces */
if (UNLIKELY(l_dst->f->len < 3)) if (UNLIKELY(l_dst->f->len < 3))
return; return;
md_dst = BM_ELEM_CD_GET_VOID_P(l_dst, cd_loop_mdisp_offset); md_dst = BM_ELEM_CD_GET_VOID_P(l_dst, cd_loop_mdisp_offset);
compute_mdisp_quad(l_dst, f_dst_center, v1, v2, v3, v4, e1, e2); compute_mdisp_quad(l_dst, f_dst_center, v1, v2, v3, v4, e1, e2);
/* if no disps data allocate a new grid, the size of the first grid in f_src. */ /* if no disps data allocate a new grid, the size of the first grid in f_src. */
if (!md_dst->totdisp) { if (!md_dst->totdisp) {
const MDisps *md_src = BM_ELEM_CD_GET_VOID_P(BM_FACE_FIRST_LOOP(f_src), cd_loop_mdisp_offset); const MDisps *md_src = BM_ELEM_CD_GET_VOID_P(BM_FACE_FIRST_LOOP(f_src), cd_loop_mdisp_offset);
@ -499,7 +499,7 @@ void BM_loop_interp_multires_ex(
return; return;
} }
} }
mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y); mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y);
const int res = (int)sqrt(md_dst->totdisp); const int res = (int)sqrt(md_dst->totdisp);
@ -571,10 +571,10 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS);
BMLoop *l; BMLoop *l;
BMIter liter; BMIter liter;
if (cd_loop_mdisp_offset == -1) if (cd_loop_mdisp_offset == -1)
return; return;
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
MDisps *mdp = BM_ELEM_CD_GET_VOID_P(l->prev, cd_loop_mdisp_offset); MDisps *mdp = BM_ELEM_CD_GET_VOID_P(l->prev, cd_loop_mdisp_offset);
MDisps *mdl = BM_ELEM_CD_GET_VOID_P(l, cd_loop_mdisp_offset); MDisps *mdl = BM_ELEM_CD_GET_VOID_P(l, cd_loop_mdisp_offset);
@ -582,7 +582,7 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
float co1[3]; float co1[3];
int sides; int sides;
int y; int y;
/* /*
* mdisps is a grid of displacements, ordered thus: * mdisps is a grid of displacements, ordered thus:
* *
@ -605,14 +605,14 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
copy_v3_v3(mdl->disps[y], co1); copy_v3_v3(mdl->disps[y], co1);
} }
} }
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
MDisps *mdl1 = BM_ELEM_CD_GET_VOID_P(l, cd_loop_mdisp_offset); MDisps *mdl1 = BM_ELEM_CD_GET_VOID_P(l, cd_loop_mdisp_offset);
MDisps *mdl2; MDisps *mdl2;
float co1[3], co2[3], co[3]; float co1[3], co2[3], co[3];
int sides; int sides;
int y; int y;
/* /*
* mdisps is a grid of displacements, ordered thus: * mdisps is a grid of displacements, ordered thus:
* *
@ -638,11 +638,11 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
sides = (int)sqrt(mdl1->totdisp); sides = (int)sqrt(mdl1->totdisp);
for (y = 0; y < sides; y++) { for (y = 0; y < sides; y++) {
int a1, a2, o1, o2; int a1, a2, o1, o2;
if (l->v != l->radial_next->v) { if (l->v != l->radial_next->v) {
a1 = sides * y + sides - 2; a1 = sides * y + sides - 2;
a2 = (sides - 2) * sides + y; a2 = (sides - 2) * sides + y;
o1 = sides * y + sides - 1; o1 = sides * y + sides - 1;
o2 = (sides - 1) * sides + y; o2 = (sides - 1) * sides + y;
} }
@ -652,16 +652,16 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
o1 = sides * y + sides - 1; o1 = sides * y + sides - 1;
o2 = sides * y + sides - 1; o2 = sides * y + sides - 1;
} }
/* magic blending numbers, hardcoded! */ /* magic blending numbers, hardcoded! */
add_v3_v3v3(co1, mdl1->disps[a1], mdl2->disps[a2]); add_v3_v3v3(co1, mdl1->disps[a1], mdl2->disps[a2]);
mul_v3_fl(co1, 0.18); mul_v3_fl(co1, 0.18);
add_v3_v3v3(co2, mdl1->disps[o1], mdl2->disps[o2]); add_v3_v3v3(co2, mdl1->disps[o1], mdl2->disps[o2]);
mul_v3_fl(co2, 0.32); mul_v3_fl(co2, 0.32);
add_v3_v3v3(co, co1, co2); add_v3_v3v3(co, co1, co2);
copy_v3_v3(mdl1->disps[o1], co); copy_v3_v3(mdl1->disps[o1], co);
copy_v3_v3(mdl2->disps[o2], co); copy_v3_v3(mdl2->disps[o2], co);
} }

@ -508,7 +508,7 @@ void *bmiter__face_of_vert_step(struct BMIter__face_of_vert *iter)
iter->l_next = iter->l_first; iter->l_next = iter->l_first;
} }
} }
if (!((BMIter *)iter)->count) { if (!((BMIter *)iter)->count) {
iter->l_next = NULL; iter->l_next = NULL;
} }
@ -549,7 +549,7 @@ void *bmiter__loop_of_vert_step(struct BMIter__loop_of_vert *iter)
iter->l_next = iter->l_first; iter->l_next = iter->l_first;
} }
} }
if (!((BMIter *)iter)->count) { if (!((BMIter *)iter)->count) {
iter->l_next = NULL; iter->l_next = NULL;
} }
@ -590,7 +590,7 @@ void bmiter__loop_of_loop_begin(struct BMIter__loop_of_loop *iter)
{ {
iter->l_first = iter->ldata; iter->l_first = iter->ldata;
iter->l_next = iter->l_first->radial_next; iter->l_next = iter->l_first->radial_next;
if (iter->l_next == iter->l_first) if (iter->l_next == iter->l_first)
iter->l_next = NULL; iter->l_next = NULL;
} }
@ -598,7 +598,7 @@ void bmiter__loop_of_loop_begin(struct BMIter__loop_of_loop *iter)
void *bmiter__loop_of_loop_step(struct BMIter__loop_of_loop *iter) void *bmiter__loop_of_loop_step(struct BMIter__loop_of_loop *iter)
{ {
BMLoop *l_curr = iter->l_next; BMLoop *l_curr = iter->l_next;
if (iter->l_next) { if (iter->l_next) {
iter->l_next = iter->l_next->radial_next; iter->l_next = iter->l_next->radial_next;
if (iter->l_next == iter->l_first) { if (iter->l_next == iter->l_first) {
@ -696,7 +696,7 @@ void *bmiter__edge_of_face_step(struct BMIter__edge_of_face *iter)
iter->l_next = NULL; iter->l_next = NULL;
} }
} }
return l_curr ? l_curr->e : NULL; return l_curr ? l_curr->e : NULL;
} }

@ -156,7 +156,7 @@ BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *da
return false; return false;
break; break;
} }
iter->begin(iter); iter->begin(iter);
return true; return true;

@ -141,7 +141,7 @@ static uint bm_log_vert_id_get(BMLog *log, BMVert *v)
static void bm_log_vert_id_set(BMLog *log, BMVert *v, uint id) static void bm_log_vert_id_set(BMLog *log, BMVert *v, uint id)
{ {
void *vid = SET_UINT_IN_POINTER(id); void *vid = SET_UINT_IN_POINTER(id);
BLI_ghash_reinsert(log->id_to_elem, vid, v, NULL, NULL); BLI_ghash_reinsert(log->id_to_elem, vid, v, NULL, NULL);
BLI_ghash_reinsert(log->elem_to_id, v, vid, NULL, NULL); BLI_ghash_reinsert(log->elem_to_id, v, vid, NULL, NULL);
} }

@ -609,7 +609,7 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode)
{ {
BMIter iter; BMIter iter;
BMElem *ele; BMElem *ele;
bm->selectmode = selectmode; bm->selectmode = selectmode;
if (bm->selectmode & SCE_SELECT_VERTEX) { if (bm->selectmode & SCE_SELECT_VERTEX) {
@ -737,13 +737,13 @@ BMFace *BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_s
BMIter iter; BMIter iter;
BMFace *f = NULL; BMFace *f = NULL;
BMEditSelection *ese; BMEditSelection *ese;
/* Find the latest non-hidden face from the BMEditSelection */ /* Find the latest non-hidden face from the BMEditSelection */
ese = bm->selected.last; ese = bm->selected.last;
for ( ; ese; ese = ese->prev) { for ( ; ese; ese = ese->prev) {
if (ese->htype == BM_FACE) { if (ese->htype == BM_FACE) {
f = (BMFace *)ese->ele; f = (BMFace *)ese->ele;
if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
f = NULL; f = NULL;
} }
@ -842,10 +842,10 @@ void BM_editselection_normal(BMEditSelection *ese, float r_normal[3])
BMEdge *eed = (BMEdge *)ese->ele; BMEdge *eed = (BMEdge *)ese->ele;
float plane[3]; /* need a plane to correct the normal */ float plane[3]; /* need a plane to correct the normal */
float vec[3]; /* temp vec storage */ float vec[3]; /* temp vec storage */
add_v3_v3v3(r_normal, eed->v1->no, eed->v2->no); add_v3_v3v3(r_normal, eed->v1->no, eed->v2->no);
sub_v3_v3v3(plane, eed->v2->co, eed->v1->co); sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
/* the 2 vertex normals will be close but not at rightangles to the edge /* the 2 vertex normals will be close but not at rightangles to the edge
* for rotate about edge we want them to be at right angles, so we need to * for rotate about edge we want them to be at right angles, so we need to
* do some extra calculation to correct the vert normals, * do some extra calculation to correct the vert normals,
@ -853,7 +853,7 @@ void BM_editselection_normal(BMEditSelection *ese, float r_normal[3])
cross_v3_v3v3(vec, r_normal, plane); cross_v3_v3v3(vec, r_normal, plane);
cross_v3_v3v3(r_normal, plane, vec); cross_v3_v3v3(r_normal, plane, vec);
normalize_v3(r_normal); normalize_v3(r_normal);
} }
else if (ese->htype == BM_FACE) { else if (ese->htype == BM_FACE) {
BMFace *efa = (BMFace *)ese->ele; BMFace *efa = (BMFace *)ese->ele;
@ -869,7 +869,7 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
if (ese->htype == BM_VERT) { if (ese->htype == BM_VERT) {
BMVert *eve = (BMVert *)ese->ele; BMVert *eve = (BMVert *)ese->ele;
float vec[3] = {0.0f, 0.0f, 0.0f}; float vec[3] = {0.0f, 0.0f, 0.0f};
if (ese->prev) { /* use previously selected data to make a useful vertex plane */ if (ese->prev) { /* use previously selected data to make a useful vertex plane */
BM_editselection_center(ese->prev, vec); BM_editselection_center(ese->prev, vec);
sub_v3_v3v3(r_plane, vec, eve->co); sub_v3_v3v3(r_plane, vec, eve->co);
@ -1261,7 +1261,7 @@ void BM_edge_hide_set(BMEdge *e, const bool hide)
BM_elem_flag_set(l_iter->f, BM_ELEM_HIDDEN, hide); BM_elem_flag_set(l_iter->f, BM_ELEM_HIDDEN, hide);
} while ((l_iter = l_iter->radial_next) != l_first); } while ((l_iter = l_iter->radial_next) != l_first);
} }
BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide); BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide);
/* hide vertices if necessary */ /* hide vertices if necessary */

@ -168,7 +168,7 @@ BMesh *BM_mesh_create(
{ {
/* allocate the structure */ /* allocate the structure */
BMesh *bm = MEM_callocN(sizeof(BMesh), __func__); BMesh *bm = MEM_callocN(sizeof(BMesh), __func__);
/* allocate the memory pools for the mesh elements */ /* allocate the memory pools for the mesh elements */
bm_mempool_init(bm, allocsize, params->use_toolflags); bm_mempool_init(bm, allocsize, params->use_toolflags);
@ -1052,41 +1052,41 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(
BMFace *f; BMFace *f;
BMIter iter; BMIter iter;
// int i = 0; // UNUSED // int i = 0; // UNUSED
multires_set_space(dm, ob, from, to); multires_set_space(dm, ob, from, to);
mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS); mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS);
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
BMLoop *l; BMLoop *l;
BMIter liter; BMIter liter;
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
MDisps *lmd = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS); MDisps *lmd = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS);
if (!lmd->disps) { if (!lmd->disps) {
printf("%s: warning - 'lmd->disps' == NULL\n", __func__); printf("%s: warning - 'lmd->disps' == NULL\n", __func__);
} }
if (lmd->disps && lmd->totdisp == mdisps->totdisp) { if (lmd->disps && lmd->totdisp == mdisps->totdisp) {
memcpy(lmd->disps, mdisps->disps, sizeof(float) * 3 * lmd->totdisp); memcpy(lmd->disps, mdisps->disps, sizeof(float) * 3 * lmd->totdisp);
} }
else if (mdisps->disps) { else if (mdisps->disps) {
if (lmd->disps) if (lmd->disps)
MEM_freeN(lmd->disps); MEM_freeN(lmd->disps);
lmd->disps = MEM_dupallocN(mdisps->disps); lmd->disps = MEM_dupallocN(mdisps->disps);
lmd->totdisp = mdisps->totdisp; lmd->totdisp = mdisps->totdisp;
lmd->level = mdisps->level; lmd->level = mdisps->level;
} }
mdisps++; mdisps++;
// i += 1; // i += 1;
} }
} }
dm->needsFree = 1; dm->needsFree = 1;
dm->release(dm); dm->release(dm);
/* setting this to NULL prevents BKE_editmesh_free from freeing it */ /* setting this to NULL prevents BKE_editmesh_free from freeing it */
em->bm = NULL; em->bm = NULL;
BKE_editmesh_free(em); BKE_editmesh_free(em);

@ -66,7 +66,7 @@ bool BM_vert_dissolve(BMesh *bm, BMVert *v)
{ {
/* logic for 3 or more is identical */ /* logic for 3 or more is identical */
const int len = BM_vert_edge_count_at_most(v, 3); const int len = BM_vert_edge_count_at_most(v, 3);
if (len == 1) { if (len == 1) {
BM_vert_kill(bm, v); /* will kill edges too */ BM_vert_kill(bm, v); /* will kill edges too */
return true; return true;
@ -110,7 +110,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v)
if (!BM_vert_is_manifold(v)) { if (!BM_vert_is_manifold(v)) {
return false; return false;
} }
if (v->e) { if (v->e) {
/* v->e we keep, what else */ /* v->e we keep, what else */
e = v->e; e = v->e;
@ -124,7 +124,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v)
len++; len++;
} while (e != v->e); } while (e != v->e);
} }
/* this code for handling 2 and 3-valence verts /* this code for handling 2 and 3-valence verts
* may be totally bad */ * may be totally bad */
if (keepedge == NULL && len == 3) { if (keepedge == NULL && len == 3) {
@ -200,7 +200,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v)
if (!e) { if (!e) {
return false; return false;
} }
if (e->l) { if (e->l) {
/* get remaining two faces */ /* get remaining two faces */
if (e->l != e->l->radial_next) { if (e->l != e->l->radial_next) {
@ -286,13 +286,13 @@ BMFace *BM_face_split(
if (cd_loop_mdisp_offset != -1) { if (cd_loop_mdisp_offset != -1) {
f_tmp = BM_face_copy(bm, bm, f, false, false); f_tmp = BM_face_copy(bm, bm, f, false, false);
} }
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, NULL, example, no_double); f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, NULL, example, no_double);
#else #else
f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, example, no_double); f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, example, no_double);
#endif #endif
if (f_new) { if (f_new) {
/* handle multires update */ /* handle multires update */
if (cd_loop_mdisp_offset != -1) { if (cd_loop_mdisp_offset != -1) {
@ -368,7 +368,7 @@ BMFace *BM_face_split_n(
} }
f_tmp = BM_face_copy(bm, bm, f, true, true); f_tmp = BM_face_copy(bm, bm, f, true, true);
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, &l_new, NULL, example, false); f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, &l_new, NULL, example, false);
#else #else
@ -600,13 +600,13 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
if (cd_loop_mdisp_offset != -1) { if (cd_loop_mdisp_offset != -1) {
BMLoop *l; BMLoop *l;
int i; int i;
l = e->l; l = e->l;
do { do {
BLI_array_append(oldfaces, l->f); BLI_array_append(oldfaces, l->f);
l = l->radial_next; l = l->radial_next;
} while (l != e->l); } while (l != e->l);
/* flag existing faces so we can differentiate oldfaces from new faces */ /* flag existing faces so we can differentiate oldfaces from new faces */
for (i = 0; i < BLI_array_len(oldfaces); i++) { for (i = 0; i < BLI_array_len(oldfaces); i++) {
BM_ELEM_API_FLAG_ENABLE(oldfaces[i], _FLAG_OVERLAP); BM_ELEM_API_FLAG_ENABLE(oldfaces[i], _FLAG_OVERLAP);
@ -647,7 +647,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
for (j = 0; j < 2; j++) { for (j = 0; j < 2; j++) {
BMEdge *e1 = j ? e_new : e; BMEdge *e1 = j ? e_new : e;
BMLoop *l; BMLoop *l;
l = e1->l; l = e1->l;
if (UNLIKELY(!l)) { if (UNLIKELY(!l)) {
@ -669,31 +669,31 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
} while (l != e1->l); } while (l != e1->l);
} }
} }
/* destroy the old faces */ /* destroy the old faces */
for (i = 0; i < BLI_array_len(oldfaces); i++) { for (i = 0; i < BLI_array_len(oldfaces); i++) {
BM_face_verts_kill(bm, oldfaces[i]); BM_face_verts_kill(bm, oldfaces[i]);
} }
/* fix boundaries a bit, doesn't work too well quite yet */ /* fix boundaries a bit, doesn't work too well quite yet */
#if 0 #if 0
for (j = 0; j < 2; j++) { for (j = 0; j < 2; j++) {
BMEdge *e1 = j ? e_new : e; BMEdge *e1 = j ? e_new : e;
BMLoop *l, *l2; BMLoop *l, *l2;
l = e1->l; l = e1->l;
if (UNLIKELY(!l)) { if (UNLIKELY(!l)) {
BMESH_ASSERT(0); BMESH_ASSERT(0);
break; break;
} }
do { do {
BM_face_multires_bounds_smooth(bm, l->f); BM_face_multires_bounds_smooth(bm, l->f);
l = l->radial_next; l = l->radial_next;
} while (l != e1->l); } while (l != e1->l);
} }
#endif #endif
BLI_array_free(oldfaces); BLI_array_free(oldfaces);
} }
@ -710,7 +710,7 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts, BMVert **r_varr)
int i; int i;
float percent; float percent;
BMVert *v_new = NULL; BMVert *v_new = NULL;
for (i = 0; i < numcuts; i++) { for (i = 0; i < numcuts; i++) {
percent = 1.0f / (float)(numcuts + 1 - i); percent = 1.0f / (float)(numcuts + 1 - i);
v_new = BM_edge_split(bm, e, e->v2, NULL, percent); v_new = BM_edge_split(bm, e, e->v2, NULL, percent);
@ -734,7 +734,7 @@ bool BM_face_validate(BMFace *face, FILE *err)
BMLoop *l; BMLoop *l;
int i, j; int i, j;
bool ret = true; bool ret = true;
if (face->len == 2) { if (face->len == 2) {
fprintf(err, "warning: found two-edged face. face ptr: %p\n", face); fprintf(err, "warning: found two-edged face. face ptr: %p\n", face);
fflush(err); fflush(err);
@ -765,7 +765,7 @@ bool BM_face_validate(BMFace *face, FILE *err)
} }
} }
} }
BLI_array_free(verts); BLI_array_free(verts);
return ret; return ret;
} }

@ -65,10 +65,10 @@ BLI_STATIC_ASSERT(ARRAY_SIZE(bmo_error_messages) + 1 == BMERR_TOTAL, "message mi
/* operator slot type information - size of one element of the type given. */ /* operator slot type information - size of one element of the type given. */
const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = { const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = {
0, /* 0: BMO_OP_SLOT_SENTINEL */ 0, /* 0: BMO_OP_SLOT_SENTINEL */
sizeof(int), /* 1: BMO_OP_SLOT_BOOL */ sizeof(int), /* 1: BMO_OP_SLOT_BOOL */
sizeof(int), /* 2: BMO_OP_SLOT_INT */ sizeof(int), /* 2: BMO_OP_SLOT_INT */
sizeof(float), /* 3: BMO_OP_SLOT_FLT */ sizeof(float), /* 3: BMO_OP_SLOT_FLT */
sizeof(void *), /* 4: BMO_OP_SLOT_PNT */ sizeof(void *), /* 4: BMO_OP_SLOT_PNT */
sizeof(void *), /* 5: BMO_OP_SLOT_PNT */ sizeof(void *), /* 5: BMO_OP_SLOT_PNT */
0, /* 6: unused */ 0, /* 6: unused */
0, /* 7: unused */ 0, /* 7: unused */
@ -185,7 +185,7 @@ void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
op->type = opcode; op->type = opcode;
op->type_flag = bmo_opdefines[opcode]->type_flag; op->type_flag = bmo_opdefines[opcode]->type_flag;
op->flag = flag; op->flag = flag;
/* initialize the operator slot types */ /* initialize the operator slot types */
bmo_op_slots_init(bmo_opdefines[opcode]->slot_types_in, op->slots_in); bmo_op_slots_init(bmo_opdefines[opcode]->slot_types_in, op->slots_in);
bmo_op_slots_init(bmo_opdefines[opcode]->slot_types_out, op->slots_out); bmo_op_slots_init(bmo_opdefines[opcode]->slot_types_out, op->slots_out);
@ -217,10 +217,10 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
if (bm->toolflag_index == 1) if (bm->toolflag_index == 1)
bmesh_edit_begin(bm, op->type_flag); bmesh_edit_begin(bm, op->type_flag);
op->exec(bm, op); op->exec(bm, op);
if (bm->toolflag_index == 1) if (bm->toolflag_index == 1)
bmesh_edit_end(bm, op->type_flag); bmesh_edit_end(bm, op->type_flag);
BMO_pop(bm); BMO_pop(bm);
} }
@ -406,7 +406,7 @@ void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], cons
slot->len = 4; slot->len = 4;
slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float) * 4 * 4); slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float) * 4 * 4);
if (size == 4) { if (size == 4) {
copy_m4_m4(slot->data.p, (float (*)[4])mat); copy_m4_m4(slot->data.p, (float (*)[4])mat);
} }
@ -661,7 +661,7 @@ int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot
{ {
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name); BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF); BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
/* check if its actually a buffer */ /* check if its actually a buffer */
if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
return 0; return 0;
@ -697,7 +697,7 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
BMOpSlot *slot = &op->slots[slot_code]; BMOpSlot *slot = &op->slots[slot_code];
void *tmp; void *tmp;
ssize_t allocsize; ssize_t allocsize;
BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
/* check if its actually a buffer */ /* check if its actually a buffer */
@ -760,7 +760,7 @@ void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS]
/* check if its actually a buffer */ /* check if its actually a buffer */
if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
return NULL; return NULL;
slot->len = len; slot->len = len;
if (len) { if (len) {
slot->data.buf = BLI_memarena_alloc(op->arena, BMO_OPSLOT_TYPEINFO[slot->slot_type] * len); slot->data.buf = BLI_memarena_alloc(op->arena, BMO_OPSLOT_TYPEINFO[slot->slot_type] * len);
@ -783,7 +783,7 @@ void BMO_slot_buffer_from_all(
{ {
BMOpSlot *output = BMO_slot_get(slot_args, slot_name); BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
int totelement = 0, i = 0; int totelement = 0, i = 0;
BLI_assert(output->slot_type == BMO_OP_SLOT_ELEMENT_BUF); BLI_assert(output->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
BLI_assert(((output->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype); BLI_assert(((output->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
@ -1365,7 +1365,7 @@ static void bmo_flag_layer_clear(BMesh *bm)
void *BMO_slot_buffer_get_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name) void *BMO_slot_buffer_get_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{ {
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name); BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
return NULL; return NULL;
@ -1505,14 +1505,14 @@ void BMO_error_clear(BMesh *bm)
void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg) void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg)
{ {
BMOpError *err = MEM_callocN(sizeof(BMOpError), "bmop_error"); BMOpError *err = MEM_callocN(sizeof(BMOpError), "bmop_error");
err->errorcode = errcode; err->errorcode = errcode;
if (!msg) { if (!msg) {
msg = bmo_error_messages[errcode]; msg = bmo_error_messages[errcode];
} }
err->msg = msg; err->msg = msg;
err->op = owner; err->op = owner;
BLI_addhead(&bm->errorstack, err); BLI_addhead(&bm->errorstack, err);
} }
@ -1531,17 +1531,17 @@ int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op)
if (msg) *msg = err->msg; if (msg) *msg = err->msg;
if (op) *op = err->op; if (op) *op = err->op;
return err->errorcode; return err->errorcode;
} }
int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op) int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op)
{ {
int errorcode = BMO_error_get(bm, msg, op); int errorcode = BMO_error_get(bm, msg, op);
if (errorcode) { if (errorcode) {
BMOpError *err = bm->errorstack.first; BMOpError *err = bm->errorstack.first;
BLI_remlink(&bm->errorstack, bm->errorstack.first); BLI_remlink(&bm->errorstack, bm->errorstack.first);
MEM_freeN(err); MEM_freeN(err);
} }
@ -1680,7 +1680,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
/* we muck around in here, so dup it */ /* we muck around in here, so dup it */
fmt = ofmt = BLI_strdup(_fmt); fmt = ofmt = BLI_strdup(_fmt);
/* find operator name */ /* find operator name */
i = strcspn(fmt, " "); i = strcspn(fmt, " ");
@ -1689,7 +1689,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
opname[i] = '\0'; opname[i] = '\0';
fmt += i + (noslot ? 0 : 1); fmt += i + (noslot ? 0 : 1);
i = BMO_opcode_from_opname_check(opname); i = BMO_opcode_from_opname_check(opname);
if (i == -1) { if (i == -1) {
@ -1700,7 +1700,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
BMO_op_init(bm, op, flag, opname); BMO_op_init(bm, op, flag, opname);
// def = bmo_opdefines[i]; // def = bmo_opdefines[i];
i = 0; i = 0;
state = true; /* false: not inside slot_code name, true: inside slot_code name */ state = true; /* false: not inside slot_code name, true: inside slot_code name */
@ -1709,7 +1709,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
/* jump past leading whitespace */ /* jump past leading whitespace */
i = strspn(fmt, " "); i = strspn(fmt, " ");
fmt += i; fmt += i;
/* ignore trailing whitespace */ /* ignore trailing whitespace */
if (!fmt[i]) if (!fmt[i])
break; break;
@ -1725,9 +1725,9 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
if (bmo_name_to_slotcode_check(op->slots_in, fmt) < 0) { if (bmo_name_to_slotcode_check(op->slots_in, fmt) < 0) {
GOTO_ERROR("name to slot code check failed"); GOTO_ERROR("name to slot code check failed");
} }
BLI_strncpy(slot_name, fmt, sizeof(slot_name)); BLI_strncpy(slot_name, fmt, sizeof(slot_name));
state = false; state = false;
fmt += i; fmt += i;
} }

@ -611,7 +611,7 @@ void BM_edge_normals_update(BMEdge *e)
{ {
BMIter iter; BMIter iter;
BMFace *f; BMFace *f;
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
BM_face_normal_update(f); BM_face_normal_update(f);
} }
@ -886,7 +886,7 @@ bool BM_face_point_inside_test(const BMFace *f, const float co[3])
float co_2d[2]; float co_2d[2];
BMLoop *l_iter; BMLoop *l_iter;
int i; int i;
BLI_assert(BM_face_is_normal_valid(f)); BLI_assert(BM_face_is_normal_valid(f));
axis_dominant_v3_to_m3(axis_mat, f->no); axis_dominant_v3_to_m3(axis_mat, f->no);
@ -1199,7 +1199,7 @@ void BM_face_splits_check_legal(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int l
out[1] = max_ff(out[1], projverts[i][1]); out[1] = max_ff(out[1], projverts[i][1]);
} }
bm->elem_index_dirty |= BM_LOOP; bm->elem_index_dirty |= BM_LOOP;
/* ensure we are well outside the face bounds (value is arbitrary) */ /* ensure we are well outside the face bounds (value is arbitrary) */
add_v2_fl(out, 1.0f); add_v2_fl(out, 1.0f);
@ -1212,7 +1212,7 @@ void BM_face_splits_check_legal(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int l
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
float mid[2]; float mid[2];
mid_v2_v2v2(mid, edgeverts[i][0], edgeverts[i][1]); mid_v2_v2v2(mid, edgeverts[i][0], edgeverts[i][1]);
int isect = 0; int isect = 0;
int j_prev; int j_prev;
for (j = 0, j_prev = f->len - 1; j < f->len; j_prev = j++) { for (j = 0, j_prev = f->len - 1; j < f->len; j_prev = j++) {

@ -424,7 +424,7 @@ int BM_verts_in_face_count(BMVert **varr, int len, BMFace *f)
#endif #endif
int i, count = 0; int i, count = 0;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
BM_ELEM_API_FLAG_ENABLE(varr[i], _FLAG_OVERLAP); BM_ELEM_API_FLAG_ENABLE(varr[i], _FLAG_OVERLAP);
} }
@ -1213,7 +1213,7 @@ int BM_face_share_edge_count(BMFace *f_a, BMFace *f_b)
BMLoop *l_iter; BMLoop *l_iter;
BMLoop *l_first; BMLoop *l_first;
int count = 0; int count = 0;
l_iter = l_first = BM_FACE_FIRST_LOOP(f_a); l_iter = l_first = BM_FACE_FIRST_LOOP(f_a);
do { do {
if (BM_edge_in_face(l_iter->e, f_b)) { if (BM_edge_in_face(l_iter->e, f_b)) {

@ -217,7 +217,7 @@ void bmesh_disk_edge_remove(BMEdge *e, BMVert *v)
BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2) BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2)
{ {
BMEdge *e_iter, *e_first; BMEdge *e_iter, *e_first;
if (v1->e) { if (v1->e) {
e_first = e_iter = v1->e; e_first = e_iter = v1->e;
@ -227,7 +227,7 @@ BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2)
} }
} while ((e_iter = bmesh_disk_edge_next(e_iter, v1)) != e_first); } while ((e_iter = bmesh_disk_edge_next(e_iter, v1)) != e_first);
} }
return NULL; return NULL;
} }
@ -380,7 +380,7 @@ bool bmesh_radial_validate(int radlen, BMLoop *l)
{ {
BMLoop *l_iter = l; BMLoop *l_iter = l;
int i = 0; int i = 0;
if (bmesh_radial_length(l) != radlen) if (bmesh_radial_length(l) != radlen)
return false; return false;
@ -389,17 +389,17 @@ bool bmesh_radial_validate(int radlen, BMLoop *l)
BMESH_ASSERT(0); BMESH_ASSERT(0);
return false; return false;
} }
if (l_iter->e != l->e) if (l_iter->e != l->e)
return false; return false;
if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2) if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2)
return false; return false;
if (UNLIKELY(i > BM_LOOP_RADIAL_MAX)) { if (UNLIKELY(i > BM_LOOP_RADIAL_MAX)) {
BMESH_ASSERT(0); BMESH_ASSERT(0);
return false; return false;
} }
i++; i++;
} while ((l_iter = l_iter->radial_next) != l); } while ((l_iter = l_iter->radial_next) != l);
@ -529,7 +529,7 @@ int bmesh_radial_length(const BMLoop *l)
BMESH_ASSERT(0); BMESH_ASSERT(0);
return 0; return 0;
} }
i++; i++;
if (UNLIKELY(i >= BM_LOOP_RADIAL_MAX)) { if (UNLIKELY(i >= BM_LOOP_RADIAL_MAX)) {
BMESH_ASSERT(0); BMESH_ASSERT(0);

@ -63,7 +63,7 @@ void *BMW_begin(BMWalker *walker, void *start)
BLI_assert(((BMHeader *)start)->htype & walker->begin_htype); BLI_assert(((BMHeader *)start)->htype & walker->begin_htype);
walker->begin(walker, start); walker->begin(walker, start);
return BMW_current_state(walker) ? walker->step(walker) : NULL; return BMW_current_state(walker) ? walker->step(walker) : NULL;
} }
@ -101,7 +101,7 @@ void BMW_init(
BLI_assert(0); BLI_assert(0);
return; return;
} }
if (type != BMW_CUSTOM) { if (type != BMW_CUSTOM) {
walker->begin_htype = bm_walker_types[type]->begin_htype; walker->begin_htype = bm_walker_types[type]->begin_htype;
walker->begin = bm_walker_types[type]->begin; walker->begin = bm_walker_types[type]->begin;
@ -118,7 +118,7 @@ void BMW_init(
BLI_assert(mask_edge == 0 || (walker->valid_mask & BM_EDGE)); BLI_assert(mask_edge == 0 || (walker->valid_mask & BM_EDGE));
BLI_assert(mask_face == 0 || (walker->valid_mask & BM_FACE)); BLI_assert(mask_face == 0 || (walker->valid_mask & BM_FACE));
} }
walker->worklist = BLI_mempool_create(walker->structsize, 0, 128, BLI_MEMPOOL_NOP); walker->worklist = BLI_mempool_create(walker->structsize, 0, 128, BLI_MEMPOOL_NOP);
BLI_listbase_clear(&walker->states); BLI_listbase_clear(&walker->states);
} }

@ -210,7 +210,7 @@ static void *bmw_VertShellWalker_step(BMWalker *walker)
BMVert *v_old = NULL; BMVert *v_old = NULL;
bool restrictpass = true; bool restrictpass = true;
BMwShellWalker shellWalk = *((BMwShellWalker *)BMW_current_state(walker)); BMwShellWalker shellWalk = *((BMwShellWalker *)BMW_current_state(walker));
if (!BLI_gset_haskey(walker->visit_set, shellWalk.base)) { if (!BLI_gset_haskey(walker->visit_set, shellWalk.base)) {
BLI_gset_insert(walker->visit_set, shellWalk.base); BLI_gset_insert(walker->visit_set, shellWalk.base);
} }
@ -228,11 +228,11 @@ static void *bmw_VertShellWalker_step(BMWalker *walker)
BMwShellWalker *newstate; BMwShellWalker *newstate;
v_old = BM_edge_other_vert(curedge, shellWalk.base); v_old = BM_edge_other_vert(curedge, shellWalk.base);
/* push a new state onto the stac */ /* push a new state onto the stac */
newState = BMW_state_add(walker); newState = BMW_state_add(walker);
BLI_gset_insert(walker->visit_set, curedge); BLI_gset_insert(walker->visit_set, curedge);
/* populate the new stat */ /* populate the new stat */
newState->base = v_old; newState->base = v_old;
@ -240,7 +240,7 @@ static void *bmw_VertShellWalker_step(BMWalker *walker)
} }
} }
} while ((curedge = bmesh_disk_edge_next(curedge, shellWalk.base)) != shellWalk.curedge); } while ((curedge = bmesh_disk_edge_next(curedge, shellWalk.base)) != shellWalk.curedge);
return shellWalk.curedge; return shellWalk.curedge;
} }
#endif #endif
@ -711,12 +711,12 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker)
e = l->e; e = l->e;
v = BM_edge_other_vert(e, iwalk->lastv); v = BM_edge_other_vert(e, iwalk->lastv);
/* pop off current state */ /* pop off current state */
BMW_state_remove(walker); BMW_state_remove(walker);
f = l->f; f = l->f;
while (1) { while (1) {
l = BM_loop_other_edge_loop(l, v); l = BM_loop_other_edge_loop(l, v);
if (BM_loop_is_manifold(l)) { if (BM_loop_is_manifold(l)) {
@ -736,7 +736,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker)
break; break;
} }
} }
if (l == owalk.curloop) { if (l == owalk.curloop) {
return NULL; return NULL;
} }
@ -789,7 +789,7 @@ static void *bmw_IslandWalker_step_ex(BMWalker *walker, bool only_manifold)
{ {
BMwIslandWalker *iwalk, owalk; BMwIslandWalker *iwalk, owalk;
BMLoop *l_iter, *l_first; BMLoop *l_iter, *l_first;
BMW_state_remove_r(walker, &owalk); BMW_state_remove_r(walker, &owalk);
iwalk = &owalk; iwalk = &owalk;
@ -1154,7 +1154,7 @@ static bool bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e)
if (BM_edge_is_wire(e)) { if (BM_edge_is_wire(e)) {
return false; return false;
} }
/* Don't start a loop from a boundary edge if it cannot /* Don't start a loop from a boundary edge if it cannot
* be extended to cover any faces */ * be extended to cover any faces */
if (BM_edge_is_boundary(e)) { if (BM_edge_is_boundary(e)) {
@ -1162,7 +1162,7 @@ static bool bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e)
return false; return false;
} }
} }
/* Don't start a face loop from non-manifold edges */ /* Don't start a face loop from non-manifold edges */
if (!BM_edge_is_manifold(e)) { if (!BM_edge_is_manifold(e)) {
return false; return false;
@ -1206,7 +1206,7 @@ static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data)
static void *bmw_FaceLoopWalker_yield(BMWalker *walker) static void *bmw_FaceLoopWalker_yield(BMWalker *walker)
{ {
BMwFaceLoopWalker *lwalk = BMW_current_state(walker); BMwFaceLoopWalker *lwalk = BMW_current_state(walker);
if (!lwalk) { if (!lwalk) {
return NULL; return NULL;
} }
@ -1225,7 +1225,7 @@ static void *bmw_FaceLoopWalker_step(BMWalker *walker)
f = lwalk->l->f; f = lwalk->l->f;
l = lwalk->l->radial_next; l = lwalk->l->radial_next;
if (lwalk->no_calc) { if (lwalk->no_calc) {
return f; return f;
} }
@ -1314,7 +1314,7 @@ static void bmw_EdgeringWalker_begin(BMWalker *walker, void *data)
static void *bmw_EdgeringWalker_yield(BMWalker *walker) static void *bmw_EdgeringWalker_yield(BMWalker *walker)
{ {
BMwEdgeringWalker *lwalk = BMW_current_state(walker); BMwEdgeringWalker *lwalk = BMW_current_state(walker);
if (!lwalk) { if (!lwalk) {
return NULL; return NULL;
} }
@ -1381,7 +1381,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
l = l->radial_next; l = l->radial_next;
l = l->next->next; l = l->next->next;
if ((l->f->len != 4) || !EDGE_CHECK(l->e) || !bmw_mask_check_face(walker, l->f)) { if ((l->f->len != 4) || !EDGE_CHECK(l->e) || !bmw_mask_check_face(walker, l->f)) {
l = owalk.l->next->next; l = owalk.l->next->next;
} }
@ -1502,7 +1502,7 @@ static void bmw_UVEdgeWalker_begin(BMWalker *walker, void *data)
static void *bmw_UVEdgeWalker_yield(BMWalker *walker) static void *bmw_UVEdgeWalker_yield(BMWalker *walker)
{ {
BMwUVEdgeWalker *lwalk = BMW_current_state(walker); BMwUVEdgeWalker *lwalk = BMW_current_state(walker);
if (!lwalk) { if (!lwalk) {
return NULL; return NULL;
} }

@ -66,7 +66,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
break; break;
} }
} }
/* --- Support Edge Creation --- /* --- Support Edge Creation ---
* simple case when we only have 2 verts selected. * simple case when we only have 2 verts selected.
*/ */

@ -158,7 +158,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
} }
BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_MARK | FACE_TAG); BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_MARK | FACE_TAG);
/* collect region */ /* collect region */
BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) { BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
BMFace *f_iter; BMFace *f_iter;
@ -178,7 +178,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
BLI_array_append(faces, f_iter); BLI_array_append(faces, f_iter);
} }
BMW_end(&regwalker); BMW_end(&regwalker);
for (i = 0; i < BLI_array_len(faces); i++) { for (i = 0; i < BLI_array_len(faces); i++) {
f_iter = faces[i]; f_iter = faces[i];
BMO_face_flag_disable(bm, f_iter, FACE_TAG); BMO_face_flag_disable(bm, f_iter, FACE_TAG);
@ -190,7 +190,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, NULL); BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, NULL);
goto cleanup; goto cleanup;
} }
BLI_array_append(faces, NULL); BLI_array_append(faces, NULL);
BLI_array_append(regions, faces); BLI_array_append(regions, faces);
} }
@ -201,17 +201,17 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < BLI_array_len(regions); i++) { for (i = 0; i < BLI_array_len(regions); i++) {
BMFace *f_new; BMFace *f_new;
int tot = 0; int tot = 0;
faces = regions[i]; faces = regions[i];
if (!faces[0]) { if (!faces[0]) {
BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED,
"Could not find boundary of dissolve region"); "Could not find boundary of dissolve region");
goto cleanup; goto cleanup;
} }
while (faces[tot]) while (faces[tot])
tot++; tot++;
f_new = BM_faces_join(bm, faces, tot, true); f_new = BM_faces_join(bm, faces, tot, true);
if (f_new) { if (f_new) {

@ -64,7 +64,7 @@ static BMVert *bmo_vert_copy(
/* Mark the vert for output */ /* Mark the vert for output */
BMO_vert_flag_enable(bm_dst, v_dst, DUPE_NEW); BMO_vert_flag_enable(bm_dst, v_dst, DUPE_NEW);
return v_dst; return v_dst;
} }
@ -103,7 +103,7 @@ static BMEdge *bmo_edge_copy(
/* Lookup v1 and v2 */ /* Lookup v1 and v2 */
e_dst_v1 = BLI_ghash_lookup(vhash, e_src->v1); e_dst_v1 = BLI_ghash_lookup(vhash, e_src->v1);
e_dst_v2 = BLI_ghash_lookup(vhash, e_src->v2); e_dst_v2 = BLI_ghash_lookup(vhash, e_src->v2);
/* Create a new edge */ /* Create a new edge */
e_dst = BM_edge_create(bm_dst, e_dst_v1, e_dst_v2, NULL, BM_CREATE_SKIP_CD); e_dst = BM_edge_create(bm_dst, e_dst_v1, e_dst_v2, NULL, BM_CREATE_SKIP_CD);
BMO_slot_map_elem_insert(op, slot_edgemap_out, e_src, e_dst); BMO_slot_map_elem_insert(op, slot_edgemap_out, e_src, e_dst);
@ -124,7 +124,7 @@ static BMEdge *bmo_edge_copy(
/* Mark the edge for output */ /* Mark the edge for output */
BMO_edge_flag_enable(bm_dst, e_dst, DUPE_NEW); BMO_edge_flag_enable(bm_dst, e_dst, DUPE_NEW);
return e_dst; return e_dst;
} }
@ -164,7 +164,7 @@ static BMFace *bmo_face_copy(
/* Copy attributes */ /* Copy attributes */
BM_elem_attrs_copy(bm_src, bm_dst, f_src, f_dst); BM_elem_attrs_copy(bm_src, bm_dst, f_src, f_dst);
/* copy per-loop custom data */ /* copy per-loop custom data */
l_iter_src = l_first_src; l_iter_src = l_first_src;
l_iter_dst = BM_FACE_FIRST_LOOP(f_dst); l_iter_dst = BM_FACE_FIRST_LOOP(f_dst);
@ -192,7 +192,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src)
BMVert *v = NULL, *v2; BMVert *v = NULL, *v2;
BMEdge *e = NULL; BMEdge *e = NULL;
BMFace *f = NULL; BMFace *f = NULL;
BMIter viter, eiter, fiter; BMIter viter, eiter, fiter;
GHash *vhash, *ehash; GHash *vhash, *ehash;
@ -286,7 +286,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src)
BMO_face_flag_enable(bm_src, f, DUPE_DONE); BMO_face_flag_enable(bm_src, f, DUPE_DONE);
} }
} }
/* free pointer hashes */ /* free pointer hashes */
BLI_ghash_free(vhash, NULL, NULL); BLI_ghash_free(vhash, NULL, NULL);
BLI_ghash_free(ehash, NULL, NULL); BLI_ghash_free(ehash, NULL, NULL);
@ -326,7 +326,7 @@ void bmo_duplicate_exec(BMesh *bm, BMOperator *op)
{ {
BMOperator *dupeop = op; BMOperator *dupeop = op;
BMesh *bm_dst = BMO_slot_ptr_get(op->slots_in, "dest"); BMesh *bm_dst = BMO_slot_ptr_get(op->slots_in, "dest");
if (!bm_dst) if (!bm_dst)
bm_dst = bm; bm_dst = bm;
@ -335,7 +335,7 @@ void bmo_duplicate_exec(BMesh *bm, BMOperator *op)
/* use the internal copy function */ /* use the internal copy function */
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",
@ -393,11 +393,11 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
/* 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_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) {

@ -175,7 +175,7 @@ static void bm_extrude_copy_face_loop_attributes(BMesh *bm, BMFace *f)
static void bm_extrude_disable_skin_root(BMesh *bm, BMVert *v) static void bm_extrude_disable_skin_root(BMesh *bm, BMVert *v)
{ {
MVertSkin *vs; MVertSkin *vs;
vs = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_MVERT_SKIN); vs = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_MVERT_SKIN);
vs->flag &= ~MVERT_SKIN_ROOT; vs->flag &= ~MVERT_SKIN_ROOT;
} }
@ -186,7 +186,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
BMOperator dupeop; BMOperator dupeop;
BMFace *f; BMFace *f;
BMEdge *e, *e_new; BMEdge *e, *e_new;
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) { BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
BMO_edge_flag_enable(bm, e, EXT_INPUT); BMO_edge_flag_enable(bm, e, EXT_INPUT);
BMO_vert_flag_enable(bm, e->v1, EXT_INPUT); BMO_vert_flag_enable(bm, e->v1, EXT_INPUT);
@ -227,16 +227,16 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
/* not sure what to do about example face, pass NULL for now */ /* not sure what to do about example face, pass NULL for now */
f = BM_face_create_verts(bm, f_verts, 4, NULL, BM_CREATE_NOP, true); f = BM_face_create_verts(bm, f_verts, 4, NULL, BM_CREATE_NOP, true);
bm_extrude_copy_face_loop_attributes(bm, f); bm_extrude_copy_face_loop_attributes(bm, f);
if (BMO_edge_flag_test(bm, e, EXT_INPUT)) { if (BMO_edge_flag_test(bm, e, EXT_INPUT)) {
e = e_new; e = e_new;
} }
BMO_face_flag_enable(bm, f, EXT_KEEP); BMO_face_flag_enable(bm, f, EXT_KEEP);
BMO_edge_flag_enable(bm, e, EXT_KEEP); BMO_edge_flag_enable(bm, e, EXT_KEEP);
BMO_vert_flag_enable(bm, e->v1, EXT_KEEP); BMO_vert_flag_enable(bm, e->v1, EXT_KEEP);
BMO_vert_flag_enable(bm, e->v2, EXT_KEEP); BMO_vert_flag_enable(bm, e->v2, EXT_KEEP);
} }
BMO_op_finish(bm, &dupeop); BMO_op_finish(bm, &dupeop);
@ -343,7 +343,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
BMO_slot_bool_get(op->slots_in, "use_select_history")); BMO_slot_bool_get(op->slots_in, "use_select_history"));
BMO_slot_buffer_flag_enable(bm, op->slots_in, "geom", BM_EDGE | BM_FACE, EXT_INPUT); BMO_slot_buffer_flag_enable(bm, op->slots_in, "geom", BM_EDGE | BM_FACE, EXT_INPUT);
/* if one flagged face is bordered by an un-flagged face, then we delete /* if one flagged face is bordered by an un-flagged face, then we delete
* original geometry unless caller explicitly asked to keep it. */ * original geometry unless caller explicitly asked to keep it. */
if (!BMO_slot_bool_get(op->slots_in, "use_keep_orig")) { if (!BMO_slot_bool_get(op->slots_in, "use_keep_orig")) {
@ -404,7 +404,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
} }
} }
} }
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BMO_face_flag_test(bm, f, EXT_INPUT)) { if (BMO_face_flag_test(bm, f, EXT_INPUT)) {
BMO_face_flag_enable(bm, f, EXT_DEL); BMO_face_flag_enable(bm, f, EXT_DEL);
@ -436,7 +436,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
if (delorig) { if (delorig) {
BMO_op_exec(bm, &delop); BMO_op_exec(bm, &delop);
} }
/* if not delorig, reverse loops of original face */ /* if not delorig, reverse loops of original face */
if (!delorig) { if (!delorig) {
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
@ -445,7 +445,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
} }
} }
} }
BMO_slot_copy(&dupeop, slots_out, "geom.out", BMO_slot_copy(&dupeop, slots_out, "geom.out",
op, slots_out, "geom.out"); op, slots_out, "geom.out");
@ -493,7 +493,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
else else
fwd = (e_new->l->v == e_new->v1); fwd = (e_new->l->v == e_new->v1);
if (fwd) { if (fwd) {
f_verts[0] = e->v1; f_verts[0] = e->v1;
f_verts[1] = e->v2; f_verts[1] = e->v2;

@ -46,10 +46,10 @@
/* Internal operator flags */ /* Internal operator flags */
typedef enum { typedef enum {
HULL_FLAG_INPUT = (1 << 0), HULL_FLAG_INPUT = (1 << 0),
HULL_FLAG_INTERIOR_ELE = (1 << 1), HULL_FLAG_INTERIOR_ELE = (1 << 1),
HULL_FLAG_OUTPUT_GEOM = (1 << 2), HULL_FLAG_OUTPUT_GEOM = (1 << 2),
HULL_FLAG_DEL = (1 << 3), HULL_FLAG_DEL = (1 << 3),
HULL_FLAG_HOLE = (1 << 4) HULL_FLAG_HOLE = (1 << 4)
} HullFlags; } HullFlags;
@ -106,7 +106,7 @@ static BMFace *hull_find_example_face(BMesh *bm, BMEdge *e)
static void hull_output_triangles(BMesh *bm, GSet *hull_triangles) static void hull_output_triangles(BMesh *bm, GSet *hull_triangles)
{ {
GSetIterator iter; GSetIterator iter;
GSET_ITER (iter, hull_triangles) { GSET_ITER (iter, hull_triangles) {
HullTriangle *t = BLI_gsetIterator_getKey(&iter); HullTriangle *t = BLI_gsetIterator_getKey(&iter);
int i; int i;
@ -213,7 +213,7 @@ static HullFinalEdges *hull_final_edges(GSet *hull_triangles)
{ {
HullFinalEdges *final_edges; HullFinalEdges *final_edges;
GSetIterator iter; GSetIterator iter;
final_edges = MEM_callocN(sizeof(HullFinalEdges), "HullFinalEdges"); final_edges = MEM_callocN(sizeof(HullFinalEdges), "HullFinalEdges");
final_edges->edges = BLI_ghash_ptr_new("final edges ghash"); final_edges->edges = BLI_ghash_ptr_new("final edges ghash");
final_edges->base_pool = BLI_mempool_create(sizeof(ListBase), 0, 128, BLI_MEMPOOL_NOP); final_edges->base_pool = BLI_mempool_create(sizeof(ListBase), 0, 128, BLI_MEMPOOL_NOP);
@ -286,7 +286,7 @@ static void hull_remove_overlapping(
break; break;
} }
} }
/* Note: can't change ghash while iterating, so mark /* Note: can't change ghash while iterating, so mark
* with 'skip' flag rather than deleting triangles */ * with 'skip' flag rather than deleting triangles */
if (BM_vert_in_face(t->v[1], f) && if (BM_vert_in_face(t->v[1], f) &&
@ -336,7 +336,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) { BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
if (BMO_vert_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) { if (BMO_vert_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) {
bool del = true; bool del = true;
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
if (!BMO_edge_flag_test(bm, e, HULL_FLAG_INPUT)) { if (!BMO_edge_flag_test(bm, e, HULL_FLAG_INPUT)) {
del = false; del = false;
@ -406,7 +406,7 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) { BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
bool hole = true; bool hole = true;
bool any_faces = false; bool any_faces = false;
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
any_faces = true; any_faces = true;
if (!BMO_face_flag_test(bm, f, HULL_FLAG_HOLE)) { if (!BMO_face_flag_test(bm, f, HULL_FLAG_HOLE)) {
@ -511,7 +511,7 @@ static void hull_from_bullet(
hull = plConvexHullCompute(coords, num_input_verts); hull = plConvexHullCompute(coords, num_input_verts);
hull_verts = hull_verts_from_bullet(hull, input_verts, num_input_verts); hull_verts = hull_verts_from_bullet(hull, input_verts, num_input_verts);
count = plConvexHullNumFaces(hull); count = plConvexHullNumFaces(hull);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
const int len = plConvexHullGetFaceSize(hull, i); const int len = plConvexHullGetFaceSize(hull, i);
@ -601,7 +601,7 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
hull_from_bullet(bm, op, hull_triangles, hull_pool); hull_from_bullet(bm, op, hull_triangles, hull_pool);
final_edges = hull_final_edges(hull_triangles); final_edges = hull_final_edges(hull_triangles);
hull_mark_interior_elements(bm, op, final_edges); hull_mark_interior_elements(bm, op, final_edges);
/* Remove hull triangles covered by an existing face */ /* Remove hull triangles covered by an existing face */

@ -57,13 +57,13 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
BMOpSlot *slot_targetmap; BMOpSlot *slot_targetmap;
ototvert = bm->totvert; ototvert = bm->totvert;
BMO_slot_mat4_get(op->slots_in, "matrix", mtx); BMO_slot_mat4_get(op->slots_in, "matrix", mtx);
invert_m4_m4(imtx, mtx); invert_m4_m4(imtx, mtx);
BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom"); BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom");
BMO_op_exec(bm, &dupeop); BMO_op_exec(bm, &dupeop);
BMO_slot_buffer_flag_enable(bm, dupeop.slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); BMO_slot_buffer_flag_enable(bm, dupeop.slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW);
/* create old -> new mappin */ /* create old -> new mappin */
@ -74,7 +74,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, mtx); BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, mtx);
BMO_op_callf(bm, op->flag, "scale verts=%fv vec=%v", ELE_NEW, scale); BMO_op_callf(bm, op->flag, "scale verts=%fv vec=%v", ELE_NEW, scale);
BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, imtx); BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, imtx);
BMO_op_init(bm, &weldop, op->flag, "weld_verts"); BMO_op_init(bm, &weldop, op->flag, "weld_verts");
slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap"); slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
@ -87,7 +87,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
} }
v = BM_iter_step(&iter); v = BM_iter_step(&iter);
} }
if (mirror_u || mirror_v) { if (mirror_u || mirror_v) {
BMFace *f; BMFace *f;
BMLoop *l; BMLoop *l;
@ -109,7 +109,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
} }
BMO_op_exec(bm, &weldop); BMO_op_exec(bm, &weldop);
BMO_op_finish(bm, &weldop); BMO_op_finish(bm, &weldop);
BMO_op_finish(bm, &dupeop); BMO_op_finish(bm, &dupeop);

@ -940,7 +940,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK); BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
BMO_op_callf(bm, op->flag, "rotate cent=%v matrix=%m3 verts=%S", vec, cmat, &bmop, "geom.out"); BMO_op_callf(bm, op->flag, "rotate cent=%v matrix=%m3 verts=%S", vec, cmat, &bmop, "geom.out");
prevop = bmop; prevop = bmop;
} }
@ -1041,7 +1041,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
v3 = eva[icoface[a][2]]; v3 = eva[icoface[a][2]];
f = BM_face_create_quad_tri(bm, v1, v2, v3, NULL, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, v1, v2, v3, NULL, NULL, BM_CREATE_NOP);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
BMO_edge_flag_enable(bm, l->e, EDGE_MARK); BMO_edge_flag_enable(bm, l->e, EDGE_MARK);
} }
@ -1296,10 +1296,10 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL; BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL;
float vec[3], mat[4][4], phi, phid; float vec[3], mat[4][4], phi, phid;
int a; int a;
if (!segs) if (!segs)
return; return;
BMO_slot_mat4_get(op->slots_in, "matrix", mat); BMO_slot_mat4_get(op->slots_in, "matrix", mat);
phid = 2.0f * (float)M_PI / segs; phid = 2.0f * (float)M_PI / segs;
@ -1308,7 +1308,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
if (cap_ends) { if (cap_ends) {
zero_v3(vec); zero_v3(vec);
mul_m4_v3(mat, vec); mul_m4_v3(mat, vec);
cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_vert_flag_enable(bm, cent1, VERT_MARK); BMO_vert_flag_enable(bm, cent1, VERT_MARK);
} }
@ -1322,17 +1322,17 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
v1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); v1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_vert_flag_enable(bm, v1, VERT_MARK); BMO_vert_flag_enable(bm, v1, VERT_MARK);
if (lastv1) if (lastv1)
BM_edge_create(bm, v1, lastv1, NULL, BM_CREATE_NOP); BM_edge_create(bm, v1, lastv1, NULL, BM_CREATE_NOP);
if (a && cap_ends) { if (a && cap_ends) {
BMFace *f; BMFace *f;
f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP);
BMO_face_flag_enable(bm, f, FACE_NEW); BMO_face_flag_enable(bm, f, FACE_NEW);
} }
if (!firstv1) if (!firstv1)
firstv1 = v1; firstv1 = v1;
@ -1346,7 +1346,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
if (cap_ends) { if (cap_ends) {
BMFace *f; BMFace *f;
f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP); f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP);
BMO_face_flag_enable(bm, f, FACE_NEW); BMO_face_flag_enable(bm, f, FACE_NEW);
@ -1354,11 +1354,11 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
BM_mesh_calc_uvs_circle(bm, mat, radius, FACE_NEW, cd_loop_uv_offset); BM_mesh_calc_uvs_circle(bm, mat, radius, FACE_NEW, cd_loop_uv_offset);
} }
} }
if (!cap_tris) { if (!cap_tris) {
BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW); BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
} }
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
} }
@ -1421,10 +1421,10 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs"); const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs");
int a; int a;
if (!segs) if (!segs)
return; return;
BMO_slot_mat4_get(op->slots_in, "matrix", mat); BMO_slot_mat4_get(op->slots_in, "matrix", mat);
phid = 2.0f * (float)M_PI / segs; phid = 2.0f * (float)M_PI / segs;
@ -1435,13 +1435,13 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
vec[0] = vec[1] = 0.0f; vec[0] = vec[1] = 0.0f;
vec[2] = -depth; vec[2] = -depth;
mul_m4_v3(mat, vec); mul_m4_v3(mat, vec);
cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
vec[0] = vec[1] = 0.0f; vec[0] = vec[1] = 0.0f;
vec[2] = depth; vec[2] = depth;
mul_m4_v3(mat, vec); mul_m4_v3(mat, vec);
cent2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); cent2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
BMO_vert_flag_enable(bm, cent1, VERT_MARK); BMO_vert_flag_enable(bm, cent1, VERT_MARK);
@ -1522,7 +1522,7 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
if (!cap_tris) { if (!cap_tris) {
BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW); BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
} }
BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, 0.000001); BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, 0.000001);
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
} }

@ -303,7 +303,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
if (l_first == NULL) { if (l_first == NULL) {
l_first = l; l_first = l;
} }
for (i = 0; i < bm->ldata.totlayer; i++) { for (i = 0; i < bm->ldata.totlayer; i++) {
if (CustomData_layer_has_math(&bm->ldata, i)) { if (CustomData_layer_has_math(&bm->ldata, i)) {
const int type = bm->ldata.layers[i].type; const int type = bm->ldata.layers[i].type;
@ -312,7 +312,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
e1 = BM_ELEM_CD_GET_VOID_P(l_first, offset); e1 = BM_ELEM_CD_GET_VOID_P(l_first, offset);
e2 = BM_ELEM_CD_GET_VOID_P(l, offset); e2 = BM_ELEM_CD_GET_VOID_P(l, offset);
CustomData_data_multiply(type, e2, fac); CustomData_data_multiply(type, e2, fac);
if (l != l_first) { if (l != l_first) {
@ -348,7 +348,7 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op)
if (!CustomData_layer_has_math(&bm->ldata, i)) if (!CustomData_layer_has_math(&bm->ldata, i))
continue; continue;
CustomData_data_initminmax(type, &min, &max); CustomData_data_initminmax(type, &min, &max);
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) { BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
@ -378,7 +378,7 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
BMVert *v, *vert_snap = NULL; BMVert *v, *vert_snap = NULL;
float vec[3]; float vec[3];
BMOpSlot *slot_targetmap; BMOpSlot *slot_targetmap;
BMO_slot_vec_get(op->slots_in, "merge_co", vec); BMO_slot_vec_get(op->slots_in, "merge_co", vec);
//BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges"); //BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");

@ -156,7 +156,7 @@ static BMEdge *connect_smallest_face(BMesh *bm, BMVert *v_a, BMVert *v_b, BMFace
BLI_assert(!BM_loop_is_adjacent(l_a, l_b)); BLI_assert(!BM_loop_is_adjacent(l_a, l_b));
f_new = BM_face_split(bm, f, l_a, l_b, &l_new, NULL, false); f_new = BM_face_split(bm, f, l_a, l_b, &l_new, NULL, false);
if (r_f_new) *r_f_new = f_new; if (r_f_new) *r_f_new = f_new;
return l_new ? l_new->e : NULL; return l_new ? l_new->e : NULL;
} }
@ -380,7 +380,7 @@ static BMVert *bm_subdivide_edge_addvert(
BMEdge **r_edge) BMEdge **r_edge)
{ {
BMVert *v_new; BMVert *v_new;
v_new = BM_edge_split(bm, edge, edge->v1, r_edge, factor_edge_split); v_new = BM_edge_split(bm, edge, edge->v1, r_edge, factor_edge_split);
BMO_vert_flag_enable(bm, v_new, ELE_INNER); BMO_vert_flag_enable(bm, v_new, ELE_INNER);
@ -402,7 +402,7 @@ static BMVert *bm_subdivide_edge_addvert(
} }
} }
#endif #endif
interp_v3_v3v3(v_new->no, v_a->no, v_b->no, factor_subd); interp_v3_v3v3(v_new->no, v_a->no, v_b->no, factor_subd);
normalize_v3(v_new->no); normalize_v3(v_new->no);
@ -426,7 +426,7 @@ static BMVert *subdivide_edge_num(
factor_edge_split = 1.0f / (float)(totpoint + 1 - curpoint); factor_edge_split = 1.0f / (float)(totpoint + 1 - curpoint);
factor_subd = (float)(curpoint + 1) / (float)(totpoint + 1); factor_subd = (float)(curpoint + 1) / (float)(totpoint + 1);
} }
v_new = bm_subdivide_edge_addvert( v_new = bm_subdivide_edge_addvert(
bm, edge, e_orig, params, bm, edge, e_orig, params,
factor_edge_split, factor_subd, factor_edge_split, factor_subd,
@ -444,7 +444,7 @@ static void bm_subdivide_multicut(
e_tmp.v1 = &v1_tmp; e_tmp.v1 = &v1_tmp;
e_tmp.v2 = &v2_tmp; e_tmp.v2 = &v2_tmp;
for (i = 0; i < numcuts; i++) { for (i = 0; i < numcuts; i++) {
v = subdivide_edge_num(bm, eed, &e_tmp, i, params->numcuts, params, v_a, v_b, &e_new); v = subdivide_edge_num(bm, eed, &e_tmp, i, params->numcuts, params, v_a, v_b, &e_new);
@ -456,7 +456,7 @@ static void bm_subdivide_multicut(
if (v->e) BM_CHECK_ELEMENT(v->e); if (v->e) BM_CHECK_ELEMENT(v->e);
if (v->e && v->e->l) BM_CHECK_ELEMENT(v->e->l->f); if (v->e && v->e->l) BM_CHECK_ELEMENT(v->e->l->f);
} }
alter_co(v1, &e_tmp, params, 0, &v1_tmp, &v2_tmp); alter_co(v1, &e_tmp, params, 0, &v1_tmp, &v2_tmp);
alter_co(v2, &e_tmp, params, 1.0, &v1_tmp, &v2_tmp); alter_co(v2, &e_tmp, params, 1.0, &v1_tmp, &v2_tmp);
} }
@ -526,7 +526,7 @@ static void quad_2edge_split_path(BMesh *bm, BMFace *UNUSED(face), BMVert **vert
{ {
BMFace *f_new; BMFace *f_new;
int i, numcuts = params->numcuts; int i, numcuts = params->numcuts;
for (i = 0; i < numcuts; i++) { for (i = 0; i < numcuts; i++) {
connect_smallest_face(bm, verts[i], verts[numcuts + (numcuts - i)], &f_new); connect_smallest_face(bm, verts[i], verts[numcuts + (numcuts - i)], &f_new);
} }
@ -556,7 +556,7 @@ static void quad_2edge_split_innervert(BMesh *bm, BMFace *UNUSED(face), BMVert *
BMVert *v, *v_last; BMVert *v, *v_last;
BMEdge *e, *e_new, e_tmp; BMEdge *e, *e_new, e_tmp;
int i, numcuts = params->numcuts; int i, numcuts = params->numcuts;
v_last = verts[numcuts]; v_last = verts[numcuts];
for (i = numcuts - 1; i >= 0; i--) { for (i = numcuts - 1; i >= 0; i--) {
@ -629,7 +629,7 @@ static void quad_3edge_split(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
{ {
BMFace *f_new; BMFace *f_new;
int i, add = 0, numcuts = params->numcuts; int i, add = 0, numcuts = params->numcuts;
for (i = 0; i < numcuts; i++) { for (i = 0; i < numcuts; i++) {
if (i == numcuts / 2) { if (i == numcuts / 2) {
if (numcuts % 2 != 0) { if (numcuts % 2 != 0) {
@ -687,12 +687,12 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts
for (i = 0; i < numcuts + 2; i++) { for (i = 0; i < numcuts + 2; i++) {
lines[(s - 1) * s + i] = verts[numcuts + i]; lines[(s - 1) * s + i] = verts[numcuts + i];
} }
/* first and last members of middle lines */ /* first and last members of middle lines */
for (i = 0; i < numcuts; i++) { for (i = 0; i < numcuts; i++) {
a = i; a = i;
b = numcuts + 1 + numcuts + 1 + (numcuts - i - 1); b = numcuts + 1 + numcuts + 1 + (numcuts - i - 1);
e = connect_smallest_face(bm, verts[a], verts[b], &f_new); e = connect_smallest_face(bm, verts[a], verts[b], &f_new);
if (!e) if (!e)
continue; continue;
@ -700,10 +700,10 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts
BMO_edge_flag_enable(bm, e, ELE_INNER); BMO_edge_flag_enable(bm, e, ELE_INNER);
BMO_face_flag_enable(bm, f_new, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER);
v1 = lines[(i + 1) * s] = verts[a]; v1 = lines[(i + 1) * s] = verts[a];
v2 = lines[(i + 1) * s + s - 1] = verts[b]; v2 = lines[(i + 1) * s + s - 1] = verts[b];
e_tmp = *e; e_tmp = *e;
for (a = 0; a < numcuts; a++) { for (a = 0; a < numcuts; a++) {
v = subdivide_edge_num(bm, e, &e_tmp, a, numcuts, params, v1, v2, &e_new); v = subdivide_edge_num(bm, e, &e_tmp, a, numcuts, params, v1, v2, &e_new);
@ -748,7 +748,7 @@ static void tri_1edge_split(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
{ {
BMFace *f_new; BMFace *f_new;
int i, numcuts = params->numcuts; int i, numcuts = params->numcuts;
for (i = 0; i < numcuts; i++) { for (i = 0; i < numcuts; i++) {
connect_smallest_face(bm, verts[i], verts[numcuts + 1], &f_new); connect_smallest_face(bm, verts[i], verts[numcuts + 1], &f_new);
} }
@ -780,13 +780,13 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
BMVert ***lines, *v, v1_tmp, v2_tmp; BMVert ***lines, *v, v1_tmp, v2_tmp;
void *stackarr[1]; void *stackarr[1];
int i, j, a, b, numcuts = params->numcuts; int i, j, a, b, numcuts = params->numcuts;
/* number of verts in each lin */ /* number of verts in each lin */
lines = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table"); lines = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table");
lines[0] = (BMVert **) stackarr; lines[0] = (BMVert **) stackarr;
lines[0][0] = verts[numcuts * 2 + 1]; lines[0][0] = verts[numcuts * 2 + 1];
lines[numcuts + 1] = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table 2"); lines[numcuts + 1] = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table 2");
for (i = 0; i < numcuts; i++) { for (i = 0; i < numcuts; i++) {
lines[numcuts + 1][i + 1] = verts[i]; lines[numcuts + 1][i + 1] = verts[i];
@ -806,7 +806,7 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
lines[i + 1][0] = verts[a]; lines[i + 1][0] = verts[a];
lines[i + 1][i + 1] = verts[b]; lines[i + 1][i + 1] = verts[b];
e_tmp = *e; e_tmp = *e;
v1_tmp = *verts[a]; v1_tmp = *verts[a];
v2_tmp = *verts[b]; v2_tmp = *verts[b];
@ -819,7 +819,7 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
BMO_edge_flag_enable(bm, e_new, ELE_INNER); BMO_edge_flag_enable(bm, e_new, ELE_INNER);
} }
} }
/** /**
* <pre> * <pre>
* v5 * v5
@ -906,9 +906,9 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
float smooth, fractal, along_normal; float smooth, fractal, along_normal;
bool use_sphere, use_single_edge, use_grid_fill, use_only_quads; bool use_sphere, use_single_edge, use_grid_fill, use_only_quads;
int cornertype, seed, i, j, a, b, numcuts, totesel, smooth_falloff; int cornertype, seed, i, j, a, b, numcuts, totesel, smooth_falloff;
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT); BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT);
numcuts = BMO_slot_int_get(op->slots_in, "cuts"); numcuts = BMO_slot_int_get(op->slots_in, "cuts");
seed = BMO_slot_int_get(op->slots_in, "seed"); seed = BMO_slot_int_get(op->slots_in, "seed");
smooth = BMO_slot_float_get(op->slots_in, "smooth"); smooth = BMO_slot_float_get(op->slots_in, "smooth");
@ -935,7 +935,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
patterns[1] = &quad_2edge_fan; patterns[1] = &quad_2edge_fan;
break; break;
} }
if (use_single_edge) { if (use_single_edge) {
patterns[0] = &quad_1edge; patterns[0] = &quad_1edge;
patterns[2] = &tri_1edge; patterns[2] = &tri_1edge;
@ -953,12 +953,12 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
patterns[3] = NULL; patterns[3] = NULL;
patterns[5] = NULL; patterns[5] = NULL;
} }
/* add a temporary shapekey layer to store displacements on current geometry */ /* add a temporary shapekey layer to store displacements on current geometry */
BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY); BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
bmo_subd_init_shape_info(bm, &params); bmo_subd_init_shape_info(bm, &params);
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
float *co = BM_ELEM_CD_GET_VOID_P(v, params.shape_info.cd_vert_shape_offset_tmp); float *co = BM_ELEM_CD_GET_VOID_P(v, params.shape_info.cd_vert_shape_offset_tmp);
copy_v3_v3(co, v->co); copy_v3_v3(co, v->co);
@ -990,7 +990,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
BLI_rng_free(rng); BLI_rng_free(rng);
} }
BMO_slot_map_to_flag(bm, op->slots_in, "custom_patterns", BMO_slot_map_to_flag(bm, op->slots_in, "custom_patterns",
BM_FACE, FACE_CUSTOMFILL); BM_FACE, FACE_CUSTOMFILL);
@ -1105,10 +1105,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
} }
} }
if (!matched && totesel) { if (!matched && totesel) {
SubDFaceData *fd; SubDFaceData *fd;
BMO_face_flag_enable(bm, face, SUBD_SPLIT); BMO_face_flag_enable(bm, face, SUBD_SPLIT);
/* must initialize all members here */ /* must initialize all members here */
@ -1146,7 +1146,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
if (!pat && fd->totedgesel == 2) { if (!pat && fd->totedgesel == 2) {
int vlen; int vlen;
/* ok, no pattern. we still may be able to do something */ /* ok, no pattern. we still may be able to do something */
BLI_array_clear(loops); BLI_array_clear(loops);
BLI_array_clear(loops_split); BLI_array_clear(loops_split);
@ -1156,7 +1156,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
BM_ITER_ELEM_INDEX (l, &liter, face, BM_LOOPS_OF_FACE, a) { BM_ITER_ELEM_INDEX (l, &liter, face, BM_LOOPS_OF_FACE, a) {
loops[a] = l; loops[a] = l;
} }
vlen = BLI_array_len(loops); vlen = BLI_array_len(loops);
/* find the boundary of one of the split edges */ /* find the boundary of one of the split edges */
@ -1167,7 +1167,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
break; break;
} }
} }
if (BMO_vert_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) { if (BMO_vert_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) {
b = (a + numcuts + 1) % vlen; b = (a + numcuts + 1) % vlen;
} }
@ -1182,7 +1182,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
} }
} }
} }
b += numcuts - 1; b += numcuts - 1;
BLI_array_grow_items(loops_split, numcuts); BLI_array_grow_items(loops_split, numcuts);
@ -1230,7 +1230,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
b = (b - 1) % vlen; b = (b - 1) % vlen;
a = (a + 1) % vlen; a = (a + 1) % vlen;
} }
/* Since these are newly created vertices, we don't need to worry about them being legal, /* Since these are newly created vertices, we don't need to worry about them being legal,
* ... though there are some cases we _should_ check for * ... though there are some cases we _should_ check for
* - concave corner of an ngon. * - concave corner of an ngon.
@ -1281,7 +1281,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
} }
BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, params.shape_info.tmpkey); BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, params.shape_info.tmpkey);
BLI_stack_free(facedata); BLI_stack_free(facedata);
if (edges) BLI_array_free(edges); if (edges) BLI_array_free(edges);
if (verts) BLI_array_free(verts); if (verts) BLI_array_free(verts);
@ -1290,7 +1290,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_inner.out", BM_ALL_NOLOOP, ELE_INNER); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_inner.out", BM_ALL_NOLOOP, ELE_INNER);
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_split.out", BM_ALL_NOLOOP, ELE_SPLIT); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_split.out", BM_ALL_NOLOOP, ELE_SPLIT);
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_INNER | ELE_SPLIT | SUBD_SPLIT); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_INNER | ELE_SPLIT | SUBD_SPLIT);
} }
@ -1306,7 +1306,7 @@ void BM_mesh_esubdivide(
const int seed) const int seed)
{ {
BMOperator op; BMOperator op;
/* use_sphere isnt exposed here since its only used for new primitives */ /* use_sphere isnt exposed here since its only used for new primitives */
BMO_op_initf(bm, &op, BMO_FLAG_DEFAULTS, BMO_op_initf(bm, &op, BMO_FLAG_DEFAULTS,
"subdivide_edges edges=%he " "subdivide_edges edges=%he "
@ -1325,9 +1325,9 @@ void BM_mesh_esubdivide(
use_single_edge, use_grid_fill, use_single_edge, use_grid_fill,
use_only_quads, use_only_quads,
seed); seed);
BMO_op_exec(bm, &op); BMO_op_exec(bm, &op);
switch (seltype) { switch (seltype) {
case SUBDIV_SELECT_NONE: case SUBDIV_SELECT_NONE:
break; break;
@ -1354,11 +1354,11 @@ void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
BMOIter siter; BMOIter siter;
BMEdge *e; BMEdge *e;
SubDParams params = {0}; SubDParams params = {0};
params.numcuts = BMO_slot_int_get(op->slots_in, "cuts"); params.numcuts = BMO_slot_int_get(op->slots_in, "cuts");
params.op = op; params.op = op;
params.slot_edge_percents = BMO_slot_get(op->slots_in, "edge_percents"); params.slot_edge_percents = BMO_slot_get(op->slots_in, "edge_percents");
BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY); BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
bmo_subd_init_shape_info(bm, &params); bmo_subd_init_shape_info(bm, &params);

@ -83,9 +83,9 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
sf_vert_map = BLI_ghash_ptr_new_ex(__func__, BMO_slot_buffer_count(op->slots_in, "edges")); sf_vert_map = BLI_ghash_ptr_new_ex(__func__, BMO_slot_buffer_count(op->slots_in, "edges"));
BMO_slot_vec_get(op->slots_in, "normal", normal); BMO_slot_vec_get(op->slots_in, "normal", normal);
BLI_scanfill_begin(&sf_ctx); BLI_scanfill_begin(&sf_ctx);
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) { BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
ScanFillVert *sf_verts[2]; ScanFillVert *sf_verts[2];
BMVert **e_verts = &e->v1; BMVert **e_verts = &e->v1;
@ -108,7 +108,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
} }
nors_tot = BLI_ghash_len(sf_vert_map); nors_tot = BLI_ghash_len(sf_vert_map);
BLI_ghash_free(sf_vert_map, NULL, NULL); BLI_ghash_free(sf_vert_map, NULL, NULL);
if (is_zero_v3(normal)) { if (is_zero_v3(normal)) {
/* calculate the normal from the cross product of vert-edge pairs. /* calculate the normal from the cross product of vert-edge pairs.
@ -225,7 +225,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
f = BM_face_create_quad_tri(bm, f = BM_face_create_quad_tri(bm,
sf_tri->v1->tmp.p, sf_tri->v2->tmp.p, sf_tri->v3->tmp.p, NULL, sf_tri->v1->tmp.p, sf_tri->v2->tmp.p, sf_tri->v3->tmp.p, NULL,
NULL, BM_CREATE_NO_DOUBLE); NULL, BM_CREATE_NO_DOUBLE);
BMO_face_flag_enable(bm, f, ELE_NEW); BMO_face_flag_enable(bm, f, ELE_NEW);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (!BMO_edge_flag_test(bm, l->e, EDGE_MARK)) { if (!BMO_edge_flag_test(bm, l->e, EDGE_MARK)) {
@ -233,9 +233,9 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
} }
} }
} }
BLI_scanfill_end(&sf_ctx); BLI_scanfill_end(&sf_ctx);
if (use_beauty) { if (use_beauty) {
BMOperator bmop; BMOperator bmop;

@ -151,7 +151,7 @@ typedef struct BoundVert {
bool any_seam; /* are any of the edges attached here seams? */ bool any_seam; /* are any of the edges attached here seams? */
bool visited; /* used during delta adjust pass */ bool visited; /* used during delta adjust pass */
// int _pad; // int _pad;
} BoundVert; } BoundVert;
/* Mesh structure replacing a vertex */ /* Mesh structure replacing a vertex */
typedef struct VMesh { typedef struct VMesh {
@ -511,7 +511,7 @@ static BMFace *bev_create_ngon(
static BMFace *bev_create_quad( static BMFace *bev_create_quad(
BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4, BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4,
int mat_nr) int mat_nr)
{ {
BMVert *varr[4] = {v1, v2, v3, v4}; BMVert *varr[4] = {v1, v2, v3, v4};
@ -521,7 +521,7 @@ static BMFace *bev_create_quad(
static BMFace *bev_create_quad_ex( static BMFace *bev_create_quad_ex(
BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4, BMFace *f1, BMFace *f2, BMFace *f3, BMFace *f4,
BMEdge *e1, BMEdge *e2, BMEdge *e3, BMEdge *e4, BMEdge *e1, BMEdge *e2, BMEdge *e3, BMEdge *e4,
int mat_nr) int mat_nr)
{ {
@ -1355,7 +1355,7 @@ static void get_profile_point(BevelParams *bp, const Profile *pro, int i, int n,
else else
copy_v3_v3(r_co, pro->cob); copy_v3_v3(r_co, pro->cob);
} }
else { else {
if (n == bp->seg) { if (n == bp->seg) {
BLI_assert(pro->prof_co != NULL); BLI_assert(pro->prof_co != NULL);
@ -2119,7 +2119,7 @@ static void adjust_the_cycle_or_chain(BoundVert *vstart, bool iscycle)
#ifdef DEBUG_ADJUST #ifdef DEBUG_ADJUST
printf("b[%d]=%f * %f, for e%d->offset_r\n", row, weight, eright->offset_r, BM_elem_index_get(eright->e)); printf("b[%d]=%f * %f, for e%d->offset_r\n", row, weight, eright->offset_r, BM_elem_index_get(eright->e));
#endif #endif
/* residue np + 2*i + 1 (if cycle) else np - 1 + 2*i + 1: /* residue np + 2*i + 1 (if cycle) else np - 1 + 2*i + 1:
* left offset for parm i matches its spec; weighted */ * left offset for parm i matches its spec; weighted */
row = row + 1; row = row + 1;
@ -2607,7 +2607,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
float beta, gamma; float beta, gamma;
VMesh *vm1; VMesh *vm1;
BoundVert *bndv; BoundVert *bndv;
n = vm0->count; n = vm0->count;
ns0 = vm0->seg; ns0 = vm0->seg;
ns20 = ns0 / 2; ns20 = ns0 / 2;
@ -2627,7 +2627,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
add_v3_v3v3(acc, co1, co2); add_v3_v3v3(acc, co1, co2);
madd_v3_v3fl(acc, co, -2.0f); madd_v3_v3fl(acc, co, -2.0f);
madd_v3_v3fl(co, acc, -1.0f / 6.0f); madd_v3_v3fl(co, acc, -1.0f / 6.0f);
copy_v3_v3(mesh_vert_canon(vm1, i, 0, 2 * k)->co, co); copy_v3_v3(mesh_vert_canon(vm1, i, 0, 2 * k)->co, co);
} }
} }
@ -2642,7 +2642,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
add_v3_v3v3(acc, co1, co2); add_v3_v3v3(acc, co1, co2);
madd_v3_v3fl(acc, co, -2.0f); madd_v3_v3fl(acc, co, -2.0f);
madd_v3_v3fl(co, acc, -1.0f / 6.0f); madd_v3_v3fl(co, acc, -1.0f / 6.0f);
copy_v3_v3(mesh_vert_canon(vm1, i, 0, k)->co, co); copy_v3_v3(mesh_vert_canon(vm1, i, 0, k)->co, co);
} }
bndv = bndv->next; bndv = bndv->next;
@ -2661,7 +2661,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
/* Now we do the internal vertices, using standard Catmull-Clark /* Now we do the internal vertices, using standard Catmull-Clark
* and assuming all boundary vertices have valence 4 */ * and assuming all boundary vertices have valence 4 */
/* The new face vertices */ /* The new face vertices */
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
for (j = 0; j < ns20; j++) { for (j = 0; j < ns20; j++) {
@ -2882,7 +2882,7 @@ static VMesh *make_cube_corner_adj_vmesh(BevelParams *bp)
copy_v3_v3(bndv->profile.proj_dir, bndv->profile.plane_no); copy_v3_v3(bndv->profile.proj_dir, bndv->profile.plane_no);
calculate_profile(bp, bndv); calculate_profile(bp, bndv);
get_profile_point(bp, &bndv->profile, 1, 2, mesh_vert(vm0, i, 0, 1)->co); get_profile_point(bp, &bndv->profile, 1, 2, mesh_vert(vm0, i, 0, 1)->co);
bndv = bndv->next; bndv = bndv->next;
} }
/* center vertex */ /* center vertex */
@ -4618,7 +4618,7 @@ static void bevel_reattach_wires(BMesh *bm, BevelParams *bp, BMVert *v)
vclosest = bndv->nv.v; vclosest = bndv->nv.v;
votherclosest = bndvother->nv.v; votherclosest = bndvother->nv.v;
dclosest = d; dclosest = d;
} }
} while ((bndvother = bndvother->next) != bvother->vmesh->boundstart); } while ((bndvother = bndvother->next) != bvother->vmesh->boundstart);
} }
@ -5215,7 +5215,7 @@ static float geometry_collide_offset(BevelParams *bp, EdgeHalf *eb)
kc = kc / bp->offset; kc = kc / bp->offset;
th1 = angle_v3v3v3(va->co, vb->co, vc->co); th1 = angle_v3v3v3(va->co, vb->co, vc->co);
th2 = angle_v3v3v3(vb->co, vc->co, vd->co); th2 = angle_v3v3v3(vb->co, vc->co, vd->co);
/* First calculate offset at which edge B collapses, which happens /* First calculate offset at which edge B collapses, which happens
* when advancing clones of A, B, C all meet at a point. * when advancing clones of A, B, C all meet at a point.
* This only happens if at least two of those three edges have non-zero k's */ * This only happens if at least two of those three edges have non-zero k's */

@ -18,7 +18,7 @@
# #
# ***** END GPL LICENSE BLOCK ***** # ***** END GPL LICENSE BLOCK *****
set(INC set(INC
. .
../../bmesh ../../bmesh
../../blenkernel ../../blenkernel

@ -2153,7 +2153,7 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
if (vert_array == NULL) { if (vert_array == NULL) {
return NULL; return NULL;
} }
if (BM_edge_exists(vert_array[0], vert_array[1])) { if (BM_edge_exists(vert_array[0], vert_array[1])) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"edges.new(): this edge exists"); "edges.new(): this edge exists");

@ -18,7 +18,7 @@
# #
# ***** END GPL LICENSE BLOCK ***** # ***** END GPL LICENSE BLOCK *****
set(INC set(INC
. .
../../blenkernel ../../blenkernel
../../blenlib ../../blenlib

@ -866,7 +866,7 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end)
{ {
PyObject *list; PyObject *list;
int count; int count;
if (begin < 0) begin = 0; if (begin < 0) begin = 0;
if (end > self->dimensions[0]) end = self->dimensions[0]; if (end > self->dimensions[0]) end = self->dimensions[0];
if (begin > end) begin = end; if (begin > end) begin = end;
@ -914,11 +914,11 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
{ {
PyObject *item; PyObject *item;
int count, err = 0; int count, err = 0;
if (begin < 0) begin = 0; if (begin < 0) begin = 0;
if (end > self->dimensions[0]) end = self->dimensions[0]; if (end > self->dimensions[0]) end = self->dimensions[0];
if (begin > end) begin = end; if (begin > end) begin = end;
if (!PySequence_Check(seq)) { if (!PySequence_Check(seq)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"buffer[:] = value, invalid assignment. " "buffer[:] = value, invalid assignment. "
@ -934,7 +934,7 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
"Expected: %d (given: %d)", count, end - begin); "Expected: %d (given: %d)", count, end - begin);
return -1; return -1;
} }
for (count = begin; count < end; count++) { for (count = begin; count < end; count++) {
item = PySequence_GetItem(seq, count - begin); item = PySequence_GetItem(seq, count - begin);
if (item) { if (item) {

@ -39,7 +39,7 @@ int BGL_typeSize(int type);
* For Python access to OpenGL functions requiring a pointer. * For Python access to OpenGL functions requiring a pointer.
*/ */
typedef struct _Buffer { typedef struct _Buffer {
PyObject_VAR_HEAD PyObject_VAR_HEAD
PyObject *parent; PyObject *parent;
int type; /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */ int type; /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */

@ -307,7 +307,7 @@ static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
if (!PyArg_ParseTuple(args, "if:blf.rotation", &fontid, &angle)) if (!PyArg_ParseTuple(args, "if:blf.rotation", &fontid, &angle))
return NULL; return NULL;
BLF_rotation(fontid, angle); BLF_rotation(fontid, angle);
Py_RETURN_NONE; Py_RETURN_NONE;

@ -177,7 +177,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
int namelen = strlen(name); int namelen = strlen(name);
//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main; //XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
Main *maggie = bpy_import_main; Main *maggie = bpy_import_main;
*found = 0; *found = 0;
if (!maggie) { if (!maggie) {
@ -210,7 +210,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
return NULL; return NULL;
else else
*found = 1; *found = 1;
return bpy_text_import(text); return bpy_text_import(text);
} }
@ -226,14 +226,14 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
const char *filepath; const char *filepath;
//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main; //XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
Main *maggie = bpy_import_main; Main *maggie = bpy_import_main;
if (!maggie) { if (!maggie) {
printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n"); printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
return NULL; return NULL;
} }
*found = 0; *found = 0;
/* get name, filename from the module itself */ /* get name, filename from the module itself */
if ((name = PyModule_GetName(module)) == NULL) if ((name = PyModule_GetName(module)) == NULL)
return NULL; return NULL;
@ -288,15 +288,15 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
/* import existing builtin modules or modules that have been imported already */ /* import existing builtin modules or modules that have been imported already */
newmodule = PyImport_ImportModuleLevel(name, globals, locals, fromlist, level); newmodule = PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
if (newmodule) if (newmodule)
return newmodule; return newmodule;
PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */ PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */
/* importing from existing modules failed, see if we have this module as blender text */ /* importing from existing modules failed, see if we have this module as blender text */
newmodule = bpy_text_import_name(name, &found); newmodule = bpy_text_import_name(name, &found);
if (newmodule) { /* found module as blender text, ignore above exception */ if (newmodule) { /* found module as blender text, ignore above exception */
PyErr_Clear(); PyErr_Clear();
Py_XDECREF(exception); Py_XDECREF(exception);

@ -1,4 +1,4 @@
/* /*
* ***** BEGIN GPL LICENSE BLOCK ***** * ***** BEGIN GPL LICENSE BLOCK *****
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -47,7 +47,7 @@ bool bpy_text_compile(struct Text *text);
PyObject *bpy_text_import(struct Text *text); PyObject *bpy_text_import(struct Text *text);
PyObject *bpy_text_import_name(const char *name, int *found); PyObject *bpy_text_import_name(const char *name, int *found);
PyObject *bpy_text_reimport(PyObject *module, int *found); PyObject *bpy_text_reimport(PyObject *module, int *found);
/* void bpy_text_clear_modules(int clear_all);*/ /* Clear user modules */ /* void bpy_text_clear_modules(int clear_all);*/ /* Clear user modules */
void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text); void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text);

@ -295,7 +295,7 @@ void PyC_LineSpit(void)
PyErr_Clear(); PyErr_Clear();
PyC_FileAndNum(&filename, &lineno); PyC_FileAndNum(&filename, &lineno);
fprintf(stderr, "%s:%d\n", filename, lineno); fprintf(stderr, "%s:%d\n", filename, lineno);
} }
@ -317,7 +317,7 @@ void PyC_StackSpit(void)
void PyC_FileAndNum(const char **filename, int *lineno) void PyC_FileAndNum(const char **filename, int *lineno)
{ {
PyFrameObject *frame; PyFrameObject *frame;
if (filename) *filename = NULL; if (filename) *filename = NULL;
if (lineno) *lineno = -1; if (lineno) *lineno = -1;
@ -375,22 +375,22 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
Py_ssize_t i; Py_ssize_t i;
PyObject *item = o; PyObject *item = o;
const char *attr; const char *attr;
va_list vargs; va_list vargs;
va_start(vargs, n); va_start(vargs, n);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
attr = va_arg(vargs, char *); attr = va_arg(vargs, char *);
item = PyObject_GetAttrString(item, attr); item = PyObject_GetAttrString(item, attr);
if (item) if (item)
Py_DECREF(item); Py_DECREF(item);
else /* python will set the error value here */ else /* python will set the error value here */
break; break;
} }
va_end(vargs); va_end(vargs);
Py_XINCREF(item); /* final value has is increfed, to match PyObject_GetAttrString */ Py_XINCREF(item); /* final value has is increfed, to match PyObject_GetAttrString */
return item; return item;
} }
@ -839,7 +839,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
} }
} }
va_end(vargs); va_end(vargs);
/* set the value so we can access it */ /* set the value so we can access it */
PyDict_SetItemString(py_dict, "values", values); PyDict_SetItemString(py_dict, "values", values);
Py_DECREF(values); Py_DECREF(values);
@ -865,7 +865,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
for (i = 0; i * 2 < n; i++) { for (i = 0; i * 2 < n; i++) {
const char *format = va_arg(vargs, char *); const char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *); void *ptr = va_arg(vargs, void *);
PyObject *item; PyObject *item;
PyObject *item_new; PyObject *item_new;
/* prepend the string formatting and remake the tuple */ /* prepend the string formatting and remake the tuple */

@ -171,7 +171,7 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
PyErr_SetString(PyExc_ValueError, "invalid resource argument"); PyErr_SetString(PyExc_ValueError, "invalid resource argument");
return NULL; return NULL;
} }
/* same logic as BKE_appdir_folder_id_create(), but best leave it up to the script author to create */ /* same logic as BKE_appdir_folder_id_create(), but best leave it up to the script author to create */
path = BKE_appdir_folder_id(folder_id, subdir); path = BKE_appdir_folder_id(folder_id, subdir);

@ -253,10 +253,10 @@ static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *clos
PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False"); PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
return -1; return -1;
} }
if (param) G.debug |= flag; if (param) G.debug |= flag;
else G.debug &= ~flag; else G.debug &= ~flag;
return 0; return 0;
} }
@ -307,7 +307,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void
PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number"); PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
return -1; return -1;
} }
G.debug_value = param; G.debug_value = param;
WM_main_add_notifier(NC_WINDOW, NULL); WM_main_add_notifier(NC_WINDOW, NULL);
@ -406,7 +406,7 @@ static void py_struct_seq_getset_init(void)
PyObject *BPY_app_struct(void) PyObject *BPY_app_struct(void)
{ {
PyObject *ret; PyObject *ret;
PyStructSequence_InitType(&BlenderAppType, &app_info_desc); PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
ret = make_app_info(); ret = make_app_info();

@ -88,21 +88,21 @@ bool BPy_errors_to_report_ex(ReportList *reports, const bool use_full, const boo
if (!PyErr_Occurred()) if (!PyErr_Occurred())
return 1; return 1;
/* less hassle if we allow NULL */ /* less hassle if we allow NULL */
if (reports == NULL) { if (reports == NULL) {
PyErr_Print(); PyErr_Print();
PyErr_Clear(); PyErr_Clear();
return 1; return 1;
} }
if (use_full) { if (use_full) {
pystring = PyC_ExceptionBuffer(); pystring = PyC_ExceptionBuffer();
} }
else { else {
pystring = PyC_ExceptionBuffer_Simple(); pystring = PyC_ExceptionBuffer_Simple();
} }
if (pystring == NULL) { if (pystring == NULL) {
BKE_report(reports, RPT_ERROR, "Unknown py-exception, could not convert"); BKE_report(reports, RPT_ERROR, "Unknown py-exception, could not convert");
return 0; return 0;

@ -285,7 +285,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, c
for (dvar = driver->variables.first, i = 0; dvar; dvar = dvar->next) { for (dvar = driver->variables.first, i = 0; dvar; dvar = dvar->next) {
PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_FromString(dvar->name)); PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_FromString(dvar->name));
} }
driver->flag &= ~DRIVER_FLAG_RENAMEVAR; driver->flag &= ~DRIVER_FLAG_RENAMEVAR;
} }
else { else {
@ -342,7 +342,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, c
fprintf(stderr, "\nBPY_driver_eval() - Error while evaluating PyDriver:\n"); fprintf(stderr, "\nBPY_driver_eval() - Error while evaluating PyDriver:\n");
targets_ok = 0; targets_ok = 0;
} }
fprintf(stderr, "\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n", dvar->name); fprintf(stderr, "\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n", dvar->name);
// BPy_errors_to_report(NULL); // TODO - reports // BPy_errors_to_report(NULL); // TODO - reports
PyErr_Print(); PyErr_Print();

@ -291,7 +291,7 @@ void BPY_python_start(int argc, const char **argv)
PySys_SetObject("argv", py_argv); PySys_SetObject("argv", py_argv);
Py_DECREF(py_argv); Py_DECREF(py_argv);
} }
/* Initialize thread support (also acquires lock) */ /* Initialize thread support (also acquires lock) */
PyEval_InitThreads(); PyEval_InitThreads();
#else #else
@ -330,7 +330,7 @@ void BPY_python_start(int argc, const char **argv)
BPy_init_modules(); BPy_init_modules();
bpy_import_init(PyEval_GetBuiltins()); bpy_import_init(PyEval_GetBuiltins());
pyrna_alloc_types(); pyrna_alloc_types();
#ifndef WITH_PYTHON_MODULE #ifndef WITH_PYTHON_MODULE
@ -349,7 +349,7 @@ void BPY_python_end(void)
/* finalizing, no need to grab the state, except when we are a module */ /* finalizing, no need to grab the state, except when we are a module */
gilstate = PyGILState_Ensure(); gilstate = PyGILState_Ensure();
/* free other python data. */ /* free other python data. */
pyrna_free_types(); pyrna_free_types();
@ -696,7 +696,7 @@ bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
PyC_MainModule_Restore(main_mod); PyC_MainModule_Restore(main_mod);
bpy_context_clear(C, &gilstate); bpy_context_clear(C, &gilstate);
return ok; return ok;
} }
@ -880,7 +880,7 @@ static void bpy_module_delay_init(PyObject *bpy_proxy)
argv[0] = filename_abs; argv[0] = filename_abs;
argv[1] = NULL; argv[1] = NULL;
// printf("module found %s\n", argv[0]); // printf("module found %s\n", argv[0]);
main_python_enter(argc, argv); main_python_enter(argc, argv);
@ -909,14 +909,14 @@ PyMODINIT_FUNC
PyInit_bpy(void) PyInit_bpy(void)
{ {
PyObject *bpy_proxy = PyModule_Create(&bpy_proxy_def); PyObject *bpy_proxy = PyModule_Create(&bpy_proxy_def);
/* Problem: /* Problem:
* 1) this init function is expected to have a private member defined - 'md_def' * 1) this init function is expected to have a private member defined - 'md_def'
* but this is only set for C defined modules (not py packages) * but this is only set for C defined modules (not py packages)
* so we cant return 'bpy_package_py' as is. * so we cant return 'bpy_package_py' as is.
* *
* 2) there is a 'bpy' C module for python to load which is basically all of blender, * 2) there is a 'bpy' C module for python to load which is basically all of blender,
* and there is scripts/bpy/__init__.py, * and there is scripts/bpy/__init__.py,
* we may end up having to rename this module so there is no naming conflict here eg: * we may end up having to rename this module so there is no naming conflict here eg:
* 'from blender import bpy' * 'from blender import bpy'
* *
@ -926,13 +926,13 @@ PyInit_bpy(void)
/* assign an object which is freed after __file__ is assigned */ /* assign an object which is freed after __file__ is assigned */
dealloc_obj *dob; dealloc_obj *dob;
/* assign dummy type */ /* assign dummy type */
dealloc_obj_Type.tp_name = "dealloc_obj"; dealloc_obj_Type.tp_name = "dealloc_obj";
dealloc_obj_Type.tp_basicsize = sizeof(dealloc_obj); dealloc_obj_Type.tp_basicsize = sizeof(dealloc_obj);
dealloc_obj_Type.tp_dealloc = dealloc_obj_dealloc; dealloc_obj_Type.tp_dealloc = dealloc_obj_dealloc;
dealloc_obj_Type.tp_flags = Py_TPFLAGS_DEFAULT; dealloc_obj_Type.tp_flags = Py_TPFLAGS_DEFAULT;
if (PyType_Ready(&dealloc_obj_Type) < 0) if (PyType_Ready(&dealloc_obj_Type) < 0)
return NULL; return NULL;

@ -79,7 +79,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
/* XXX Todo, work out a better solution for passing on context, /* XXX Todo, work out a better solution for passing on context,
* could make a tuple from self and pack the name and Context into it... */ * could make a tuple from self and pack the name and Context into it... */
bContext *C = (bContext *)BPy_GetContext(); bContext *C = (bContext *)BPy_GetContext();
if (C == NULL) { if (C == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators"); PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
return NULL; return NULL;
@ -87,7 +87,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str)) if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str))
return NULL; return NULL;
ot = WM_operatortype_find(opname, true); ot = WM_operatortype_find(opname, true);
if (ot == NULL) { if (ot == NULL) {
@ -108,7 +108,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
return NULL; return NULL;
} }
} }
if (context_dict == NULL || context_dict == Py_None) { if (context_dict == NULL || context_dict == Py_None) {
context_dict = NULL; context_dict = NULL;
} }
@ -123,10 +123,10 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
context_dict_back = CTX_py_dict_get(C); context_dict_back = CTX_py_dict_get(C);
CTX_py_dict_set(C, (void *)context_dict); CTX_py_dict_set(C, (void *)context_dict);
Py_XINCREF(context_dict); /* so we done loose it */ Py_XINCREF(context_dict); /* so we done loose it */
/* main purpose of thsi function */ /* main purpose of thsi function */
ret = WM_operator_poll_context((bContext *)C, ot, context) ? Py_True : Py_False; ret = WM_operator_poll_context((bContext *)C, ot, context) ? Py_True : Py_False;
/* restore with original context dict, probably NULL but need this for nested operator calls */ /* restore with original context dict, probably NULL but need this for nested operator calls */
Py_XDECREF(context_dict); Py_XDECREF(context_dict);
CTX_py_dict_set(C, (void *)context_dict_back); CTX_py_dict_set(C, (void *)context_dict_back);
@ -154,12 +154,12 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
/* XXX Todo, work out a better solution for passing on context, /* XXX Todo, work out a better solution for passing on context,
* could make a tuple from self and pack the name and Context into it... */ * could make a tuple from self and pack the name and Context into it... */
bContext *C = (bContext *)BPy_GetContext(); bContext *C = (bContext *)BPy_GetContext();
if (C == NULL) { if (C == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators"); PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
return NULL; return NULL;
} }
if (!PyArg_ParseTuple(args, "sO|O!si:_bpy.ops.call", if (!PyArg_ParseTuple(args, "sO|O!si:_bpy.ops.call",
&opname, &context_dict, &PyDict_Type, &kw, &context_str, &is_undo)) &opname, &context_dict, &PyDict_Type, &kw, &context_str, &is_undo))
{ {
@ -174,7 +174,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
"could not be found", opname); "could not be found", opname);
return NULL; return NULL;
} }
if (!pyrna_write_check()) { if (!pyrna_write_check()) {
PyErr_Format(PyExc_RuntimeError, PyErr_Format(PyExc_RuntimeError,
"Calling operator \"bpy.ops.%s\" error, " "Calling operator \"bpy.ops.%s\" error, "
@ -259,7 +259,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
PySys_WriteStdout("%s: %s\n", report->typestr, report->message); PySys_WriteStdout("%s: %s\n", report->typestr, report->message);
} }
} }
BKE_reports_clear(reports); BKE_reports_clear(reports);
if ((reports->flag & RPT_FREE) == 0) { if ((reports->flag & RPT_FREE) == 0) {
MEM_freeN(reports); MEM_freeN(reports);
@ -330,7 +330,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant get the string representation of this object."); PyErr_SetString(PyExc_RuntimeError, "Context is None, cant get the string representation of this object.");
return NULL; return NULL;
} }
if (!PyArg_ParseTuple( if (!PyArg_ParseTuple(
args, "s|O!O&O&:_bpy.ops.as_string", args, "s|O!O&O&:_bpy.ops.as_string",
&opname, &PyDict_Type, &kw, &opname, &PyDict_Type, &kw,
@ -400,7 +400,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
PointerRNA ptr; PointerRNA ptr;
const char *opname = _PyUnicode_AsString(value); const char *opname = _PyUnicode_AsString(value);
BPy_StructRNA *pyrna = NULL; BPy_StructRNA *pyrna = NULL;
if (opname == NULL) { if (opname == NULL) {
PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument"); PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument");
return NULL; return NULL;
@ -410,7 +410,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname); PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname);
return NULL; return NULL;
} }
/* type */ /* type */
//RNA_pointer_create(NULL, &RNA_Struct, ot->srna, &ptr); //RNA_pointer_create(NULL, &RNA_Struct, ot->srna, &ptr);
@ -418,7 +418,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
WM_operator_properties_create_ptr(&ptr, ot); WM_operator_properties_create_ptr(&ptr, ot);
WM_operator_properties_sanitize(&ptr, 0); WM_operator_properties_sanitize(&ptr, 0);
pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr); pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
#ifdef PYRNA_FREE_SUPPORT #ifdef PYRNA_FREE_SUPPORT
pyrna->freeptr = true; pyrna->freeptr = true;

@ -366,7 +366,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *
Py_DECREF(ret); Py_DECREF(ret);
} }
if (use_gil) if (use_gil)
PyGILState_Release(gilstate); PyGILState_Release(gilstate);
@ -1329,7 +1329,7 @@ static int icon_id_from_name(const char *name)
} }
} }
} }
return 0; return 0;
} }
@ -1631,7 +1631,7 @@ static void bpy_prop_callback_assign_boolean(struct PropertyRNA *prop, PyObject
{ {
BooleanPropertyGetFunc rna_get_cb = NULL; BooleanPropertyGetFunc rna_get_cb = NULL;
BooleanPropertySetFunc rna_set_cb = NULL; BooleanPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) { if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop); PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1653,7 +1653,7 @@ static void bpy_prop_callback_assign_boolean_array(struct PropertyRNA *prop, PyO
{ {
BooleanArrayPropertyGetFunc rna_get_cb = NULL; BooleanArrayPropertyGetFunc rna_get_cb = NULL;
BooleanArrayPropertySetFunc rna_set_cb = NULL; BooleanArrayPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) { if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop); PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1675,7 +1675,7 @@ static void bpy_prop_callback_assign_int(struct PropertyRNA *prop, PyObject *get
{ {
IntPropertyGetFunc rna_get_cb = NULL; IntPropertyGetFunc rna_get_cb = NULL;
IntPropertySetFunc rna_set_cb = NULL; IntPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) { if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop); PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1697,7 +1697,7 @@ static void bpy_prop_callback_assign_int_array(struct PropertyRNA *prop, PyObjec
{ {
IntArrayPropertyGetFunc rna_get_cb = NULL; IntArrayPropertyGetFunc rna_get_cb = NULL;
IntArrayPropertySetFunc rna_set_cb = NULL; IntArrayPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) { if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop); PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1719,7 +1719,7 @@ static void bpy_prop_callback_assign_float(struct PropertyRNA *prop, PyObject *g
{ {
FloatPropertyGetFunc rna_get_cb = NULL; FloatPropertyGetFunc rna_get_cb = NULL;
FloatPropertySetFunc rna_set_cb = NULL; FloatPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) { if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop); PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1741,7 +1741,7 @@ static void bpy_prop_callback_assign_float_array(struct PropertyRNA *prop, PyObj
{ {
FloatArrayPropertyGetFunc rna_get_cb = NULL; FloatArrayPropertyGetFunc rna_get_cb = NULL;
FloatArrayPropertySetFunc rna_set_cb = NULL; FloatArrayPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) { if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop); PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1764,7 +1764,7 @@ static void bpy_prop_callback_assign_string(struct PropertyRNA *prop, PyObject *
StringPropertyGetFunc rna_get_cb = NULL; StringPropertyGetFunc rna_get_cb = NULL;
StringPropertyLengthFunc rna_length_cb = NULL; StringPropertyLengthFunc rna_length_cb = NULL;
StringPropertySetFunc rna_set_cb = NULL; StringPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) { if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop); PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1788,7 +1788,7 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, PyObject *ge
EnumPropertyGetFunc rna_get_cb = NULL; EnumPropertyGetFunc rna_get_cb = NULL;
EnumPropertyItemFunc rna_itemf_cb = NULL; EnumPropertyItemFunc rna_itemf_cb = NULL;
EnumPropertySetFunc rna_set_cb = NULL; EnumPropertySetFunc rna_set_cb = NULL;
if (get_cb && get_cb != Py_None) { if (get_cb && get_cb != Py_None) {
PyObject **py_data = bpy_prop_py_data_get(prop); PyObject **py_data = bpy_prop_py_data_get(prop);
@ -1815,7 +1815,7 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, PyObject *ge
RNA_def_property_enum_funcs_runtime(prop, rna_get_cb, rna_set_cb, rna_itemf_cb); RNA_def_property_enum_funcs_runtime(prop, rna_get_cb, rna_set_cb, rna_itemf_cb);
} }
/* this define runs at the start of each function and deals with /* this define runs at the start of each function and deals with
* returning a deferred property (to be registered later) */ * returning a deferred property (to be registered later) */
#define BPY_PROPDEF_HEAD(_func) \ #define BPY_PROPDEF_HEAD(_func) \
if (PyTuple_GET_SIZE(args) == 1) { \ if (PyTuple_GET_SIZE(args) == 1) { \
@ -2166,7 +2166,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
bpy_prop_callback_assign_boolean_array(prop, get_cb, set_cb); bpy_prop_callback_assign_boolean_array(prop, get_cb, set_cb);
RNA_def_property_duplicate_pointers(srna, prop); RNA_def_property_duplicate_pointers(srna, prop);
} }
Py_RETURN_NONE; Py_RETURN_NONE;
} }
@ -2801,7 +2801,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna; StructRNA *srna;
BPY_PROPDEF_HEAD(EnumProperty); BPY_PROPDEF_HEAD(EnumProperty);
if (srna) { if (srna) {
const char *id = NULL, *name = NULL, *description = ""; const char *id = NULL, *name = NULL, *description = "";
PyObject *def = NULL; PyObject *def = NULL;
@ -3195,7 +3195,7 @@ PyObject *BPY_rna_props(void)
{ {
PyObject *submodule; PyObject *submodule;
PyObject *submodule_dict; PyObject *submodule_dict;
submodule = PyModule_Create(&props_module); submodule = PyModule_Create(&props_module);
PyDict_SetItemString(PyImport_GetModuleDict(), props_module.m_name, submodule); PyDict_SetItemString(PyImport_GetModuleDict(), props_module.m_name, submodule);
@ -3203,7 +3203,7 @@ PyObject *BPY_rna_props(void)
* module with a new ref like PyDict_New, since they are passed to * module with a new ref like PyDict_New, since they are passed to
* PyModule_AddObject which steals a ref */ * PyModule_AddObject which steals a ref */
Py_INCREF(submodule); Py_INCREF(submodule);
/* api needs the PyObjects internally */ /* api needs the PyObjects internally */
submodule_dict = PyModule_GetDict(submodule); submodule_dict = PyModule_GetDict(submodule);
@ -3220,6 +3220,6 @@ PyObject *BPY_rna_props(void)
ASSIGN_STATIC(PointerProperty); ASSIGN_STATIC(PointerProperty);
ASSIGN_STATIC(CollectionProperty); ASSIGN_STATIC(CollectionProperty);
ASSIGN_STATIC(RemoveProperty); ASSIGN_STATIC(RemoveProperty);
return submodule; return submodule;
} }

@ -234,13 +234,13 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
struct Depsgraph *depsgraph = CTX_data_depsgraph(BPy_GetContext()); struct Depsgraph *depsgraph = CTX_data_depsgraph(BPy_GetContext());
ReportList reports; ReportList reports;
short result = 0; short result = 0;
PointerRNA ptr = self->ptr; PointerRNA ptr = self->ptr;
PropertyRNA *prop = NULL; PropertyRNA *prop = NULL;
const char *prop_name; const char *prop_name;
BKE_reports_init(&reports, RPT_STORE); BKE_reports_init(&reports, RPT_STORE);
/* Retrieve the property identifier from the full path, since we can't get it any other way */ /* Retrieve the property identifier from the full path, since we can't get it any other way */
prop_name = strrchr(path_full, '.'); prop_name = strrchr(path_full, '.');
if ((prop_name >= path_full) && if ((prop_name >= path_full) &&
@ -248,21 +248,21 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
{ {
prop = RNA_struct_find_property(&ptr, prop_name + 1); prop = RNA_struct_find_property(&ptr, prop_name + 1);
} }
if (prop) { if (prop) {
NlaStrip *strip = (NlaStrip *)ptr.data; NlaStrip *strip = (NlaStrip *)ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index); FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index);
result = insert_keyframe_direct(depsgraph, &reports, ptr, prop, fcu, cfra, keytype, options); result = insert_keyframe_direct(depsgraph, &reports, ptr, prop, fcu, cfra, keytype, options);
} }
else { else {
BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full); BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
} }
MEM_freeN((void *)path_full); MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
return NULL; return NULL;
return PyBool_FromLong(result); return PyBool_FromLong(result);
} }
else { else {
@ -322,13 +322,13 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
*/ */
ReportList reports; ReportList reports;
short result = 0; short result = 0;
PointerRNA ptr = self->ptr; PointerRNA ptr = self->ptr;
PropertyRNA *prop = NULL; PropertyRNA *prop = NULL;
const char *prop_name; const char *prop_name;
BKE_reports_init(&reports, RPT_STORE); BKE_reports_init(&reports, RPT_STORE);
/* Retrieve the property identifier from the full path, since we can't get it any other way */ /* Retrieve the property identifier from the full path, since we can't get it any other way */
prop_name = strrchr(path_full, '.'); prop_name = strrchr(path_full, '.');
if ((prop_name >= path_full) && if ((prop_name >= path_full) &&
@ -336,14 +336,14 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
{ {
prop = RNA_struct_find_property(&ptr, prop_name + 1); prop = RNA_struct_find_property(&ptr, prop_name + 1);
} }
if (prop) { if (prop) {
ID *id = ptr.id.data; ID *id = ptr.id.data;
NlaStrip *strip = (NlaStrip *)ptr.data; NlaStrip *strip = (NlaStrip *)ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index); FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index);
BLI_assert(fcu != NULL); /* NOTE: This should be true, or else we wouldn't be able to get here */ BLI_assert(fcu != NULL); /* NOTE: This should be true, or else we wouldn't be able to get here */
if (BKE_fcurve_is_protected(fcu)) { if (BKE_fcurve_is_protected(fcu)) {
BKE_reportf(&reports, RPT_WARNING, BKE_reportf(&reports, RPT_WARNING,
"Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'", "Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'",
@ -356,7 +356,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
*/ */
bool found = false; bool found = false;
int i; int i;
/* try to find index of beztriple to get rid of */ /* try to find index of beztriple to get rid of */
i = binarysearch_bezt_index(fcu->bezt, cfra, fcu->totvert, &found); i = binarysearch_bezt_index(fcu->bezt, cfra, fcu->totvert, &found);
if (found) { if (found) {
@ -370,10 +370,10 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full); BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
} }
MEM_freeN((void *)path_full); MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
return NULL; return NULL;
return PyBool_FromLong(result); return PyBool_FromLong(result);
} }
else { else {
@ -425,7 +425,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
BKE_reports_init(&reports, RPT_STORE); BKE_reports_init(&reports, RPT_STORE);
result = ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index, result = ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index,
CREATEDRIVER_WITH_FMODIFIER, DRIVER_TYPE_PYTHON); CREATEDRIVER_WITH_FMODIFIER, DRIVER_TYPE_PYTHON);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
@ -451,7 +451,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr); RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
ret = pyrna_struct_CreatePyObject(&tptr); ret = pyrna_struct_CreatePyObject(&tptr);
} }
WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL); WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
} }
else { else {
@ -504,7 +504,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
return NULL; return NULL;
WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL); WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
return PyBool_FromLong(result); return PyBool_FromLong(result);

@ -277,10 +277,10 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
* dimsize[1] = 4 * dimsize[1] = 4
* dimsize[2] = 5 * dimsize[2] = 5
* lvalue_dim = 0, totdim = 3 * lvalue_dim = 0, totdim = 3
* *
* arr[2][3] = x * arr[2][3] = x
* lvalue_dim = 1 * lvalue_dim = 1
* *
* arr[2][3][4] = x * arr[2][3][4] = x
* lvalue_dim = 2 */ * lvalue_dim = 2 */
for (i = lvalue_dim; i < totdim; i++) for (i = lvalue_dim; i < totdim; i++)
@ -805,7 +805,7 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
* *
* x = arr[2] * x = arr[2]
* index = 0 + 2 * 4 * 5 * index = 0 + 2 * 4 * 5
* *
* x = arr[2][3] * x = arr[2][3]
* index = offset + 3 * 5 */ * index = offset + 3 * 5 */

@ -93,7 +93,7 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
if (!PyArg_ParseTuple(args, "OO!|s:bpy_struct.callback_add", &cb_func, &PyTuple_Type, &cb_args, &cb_event_str)) if (!PyArg_ParseTuple(args, "OO!|s:bpy_struct.callback_add", &cb_func, &PyTuple_Type, &cb_args, &cb_event_str))
return NULL; return NULL;
if (!PyCallable_Check(cb_func)) { if (!PyCallable_Check(cb_func)) {
PyErr_SetString(PyExc_TypeError, "callback_add(): first argument isn't callable"); PyErr_SetString(PyExc_TypeError, "callback_add(): first argument isn't callable");
return NULL; return NULL;

@ -18,7 +18,7 @@
# #
# ***** END GPL LICENSE BLOCK ***** # ***** END GPL LICENSE BLOCK *****
set(INC set(INC
. .
../../blenlib ../../blenlib
../../blenkernel ../../blenkernel

@ -1,4 +1,4 @@
/* /*
* ***** BEGIN GPL LICENSE BLOCK ***** * ***** BEGIN GPL LICENSE BLOCK *****
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or

@ -60,10 +60,10 @@ static PyObject *M_Interpolate_poly_3d_calc(PyObject *UNUSED(self), PyObject *ar
float fp[3]; float fp[3];
float (*vecs)[3]; float (*vecs)[3];
Py_ssize_t len; Py_ssize_t len;
PyObject *point, *veclist, *ret; PyObject *point, *veclist, *ret;
int i; int i;
if (!PyArg_ParseTuple( if (!PyArg_ParseTuple(
args, "OO!:poly_3d_calc", args, "OO!:poly_3d_calc",
&veclist, &veclist,
@ -71,27 +71,27 @@ static PyObject *M_Interpolate_poly_3d_calc(PyObject *UNUSED(self), PyObject *ar
{ {
return NULL; return NULL;
} }
if (BaseMath_ReadCallback((VectorObject *)point) == -1) if (BaseMath_ReadCallback((VectorObject *)point) == -1)
return NULL; return NULL;
fp[0] = ((VectorObject *)point)->vec[0]; fp[0] = ((VectorObject *)point)->vec[0];
fp[1] = ((VectorObject *)point)->vec[1]; fp[1] = ((VectorObject *)point)->vec[1];
if (((VectorObject *)point)->size > 2) if (((VectorObject *)point)->size > 2)
fp[2] = ((VectorObject *)point)->vec[2]; fp[2] = ((VectorObject *)point)->vec[2];
else else
fp[2] = 0.0f; /* if its a 2d vector then set the z to be zero */ fp[2] = 0.0f; /* if its a 2d vector then set the z to be zero */
len = mathutils_array_parse_alloc_v(((float **)&vecs), 3, veclist, __func__); len = mathutils_array_parse_alloc_v(((float **)&vecs), 3, veclist, __func__);
if (len == -1) { if (len == -1) {
return NULL; return NULL;
} }
if (len) { if (len) {
float *weights = MEM_mallocN(sizeof(float) * len, __func__); float *weights = MEM_mallocN(sizeof(float) * len, __func__);
interp_weights_poly_v3(weights, vecs, len, fp); interp_weights_poly_v3(weights, vecs, len, fp);
ret = PyList_New(len); ret = PyList_New(len);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
PyList_SET_ITEM(ret, i, PyFloat_FromDouble(weights[i])); PyList_SET_ITEM(ret, i, PyFloat_FromDouble(weights[i]));

@ -671,7 +671,7 @@ static PyObject *M_Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *
if (mathutils_array_parse(vec, 3, 3, value, "hybrid_multi_fractal: invalid 'position' arg") == -1) if (mathutils_array_parse(vec, 3, 3, value, "hybrid_multi_fractal: invalid 'position' arg") == -1)
return NULL; return NULL;
return PyFloat_FromDouble(mg_HybridMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, nb)); return PyFloat_FromDouble(mg_HybridMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, nb));
} }