style edits - < 120 line width
authorCampbell Barton <ideasman42@gmail.com>
Thu, 19 Jan 2012 16:04:44 +0000 (16:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 19 Jan 2012 16:04:44 +0000 (16:04 +0000)
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/drawvolume.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_fly.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_view.c

index 2d77ab208081e39f4488942219a7ca85d7be14bf..599e113ba97b33b023b527a4fcd66378024abfff 100644 (file)
@@ -526,7 +526,8 @@ static void draw_bone_solid_octahedral(void)
                glEnableClientState(GL_VERTEX_ARRAY);
                glNormalPointer(GL_FLOAT, 0, bone_octahedral_solid_normals);
                glVertexPointer(3, GL_FLOAT, 0, bone_octahedral_verts);
-               glDrawElements(GL_TRIANGLES, sizeof(bone_octahedral_solid_tris)/sizeof(unsigned int), GL_UNSIGNED_INT, bone_octahedral_solid_tris);
+               glDrawElements(GL_TRIANGLES, sizeof(bone_octahedral_solid_tris)/sizeof(unsigned int),
+                              GL_UNSIGNED_INT, bone_octahedral_solid_tris);
                glDisableClientState(GL_NORMAL_ARRAY);
                glDisableClientState(GL_VERTEX_ARRAY);
 #endif
@@ -738,7 +739,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
 
 
 /* smat, imat = mat & imat to draw screenaligned */
-static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_sphere_bone_wire(float smat[][4], float imat[][4],
+                                  int armflag, int boneflag, short constflag, unsigned int id,
+                                  bPoseChannel *pchan, EditBone *ebone)
 {
        float head, tail /*, length*/;
        float *headvec, *tailvec, dirvec[3];
@@ -843,7 +846,8 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag,
 }
 
 /* does wire only for outline selecting */
-static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id,
+                             bPoseChannel *pchan, EditBone *ebone)
 {
        GLUquadricObj   *qobj;
        float head, tail, length;
@@ -973,7 +977,8 @@ static GLubyte bm_dot5[]= {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0};
 static GLubyte bm_dot7[]= {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38}; 
 
 
-static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id,
+                           bPoseChannel *pchan, EditBone *ebone)
 {
        float length;
        
@@ -1107,7 +1112,8 @@ static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float l
        }
 }
 
-static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id,
+                        bPoseChannel *pchan, EditBone *ebone)
 {
        float xwidth, length, zwidth;
        
@@ -1220,7 +1226,8 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len
        }
 }
 
-static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id,
+                           bPoseChannel *pchan, EditBone *ebone)
 {
        Mat4 *bbones = NULL;
        int segments = 0;
@@ -1340,7 +1347,8 @@ static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsign
        }
 }
 
