From ba65f7093b39a8e5f1fb869cbc347fb810a05ab9 Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Mon, 4 Jun 2018 00:07:17 +0200 Subject: [PATCH 1/4] Cycles: Cleanup: Don't use return on function returning void --- intern/cycles/kernel/bvh/bvh.h | 25 +++++++++++++------------ intern/cycles/kernel/bvh/bvh_local.h | 26 ++++++++++++++------------ 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index d3e0b25a200..c0a5bb434ea 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -212,20 +212,21 @@ ccl_device_intersect void scene_intersect_local(KernelGlobals *kg, { #ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { - return bvh_intersect_local_motion(kg, - &ray, - local_isect, - local_object, - lcg_state, - max_hits); + bvh_intersect_local_motion(kg, + &ray, + local_isect, + local_object, + lcg_state, + max_hits); + return; } #endif /* __OBJECT_MOTION__ */ - return bvh_intersect_local(kg, - &ray, - local_isect, - local_object, - lcg_state, - max_hits); + bvh_intersect_local(kg, + &ray, + local_isect, + local_object, + lcg_state, + max_hits); } #endif diff --git a/intern/cycles/kernel/bvh/bvh_local.h b/intern/cycles/kernel/bvh/bvh_local.h index 9292cc76a5c..605d4166819 100644 --- a/intern/cycles/kernel/bvh/bvh_local.h +++ b/intern/cycles/kernel/bvh/bvh_local.h @@ -246,20 +246,22 @@ ccl_device_inline void BVH_FUNCTION_NAME(KernelGlobals *kg, switch(kernel_data.bvh.bvh_layout) { #ifdef __QBVH__ case BVH_LAYOUT_BVH4: - return BVH_FUNCTION_FULL_NAME(QBVH)(kg, - ray, - local_isect, - local_object, - lcg_state, - max_hits); + BVH_FUNCTION_FULL_NAME(QBVH)(kg, + ray, + local_isect, + local_object, + lcg_state, + max_hits); + break; #endif case BVH_LAYOUT_BVH2: - return BVH_FUNCTION_FULL_NAME(BVH)(kg, - ray, - local_isect, - local_object, - lcg_state, - max_hits); + BVH_FUNCTION_FULL_NAME(BVH)(kg, + ray, + local_isect, + local_object, + lcg_state, + max_hits); + break; } kernel_assert(!"Should not happen"); } From 854db8951bc15a7545eea3ff2219a28897698ead Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Jun 2018 08:48:38 +0200 Subject: [PATCH 2/4] Cleanup: strip trailing space in bmesh module --- source/blender/bmesh/bmesh_class.h | 8 +- source/blender/bmesh/intern/bmesh_construct.c | 4 +- source/blender/bmesh/intern/bmesh_core.c | 58 +++++++------- source/blender/bmesh/intern/bmesh_delete.c | 2 +- source/blender/bmesh/intern/bmesh_edgeloop.c | 2 +- source/blender/bmesh/intern/bmesh_interp.c | 44 +++++------ source/blender/bmesh/intern/bmesh_iterators.c | 10 +-- .../bmesh/intern/bmesh_iterators_inline.h | 2 +- source/blender/bmesh/intern/bmesh_log.c | 2 +- source/blender/bmesh/intern/bmesh_marking.c | 16 ++-- source/blender/bmesh/intern/bmesh_mesh.c | 20 ++--- source/blender/bmesh/intern/bmesh_mods.c | 36 ++++----- source/blender/bmesh/intern/bmesh_operators.c | 48 ++++++------ source/blender/bmesh/intern/bmesh_polygon.c | 8 +- source/blender/bmesh/intern/bmesh_queries.c | 4 +- source/blender/bmesh/intern/bmesh_structure.c | 14 ++-- source/blender/bmesh/intern/bmesh_walkers.c | 6 +- .../blender/bmesh/intern/bmesh_walkers_impl.c | 32 ++++---- source/blender/bmesh/operators/bmo_create.c | 2 +- source/blender/bmesh/operators/bmo_dissolve.c | 12 +-- source/blender/bmesh/operators/bmo_dupe.c | 20 ++--- source/blender/bmesh/operators/bmo_extrude.c | 20 ++--- source/blender/bmesh/operators/bmo_hull.c | 18 ++--- source/blender/bmesh/operators/bmo_mirror.c | 12 +-- .../blender/bmesh/operators/bmo_primitive.c | 34 ++++---- .../bmesh/operators/bmo_removedoubles.c | 8 +- .../blender/bmesh/operators/bmo_subdivide.c | 78 +++++++++---------- .../blender/bmesh/operators/bmo_triangulate.c | 12 +-- source/blender/bmesh/tools/bmesh_bevel.c | 24 +++--- 29 files changed, 278 insertions(+), 278 deletions(-) diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index bec2c7a1f45..10e2892c5a5 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -119,7 +119,7 @@ typedef struct BMEdge { /* the list of loops around the edge (use l->radial_prev/next) * to access the other loops using the edge */ struct BMLoop *l; - + /* disk cycle pointers * 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; @@ -229,7 +229,7 @@ typedef struct BMesh { int toolflag_index; struct BMOperator *currentop; - + CustomData vdata, edata, ldata, pdata; #ifdef USE_BMESH_HOLES @@ -241,10 +241,10 @@ typedef struct BMesh { * make sure they're in sync! * Only use when the edit mesh cant be accessed - campbell */ short selectmode; - + /* ID of the shape key this bmesh came from */ int shapenr; - + int totflags; ListBase selected; diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index f8ecbe1756b..1b300b24808 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -712,7 +712,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old) /* safety check */ BLI_assert(i == bm_old->totvert); - + BM_ITER_MESH_INDEX (e, &iter, bm_old, BM_EDGES_OF_MESH, i) { e_new = BM_edge_create(bm_new, vtable[BM_elem_index_get(e->v1)], @@ -730,7 +730,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old) /* safety check */ BLI_assert(i == bm_old->totedge); - + BM_ITER_MESH_INDEX (f, &iter, bm_old, BM_FACES_OF_MESH, i) { BM_elem_index_set(f, i); /* set_inline */ diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 7e35866887d..c6836187eee 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -158,7 +158,7 @@ BMEdge *BM_edge_create( if ((create_flag & BM_CREATE_NO_DOUBLE) && (e = BM_edge_exists(v1, v2))) return e; - + e = BLI_mempool_alloc(bm->epool); @@ -286,7 +286,7 @@ static BMLoop *bm_face_boundary_add( BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool); #endif BMLoop *l = bm_loop_create(bm, startv, starte, f, NULL /* starte->l */, create_flag); - + bmesh_radial_loop_append(starte, l); #ifdef USE_BMESH_HOLES @@ -295,7 +295,7 @@ static BMLoop *bm_face_boundary_add( #else f->l_first = l; #endif - + return l; } @@ -330,7 +330,7 @@ BMFace *BM_face_copy( do { if (copy_edges) { BMVert *v1, *v2; - + if (l_iter->e->v1 == verts[i]) { v1 = verts[i]; v2 = verts[(i + 1) % f->len]; @@ -339,7 +339,7 @@ BMFace *BM_face_copy( v2 = verts[i]; v1 = verts[(i + 1) % f->len]; } - + edges[i] = BM_edge_create(bm_dst, v1, v2, l_iter->e, BM_CREATE_NOP); } else { @@ -347,11 +347,11 @@ BMFace *BM_face_copy( } i++; } while ((l_iter = l_iter->next) != l_first); - + 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); - + l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_copy = BM_FACE_FIRST_LOOP(f_copy); do { @@ -463,12 +463,12 @@ BMFace *BM_face_create( lastl->next = l; lastl = l; } - + startl->prev = lastl; lastl->next = startl; - + f->len = len; - + if (!(create_flag & BM_CREATE_SKIP_CD)) { if (f_example) { 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) return IS_WRONG_TYPE; - + switch (htype) { case BM_VERT: { @@ -830,12 +830,12 @@ void BM_face_edges_kill(BMesh *bm, BMFace *f) BMLoop *l_iter; BMLoop *l_first; int i = 0; - + l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { edges[i++] = l_iter->e; } while ((l_iter = l_iter->next) != l_first); - + for (i = 0; i < f->len; 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_first; int i = 0; - + l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { verts[i++] = l_iter->v; } while ((l_iter = l_iter->next) != l_first); - + for (i = 0; i < f->len; 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->v2); - + 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) { return false; } - + if (BM_edge_is_boundary(l->e)) { return false; } - + do { if (!BM_ELEM_API_FLAG_TEST(l->f, api_flag)) 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]); } } - + BLI_array_free(edges); BLI_array_free(deledges); BLI_array_free(delverts); @@ -1562,7 +1562,7 @@ BMFace *bmesh_kernel_split_face_make_edge( BM_CHECK_ELEMENT(e); BM_CHECK_ELEMENT(f); BM_CHECK_ELEMENT(f2); - + return f2; } @@ -1664,7 +1664,7 @@ BMVert *bmesh_kernel_split_edge_make_vert(BMesh *bm, BMVert *tv, BMEdge *e, BMEd is_first = false; l->radial_next = l->radial_prev = NULL; } - + bmesh_radial_loop_append(l_new->e, l_new); 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) { return NULL; } - + if (bmesh_disk_count_at_most(v_kill, 3) == 2) { #ifndef NDEBUG 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 */ l_f1->prev->next = l_f2->next; l_f2->next->prev = l_f1->prev; - + l_f1->next->prev = l_f2->prev; l_f2->prev->next = l_f1->next; - + /* if l_f1 was baseloop, make l_f1->next the base. */ if (BM_FACE_FIRST_LOOP(f1) == l_f1) 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; for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < newlen; i++, l_iter = l_iter->next) l_iter->f = f1; - + /* 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->v2); - + /* deallocate edge and its two loops as well as f2 */ if (bm->etoolflagpool) { 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 */ edok = bmesh_loop_validate(f1); BMESH_ASSERT(edok != false); - + return f1; } @@ -2600,7 +2600,7 @@ void bmesh_kernel_edge_separate( BLI_assert(l_sep->e == e); BLI_assert(e->l); - + if (BM_edge_is_boundary(e)) { BLI_assert(0); /* no cut required */ return; diff --git a/source/blender/bmesh/intern/bmesh_delete.c b/source/blender/bmesh/intern/bmesh_delete.c index 1449a6ef9d7..1869bc49da0 100644 --- a/source/blender/bmesh/intern/bmesh_delete.c +++ b/source/blender/bmesh/intern/bmesh_delete.c @@ -105,7 +105,7 @@ void BMO_mesh_delete_oflag_tagged(BMesh *bm, const short oflag, const char htype bmo_remove_tagged_edges(bm, oflag); } if (htype & BM_VERT) { - bmo_remove_tagged_verts(bm, oflag); + bmo_remove_tagged_verts(bm, oflag); } } diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c index 54fe2801d0c..9e107c822ac 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.c +++ b/source/blender/bmesh/intern/bmesh_edgeloop.c @@ -160,7 +160,7 @@ int BM_mesh_edgeloops_find( BMEdge **edges = MEM_mallocN(sizeof(*edges) * edges_len, __func__); BLI_stack_pop_n_reverse(edge_stack, edges, BLI_stack_count(edge_stack)); BLI_stack_free(edge_stack); - + for (uint i = 0; i < edges_len; i += 1) { e = edges[i]; if (BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG)) { diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 8a1090891f2..e3b779ddbcd 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -152,7 +152,7 @@ void BM_data_interp_face_vert_edge( l_v = l_iter; l_v2 = l_iter->prev; } - + if (!l_v1 || !l_v2) { return; } @@ -260,15 +260,15 @@ static int compute_mdisp_quad( mid_v3_v3v3(p, l->prev->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(v2, p); copy_v3_v3(v3, l->v->co); copy_v3_v3(v4, n); - + sub_v3_v3v3(e1, v2, v1); sub_v3_v3v3(e2, v3, v4); - + 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 eps = FLT_EPSILON * 4000; - + if (is_zero_v3(l_src->v->no)) BM_vert_normal_update_all(l_src->v); if (is_zero_v3(l_dst->v->no)) @@ -341,17 +341,17 @@ static bool mdisp_in_mdispquad( /* expand quad a bit */ mid_v3_v3v3v3v3(c, v1, v2, v3, v4); - + sub_v3_v3(v1, c); sub_v3_v3(v2, 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(v3, 1.0f + eps); mul_v3_fl(v4, 1.0f + eps); add_v3_v3(v1, c); add_v3_v3(v2, 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)) return 0; - + mul_v2_fl(r_uv, (float)(res - 1)); 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; 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]; - + /* ignore 2-edged faces */ if (UNLIKELY(l_dst->f->len < 3)) return; 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); - + /* if no disps data allocate a new grid, the size of the first grid in f_src. */ if (!md_dst->totdisp) { 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; } } - + mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y); 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); BMLoop *l; BMIter liter; - + if (cd_loop_mdisp_offset == -1) return; - + 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 *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]; int sides; int y; - + /* * 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); } } - + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { MDisps *mdl1 = BM_ELEM_CD_GET_VOID_P(l, cd_loop_mdisp_offset); MDisps *mdl2; float co1[3], co2[3], co[3]; int sides; int y; - + /* * 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); for (y = 0; y < sides; y++) { int a1, a2, o1, o2; - + if (l->v != l->radial_next->v) { a1 = sides * y + sides - 2; a2 = (sides - 2) * sides + y; - + o1 = sides * y + sides - 1; o2 = (sides - 1) * sides + y; } @@ -652,16 +652,16 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) o1 = sides * y + sides - 1; o2 = sides * y + sides - 1; } - + /* magic blending numbers, hardcoded! */ add_v3_v3v3(co1, mdl1->disps[a1], mdl2->disps[a2]); mul_v3_fl(co1, 0.18); - + add_v3_v3v3(co2, mdl1->disps[o1], mdl2->disps[o2]); mul_v3_fl(co2, 0.32); - + add_v3_v3v3(co, co1, co2); - + copy_v3_v3(mdl1->disps[o1], co); copy_v3_v3(mdl2->disps[o2], co); } diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c index 9fe28561b93..c9b7b80b658 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.c +++ b/source/blender/bmesh/intern/bmesh_iterators.c @@ -508,7 +508,7 @@ void *bmiter__face_of_vert_step(struct BMIter__face_of_vert *iter) iter->l_next = iter->l_first; } } - + if (!((BMIter *)iter)->count) { 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; } } - + if (!((BMIter *)iter)->count) { 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_next = iter->l_first->radial_next; - + if (iter->l_next == iter->l_first) 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) { BMLoop *l_curr = iter->l_next; - + if (iter->l_next) { iter->l_next = iter->l_next->radial_next; 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; } } - + return l_curr ? l_curr->e : NULL; } diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h index 88985d639cf..e7bd6164c27 100644 --- a/source/blender/bmesh/intern/bmesh_iterators_inline.h +++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h @@ -156,7 +156,7 @@ BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *da return false; break; } - + iter->begin(iter); return true; diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index 28827a5ddaa..4e6fff03411 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -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) { void *vid = SET_UINT_IN_POINTER(id); - + BLI_ghash_reinsert(log->id_to_elem, vid, v, NULL, NULL); BLI_ghash_reinsert(log->elem_to_id, v, vid, NULL, NULL); } diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 1b96237e262..10a03050d4b 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -609,7 +609,7 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode) { BMIter iter; BMElem *ele; - + bm->selectmode = selectmode; 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; BMFace *f = NULL; BMEditSelection *ese; - + /* Find the latest non-hidden face from the BMEditSelection */ ese = bm->selected.last; for ( ; ese; ese = ese->prev) { if (ese->htype == BM_FACE) { f = (BMFace *)ese->ele; - + if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { f = NULL; } @@ -842,10 +842,10 @@ void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]) BMEdge *eed = (BMEdge *)ese->ele; float plane[3]; /* need a plane to correct the normal */ float vec[3]; /* temp vec storage */ - + add_v3_v3v3(r_normal, eed->v1->no, eed->v2->no); sub_v3_v3v3(plane, eed->v2->co, eed->v1->co); - + /* 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 * 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(r_normal, plane, vec); normalize_v3(r_normal); - + } else if (ese->htype == BM_FACE) { BMFace *efa = (BMFace *)ese->ele; @@ -869,7 +869,7 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]) if (ese->htype == BM_VERT) { BMVert *eve = (BMVert *)ese->ele; float vec[3] = {0.0f, 0.0f, 0.0f}; - + if (ese->prev) { /* use previously selected data to make a useful vertex plane */ BM_editselection_center(ese->prev, vec); 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); } while ((l_iter = l_iter->radial_next) != l_first); } - + BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide); /* hide vertices if necessary */ diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 7f7f48e37bd..185e5412b3d 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -168,7 +168,7 @@ BMesh *BM_mesh_create( { /* allocate the structure */ BMesh *bm = MEM_callocN(sizeof(BMesh), __func__); - + /* allocate the memory pools for the mesh elements */ bm_mempool_init(bm, allocsize, params->use_toolflags); @@ -1051,41 +1051,41 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from BMFace *f; BMIter iter; // int i = 0; // UNUSED - + multires_set_space(dm, ob, from, to); - + mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS); - + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BMLoop *l; BMIter liter; BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { MDisps *lmd = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS); - + if (!lmd->disps) { printf("%s: warning - 'lmd->disps' == NULL\n", __func__); } - + if (lmd->disps && lmd->totdisp == mdisps->totdisp) { memcpy(lmd->disps, mdisps->disps, sizeof(float) * 3 * lmd->totdisp); } else if (mdisps->disps) { if (lmd->disps) MEM_freeN(lmd->disps); - + lmd->disps = MEM_dupallocN(mdisps->disps); lmd->totdisp = mdisps->totdisp; lmd->level = mdisps->level; } - + mdisps++; // i += 1; } } - + dm->needsFree = 1; dm->release(dm); - + /* setting this to NULL prevents BKE_editmesh_free from freeing it */ em->bm = NULL; BKE_editmesh_free(em); diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 4290f94bba1..a10f2e2bb3f 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -66,7 +66,7 @@ bool BM_vert_dissolve(BMesh *bm, BMVert *v) { /* logic for 3 or more is identical */ const int len = BM_vert_edge_count_at_most(v, 3); - + if (len == 1) { BM_vert_kill(bm, v); /* will kill edges too */ return true; @@ -110,7 +110,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v) if (!BM_vert_is_manifold(v)) { return false; } - + if (v->e) { /* v->e we keep, what else */ e = v->e; @@ -124,7 +124,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v) len++; } while (e != v->e); } - + /* this code for handling 2 and 3-valence verts * may be totally bad */ if (keepedge == NULL && len == 3) { @@ -200,7 +200,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v) if (!e) { return false; } - + if (e->l) { /* get remaining two faces */ if (e->l != e->l->radial_next) { @@ -286,13 +286,13 @@ BMFace *BM_face_split( if (cd_loop_mdisp_offset != -1) { f_tmp = BM_face_copy(bm, bm, f, false, false); } - + #ifdef USE_BMESH_HOLES f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, NULL, example, no_double); #else f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, example, no_double); #endif - + if (f_new) { /* handle multires update */ 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); - + #ifdef USE_BMESH_HOLES f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, &l_new, NULL, example, false); #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) { BMLoop *l; int i; - + l = e->l; do { BLI_array_append(oldfaces, l->f); l = l->radial_next; } while (l != e->l); - + /* flag existing faces so we can differentiate oldfaces from new faces */ for (i = 0; i < BLI_array_len(oldfaces); i++) { 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++) { BMEdge *e1 = j ? e_new : e; BMLoop *l; - + l = e1->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); } } - + /* destroy the old faces */ for (i = 0; i < BLI_array_len(oldfaces); i++) { BM_face_verts_kill(bm, oldfaces[i]); } - + /* fix boundaries a bit, doesn't work too well quite yet */ #if 0 for (j = 0; j < 2; j++) { BMEdge *e1 = j ? e_new : e; BMLoop *l, *l2; - + l = e1->l; if (UNLIKELY(!l)) { BMESH_ASSERT(0); break; } - + do { BM_face_multires_bounds_smooth(bm, l->f); l = l->radial_next; } while (l != e1->l); } #endif - + BLI_array_free(oldfaces); } @@ -710,7 +710,7 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts, BMVert **r_varr) int i; float percent; BMVert *v_new = NULL; - + for (i = 0; i < numcuts; i++) { percent = 1.0f / (float)(numcuts + 1 - i); 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; int i, j; bool ret = true; - + if (face->len == 2) { fprintf(err, "warning: found two-edged face. face ptr: %p\n", face); fflush(err); @@ -765,7 +765,7 @@ bool BM_face_validate(BMFace *face, FILE *err) } } } - + BLI_array_free(verts); return ret; } diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index f814767a200..62d892712fd 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -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. */ const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = { 0, /* 0: BMO_OP_SLOT_SENTINEL */ - sizeof(int), /* 1: BMO_OP_SLOT_BOOL */ - sizeof(int), /* 2: BMO_OP_SLOT_INT */ - sizeof(float), /* 3: BMO_OP_SLOT_FLT */ - sizeof(void *), /* 4: BMO_OP_SLOT_PNT */ + sizeof(int), /* 1: BMO_OP_SLOT_BOOL */ + sizeof(int), /* 2: BMO_OP_SLOT_INT */ + sizeof(float), /* 3: BMO_OP_SLOT_FLT */ + sizeof(void *), /* 4: BMO_OP_SLOT_PNT */ sizeof(void *), /* 5: BMO_OP_SLOT_PNT */ 0, /* 6: 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_flag = bmo_opdefines[opcode]->type_flag; op->flag = flag; - + /* 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_out, op->slots_out); @@ -217,10 +217,10 @@ void BMO_op_exec(BMesh *bm, BMOperator *op) if (bm->toolflag_index == 1) bmesh_edit_begin(bm, op->type_flag); op->exec(bm, op); - + if (bm->toolflag_index == 1) bmesh_edit_end(bm, op->type_flag); - + 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->data.p = BLI_memarena_alloc(op->arena, sizeof(float) * 4 * 4); - + if (size == 4) { 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); BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF); - + /* check if its actually a buffer */ if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) 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]; void *tmp; ssize_t allocsize; - + BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF); /* 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 */ if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) return NULL; - + slot->len = len; if (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); int totelement = 0, i = 0; - + BLI_assert(output->slot_type == BMO_OP_SLOT_ELEMENT_BUF); 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) { BMOpSlot *slot = BMO_slot_get(slot_args, slot_name); - + if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) 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) { BMOpError *err = MEM_callocN(sizeof(BMOpError), "bmop_error"); - + err->errorcode = errcode; if (!msg) { msg = bmo_error_messages[errcode]; } err->msg = msg; err->op = owner; - + 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 (op) *op = err->op; - + return err->errorcode; } int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op) { int errorcode = BMO_error_get(bm, msg, op); - + if (errorcode) { BMOpError *err = bm->errorstack.first; - + BLI_remlink(&bm->errorstack, bm->errorstack.first); 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 */ fmt = ofmt = BLI_strdup(_fmt); - + /* find operator name */ i = strcspn(fmt, " "); @@ -1689,7 +1689,7 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, opname[i] = '\0'; fmt += i + (noslot ? 0 : 1); - + i = BMO_opcode_from_opname_check(opname); 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); // def = bmo_opdefines[i]; - + i = 0; 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 */ i = strspn(fmt, " "); fmt += i; - + /* ignore trailing whitespace */ if (!fmt[i]) 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) { GOTO_ERROR("name to slot code check failed"); } - + BLI_strncpy(slot_name, fmt, sizeof(slot_name)); - + state = false; fmt += i; } diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index bcb940f8b96..7cbc6461667 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -611,7 +611,7 @@ void BM_edge_normals_update(BMEdge *e) { BMIter iter; BMFace *f; - + BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { 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]; BMLoop *l_iter; int i; - + BLI_assert(BM_face_is_normal_valid(f)); 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]); } bm->elem_index_dirty |= BM_LOOP; - + /* ensure we are well outside the face bounds (value is arbitrary) */ 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++) { float mid[2]; mid_v2_v2v2(mid, edgeverts[i][0], edgeverts[i][1]); - + int isect = 0; int j_prev; for (j = 0, j_prev = f->len - 1; j < f->len; j_prev = j++) { diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index ab2f017d103..5ce4b236d03 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -424,7 +424,7 @@ int BM_verts_in_face_count(BMVert **varr, int len, BMFace *f) #endif int i, count = 0; - + for (i = 0; i < len; i++) { 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_first; int count = 0; - + l_iter = l_first = BM_FACE_FIRST_LOOP(f_a); do { if (BM_edge_in_face(l_iter->e, f_b)) { diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c index 8aa9502c0f7..ff744ae1a42 100644 --- a/source/blender/bmesh/intern/bmesh_structure.c +++ b/source/blender/bmesh/intern/bmesh_structure.c @@ -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 *e_iter, *e_first; - + if (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); } - + return NULL; } @@ -380,7 +380,7 @@ bool bmesh_radial_validate(int radlen, BMLoop *l) { BMLoop *l_iter = l; int i = 0; - + if (bmesh_radial_length(l) != radlen) return false; @@ -389,17 +389,17 @@ bool bmesh_radial_validate(int radlen, BMLoop *l) BMESH_ASSERT(0); return false; } - + if (l_iter->e != l->e) return false; if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2) return false; - + if (UNLIKELY(i > BM_LOOP_RADIAL_MAX)) { BMESH_ASSERT(0); return false; } - + i++; } while ((l_iter = l_iter->radial_next) != l); @@ -529,7 +529,7 @@ int bmesh_radial_length(const BMLoop *l) BMESH_ASSERT(0); return 0; } - + i++; if (UNLIKELY(i >= BM_LOOP_RADIAL_MAX)) { BMESH_ASSERT(0); diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c index d39fb382b96..77e9d441bbb 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.c +++ b/source/blender/bmesh/intern/bmesh_walkers.c @@ -63,7 +63,7 @@ void *BMW_begin(BMWalker *walker, void *start) BLI_assert(((BMHeader *)start)->htype & walker->begin_htype); walker->begin(walker, start); - + return BMW_current_state(walker) ? walker->step(walker) : NULL; } @@ -101,7 +101,7 @@ void BMW_init( BLI_assert(0); return; } - + if (type != BMW_CUSTOM) { walker->begin_htype = bm_walker_types[type]->begin_htype; 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_face == 0 || (walker->valid_mask & BM_FACE)); } - + walker->worklist = BLI_mempool_create(walker->structsize, 0, 128, BLI_MEMPOOL_NOP); BLI_listbase_clear(&walker->states); } diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index 279440984bb..81487b70edc 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -210,7 +210,7 @@ static void *bmw_VertShellWalker_step(BMWalker *walker) BMVert *v_old = NULL; bool restrictpass = true; BMwShellWalker shellWalk = *((BMwShellWalker *)BMW_current_state(walker)); - + if (!BLI_gset_haskey(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; v_old = BM_edge_other_vert(curedge, shellWalk.base); - + /* push a new state onto the stac */ newState = BMW_state_add(walker); BLI_gset_insert(walker->visit_set, curedge); - + /* populate the new stat */ 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); - + return shellWalk.curedge; } #endif @@ -711,12 +711,12 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker) e = l->e; v = BM_edge_other_vert(e, iwalk->lastv); - + /* pop off current state */ BMW_state_remove(walker); - + f = l->f; - + while (1) { l = BM_loop_other_edge_loop(l, v); if (BM_loop_is_manifold(l)) { @@ -736,7 +736,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker) break; } } - + if (l == owalk.curloop) { return NULL; } @@ -789,7 +789,7 @@ static void *bmw_IslandWalker_step_ex(BMWalker *walker, bool only_manifold) { BMwIslandWalker *iwalk, owalk; BMLoop *l_iter, *l_first; - + BMW_state_remove_r(walker, &owalk); iwalk = &owalk; @@ -1154,7 +1154,7 @@ static bool bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e) if (BM_edge_is_wire(e)) { return false; } - + /* Don't start a loop from a boundary edge if it cannot * be extended to cover any faces */ if (BM_edge_is_boundary(e)) { @@ -1162,7 +1162,7 @@ static bool bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e) return false; } } - + /* Don't start a face loop from non-manifold edges */ if (!BM_edge_is_manifold(e)) { return false; @@ -1206,7 +1206,7 @@ static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data) static void *bmw_FaceLoopWalker_yield(BMWalker *walker) { BMwFaceLoopWalker *lwalk = BMW_current_state(walker); - + if (!lwalk) { return NULL; } @@ -1225,7 +1225,7 @@ static void *bmw_FaceLoopWalker_step(BMWalker *walker) f = lwalk->l->f; l = lwalk->l->radial_next; - + if (lwalk->no_calc) { return f; } @@ -1314,7 +1314,7 @@ static void bmw_EdgeringWalker_begin(BMWalker *walker, void *data) static void *bmw_EdgeringWalker_yield(BMWalker *walker) { BMwEdgeringWalker *lwalk = BMW_current_state(walker); - + if (!lwalk) { return NULL; } @@ -1381,7 +1381,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker) l = l->radial_next; l = l->next->next; - + if ((l->f->len != 4) || !EDGE_CHECK(l->e) || !bmw_mask_check_face(walker, l->f)) { 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) { BMwUVEdgeWalker *lwalk = BMW_current_state(walker); - + if (!lwalk) { return NULL; } diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index c70e8b675c7..aeaedf6417c 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -66,7 +66,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) break; } } - + /* --- Support Edge Creation --- * simple case when we only have 2 verts selected. */ diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 816d2e8d009..0ad800cbddd 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -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); - + /* collect region */ BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) { BMFace *f_iter; @@ -178,7 +178,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) BLI_array_append(faces, f_iter); } BMW_end(®walker); - + for (i = 0; i < BLI_array_len(faces); i++) { f_iter = faces[i]; 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); goto cleanup; } - + BLI_array_append(faces, NULL); 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++) { BMFace *f_new; int tot = 0; - + faces = regions[i]; if (!faces[0]) { BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, "Could not find boundary of dissolve region"); goto cleanup; } - + while (faces[tot]) tot++; - + f_new = BM_faces_join(bm, faces, tot, true); if (f_new) { diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 394faabbd25..eed87ed20af 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -64,7 +64,7 @@ static BMVert *bmo_vert_copy( /* Mark the vert for output */ BMO_vert_flag_enable(bm_dst, v_dst, DUPE_NEW); - + return v_dst; } @@ -103,7 +103,7 @@ static BMEdge *bmo_edge_copy( /* Lookup v1 and v2 */ e_dst_v1 = BLI_ghash_lookup(vhash, e_src->v1); e_dst_v2 = BLI_ghash_lookup(vhash, e_src->v2); - + /* Create a new edge */ 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); @@ -124,7 +124,7 @@ static BMEdge *bmo_edge_copy( /* Mark the edge for output */ BMO_edge_flag_enable(bm_dst, e_dst, DUPE_NEW); - + return e_dst; } @@ -164,7 +164,7 @@ static BMFace *bmo_face_copy( /* Copy attributes */ BM_elem_attrs_copy(bm_src, bm_dst, f_src, f_dst); - + /* copy per-loop custom data */ l_iter_src = l_first_src; 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; BMEdge *e = NULL; BMFace *f = NULL; - + BMIter viter, eiter, fiter; 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); } } - + /* free pointer hashes */ BLI_ghash_free(vhash, NULL, NULL); BLI_ghash_free(ehash, NULL, NULL); @@ -326,7 +326,7 @@ void bmo_duplicate_exec(BMesh *bm, BMOperator *op) { BMOperator *dupeop = op; BMesh *bm_dst = BMO_slot_ptr_get(op->slots_in, "dest"); - + if (!bm_dst) bm_dst = bm; @@ -335,7 +335,7 @@ void bmo_duplicate_exec(BMesh *bm, BMOperator *op) /* use the internal copy function */ bmo_mesh_copy(dupeop, bm_dst, bm); - + /* Output */ /* First copy the input buffers to output buffers - original data */ BMO_slot_copy(dupeop, slots_in, "geom", @@ -393,11 +393,11 @@ void bmo_split_exec(BMesh *bm, BMOperator *op) /* initialize our sub-operator */ BMO_op_init(bm, &dupeop, op->flag, "duplicate"); - + BMO_slot_copy(splitop, slots_in, "geom", &dupeop, slots_in, "geom"); BMO_op_exec(bm, &dupeop); - + BMO_slot_buffer_flag_enable(bm, splitop->slots_in, "geom", BM_ALL_NOLOOP, SPLIT_INPUT); if (use_only_faces) { diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 87369472df7..3a6fbd419c1 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -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) { MVertSkin *vs; - + vs = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_MVERT_SKIN); vs->flag &= ~MVERT_SKIN_ROOT; } @@ -186,7 +186,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op) BMOperator dupeop; BMFace *f; BMEdge *e, *e_new; - + BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) { BMO_edge_flag_enable(bm, e, 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 */ f = BM_face_create_verts(bm, f_verts, 4, NULL, BM_CREATE_NOP, true); bm_extrude_copy_face_loop_attributes(bm, f); - + if (BMO_edge_flag_test(bm, e, EXT_INPUT)) { e = e_new; } - + BMO_face_flag_enable(bm, f, 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->v2, EXT_KEEP); - + } 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_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 * original geometry unless caller explicitly asked to keep it. */ 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) { if (BMO_face_flag_test(bm, f, EXT_INPUT)) { BMO_face_flag_enable(bm, f, EXT_DEL); @@ -436,7 +436,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) if (delorig) { BMO_op_exec(bm, &delop); } - + /* if not delorig, reverse loops of original face */ if (!delorig) { 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", op, slots_out, "geom.out"); @@ -493,7 +493,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) else fwd = (e_new->l->v == e_new->v1); - + if (fwd) { f_verts[0] = e->v1; f_verts[1] = e->v2; diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index d52cb00e172..ca727de5756 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -46,10 +46,10 @@ /* Internal operator flags */ typedef enum { HULL_FLAG_INPUT = (1 << 0), - + HULL_FLAG_INTERIOR_ELE = (1 << 1), HULL_FLAG_OUTPUT_GEOM = (1 << 2), - + HULL_FLAG_DEL = (1 << 3), HULL_FLAG_HOLE = (1 << 4) } 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) { GSetIterator iter; - + GSET_ITER (iter, hull_triangles) { HullTriangle *t = BLI_gsetIterator_getKey(&iter); int i; @@ -213,7 +213,7 @@ static HullFinalEdges *hull_final_edges(GSet *hull_triangles) { HullFinalEdges *final_edges; GSetIterator iter; - + final_edges = MEM_callocN(sizeof(HullFinalEdges), "HullFinalEdges"); final_edges->edges = BLI_ghash_ptr_new("final edges ghash"); final_edges->base_pool = BLI_mempool_create(sizeof(ListBase), 0, 128, BLI_MEMPOOL_NOP); @@ -286,7 +286,7 @@ static void hull_remove_overlapping( break; } } - + /* Note: can't change ghash while iterating, so mark * with 'skip' flag rather than deleting triangles */ 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) { if (BMO_vert_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) { bool del = true; - + BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { if (!BMO_edge_flag_test(bm, e, HULL_FLAG_INPUT)) { 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) { bool hole = true; bool any_faces = false; - + BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { any_faces = true; 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_verts = hull_verts_from_bullet(hull, input_verts, num_input_verts); - + count = plConvexHullNumFaces(hull); for (i = 0; i < count; 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); final_edges = hull_final_edges(hull_triangles); - + hull_mark_interior_elements(bm, op, final_edges); /* Remove hull triangles covered by an existing face */ diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index f1bf3179cd6..64f9773714b 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -57,13 +57,13 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) BMOpSlot *slot_targetmap; ototvert = bm->totvert; - + BMO_slot_mat4_get(op->slots_in, "matrix", mtx); invert_m4_m4(imtx, mtx); - + BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom"); BMO_op_exec(bm, &dupeop); - + BMO_slot_buffer_flag_enable(bm, dupeop.slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); /* 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, "scale verts=%fv vec=%v", ELE_NEW, scale); BMO_op_callf(bm, op->flag, "transform verts=%fv matrix=%m4", ELE_NEW, imtx); - + BMO_op_init(bm, &weldop, op->flag, "weld_verts"); 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); } - + if (mirror_u || mirror_v) { BMFace *f; BMLoop *l; @@ -109,7 +109,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) } BMO_op_exec(bm, &weldop); - + BMO_op_finish(bm, &weldop); BMO_op_finish(bm, &dupeop); diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 95d61763902..fd9b88ca4d3 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -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_op_callf(bm, op->flag, "rotate cent=%v matrix=%m3 verts=%S", vec, cmat, &bmop, "geom.out"); - + prevop = bmop; } @@ -1041,7 +1041,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) v3 = eva[icoface[a][2]]; 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) { 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; float vec[3], mat[4][4], phi, phid; int a; - + if (!segs) return; - + BMO_slot_mat4_get(op->slots_in, "matrix", mat); phid = 2.0f * (float)M_PI / segs; @@ -1308,7 +1308,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) if (cap_ends) { zero_v3(vec); mul_m4_v3(mat, vec); - + cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); 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); BMO_vert_flag_enable(bm, v1, VERT_MARK); - + if (lastv1) BM_edge_create(bm, v1, lastv1, NULL, BM_CREATE_NOP); - + if (a && cap_ends) { BMFace *f; - + f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP); BMO_face_flag_enable(bm, f, FACE_NEW); } - + if (!firstv1) firstv1 = v1; @@ -1346,7 +1346,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) if (cap_ends) { BMFace *f; - + f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP); 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); } } - + if (!cap_tris) { 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); } @@ -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 bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs"); int a; - + if (!segs) return; - + BMO_slot_mat4_get(op->slots_in, "matrix", mat); 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[2] = -depth; mul_m4_v3(mat, vec); - + cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); vec[0] = vec[1] = 0.0f; vec[2] = depth; mul_m4_v3(mat, vec); - + cent2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); BMO_vert_flag_enable(bm, cent1, VERT_MARK); @@ -1522,7 +1522,7 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) if (!cap_tris) { 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_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK); } diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index e85751531ae..8468227d17e 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -303,7 +303,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op) if (l_first == NULL) { l_first = l; } - + for (i = 0; i < bm->ldata.totlayer; i++) { if (CustomData_layer_has_math(&bm->ldata, i)) { 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); e2 = BM_ELEM_CD_GET_VOID_P(l, offset); - + CustomData_data_multiply(type, e2, fac); 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)) continue; - + CustomData_data_initminmax(type, &min, &max); 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; float vec[3]; BMOpSlot *slot_targetmap; - + BMO_slot_vec_get(op->slots_in, "merge_co", vec); //BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges"); diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 8f998797a16..90cbe9a5d76 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -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)); f_new = BM_face_split(bm, f, l_a, l_b, &l_new, NULL, false); - + if (r_f_new) *r_f_new = f_new; return l_new ? l_new->e : NULL; } @@ -380,7 +380,7 @@ static BMVert *bm_subdivide_edge_addvert( BMEdge **r_edge) { BMVert *v_new; - + v_new = BM_edge_split(bm, edge, edge->v1, r_edge, factor_edge_split); BMO_vert_flag_enable(bm, v_new, ELE_INNER); @@ -402,7 +402,7 @@ static BMVert *bm_subdivide_edge_addvert( } } #endif - + interp_v3_v3v3(v_new->no, v_a->no, v_b->no, factor_subd); normalize_v3(v_new->no); @@ -426,7 +426,7 @@ static BMVert *subdivide_edge_num( factor_edge_split = 1.0f / (float)(totpoint + 1 - curpoint); factor_subd = (float)(curpoint + 1) / (float)(totpoint + 1); } - + v_new = bm_subdivide_edge_addvert( bm, edge, e_orig, params, factor_edge_split, factor_subd, @@ -444,7 +444,7 @@ static void bm_subdivide_multicut( e_tmp.v1 = &v1_tmp; e_tmp.v2 = &v2_tmp; - + for (i = 0; i < numcuts; i++) { 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 && v->e->l) BM_CHECK_ELEMENT(v->e->l->f); } - + alter_co(v1, &e_tmp, params, 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; int i, numcuts = params->numcuts; - + for (i = 0; i < numcuts; i++) { 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; BMEdge *e, *e_new, e_tmp; int i, numcuts = params->numcuts; - + v_last = verts[numcuts]; 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; int i, add = 0, numcuts = params->numcuts; - + for (i = 0; i < numcuts; i++) { if (i == numcuts / 2) { 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++) { lines[(s - 1) * s + i] = verts[numcuts + i]; } - + /* first and last members of middle lines */ for (i = 0; i < numcuts; i++) { a = i; b = numcuts + 1 + numcuts + 1 + (numcuts - i - 1); - + e = connect_smallest_face(bm, verts[a], verts[b], &f_new); if (!e) 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_face_flag_enable(bm, f_new, ELE_INNER); - + v1 = lines[(i + 1) * s] = verts[a]; v2 = lines[(i + 1) * s + s - 1] = verts[b]; - + e_tmp = *e; for (a = 0; a < numcuts; a++) { 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; int i, numcuts = params->numcuts; - + for (i = 0; i < numcuts; i++) { 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; void *stackarr[1]; int i, j, a, b, numcuts = params->numcuts; - + /* number of verts in each lin */ lines = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table"); - + lines[0] = (BMVert **) stackarr; lines[0][0] = verts[numcuts * 2 + 1]; - + lines[numcuts + 1] = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table 2"); for (i = 0; i < numcuts; 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][i + 1] = verts[b]; - + e_tmp = *e; v1_tmp = *verts[a]; 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); } } - + /** *
 	 *         v5
@@ -906,9 +906,9 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 	float smooth, fractal, along_normal;
 	bool use_sphere, use_single_edge, use_grid_fill, use_only_quads;
 	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);
-	
+
 	numcuts = BMO_slot_int_get(op->slots_in, "cuts");
 	seed = BMO_slot_int_get(op->slots_in, "seed");
 	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;
 			break;
 	}
-	
+
 	if (use_single_edge) {
 		patterns[0] = &quad_1edge;
 		patterns[2] = &tri_1edge;
@@ -953,12 +953,12 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 		patterns[3] = NULL;
 		patterns[5] = NULL;
 	}
-	
+
 	/* add a temporary shapekey layer to store displacements on current geometry */
 	BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
 
 	bmo_subd_init_shape_info(bm, ¶ms);
-	
+
 	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);
 		copy_v3_v3(co, v->co);
