style cleanup
authorCampbell Barton <ideasman42@gmail.com>
Sun, 31 Mar 2013 03:28:46 +0000 (03:28 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 31 Mar 2013 03:28:46 +0000 (03:28 +0000)
36 files changed:
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/sca.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_250.c
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/operators/bmo_beautify.c
source/blender/bmesh/operators/bmo_edgenet.c
source/blender/bmesh/tools/bmesh_bevel.c
source/blender/bmesh/tools/bmesh_decimate_collapse.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/armature/reeb.c
source/blender/editors/include/ED_types.h
source/blender/editors/object/object_constraint.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/sculpt_paint/paint_cursor.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_node/node_edit.c
source/blender/gpu/intern/gpu_codegen.c
source/blender/gpu/intern/gpu_draw.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/gpu/shaders/gpu_shader_simple_frag.glsl
source/blender/imbuf/intern/rectop.c
source/blender/makesdna/DNA_ID.h
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/nodes/intern/node_common.c
source/blender/nodes/shader/nodes/node_shader_geom.c
source/blender/nodes/shader/nodes/node_shader_math.c
source/blender/nodes/texture/nodes/node_texture_math.c
source/blender/render/intern/source/imagetexture.c

index 6dcd394c92a6e3f472e55eec13dbcdae9d523b42..3fbbbc84ef42c93b40b4d539c1d9beddecc618bb 100644 (file)
@@ -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;
index 843c3d66e5888a0e9262ed54072dc394d5b0c4ba..64bc4928e35d5dbb3c341c94bc22bd114c7f134a 100644 (file)
@@ -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) {
index 3efe25794e19fea52b80b6126812e05dc906e09c..5124cb1da26a9f82e0216aa57046682189e1b37a 100644 (file)
@@ -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;
index 8034c4d1de9a9a4aad26b149a44f7ed298552b0d..c119eb07779f52e0b42137286d3ee3e4f6c4de98 100644 (file)
@@ -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;
 
index 6433b73fda0fad53d7bdf5a59760e8c50e6a11fe..92f57a54a015e2cbbe955526dc7335a8dd349051 100644 (file)
@@ -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;
index b605747c0202bd99381aa73f3631f471cdd64064..92d32919114be19c65b176d1c4fd86dbf4021ee6 100644 (file)
@@ -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);
                                        }
                                }
                        }
index c00569e4b518bd7f0f3409e3fc8e2d4cfe65922f..2445775ad446038b1e07646f73435245a26467fb 100644 (file)
@@ -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;
index 29d58a94e79089c62407f59d7948cef68295fb18..3aa12005a721626fd63179bef09bfcd22310d450 100644 (file)
@@ -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);
index b94e047ac95c90c68351f4448601dd8c88a29e04..3e968f9250da4839b0c63c5ad151d0363a64e623 100644 (file)
@@ -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;
index 124579c837e3428326432baf67645fc2aa8f4736..a4af570ded055deeedcccab6002e3058ab2467f3 100644 (file)
@@ -45,7 +45,6 @@
 #define FACE_NEW       1
 
 #define ELE_NEW                1
-#define ELE_OUT                2
 #define ELE_ORIG       4
 
 #define FACE_IGNORE    16
index 525bf3a2da783a05509d077fc98ac7d152a517d2..a0fbaaed810ff441ebf0d9a6afdb4e852988c2ff 100644 (file)
@@ -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) {
index e94bb9f5417c9265e7fdc007f9131e175de1642e..edbd43a334643c656a0482d913ea5e5bddb4ae39 100644 (file)
@@ -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;
 
 
index 20ffbd8eac0386414575c52c278a489719931dea..3fa1d580fc50bf99206c0a87094f6350776d8e07 100644 (file)
@@ -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) 
index d04938fd59b08a64d6b90efe793f93c65071fc9f..649ef90f7baed2f453cd1f818b70ea21b1258241 100644 (file)
@@ -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 {
index 5908dbf3a1d999ef1b9f0f28cf97256c7ed886f2..fac4c02e8edd67610fa41839cbe7d17cb78d34e5 100644 (file)
@@ -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)
 
 
 
