style cleanup: + some warning fixes, also remove unused metaelem extern.

This commit is contained in:
Campbell Barton 2012-03-10 22:00:55 +00:00
parent 67f1e83508
commit 7f34653f59
13 changed files with 93 additions and 75 deletions

@ -465,7 +465,7 @@ int dtStatNavMesh::raycast(dtStatPolyRef centerRef, const float* startPos, const
if (!m_header) return 0;
if (!centerRef) return 0;
dtStatPolyRef prevRef = centerRef;
/* dtStatPolyRef prevRef = centerRef; */ /* UNUSED */
dtStatPolyRef curRef = centerRef;
t = 0;
@ -506,7 +506,7 @@ int dtStatNavMesh::raycast(dtStatPolyRef centerRef, const float* startPos, const
}
// No hit, advance to neighbour polygon.
prevRef = curRef;
/* prevRef = curRef; */ /* UNUSED */
curRef = nextRef;
}

@ -227,9 +227,9 @@ int EDBM_mask_init_backbuf_border(ViewContext *vc, int mcords[][2], short tot, s
/* method in use for face selecting too */
if (vc->obedit == NULL) {
if (paint_facesel_test(vc->obact));
else if (paint_vertsel_test(vc->obact));
else return 0;
if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
return 0;
}
}
else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
return 0;
@ -289,9 +289,9 @@ int EDBM_init_backbuf_circle(ViewContext *vc, short xs, short ys, short rads)
/* method in use for face selecting too */
if (vc->obedit == NULL) {
if (paint_facesel_test(vc->obact));
else if (paint_vertsel_test(vc->obact));
else return 0;
if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
return 0;
}
}
else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) return 0;

@ -465,7 +465,7 @@ static int EDBM_Extrude_Mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOpe
if (nr < 1) return 'g';
if (nr == 1 && em->selectmode & SCE_SELECT_VERTEX)
if (nr == 1 && (em->selectmode & SCE_SELECT_VERTEX))
transmode = EDBM_Extrude_vert(obedit, em, BM_ELEM_SELECT, nor);
else if (nr == 1) transmode = EDBM_Extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
else if (nr == 4) transmode = EDBM_Extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
@ -1810,12 +1810,6 @@ void MESH_OT_faces_shade_flat(wmOperatorType *ot)
/********************** UV/Color Operators *************************/
static const EnumPropertyItem axis_items[] = {
{OPUVC_AXIS_X, "X", 0, "X", ""},
{OPUVC_AXIS_Y, "Y", 0, "Y", ""},
{0, NULL, 0, NULL, NULL}};
static int mesh_rotate_uvs(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);