@@ -990,7 +990,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 
 		BLI_rng_free(rng);
 	}
-	
+
 	BMO_slot_map_to_flag(bm, op->slots_in, "custom_patterns",
 	                     BM_FACE, FACE_CUSTOMFILL);
 
@@ -1105,10 +1105,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 			}
 
 		}
-		
+
 		if (!matched && totesel) {
 			SubDFaceData *fd;
-			
+
 			BMO_face_flag_enable(bm, face, SUBD_SPLIT);
 
 			/* must initialize all members here */
@@ -1146,7 +1146,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 
 		if (!pat && fd->totedgesel == 2) {
 			int vlen;
-			
+
 			/* ok, no pattern.  we still may be able to do something */
 			BLI_array_clear(loops);
 			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) {
 				loops[a] = l;
 			}
-			
+
 			vlen = BLI_array_len(loops);
 
 			/* find the boundary of one of the split edges */
@@ -1167,7 +1167,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 					break;
 				}
 			}
-			
+
 			if (BMO_vert_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) {
 				b = (a + numcuts + 1) % vlen;
 			}
@@ -1182,7 +1182,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 					}
 				}
 			}
-			
+
 			b += numcuts - 1;
 
 			BLI_array_grow_items(loops_split, numcuts);
@@ -1230,7 +1230,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 				b = (b - 1) % vlen;
 				a = (a + 1) % vlen;
 			}
