diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-31 07:28:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-31 07:28:46 +0400 |
commit | e8d532f1dde96c40c1407d39260724fcfee0b606 (patch) | |
tree | 36264f1310ab0dd9af959d09373e7ad6a5e13126 /source | |
parent | 2c58e96685e80e4e12dfad56ed3bb51fa3824197 (diff) |
style cleanup
Diffstat (limited to 'source')
36 files changed, 110 insertions, 105 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 6dcd394c92a..3fbbbc84ef4 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -574,13 +574,13 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, y = point_2d[1] - ups->tex_mouse[1]; /* use pressure adjusted size for fixed mode */ - invradius = 1.0/ups->pixel_radius; + invradius = 1.0f / ups->pixel_radius; } else if (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) { /* leave the coordinates relative to the screen */ /* use unadjusted size for tiled mode */ - invradius = 1.0/BKE_brush_size_get(scene, br); + invradius = 1.0f / BKE_brush_size_get(scene, br); x = point_2d[0]; y = point_2d[1]; @@ -591,7 +591,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, x = point_2d[0] - ups->tex_mouse[0]; y = point_2d[1] - ups->tex_mouse[1]; - invradius = 1.0/ups->pixel_radius; + invradius = 1.0f / ups->pixel_radius; } x *= invradius; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 843c3d66e58..64bc4928e35 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -3011,7 +3011,7 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) *lock_r = ima; /* XXX anim play for viewer nodes not yet supported */ - frame = 0; // XXX iuser?iuser->framenr:0; + frame = 0; // XXX iuser ? iuser->framenr : 0; ibuf = image_get_ibuf(ima, 0, frame); if (!ibuf) { diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 3efe25794e1..5124cb1da26 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1346,7 +1346,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D ctx->jitoff= jitter_offset; ctx->weight= element_weight; ctx->maxweight= maxweight; - ctx->from= (children)? PART_FROM_CHILD: from; + ctx->from= (children) ? PART_FROM_CHILD : from; ctx->cfrom= cfrom; ctx->distr= distr; ctx->dm= dm; @@ -2039,7 +2039,7 @@ static void set_keyed_keys(ParticleSimulationData *sim) ksim.psys->flag |= keyed_flag; - pt = (pt->next && pt->next->flag & PTARGET_VALID)? pt->next : psys->targets.first; + pt = (pt->next && pt->next->flag & PTARGET_VALID) ? pt->next : psys->targets.first; } psys->flag |= PSYS_KEYED; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 8034c4d1de9..c119eb07779 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1396,7 +1396,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup static int ptcache_path(PTCacheID *pid, char *filename) { - Library *lib= (pid->ob)? pid->ob->id.lib: NULL; + Library *lib = (pid->ob) ? pid->ob->id.lib : NULL; const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.main->name; size_t i; diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 6433b73fda0..92f57a54a01 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -705,7 +705,7 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up) bSensor *sens, *tmp; int val; - val = move_up ? 1:2; + val = move_up ? 1 : 2; /* make sure this sensor belongs to this object */ sens= ob->sensors.first; @@ -744,7 +744,7 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up) bController *cont, *tmp; int val; - val = move_up ? 1:2; + val = move_up ? 1 : 2; /* make sure this controller belongs to this object */ cont= ob->controllers.first; @@ -787,7 +787,7 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up) bActuator *act, *tmp; int val; - val = move_up ? 1:2; + val = move_up ? 1 : 2; /* make sure this actuator belongs to this object */ act= ob->actuators.first; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b605747c020..92d32919114 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7935,7 +7935,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (ba->axis==(float) 'x') ba->axis=OB_POSX; else if (ba->axis==(float)'y') ba->axis=OB_POSY; /* don't do an if/else to avoid imediate subversion bump*/ -// ba->axis=((ba->axis == (float) 'x')?OB_POSX_X:OB_POSY); +// ba->axis=((ba->axis == (float)'x') ? OB_POSX_X : OB_POSY); } } } diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index c00569e4b51..2445775ad44 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -1070,7 +1070,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) sce->gm.dome.warptext = sce->r.dometext; /* Stand Alone */ - sce->gm.playerflag |= (sce->r.fullscreen?GAME_PLAYER_FULLSCREEN:0); + sce->gm.playerflag |= (sce->r.fullscreen ? GAME_PLAYER_FULLSCREEN : 0); sce->gm.xplay = sce->r.xplay; sce->gm.yplay = sce->r.yplay; sce->gm.freqplay = sce->r.freqplay; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 29d58a94e79..3aa12005a72 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -800,9 +800,9 @@ static void current_screen_compat(Main *mainvar, bScreen **screen) /* find a global current screen in the first open window, to have * a reasonable default for reading in older versions */ - wm= mainvar->wm.first; - window= (wm)? wm->windows.first: NULL; - *screen= (window)? window->screen: NULL; + wm = mainvar->wm.first; + window = (wm) ? wm->windows.first : NULL; + *screen = (window) ? window->screen : NULL; } typedef struct RenderInfo { @@ -3014,7 +3014,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar) /* XXX still remap G */ fg.curscreen= screen; - fg.curscene= screen? screen->scene : NULL; + fg.curscene= screen ? screen->scene : NULL; fg.displaymode= G.displaymode; fg.winpos= G.winpos; @@ -3075,7 +3075,11 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil } #endif - sprintf(buf, "BLENDER%c%c%.3d", (sizeof(void*)==8)?'-':'_', (ENDIAN_ORDER==B_ENDIAN)?'V':'v', BLENDER_VERSION); + sprintf(buf, "BLENDER%c%c%.3d", + (sizeof(void *) == 8) ? '-' : '_', + (ENDIAN_ORDER == B_ENDIAN) ? 'V' : 'v', + BLENDER_VERSION); + mywrite(wd, buf, 12); write_renderinfo(wd, mainvar); diff --git a/source/blender/bmesh/operators/bmo_beautify.c b/source/blender/bmesh/operators/bmo_beautify.c index b94e047ac95..3e968f9250d 100644 --- a/source/blender/bmesh/operators/bmo_beautify.c +++ b/source/blender/bmesh/operators/bmo_beautify.c @@ -156,9 +156,9 @@ static float bm_edge_calc_rotate_beauty(const BMEdge *e) // printf("%p %p %p %p - %p %p\n", v1, v2, v3, v4, e->l->f, e->l->radial_next->f); BLI_assert((ELEM3(v1, v2, v3, v4) == false) && - (ELEM3(v2, v1, v3, v4) == false) && - (ELEM3(v3, v1, v2, v4) == false) && - (ELEM3(v4, v1, v2, v3) == false)); + (ELEM3(v2, v1, v3, v4) == false) && + (ELEM3(v3, v1, v2, v4) == false) && + (ELEM3(v4, v1, v2, v3) == false)); is_zero_a = area_tri_v3(v2, v3, v4) <= FLT_EPSILON; is_zero_b = area_tri_v3(v2, v4, v1) <= FLT_EPSILON; diff --git a/source/blender/bmesh/operators/bmo_edgenet.c b/source/blender/bmesh/operators/bmo_edgenet.c index 124579c837e..a4af570ded0 100644 --- a/source/blender/bmesh/operators/bmo_edgenet.c +++ b/source/blender/bmesh/operators/bmo_edgenet.c @@ -45,7 +45,6 @@ #define FACE_NEW 1 #define ELE_NEW 1 -#define ELE_OUT 2 #define ELE_ORIG 4 #define FACE_IGNORE 16 diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 525bf3a2da7..a0fbaaed810 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -675,7 +675,7 @@ static void build_boundary(BevelParams *bp, BevVert *bv) return; } - lastd = bp->vertex_only? bv->offset : e->offset; + lastd = bp->vertex_only ? bv->offset : e->offset; vm->boundstart = NULL; do { if (e->is_bev) { diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index e94bb9f5417..edbd43a3346 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -993,7 +993,7 @@ void BM_mesh_decimate_collapse(BMesh *bm, const float factor, float *vweights, c vquadrics = MEM_callocN(sizeof(Quadric) * bm->totvert, __func__); /* since some edges may be degenerate, we might be over allocing a little here */ eheap = BLI_heap_new_ex(bm->totedge); - eheap_table = MEM_callocN(sizeof(HeapNode *) * bm->totedge, __func__); + eheap_table = MEM_mallocN(sizeof(HeapNode *) * bm->totedge, __func__); tot_edge_orig = bm->totedge; diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 20ffbd8eac0..3fa1d580fc5 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3289,13 +3289,13 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann break; case ACHANNEL_SETTING_EXPAND: /* expanded triangle */ - //icon = ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT); + //icon = ((enabled) ? ICON_TRIA_DOWN : ICON_TRIA_RIGHT); icon = ICON_TRIA_RIGHT; tooltip = TIP_("Make channels grouped under this channel visible"); break; case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */ - //icon = ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED); + //icon = ((enabled) ? ICON_LAYER_ACTIVE : ICON_LAYER_USED); icon = ICON_LAYER_USED; tooltip = TIP_("NLA Track is the only one evaluated for the AnimData block it belongs to"); break; @@ -3304,13 +3304,13 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann case ACHANNEL_SETTING_PROTECT: /* protected lock */ // TODO: what about when there's no protect needed? - //icon = ((enabled)? ICON_LOCKED : ICON_UNLOCKED); + //icon = ((enabled) ? ICON_LOCKED : ICON_UNLOCKED); icon = ICON_UNLOCKED; tooltip = TIP_("Editability of keyframes for this channel"); break; case ACHANNEL_SETTING_MUTE: /* muted speaker */ - //icon = ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF); + //icon = ((enabled) ? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF); icon = ICON_MUTE_IPO_OFF; if (ale->type == ALE_FCURVE) diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index d04938fd59b..649ef90f7ba 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -52,9 +52,11 @@ static ReebGraph *FILTERED_RG = NULL; * SIGGRAPH 2007 * * */ - + +#if 0 #define DEBUG_REEB #define DEBUG_REEB_NODE +#endif /* place-holders! */ typedef struct EditEdge { diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index 5908dbf3a1d..fac4c02e8ed 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -40,7 +40,7 @@ /* proposal = put scene pointers on function calls? */ // #define BASACT (scene->basact) -// #define OBACT (BASACT? BASACT->object: NULL) +// #define OBACT (BASACT ? BASACT->object : NULL) diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 9b61fa44955..3e66c4ca110 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -604,7 +604,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int list = &pchan->constraints; else { //if (G.debug & G_DEBUG) - //printf("edit_constraint_property_get: No active bone for object '%s'\n", (ob)? ob->id.name + 2 : "<None>"); + //printf("edit_constraint_property_get: No active bone for object '%s'\n", (ob) ? ob->id.name + 2 : "<None>"); return NULL; } } @@ -616,7 +616,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int con = BKE_constraints_findByName(list, constraint_name); //if (G.debug & G_DEBUG) - //printf("constraint found = %p, %s\n", (void *)con, (con)?con->name:"<Not found>"); + //printf("constraint found = %p, %s\n", (void *)con, (con) ? con->name : "<Not found>"); if (con && (type != 0) && (con->type != type)) con = NULL; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index e972b7d6620..f00295a9033 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2287,13 +2287,13 @@ static void subdivide_particle(PEData *data, int pa_index) nekey++; if (ekey->flag & PEK_SELECT && (ekey+1)->flag & PEK_SELECT) { - nkey->time= (key->time + (key+1)->time)*0.5f; - state.time= (endtime != 0.0f)? nkey->time/endtime: 0.0f; + nkey->time = (key->time + (key + 1)->time) * 0.5f; + state.time = (endtime != 0.0f) ? nkey->time / endtime: 0.0f; psys_get_particle_on_path(&sim, pa_index, &state, 0); copy_v3_v3(nkey->co, state.co); nekey->co= nkey->co; - nekey->time= &nkey->time; + nekey->time = &nkey->time; nekey->flag |= PEK_SELECT; if (!(psys->flag & PSYS_GLOBAL_HAIR)) nekey->flag |= PEK_USE_WCO; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index df723b06259..8fe3eb66c67 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -528,7 +528,7 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length) if ( ELEM(fsmesh.type, OB_FLUIDSIM_FLUID, OB_FLUIDSIM_INFLOW)) { fsmesh.channelInitialVel = fobj->InitialVelocity; - fsmesh.localInivelCoords = ((fluidmd->fss->typeFlags & OB_FSINFLOW_LOCALCOORD)?1:0); + fsmesh.localInivelCoords = ((fluidmd->fss->typeFlags & OB_FSINFLOW_LOCALCOORD) ? 1 : 0); } if (fluidmd->fss->typeFlags & OB_FSBND_NOSLIP) diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 1616b3026bd..dd07da6a16f 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -133,7 +133,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col) int size; int j; int refresh; - int format = col? GL_RGBA : GL_ALPHA; + GLenum format = col ? GL_RGBA : GL_ALPHA; if (br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED && !br->mtex.tex) return 0; @@ -151,7 +151,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col) if (refresh) { struct ImagePool *pool = NULL; /* stencil is rotated later */ - const float rotation = (br->mtex.brush_map_mode != MTEX_MAP_MODE_STENCIL)? + const float rotation = (br->mtex.brush_map_mode != MTEX_MAP_MODE_STENCIL) ? -br->mtex.rot : 0; float radius = BKE_brush_size_get(vc->scene, br) * zoom; @@ -257,10 +257,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col) if (br->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) mul_v4_fl(rgba, BKE_brush_curve_strength(br, len, 1)); /* Falloff curve */ - buffer[index*4] = rgba[0]*255; - buffer[index*4 + 1] = rgba[1]*255; - buffer[index*4 + 2] = rgba[2]*255; - buffer[index*4 + 3] = rgba[3]*255; + buffer[index * 4] = rgba[0] * 255; + buffer[index * 4 + 1] = rgba[1] * 255; + buffer[index * 4 + 2] = rgba[2] * 255; + buffer[index * 4 + 3] = rgba[3] * 255; } else { float avg = br->mtex.tex ? paint_get_tex_pixel(&br->mtex, x, y, pool) : 1; @@ -275,13 +275,14 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col) } else { if (col) { - buffer[index*4] = 0; - buffer[index*4 + 1] = 0; - buffer[index*4 + 2] = 0; - buffer[index*4 + 3] = 0; + buffer[index * 4] = 0; + buffer[index * 4 + 1] = 0; + buffer[index * 4 + 2] = 0; + buffer[index * 4 + 3] = 0; } - else + else { buffer[index] = 0; + } } } } @@ -424,14 +425,13 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, /* check for overlay mode */ if (brush->mtex.brush_map_mode != MTEX_MAP_MODE_STENCIL && - (!(brush->flag & BRUSH_TEXTURE_OVERLAY) || + (!(brush->flag & BRUSH_TEXTURE_OVERLAY) || !ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_TILED))) { return; } - col = ELEM3(mode, PAINT_TEXTURE_PROJECTIVE, PAINT_TEXTURE_2D, PAINT_VERTEX)? - true: false; + col = ELEM3(mode, PAINT_TEXTURE_PROJECTIVE, PAINT_TEXTURE_2D, PAINT_VERTEX) ? true: false; /* save lots of GL state * TODO: check on whether all of these are needed? */ glPushAttrib(GL_COLOR_BUFFER_BIT | @@ -485,7 +485,7 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, quad.ymax = y + radius; } } - else if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_TILED){ + else if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_TILED) { quad.xmin = 0; quad.ymin = 0; quad.xmax = BLI_rcti_size_x(&vc->ar->winrct); @@ -500,7 +500,7 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, glMatrixMode(GL_MODELVIEW); glPushMatrix(); glTranslatef(brush->stencil_pos[0], brush->stencil_pos[1], 0); - glRotatef(brush->mtex.rot/M_PI*180, 0, 0, 1); + glRotatef(RAD2DEGF(brush->mtex.rot), 0, 0, 1); glMatrixMode(GL_TEXTURE); } diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 7ea11cc464a..a63d147e459 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -476,7 +476,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev copy_v2_v2_int(scd->init_sdim, br->stencil_dimension); copy_v2_v2_int(scd->init_spos, br->stencil_pos); sub_v2_v2v2_int(mdiff, event->mval, br->stencil_pos); - scd->lenorig = sqrtf(mdiff[0]*mdiff[0] + mdiff[1]*mdiff[1]); + scd->lenorig = sqrtf(mdiff[0] * mdiff[0] + mdiff[1] * mdiff[1]); scd->br = br; scd->init_rot = br->mtex.rot; scd->init_angle = atan2(mdiff[1], mdiff[0]); @@ -519,10 +519,10 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve { float len, factor; sub_v2_v2v2_int(mdiff, event->mval, scd->br->stencil_pos); - len = sqrtf(mdiff[0]*mdiff[0] + mdiff[1]*mdiff[1]); + len = sqrtf(mdiff[0] * mdiff[0] + mdiff[1] * mdiff[1]); factor = len/scd->lenorig; - mdiff[0] = factor*scd->init_sdim[0]; - mdiff[1] = factor*scd->init_sdim[1]; + mdiff[0] = factor * scd->init_sdim[0]; + mdiff[1] = factor * scd->init_sdim[1]; copy_v2_v2_int(scd->br->stencil_dimension, mdiff); break; } @@ -532,10 +532,10 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve sub_v2_v2v2_int(mdiff, event->mval, scd->br->stencil_pos); angle = atan2(mdiff[1], mdiff[0]); angle = scd->init_rot + angle - scd->init_angle; - if (angle < 0) - angle += 2*M_PI; - if (angle > 2*M_PI) - angle -= 2*M_PI; + if (angle < 0.0f) + angle += (float)(2 * M_PI); + if (angle > (float)(2 * M_PI)) + angle -= (float)(2 * M_PI); scd->br->mtex.rot = angle; break; } @@ -543,12 +543,12 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve } break; case LEFTMOUSE: - if(event->val == KM_PRESS) { + if (event->val == KM_PRESS) { MEM_freeN(op->customdata); return OPERATOR_FINISHED; } case RIGHTMOUSE: - if(event->val == KM_PRESS) { + if (event->val == KM_PRESS) { return stencil_control_cancel(C, op); } default: diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 061f073b287..2eca3f94e95 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -883,7 +883,7 @@ static float calc_vp_strength_col_dl(VPaint *vp, ViewContext *vc, const float co } factor = rgba[3]; } - return factor*BKE_brush_curve_strength_clamp(brush, dist, brush_size_pressure); + return factor * BKE_brush_curve_strength_clamp(brush, dist, brush_size_pressure); } } if (rgba) diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index c74c160080c..582a319a5f1 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2364,7 +2364,7 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op) RE_engine_free(engine); - return (found)? OPERATOR_FINISHED: OPERATOR_CANCELLED; + return (found) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } void NODE_OT_shader_script_update(wmOperatorType *ot) diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 840b16a4567..ae1eb62bc18 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -475,7 +475,7 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) /* create exactly one sampler for each texture */ if (codegen_input_has_texture(input) && input->bindtex) BLI_dynstr_appendf(ds, "uniform %s samp%d;\n", - (input->textype == GPU_TEX2D)? "sampler2D": "sampler2DShadow", + (input->textype == GPU_TEX2D) ? "sampler2D" : "sampler2DShadow", input->texid); } else if (input->source == GPU_SOURCE_BUILTIN) { diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 33402426b62..b772507e0cc 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -1295,7 +1295,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O GMS.gob = ob; GMS.gscene = scene; - GMS.totmat= use_matcap? 1 : ob->totcol+1; /* materials start from 1, default material is 0 */ + GMS.totmat = use_matcap ? 1 : ob->totcol + 1; /* materials start from 1, default material is 0 */ GMS.glay= (v3d->localvd)? v3d->localvd->lay: v3d->lay; /* keep lamps visible in local view */ GMS.gviewmat= rv3d->viewmat; GMS.gviewinv= rv3d->viewinv; diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index c455e8f7642..e8d28877043 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -393,7 +393,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in if (fpixels) { glTexSubImage1D(tex->target, 0, 0, w, format, type, - pixels? pixels: fpixels); + pixels ? pixels : fpixels); if (tex->w > w) GPU_glTexSubImageEmpty(tex->target, format, w, 0, @@ -406,7 +406,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in if (fpixels) { glTexSubImage2D(tex->target, 0, 0, 0, w, h, - format, type, pixels? pixels: fpixels); + format, type, pixels ? pixels : fpixels); if (tex->w > w) GPU_glTexSubImageEmpty(tex->target, format, w, 0, tex->w-w, tex->h); diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 4fc04175bba..147d002475b 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -93,7 +93,7 @@ void hsv_to_rgb(vec4 hsv, out vec4 outcol) float srgb_to_linearrgb(float c) { if(c < 0.04045) - return (c < 0.0)? 0.0: c * (1.0/12.92); + return (c < 0.0) ? 0.0: c * (1.0 / 12.92); else return pow((c + 0.055)*(1.0/1.055), 2.4); } @@ -101,7 +101,7 @@ float srgb_to_linearrgb(float c) float linearrgb_to_srgb(float c) { if(c < 0.0031308) - return (c < 0.0)? 0.0: c * 12.92; + return (c < 0.0) ? 0.0: c * 12.92; else return 1.055 * pow(c, 1.0/2.4) - 0.055; } @@ -2098,7 +2098,7 @@ void node_add_shader(vec4 shader1, vec4 shader2, out vec4 shader) void node_fresnel(float ior, vec3 N, vec3 I, out float result) { float eta = max(ior, 0.00001); - result = fresnel_dielectric(I, N, eta); //backfacing()? 1.0/eta: eta); + result = fresnel_dielectric(I, N, eta); //backfacing() ? 1.0/eta: eta); } /* geometry */ diff --git a/source/blender/gpu/shaders/gpu_shader_simple_frag.glsl b/source/blender/gpu/shaders/gpu_shader_simple_frag.glsl index 9610e0cf5aa..94c73d9e248 100644 --- a/source/blender/gpu/shaders/gpu_shader_simple_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_simple_frag.glsl @@ -70,7 +70,7 @@ void main() #ifndef NO_SPECULAR /* view vector computation, depends on orthographics or perspective */ - vec3 V = (gl_ProjectionMatrix[3][3] == 0.0)? normalize(varying_position): vec3(0.0, 0.0, -1.0); + vec3 V = (gl_ProjectionMatrix[3][3] == 0.0) ? normalize(varying_position): vec3(0.0, 0.0, -1.0); #endif for (int i = 0; i < NUM_SCENE_LIGHTS; i++) { diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index 958070c1479..79bf9eba1cc 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -138,7 +138,7 @@ static void blend_color_add_alpha(char cp[4], const char cp1[4], const char cp2[ cp[0] = cp1[0]; cp[1] = cp1[1]; cp[2] = cp1[2]; - cp[3] = (temp > 255)? 255 : ((temp < 0) ? 0 : temp); + cp[3] = (temp > 255) ? 255 : ((temp < 0) ? 0 : temp); } diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 8d425f98a25..9aa51e7c1df 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -224,7 +224,7 @@ typedef struct PreviewImage { /* fluidsim Ipo */ #define ID_FLUIDSIM MAKE_ID2('F', 'S') -#define ID_REAL_USERS(id) (((ID *)id)->us - ((((ID *)id)->flag & LIB_FAKEUSER) ? 1:0)) +#define ID_REAL_USERS(id) (((ID *)id)->us - ((((ID *)id)->flag & LIB_FAKEUSER) ? 1 : 0)) #define ID_CHECK_UNDO(id) ((GS((id)->name) != ID_SCR) && (GS((id)->name) != ID_WM)) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index b9ee9b6ad1c..68a5ac5f639 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -6194,8 +6194,8 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop) int *array_a, *array_b; int equals; - array_a = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_a; - array_b = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_b; + array_a = (len > 16) ? MEM_callocN(sizeof(int) * len, "RNA equals") : fixed_a; + array_b = (len > 16) ? MEM_callocN(sizeof(int) * len, "RNA equals") : fixed_b; RNA_property_boolean_get_array(a, prop, array_a); RNA_property_boolean_get_array(b, prop, array_b); @@ -6220,8 +6220,8 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop) int *array_a, *array_b; int equals; - array_a = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_a; - array_b = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_b; + array_a = (len > 16) ? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_a; + array_b = (len > 16) ? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_b; RNA_property_int_get_array(a, prop, array_a); RNA_property_int_get_array(b, prop, array_b); @@ -6246,8 +6246,8 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop) float *array_a, *array_b; int equals; - array_a = (len > 16)? MEM_callocN(sizeof(float) * len, "RNA equals"): fixed_a; - array_b = (len > 16)? MEM_callocN(sizeof(float) * len, "RNA equals"): fixed_b; + array_a = (len > 16) ? MEM_callocN(sizeof(float) * len, "RNA equals") : fixed_a; + array_b = (len > 16) ? MEM_callocN(sizeof(float) * len, "RNA equals") : fixed_b; RNA_property_float_get_array(a, prop, array_a); RNA_property_float_get_array(b, prop, array_b); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 28278edbbf4..16f63e31353 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -2736,7 +2736,7 @@ static void rna_ShaderNodeScript_bytecode_get(PointerRNA *ptr, char *value) bNode *node = (bNode *)ptr->data; NodeShaderScript *nss = node->storage; - strcpy(value, (nss->bytecode)? nss->bytecode: ""); + strcpy(value, (nss->bytecode) ? nss->bytecode : ""); } static int rna_ShaderNodeScript_bytecode_length(PointerRNA *ptr) diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 3280672d5c2..4e4443f7c3f 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -84,7 +84,7 @@ bNodeSocket *node_group_find_output_socket(bNode *groupnode, const char *identif /* groups display their internal tree name as label */ const char *node_group_label(bNode *node) { - return (node->id)? node->id->name + 2: IFACE_("Missing Datablock"); + return (node->id) ? node->id->name + 2 : IFACE_("Missing Datablock"); } int node_group_poll_instance(bNode *node, bNodeTree *nodetree) diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c index 40ba2cca4e5..a99d9b0cf56 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geom.c +++ b/source/blender/nodes/shader/nodes/node_shader_geom.c @@ -116,7 +116,7 @@ static void node_shader_exec_geom(void *data, int UNUSED(thread), bNode *node, b } /* front/back, normal flipping was stored */ - out[GEOM_OUT_FRONTBACK]->vec[0] = (shi->flippednor)? 0.0f: 1.0f; + out[GEOM_OUT_FRONTBACK]->vec[0] = (shi->flippednor) ? 0.0f : 1.0f; } } diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c index 31a1501bc3f..c3e2fc54c78 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.c +++ b/source/blender/nodes/shader/nodes/node_shader_math.c @@ -94,14 +94,14 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode { if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ /* Can't do the impossible... */ - if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 ) + if (in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1) out[0]->vec[0] = asin(in[0]->vec[0]); else out[0]->vec[0] = 0.0; } else { /* Can't do the impossible... */ - if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 ) + if (in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1) out[0]->vec[0] = asin(in[1]->vec[0]); else out[0]->vec[0] = 0.0; @@ -112,14 +112,14 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode { if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ /* Can't do the impossible... */ - if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 ) + if (in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1) out[0]->vec[0] = acos(in[0]->vec[0]); else out[0]->vec[0] = 0.0; } else { /* Can't do the impossible... */ - if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 ) + if (in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1) out[0]->vec[0] = acos(in[1]->vec[0]); else out[0]->vec[0] = 0.0; @@ -137,7 +137,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode case 10: /* Power */ { /* Only raise negative numbers by full integers */ - if ( in[0]->vec[0] >= 0 ) { + if (in[0]->vec[0] >= 0) { out[0]->vec[0] = pow(in[0]->vec[0], in[1]->vec[0]); } else { @@ -157,7 +157,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode case 11: /* Logarithm */ { /* Don't want any imaginary numbers... */ - if ( in[0]->vec[0] > 0 && in[1]->vec[0] > 0 ) + if (in[0]->vec[0] > 0 && in[1]->vec[0] > 0) out[0]->vec[0] = log(in[0]->vec[0]) / log(in[1]->vec[0]); else out[0]->vec[0] = 0.0; @@ -165,7 +165,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode break; case 12: /* Minimum */ { - if ( in[0]->vec[0] < in[1]->vec[0] ) + if (in[0]->vec[0] < in[1]->vec[0]) out[0]->vec[0] = in[0]->vec[0]; else out[0]->vec[0] = in[1]->vec[0]; @@ -173,7 +173,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode break; case 13: /* Maximum */ { - if ( in[0]->vec[0] > in[1]->vec[0] ) + if (in[0]->vec[0] > in[1]->vec[0]) out[0]->vec[0] = in[0]->vec[0]; else out[0]->vec[0] = in[1]->vec[0]; @@ -182,14 +182,14 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode case 14: /* Round */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ - out[0]->vec[0] = (in[0]->vec[0]<0)?(int)(in[0]->vec[0] - 0.5f):(int)(in[0]->vec[0] + 0.5f); + out[0]->vec[0] = (in[0]->vec[0] < 0) ? (int)(in[0]->vec[0] - 0.5f) : (int)(in[0]->vec[0] + 0.5f); else - out[0]->vec[0] = (in[1]->vec[0]<0)?(int)(in[1]->vec[0] - 0.5f):(int)(in[1]->vec[0] + 0.5f); + out[0]->vec[0] = (in[1]->vec[0] < 0) ? (int)(in[1]->vec[0] - 0.5f) : (int)(in[1]->vec[0] + 0.5f); } break; case 15: /* Less Than */ { - if ( in[0]->vec[0] < in[1]->vec[0] ) + if (in[0]->vec[0] < in[1]->vec[0]) out[0]->vec[0] = 1.0f; else out[0]->vec[0] = 0.0f; @@ -197,7 +197,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode break; case 16: /* Greater Than */ { - if ( in[0]->vec[0] > in[1]->vec[0] ) + if (in[0]->vec[0] > in[1]->vec[0]) out[0]->vec[0] = 1.0f; else out[0]->vec[0] = 0.0f; diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 499412e750d..03349a57832 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -88,7 +88,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 7: /* Arc-Sine */ { /* Can't do the impossible... */ - if ( in0 <= 1 && in0 >= -1 ) + if (in0 <= 1 && in0 >= -1) *out= asin(in0); else *out= 0.0; @@ -97,7 +97,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 8: /* Arc-Cosine */ { /* Can't do the impossible... */ - if ( in0 <= 1 && in0 >= -1 ) + if (in0 <= 1 && in0 >= -1) *out= acos(in0); else *out= 0.0; @@ -111,7 +111,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 10: /* Power */ { /* Only raise negative numbers by full integers */ - if ( in0 >= 0 ) { + if (in0 >= 0) { out[0] = pow(in0, in1); } else { @@ -128,7 +128,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 11: /* Logarithm */ { /* Don't want any imaginary numbers... */ - if ( in0 > 0 && in1 > 0 ) + if (in0 > 0 && in1 > 0) *out= log(in0) / log(in1); else *out= 0.0; @@ -136,7 +136,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; case 12: /* Minimum */ { - if ( in0 < in1 ) + if (in0 < in1) *out= in0; else *out= in1; @@ -144,7 +144,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; case 13: /* Maximum */ { - if ( in0 > in1 ) + if (in0 > in1) *out= in0; else *out= in1; @@ -152,13 +152,13 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; case 14: /* Round */ { - *out= (in0<0)?(int)(in0 - 0.5f):(int)(in0 + 0.5f); + *out= (in0 < 0) ? (int)(in0 - 0.5f) : (int)(in0 + 0.5f); } break; case 15: /* Less Than */ { - if ( in0 < in1 ) + if (in0 < in1) *out= 1.0f; else *out= 0.0f; @@ -167,7 +167,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 16: /* Greater Than */ { - if ( in0 > in1 ) + if (in0 > in1) *out= 1.0f; else *out= 0.0f; diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 756fb098882..d822439ed16 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -119,7 +119,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul texres->tin= texres->ta= texres->tr= texres->tg= texres->tb= 0.0f; /* we need to set retval OK, otherwise texture code generates normals itself... */ - retval= texres->nor?3:1; + retval= texres->nor ? 3 : 1; /* quick tests */ if (ibuf==NULL && ima==NULL) @@ -1500,7 +1500,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const texres->tin= texres->ta= texres->tr= texres->tg= texres->tb= 0.0f; /* we need to set retval OK, otherwise texture code generates normals itself... */ - retval= texres->nor?3:1; + retval = texres->nor ? 3 : 1; /* quick tests */ if (ibuf==NULL && ima==NULL) |