@ -170,10 +170,18 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
glColor3ubv(cp);
}
else {
if (boneflag & BONE_DRAW_ACTIVE && boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_BONE_POSE, 40);
else if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorBlend(TH_WIRE, TH_BONE_POSE, 0.15f); /* unselected active */
else if (boneflag & BONE_SELECTED) UI_ThemeColor(TH_BONE_POSE);
else UI_ThemeColor(TH_WIRE);
if ((boneflag & BONE_DRAW_ACTIVE) && (boneflag & BONE_SELECTED)) {
UI_ThemeColorShade(TH_BONE_POSE, 40);
}
else if (boneflag & BONE_DRAW_ACTIVE) {
UI_ThemeColorBlend(TH_WIRE, TH_BONE_POSE, 0.15f); /* unselected active */
}
else if (boneflag & BONE_SELECTED) {
UI_ThemeColor(TH_BONE_POSE);
}
else {
UI_ThemeColor(TH_WIRE);
}
}
return 1;
@ -290,10 +298,18 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
static void set_ebone_glColor(const unsigned int boneflag)
{
if (boneflag & BONE_DRAW_ACTIVE && boneflag & BONE_SELECTED) UI_ThemeColor(TH_EDGE_SELECT);
else if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, 0.15f); /* unselected active */
else if (boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_EDGE_SELECT, -20);
else UI_ThemeColor(TH_WIRE);
if ((boneflag & BONE_DRAW_ACTIVE) && (boneflag & BONE_SELECTED)) {
UI_ThemeColor(TH_EDGE_SELECT);
}
else if (boneflag & BONE_DRAW_ACTIVE) {
UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, 0.15f); /* unselected active */
}
else if (boneflag & BONE_SELECTED) {
UI_ThemeColorShade(TH_EDGE_SELECT, -20);
}
else {
UI_ThemeColor(TH_WIRE);
}
}
/* *************** Armature drawing, helper calls for parts ******************* */
@ -1749,16 +1765,21 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
OB_SOLID, arm->flag, flag, index, bone->length);
}
}
else if (arm->drawtype==ARM_LINE)
; /* nothing in solid */
else if (arm->drawtype==ARM_WIRE)
; /* nothing in solid */
else if (arm->drawtype==ARM_ENVELOPE)
else if (arm->drawtype == ARM_LINE) {
/* nothing in solid */
}
else if (arm->drawtype == ARM_WIRE) {
/* nothing in solid */
}
else if (arm->drawtype == ARM_ENVELOPE) {
draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
else if (arm->drawtype==ARM_B_BONE)
}
else if (arm->drawtype == ARM_B_BONE) {
draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
else
}
else {
draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length);
}
glPopMatrix();
}
@ -1937,8 +1958,9 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* set color-set to use */
set_pchan_colorset(ob, pchan);
if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM))
; // custom bone shapes should not be drawn here!
if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
/* custom bone shapes should not be drawn here! */
}
else if (arm->drawtype==ARM_ENVELOPE) {
if (dt < OB_SOLID)
draw_sphere_bone_wire(smat, imat, arm->flag, flag, constflag, index, pchan, NULL);
@ -1973,7 +1995,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
draw_pose_dofs(ob);
/* finally names and axes */
if (arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES) && is_outline == 0) {
if ((arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES)) && (is_outline == 0)) {
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
if ((G.f & G_PICKSEL) == 0) {
float vec[3];

@ -404,7 +404,7 @@ static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int
glColor3ub(0xFF, 0x00, 0xFF);
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
else if (ma && ma->shade_flag&MA_OBCOLOR) {
else if (ma && (ma->shade_flag&MA_OBCOLOR)) {
glColor3ubv(Gtexdraw.obcol);
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
@ -444,7 +444,7 @@ static DMDrawOption draw_tface__set_draw(MTFace *tface, int has_mcol, int matnr)
if (tface && set_draw_settings_cached(0, tface, ma, Gtexdraw)) {
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
else if (tface && tface->mode&TF_OBCOL) {
else if (tface && (tface->mode & TF_OBCOL)) {
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
else if (!has_mcol) {
@ -486,7 +486,7 @@ static void add_tface_color_layer(DerivedMesh *dm)
finalCol[i*4+j].r = 255;
}
}
else if (tface && tface->mode&TF_OBCOL) {
else if (tface && (tface->mode & TF_OBCOL)) {
for (j=0;j<4;j++) {
finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[0]);
finalCol[i*4+j].g = FTOCHAR(Gtexdraw.obcol[1]);

@ -197,7 +197,7 @@ static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
if (dt==OB_TEXTURE && vd->drawtype==OB_TEXTURE)
return 0;
if (vd->drawtype>=OB_SOLID && vd->flag2 & V3D_SOLID_TEX)
if ((vd->drawtype >= OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX))
return 0;
return 1;
@ -3246,7 +3246,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
if (dt==OB_BOUNDBOX) {
if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_WIRE)==0)
draw_bounding_volume(scene, ob, ob->boundtype);
}
else if (hasHaloMat || (totface==0 && totedge==0)) {
@ -3498,7 +3498,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
}
if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_SOLID)==0)
dm->drawEdges(dm, (dt==OB_WIRE || totface==0), me->drawflag & ME_ALLEDGES);
if (dt!=OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) {
@ -3540,8 +3540,8 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
if (obedit && ob!=obedit && ob->data==obedit->data) {
if (ob_get_key(ob) || ob_get_key(obedit));
else if (ob->modifiers.first || obedit->modifiers.first);
if (ob_get_key(ob) || ob_get_key(obedit)) {}
else if (ob->modifiers.first || obedit->modifiers.first) {}
else drawlinked= 1;
}
@ -3853,7 +3853,7 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
GPU_end_object_materials();
}
else {
if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_SOLID)==0)
drawCurveDMWired (ob);
}
@ -5407,7 +5407,9 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
}
}
else {
if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
if ((bp->f1 & SELECT) && (bp1->f1 & SELECT)) {
/* pass */
}
else {
UI_ThemeColor(TH_NURB_ULINE);
@ -5440,7 +5442,9 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
}
}
else {
if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
if ((bp->f1 & SELECT) && (bp1->f1 & SELECT)) {
/* pass */
}
else {
UI_ThemeColor(TH_NURB_VLINE);
@ -5504,7 +5508,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* direction vectors for 3d curve paths
* when at its lowest, dont render normals */
if (cu->flag & CU_3D && ts->normalsize > 0.0015f && (cu->drawflag & CU_HIDE_NORMALS)==0) {
if ((cu->flag & CU_3D) && (ts->normalsize > 0.0015f) && (cu->drawflag & CU_HIDE_NORMALS)==0) {
UI_ThemeColor(TH_WIRE);
for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
@ -6620,7 +6624,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
else if (dt==OB_BOUNDBOX) {
if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE) == 0) {
if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_WIRE) == 0) {
draw_bounding_volume(scene, ob, ob->boundtype);
}
}
@ -6638,8 +6642,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
drawnurb(scene, v3d, rv3d, base, nurbs->first, dt);
}
else if (dt==OB_BOUNDBOX) {
if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && (v3d->drawtype >= OB_WIRE)) == 0) {
draw_bounding_volume(scene, ob, ob->boundtype);
}
}
else if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
@ -6655,8 +6660,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if (mb->editelems)
drawmball(scene, v3d, rv3d, base, dt);
else if (dt==OB_BOUNDBOX) {
if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && (v3d->drawtype >= OB_WIRE)) == 0) {
draw_bounding_volume(scene, ob, ob->boundtype);
}
}
else
empty_object= drawmball(scene, v3d, rv3d, base, dt);
@ -7295,7 +7301,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
bm_wireoffs= bm_solidoffs + em->bm->totedge;
// we draw verts if vert select mode or if in transform (for snap).
if (ts->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) {
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;
}

