[Bf-blender-cvs] [29c10692440] blender2.8: Cleanup: code style
Campbell Barton
noreply at git.blender.org
Mon Jun 25 12:07:15 CEST 2018
Commit: 29c106924408a508b2f37af9e09d9eb46adc6fad
Author: Campbell Barton
Date: Mon Jun 25 12:02:57 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB29c106924408a508b2f37af9e09d9eb46adc6fad
Cleanup: code style
===================================================================
M source/blender/blenfont/intern/blf_glyph.c
M source/blender/blenkernel/BKE_blender_user_menu.h
M source/blender/blenkernel/BKE_mesh_iterators.h
M source/blender/blenkernel/BKE_studiolight.h
M source/blender/blenkernel/intern/layer.c
M source/blender/blenkernel/intern/library.c
M source/blender/blenkernel/intern/rigidbody.c
M source/blender/blenkernel/intern/studiolight.c
M source/blender/blenloader/intern/versioning_280.c
M source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M source/blender/depsgraph/intern/depsgraph.cc
M source/blender/depsgraph/intern/depsgraph_physics.cc
M source/blender/draw/engines/workbench/workbench_deferred.c
M source/blender/draw/engines/workbench/workbench_forward.c
M source/blender/draw/engines/workbench/workbench_materials.c
M source/blender/editors/interface/interface_icons.c
M source/blender/editors/object/object_add.c
M source/blender/editors/object/object_edit.c
M source/blender/editors/screen/screen_user_menu.c
M source/blender/editors/space_outliner/outliner_draw.c
M source/blender/editors/space_outliner/outliner_tree.c
M source/blender/gpu/intern/gpu_texture.c
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_space.c
M source/blender/makesrna/intern/rna_userdef.c
===================================================================
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 51b43d0d168..84388bedb7b 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -223,7 +223,7 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
if (UNLIKELY(gc->texture_current >= gc->textures_len)) {
gc->textures_len *= 2;
- gc->textures = MEM_recallocN((void *)gc->textures, sizeof(GPUTexture*) * gc->textures_len);
+ gc->textures = MEM_recallocN((void *)gc->textures, sizeof(GPUTexture *) * gc->textures_len);
}
gc->p2_width = (int)blf_next_p2((unsigned int)((gc->glyphs_len_free * gc->glyph_width_max) + (gc->pad * 2)));
@@ -239,7 +239,7 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
}
unsigned char *pixels = MEM_callocN((size_t)gc->p2_width * (size_t)gc->p2_height, "BLF texture init");
- GPUTexture *tex = GPU_texture_create_2D(gc->p2_width, gc->p2_height, GPU_R8, (const float*)pixels, error);
+ GPUTexture *tex = GPU_texture_create_2D(gc->p2_width, gc->p2_height, GPU_R8, (const float *)pixels, error);
MEM_freeN(pixels);
gc->textures[gc->texture_current] = tex;
GPU_texture_bind(tex, 0);
diff --git a/source/blender/blenkernel/BKE_blender_user_menu.h b/source/blender/blenkernel/BKE_blender_user_menu.h
index 9f8d1d62951..ff314314646 100644
--- a/source/blender/blenkernel/BKE_blender_user_menu.h
+++ b/source/blender/blenkernel/BKE_blender_user_menu.h
@@ -19,6 +19,7 @@
*/
#ifndef __BKE_BLENDER_USER_MENU_H__
+#define __BKE_BLENDER_USER_MENU_H__
/** \file BKE_blender_user_menu.h
* \ingroup bke
diff --git a/source/blender/blenkernel/BKE_mesh_iterators.h b/source/blender/blenkernel/BKE_mesh_iterators.h
index cbf156b8052..edd5ad783d2 100644
--- a/source/blender/blenkernel/BKE_mesh_iterators.h
+++ b/source/blender/blenkernel/BKE_mesh_iterators.h
@@ -24,7 +24,7 @@
#ifndef __BKE_MESH_ITERATORS_H__
#define __BKE_MESH_ITERATORS_H__
-/** \file BKE_MESH_ITERATORS.h
+/** \file BKE_mesh_iterators.h
* \ingroup bke
*/
diff --git a/source/blender/blenkernel/BKE_studiolight.h b/source/blender/blenkernel/BKE_studiolight.h
index faa48717210..e3edcca5aca 100644
--- a/source/blender/blenkernel/BKE_studiolight.h
+++ b/source/blender/blenkernel/BKE_studiolight.h
@@ -133,7 +133,7 @@ typedef struct StudioLight {
* that cleans up all icons. just to keep the code simple.
*/
StudioLightFreeFunction *free_function;
- void* free_function_data;
+ void *free_function_data;
} StudioLight;
void BKE_studiolight_init(void);
@@ -141,11 +141,11 @@ void BKE_studiolight_free(void);
struct StudioLight *BKE_studiolight_find(const char *name, int flag);
struct StudioLight *BKE_studiolight_findindex(int index, int flag);
struct StudioLight *BKE_studiolight_find_first(int flag);
-void BKE_studiolight_preview(uint* icon_buffer, StudioLight *sl, int icon_id_type);
+void BKE_studiolight_preview(uint *icon_buffer, StudioLight *sl, int icon_id_type);
struct ListBase *BKE_studiolight_listbase(void);
void BKE_studiolight_ensure_flag(StudioLight *sl, int flag);
void BKE_studiolight_refresh(void);
-StudioLight *BKE_studiolight_new(const char* path, int orientation);
+StudioLight *BKE_studiolight_new(const char *path, int orientation);
void BKE_studiolight_remove(StudioLight *sl);
void BKE_studiolight_set_free_function(StudioLight *sl, StudioLightFreeFunction *free_function, void *data);
void BKE_studiolight_unset_icon_id(StudioLight *sl, int icon_id);
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index c44884c3dbf..42e6cec253a 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -657,7 +657,7 @@ static int layer_collection_sync(
int object_restrict = base->object->restrictflag;
if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
- ((object_restrict & OB_RESTRICT_VIEW) == 0))
+ ((object_restrict & OB_RESTRICT_VIEW) == 0))
{
base->flag |= BASE_VISIBLED | BASE_VISIBLE_VIEWPORT;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index fa9432213f9..c2cdc8df1e6 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -2561,8 +2561,8 @@ void BKE_id_tag_clear_atomic(ID *id, int tag)
/** Check that given ID pointer actually is in G_MAIN.
* Main intended use is for debug asserts in places we cannot easily get rid of G_Main... */
-bool BKE_id_is_in_gobal_main(ID *id) {
+bool BKE_id_is_in_gobal_main(ID *id)
+{
/* We do not want to fail when id is NULL here, even though this is a bit strange behavior... */
return (id == NULL || BLI_findindex(which_libbase(G_MAIN, GS(id->name)), id) != -1);
}
-
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 6d38b9b1188..ab324726812 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -238,7 +238,7 @@ RigidBodyCon *BKE_rigidbody_copy_constraint(const Object *ob, const int UNUSED(f
/* get the appropriate DerivedMesh based on rigid body mesh source */
static Mesh *rigidbody_get_mesh(Object *ob)
{
- switch(ob->rigidbody_object->mesh_source) {
+ switch (ob->rigidbody_object->mesh_source) {
case RBO_MESH_DEFORM:
return ob->runtime.mesh_deform_eval;
case RBO_MESH_FINAL:
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index a371f89e0b2..b2a1785542c 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -211,8 +211,7 @@ static void studiolight_load_equirectangular_image(StudioLight *sl)
if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) {
ImBuf *ibuf = NULL;
ibuf = IMB_loadiffname(sl->path, 0, NULL);
- if (ibuf == NULL)
- {
+ if (ibuf == NULL) {
float *colbuf = MEM_mallocN(sizeof(float[4]), __func__);
copy_v4_fl4(colbuf, 1.0f, 0.0f, 1.0f, 1.0f);
ibuf = IMB_allocFromBuffer(NULL, colbuf, 1, 1);
@@ -499,8 +498,7 @@ static void studiolight_calculate_spherical_harmonics_coefficient(StudioLight *s
#ifdef STUDIOLIGHT_SPHERICAL_HARMONICS_WINDOWING
static void studiolight_calculate_spherical_harmonics_luminance(StudioLight *sl, float luminance[STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS])
{
- for (int index = 0; index < STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS; index++)
- {
+ for (int index = 0; index < STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS; index++) {
luminance[index] = rgb_to_grayscale(sl->spherical_harmonics_coefs[index]);
}
}
@@ -519,40 +517,34 @@ static void studiolight_apply_spherical_harmonics_windowing(StudioLight *sl, flo
studiolight_calculate_spherical_harmonics_luminance(sl, luminance);
int index = 1;
- for (int level = 1; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level ++)
- {
+ for (int level = 1; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level++) {
table_l[level] = (float)(SQUARE(level) * SQUARE(level + 1));
float b = 0.0f;
- for (int m = -1; m <= level; m++)
- {
+ for (int m = -1; m <= level; m++) {
b += SQUARE(luminance[index++]);
}
table_b[level] = b;
}
float squared_lamplacian = 0.0f;
- for (int level = 1; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level ++)
- {
+ for (int level = 1; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level++) {
squared_lamplacian += table_l[level] * table_b[level];
}
const float target_squared_laplacian = max_lamplacian * max_lamplacian;
- if (squared_lamplacian <= target_squared_laplacian)
- {
+ if (squared_lamplacian <= target_squared_laplacian) {
return;
}
float lambda = 0.0f;
const int no_iterations = 10000000;
- for (int i = 0; i < no_iterations; ++i)
- {
+ for (int i = 0; i < no_iterations; ++i) {
float f = 0.0f;
float fd = 0.0f;
- for (int level = 1; level <= (int)STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; ++level)
- {
+ for (int level = 1; level <= (int)STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; ++level) {
f += table_l[level] * table_b[level] / SQUARE(1.0f + lambda * table_l[level]);
fd += (2.0f * SQUARE(table_l[level]) * table_b[level]) / CUBE(1.0f + lambda * table_l[level]);
}
@@ -562,20 +554,17 @@ static void studiolight_apply_spherical_harmonics_windowing(StudioLight *sl, flo
float delta = -f / fd;
lambda += delta;
- if (ABS(delta) < 1e-6f)
- {
+ if (ABS(delta) < 1e-6f) {
break;
}
}
/* Apply windowing lambda */
index = 0;
- for (int level = 0; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level ++)
- {
+ for (int level = 0; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level ++) {
float s = 1.0f / (1.0f + lambda * SQUARE(level) * SQUARE(level + 1.0f));
- for (int m = -1; m <= level; m++)
- {
+ for (int m = -1; m <= level; m++) {
mul_v3_fl(sl->spherical_harmonics_coefs[index++], s);
}
}
@@ -726,8 +715,7 @@ static bool studiolight_load_spherical_harmonics_coefficients(StudioLight *sl)
if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) {
FILE *fp = BLI_fopen(sl->path_sh_cache, "rb");
if (fp) {
- if (fread((void*)(sl->spherical_harmonics_coefs), sizeof(sl->spherical_harmonics_coefs), 1, fp))
- {
+ if (fread((void *)(sl->spherical_harmonics_coefs), sizeof(sl->spherical_harmonics_coefs), 1, fp)) {
sl->flag |= STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED;
fclose(fp);
return true;
@@ -823,7 +811,7 @@ static void studiolight_calculate_light_direction(StudioLight *sl)
sl->flag |= STUDIOLIGHT_LIGHT_DIRECTION_CALCULATED;
}
-static StudioLight* studiolight_add_file(const char *path, int flag)
+static StudioLight *studiolight_add_file(const char *path, int flag)
{
char filename[FILE_MAXFILE];
BLI_split_file_part(path, filename, FILE_MAXFILE);
@@ -901,7 +889,7 @@ static uint alpha_circle_mask(float u, float v, float inner_edge, float outer_ed
#define STUDIOLIGHT_DIAMETER 0.95f
-static void studiolight_radiance_preview(uint* icon_buffer, StudioLight *sl)
+static void studiolight_radiance_preview(uint *icon_buffer, StudioLight *sl)
{
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EXTERN
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list