Cleanup: style, warning

This commit is contained in:
Campbell Barton 2018-02-15 18:03:55 +11:00
parent e6386ed286
commit b8b8669b28
16 changed files with 53 additions and 51 deletions

View File

@ -88,9 +88,7 @@ static SceneCollection *collection_add(ID *owner_id, SceneCollection *sc_parent,
else {
const int number = BLI_listbase_count(&sc_parent->scene_collections) + 1;
const int digits = integer_digits_i(number);
const int max_len = sizeof(sc_parent->name)
- 1 /* NULL terminator */
- (1 + digits) /* " %d" */;
const int max_len = sizeof(sc_parent->name) - 1 /* NULL terminator */ - (1 + digits) /* " %d" */;
name = BLI_sprintfN("%.*s %d", max_len, sc_parent->name, number);
}
}

View File

@ -569,9 +569,9 @@ struct LayerCollection *BKE_layer_collection_duplicate(struct ID *owner_id, stru
layer_collection);
if (layer_collections_parent != NULL) {
layer_collection_new = BLI_findptr(
layer_collections_parent,
scene_collection_new,
offsetof(LayerCollection, scene_collection));
layer_collections_parent,
scene_collection_new,
offsetof(LayerCollection, scene_collection));
break;
}
}

View File

@ -611,7 +611,7 @@ void do_versions_after_linking_280(Main *main)
#endif
if (object->particlesystem.first) {
object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT;
for (ParticleSystem *psys = object->particlesystem.first; psys; psys=psys->next) {
for (ParticleSystem *psys = object->particlesystem.first; psys; psys = psys->next) {
if (psys->part->draw & PART_DRAW_EMITTER) {
object->duplicator_visibility_flag |= OB_DUPLI_FLAG_RENDER;
#ifndef VERSION_280_SUBVERSION_4
@ -902,11 +902,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
SpaceOops *so = (SpaceOops *)sl;
if (!ELEM(so->outlinevis,
SO_SCENES,
SO_GROUPS,
SO_LIBRARIES,
SO_SEQUENCE,
SO_DATABLOCKS,
SO_SCENES,
SO_GROUPS,
SO_LIBRARIES,
SO_SEQUENCE,
SO_DATABLOCKS,
SO_ID_ORPHANS,
SO_VIEW_LAYER,
SO_COLLECTIONS))

View File

@ -132,7 +132,7 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Object
/* Force normal buffer creation. */
if (DRW_state_is_image_render() &&
(view_layer->passflag & SCE_PASS_NORMAL) != 0)
(view_layer->passflag & SCE_PASS_NORMAL) != 0)
{
effects->enabled_effects |= EFFECT_NORMAL_BUFFER;
}

View File

@ -190,7 +190,7 @@ static void eevee_draw_background(void *vedata)
double r[3];
if (DRW_state_is_image_render() ||
((stl->effects->enabled_effects & EFFECT_TAA) != 0))
((stl->effects->enabled_effects & EFFECT_TAA) != 0))
{
BLI_halton_3D(primes, offset, stl->effects->taa_current_sample, r);
EEVEE_update_noise(psl, fbl, r);
@ -226,8 +226,8 @@ static void eevee_draw_background(void *vedata)
}
if (((stl->effects->enabled_effects & EFFECT_TAA) != 0) &&
(stl->effects->taa_current_sample > 1) &&
!DRW_state_is_image_render())
(stl->effects->taa_current_sample > 1) &&
!DRW_state_is_image_render())
{
DRW_viewport_matrix_override_set(stl->effects->overide_persmat, DRW_MAT_PERS);
DRW_viewport_matrix_override_set(stl->effects->overide_persinv, DRW_MAT_PERSINV);

View File

@ -507,28 +507,30 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
psl->probe_display = DRW_pass_create("LightProbe Display", state);
DRW_shgroup_instance_format(e_data.format_probe_display_cube, {
{"probe_id" , DRW_ATTRIB_INT, 1},
{"probe_id", DRW_ATTRIB_INT, 1},
{"probe_location", DRW_ATTRIB_FLOAT, 3},
{"sphere_size" , DRW_ATTRIB_FLOAT, 1},
{"sphere_size", DRW_ATTRIB_FLOAT, 1},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_cube_display_sh,
psl->probe_display,
DRW_cache_sphere_get(),
e_data.format_probe_display_cube);
DRWShadingGroup *grp = DRW_shgroup_instance_create(
e_data.probe_cube_display_sh,
psl->probe_display,
DRW_cache_sphere_get(),
e_data.format_probe_display_cube);
stl->g_data->cube_display_shgrp = grp;
DRW_shgroup_uniform_buffer(grp, "probeCubes", &sldata->probe_pool);
DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
DRW_shgroup_instance_format(e_data.format_probe_display_planar, {
{"probe_id" , DRW_ATTRIB_INT, 1},
{"probe_id", DRW_ATTRIB_INT, 1},
{"probe_mat", DRW_ATTRIB_FLOAT, 16},
});
grp = DRW_shgroup_instance_create(e_data.probe_planar_display_sh,
psl->probe_display,
DRW_cache_quad_get(),
e_data.format_probe_display_planar);
grp = DRW_shgroup_instance_create(
e_data.probe_planar_display_sh,
psl->probe_display,
DRW_cache_quad_get(),
e_data.format_probe_display_planar);
stl->g_data->planar_display_shgrp = grp;
DRW_shgroup_uniform_buffer(grp, "probePlanars", &txl->planar_pool);
}
@ -537,9 +539,10 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
psl->probe_planar_downsample_ps = DRW_pass_create("LightProbe Planar Downsample", DRW_STATE_WRITE_COLOR);
struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_planar_downsample_sh,
psl->probe_planar_downsample_ps,
geom, NULL);
DRWShadingGroup *grp = DRW_shgroup_instance_create(
e_data.probe_planar_downsample_sh,
psl->probe_planar_downsample_ps,
geom, NULL);
stl->g_data->planar_downsample = grp;
DRW_shgroup_uniform_buffer(grp, "source", &txl->planar_pool);
DRW_shgroup_uniform_float(grp, "fireflyFactor", &sldata->common_data.ssr_firefly_fac, 1);
@ -564,7 +567,7 @@ void EEVEE_lightprobes_cache_add(EEVEE_ViewLayerData *sldata, Object *ob)
ped->num_cell = probe->grid_resolution_x * probe->grid_resolution_y * probe->grid_resolution_z;
if ((probe->type == LIGHTPROBE_TYPE_GRID) &&
((pinfo->total_irradiance_samples + ped->num_cell) >= MAX_IRRADIANCE_SAMPLES))
((pinfo->total_irradiance_samples + ped->num_cell) >= MAX_IRRADIANCE_SAMPLES))
{
printf("Too much grid samples !!!\n");
return;
@ -843,9 +846,10 @@ static void EEVEE_lightprobes_updates(EEVEE_ViewLayerData *sldata, EEVEE_PassLis
(probe->flag & LIGHTPROBE_FLAG_SHOW_DATA))
{
struct Gwn_Batch *geom = DRW_cache_sphere_get();
DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_grid_display_sh,
psl->probe_display,
geom, NULL);
DRWShadingGroup *grp = DRW_shgroup_instance_create(
e_data.probe_grid_display_sh,
psl->probe_display,
geom, NULL);
DRW_shgroup_set_instance_count(grp, ped->num_cell);
DRW_shgroup_uniform_int(grp, "offset", &egrid->offset, 1);
DRW_shgroup_uniform_ivec3(grp, "grid_resolution", egrid->resolution, 1);

View File

@ -343,7 +343,7 @@ void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob)
/* For light update tracking. */
if ((prev_cube_sh_id >= 0) &&
(prev_cube_sh_id < linfo->shcaster_backbuffer->count))
(prev_cube_sh_id < linfo->shcaster_backbuffer->count))
{
linfo->new_shadow_id[prev_cube_sh_id] = linfo->cpu_cube_ct;
}