-static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int armflag, int boneflag, unsigned int id, float length)
+static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob,
+                             int dt, int armflag, int boneflag, unsigned int id, float length)
 {
        if(ob==NULL) return;
        
@@ -1573,7 +1581,8 @@ static void draw_pose_dofs(Object *ob)
                                                                glColor3ub(50, 50, 255);        // blue, Z axis limit
                                                                glBegin(GL_LINE_STRIP);
                                                                for (a=-16; a<=16; a++) {
-                                                                       float fac= ((float)a)/16.0f * 0.5f; /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
+                                                                       /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
+                                                                       float fac= ((float)a)/16.0f * 0.5f;
                                                                        
                                                                        phi= fac * (pchan->limitmax[2] - pchan->limitmin[2]);
                                                                        
@@ -1596,7 +1605,8 @@ static void draw_pose_dofs(Object *ob)
                                                                glColor3ub(255, 50, 50);        // Red, X axis limit
                                                                glBegin(GL_LINE_STRIP);
                                                                for (a=-16; a<=16; a++) {
-                                                                       float fac= ((float)a)/16.0f * 0.5f; /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
+                                                                       /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
+                                                                       float fac= ((float)a)/16.0f * 0.5f;
                                                                        phi= (float)(0.5*M_PI) + fac * (pchan->limitmax[0] - pchan->limitmin[0]);
                                                                        
                                                                        i= (a == -16) ? 2 : 3;
@@ -1630,7 +1640,8 @@ static void bone_matrix_translate_y(float mat[][4], float y)
 }
 
 /* assumes object is Armature with pose */
-static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, const short is_ghost, const short is_outline)
+static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt,
+                            const short is_ghost, const short is_outline)
 {
        RegionView3D *rv3d= ar->regiondata;
        Object *ob= base->object;
@@ -1730,10 +1741,13 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                                        
                                        if (use_custom) {
                                                /* if drawwire, don't try to draw in solid */
-                                               if (pchan->bone->flag & BONE_DRAWWIRE) 
+                                               if (pchan->bone->flag & BONE_DRAWWIRE) {
                                                        draw_wire= 1;
-                                               else
-                                                       draw_custom_bone(scene, v3d, rv3d, pchan->custom, OB_SOLID, arm->flag, flag, index, bone->length);
+                                               }
+                                               else {
+                                                       draw_custom_bone(scene, v3d, rv3d, pchan->custom,
+                                                                        OB_SOLID, arm->flag, flag, index, bone->length);
+                                               }
                                        }
                                        else if (arm->drawtype==ARM_LINE)
                                                ;       /* nothing in solid */
@@ -1817,7 +1831,8 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                                                        if (bone == arm->act_bone)
                                                                flag |= BONE_DRAW_ACTIVE;
                                                        
-                                                       draw_custom_bone(scene, v3d, rv3d, pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
+                                                       draw_custom_bone(scene, v3d, rv3d, pchan->custom,
+                                                                        OB_WIRE, arm->flag, flag, index, bone->length);
                                                        
                                                        glPopMatrix();
                                                }
@@ -2580,7 +2595,3 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
 
        return retval;
 }
-
-/* *************** END Armature drawing ******************* */
-
-
index 441665377c7dc968313169f30e20c088d93c3d57..f7f67bd4e733e8b8714e496545c2a009512caa5c 100644 (file)
@@ -2695,10 +2695,14 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, EditMesh *em, UnitSet
                                        mul_mat3_m4_v3(ob->obmat, v1);
                                        mul_mat3_m4_v3(ob->obmat, v2);
                                }