@ -517,8 +517,6 @@ static void viewops_data_free(bContext *C, wmOperator *op)
/* ************************** viewrotate **********************************/
static const float thres = 0.93f; //cos(20 deg);
#define COS45 0.7071068
#define SIN45 COS45
@ -2135,8 +2133,8 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
INIT_MINMAX(min, max);
if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
/* hardcoded exception, we look for the one selected armature */
if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
/* hard-coded exception, we look for the one selected armature */
/* this is weak code this way, we should make a generic active/selection callback interface once... */
Base *base;
for (base=scene->base.first; base; base= base->next) {
@ -2681,16 +2679,20 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
/* normal operation */
if (rv3d->viewlock) {
/* only pass on if */
if (rv3d->view==RV3D_VIEW_FRONT && view==RV3D_VIEW_BACK);
else if (rv3d->view==RV3D_VIEW_BACK && view==RV3D_VIEW_FRONT);
else if (rv3d->view==RV3D_VIEW_RIGHT && view==RV3D_VIEW_LEFT);
else if (rv3d->view==RV3D_VIEW_LEFT && view==RV3D_VIEW_RIGHT);
else if (rv3d->view==RV3D_VIEW_BOTTOM && view==RV3D_VIEW_TOP);
else if (rv3d->view==RV3D_VIEW_TOP && view==RV3D_VIEW_BOTTOM);
else return;
/* nice confusing if-block */
if (!((rv3d->view == RV3D_VIEW_FRONT && view == RV3D_VIEW_BACK) ||
(rv3d->view == RV3D_VIEW_BACK && view == RV3D_VIEW_FRONT) ||
(rv3d->view == RV3D_VIEW_RIGHT && view == RV3D_VIEW_LEFT) ||
(rv3d->view == RV3D_VIEW_LEFT && view == RV3D_VIEW_RIGHT) ||
(rv3d->view == RV3D_VIEW_BOTTOM && view == RV3D_VIEW_TOP) ||
(rv3d->view == RV3D_VIEW_TOP && view == RV3D_VIEW_BOTTOM)))
{
return;
}
}
rv3d->view= view;
rv3d->view = view;
}
if (rv3d->viewlock) {

@ -185,7 +185,7 @@ typedef struct FlyInfo {
* 0) disabled
* 1) enabled but not checking because mouse hasn't moved outside the margin since locking was checked an not needed
* when the mouse moves, locking is set to 2 so checks are done.
* 2) mouse moved and checking needed, if no view altering is donem its changed back to 1 */
* 2) mouse moved and checking needed, if no view altering is done its changed back to 1 */
short xlock, zlock;
float xlock_momentum, zlock_momentum; /* nicer dynamics */
float grid; /* world scale 1.0 default */
@ -525,7 +525,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
fly->time_lastdraw = PIL_check_seconds_timer();
break;
default:
; // should always be one of the above 3
break; /* should always be one of the above 3 */
}
}
/* handle modal keymap first */