-			
+
 			/* 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
 			 * - 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);
-	
+
 	BLI_stack_free(facedata);
 	if (edges) BLI_array_free(edges);
 	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_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);
 }
 
@@ -1306,7 +1306,7 @@ void BM_mesh_esubdivide(
         const int seed)
 {
 	BMOperator op;
-	
+
 	/* use_sphere isnt exposed here since its only used for new primitives */
 	BMO_op_initf(bm, &op, BMO_FLAG_DEFAULTS,
 	             "subdivide_edges edges=%he "
@@ -1325,9 +1325,9 @@ void BM_mesh_esubdivide(
 	             use_single_edge, use_grid_fill,
 	             use_only_quads,
 	             seed);
-	
+
 	BMO_op_exec(bm, &op);
-	
+
 	switch (seltype) {
 		case SUBDIV_SELECT_NONE:
 			break;
@@ -1354,11 +1354,11 @@ void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
 	BMOIter siter;
 	BMEdge *e;
 	SubDParams params = {0};
-	
+
 	params.numcuts = BMO_slot_int_get(op->slots_in, "cuts");
 	params.op = op;
 	params.slot_edge_percents = BMO_slot_get(op->slots_in, "edge_percents");
-	
+
 	BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
 
 	bmo_subd_init_shape_info(bm, ¶ms);
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 163a9ef599c..e686ef0429a 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -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"));
 
 	BMO_slot_vec_get(op->slots_in, "normal", normal);
-	
+
 	BLI_scanfill_begin(&sf_ctx);
-	
+
 	BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
 		ScanFillVert *sf_verts[2];
 		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);
 	BLI_ghash_free(sf_vert_map, NULL, NULL);
-	
+
 
 	if (is_zero_v3(normal)) {
 		/* 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,
 		                            sf_tri->v1->tmp.p, sf_tri->v2->tmp.p, sf_tri->v3->tmp.p, NULL,
 		                            NULL, BM_CREATE_NO_DOUBLE);
-		
+
 		BMO_face_flag_enable(bm, f, ELE_NEW);
 		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
 			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);
-	
+
 	if (use_beauty) {
 		BMOperator bmop;
 
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index ca96e5b4b78..33380cee18e 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -151,7 +151,7 @@ typedef struct BoundVert {
 	bool any_seam;      /* are any of the edges attached here seams? */
 	bool visited;       /* used during delta adjust pass */
 //	int _pad;
-} BoundVert;	
+} BoundVert;
 
 /* Mesh structure replacing a vertex */
 typedef struct VMesh {
@@ -511,7 +511,7 @@ static BMFace *bev_create_ngon(
 
 static BMFace *bev_create_quad(
         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)
 {
 	BMVert *varr[4] = {v1, v2, v3, v4};
@@ -521,7 +521,7 @@ static BMFace *bev_create_quad(
 
 static BMFace *bev_create_quad_ex(
         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,
         int mat_nr)
 {
@@ -1355,7 +1355,7 @@ static void get_profile_point(BevelParams *bp, const Profile *pro, int i, int n,
 		else
 			copy_v3_v3(r_co, pro->cob);
 	}
-	
+
 	else {
 		if (n == bp->seg) {
 			BLI_assert(pro->prof_co != NULL);
@@ -2119,7 +2119,7 @@ static void adjust_the_cycle_or_chain(BoundVert *vstart, bool iscycle)
 #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));
 #endif
-			
+
 			/* residue np + 2*i + 1 (if cycle) else np - 1 + 2*i + 1:
 			 * left offset for parm i matches its spec; weighted */
 			 row = row + 1;
@@ -2607,7 +2607,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
 	float beta, gamma;
 	VMesh *vm1;
 	BoundVert *bndv;
-	
+
 	n = vm0->count;
 	ns0 = vm0->seg;
 	ns20 = ns0 / 2;
@@ -2627,7 +2627,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
 			add_v3_v3v3(acc, co1, co2);
 			madd_v3_v3fl(acc, co, -2.0f);
 			madd_v3_v3fl(co, acc, -1.0f / 6.0f);
-			
+
 			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);
 			madd_v3_v3fl(acc, co, -2.0f);
 			madd_v3_v3fl(co, acc, -1.0f / 6.0f);
-			
+
 			copy_v3_v3(mesh_vert_canon(vm1, i, 0, k)->co, co);
 		}
 		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
 	 * and assuming all boundary vertices have valence 4 */
-	
+
 	/* The new face vertices */
 	for (i = 0; i < n; i++) {
 		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);
 		calculate_profile(bp, bndv);
 		get_profile_point(bp, &bndv->profile, 1, 2, mesh_vert(vm0, i, 0, 1)->co);
-		
+
 		bndv = bndv->next;
 	}
 	/* center vertex */
@@ -4618,7 +4618,7 @@ static void bevel_reattach_wires(BMesh *bm, BevelParams *bp, BMVert *v)
 						vclosest = bndv->nv.v;
 						votherclosest = bndvother->nv.v;
 						dclosest = d;
-						
+
 					}
 				} while ((bndvother = bndvother->next) != bvother->vmesh->boundstart);
 			}
@@ -5215,7 +5215,7 @@ static float geometry_collide_offset(BevelParams *bp, EdgeHalf *eb)
 	kc = kc / bp->offset;
 	th1 = angle_v3v3v3(va->co, vb->co, vc->co);
 	th2 = angle_v3v3v3(vb->co, vc->co, vd->co);
-	
+
 	/* First calculate offset at which edge B collapses, which happens
 	 * 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 */

From 7719c110064fc6f90c93c5339681b7dd9f5cbd63 Mon Sep 17 00:00:00 2001
From: Campbell Barton 
Date: Mon, 4 Jun 2018 08:54:17 +0200
Subject: [PATCH 3/4] Cleanup: strip trailing space in Python module

---
 source/blender/python/bmesh/CMakeLists.txt    |  2 +-
 source/blender/python/bmesh/bmesh_py_types.c  |  2 +-
 source/blender/python/generic/CMakeLists.txt  |  2 +-
 source/blender/python/generic/bgl.c           | 10 ++---
 source/blender/python/generic/bgl.h           |  2 +-
 source/blender/python/generic/blf_py_api.c    |  2 +-
 .../python/generic/bpy_internal_import.c      | 18 ++++-----
 .../python/generic/bpy_internal_import.h      |  4 +-
 source/blender/python/generic/py_capi_utils.c | 18 ++++-----
 source/blender/python/intern/bpy.c            |  2 +-
 source/blender/python/intern/bpy_app.c        |  8 ++--
 source/blender/python/intern/bpy_capi_utils.c |  6 +--
 source/blender/python/intern/bpy_driver.c     |  4 +-
 source/blender/python/intern/bpy_interface.c  | 18 ++++-----
 source/blender/python/intern/bpy_operator.c   | 26 ++++++-------
 source/blender/python/intern/bpy_props.c      | 32 ++++++++--------
 source/blender/python/intern/bpy_rna_anim.c   | 38 +++++++++----------
 source/blender/python/intern/bpy_rna_array.c  |  6 +--
 .../blender/python/intern/bpy_rna_callback.c  |  2 +-
 .../blender/python/mathutils/CMakeLists.txt   |  2 +-
 .../python/mathutils/mathutils_Matrix.h       |  2 +-
 .../python/mathutils/mathutils_interpolate.c  | 16 ++++----
 .../python/mathutils/mathutils_noise.c        |  2 +-
 23 files changed, 112 insertions(+), 112 deletions(-)

diff --git a/source/blender/python/bmesh/CMakeLists.txt b/source/blender/python/bmesh/CMakeLists.txt
index c7b86acc8f9..3b38fead7b9 100644
--- a/source/blender/python/bmesh/CMakeLists.txt
+++ b/source/blender/python/bmesh/CMakeLists.txt
@@ -18,7 +18,7 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-set(INC 
+set(INC
 	.
 	../../bmesh
 	../../blenkernel
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 2866683b89b..8b5fbe03cc3 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -2149,7 +2149,7 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
 		if (vert_array == NULL) {
 			return NULL;
 		}
-		
+
 		if (BM_edge_exists(vert_array[0], vert_array[1])) {
 			PyErr_SetString(PyExc_ValueError,
 			                "edges.new(): this edge exists");
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index df611e00d00..77214322b88 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -18,7 +18,7 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-set(INC 
+set(INC
 	.
 	../../blenkernel
 	../../blenlib
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 072021c6ac9..7b9292827b0 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -862,7 +862,7 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end)
 {
 	PyObject *list;
 	int count;
-	
+
 	if (begin < 0) begin = 0;
 	if (end > self->dimensions[0]) end = self->dimensions[0];
 	if (begin > end) begin = end;
@@ -910,11 +910,11 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
 {
 	PyObject *item;
 	int count, err = 0;
-	
+
 	if (begin < 0) begin = 0;
 	if (end > self->dimensions[0]) end = self->dimensions[0];
 	if (begin > end) begin = end;
-	
+
 	if (!PySequence_Check(seq)) {
 		PyErr_Format(PyExc_TypeError,
 		             "buffer[:] = value, invalid assignment. "
@@ -930,7 +930,7 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
 		             "Expected: %d (given: %d)", count, end - begin);
 		return -1;
 	}
-	
+
 	for (count = begin; count < end; count++) {
 		item = PySequence_GetItem(seq, count - begin);
 		if (item) {
@@ -3743,4 +3743,4 @@ static PyObject *Method_ShaderSource(PyObject *UNUSED(self), PyObject *args)
 }
 
 
-/** \} */
\ No newline at end of file
+/** \} */
diff --git a/source/blender/python/generic/bgl.h b/source/blender/python/generic/bgl.h
index b27a4d6a0a4..1373c81046b 100644
--- a/source/blender/python/generic/bgl.h
+++ b/source/blender/python/generic/bgl.h
@@ -39,7 +39,7 @@ int BGL_typeSize(int type);
  * For Python access to OpenGL functions requiring a pointer.
  */
 typedef struct _Buffer {
-	PyObject_VAR_HEAD 
+	PyObject_VAR_HEAD
 	PyObject *parent;
 
 	int type;		/* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 69f1e297b43..629335888e4 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -305,7 +305,7 @@ static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
 
 	if (!PyArg_ParseTuple(args, "if:blf.rotation", &fontid, &angle))
 		return NULL;
-		
+
 	BLF_rotation(fontid, angle);
 
 	Py_RETURN_NONE;
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index ffac09efdde..fb89d7c9e30 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -187,7 +187,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
 	int namelen = strlen(name);
 //XXX	Main *maggie = bpy_import_main ? bpy_import_main:G.main;
 	Main *maggie = bpy_import_main;
-	
+
 	*found = 0;
 
 	if (!maggie) {
@@ -220,7 +220,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
 		return NULL;
 	else
 		*found = 1;
-	
+
 	return bpy_text_import(text);
 }
 
@@ -236,14 +236,14 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
 	const char *filepath;
 //XXX	Main *maggie = bpy_import_main ? bpy_import_main:G.main;
 	Main *maggie = bpy_import_main;
-	
+
 	if (!maggie) {
 		printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
 		return NULL;
 	}
-	
+
 	*found = 0;
-	
+
 	/* get name, filename from the module itself */
 	if ((name = PyModule_GetName(module)) == NULL)
 		return NULL;
@@ -298,15 +298,15 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
 
 	/* import existing builtin modules or modules that have been imported already */
 	newmodule = PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
-	
+
 	if (newmodule)
 		return newmodule;
-	
+
 	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 */
 	newmodule = bpy_text_import_name(name, &found);
-	
+
 	if (newmodule) { /* found module as blender text, ignore above exception */
 		PyErr_Clear();
 		Py_XDECREF(exception);
diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h
index 905e045d657..a184087e359 100644
--- a/source/blender/python/generic/bpy_internal_import.h
+++ b/source/blender/python/generic/bpy_internal_import.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * 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_name(const char *name, 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);
 
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 6f265b2ae87..22646462163 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -295,7 +295,7 @@ void PyC_LineSpit(void)
 
 	PyErr_Clear();
 	PyC_FileAndNum(&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)
 {
 	PyFrameObject *frame;
-	
+
 	if (filename) *filename = NULL;
 	if (lineno)   *lineno = -1;
 
@@ -375,22 +375,22 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
 	Py_ssize_t i;
 	PyObject *item = o;
 	const char *attr;
-	
+
 	va_list vargs;
 
 	va_start(vargs, n);
 	for (i = 0; i < n; i++) {
 		attr = va_arg(vargs, char *);
 		item = PyObject_GetAttrString(item, attr);
-		
-		if (item) 
+
+		if (item)
 			Py_DECREF(item);
 		else /* python will set the error value here */
 			break;
-		
+
 	}
 	va_end(vargs);
-	
+
 	Py_XINCREF(item); /* final value has is increfed, to match PyObject_GetAttrString */
 	return item;
 }
@@ -839,7 +839,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
 			}
 		}
 		va_end(vargs);
-		
+
 		/* set the value so we can access it */
 		PyDict_SetItemString(py_dict, "values", values);
 		Py_DECREF(values);
@@ -865,7 +865,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
 				for (i = 0; i * 2 < n; i++) {
 					const char *format = va_arg(vargs, char *);
 					void *ptr = va_arg(vargs, void *);
-					
+
 					PyObject *item;
 					PyObject *item_new;
 					/* prepend the string formatting and remake the tuple */
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 7150cc65942..26dc5827da1 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -169,7 +169,7 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
 		PyErr_SetString(PyExc_ValueError, "invalid resource argument");
 		return NULL;
 	}
-	
+
 	/* 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);
 
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 1e2ce372727..66c64b580f3 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -243,10 +243,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");
 		return -1;
 	}
-	
+
 	if (param)  G.debug |=  flag;
 	else        G.debug &= ~flag;
-	
+
 	return 0;
 }
 
@@ -297,7 +297,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");
 		return -1;
 	}
-	
+
 	G.debug_value = param;
 
 	WM_main_add_notifier(NC_WINDOW, NULL);
@@ -396,7 +396,7 @@ static void py_struct_seq_getset_init(void)
 PyObject *BPY_app_struct(void)
 {
 	PyObject *ret;
-	
+
 	PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
 
 	ret = make_app_info();
diff --git a/source/blender/python/intern/bpy_capi_utils.c b/source/blender/python/intern/bpy_capi_utils.c
index 7232e4ea821..f873a8a762b 100644
--- a/source/blender/python/intern/bpy_capi_utils.c
+++ b/source/blender/python/intern/bpy_capi_utils.c
@@ -88,21 +88,21 @@ bool BPy_errors_to_report_ex(ReportList *reports, const bool use_full, const boo
 
 	if (!PyErr_Occurred())
 		return 1;
-	
+
 	/* less hassle if we allow NULL */
 	if (reports == NULL) {
 		PyErr_Print();
 		PyErr_Clear();
 		return 1;
 	}
-	
+
 	if (use_full) {
 		pystring = PyC_ExceptionBuffer();
 	}
 	else {
 		pystring = PyC_ExceptionBuffer_Simple();
 	}
-	
+
 	if (pystring == NULL) {
 		BKE_report(reports, RPT_ERROR, "Unknown py-exception, could not convert");
 		return 0;
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index c8ce7b2f770..215a64a4449 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -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) {
 			PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_FromString(dvar->name));
 		}
-		
+
 		driver->flag &= ~DRIVER_FLAG_RENAMEVAR;
 	}
 	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");
 				targets_ok = 0;
 			}
-			
+
 			fprintf(stderr, "\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n", dvar->name);
 			// BPy_errors_to_report(NULL); // TODO - reports
 			PyErr_Print();
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 99f87c61c5a..b0c6b0ca800 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -289,7 +289,7 @@ void BPY_python_start(int argc, const char **argv)
 		PySys_SetObject("argv", py_argv);
 		Py_DECREF(py_argv);
 	}
-	
+
 	/* Initialize thread support (also acquires lock) */
 	PyEval_InitThreads();
 #else
@@ -328,7 +328,7 @@ void BPY_python_start(int argc, const char **argv)
 	BPy_init_modules();
 
 	bpy_import_init(PyEval_GetBuiltins());
-	
+
 	pyrna_alloc_types();
 
 #ifndef WITH_PYTHON_MODULE
@@ -347,7 +347,7 @@ void BPY_python_end(void)
 
 	/* finalizing, no need to grab the state, except when we are a module */
 	gilstate = PyGILState_Ensure();
-	
+
 	/* free other python data. */
 	pyrna_free_types();
 
@@ -693,7 +693,7 @@ bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
 	PyC_MainModule_Restore(main_mod);
 
 	bpy_context_clear(C, &gilstate);
-	
+
 	return ok;
 }
 
@@ -877,7 +877,7 @@ static void bpy_module_delay_init(PyObject *bpy_proxy)
 
 	argv[0] = filename_abs;
 	argv[1] = NULL;
-	
+
 	// printf("module found %s\n", argv[0]);
 
 	main_python_enter(argc, argv);
@@ -906,14 +906,14 @@ PyMODINIT_FUNC
 PyInit_bpy(void)
 {
 	PyObject *bpy_proxy = PyModule_Create(&bpy_proxy_def);
-	
+
 	/* Problem:
 	 * 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)
 	 *    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,
-	 *    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:
 	 *    'from blender import bpy'
 	 *
@@ -923,13 +923,13 @@ PyInit_bpy(void)
 
 	/* assign an object which is freed after __file__ is assigned */
 	dealloc_obj *dob;
-	
+
 	/* assign dummy type */
 	dealloc_obj_Type.tp_name = "dealloc_obj";
 	dealloc_obj_Type.tp_basicsize = sizeof(dealloc_obj);
 	dealloc_obj_Type.tp_dealloc = dealloc_obj_dealloc;
 	dealloc_obj_Type.tp_flags = Py_TPFLAGS_DEFAULT;
-	
+
 	if (PyType_Ready(&dealloc_obj_Type) < 0)
 		return NULL;
 
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 0cadbc30a9f..4652da2018c 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -79,7 +79,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
 	/* 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... */
 	bContext *C = (bContext *)BPy_GetContext();
-	
+
 	if (C == NULL) {
 		PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
 		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))
 		return NULL;
-	
+
 	ot = WM_operatortype_find(opname, true);
 
 	if (ot == NULL) {
@@ -108,7 +108,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
 			return NULL;
 		}
 	}
-	
+
 	if (context_dict == NULL || context_dict == Py_None) {
 		context_dict = NULL;
 	}
@@ -123,10 +123,10 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
 	context_dict_back = CTX_py_dict_get(C);
 	CTX_py_dict_set(C, (void *)context_dict);
 	Py_XINCREF(context_dict); /* so we done loose it */
-	
+
 	/* main purpose of thsi function */
 	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 */
 	Py_XDECREF(context_dict);
 	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,
 	 * could make a tuple from self and pack the name and Context into it... */
 	bContext *C = (bContext *)BPy_GetContext();
-	
+
 	if (C == NULL) {
 		PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
 		return NULL;
 	}
-	
+
 	if (!PyArg_ParseTuple(args, "sO|O!si:_bpy.ops.call",
 	                      &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);
 		return NULL;
 	}
-	
+
 	if (!pyrna_write_check()) {
 		PyErr_Format(PyExc_RuntimeError,
 		             "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);
 				}
 			}
-	
+
 			BKE_reports_clear(reports);
 			if ((reports->flag & RPT_FREE) == 0) {
 				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.");
 		return NULL;
 	}
-	
+
 	if (!PyArg_ParseTuple(
 	        args, "s|O!O&O&:_bpy.ops.as_string",
 	        &opname, &PyDict_Type, &kw,
@@ -400,7 +400,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
 	PointerRNA ptr;
 	const char *opname = _PyUnicode_AsString(value);
 	BPy_StructRNA *pyrna = NULL;
-	
+
 	if (opname == NULL) {
 		PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument");
 		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);
 		return NULL;
 	}
-	
+
 	/* type */
 	//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_sanitize(&ptr, 0);
 
-	
+
 	pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
 #ifdef PYRNA_FREE_SUPPORT
 	pyrna->freeptr = true;
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index d3eddff4b9a..d0b0331430d 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -366,7 +366,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *
 
 		Py_DECREF(ret);
 	}
-	
+
 	if (use_gil)
 		PyGILState_Release(gilstate);
 
@@ -1329,7 +1329,7 @@ static int icon_id_from_name(const char *name)
 			}
 		}
 	}