-                               if(unit->system)
-                                       bUnit_AsString(numstr, sizeof(numstr), len_v3v3(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE);
-                               else
+
+                               if(unit->system) {
+                                       bUnit_AsString(numstr, sizeof(numstr), len_v3v3(v1, v2) * unit->scale_length, 3,
+                                                      unit->system, B_UNIT_LENGTH, do_split, FALSE);
+                               }
+                               else {
                                        sprintf(numstr, conv_float, len_v3v3(v1, v2));
+                               }
 
                                view3d_cached_text_draw_add(vmid, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
                        }
@@ -2706,7 +2710,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, EditMesh *em, UnitSet
        }
 
        if(me->drawflag & ME_DRAWEXTRA_FACEAREA) {
-// XXX         extern int faceselectedOR(EditFace *efa, int flag);             // editmesh.h shouldn't be in this file... ok for now?
+// XXX         extern int faceselectedOR(EditFace *efa, int flag); // editmesh.h shouldn't be in this file... ok for now?
                UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
                
                for(efa= em->faces.first; efa; efa= efa->next) {
@@ -2729,10 +2733,14 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, EditMesh *em, UnitSet
                                else
                                        area = area_tri_v3(v1, v2, v3);
 
-                               if(unit->system)
-                                       bUnit_AsString(numstr, sizeof(numstr), area*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE); // XXX should be B_UNIT_AREA
-                               else
+                               if(unit->system) {
+                                       // XXX should be B_UNIT_AREA
+                                       bUnit_AsString(numstr, sizeof(numstr), area * unit->scale_length, 3,
+                                                      unit->system, B_UNIT_LENGTH, do_split, FALSE);
+                               }
+                               else {
                                        sprintf(numstr, conv_float, area);
+                               }
 
                                view3d_cached_text_draw_add(efa->cent, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
                        }
index 8308a4a9ccf3bddca5893fa1a8523349721b0308..1ed8e44a26b05e287de4fd4b0f53352309a14181 100644 (file)
@@ -170,7 +170,8 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
        float cor[3] = {1.,1.,1.};
        int gl_depth = 0, gl_blend = 0;
 
-       /* draw slices of smoke is adapted from c++ code authored by: Johannes Schmid and Ingemar Rask, 2006, johnny@grob.org */
+       /* draw slices of smoke is adapted from c++ code authored
+        * by: Johannes Schmid and Ingemar Rask, 2006, johnny@grob.org */
        float cv[][3] = {
                {1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, {-1.0f, -1.0f, 1.0f}, {1.0f, -1.0f, 1.0f},
                {1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}, {1.0f, -1.0f, -1.0f}
@@ -424,7 +425,9 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
                        glBegin(GL_POLYGON);
                        glColor3f(1.0, 1.0, 1.0);
                        for (i = 0; i < numpoints; i++) {
-                               glTexCoord3d((points[i * 3 + 0] - min[0] )*cor[0]/size[0], (points[i * 3 + 1] - min[1])*cor[1]/size[1], (points[i * 3 + 2] - min[2])*cor[2]/size[2]);
+                               glTexCoord3d((points[i * 3 + 0] - min[0]) * cor[0] / size[0],
+                                            (points[i * 3 + 1] - min[1]) * cor[1] / size[1],
+                                            (points[i * 3 + 2] - min[2]) * cor[2] / size[2]);
                                glVertex3f(points[i * 3 + 0], points[i * 3 + 1], points[i * 3 + 2]);
                        }
                        glEnd();
index f2906ca9559bafaf2c5006800e8a08d2b8e9d0fd..94ab847c91b062594ade0785ab6ecfceb642dc9d 100644 (file)
@@ -1023,7 +1023,8 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn)
                        break;
        }
 
-#if 0 // removed since BKE_image_user_calc_frame is now called in draw_bgpic because screen_ops doesnt call the notifier.
+       // removed since BKE_image_user_calc_frame is now called in draw_bgpic because screen_ops doesnt call the notifier.
+#if 0
        if (wmn->category == NC_SCENE && wmn->data == ND_FRAME) {
                View3D *v3d = area->spacedata.first;
                BGpic *bgpic = v3d->bgpicbase.first;
@@ -1048,7 +1049,8 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
        View3D *v3d= CTX_wm_view3d(C);
        Scene *scene= CTX_data_scene(C);
        Base *base;
-       unsigned int lay = v3d ? v3d->lay:scene->lay; /* fallback to the scene layer, allows duplicate and other oject operators to run outside the 3d view */
+       /* fallback to the scene layer, allows duplicate and other object operators to run outside the 3d view */
+       unsigned int lay = v3d ? v3d->lay:scene->lay;
 
        if(CTX_data_dir(member)) {
                CTX_data_dir_set(result, view3d_context_dir);
index 1fa50124a28fc07283d447155d218abffa88e0a6..4f46a746b9e4cc123841c0cef7bee1e37e03102e 100644 (file)
@@ -471,7 +471,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
                /* emphasise division lines lighter instead of darker, if background is darker than grid */
                UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);
                UI_GetColorPtrShade3ubv(col_grid, col_grid_emphasise,
-                                       (((col_grid[0]+col_grid[1]+col_grid[2])+30) > (col_bg[0]+col_bg[1]+col_bg[2])) ? 20 : -10);
+                                       (((col_grid[0]+col_grid[1]+col_grid[2])+30) >
+                                         (col_bg[0]+col_bg[1]+col_bg[2])) ? 20 : -10);
 
                /* set fixed axis */
                vert[0][0]= vert[2][1]= grid;
@@ -923,7 +924,8 @@ static void draw_selected_name(Scene *scene, Object *ob)
        BLF_draw_default(offset,  10, 0.0f, info, sizeof(info));
 }
 
-static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short no_shift, short no_zoom)
+static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d,
+                                 rctf *viewborder_r, short no_shift, short no_zoom)
 {
        CameraParams params;
        rctf rect_view, rect_camera;
@@ -962,7 +964,8 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R
        size_r[1]= viewborder.ymax - viewborder.ymin;
 }
 
-void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short no_shift)
+void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d,
+                                  rctf *viewborder_r, short no_shift)
 {
        view3d_camera_border(scene, ar, v3d, rv3d, viewborder_r, no_shift, FALSE);
 }
@@ -1395,7 +1398,12 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
 
        view3d_validate_backbuf(vc); 
        
