From 0361909ab4e0f41c631ef4654345b0034bb89d51 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 8 Jul 2012 20:36:00 +0000 Subject: style cleanup --- source/blender/editors/space_view3d/drawanimviz.c | 6 +- source/blender/editors/space_view3d/drawarmature.c | 50 ++++++----- source/blender/editors/space_view3d/drawmesh.c | 18 ++-- source/blender/editors/space_view3d/drawobject.c | 60 ++++++------- source/blender/editors/space_view3d/drawvolume.c | 69 +++++++------- source/blender/editors/space_view3d/space_view3d.c | 10 +-- source/blender/editors/space_view3d/view3d_draw.c | 100 ++++++++++----------- source/blender/editors/space_view3d/view3d_edit.c | 18 ++-- source/blender/editors/space_view3d/view3d_fly.c | 2 +- .../blender/editors/space_view3d/view3d_header.c | 4 +- .../blender/editors/space_view3d/view3d_select.c | 14 +-- source/blender/editors/space_view3d/view3d_snap.c | 14 +-- source/blender/editors/space_view3d/view3d_view.c | 36 ++++---- 13 files changed, 201 insertions(+), 200 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 4fc3edb521e..afbaabf1b06 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -135,10 +135,10 @@ void draw_motion_path_instance(Scene *scene, /* draw curve-line of path */ glShadeModel(GL_SMOOTH); - glBegin(GL_LINE_STRIP); + glBegin(GL_LINE_STRIP); for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { short sel = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->flag & SELECT); - float intensity; /* how faint */ + float intensity; /* how faint */ /* set color * - more intense for active/selected bones, less intense for unselected bones @@ -223,7 +223,7 @@ void draw_motion_path_instance(Scene *scene, UI_ThemeColor(TH_TEXT_HI); } - // XXX, this isn't up to date but probably should be kept so. + /* XXX, this isn't up to date but probably should be kept so. */ invert_m4_m4(ob->imat, ob->obmat); /* Draw frame numbers at each framestep value */ diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index cdaf7d5690f..48b3672c144 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -686,13 +686,13 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel tailvec = headvec; tail = head; zero_v3(dirvec); - dirvec[0] = 0.00001; // XXX. weak but ok + dirvec[0] = 0.00001; /* XXX. weak but ok */ } else if (tail - view_dist > head) { headvec = tailvec; head = tail; zero_v3(dirvec); - dirvec[0] = 0.00001; // XXX. weak but ok + dirvec[0] = 0.00001; /* XXX. weak but ok */ } } @@ -1019,7 +1019,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned /* Draw root point if we are not connected */ if ((boneflag & BONE_CONNECTED) == 0) { - if (G.f & G_PICKSEL) { // no bitmap in selection mode, crashes 3d cards... + if (G.f & G_PICKSEL) { /* no bitmap in selection mode, crashes 3d cards... */ glLoadName(id | BONESEL_ROOT); glBegin(GL_POINTS); glVertex3f(0.0f, 0.0f, 0.0f); @@ -1151,7 +1151,7 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl glScalef(length, length, length); draw_bone_points(dt, armflag, boneflag, id); glPopMatrix(); - length *= 0.95f; // make vertices visible + length *= 0.95f; /* make vertices visible */ } /* colors for modes */ @@ -1225,7 +1225,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len glBegin(GL_LINES); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, dlen, 0.0f); - glEnd(); // GL_LINES + glEnd(); /* GL_LINES */ glPopMatrix(); } @@ -1266,7 +1266,7 @@ static void draw_wire_bone(const short dt, int armflag, int boneflag, short cons glScalef(length, length, length); draw_bone_points(dt, armflag, boneflag, id); glPopMatrix(); - length *= 0.95f; // make vertices visible + length *= 0.95f; /* make vertices visible */ } /* this chunk not in object mode */ @@ -1416,7 +1416,9 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) /* Find the chain's root */ while (parchan->parent) { segcount++; - if (segcount == data->rootbone || segcount > 255) break; // 255 is weak + if (segcount == data->rootbone || segcount > 255) { + break; /* 255 is weak */ + } parchan = parchan->parent; } if (parchan) @@ -1440,13 +1442,13 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) /* Find the chain's root */ while (parchan->parent) { segcount++; - // FIXME: revise the breaking conditions - if (segcount == data->chainlen || segcount > 255) break; // 255 is weak + /* FIXME: revise the breaking conditions */ + if (segcount == data->chainlen || segcount > 255) break; /* 255 is weak */ parchan = parchan->parent; } - if (parchan) // XXX revise the breaking conditions to only stop at the tail? + if (parchan) /* XXX revise the breaking conditions to only stop at the tail? */ glVertex3fv(parchan->pose_head); - + glEnd(); setlinestyle(0); } @@ -1594,7 +1596,7 @@ static void draw_pose_dofs(Object *ob) theta = RAD2DEGF(0.5f * (pchan->limitmin[2] + pchan->limitmax[2])); glRotatef(theta, 0.0f, 0.0f, 1.0f); - glColor3ub(50, 50, 255); // blue, Z axis limit + glColor3ub(50, 50, 255); /* blue, Z axis limit */ glBegin(GL_LINE_STRIP); for (a = -16; a <= 16; a++) { /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */ @@ -1611,14 +1613,14 @@ static void draw_pose_dofs(Object *ob) glEnd(); glRotatef(-theta, 0.0f, 0.0f, 1.0f); - } + } if (pchan->ikflag & BONE_IK_XLIMIT) { /* OpenGL requires rotations in degrees; so we're taking the average angle here */ theta = RAD2DEGF(0.5f * (pchan->limitmin[0] + pchan->limitmax[0])); glRotatef(theta, 1.0f, 0.0f, 0.0f); - glColor3ub(255, 50, 50); // Red, X axis limit + glColor3ub(255, 50, 50); /* Red, X axis limit */ glBegin(GL_LINE_STRIP); for (a = -16; a <= 16; a++) { /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */ @@ -1792,7 +1794,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } if (index != -1) - index += 0x10000; // pose bones count in higher 2 bytes only + index += 0x10000; /* pose bones count in higher 2 bytes only */ } /* very very confusing... but in object mode, solid draw, we cannot do glLoadName yet, @@ -1861,7 +1863,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } if (index != -1) - index += 0x10000; // pose bones count in higher 2 bytes only + index += 0x10000; /* pose bones count in higher 2 bytes only */ } /* stick or wire bones have not been drawn yet so don't clear object selection in this case */ if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && draw_wire) { @@ -1900,11 +1902,11 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, const short constflag = pchan->constflag; if ((do_dashed & 1) && (pchan->parent)) { /* Draw a line from our root to the parent's tip - * - only if V3D_HIDE_HELPLINES is enabled... + * - only if V3D_HIDE_HELPLINES is enabled... */ if ( (do_dashed & 2) && ((bone->flag & BONE_CONNECTED) == 0) ) { if (arm->flag & ARM_POSEMODE) { - glLoadName(index & 0xFFFF); // object tag, for bordersel optim + glLoadName(index & 0xFFFF); /* object tag, for bordersel optim */ UI_ThemeColor(TH_WIRE); } setlinestyle(3); @@ -1922,15 +1924,15 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (constflag & PCHAN_HAS_IK) { if (bone->flag & BONE_SELECTED) { if (constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0); - else glColor3ub(200, 200, 50); // add theme! - + else glColor3ub(200, 200, 50); /* add theme! */ + glLoadName(index & 0xFFFF); pchan_draw_IK_root_lines(pchan, !(do_dashed & 2)); } } else if (constflag & PCHAN_HAS_SPLINEIK) { if (bone->flag & BONE_SELECTED) { - glColor3ub(150, 200, 50); // add theme! + glColor3ub(150, 200, 50); /* add theme! */ glLoadName(index & 0xFFFF); pchan_draw_IK_root_lines(pchan, !(do_dashed & 2)); @@ -2205,7 +2207,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) /* offset to parent */ if (eBone->parent) { UI_ThemeColor(TH_WIRE); - glLoadName(-1); // -1 here is OK! + glLoadName(-1); /* -1 here is OK! */ setlinestyle(3); glBegin(GL_LINES); @@ -2227,7 +2229,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) /* finally names and axes */ if (arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) { - // patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing + /* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */ if ((G.f & G_PICKSEL) == 0) { float vec[3]; unsigned char col[4]; @@ -2574,7 +2576,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); - glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); // only for lighting... + glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); /* only for lighting... */ } /* arm->flag is being used to detect mode... */ diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 19696b2b0e0..38109c3048e 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -71,7 +71,7 @@ #include "ED_mesh.h" #include "ED_uvedit.h" -#include "view3d_intern.h" // own include +#include "view3d_intern.h" /* own include */ /* user data structures for derived mesh callbacks */ typedef struct drawMeshFaceSelect_userData { @@ -214,7 +214,7 @@ void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) dm->drawMappedEdges(dm, draw_mesh_face_select__setSelectOpts, &data); setlinestyle(0); - bglPolygonOffset(rv3d->dist, 0.0); // resets correctly now, even after calling accumulated offsets + bglPolygonOffset(rv3d->dist, 0.0); /* resets correctly now, even after calling accumulated offsets */ BLI_edgehash_free(data.eh, NULL); } @@ -223,7 +223,7 @@ void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) static Material *give_current_material_or_def(Object *ob, int matnr) { - extern Material defmaterial; // render module abuse... + extern Material defmaterial; /* render module abuse... */ Material *ma = give_current_material(ob, matnr); return ma ? ma : &defmaterial; @@ -248,7 +248,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m static int c_lit; static int c_has_texface; - Object *litob = NULL; //to get mode to turn off mipmap in painting mode + Object *litob = NULL; /* to get mode to turn off mipmap in painting mode */ int backculled = GEMAT_BACKCULL; int alphablend = 0; int textured = 0; @@ -317,7 +317,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m if (lit != c_lit || ma != c_ma) { if (lit) { float spec[4]; - if (!ma) ma = give_current_material_or_def(NULL, 0); //default material + if (!ma) ma = give_current_material_or_def(NULL, 0); /* default material */ spec[0] = ma->spec * ma->specr; spec[1] = ma->spec * ma->specg; @@ -345,7 +345,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O unsigned char obcol[4]; int is_tex, solidtex; - // XXX scene->obedit warning + /* XXX scene->obedit warning */ /* texture draw is abused for mask selection mode, do this so wire draw * with face selection in weight paint is not lit. */ @@ -705,8 +705,8 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl) - // The BM_FONT handling is in the gpu module, shared with the - // game engine, was duplicated previously + /* The BM_FONT handling is in the gpu module, shared with the + * game engine, was duplicated previously */ set_property_valstr(prop, string); characters = strlen(string); @@ -1062,7 +1062,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *d * rather than the shading, this is also forced in wire view */ bglPolygonOffset(rv3d->dist, 1.0); - glDepthMask(0); // disable write in zbuffer, selected edge wires show better + glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */ glEnable(GL_BLEND); glColor4ub(255, 255, 255, 96); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7f7970382bc..b651dfcb8db 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -35,7 +35,7 @@ #include "DNA_camera_types.h" #include "DNA_curve_types.h" -#include "DNA_constraint_types.h" // for drawing constraint +#include "DNA_constraint_types.h" /* for drawing constraint */ #include "DNA_lamp_types.h" #include "DNA_lattice_types.h" #include "DNA_material_types.h" @@ -56,10 +56,10 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" -#include "BKE_anim.h" //for the where_on_path function +#include "BKE_anim.h" /* for the where_on_path function */ #include "BKE_armature.h" #include "BKE_camera.h" -#include "BKE_constraint.h" // for the get_constraint_target function +#include "BKE_constraint.h" /* for the get_constraint_target function */ #include "BKE_curve.h" #include "BKE_DerivedMesh.h" #include "BKE_deform.h" @@ -108,7 +108,7 @@ #include "wm_subwindow.h" #include "BLF_api.h" -#include "view3d_intern.h" // own include +#include "view3d_intern.h" /* own include */ typedef enum eWireDrawMode { OBDRAW_WIRE_OFF = 0, @@ -2781,7 +2781,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, ToolSettings *ts = scene->toolsettings; int sel; - if (v3d->zbuf) glDepthMask(0); // disable write in zbuffer, zbuf select + if (v3d->zbuf) glDepthMask(0); /* disable write in zbuffer, zbuf select */ for (sel = 0; sel < 2; sel++) { unsigned char col[4], fcol[4]; @@ -3202,8 +3202,8 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); } - // Setup for drawing wire over, disable zbuffer - // write to show selected edge wires better + /* Setup for drawing wire over, disable zbuffer + * write to show selected edge wires better */ UI_ThemeColor(TH_WIRE); bglPolygonOffset(rv3d->dist, 1.0); @@ -3222,18 +3222,18 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, UI_GetThemeColor4ubv(TH_FACE, col1); UI_GetThemeColor4ubv(TH_FACE_SELECT, col2); UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3); - + glEnable(GL_BLEND); - glDepthMask(0); // disable write in zbuffer, needed for nice transp - + glDepthMask(0); /* disable write in zbuffer, needed for nice transp */ + /* don't draw unselected faces, only selected, this is MUCH nicer when texturing */ if (check_object_draw_texture(scene, v3d, dt)) col1[3] = 0; - + draw_dm_faces_sel(em, cageDM, col1, col2, col3, efa_act); glDisable(GL_BLEND); - glDepthMask(1); // restore write in zbuffer + glDepthMask(1); /* restore write in zbuffer */ } else if (efa_act) { /* even if draw faces is off it would be nice to draw the stipple face @@ -3242,15 +3242,15 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, unsigned char col1[4], col2[4], col3[4]; col1[3] = col2[3] = 0; /* don't draw */ UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3); - + glEnable(GL_BLEND); - glDepthMask(0); // disable write in zbuffer, needed for nice transp - + glDepthMask(0); /* disable write in zbuffer, needed for nice transp */ + draw_dm_faces_sel(em, cageDM, col1, col2, col3, efa_act); glDisable(GL_BLEND); - glDepthMask(1); // restore write in zbuffer - + glDepthMask(1); /* restore write in zbuffer */ + } /* here starts all fancy draw-extra over */ @@ -3583,7 +3583,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D */ if (dt != OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) { bglPolygonOffset(rv3d->dist, 1.0); - glDepthMask(0); // disable write in zbuffer, selected edge wires show better + glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */ } if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_SOLID) == 0) @@ -3818,7 +3818,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW); else glFrontFace(GL_CCW); - if (ob->type == OB_MBALL) { // mball always smooth shaded + if (ob->type == OB_MBALL) { /* mball always smooth shaded */ glShadeModel(GL_SMOOTH); } @@ -5639,8 +5639,8 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, while (nr-- > 0) { /* accounts for empty bevel lists */ const float fac = bevp->radius * ts->normalsize; - float vec_a[3]; // Offset perpendicular to the curve - float vec_b[3]; // Delta along the curve + float vec_a[3]; /* Offset perpendicular to the curve */ + float vec_b[3]; /* Delta along the curve */ vec_a[0] = fac; vec_a[1] = 0.0f; @@ -5736,7 +5736,7 @@ static void draw_empty_cone(float size) } /* draw points on curve speed handles */ -#if 0 // XXX old animation system stuff +#if 0 /* XXX old animation system stuff */ static void curve_draw_speed(Scene *scene, Object *ob) { Curve *cu = ob->data; @@ -5765,7 +5765,7 @@ static void curve_draw_speed(Scene *scene, Object *ob) glPointSize(1.0); bglEnd(); } -#endif // XXX old animation system stuff +#endif /* XXX old animation system stuff */ static void draw_textcurs(float textcurs[4][2]) @@ -6009,7 +6009,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d) /* calculus here, is reused in PFIELD_FORCE */ invert_m4_m4(imat, rv3d->viewmatob); -// normalize_v3(imat[0]); // we don't do this because field doesnt scale either... apart from wind! +// normalize_v3(imat[0]); /* we don't do this because field doesnt scale either... apart from wind! */ // normalize_v3(imat[1]); if (pd->forcefield == PFIELD_WIND) { @@ -6383,8 +6383,8 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob) } bglPolygonOffset(rv3d->dist, 1.0); - glDepthMask(0); // disable write in zbuffer, selected edge wires show better - + glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */ + if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { Curve *cu = ob->data; if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { @@ -6990,7 +6990,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short #endif } - // only draw domains + /* only draw domains */ if (smd->domain && smd->domain->fluid) { if (CFRA < smd->domain->point_cache[0]->startframe) { /* don't show smoke before simulation starts, this could be made an option in the future */ @@ -7408,7 +7408,7 @@ static DMDrawOption bbs_mesh_solid_hide__setDrawOpts(void *userData, int index) } } -// must have called WM_set_framebuffer_index_color beforehand +/* must have called WM_set_framebuffer_index_color beforehand */ static DMDrawOption bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index) { Mesh *me = userData; @@ -7462,11 +7462,11 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec bglPolygonOffset(rv3d->dist, 1.0); - // we draw edges always, for loop (select) tools + /* we draw edges always, for loop (select) tools */ bbs_mesh_wire(em, dm, bm_solidoffs); bm_wireoffs = bm_solidoffs + em->bm->totedge; - // we draw verts if vert select mode or if in transform (for snap). + /* we draw verts if vert select mode or if in transform (for snap). */ if ((ts->selectmode & SCE_SELECT_VERTEX) || (G.moving & G_TRANSFORM_EDIT)) { bbs_mesh_verts(em, dm, bm_wireoffs); bm_vertoffs = bm_wireoffs + em->bm->totvert; diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 60b3b911b1b..2c2d4039225 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -45,7 +45,7 @@ #include "BLI_rand.h" #include "BKE_curve.h" -#include "BKE_constraint.h" // for the get_constraint_target function +#include "BKE_constraint.h" /* for the get_constraint_target function */ #include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_effect.h" @@ -148,7 +148,7 @@ static int intersect_edges(float *points, float a, float b, float c, float d, fl static int convex(const float p0[3], const float up[3], const float a[3], const float b[3]) { - // Vec3 va = a-p0, vb = b-p0; + /* Vec3 va = a-p0, vb = b-p0; */ float va[3], vb[3], tmp[3]; sub_v3_v3v3(va, a, p0); sub_v3_v3v3(vb, b, p0); @@ -175,7 +175,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r {1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}, {1.0f, -1.0f, -1.0f} }; - // edges have the form edges[n][0][xyz] + t*edges[n][1][xyz] + /* edges have the form edges[n][0][xyz] + t*edges[n][1][xyz] */ float edges[12][2][3] = { {{1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}}, {{-1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}}, @@ -226,54 +226,54 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r sub_v3_v3v3(size, max, min); - // maxx, maxy, maxz + /* maxx, maxy, maxz */ cv[0][0] = max[0]; cv[0][1] = max[1]; cv[0][2] = max[2]; - // minx, maxy, maxz + /* minx, maxy, maxz */ cv[1][0] = min[0]; cv[1][1] = max[1]; cv[1][2] = max[2]; - // minx, miny, maxz + /* minx, miny, maxz */ cv[2][0] = min[0]; cv[2][1] = min[1]; cv[2][2] = max[2]; - // maxx, miny, maxz + /* maxx, miny, maxz */ cv[3][0] = max[0]; cv[3][1] = min[1]; cv[3][2] = max[2]; - // maxx, maxy, minz + /* maxx, maxy, minz */ cv[4][0] = max[0]; cv[4][1] = max[1]; cv[4][2] = min[2]; - // minx, maxy, minz + /* minx, maxy, minz */ cv[5][0] = min[0]; cv[5][1] = max[1]; cv[5][2] = min[2]; - // minx, miny, minz + /* minx, miny, minz */ cv[6][0] = min[0]; cv[6][1] = min[1]; cv[6][2] = min[2]; - // maxx, miny, minz + /* maxx, miny, minz */ cv[7][0] = max[0]; cv[7][1] = min[1]; cv[7][2] = min[2]; - copy_v3_v3(edges[0][0], cv[4]); // maxx, maxy, minz - copy_v3_v3(edges[1][0], cv[5]); // minx, maxy, minz - copy_v3_v3(edges[2][0], cv[6]); // minx, miny, minz - copy_v3_v3(edges[3][0], cv[7]); // maxx, miny, minz + copy_v3_v3(edges[0][0], cv[4]); /* maxx, maxy, minz */ + copy_v3_v3(edges[1][0], cv[5]); /* minx, maxy, minz */ + copy_v3_v3(edges[2][0], cv[6]); /* minx, miny, minz */ + copy_v3_v3(edges[3][0], cv[7]); /* maxx, miny, minz */ - copy_v3_v3(edges[4][0], cv[3]); // maxx, miny, maxz - copy_v3_v3(edges[5][0], cv[2]); // minx, miny, maxz - copy_v3_v3(edges[6][0], cv[6]); // minx, miny, minz - copy_v3_v3(edges[7][0], cv[7]); // maxx, miny, minz + copy_v3_v3(edges[4][0], cv[3]); /* maxx, miny, maxz */ + copy_v3_v3(edges[5][0], cv[2]); /* minx, miny, maxz */ + copy_v3_v3(edges[6][0], cv[6]); /* minx, miny, minz */ + copy_v3_v3(edges[7][0], cv[7]); /* maxx, miny, minz */ - copy_v3_v3(edges[8][0], cv[1]); // minx, maxy, maxz - copy_v3_v3(edges[9][0], cv[2]); // minx, miny, maxz - copy_v3_v3(edges[10][0], cv[6]); // minx, miny, minz - copy_v3_v3(edges[11][0], cv[5]); // minx, maxy, minz + copy_v3_v3(edges[8][0], cv[1]); /* minx, maxy, maxz */ + copy_v3_v3(edges[9][0], cv[2]); /* minx, miny, maxz */ + copy_v3_v3(edges[10][0], cv[6]); /* minx, miny, minz */ + copy_v3_v3(edges[11][0], cv[5]); /* minx, maxy, minz */ // printf("size x: %f, y: %f, z: %f\n", size[0], size[1], size[2]); // printf("min[2]: %f, max[2]: %f\n", min[2], max[2]); @@ -311,11 +311,11 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r printf("%f, %f, %f\n", rv3d->viewinv[2][0], rv3d->viewinv[2][1], rv3d->viewinv[2][2]); #endif - // get view vector + /* get view vector */ copy_v3_v3(viewnormal, rv3d->viewinv[2]); normalize_v3(viewnormal); - // find cube vertex that is closest to the viewer + /* find cube vertex that is closest to the viewer */ for (i = 0; i < 8; i++) { float x, y, z; @@ -346,9 +346,9 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog); glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(text), text); - // cell spacing + /* cell spacing */ glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, dx, dx, dx, 1.0); - // custom parameter for smoke style (higher = thicker) + /* custom parameter for smoke style (higher = thicker) */ glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 7.0, 7.0, 7.0, 1.0); } else @@ -366,10 +366,10 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r cor[2] = (float)res[2] / (float)power_of_2_max_i(res[2]); } - // our slices are defined by the plane equation a*x + b*y +c*z + d = 0 - // (a,b,c), the plane normal, are given by viewdir - // d is the parameter along the view direction. the first d is given by - // inserting previously found vertex into the plane equation + /* our slices are defined by the plane equation a*x + b*y +c*z + d = 0 + * (a,b,c), the plane normal, are given by viewdir + * d is the parameter along the view direction. the first d is given by + * inserting previously found vertex into the plane equation */ /* d0 = (viewnormal[0]*cv[i][0] + viewnormal[1]*cv[i][1] + viewnormal[2]*cv[i][2]); */ /* UNUSED */ ds = (ABS(viewnormal[0]) * size[0] + ABS(viewnormal[1]) * size[1] + ABS(viewnormal[2]) * size[2]); @@ -395,8 +395,8 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r // printf("my d: %f\n", d); - // intersect_edges returns the intersection points of all cube edges with - // the given plane that lie within the cube + /* intersect_edges returns the intersection points of all cube edges with + * the given plane that lie within the cube */ numpoints = intersect_edges(points, viewnormal[0], viewnormal[1], viewnormal[2], -d, edges); // printf("points: %d\n", numpoints); @@ -404,7 +404,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r if (numpoints > 2) { copy_v3_v3(p0, points); - // sort points to get a convex polygon + /* sort points to get a convex polygon */ for (i = 1; i < numpoints - 1; i++) { for (j = i + 1; j < numpoints; j++) { if (!convex(p0, viewnormal, &points[j * 3], &points[i * 3])) { @@ -454,4 +454,3 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r glDepthMask(GL_TRUE); } } - diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index a6948222d93..88d08d937be 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -62,7 +62,7 @@ #include "UI_resources.h" -#include "view3d_intern.h" // own include +#include "view3d_intern.h" /* own include */ /* ******************** manage regions ********************* */ @@ -1016,7 +1016,7 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn) break; } - // removed since BKE_image_user_frame_calc is now called in view3d_draw_bgpic because screen_ops doesnt call the notifier. + /* removed since BKE_image_user_frame_calc is now called in view3d_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; @@ -1172,7 +1172,7 @@ void ED_spacetype_view3d(void) /* regions: listview/buttons */ art = MEM_callocN(sizeof(ARegionType), "spacetype view3d buttons region"); art->regionid = RGN_TYPE_UI; - art->prefsizex = 180; // XXX + art->prefsizex = 180; /* XXX */ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; art->listener = view3d_buttons_area_listener; art->init = view3d_buttons_area_init; @@ -1184,8 +1184,8 @@ void ED_spacetype_view3d(void) /* regions: tool(bar) */ art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tools region"); art->regionid = RGN_TYPE_TOOLS; - art->prefsizex = 160; // XXX - art->prefsizey = 50; // XXX + art->prefsizex = 160; /* XXX */ + art->prefsizey = 50; /* XXX */ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; art->listener = view3d_buttons_area_listener; art->init = view3d_tools_area_init; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 3079719efe0..1ace4688991 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -28,7 +28,6 @@ * \ingroup spview3d */ - #include #include #include @@ -65,7 +64,7 @@ #include "BKE_movieclip.h" #include "RE_engine.h" -#include "RE_pipeline.h" // make_stars +#include "RE_pipeline.h" /* make_stars */ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -92,8 +91,7 @@ #include "GPU_material.h" #include "GPU_extensions.h" -#include "view3d_intern.h" // own include - +#include "view3d_intern.h" /* own include */ static void star_stuff_init_func(void) @@ -299,7 +297,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** dx = fabs(x - (wx) * fx / fw); if (dx == 0) dx = fabs(y - (wy) * fy / fw); - glDepthMask(0); // disable write in zbuffer + glDepthMask(0); /* disable write in zbuffer */ /* check zoom out */ UI_ThemeColor(TH_GRID); @@ -361,7 +359,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** drawgrid_draw(ar, wx, wy, x, y, dx); } } - else { // start blending out + else { /* start blending out */ UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); drawgrid_draw(ar, wx, wy, x, y, dx); @@ -369,7 +367,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** drawgrid_draw(ar, wx, wy, x, y, sublines * dx); } } - else { // start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX*10)) + else { /* start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX*10)) */ UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX_D * 6.0)); drawgrid_draw(ar, wx, wy, x, y, dx); @@ -378,10 +376,10 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** } } else { - if (dx > (GRID_MIN_PX_D * 10.0)) { // start blending in + if (dx > (GRID_MIN_PX_D * 10.0)) { /* start blending in */ rv3d->gridview /= sublines; dx /= sublines; - if (dx > (GRID_MIN_PX_D * 10.0)) { // start blending in + if (dx > (GRID_MIN_PX_D * 10.0)) { /* start blending in */ rv3d->gridview /= sublines; dx /= sublines; if (dx > (GRID_MIN_PX_D * 10.0)) { @@ -435,7 +433,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** fdrawline(x, 0.0, x, (float)ar->winy); - glDepthMask(1); // enable write in zbuffer + glDepthMask(1); /* enable write in zbuffer */ } #undef GRID_MIN_PX @@ -473,7 +471,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) grid_scale = ED_view3d_grid_scale(scene, v3d, grid_unit); grid = gridlines * grid_scale; - if (v3d->zbuf && scene->obedit) glDepthMask(0); // for zbuffer-select + if (v3d->zbuf && scene->obedit) + glDepthMask(0); /* for zbuffer-select */ UI_GetThemeColor3ubv(TH_GRID, col_grid); @@ -665,10 +664,10 @@ static void draw_view_axis(RegionView3D *rv3d) /* draw center and axis of rotation for ongoing 3D mouse navigation */ static void draw_rotation_guide(RegionView3D *rv3d) { - float o[3]; // center of rotation - float end[3]; // endpoints for drawing + float o[3]; /* center of rotation */ + float end[3]; /* endpoints for drawing */ - float color[4] = {0.0f, 0.4235f, 1.0f, 1.0f}; // bright blue so it matches device LEDs + float color[4] = {0.0f, 0.4235f, 1.0f, 1.0f}; /* bright blue so it matches device LEDs */ negate_v3_v3(o, rv3d->ofs); @@ -677,25 +676,25 @@ static void draw_rotation_guide(RegionView3D *rv3d) glShadeModel(GL_SMOOTH); glPointSize(5); glEnable(GL_POINT_SMOOTH); - glDepthMask(0); // don't overwrite zbuf + glDepthMask(0); /* don't overwrite zbuf */ if (rv3d->rot_angle != 0.f) { - // -- draw rotation axis -- + /* -- draw rotation axis -- */ float scaled_axis[3]; const float scale = rv3d->dist; mul_v3_v3fl(scaled_axis, rv3d->rot_axis, scale); glBegin(GL_LINE_STRIP); - color[3] = 0.f; // more transparent toward the ends + color[3] = 0.f; /* more transparent toward the ends */ glColor4fv(color); add_v3_v3v3(end, o, scaled_axis); glVertex3fv(end); - // color[3] = 0.2f + fabsf(rv3d->rot_angle); // modulate opacity with angle + // color[3] = 0.2f + fabsf(rv3d->rot_angle); /* modulate opacity with angle */ // ^^ neat idea, but angle is frame-rate dependent, so it's usually close to 0.2 - color[3] = 0.5f; // more opaque toward the center + color[3] = 0.5f; /* more opaque toward the center */ glColor4fv(color); glVertex3fv(o); @@ -705,7 +704,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) glVertex3fv(end); glEnd(); - // -- draw ring around rotation center -- + /* -- draw ring around rotation center -- */ { #define ROT_AXIS_DETAIL 13 @@ -714,7 +713,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) float angle; int i; - float q[4]; // rotate ring so it's perpendicular to axis + float q[4]; /* rotate ring so it's perpendicular to axis */ const int upright = fabsf(rv3d->rot_axis[2]) >= 0.95f; if (!upright) { const float up[3] = {0.f, 0.f, 1.f}; @@ -725,7 +724,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) axis_angle_to_quat(q, vis_axis, vis_angle); } - color[3] = 0.25f; // somewhat faint + color[3] = 0.25f; /* somewhat faint */ glColor4fv(color); glBegin(GL_LINE_LOOP); for (i = 0, angle = 0.f; i < ROT_AXIS_DETAIL; ++i, angle += step) { @@ -743,21 +742,23 @@ static void draw_rotation_guide(RegionView3D *rv3d) #undef ROT_AXIS_DETAIL } - color[3] = 1.f; // solid dot + color[3] = 1.0f; /* solid dot */ } else - color[3] = 0.5f; // see-through dot + color[3] = 0.5f; /* see-through dot */ - // -- draw rotation center -- + /* -- draw rotation center -- */ glColor4fv(color); glBegin(GL_POINTS); glVertex3fv(o); glEnd(); - // find screen coordinates for rotation center, then draw pretty icon - // mul_m4_v3(rv3d->persinv, rot_center); - // UI_icon_draw(rot_center[0], rot_center[1], ICON_NDOF_TURN); - // ^^ just playing around, does not work + /* find screen coordinates for rotation center, then draw pretty icon */ +#if 0 + mul_m4_v3(rv3d->persinv, rot_center); + UI_icon_draw(rot_center[0], rot_center[1], ICON_NDOF_TURN); +#endif + /* ^^ just playing around, does not work */ glDisable(GL_BLEND); glDisable(GL_POINT_SMOOTH); @@ -1319,12 +1320,14 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) if (!(v3d->flag & V3D_INVALID_BACKBUF) ) return; -// if (test) { -// if (qtest()) { -// addafterqueue(ar->win, BACKBUFDRAW, 1); -// return; -// } -// } +#if 0 + if (test) { + if (qtest()) { + addafterqueue(ar->win, BACKBUFDRAW, 1); + return; + } + } +#endif if (v3d->drawtype > OB_WIRE) v3d->zbuf = TRUE; @@ -1370,7 +1373,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) ED_view3d_clipping_disable(); /* it is important to end a view in a transform compatible with buttons */ -// persp(PERSP_WIN); // set ortho +// persp(PERSP_WIN); /* set ortho */ } @@ -1493,20 +1496,20 @@ unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int for (a = 0; a < 2; a++) { for (b = 0; b < nr; b++, distance++) { - if (*tbuf && *tbuf >= min && *tbuf < max) { //we got a hit + if (*tbuf && *tbuf >= min && *tbuf < max) { /* we got a hit */ if (strict) { indexok = indextest(handle, *tbuf - min + 1); if (indexok) { *dist = (short) sqrt( (float)distance); index = *tbuf - min + 1; goto exit; - } + } } else { - *dist = (short) sqrt( (float)distance); // XXX, this distance is wrong - - index = *tbuf - min + 1; // messy yah, but indices start at 1 + *dist = (short) sqrt( (float)distance); /* XXX, this distance is wrong - */ + index = *tbuf - min + 1; /* messy yah, but indices start at 1 */ goto exit; - } + } } tbuf += (dirvec[rc][0] + dirvec[rc][1]); @@ -1912,7 +1915,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas tbase.flag = OB_FROMDUPLI | base->flag; lb = object_duplilist(scene, base->object); - // BLI_sortlist(lb, dupli_ob_sort); // might be nice to have if we have a dupli list with mixed objects. + // BLI_sortlist(lb, dupli_ob_sort); /* might be nice to have if we have a dupli list with mixed objects. */ dob = dupli_step(lb->first); if (dob) dob_next = dupli_step(dob->next); @@ -2174,7 +2177,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *)) glClear(GL_DEPTH_BUFFER_BIT); glLoadMatrixf(rv3d->viewmat); -// persp(PERSP_STORE); // store correct view for persp(PERSP_VIEW) calls +// persp(PERSP_STORE); /* store correct view for persp(PERSP_VIEW) calls */ if (rv3d->rflag & RV3D_CLIPPING) { ED_view3d_clipping_set(rv3d); @@ -2640,7 +2643,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, glPopMatrix(); - // 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; @@ -2686,9 +2689,6 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, GPU_offscreen_read_pixels(ofs, GL_FLOAT, ibuf->rect_float); else if (ibuf->rect) GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, ibuf->rect); - - //if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) - // BKE_stamp_buf(scene, NULL, rr->rectf, rr->rectx, rr->recty, 4); /* unbind */ GPU_offscreen_unbind(ofs); @@ -2951,7 +2951,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const glEnable(GL_MULTISAMPLE_ARB); #endif - // needs to be done always, gridview is adjusted in drawgrid() now + /* needs to be done always, gridview is adjusted in drawgrid() now */ rv3d->gridview = v3d->grid; if ((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) { @@ -3049,7 +3049,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const /* Transp and X-ray afterdraw stuff */ if (v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d); - if (v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used! + if (v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); /* clears zbuffer if it is used! */ if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1); ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); @@ -3078,7 +3078,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const } if ((U.ndof_flag & NDOF_SHOW_GUIDE) && (rv3d->viewlock != RV3D_LOCKED) && (rv3d->persp != RV3D_CAMOB)) - // TODO: draw something else (but not this) during fly mode + /* TODO: draw something else (but not this) during fly mode */ draw_rotation_guide(rv3d); } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 218aa71d621..97123767211 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -81,7 +81,7 @@ #include "PIL_time.h" /* smoothview */ -#include "view3d_intern.h" // own include +#include "view3d_intern.h" /* own include */ /* ********************** view3d_edit: view manipulations ********************* */ @@ -444,7 +444,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) float my_pivot[3]; /* view */ float dvec[3]; - // locals for dist correction + /* locals for dist correction */ float mat[3][3]; float upvec[3]; @@ -1517,13 +1517,13 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom, fac = -fac; } - // oldstyle zoom + /* oldstyle zoom */ zfac = 1.0f + ((fac / 20.0f) * time_step); vod->timer_lastdraw = time; } else if (viewzoom == USER_ZOOM_SCALE) { int ctr[2], len1, len2; - // method which zooms based on how far you move the mouse + /* method which zooms based on how far you move the mouse */ ctr[0] = (vod->ar->winrct.xmax + vod->ar->winrct.xmin) / 2; ctr[1] = (vod->ar->winrct.ymax + vod->ar->winrct.ymin) / 2; @@ -2100,7 +2100,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in new_ofs[1] = -(min[1] + max[1]) / 2.0f; new_ofs[2] = -(min[2] + max[2]) / 2.0f; - // correction for window aspect ratio + /* correction for window aspect ratio */ if (ar->winy > 2 && ar->winx > 2) { size = (float)ar->winx / (float)ar->winy; if (size < 1.0f) size = 1.0f / size; @@ -3402,7 +3402,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve if (mval[0] != IS_CLIPPED) { short depth_used = 0; - if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */ + if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */ view3d_operator_needs_opengl(C); if (ED_view3d_autodist(scene, ar, v3d, event->mval, fp)) depth_used = 1; @@ -3596,7 +3596,7 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2] return 1; } -int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, float *autodist ) +int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) { /* Get Z Depths, needed for perspective, nice for ortho */ switch (mode) { @@ -3611,9 +3611,9 @@ int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) // return 1; } -// no 4x4 sampling, run view_autodist_init first +/* 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 margin, float *force_depth) { bglMats mats; /* ZBuffer depth vars, could cache? */ float depth; diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 95cc37d9f87..40837d00409 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -513,7 +513,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) } break; case P_FINISHING: - // stop keeping track of 3D mouse position + /* stop keeping track of 3D mouse position */ #ifdef NDOF_FLY_DEBUG puts("stop keeping track of 3D mouse position"); #endif diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index eb202497260..465279ee6ed 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -115,8 +115,8 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event); #define B_REDR 122 #define B_NOP 123 -// XXX quickly ported across -static void handle_view3d_lock(bContext *C) +/* XXX quickly ported across */ +static void handle_view3d_lock(bContext *C) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index f9ebd4e39c1..f12e7683668 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -92,9 +92,9 @@ #include "UI_interface.h" #include "UI_resources.h" -#include "view3d_intern.h" // own include +#include "view3d_intern.h" /* own include */ -// TODO: should return whether there is valid context to continue +/* TODO: should return whether there is valid context to continue */ void view3d_set_viewcontext(bContext *C, ViewContext *vc) { memset(vc, 0, sizeof(ViewContext)); @@ -1825,7 +1825,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i unsigned int *col; /* color in buffer */ int bone_only; int bone_selected = 0; - int totobj = MAXPICKBUF; // XXX solve later + int totobj = MAXPICKBUF; /* XXX solve later */ short hits; if ((ob) && (ob->mode & OB_MODE_POSE)) @@ -2370,7 +2370,7 @@ static void lattice_circle_select(ViewContext *vc, int select, const int mval[2] } -// NOTE: pose-bone case is copied from editbone case... +/* NOTE: pose-bone case is copied from editbone case... */ static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int x, int y) { CircleSelectUserData *data = userData; @@ -2403,7 +2403,7 @@ static void pose_circle_select(ViewContext *vc, int select, const int mval[2], f ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */ /* check each PoseChannel... */ - // TODO: could be optimized at some point + /* TODO: could be optimized at some point */ for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { short sco1[2], sco2[2], didpoint = 0; float vec[3]; @@ -2475,7 +2475,7 @@ static void armature_circle_select(ViewContext *vc, int select, const int mval[2 ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ /* check each EditBone... */ - // TODO: could be optimized at some point + /* TODO: could be optimized at some point */ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { short sco1[2], sco2[2], didpoint = 0; float vec[3]; @@ -2497,7 +2497,7 @@ static void armature_circle_select(ViewContext *vc, int select, const int mval[2 didpoint = 1; /* only if the endpoints didn't get selected, deal with the middle of the bone too */ - // XXX should we just do this always? + /* XXX should we just do this always? */ if ( (didpoint == 0) && edge_inside_circle(mval[0], mval[1], rad, sco1[0], sco1[1], sco2[0], sco2[1]) ) { if (select) ebone->flag |= BONE_TIPSEL | BONE_ROOTSEL | BONE_SELECTED; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 1991d4bce4f..fc97b9bbb36 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -102,7 +102,7 @@ static void special_transvert_update(Object *obedit) if (obedit->type == OB_MESH) { Mesh *me = obedit->data; - BM_mesh_normals_update(me->edit_btmesh->bm, TRUE); // does face centers too + BM_mesh_normals_update(me->edit_btmesh->bm, TRUE); /* does face centers too */ } else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { Curve *cu = obedit->data; @@ -223,8 +223,8 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod float total, center[3], centroid[3]; int a; - tottrans = 0; // global! - + tottrans = 0; /* global! */ + INIT_MINMAX(min, max); zero_v3(centroid); @@ -239,7 +239,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod /* abuses vertex index all over, set, just set dirty here, * perhaps this could use its own array instead? - campbell */ - // transform now requires awareness for select mode, so we tag the f1 flags in verts + /* transform now requires awareness for select mode, so we tag the f1 flags in verts */ tottrans = 0; if (em->selectmode & SCE_SELECT_VERTEX) { BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { @@ -304,7 +304,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod copy_v3_v3(tv->oldloc, eve->co); tv->loc = eve->co; if (eve->no[0] != 0.0f || eve->no[1] != 0.0f || eve->no[2] != 0.0f) - tv->nor = eve->no; // note this is a hackish signal (ton) + tv->nor = eve->no; /* note this is a hackish signal (ton) */ tv->flag = BM_elem_index_get(eve) & SELECT; tv++; a++; @@ -794,8 +794,8 @@ static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op)) curs[1] = gridf * floorf(0.5f + curs[1] / gridf); curs[2] = gridf * floorf(0.5f + curs[2] / gridf); - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); // hrm - + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); /* hrm */ + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index b4350847552..ee2634bf8da 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -71,7 +71,7 @@ #include "RNA_access.h" #include "RNA_define.h" -#include "view3d_intern.h" // own include +#include "view3d_intern.h" /* own include */ /* use this call when executing an operator, * event system doesn't set for each event the @@ -184,7 +184,7 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec /* original values */ if (oldcamera) { - sms.orig_dist = rv3d->dist; // below function does weird stuff with it... + sms.orig_dist = rv3d->dist; /* below function does weird stuff with it... */ ED_view3d_from_object(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens); } else { @@ -1100,14 +1100,14 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short rv3d->dist = 0.0; ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); - smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX - + smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); /* XXX */ + rv3d->persp = RV3D_CAMOB; /* just to be polite, not needed */ } else { mat3_to_quat(new_quat, tmat); - smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX + smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); /* XXX */ } } else { @@ -1211,7 +1211,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b /* case not a border select */ if (input->xmin == input->xmax) { - rect.xmin = input->xmin - 12; // seems to be default value for bones only now + rect.xmin = input->xmin - 12; /* seems to be default value for bones only now */ rect.xmax = input->xmin + 12; rect.ymin = input->ymin - 12; rect.ymax = input->ymin + 12; @@ -1252,7 +1252,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b else { Base *base; - v3d->xray = TRUE; // otherwise it postpones drawing + v3d->xray = TRUE; /* otherwise it postpones drawing */ for (base = scene->base.first; base; base = base->next) { if (base->lay & v3d->lay) { @@ -1294,7 +1294,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b } } } - v3d->xray = FALSE; // restore + v3d->xray = FALSE; /* restore */ } glPopName(); /* see above (pushname) */ @@ -1313,8 +1313,8 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b if (vc->rv3d->rflag & RV3D_CLIPPING) ED_view3d_clipping_disable(); - if (hits < 0) printf("Too many objects in select buffer\n"); // XXX make error message - + if (hits < 0) printf("Too many objects in select buffer\n"); /* XXX make error message */ + return hits; } @@ -1407,7 +1407,7 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) locallay = free_localbit(bmain); if (locallay == 0) { - printf("Sorry, no more than 8 localviews\n"); // XXX error + printf("Sorry, no more than 8 localviews\n"); /* XXX error */ ok = 0; } else { @@ -1460,7 +1460,7 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) if (rv3d->persp == RV3D_ORTHO) rv3d->dist *= 0.7f; - // correction for window aspect ratio + /* correction for window aspect ratio */ if (ar->winy > 2 && ar->winx > 2) { float asp = (float)ar->winx / (float)ar->winy; if (asp < 1.0f) asp = 1.0f / asp; @@ -1541,7 +1541,7 @@ static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa) locallay = v3d->lay & 0xFF000000; - restore_localviewdata(sa, 1); // 1 = free + restore_localviewdata(sa, 1); /* 1 = free */ /* for when in other window the layers have changed */ if (v3d->scenelock) v3d->lay = scene->lay; @@ -1681,7 +1681,7 @@ static void game_set_commmandline_options(GameData *gm) } } -#endif // WITH_GAMEENGINE +#endif /* WITH_GAMEENGINE */ static int game_engine_poll(bContext *C) { @@ -1722,7 +1722,7 @@ int ED_view3d_context_activate(bContext *C) if (!ar) return 0; - // bad context switch .. + /* bad context switch .. */ CTX_wm_area_set(C, sa); CTX_wm_region_set(C, ar); @@ -1741,7 +1741,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) (void)op; /* unused */ - // bad context switch .. + /* bad context switch .. */ if (!ED_view3d_context_activate(C)) return OPERATOR_CANCELLED; @@ -1854,11 +1854,11 @@ static void UNUSED_FUNCTION(view3d_align_axis_to_vector)(View3D *v3d, RegionView rv3d->persp = RV3D_PERSP; rv3d->dist = 0.0; ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); - smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX + smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); /* XXX */ } else { if (rv3d->persp == RV3D_CAMOB) rv3d->persp = RV3D_PERSP; /* switch out of camera mode */ - smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX + smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); /* XXX */ } } -- cgit v1.2.3 From 2e45266dc4c5026f10c383a618f0d25ea14cd1d3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 8 Jul 2012 20:53:44 +0000 Subject: localview operator now reports when 8 views are reached (since 2.5x update was printing in console only). --- source/blender/editors/space_view3d/view3d_view.c | 56 +++++++++++++++-------- 1 file changed, 37 insertions(+), 19 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index ee2634bf8da..bc41ecd1dc5 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1392,29 +1392,31 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active) return lay; } -static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) +static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportList *reports) { View3D *v3d = sa->spacedata.first; Base *base; float size = 0.0, min[3], max[3], box[3]; unsigned int locallay; - int ok = 0; + int ok = FALSE; - if (v3d->localvd) return; + if (v3d->localvd) { + return ok; + } INIT_MINMAX(min, max); locallay = free_localbit(bmain); if (locallay == 0) { - printf("Sorry, no more than 8 localviews\n"); /* XXX error */ - ok = 0; + BKE_reportf(reports, RPT_ERROR, "No more than 8 localviews"); + ok = FALSE; } else { if (scene->obedit) { BKE_object_minmax(scene->obedit, min, max); - ok = 1; + ok = TRUE; BASACT->lay |= locallay; scene->obedit->lay = BASACT->lay; @@ -1425,7 +1427,7 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) BKE_object_minmax(base->object, min, max); base->lay |= locallay; base->object->lay = base->lay; - ok = 1; + ok = TRUE; } } } @@ -1437,7 +1439,7 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) if (size <= 0.01f) size = 0.01f; } - if (ok) { + if (ok == TRUE) { ARegion *ar; v3d->localvd = MEM_mallocN(sizeof(View3D), "localview"); @@ -1486,9 +1488,10 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) if (base->object != scene->obedit) base->flag |= SELECT; base->object->lay = base->lay; } - } + } } + return ok; } static void restore_localviewdata(ScrArea *sa, int free) @@ -1531,7 +1534,7 @@ static void restore_localviewdata(ScrArea *sa, int free) } } -static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa) +static int view3d_localview_exit(Main *bmain, Scene *scene, ScrArea *sa) { View3D *v3d = sa->spacedata.first; struct Base *base; @@ -1559,23 +1562,38 @@ static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa) } DAG_on_visible_update(bmain, FALSE); + + return TRUE; } + else { + return FALSE; + } } -static int localview_exec(bContext *C, wmOperator *UNUSED(unused)) +static int localview_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + ScrArea *sa = CTX_wm_area(C); View3D *v3d = CTX_wm_view3d(C); + int change; - if (v3d->localvd) - endlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C)); - else - initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C)); + if (v3d->localvd) { + change = view3d_localview_exit(bmain, scene, sa); + } + else { + change = view3d_localview_init(bmain, scene, sa, op->reports); + } - DAG_id_type_tag(bmain, ID_OB); - ED_area_tag_redraw(CTX_wm_area(C)); - - return OPERATOR_FINISHED; + if (change) { + DAG_id_type_tag(bmain, ID_OB); + ED_area_tag_redraw(CTX_wm_area(C)); + + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } } void VIEW3D_OT_localview(wmOperatorType *ot) -- cgit v1.2.3 From 75a5eab8d13fee1cec9e8fd1538f0aa15ef3b72f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 8 Jul 2012 21:37:59 +0000 Subject: code cleanup --- source/blender/editors/include/ED_armature.h | 3 --- source/blender/editors/space_view3d/drawanimviz.c | 7 +++---- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index eb02fc97596..07f3498580c 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -180,6 +180,3 @@ void mesh_deform_bind(struct Scene *scene, #endif #endif /* __ED_ARMATURE_H__ */ - - - diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index afbaabf1b06..5f312ff7fca 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -43,7 +43,6 @@ #include "DNA_view3d_types.h" #include "DNA_object_types.h" -#include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_dlrbTree.h" @@ -64,8 +63,8 @@ /* ************************************ Motion Paths ************************************* */ /* TODO: - * - options to draw paths with lines - * - include support for editing the path verts */ + * - options to draw paths with lines + * - include support for editing the path verts */ /* Set up drawing environment for drawing motion paths */ void draw_motion_paths_init(View3D *v3d, ARegion *ar) @@ -80,7 +79,7 @@ void draw_motion_paths_init(View3D *v3d, ARegion *ar) /* Draw the given motion path for an Object or a Bone * - assumes that the viewport has already been initialized properly - * i.e. draw_motion_paths_init() has been called + * i.e. draw_motion_paths_init() has been called */ void draw_motion_path_instance(Scene *scene, Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath) -- cgit v1.2.3