-	
+
 	return 0;
 }
 
@@ -1631,7 +1631,7 @@ static void bpy_prop_callback_assign_boolean(struct PropertyRNA *prop, PyObject
 {
 	BooleanPropertyGetFunc rna_get_cb = NULL;
 	BooleanPropertySetFunc rna_set_cb = NULL;
-	
+
 	if (get_cb && get_cb != Py_None) {
 		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;
 	BooleanArrayPropertySetFunc rna_set_cb = NULL;
-	
+
 	if (get_cb && get_cb != Py_None) {
 		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;
 	IntPropertySetFunc rna_set_cb = NULL;
-	
+
 	if (get_cb && get_cb != Py_None) {
 		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;
 	IntArrayPropertySetFunc rna_set_cb = NULL;
-	
+
 	if (get_cb && get_cb != Py_None) {
 		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;
 	FloatPropertySetFunc rna_set_cb = NULL;
-	
+
 	if (get_cb && get_cb != Py_None) {
 		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;
 	FloatArrayPropertySetFunc rna_set_cb = NULL;
-	
+
 	if (get_cb && get_cb != Py_None) {
 		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;
 	StringPropertyLengthFunc rna_length_cb = NULL;
 	StringPropertySetFunc rna_set_cb = NULL;
-	
+
 	if (get_cb && get_cb != Py_None) {
 		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;
 	EnumPropertyItemFunc rna_itemf_cb = NULL;
 	EnumPropertySetFunc rna_set_cb = NULL;
-	
+
 	if (get_cb && get_cb != Py_None) {
 		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);
 }
 
-/* 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) */
 #define BPY_PROPDEF_HEAD(_func)                                               \
 	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);
 		RNA_def_property_duplicate_pointers(srna, prop);
 	}
-	
+
 	Py_RETURN_NONE;
 }
 
@@ -2801,7 +2801,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
 	StructRNA *srna;
 
 	BPY_PROPDEF_HEAD(EnumProperty);
-	
+
 	if (srna) {
 		const char *id = NULL, *name = NULL, *description = "";
 		PyObject *def = NULL;
@@ -3195,7 +3195,7 @@ PyObject *BPY_rna_props(void)
 {
 	PyObject *submodule;
 	PyObject *submodule_dict;
-	
+
 	submodule = PyModule_Create(&props_module);
 	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
 	 * PyModule_AddObject which steals a ref */
 	Py_INCREF(submodule);
-	
+
 	/* api needs the PyObjects internally */
 	submodule_dict = PyModule_GetDict(submodule);
 
@@ -3220,6 +3220,6 @@ PyObject *BPY_rna_props(void)
 	ASSIGN_STATIC(PointerProperty);
 	ASSIGN_STATIC(CollectionProperty);
 	ASSIGN_STATIC(RemoveProperty);
-	
+
 	return submodule;
 }
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 9f9bb46c8bb..693ff954993 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -233,13 +233,13 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
 		 */
 		ReportList reports;
 		short result = 0;
-		
+
 		PointerRNA ptr = self->ptr;
 		PropertyRNA *prop = NULL;
 		const char *prop_name;
-		
+
 		BKE_reports_init(&reports, RPT_STORE);
-		
+
 		/* Retrieve the property identifier from the full path, since we can't get it any other way */
 		prop_name = strrchr(path_full, '.');
 		if ((prop_name >= path_full) &&
@@ -247,21 +247,21 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
 		{
 			prop = RNA_struct_find_property(&ptr, prop_name + 1);
 		}
-		
+
 		if (prop) {
 			NlaStrip *strip = (NlaStrip *)ptr.data;
 			FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index);
-			
+
 			result = insert_keyframe_direct(&reports, ptr, prop, fcu, cfra, keytype, options);
 		}
 		else {
 			BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
 		}
 		MEM_freeN((void *)path_full);
-		
+
 		if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
 			return NULL;
-		
+
 		return PyBool_FromLong(result);
 	}
 	else {
@@ -320,13 +320,13 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
 		 */
 		ReportList reports;
 		short result = 0;
-		
+
 		PointerRNA ptr = self->ptr;
 		PropertyRNA *prop = NULL;
 		const char *prop_name;
-		
+
 		BKE_reports_init(&reports, RPT_STORE);
-		
+
 		/* Retrieve the property identifier from the full path, since we can't get it any other way */
 		prop_name = strrchr(path_full, '.');
 		if ((prop_name >= path_full) &&
@@ -334,14 +334,14 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
 		{
 			prop = RNA_struct_find_property(&ptr, prop_name + 1);
 		}
-		
+
 		if (prop) {
 			ID *id = ptr.id.data;
 			NlaStrip *strip = (NlaStrip *)ptr.data;
 			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 */
-			
+
 			if (BKE_fcurve_is_protected(fcu)) {
 				BKE_reportf(&reports, RPT_WARNING,
 				            "Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'",
@@ -354,7 +354,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
 				 */
 				bool found = false;
 				int i;
-				
+
 				/* try to find index of beztriple to get rid of */
 				i = binarysearch_bezt_index(fcu->bezt, cfra, fcu->totvert, &found);
 				if (found) {
@@ -368,10 +368,10 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
 			BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
 		}
 		MEM_freeN((void *)path_full);
-		
+
 		if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
 			return NULL;
-		
+
 		return PyBool_FromLong(result);
 	}
 	else {
@@ -423,7 +423,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
 
 		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);
 
 		if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
@@ -449,7 +449,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
 				RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
 				ret = pyrna_struct_CreatePyObject(&tptr);
 			}
-			
+
 			WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
 		}
 		else {
@@ -502,7 +502,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
 
 		if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
 			return NULL;
-		
+
 		WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
 
 		return PyBool_FromLong(result);
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index ed9d1e9c0e5..571ee0edea2 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -277,10 +277,10 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
 			 *    dimsize[1] = 4
 			 *    dimsize[2] = 5
 			 *    lvalue_dim = 0, totdim = 3
-			 * 
+			 *
 			 *    arr[2][3] = x
 			 *    lvalue_dim = 1
-			 * 
+			 *
 			 *    arr[2][3][4] = x
 			 *    lvalue_dim = 2 */
 			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]
 		 *    index = 0 + 2 * 4 * 5
-		 * 
+		 *
 		 *    x = arr[2][3]
 		 *    index = offset + 3 * 5 */
 
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index 01a25137a98..b1ac6bee608 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -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))
 		return NULL;
-	
+
 	if (!PyCallable_Check(cb_func)) {
 		PyErr_SetString(PyExc_TypeError, "callback_add(): first argument isn't callable");
 		return NULL;
diff --git a/source/blender/python/mathutils/CMakeLists.txt b/source/blender/python/mathutils/CMakeLists.txt
index f70f893aeac..adf7c85d7c9 100644
--- a/source/blender/python/mathutils/CMakeLists.txt
+++ b/source/blender/python/mathutils/CMakeLists.txt
@@ -18,7 +18,7 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-set(INC 
+set(INC
 	.
 	../../blenlib
 	../../blenkernel
diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h
index d2fbe6a04d5..f7c8d7eebeb 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.h
+++ b/source/blender/python/mathutils/mathutils_Matrix.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
diff --git a/source/blender/python/mathutils/mathutils_interpolate.c b/source/blender/python/mathutils/mathutils_interpolate.c
index c8cb71874db..720fac7c276 100644
--- a/source/blender/python/mathutils/mathutils_interpolate.c
+++ b/source/blender/python/mathutils/mathutils_interpolate.c
@@ -60,10 +60,10 @@ static PyObject *M_Interpolate_poly_3d_calc(PyObject *UNUSED(self), PyObject *ar
 	float fp[3];
 	float (*vecs)[3];
 	Py_ssize_t len;
-	
+
 	PyObject *point, *veclist, *ret;
 	int i;
-	
+
 	if (!PyArg_ParseTuple(
 	        args, "OO!:poly_3d_calc",
 	        &veclist,
@@ -71,27 +71,27 @@ static PyObject *M_Interpolate_poly_3d_calc(PyObject *UNUSED(self), PyObject *ar
 	{
 		return NULL;
 	}
-	
+
 	if (BaseMath_ReadCallback((VectorObject *)point) == -1)
 		return NULL;
-	
+
 	fp[0] = ((VectorObject *)point)->vec[0];
 	fp[1] = ((VectorObject *)point)->vec[1];
 	if (((VectorObject *)point)->size > 2)
 		fp[2] = ((VectorObject *)point)->vec[2];
 	else
 		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__);
 	if (len == -1) {
 		return NULL;
 	}
-	
+
 	if (len) {
 		float *weights = MEM_mallocN(sizeof(float) * len, __func__);
-		
+
 		interp_weights_poly_v3(weights, vecs, len, fp);
-		
+
 		ret = PyList_New(len);
 		for (i = 0; i < len; i++) {
 			PyList_SET_ITEM(ret, i, PyFloat_FromDouble(weights[i]));
diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index 88c89b90dc8..839d1ffc588 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -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)
 		return NULL;
-	
+
 	return PyFloat_FromDouble(mg_HybridMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, nb));
 }
 

From 2d3d76693a84224b86eac50729fb5a321753b7e3 Mon Sep 17 00:00:00 2001
From: Campbell Barton 
Date: Mon, 4 Jun 2018 08:49:13 +0200
Subject: [PATCH 4/4] Cleanup: newlines at EOF for Python modules

---
 release/scripts/startup/bl_operators/image.py                   | 2 +-
 release/scripts/startup/bl_operators/mask.py                    | 2 +-
 .../scripts/startup/bl_operators/screen_play_rendered_anim.py   | 2 +-
 release/scripts/startup/bl_operators/sequencer.py               | 2 +-
 release/scripts/startup/bl_operators/uvcalc_follow_active.py    | 2 +-
 release/scripts/startup/bl_operators/uvcalc_lightmap.py         | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py
index 6a538f0ae33..c2ca271de66 100644
--- a/release/scripts/startup/bl_operators/image.py
+++ b/release/scripts/startup/bl_operators/image.py
@@ -249,4 +249,4 @@ classes = (
     ProjectApply,
     ProjectEdit,
     SaveDirty,
-)
\ No newline at end of file
+)
diff --git a/release/scripts/startup/bl_operators/mask.py b/release/scripts/startup/bl_operators/mask.py
index 78a4bd9af27..3ce1abad9b8 100644
--- a/release/scripts/startup/bl_operators/mask.py
+++ b/release/scripts/startup/bl_operators/mask.py
@@ -35,4 +35,4 @@ class MASK_MT_add(Menu):
 
 classes = (
     MASK_MT_add,
-)
\ No newline at end of file
+)
diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
index f4d6c7065a9..e32c1ac0f81 100644
--- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
+++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
@@ -184,4 +184,4 @@ class PlayRenderedAnim(Operator):
 
 classes = (
     PlayRenderedAnim,
-)
\ No newline at end of file
+)
diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py
index 7209b6b478f..337492bc8a7 100644
--- a/release/scripts/startup/bl_operators/sequencer.py
+++ b/release/scripts/startup/bl_operators/sequencer.py
@@ -140,4 +140,4 @@ classes = (
     SequencerCrossfadeSounds,
     SequencerCutMulticam,
     SequencerDeinterlaceSelectedMovies,
-)
\ No newline at end of file
+)
diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
index 25ee5cafe81..bcc3a557b48 100644
--- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py
+++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
@@ -252,4 +252,4 @@ class FollowActiveQuads(Operator):
 
 classes = (
     FollowActiveQuads,
-)
\ No newline at end of file
+)
diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
index 8ee29d15d1b..b8ea642dd55 100644
--- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py
+++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
@@ -672,4 +672,4 @@ class LightMapPack(Operator):
 
 classes = (
     LightMapPack,
-)
\ No newline at end of file
+)