diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-20 09:52:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-20 09:52:56 +0300 |
commit | 12eb29fe355bc17dacf094e8e9d6edc1d8b877f0 (patch) | |
tree | b4297f5992c2263dbc3f986f20bc3edad99af4b0 /source/blender/blenkernel | |
parent | 96a3a628613bfd592aea5fcdfbb196bb61dfacb7 (diff) |
Cleanup: whitespace, duplicate includes
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_studiolight.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 37 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/icons.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mball.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/studiolight.c | 32 |
7 files changed, 48 insertions, 42 deletions
diff --git a/source/blender/blenkernel/BKE_studiolight.h b/source/blender/blenkernel/BKE_studiolight.h index 33c2af668b2..863aab37f39 100644 --- a/source/blender/blenkernel/BKE_studiolight.h +++ b/source/blender/blenkernel/BKE_studiolight.h @@ -73,7 +73,7 @@ typedef struct StudioLight void BKE_studiolight_init(void); void BKE_studiolight_free(void); -struct StudioLight *BKE_studiolight_find(const char* name); +struct StudioLight *BKE_studiolight_find(const char *name); struct StudioLight *BKE_studiolight_findindex(int index); unsigned int *BKE_studiolight_preview(StudioLight *sl, int icon_size); const struct ListBase *BKE_studiolight_listbase(void); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index bcb45b199d2..602dd4c965b 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1295,8 +1295,9 @@ static Mesh *create_orco_mesh(Object *ob, Mesh *me, BMEditMesh *em, int layer) mesh = BKE_bmesh_to_mesh_nomain(em->bm, &(struct BMeshToMeshParams){0}); } else { - BKE_id_copy_ex(NULL, &me->id, (ID**)&mesh, - LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG, false); + BKE_id_copy_ex( + NULL, &me->id, (ID **)&mesh, + LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG, false); } orco = get_orco_coords_dm(ob, em, layer, &free); @@ -1984,7 +1985,7 @@ static void mesh_ensure_display_normals(Mesh *mesh) */ /* BLI_assert((CustomData_has_layer(&mesh->pdata, CD_NORMAL) == false)); */ - if(mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL || !CustomData_has_layer(&mesh->pdata, CD_NORMAL)) { + if (mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL || !CustomData_has_layer(&mesh->pdata, CD_NORMAL)) { float (*face_nors)[3] = NULL; face_nors = MEM_malloc_arrayN(mesh->totpoly, sizeof(*face_nors), "face_nors"); @@ -1993,9 +1994,9 @@ static void mesh_ensure_display_normals(Mesh *mesh) /* calculate face normals */ BKE_mesh_calc_normals_poly( - mesh->mvert, NULL, mesh->totvert, mesh->mloop, mesh->mpoly, - mesh->totloop, mesh->totpoly, face_nors, - only_face_normals); + mesh->mvert, NULL, mesh->totvert, mesh->mloop, mesh->mpoly, + mesh->totloop, mesh->totpoly, face_nors, + only_face_normals); CustomData_add_layer(&mesh->pdata, CD_NORMAL, CD_ASSIGN, face_nors, mesh->totpoly); @@ -2127,8 +2128,9 @@ static void mesh_calc_modifiers( * coordinates (vpaint, etc.) */ if (r_deform_mesh) { - BKE_id_copy_ex(NULL, &me->id, (ID**)r_deform_mesh, - LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG, false); + BKE_id_copy_ex( + NULL, &me->id, (ID **)r_deform_mesh, + LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG, false); /* XXX: Is build_shapekey_layers ever even true? This should have crashed long ago... */ BLI_assert(!build_shapekey_layers); @@ -2269,8 +2271,9 @@ static void mesh_calc_modifiers( } } else { - BKE_id_copy_ex(NULL, &me->id, (ID**)&mesh, - LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG, false); + BKE_id_copy_ex( + NULL, &me->id, (ID **)&mesh, + LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG, false); ASSERT_IS_VALID_MESH(mesh); // XXX: port to Mesh if build_shapekey_layers can ever be true @@ -2439,8 +2442,9 @@ static void mesh_calc_modifiers( #endif } else { - BKE_id_copy_ex(NULL, &me->id, (ID**)&final_mesh, - LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG, false); + BKE_id_copy_ex( + NULL, &me->id, (ID **)&final_mesh, + LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG, false); //if (build_shapekey_layers) { // add_shapekey_layers(final_mesh, me, ob); @@ -2521,11 +2525,12 @@ static void mesh_calc_modifiers_dm( { Mesh *deform_mesh = NULL, *final_mesh = NULL; - mesh_calc_modifiers(depsgraph, scene, ob, inputVertexCos, useRenderParams, useDeform, - need_mapping, dataMask, index, useCache, build_shapekey_layers, allow_gpu, - (r_deformdm ? &deform_mesh : NULL), &final_mesh); + mesh_calc_modifiers( + depsgraph, scene, ob, inputVertexCos, useRenderParams, useDeform, + need_mapping, dataMask, index, useCache, build_shapekey_layers, allow_gpu, + (r_deformdm ? &deform_mesh : NULL), &final_mesh); - if(deform_mesh) { + if (deform_mesh) { *r_deformdm = CDDM_from_mesh_ex(deform_mesh, CD_DUPLICATE); BKE_id_free(NULL, deform_mesh); } diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 5ba4a1196b8..215477e66cc 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -313,7 +313,8 @@ bool BKE_collection_is_animated(Collection *collection, Object *UNUSED(parent)) * you can draw everything, leaves tags in objects to signal it needs further updating */ /* note: does not work for derivedmesh and render... it recreates all again in convertblender.c */ -void BKE_collection_handle_recalc_and_update(struct Depsgraph *depsgraph, Scene *scene, Object *UNUSED(parent), Collection *collection) +void BKE_collection_handle_recalc_and_update( + struct Depsgraph *depsgraph, Scene *scene, Object *UNUSED(parent), Collection *collection) { /* only do existing tags, as set by regular depsgraph */ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object) @@ -323,7 +324,7 @@ void BKE_collection_handle_recalc_and_update(struct Depsgraph *depsgraph, Scene } } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; - } +} /* **************** Object List Cache *******************/ @@ -508,7 +509,7 @@ Collection *BKE_collection_object_find(Main *bmain, Collection *collection, Obje collection = collection->id.next; else collection = bmain->collection.first; - + while (collection) { if (BKE_collection_has_object(collection, ob)) return collection; diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 8476bb6b66d..bfd4e07606f 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -806,7 +806,8 @@ struct Icon_Geom *BKE_icon_geom_from_file(const char *filename) /** \name Studio Light Icon * \{ */ -int BKE_icon_ensure_studio_light(struct StudioLight *sl) { +int BKE_icon_ensure_studio_light(struct StudioLight *sl) +{ int icon_id = get_next_free_id(); icon_create(icon_id, ICON_DATA_STUDIOLIGHT, sl); return icon_id; diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 685c007da6b..461d332dcf5 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -349,8 +349,9 @@ static void layer_collections_copy_data(ListBase *layer_collections_dst, const L const LayerCollection *layer_collection_src = layer_collections_src->first; while (layer_collection_dst != NULL) { - layer_collections_copy_data(&layer_collection_dst->layer_collections, - &layer_collection_src->layer_collections); + layer_collections_copy_data( + &layer_collection_dst->layer_collections, + &layer_collection_src->layer_collections); layer_collection_dst = layer_collection_dst->next; layer_collection_src = layer_collection_src->next; diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 7fc289f8bf2..2f85bfedcf2 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -317,7 +317,7 @@ bool BKE_mball_is_basis_for(Object *ob1, Object *ob2) bool BKE_mball_is_any_selected(const MetaBall *mb) { for (const MetaElem *ml = mb->editelems->first; ml != NULL; ml = ml->next) { - if(ml->flag & SELECT) { + if (ml->flag & SELECT) { return true; } } @@ -327,7 +327,7 @@ bool BKE_mball_is_any_selected(const MetaBall *mb) bool BKE_mball_is_any_unselected(const MetaBall *mb) { for (const MetaElem *ml = mb->editelems->first; ml != NULL; ml = ml->next) { - if((ml->flag & SELECT) == 0) { + if ((ml->flag & SELECT) == 0) { return true; } } diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index baecbd90bc5..7942cbaab71 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -83,11 +83,11 @@ static void direction_to_equirectangular(float r[2], const float dir[3]) static void equirectangular_to_direction(float r[3], float u, float v) { - float phi = (-(M_PI * 2))*u + M_PI; - float theta = -M_PI*v + M_PI; + float phi = (-(M_PI * 2)) * u + M_PI; + float theta = -M_PI * v + M_PI; float sin_theta = sinf(theta); - r[0] = sin_theta*cosf(phi); - r[1] = sin_theta*sinf(phi); + r[0] = sin_theta * cosf(phi); + r[1] = sin_theta * sinf(phi); r[2] = cosf(theta); } @@ -120,7 +120,7 @@ static void studiolight_calculate_directional_diffuse_light(ImBuf *ibuf, float c add_v3_v3(totcol, col); } } - mul_v3_v3fl(color, totcol, 1.0/(steps*steps)); + mul_v3_v3fl(color, totcol, 1.0 / (steps * steps)); } static void studiolight_calculate_diffuse_light(StudioLight *sl) @@ -138,7 +138,7 @@ static void studiolight_calculate_diffuse_light(StudioLight *sl) copy_v3_fl(sl->diffuse_light[STUDIOLIGHT_Z_NEG], 0.0f); if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) { - ImBuf* ibuf = NULL; + ImBuf *ibuf = NULL; ibuf = IMB_loadiffname(sl->path, 0, NULL); if (ibuf) { IMB_float_from_rect(ibuf); @@ -177,7 +177,7 @@ static void studiolight_calculate_light_direction(StudioLight *sl) sl->light_direction[2] = -1.0f; if ((sl->flag & STUDIOLIGHT_EXTERNAL_FILE) && (sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) { - ImBuf* ibuf = NULL; + ImBuf *ibuf = NULL; ibuf = IMB_loadiffname(sl->path, 0, NULL); if (ibuf) { IMB_float_from_rect(ibuf); @@ -204,7 +204,7 @@ static void studiolight_calculate_light_direction(StudioLight *sl) sl->flag |= STUDIOLIGHT_LIGHT_DIRECTION_CALCULATED; } -static void studiolight_add_files_from_datafolder(const int folder_id, const char* subfolder, int flag) +static void studiolight_add_files_from_datafolder(const int folder_id, const char *subfolder, int flag) { StudioLight *sl; struct direntry *dir; @@ -248,11 +248,10 @@ static int studiolight_cmp(const void *a, const void *b) const int flagorder1 = studiolight_flag_cmp_order(sl1); const int flagorder2 = studiolight_flag_cmp_order(sl2); - if (flagorder1 < flagorder2){ + if (flagorder1 < flagorder2) { return -1; } - else if (flagorder1 > flagorder2) - { + else if (flagorder1 > flagorder2) { return 1; } else { @@ -290,13 +289,12 @@ void BKE_studiolight_init(void) void BKE_studiolight_free(void) { struct StudioLight *sl; - while((sl = (StudioLight*)BLI_pophead(&studiolights))) - { + while ((sl = BLI_pophead(&studiolights))) { studiolight_free(sl); } } -struct StudioLight *BKE_studiolight_find(const char* name) +struct StudioLight *BKE_studiolight_find(const char *name) { LISTBASE_FOREACH(StudioLight *, sl, &studiolights) { if (STREQLEN(sl->name, name, FILE_MAXFILE)) { @@ -304,7 +302,7 @@ struct StudioLight *BKE_studiolight_find(const char* name) } } /* When not found, use the default studio light */ - return (StudioLight*)studiolights.first; + return studiolights.first; } struct StudioLight *BKE_studiolight_findindex(int index) @@ -315,7 +313,7 @@ struct StudioLight *BKE_studiolight_findindex(int index) } } /* When not found, use the default studio light */ - return (StudioLight*)studiolights.first; + return studiolights.first; } const struct ListBase *BKE_studiolight_listbase(void) @@ -377,7 +375,7 @@ unsigned int *BKE_studiolight_preview(StudioLight *sl, int icon_size) void BKE_studiolight_ensure_flag(StudioLight *sl, int flag) { - if ((sl->flag & flag) == flag){ + if ((sl->flag & flag) == flag) { return; } |