-       glReadPixels(vc->ar->winrct.xmin+xminc, vc->ar->winrct.ymin+yminc, (xmaxc-xminc+1), (ymaxc-yminc+1), GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
+       glReadPixels(vc->ar->winrct.xmin + xminc,
+                    vc->ar->winrct.ymin + yminc,
+                    (xmaxc-xminc + 1),
+                    (ymaxc-yminc + 1),
+                    GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
+
        glReadBuffer(GL_BACK);  
 
        if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
@@ -1819,11 +1827,13 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
                         * offset feature (used in group-duplicate.blend but no longer works in 2.5)
                         * so for now it should be ok to - campbell */
 
-                       if(             (dob_next==NULL || dob_next->ob != dob->ob) || /* if this is the last no need  to make a displist */
-                                       (dob->ob->type == OB_LAMP) || /* lamp drawing messes with matrices, could be handled smarter... but this works */
-                                       (dob->type == OB_DUPLIGROUP && dob->animated) ||
-                                       !(bb_tmp= object_get_boundbox(dob->ob))
-                       ) {
+                       if ( /* if this is the last no need  to make a displist */
+                            (dob_next==NULL || dob_next->ob != dob->ob) ||
+                            /* lamp drawing messes with matrices, could be handled smarter... but this works */
+                            (dob->ob->type == OB_LAMP) ||
+                            (dob->type == OB_DUPLIGROUP && dob->animated) ||
+                            !(bb_tmp= object_get_boundbox(dob->ob)))
+                       {
                                // printf("draw_dupli_objects_color: skipping displist for %s\n", dob->ob->id.name+2);
                                use_displist= 0;
                        }
@@ -2151,7 +2161,8 @@ typedef struct View3DShadow {
        GPULamp *lamp;
 } View3DShadow;
 
-static void gpu_render_lamp_update(Scene *scene, View3D *v3d, Object *ob, Object *par, float obmat[][4], ListBase *shadows)
+static void gpu_render_lamp_update(Scene *scene, View3D *v3d, Object *ob, Object *par,
+                                   float obmat[][4], ListBase *shadows)
 {
        GPULamp *lamp;
        Lamp *la = (Lamp*)ob->data;
@@ -2245,7 +2256,9 @@ CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
 {
        CustomDataMask mask= 0;
 
-       if(ELEM(v3d->drawtype, OB_TEXTURE, OB_MATERIAL) || ((v3d->drawtype == OB_SOLID) && (v3d->flag2 & V3D_SOLID_TEX))) {
+       if ( ELEM(v3d->drawtype, OB_TEXTURE, OB_MATERIAL) ||
+            ((v3d->drawtype == OB_SOLID) && (v3d->flag2 & V3D_SOLID_TEX)))
+       {
                mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
 
                if(scene_use_new_shading_nodes(scene)) {
@@ -2353,7 +2366,8 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar,
        glLoadMatrixf(rv3d->viewmat);
 }
 
-void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy, float viewmat[][4], float winmat[][4])
+void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
+                              int winx, int winy, float viewmat[][4], float winmat[][4])
 {
        RegionView3D *rv3d= ar->regiondata;
        Base *base;
@@ -2478,13 +2492,15 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
 
        glPopMatrix();
 
-       glColor4ub(255, 255, 255, 255); // XXX, without this the sequencer flickers with opengl draw enabled, need to find out why - campbell
+       // XXX, without this the sequencer flickers with opengl draw enabled, need to find out why - campbell
+       glColor4ub(255, 255, 255, 255);
 
        G.f &= ~G_RENDER_OGL;
 }
 
 /* utility func for ED_view3d_draw_offscreen */
-ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag, char err_out[256])
+ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
+                                      int sizex, int sizey, unsigned int flag, char err_out[256])
 {
        RegionView3D *rv3d= ar->regiondata;
        ImBuf *ibuf;
@@ -2539,7 +2555,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
 }
 
 /* creates own 3d views, used by the sequencer */
-ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256])
+ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int width, int height,
+                                             unsigned int flag, int drawtype, char err_out[256])
 {
        View3D v3d= {NULL};
        ARegion ar= {NULL};
index b07e0ccdc7465093551daa77e49f3c42d4ae7429..e3ee6678af9423a60257fb0f3cc8ea97958190a3 100644 (file)
@@ -2091,8 +2091,8 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
        RNA_def_boolean(ot->srna, "center", 0, "Center", "");
 }
 