@ -816,12 +816,11 @@ int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
}
mvert= me->mvert;
for (a=1; a<=me->totvert; a++, mvert++) {
for (a = 1; a <= me->totvert; a++, mvert++) {
if (selar[a]) {
if (mvert->flag & ME_HIDE);
else {
if (select) mvert->flag |= SELECT;
else mvert->flag &= ~SELECT;
if ((mvert->flag & ME_HIDE) == 0) {
if (select) mvert->flag |= SELECT;
else mvert->flag &= ~SELECT;
}
}
}
@ -1595,7 +1594,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, basact->object);
/* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
if (BASACT && BASACT->object->mode & OB_MODE_WEIGHT_PAINT) {
if (BASACT && (BASACT->object->mode & OB_MODE_WEIGHT_PAINT)) {
/* prevent activating */
basact= NULL;
}

@ -331,7 +331,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
if (ebo->layer & arm->layer) {
short tipsel= (ebo->flag & BONE_TIPSEL);
short rootsel= (ebo->flag & BONE_ROOTSEL);
short rootok= (!(ebo->parent && (ebo->flag & BONE_CONNECTED) && ebo->parent->flag & BONE_TIPSEL));
short rootok= (!(ebo->parent && (ebo->flag & BONE_CONNECTED) && (ebo->parent->flag & BONE_TIPSEL)));
if ((tipsel && rootsel) || (rootsel)) {
/* Don't add the tip (unless mode & TM_ALL_JOINTS, for getting all joints),

@ -111,8 +111,6 @@
#include "RNA_access.h"
extern ListBase editelems;
#include "transform.h"
#include "bmesh.h"

@ -107,8 +107,6 @@
#include "transform.h"
extern ListBase editelems;
/* ************************** Functions *************************** */
void getViewVector(TransInfo *t, float coord[3], float vec[3])

@ -752,7 +752,6 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
else if(obedit->type==OB_MBALL){
#if 0 // XXX
/* editmball.c */
extern ListBase editelems; /* go away ! */
MetaElem *ml, *ml_sel = NULL;
/* loop and check that only one element is selected */