Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-25 13:02:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-25 13:06:51 +0300
commit29c106924408a508b2f37af9e09d9eb46adc6fad (patch)
tree1858cfeb59d259a434da39848ee130ae8aa63627 /source/blender/blenkernel
parent7a4d5b78ea061196f7bf1550928680e9f094e38b (diff)
Cleanup: code style
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_blender_user_menu.h1
-rw-r--r--source/blender/blenkernel/BKE_mesh_iterators.h2
-rw-r--r--source/blender/blenkernel/BKE_studiolight.h6
-rw-r--r--source/blender/blenkernel/intern/layer.c2
-rw-r--r--source/blender/blenkernel/intern/library.c4
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c2
-rw-r--r--source/blender/blenkernel/intern/studiolight.c53
7 files changed, 29 insertions, 41 deletions
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_EXTERNAL_IMAGE_LOADED);
@@ -946,7 +934,7 @@ static void studiolight_radiance_preview(uint* icon_buffer, StudioLight *sl)
}
}
-static void studiolight_matcap_preview(uint* icon_buffer, StudioLight *sl, bool flipped)
+static void studiolight_matcap_preview(uint *icon_buffer, StudioLight *sl, bool flipped)
{
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EXTERNAL_IMAGE_LOADED);
@@ -977,7 +965,7 @@ static void studiolight_matcap_preview(uint* icon_buffer, StudioLight *sl, bool
}
}
-static void studiolight_irradiance_preview(uint* icon_buffer, StudioLight *sl)
+static void studiolight_irradiance_preview(uint *icon_buffer, StudioLight *sl)
{
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED);
@@ -1104,7 +1092,7 @@ struct ListBase *BKE_studiolight_listbase(void)
return &studiolights;
}
-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)
{
switch (icon_id_type) {
case STUDIOLIGHT_ICON_ID_TYPE_RADIANCE:
@@ -1170,16 +1158,15 @@ void BKE_studiolight_ensure_flag(StudioLight *sl, int flag)
*/
void BKE_studiolight_remove(StudioLight *sl)
{
- if (sl->flag & STUDIOLIGHT_USER_DEFINED)
- {
+ if (sl->flag & STUDIOLIGHT_USER_DEFINED) {
BLI_remlink(&studiolights, sl);
studiolight_free(sl);
}
}
-StudioLight *BKE_studiolight_new(const char* path, int orientation)
+StudioLight *BKE_studiolight_new(const char *path, int orientation)
{
- StudioLight * sl = studiolight_add_file(path, orientation | STUDIOLIGHT_USER_DEFINED);
+ StudioLight *sl = studiolight_add_file(path, orientation | STUDIOLIGHT_USER_DEFINED);
return sl;
}