-
-static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a localview without local!, was centerview() in 2.4x */
+/* like a localview without local!, was centerview() in 2.4x */
+static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
 {
        ARegion *ar= CTX_wm_region(C);
        View3D *v3d = CTX_wm_view3d(C);
@@ -2451,9 +2451,15 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
                        return OPERATOR_CANCELLED;
                }
                /* convert border to 3d coordinates */
-               if ((   !gluUnProject(cent[0], cent[1], depth_close, mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2])) ||
-                       (       !gluUnProject((double)rect.xmin, (double)rect.ymin, depth_close, mats.modelview, mats.projection, (GLint *)mats.viewport, &p_corner[0], &p_corner[1], &p_corner[2])))
+               if ( (!gluUnProject(cent[0], cent[1], depth_close,
+                                   mats.modelview, mats.projection, (GLint *)mats.viewport,
+                                   &p[0], &p[1], &p[2])) ||
+                    (!gluUnProject((double)rect.xmin, (double)rect.ymin, depth_close,
+                                       mats.modelview, mats.projection, (GLint *)mats.viewport,
+                                       &p_corner[0], &p_corner[1], &p_corner[2])))
+               {
                        return OPERATOR_CANCELLED;
+               }
 
                dvec[0] = p[0]-p_corner[0];
                dvec[1] = p[1]-p_corner[1];
@@ -2474,7 +2480,10 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
                new_dist = rv3d->dist;
 
                /* convert the drawn rectangle into 3d space */
-               if (depth_close!=FLT_MAX && gluUnProject(cent[0], cent[1], depth_close, mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2])) {
+               if (depth_close != FLT_MAX && gluUnProject(cent[0], cent[1], depth_close,
+                                                          mats.modelview, mats.projection, (GLint *)mats.viewport,
+                                                          &p[0], &p[1], &p[2]))
+               {
                        new_ofs[0] = -p[0];
                        new_ofs[1] = -p[1];
                        new_ofs[2] = -p[2];
@@ -2608,7 +2617,9 @@ static EnumPropertyItem prop_view_items[] = {
 
 /* would like to make this a generic function - outside of transform */
 
-static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, float q1, float q2, float q3, float q4, short view, int perspo, int align_active)
+static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
+                          float q1, float q2, float q3, float q4,
+                          short view, int perspo, int align_active)
 {
        RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
        float new_quat[4];
@@ -2707,27 +2718,33 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 
        switch (viewnum) {
                case RV3D_VIEW_BOTTOM :
-                       axis_set_view(C, v3d, ar, 0.0, -1.0, 0.0, 0.0, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 0.0, -1.0, 0.0, 0.0,
+                                     viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_BACK:
-                       axis_set_view(C, v3d, ar, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0), viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0),
+                                     viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_LEFT:
-                       axis_set_view(C, v3d, ar, 0.5, -0.5, 0.5, 0.5, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 0.5, -0.5, 0.5, 0.5,
+                                     viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_TOP:
-                       axis_set_view(C, v3d, ar, 1.0, 0.0, 0.0, 0.0, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 1.0, 0.0, 0.0, 0.0,
+                                     viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_FRONT:
-                       axis_set_view(C, v3d, ar, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0,
+                                     viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_RIGHT:
-                       axis_set_view(C, v3d, ar, 0.5, -0.5, -0.5, -0.5, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 0.5, -0.5, -0.5, -0.5,
+                                     viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_CAMERA:
@@ -2789,7 +2806,9 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
                                else{
                                        /* return to settings of last view */
                                        /* does smooth_view too */
-                                       axis_set_view(C, v3d, ar, rv3d->lviewquat[0], rv3d->lviewquat[1], rv3d->lviewquat[2], rv3d->lviewquat[3], rv3d->lview, rv3d->lpersp, 0);
+                                       axis_set_view(C, v3d, ar,
+                                                     rv3d->lviewquat[0], rv3d->lviewquat[1], rv3d->lviewquat[2], rv3d->lviewquat[3],
+                                                     rv3d->lview, rv3d->lpersp, 0);
                                }
                        }
                        break;
@@ -3385,7 +3404,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
 }
 
 /* XXX todo Zooms in on a border drawn by the user */
-int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3] ) //, float *autodist )
+int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3])
 {
        bglMats mats; /* ZBuffer depth vars */
        float depth_close= FLT_MAX;
@@ -3403,8 +3422,11 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2]
        cent[0] = (double)mval[0];
        cent[1] = (double)mval[1];
 
-       if (!gluUnProject(cent[0], cent[1], depth_close, mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
+       if (!gluUnProject(cent[0], cent[1], depth_close,
+                         mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
+       {
                return 0;
+       }
 
        mouse_worldloc[0] = (float)p[0];
        mouse_worldloc[1] = (float)p[1];
@@ -3428,7 +3450,8 @@ int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //
 }
 
 // no 4x4 sampling, run view_autodist_init first
-int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth) //, float *autodist )
+int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3],
+                              int margin, float *force_depth) //, float *autodist )
 {
        bglMats mats; /* ZBuffer depth vars, could cache? */
        float depth;
@@ -3447,8 +3470,12 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl
        cent[1] = (double)mval[1];
 
        bgl_get_mats(&mats);
-       if (!gluUnProject(cent[0], cent[1], depth, mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
+
+       if (!gluUnProject(cent[0], cent[1], depth,
+           mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
+       {
                return 0;
+       }
 
        mouse_worldloc[0] = (float)p[0];
        mouse_worldloc[1] = (float)p[1];
@@ -3483,7 +3510,8 @@ static int depth_segment_cb(int x, int y, void *userData)
        }
 }
 
-int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth)
+int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2],
+                                 int margin, float *depth)
 {
        struct { struct ARegion *ar; int margin; float depth; } data = {NULL};
        int p1[2];
index 981d46774dcc179ecac69cad1cb88dc288fc7cf7..801f2d5c8eb46fd57c3107d7ee25e5cd6586dd03 100644 (file)
@@ -135,7 +135,8 @@ void fly_modal_keymap(wmKeyConfig *keyconf)
        WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE);
 
        WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_PAN_ENABLE);