index 9b61fa449557e6a5fce70554c94a982c735937e4..3e66c4ca1107c06c78903a366b5cfe6e0c4c6bf0 100644 (file)
@@ -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;
index e972b7d66207f8101a6c71e79e381e1ba2e71dc1..f00295a903373c4fa510ee0d24df90a749a7be9a 100644 (file)
@@ -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;
index df723b062597e4d1a73e89e714d9b81f0cbe433d..8fe3eb66c671729f4074f77570e4057cb5fee14d 100644 (file)
@@ -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)
index 1616b3026bd5ca46c8c9201a373333c49a8ffc7e..dd07da6a16f3aace34e5f91b5e2a5fa31e824352 100644 (file)
@@ -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);
                }
 
index 7ea11cc464a527d5e3d26578e8ebb6a5adea615d..a63d147e4590d81293400c0b755c66889de9b401 100644 (file)
@@ -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:
index 061f073b287563bb6ddc73bb26c1acd2a27d44d2..2eca3f94e95f3e7c8f6b85678f956bc1bcca8198 100644 (file)
@@ -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)
index c74c160080c8d35d6e5e8669977081dcd2fc24ec..582a319a5f1845330b926b8493f35ff73ecbbc31 100644 (file)
@@ -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)
index 840b16a4567cdc9875f788822558752e0f355a54..ae1eb62bc18ae85aff1f2447b94d3c6f2334a1bd 100644 (file)
@@ -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) {
index 33402426b62c7a444252957104d027623e09d4e9..b772507e0cc881514c195cf5b24a2643c83adc97 100644 (file)
@@ -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;
index c455e8f7642c99da2ff8b06ed287af453f5fe6fa..e8d28877043af870ad9544c295c7a561692cb7fc 100644 (file)
@@ -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);
index 4fc04175bba196925fd96acb09d738e562026206..147d002475b7844f1b7bdd13c0c5a8f7a6fada5e 100644 (file)
@@ -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 */
index 9610e0cf5aaa8a291dc4cca5346238f37d9f45df..94c73d9e24886f375ed15ec1e96e36993ba59d90 100644 (file)
@@ -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++) {
index 958070c1479573111e4035375a8ba18df1573225..79bf9eba1cca87529e3a96df14469a3870d42f8a 100644 (file)
@@ -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);
 }
 
 
index 8d425f98a251d4b85d054c6d0e129cb5abbcf489..9aa51e7c1df9c807426b5a8799b3d6e71e268abb 100644 (file)
@@ -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))
 
index b9ee9b6ad1cdab23c6fbd1ed830a2b43fd6339e9..68a5ac5f63975b827e0d9e1e86284fd42796c8df 100644 (file)
@@ -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);
index 28278edbbf4a25c185d5cb92712c2c176c3ce739..16f63e313538b316bef4cc9371dae6342e813144 100644 (file)
@@ -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)
index 3280672d5c241b6539081aa81c062b22704db0f4..4e4443f7c3f89446fa511c6cabc566a2bc280319 100644 (file)
@@ -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)
index 40ba2cca4e5f68346fc6ca6d068998929ae480f1..a99d9b0cf562774c81742f40d004853715f3b7e2 100644 (file)
@@ -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;
        }
 }
 
index 31a1501bc3fea3a50fe63f6e6750d2a0f7bbd0a9..c3e2fc54c78ce7faa5b0be675ba7c908ac2e37ed 100644 (file)
@@ -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;
index 499412e750dc30c79ae0c07ff567a41bee9e9939..03349a5783258c863bcea00af2b22bde4006b2c9 100644 (file)
@@ -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;
index 756fb09888224fdfb82f08a47d78db43b50e5cbe..d822439ed16164795da0a6c16cba23e041fa14a6 100644 (file)
@@ -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)