View File

@ -594,7 +594,7 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata, EEVEE_StorageList *stl, E
}
if (!DRW_state_is_image_render() &&
((stl->effects->enabled_effects & EFFECT_TAA) == 0))
((stl->effects->enabled_effects & EFFECT_TAA) == 0))
{
e_data.alpha_hash_offset = 0.0f;
}

View File

@ -233,7 +233,7 @@ static void eevee_render_result_normal(
/* Convert Eevee encoded normals to Blender normals. */
for (int i = 0; i < rr->rectx * rr->recty * 3; i += 3) {
if (rp->rect[i] == 0.0f && rp->rect[i+1] == 0.0f) {
if (rp->rect[i] == 0.0f && rp->rect[i + 1] == 0.0f) {
/* If normal is not correct then do not produce NANs. */
continue;
}
@ -245,9 +245,9 @@ static void eevee_render_result_normal(
float f = dot_v2v2(fenc, fenc);
float g = sqrtf(1.0f - f / 4.0f);
rp->rect[i+0] = fenc[0] * g;
rp->rect[i+1] = fenc[1] * g;
rp->rect[i+2] = 1.0f - f / 2.0f;
rp->rect[i + 0] = fenc[0] * g;
rp->rect[i + 1] = fenc[1] * g;
rp->rect[i + 2] = 1.0f - f / 2.0f;
mul_mat3_m4_v3(g_data->viewinv, &rp->rect[i]);
}
@ -342,7 +342,7 @@ static void eevee_render_result_occlusion(
/* This is the accumulated color. Divide by the number of samples. */
for (int i = 0; i < rr->rectx * rr->recty * 3; i += 3) {
rp->rect[i] = rp->rect[i+1] = rp->rect[i+2] = min_ff(1.0f, rp->rect[i] / render_samples);
rp->rect[i] = rp->rect[i + 1] = rp->rect[i+2] = min_ff(1.0f, rp->rect[i] / render_samples);
}
}
}
@ -525,4 +525,4 @@ void EEVEE_render_update_passes(RenderEngine *engine, Scene *scene, ViewLayer *v
CHECK_PASS(SUBSURFACE_DIRECT, 3, "RGB");
#undef CHECK_PASS
}
}

View File

@ -67,12 +67,12 @@ static void compute_cdf(float (*func)(float x), float cdf[FILTER_CDF_TABLE_SIZE]
{
cdf[0] = 0.0f;
/* Actual CDF evaluation. */
for(int u = 0; u < FILTER_CDF_TABLE_SIZE - 1; ++u) {
for (int u = 0; u < FILTER_CDF_TABLE_SIZE - 1; ++u) {
float x = (float)(u + 1) / (float)(FILTER_CDF_TABLE_SIZE - 1);
cdf[u + 1] = cdf[u] + func(x - 0.5f); /* [-0.5..0.5]. We resize later. */
}
/* Normalize the CDF. */
for(int u = 0; u < FILTER_CDF_TABLE_SIZE - 1; u++) {
for (int u = 0; u < FILTER_CDF_TABLE_SIZE - 1; u++) {
cdf[u] /= cdf[FILTER_CDF_TABLE_SIZE - 1];
}
/* Just to make sure. */
@ -89,7 +89,7 @@ static void invert_cdf(const float cdf[FILTER_CDF_TABLE_SIZE], float invert_cdf[
invert_cdf[u] = 1.0f;
}
else {
float t = (x - cdf[i])/(cdf[i+1] - cdf[i]);
float t = (x - cdf[i]) / (cdf[i + 1] - cdf[i]);
invert_cdf[u] = ((float)i + t) / (float)(FILTER_CDF_TABLE_SIZE - 1);
}
break;

View File

@ -174,7 +174,7 @@ static struct {
void DRW_globals_free(void)
{
struct Gwn_VertFormat **format = &g_formats.instance_screenspace;
for (int i = 0; i < sizeof(g_formats) / sizeof(void*); ++i, ++format) {
for (int i = 0; i < sizeof(g_formats) / sizeof(void *); ++i, ++format) {
MEM_SAFE_FREE(*format);
}
}

View File

@ -2097,7 +2097,7 @@ int GPU_scene_object_lights(ViewLayer *view_layer, float viewmat[4][4], int orth
return count;
}
static void gpu_disable_multisample()
static void gpu_disable_multisample(void)
{
#ifdef __linux__
/* changing multisample from the default (enabled) causes problems on some

View File

@ -711,7 +711,7 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P
/* add/remove modifier as needed */
if (ob->pd->deflect && !md)
ED_object_modifier_add(NULL, bmain, scene, ob, bmain->eval_ctx->object_mode , NULL, eModifierType_Collision);
ED_object_modifier_add(NULL, bmain, scene, ob, bmain->eval_ctx->object_mode, NULL, eModifierType_Collision);
else if (!ob->pd->deflect && md)
ED_object_modifier_remove(NULL, bmain, ob, md);

View File

@ -608,7 +608,7 @@ wmManipulator *wm_manipulatormap_highlight_find(
if (do_step[step]) {
if ((mmap->update_flag[step] & MANIPULATORMAP_IS_REFRESH_CALLBACK) &&
(mgroup->type->refresh != NULL))
(mgroup->type->refresh != NULL))
{
mgroup->type->refresh(C, mgroup);
/* cleared below */

View File

@ -18,7 +18,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/windowmanager/intern/wm_message_bus_static.c
/** \file blender/windowmanager/intern/message_bus/wm_message_bus_static.c
* \ingroup wm
*/

View File

@ -18,7 +18,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/windowmanager/wm_message_bus.h
/** \file blender/windowmanager/message_bus/wm_message_bus.h
* \ingroup wm
*/