-       WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PAN_DISABLE); /* XXX - Bug in the event system, middle mouse release doesnt work */
+       /* XXX - Bug in the event system, middle mouse release doesnt work */
+       WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PAN_DISABLE);
 
        /* WASD */
        WM_modalkeymap_add_item(keymap, WKEY, KM_PRESS, 0, 0, FLY_MODAL_DIR_FORWARD);
@@ -170,7 +171,8 @@ typedef struct FlyInfo {
        short state;
        short redraw;
        unsigned char use_precision;
-       unsigned char use_freelook; /* if the user presses shift they can look about without movinf the direction there looking */
+       unsigned char use_freelook; /* if the user presses shift they can look about
+                                    * without moving the direction there looking */
 
        int mval[2]; /* latest 2D mouse values */
        wmNDOFMotionData* ndof; /* latest 3D mouse values */
@@ -195,7 +197,8 @@ typedef struct FlyInfo {
        /* backup values */
        float dist_backup; /* backup the views distance since we use a zero dist for fly mode */
        float ofs_backup[3]; /* backup the views offset incase the user cancels flying in non camera mode */
-       float rot_backup[4]; /* backup the views quat incase the user cancels flying in non camera mode. (quat for view, eul for camera) */
+       float rot_backup[4]; /* backup the views quat incase the user cancels flying in non camera mode.
+                             * (quat for view, eul for camera) */
        short persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
 
        short is_ortho_cam; /* are we flying an ortho camera in perspective view,
@@ -580,7 +583,8 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
                                /* impliment WASD keys */
                        case FLY_MODAL_DIR_FORWARD:
                                if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather than stopping, game like motion */
-                               else if (fly->axis==2) fly->speed += fly->grid; /* increse like mousewheel if were already moving in that difection*/
+                               else if (fly->axis==2) fly->speed += fly->grid; /* increse like mousewheel if were already
+                                                                                * moving in that difection*/
                                fly->axis= 2;
                                break;
                        case FLY_MODAL_DIR_BACKWARD:
@@ -738,8 +742,10 @@ static int flyApply(bContext *C, FlyInfo *fly)
        xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
 
 #ifdef NDOF_FLY_DEBUG
-       static unsigned int iteration = 1;
-       printf("fly timer %d\n", iteration++);
+       {
+               static unsigned int iteration = 1;
+               printf("fly timer %d\n", iteration++);
+       }
 #endif
 
 
@@ -782,7 +788,11 @@ static int flyApply(bContext *C, FlyInfo *fly)
                }
 
                /* Should we redraw? */
-               if (fly->speed != 0.0f || moffset[0] || moffset[1] || fly->zlock || fly->xlock || dvec[0] || dvec[1] || dvec[2] ) {
+               if ( (fly->speed != 0.0f) ||
+                    moffset[0] || moffset[1] ||
+                    fly->zlock || fly->xlock ||
+                    dvec[0] || dvec[1] || dvec[2])
+               {
                        float dvec_tmp[3];
                        double time_current; /*time how fast it takes for us to redraw, this is so simple scenes dont fly too fast */
                        float time_redraw;
@@ -792,7 +802,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
 #endif
                        time_current= PIL_check_seconds_timer();
                        time_redraw= (float)(time_current - fly->time_lastdraw);
-                       time_redraw_clamped= MIN2(0.05f, time_redraw); /* clamt the redraw time to avoid jitter in roll correction */
+                       time_redraw_clamped= MIN2(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */
                        fly->time_lastdraw= time_current;
                        /*fprintf(stderr, "%f\n", time_redraw);*/ /* 0.002 is a small redraw 0.02 is larger */
 
@@ -818,7 +828,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
                                mul_v3_fl(dvec_tmp, time_redraw * 200.0f * fly->grid);
                        }
                        else {
-                               float roll; /* similar to the angle between the camera's up and the Z-up, but its very rough so just roll*/
+                               float roll; /* similar to the angle between the camera's up and the Z-up,
+                                            * but its very rough so just roll*/
 
                                /* rotate about the X axis- look up/down */
                                if (moffset[1]) {
@@ -826,7 +837,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
                                        upvec[1]=0;
                                        upvec[2]=0;
                                        mul_m3_v3(mat, upvec);
-                                       axis_angle_to_quat( tmp_quat, upvec, (float)moffset[1] * time_redraw * -FLY_ROTATE_FAC); /* Rotate about the relative up vec */
+                                       /* Rotate about the relative up vec */
+                                       axis_angle_to_quat( tmp_quat, upvec, (float)moffset[1] * time_redraw * -FLY_ROTATE_FAC);
                                        mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
 
                                        if (fly->xlock) fly->xlock = 2; /*check for rotation*/
@@ -859,7 +871,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
                                                mul_m3_v3(mat, upvec);
                                        }
 
-                                       axis_angle_to_quat(tmp_quat, upvec, (float)moffset[0] * time_redraw * FLY_ROTATE_FAC); /* Rotate about the relative up vec */
+                                       /* Rotate about the relative up vec */
+                                       axis_angle_to_quat(tmp_quat, upvec, (float)moffset[0] * time_redraw * FLY_ROTATE_FAC);
                                        mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
 
                                        if (fly->xlock) fly->xlock = 2;/*check for rotation*/
@@ -880,7 +893,9 @@ static int flyApply(bContext *C, FlyInfo *fly)
                                                upvec[2]= 1.0f;
 
                                                mul_m3_v3(mat, upvec);
-                                               axis_angle_to_quat( tmp_quat, upvec, roll*time_redraw_clamped*fly->zlock_momentum * FLY_ZUP_CORRECT_FAC); /* Rotate about the relative up vec */
+                                               /* Rotate about the relative up vec */
+                                               axis_angle_to_quat(tmp_quat, upvec,
+                                                                  roll * time_redraw_clamped * fly->zlock_momentum * FLY_ZUP_CORRECT_FAC);
                                                mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
 
                                                fly->zlock_momentum += FLY_ZUP_CORRECT_ACCEL;
@@ -906,7 +921,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
 
                                                mul_m3_v3(mat, upvec);
 
-                                               axis_angle_to_quat( tmp_quat, upvec, roll*time_redraw_clamped*fly->xlock_momentum*0.1f); /* Rotate about the relative up vec */
+                                               /* Rotate about the relative up vec */
+                                               axis_angle_to_quat( tmp_quat, upvec, roll*time_redraw_clamped*fly->xlock_momentum*0.1f);
                                                mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
 
                                                fly->xlock_momentum += 0.05f;
@@ -949,18 +965,6 @@ static int flyApply(bContext *C, FlyInfo *fly)
 
                        add_v3_v3(rv3d->ofs, dvec);
 
-                       /* todo, dynamic keys */
-#if 0
-                       if (fly->zlock && fly->xlock)
-                               ED_area_headerprint(fly->ar, "FlyKeys  Speed:(+/- | Wheel),  Upright Axis:X  on/Z on,   Slow:Shift,  Direction:WASDRF,  Ok:LMB,  Pan:MMB,  Cancel:RMB");
-                       else if (fly->zlock)
-                               ED_area_headerprint(fly->ar, "FlyKeys  Speed:(+/- | Wheel),  Upright Axis:X off/Z on,   Slow:Shift,  Direction:WASDRF,  Ok:LMB,  Pan:MMB,  Cancel:RMB");
-                       else if (fly->xlock)
-                               ED_area_headerprint(fly->ar, "FlyKeys  Speed:(+/- | Wheel),  Upright Axis:X  on/Z off,  Slow:Shift,  Direction:WASDRF,  Ok:LMB,  Pan:MMB,  Cancel:RMB");
-                       else
-                               ED_area_headerprint(fly->ar, "FlyKeys  Speed:(+/- | Wheel),  Upright Axis:X off/Z off,  Slow:Shift,  Direction:WASDRF,  Ok:LMB,  Pan:MMB,  Cancel:RMB");
-#endif
-
                        if (rv3d->persp==RV3D_CAMOB)
                                move_camera(C, rv3d, fly, (fly->xlock || fly->zlock || moffset[0] || moffset[1]), fly->speed);
 
index e7c9a1bd3a0443c189189acbe2d6c4fc9b593d44..f6c82b0ba9d12b27bdb7b3544a80fb5995ac006a 100644 (file)
@@ -164,7 +164,8 @@ void VIEW3D_OT_game_start(struct wmOperatorType *ot);
 
 int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb);
 
-void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
+void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *,
+                 float *ofs, float *quat, float *dist, float *lens);
 
 void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */
 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);
index ce93ca56a652e97d1070bff4cc5017d45bfc53b3..1b153d03e4593f82eaca7290b51f565fadfdbd89 100644 (file)
@@ -257,7 +257,9 @@ static int view3d_selectable_data(bContext *C)
                        if (ob->mode & OB_MODE_SCULPT) {
                                return 0;
                        }
-                       if (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT) && !paint_facesel_test(ob) && !paint_vertsel_test(ob)) {
+                       if ((ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) &&
+                           !paint_facesel_test(ob) && !paint_vertsel_test(ob))
+                       {
                                return 0;
                        }
                }
index 11492ee78042d3e1e083bd26d84c647bb6e98d13..f57d8a5ec1b25224192cf3ad059ff57a096fac81 100644 (file)
@@ -120,7 +120,8 @@ struct SmoothViewStore {
 
 /* will start timer if appropriate */
 /* the arguments are the desired situation */
-void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Object *camera, float *ofs, float *quat, float *dist, float *lens)
+void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Object *camera,
+                 float *ofs, float *quat, float *dist, float *lens)
 {
        wmWindowManager *wm= CTX_wm_manager(C);
        wmWindow *win= CTX_wm_window(C);
@@ -998,7 +999,8 @@ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, fl
 }
 
 /* also exposed in previewrender.c */
-int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy, rctf *viewplane, float *clipsta, float *clipend)
+int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy,
+                            rctf *viewplane, float *clipsta, float *clipend)
 {
        CameraParams params;
 
@@ -1023,7 +1025,12 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)            /* rect: for pick
        orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend);
        rv3d->is_persp= !orth;
 
-       //      printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend);
+#if 0
+       printf("%s: %d %d %f %f %f %f %f %f\n", __func__, winx, winy,
+              viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax,
+              clipsta, clipend);
+#endif
+
        x1= viewplane.xmin;
        y1= viewplane.ymin;
        x2= viewplane.xmax;