diff options
Diffstat (limited to 'source/blender')
25 files changed, 136 insertions, 150 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index b0a1e74c30f..40365a2198f 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2570,11 +2570,9 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const } else { - int i=0; - short * no = pMesh->mvert[indices[vert_index]].no; - for(i=0; i<3; i++) - fNorm[i]=no[i]/32767.0f; - normalize_v3(fNorm); + short *no = pMesh->mvert[indices[vert_index]].no; + normal_short_to_float_v3(fNorm, no); + normalize_v3(fNorm); /* XXX, is this needed */ } } static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index fc0d5d90687..cbe7382c3a9 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1604,9 +1604,7 @@ DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *UNUSED(me)) VECCOPY(mv->co, eve->co); - mv->no[0] = eve->no[0] * 32767.0; - mv->no[1] = eve->no[1] * 32767.0; - mv->no[2] = eve->no[2] * 32767.0; + normal_float_to_short_v3(mv->no, eve->no); mv->bweight = (unsigned char) (eve->bweight * 255.0f); mv->flag = 0; diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index c749655cdc2..7cb3adf96bf 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -182,12 +182,10 @@ static void mesh_add_normals_flags(Mesh *me) v2= me->mvert+mface->v2; v3= me->mvert+mface->v3; v4= me->mvert+mface->v4; - + normal_tri_v3( nor,v1->co, v2->co, v3->co); - sno[0]= 32767.0*nor[0]; - sno[1]= 32767.0*nor[1]; - sno[2]= 32767.0*nor[2]; - + normal_float_to_short_v3(sno, nor); + simple_vertex_normal_blend(v1->no, sno); simple_vertex_normal_blend(v2->no, sno); simple_vertex_normal_blend(v3->no, sno); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index bc3e6b4c4dd..66e9d09fb7e 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -751,9 +751,7 @@ void mball_to_mesh(ListBase *lb, Mesh *me) verts= dl->verts; while(a--) { VECCOPY(mvert->co, verts); - mvert->no[0]= (short int)(nors[0]*32767.0); - mvert->no[1]= (short int)(nors[1]*32767.0); - mvert->no[2]= (short int)(nors[2]*32767.0); + normal_float_to_short_v3(mvert->no, nors); mvert++; nors+= 3; verts+= 3; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 276f60bdf7f..a0a815befba 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -516,7 +516,8 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int /* draw grease-pencil datablock */ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag) { - bGPDlayer *gpl, *actlay=NULL; + bGPDlayer *gpl; + // bGPDlayer *actlay=NULL; // UNUSED /* reset line drawing style (in case previous user didn't reset) */ setlinestyle(0); @@ -541,8 +542,8 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy continue; /* if layer is active one, store pointer to it */ - if (gpl->flag & GP_LAYER_ACTIVE) - actlay= gpl; + // if (gpl->flag & GP_LAYER_ACTIVE) + // actlay= gpl; /* get frame to draw */ gpf= gpencil_layer_getframe(gpl, cfra, 0); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 93537928c92..afee8416239 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1913,7 +1913,7 @@ void ui_check_but(uiBut *but) { /* if something changed in the button */ double value; - float okwidth; +// float okwidth; // UNUSED // int transopts= ui_translate_buttons(); ui_is_but_sel(but); @@ -1967,7 +1967,7 @@ void ui_check_but(uiBut *but) /* safety is 4 to enable small number buttons (like 'users') */ - okwidth= -4 + (but->x2 - but->x1); + // okwidth= -4 + (but->x2 - but->x1); // UNUSED /* name: */ switch( but->type ) { @@ -1989,8 +1989,8 @@ void ui_check_but(uiBut *but) value= ui_get_but_val(but); if(ui_is_but_float(but)) { - if(value == FLT_MAX) sprintf(but->drawstr, "%sinf", but->str); - else if(value == -FLT_MAX) sprintf(but->drawstr, "%s-inf", but->str); + if(value == (double) FLT_MAX) sprintf(but->drawstr, "%sinf", but->str); + else if(value == (double) -FLT_MAX) sprintf(but->drawstr, "%s-inf", but->str); /* support length type buttons */ else if(ui_is_but_unit(but)) { char new_str[sizeof(but->drawstr)]; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 648eee07ca0..47713cdb13c 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3671,12 +3671,12 @@ static int in_scope_resize_zone(uiBut *but, int UNUSED(x), int y) static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx, int my) { Histogram *hist = (Histogram *)but->poin; - rcti rect; + /* rcti rect; */ int changed= 1; float dx, dy, yfac=1.f; - rect.xmin= but->x1; rect.xmax= but->x2; - rect.ymin= but->y1; rect.ymax= but->y2; + /* rect.xmin= but->x1; rect.xmax= but->x2; */ + /* rect.ymin= but->y1; rect.ymax= but->y2; */ dx = mx - data->draglastx; dy = my - data->draglasty; @@ -3754,12 +3754,12 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx, int my) { Scopes *scopes = (Scopes *)but->poin; - rcti rect; + /* rcti rect; */ int changed= 1; float dx, dy, yfac=1.f; - rect.xmin= but->x1; rect.xmax= but->x2; - rect.ymin= but->y1; rect.ymax= but->y2; + /* rect.xmin= but->x1; rect.xmax= but->x2; */ + /* rect.ymin= but->y1; rect.ymax= but->y2; */ dx = mx - data->draglastx; dy = my - data->draglasty; @@ -3837,12 +3837,12 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int mx, int my) { Scopes *scopes = (Scopes *)but->poin; - rcti rect; + /* rcti rect; */ int changed= 1; /* float dx, dy; */ - rect.xmin= but->x1; rect.xmax= but->x2; - rect.ymin= but->y1; rect.ymax= but->y2; + /* rect.xmin= but->x1; rect.xmax= but->x2; */ + /* rect.ymin= but->y1; rect.ymax= but->y2; */ /* dx = mx - data->draglastx; */ /* dy = my - data->draglasty; */ diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 25dbcf81c26..b47194ba1b4 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1097,6 +1097,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) }*/ } else if(event->type==PADPLUSKEY || event->type==PADMINUS) { +#if 0 // XXX make float panel exception? int zoom=0; /* if panel is closed, only zoom if mouse is over the header */ @@ -1107,7 +1108,6 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) else zoom=1; -#if 0 // XXX make float panel exception? if(zoom) { ScrArea *sa= CTX_wm_area(C); SpaceLink *sl= sa->spacedata.first; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 2f442d930de..42b6926e847 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -330,13 +330,13 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiBut *but; uiBlock *block; PointerRNA idptr; - ListBase *lb; + // ListBase *lb; // UNUSED ID *id, *idfrom; idptr= RNA_property_pointer_get(&template->ptr, template->prop); id= idptr.data; idfrom= template->ptr.id.data; - lb= template->idlb; + // lb= template->idlb; block= uiLayoutGetBlock(layout); uiBlockBeginAlign(block); @@ -920,7 +920,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) PointerRNA ptr; char typestr[32]; short proxy_protected, xco=0, yco=0; - int rb_col; + // int rb_col; // UNUSED /* get constraint typeinfo */ cti= constraint_get_typeinfo(con); @@ -957,7 +957,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* Draw constraint header */ /* rounded header */ - rb_col= (con->flag & CONSTRAINT_ACTIVE)?50:20; + // rb_col= (con->flag & CONSTRAINT_ACTIVE)?50:20; // UNUSED /* open/close */ uiBlockSetEmboss(block, UI_EMBOSSN); @@ -1442,6 +1442,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname) scopes->wavefrm_height= (scopes->wavefrm_height<=20)?20:scopes->wavefrm_height; bt= uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->wavefrm_height, scopes, 0, 0, 0, 0, ""); + (void)bt; // UNUSED MEM_freeN(cb); } @@ -2389,6 +2390,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) uiLayout *ui_abs; ui_abs= uiLayoutAbsolute(layout, 0); + (void)ui_abs; // UNUSED uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, 0, UI_UNIT_Y*0.1, UI_UNIT_X*0.8, UI_UNIT_Y*0.8, NULL, 0.0f, 0.0f, 0, 0, "Stop this job"); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b57d8fda712..29b4779bc69 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2092,12 +2092,10 @@ void ui_draw_link_bezier(rcti *rect) float coord_array[LINK_RESOL+1][2]; if(ui_link_bezier_points(rect, coord_array, LINK_RESOL)) { - float dist; - int i; - /* we can reuse the dist variable here to increment the GL curve eval amount*/ - dist = 1.0f/(float)LINK_RESOL; - + // const float dist= 1.0f/(float)LINK_RESOL; // UNUSED + int i; + glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index cec7d7a3d54..af3716b4677 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -452,7 +452,7 @@ static float edgetag_cut_cost(int e1, int e2, int vert) sub_v3_v3v3(d1, v->co, v1->co); sub_v3_v3v3(d2, v2->co, v->co); - cost = cost + 0.5f*cost*(2.0f - fabs(d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2])); + cost = cost + 0.5f*cost*(2.0f - fabsf(d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2])); return cost; } diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index 887228c9772..f78a23f039d 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -599,7 +599,7 @@ static void edge_normal_compare(EditEdge *eed, EditFace *efa1) if(efa1==efa2) return; inp= efa1->n[0]*efa2->n[0] + efa1->n[1]*efa2->n[1] + efa1->n[2]*efa2->n[2]; - if(inp<0.999 && inp >-0.999) eed->f2= 1; + if(inp<0.999f && inp >-0.999f) eed->f2= 1; if(efa1->v4) cent_quad_v3(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co, efa1->v4->co); else cent_tri_v3(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co); @@ -610,7 +610,7 @@ static void edge_normal_compare(EditEdge *eed, EditFace *efa1) normalize_v3(cent1); inp= cent1[0]*efa1->n[0] + cent1[1]*efa1->n[1] + cent1[2]*efa1->n[2]; - if(inp < -0.001 ) eed->f1= 1; + if(inp < -0.001f) eed->f1= 1; } #if 0 @@ -799,10 +799,8 @@ void make_editMesh(Scene *scene, Object *ob) if(!is_paint_sel) eve->f |= (mvert->flag & 1); - if (mvert->flag & ME_HIDE) eve->h= 1; - eve->no[0]= mvert->no[0]/32767.0; - eve->no[1]= mvert->no[1]/32767.0; - eve->no[2]= mvert->no[2]/32767.0; + if (mvert->flag & ME_HIDE) eve->h= 1; + normal_short_to_float_v3(eve->no, mvert->no); eve->bweight= ((float)mvert->bweight)/255.0f; @@ -936,7 +934,7 @@ void load_editMesh(Scene *scene, Object *obedit) EditFace *efa, *efa_act; EditEdge *eed; EditSelection *ese; - float *fp, *newkey, *oldkey, nor[3]; + float *fp, *newkey, *oldkey; int i, a, ototvert; /* this one also tests of edges are not in faces: */ @@ -995,9 +993,7 @@ void load_editMesh(Scene *scene, Object *obedit) VECCOPY(mvert->co, eve->co); /* vertex normal */ - VECCOPY(nor, eve->no); - mul_v3_fl(nor, 32767.0); - VECCOPY(mvert->no, nor); + normal_float_to_short_v3(mvert->no, eve->no); /* note: it used to remove me->dvert when it was not in use, cancelled that... annoying when you have a fresh vgroup */ @@ -1009,7 +1005,7 @@ void load_editMesh(Scene *scene, Object *obedit) mvert->flag |= (eve->f & SELECT); if (eve->h) mvert->flag |= ME_HIDE; - mvert->bweight= (char)(255.0*eve->bweight); + mvert->bweight= (char)(255.0f*eve->bweight); eve= eve->next; mvert++; @@ -1030,8 +1026,8 @@ void load_editMesh(Scene *scene, Object *obedit) if(eed->h & EM_FGON) medge->flag |= ME_FGON; // different defines yes if(eed->h & 1) medge->flag |= ME_HIDE; - medge->crease= (char)(255.0*eed->crease); - medge->bweight= (char)(255.0*eed->bweight); + medge->crease= (char)(255.0f*eed->crease); + medge->bweight= (char)(255.0f*eed->bweight); CustomData_from_em_block(&em->edata, &me->edata, eed->data, a); eed->tmp.l = a++; @@ -1663,7 +1659,7 @@ static void *editMesh_to_undoMesh(void *emv) evec->h= eve->h; evec->keyindex= eve->keyindex; eve->tmp.l = a; /*store index*/ - evec->bweight= (short)(eve->bweight*255.0); + evec->bweight= (short)(eve->bweight*255.0f); CustomData_from_em_block(&em->vdata, &um->vdata, eve->data, a); } @@ -1677,8 +1673,8 @@ static void *editMesh_to_undoMesh(void *emv) eedc->h= eed->h; eedc->seam= eed->seam; eedc->sharp= eed->sharp; - eedc->crease= (short)(eed->crease*255.0); - eedc->bweight= (short)(eed->bweight*255.0); + eedc->crease= (short)(eed->crease*255.0f); + eedc->bweight= (short)(eed->bweight*255.0f); eedc->fgoni= eed->fgoni; eed->tmp.l = a; /*store index*/ CustomData_from_em_block(&em->edata, &um->edata, eed->data, a); diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 3a9859cefcb..bd094211270 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -1099,9 +1099,9 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se phi= 0; phid/=2; for(a=0; a<=tot; a++) { - vec[0]= dia*sin(phi); + vec[0]= dia*sinf(phi); vec[1]= 0.0; - vec[2]= dia*cos(phi); + vec[2]= dia*cosf(phi); eve= addvertlist(em, vec, NULL); eve->f= 1+2+4; if(a==0) v1= eve; @@ -1226,8 +1226,8 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se for(b=0; b<=ext; b++) { for(a=0; a<tot; a++) { - vec[0]= dia*sin(phi); - vec[1]= dia*cos(phi); + vec[0]= dia*sinf(phi); + vec[1]= dia*cosf(phi); vec[2]= b?depth:-depth; mul_m4_v3(mat, vec); diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index db990e033df..e63ce98c1b0 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -353,8 +353,8 @@ void EM_editselection_plane(float *plane, EditSelection *ese) we cant make a crossvec from a vec thats the same as the vec unlikely but possible, so make sure if the normal is (0,0,1) that vec isnt the same or in the same direction even.*/ - if (eve->no[0]<0.5) vec[0]=1; - else if (eve->no[1]<0.5) vec[1]=1; + if (eve->no[0]<0.5f) vec[0]=1; + else if (eve->no[1]<0.5f) vec[1]=1; else vec[2]=1; cross_v3_v3v3(plane, eve->no, vec); } @@ -1206,7 +1206,7 @@ short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor) if(eed->v1->f & eed->v2->f & flag) eed->f |= flag; } - if(nor[0]==0.0 && nor[1]==0.0 && nor[2]==0.0) return 'g'; // g is grab + if(is_zero_v3(nor)) return 'g'; // g is grab return 'n'; // n is for normal constraint } @@ -1328,18 +1328,18 @@ static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag), } if (mmd->flag & MOD_MIR_AXIS_X) - if ( (fabs(co1[0]) < mmd->tolerance) && - (fabs(co2[0]) < mmd->tolerance) ) + if ( (fabsf(co1[0]) < mmd->tolerance) && + (fabsf(co2[0]) < mmd->tolerance) ) ++eed->f2; if (mmd->flag & MOD_MIR_AXIS_Y) - if ( (fabs(co1[1]) < mmd->tolerance) && - (fabs(co2[1]) < mmd->tolerance) ) + if ( (fabsf(co1[1]) < mmd->tolerance) && + (fabsf(co2[1]) < mmd->tolerance) ) ++eed->f2; if (mmd->flag & MOD_MIR_AXIS_Z) - if ( (fabs(co1[2]) < mmd->tolerance) && - (fabs(co2[2]) < mmd->tolerance) ) + if ( (fabsf(co1[2]) < mmd->tolerance) && + (fabsf(co2[2]) < mmd->tolerance) ) ++eed->f2; } } @@ -1485,7 +1485,7 @@ static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag), EM_select_flush(em); - if(nor[0]==0.0 && nor[1]==0.0 && nor[2]==0.0) return 'g'; // grab + if(is_zero_v3(nor)) return 'g'; // grab return 'n'; // normal constraint } @@ -1612,17 +1612,17 @@ short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor, int } if (mmd->flag & MOD_MIR_AXIS_X) - if ( (fabs(co1[0]) < mmd->tolerance) && - (fabs(co2[0]) < mmd->tolerance) ) + if ( (fabsf(co1[0]) < mmd->tolerance) && + (fabsf(co2[0]) < mmd->tolerance) ) ++eed->f2; if (mmd->flag & MOD_MIR_AXIS_Y) - if ( (fabs(co1[1]) < mmd->tolerance) && - (fabs(co2[1]) < mmd->tolerance) ) + if ( (fabsf(co1[1]) < mmd->tolerance) && + (fabsf(co2[1]) < mmd->tolerance) ) ++eed->f2; if (mmd->flag & MOD_MIR_AXIS_Z) - if ( (fabs(co1[2]) < mmd->tolerance) && - (fabs(co2[2]) < mmd->tolerance) ) + if ( (fabsf(co1[2]) < mmd->tolerance) && + (fabsf(co2[2]) < mmd->tolerance) ) ++eed->f2; } } @@ -1774,7 +1774,7 @@ short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor, int // since its vertex select mode now, it also deselects higher order EM_selectmode_flush(em); - if(nor[0]==0.0 && nor[1]==0.0 && nor[2]==0.0) return 'g'; // g is grab, for correct undo print + if(is_zero_v3(nor)) return 'g'; // g is grab, for correct undo print return 'n'; } @@ -2367,7 +2367,7 @@ UvVertMap *EM_make_uv_vert_map(EditMesh *em, int selected, int do_face_idx_array sub_v2_v2v2(uvdiff, uv2, uv); - if(fabs(uv[0]-uv2[0]) < limit[0] && fabs(uv[1]-uv2[1]) < limit[1]) { + if(fabsf(uv[0]-uv2[0]) < limit[0] && fabsf(uv[1]-uv2[1]) < limit[1]) { if(lastv) lastv->next= next; else vlist= next; iterv->next= newvlist; diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index a6f05b8c2f6..375ec474382 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -735,7 +735,7 @@ static EnumPropertyItem prop_similar_types[] = { /* this as a way to compare the ares, perim of 2 faces thay will scale to different sizes *0.5 so smaller faces arnt ALWAYS selected with a thresh of 1.0 */ -#define SCALE_CMP(a,b) ((a+a*thresh >= b) && (a-(a*thresh*0.5) <= b)) +#define SCALE_CMP(a,b) ((a+a*thresh >= b) && (a-(a*thresh*0.5f) <= b)) static int similar_face_select__internal(EditMesh *em, int mode, float thresh) { @@ -828,8 +828,8 @@ static int similar_face_select__internal(EditMesh *em, int mode, float thresh) float angle; for(efa= em->faces.first; efa; efa= efa->next) { if (!(efa->f & SELECT) && !efa->h) { - angle= RAD2DEG(angle_v2v2(base_efa->n, efa->n)); - if (angle/180.0<=thresh) { + angle= RAD2DEGF(angle_v2v2(base_efa->n, efa->n)); + if (angle/180.0f<=thresh) { EM_select_face(efa, 1); selcount++; deselcount--; @@ -843,10 +843,10 @@ static int similar_face_select__internal(EditMesh *em, int mode, float thresh) base_dot= dot_v3v3(base_efa->cent, base_efa->n); for(efa= em->faces.first; efa; efa= efa->next) { if (!(efa->f & SELECT) && !efa->h) { - angle= RAD2DEG(angle_v2v2(base_efa->n, efa->n)); - if (angle/180.0<=thresh) { + angle= RAD2DEGF(angle_v2v2(base_efa->n, efa->n)); + if (angle/180.0f<=thresh) { dot=dot_v3v3(efa->cent, base_efa->n); - if (fabs(base_dot-dot) <= thresh) { + if (fabsf(base_dot-dot) <= thresh) { EM_select_face(efa, 1); selcount++; deselcount--; @@ -960,7 +960,7 @@ static int similar_edge_select__internal(EditMesh *em, int mode, float thresh) else if (eed->f2==0) /* first access, assign the face */ eed->tmp.f= efa; else if (eed->f2==1) /* second, we assign the angle*/ - eed->tmp.fp= RAD2DEG(angle_v2v2(eed->tmp.f->n, efa->n))/180; + eed->tmp.fp= RAD2DEGF(angle_v2v2(eed->tmp.f->n, efa->n))/180; eed->f2++; /* f2==0 no face assigned. f2==1 one face found. f2==2 angle calculated.*/ } j++; @@ -990,12 +990,12 @@ static int similar_edge_select__internal(EditMesh *em, int mode, float thresh) for(eed= em->edges.first; eed; eed= eed->next) { if (!(eed->f & SELECT) && !eed->h) { sub_v3_v3v3(dir, eed->v1->co, eed->v2->co); - angle= RAD2DEG(angle_v2v2(base_dir, dir)); + angle= RAD2DEGF(angle_v2v2(base_dir, dir)); - if (angle>90) /* use the smallest angle between the edges */ - angle= fabs(angle-180.0f); + if (angle>90.0f) /* use the smallest angle between the edges */ + angle= fabsf(angle-180.0f); - if (angle/90.0<=thresh) { + if (angle / 90.0f<=thresh) { EM_select_edge(eed, 1); selcount++; deselcount--; @@ -1024,7 +1024,7 @@ static int similar_edge_select__internal(EditMesh *em, int mode, float thresh) !(eed->f & SELECT) && !eed->h && eed->f2==2 && - (fabs(base_eed->tmp.fp-eed->tmp.fp)<=thresh) + (fabsf(base_eed->tmp.fp-eed->tmp.fp)<=thresh) ) { EM_select_edge(eed, 1); selcount++; @@ -1038,7 +1038,7 @@ static int similar_edge_select__internal(EditMesh *em, int mode, float thresh) if ( !(eed->f & SELECT) && !eed->h && - (fabs(base_eed->crease-eed->crease) <= thresh) + (fabsf(base_eed->crease-eed->crease) <= thresh) ) { EM_select_edge(eed, 1); selcount++; @@ -1160,8 +1160,8 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op) float angle; for(eve= em->verts.first; eve; eve= eve->next) { if (!(eve->f & SELECT) && !eve->h) { - angle= RAD2DEG(angle_v2v2(base_eve->no, eve->no)); - if (angle/180.0<=thresh) { + angle= RAD2DEGF(angle_v2v2(base_eve->no, eve->no)); + if (angle/180.0f<=thresh) { eve->f |= SELECT; selcount++; deselcount--; @@ -2971,7 +2971,7 @@ static int select_sharp_edges_exec(bContext *C, wmOperator *op) } sharpness= RNA_float_get(op->ptr, "sharpness"); - fsharpness = ((180.0 - sharpness) * M_PI) / 180.0; + fsharpness = ((180.0f - sharpness) * (float)M_PI) / 180.0f; /* count edges, use tmp.l */ eed= em->edges.first; @@ -3031,7 +3031,7 @@ static int select_sharp_edges_exec(bContext *C, wmOperator *op) angle = saacos(efa1[i]->n[0]*efa2[i]->n[0] + efa1[i]->n[1]*efa2[i]->n[1] + efa1[i]->n[2]*efa2[i]->n[2]); - if (fabs(angle) >= fsharpness) + if (fabsf(angle) >= fsharpness) EM_select_edge(eed, 1); } } @@ -3087,7 +3087,7 @@ static void select_linked_flat_faces(EditMesh *em, wmOperator *op, float sharpne return; } - fsharpness = ((180.0 - sharpness) * M_PI) / 180.0; + fsharpness = ((180.0f - sharpness) * (float)M_PI) / 180.0f; i=0; /* count edges, use tmp.l */ @@ -3153,7 +3153,7 @@ static void select_linked_flat_faces(EditMesh *em, wmOperator *op, float sharpne efa1[i]->n[1]*efa2[i]->n[1] + efa1[i]->n[2]*efa2[i]->n[2]); /* invalidate: edge too sharp */ - if (fabs(angle) >= fsharpness) + if (fabsf(angle) >= fsharpness) eed->tmp.l = -1; } else { @@ -3937,10 +3937,10 @@ void EM_recalc_normal_direction(EditMesh *em, int inside, int select) /* makes f } /* first normal is oriented this way or the other */ if(inside) { - if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] > 0.0) flipface(em, startvl); + if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] > 0.0f) flipface(em, startvl); } else { - if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] < 0.0) flipface(em, startvl); + if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] < 0.0f) flipface(em, startvl); } eed= startvl->e1; @@ -4136,15 +4136,15 @@ static int smooth_vertex(bContext *C, wmOperator *op) switch(mmd->axis){ case 0: - if (fabs(eve->co[0]) < mmd->tolerance) + if (fabsf(eve->co[0]) < mmd->tolerance) eve->f2 |= 1; break; case 1: - if (fabs(eve->co[1]) < mmd->tolerance) + if (fabsf(eve->co[1]) < mmd->tolerance) eve->f2 |= 2; break; case 2: - if (fabs(eve->co[2]) < mmd->tolerance) + if (fabsf(eve->co[2]) < mmd->tolerance) eve->f2 |= 4; break; } @@ -4157,9 +4157,7 @@ static int smooth_vertex(bContext *C, wmOperator *op) eed= em->edges.first; while(eed) { if( (eed->v1->f & SELECT) || (eed->v2->f & SELECT) ) { - fvec[0]= (eed->v1->co[0]+eed->v2->co[0])/2.0; - fvec[1]= (eed->v1->co[1]+eed->v2->co[1])/2.0; - fvec[2]= (eed->v1->co[2]+eed->v2->co[2])/2.0; + mid_v3_v3v3(fvec, eed->v1->co, eed->v2->co); if((eed->v1->f & SELECT) && eed->v1->f1<255) { eed->v1->f1++; @@ -4188,14 +4186,14 @@ static int smooth_vertex(bContext *C, wmOperator *op) } adr = eve->tmp.p; - fac= 0.5/(float)eve->f1; + fac= 0.5f/(float)eve->f1; if(xaxis) - eve->co[0]= 0.5*eve->co[0]+fac*adr[0]; + eve->co[0]= 0.5f*eve->co[0]+fac*adr[0]; if(yaxis) - eve->co[1]= 0.5*eve->co[1]+fac*adr[1]; + eve->co[1]= 0.5f*eve->co[1]+fac*adr[1]; if(zaxis) - eve->co[2]= 0.5*eve->co[2]+fac*adr[2]; + eve->co[2]= 0.5f*eve->co[2]+fac*adr[2]; /* clip if needed by mirror modifier */ @@ -4290,7 +4288,7 @@ static int mesh_noise_exec(bContext *C, wmOperator *op) if(tex->type==TEX_STUCCI) { float b2, vec[3]; - float ofs= tex->turbul/200.0; + float ofs= tex->turbul/200.0f; for(eve= em->verts.first; eve; eve= eve->next) { if(eve->f & SELECT) { b2= BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 40387b82205..eb0eb1833a6 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -980,7 +980,7 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float cent[2]-= obedit->obmat[3][2]; mul_m3_v3(imat, cent); - phi= degr*M_PI/360.0; + phi= degr*(float)M_PI/360.0f; phi/= steps; if(ts->editbutflag & B_CLOCKWISE) phi= -phi; @@ -1144,10 +1144,8 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) VECCOPY(nor, obedit->obmat[2]); - if(nor[0]*dvec[0]+nor[1]*dvec[1]+nor[2]*dvec[2]>0.000) { - dvec[0]= -dvec[0]; - dvec[1]= -dvec[1]; - dvec[2]= -dvec[2]; + if(nor[0]*dvec[0]+nor[1]*dvec[1]+nor[2]*dvec[2]>0.0f) { + negate_v3(dvec); } if(spin_mesh(C, op, dvec, turns*steps, 360.0f*turns, 0)) { @@ -1476,7 +1474,7 @@ static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int vec1[2]+= fac*nor2[2]; /* falloff for multi subdivide */ - smooth *= sqrt(fabs(1.0f - 2.0f*fabs(0.5f-perc))); + smooth *= sqrtf(fabs(1.0f - 2.0f*fabsf(0.5f-perc))); vec1[0]*= smooth*len; vec1[1]*= smooth*len; @@ -2675,15 +2673,15 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float eve->f2= 0; switch(mmd->axis){ case 0: - if (fabs(eve->co[0]) < mmd->tolerance) + if (fabsf(eve->co[0]) < mmd->tolerance) eve->f2 |= 1; break; case 1: - if (fabs(eve->co[1]) < mmd->tolerance) + if (fabsf(eve->co[1]) < mmd->tolerance) eve->f2 |= 2; break; case 2: - if (fabs(eve->co[2]) < mmd->tolerance) + if (fabsf(eve->co[2]) < mmd->tolerance) eve->f2 |= 4; break; } @@ -3226,13 +3224,13 @@ static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert normal_tri_v3( noA2,v1->co, v3->co, v4->co); if(noA1[0] == noA2[0] && noA1[1] == noA2[1] && noA1[2] == noA2[2]) normalADiff = 0.0; - else normalADiff = RAD2DEG(angle_v2v2(noA1, noA2)); + else normalADiff = RAD2DEGF(angle_v2v2(noA1, noA2)); //if(!normalADiff) normalADiff = 179; normal_tri_v3( noB1,v2->co, v3->co, v4->co); normal_tri_v3( noB2,v4->co, v1->co, v2->co); if(noB1[0] == noB2[0] && noB1[1] == noB2[1] && noB1[2] == noB2[2]) normalBDiff = 0.0; - else normalBDiff = RAD2DEG(angle_v2v2(noB1, noB2)); + else normalBDiff = RAD2DEGF(angle_v2v2(noB1, noB2)); //if(!normalBDiff) normalBDiff = 179; measure += (normalADiff/360) + (normalBDiff/360); @@ -3247,10 +3245,10 @@ static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert diff = 0.0; diff = ( - fabs(RAD2DEG(angle_v2v2(edgeVec1, edgeVec2)) - 90) + - fabs(RAD2DEG(angle_v2v2(edgeVec2, edgeVec3)) - 90) + - fabs(RAD2DEG(angle_v2v2(edgeVec3, edgeVec4)) - 90) + - fabs(RAD2DEG(angle_v2v2(edgeVec4, edgeVec1)) - 90)) / 360; + fabsf(RAD2DEGF(angle_v2v2(edgeVec1, edgeVec2)) - 90) + + fabsf(RAD2DEGF(angle_v2v2(edgeVec2, edgeVec3)) - 90) + + fabsf(RAD2DEGF(angle_v2v2(edgeVec3, edgeVec4)) - 90) + + fabsf(RAD2DEGF(angle_v2v2(edgeVec4, edgeVec1)) - 90)) / 360; if(!diff) return 0.0; measure += diff; @@ -3272,7 +3270,7 @@ static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert return measure; } -#define T2QUV_LIMIT 0.005 +#define T2QUV_LIMIT 0.005f #define T2QCOL_LIMIT 3 static int compareFaceAttribs(EditMesh *em, EditFace *f1, EditFace *f2, EditEdge *eed) { diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 9f79a959ed5..17e7b1b5b18 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -389,7 +389,6 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa DriverTarget *dtar= &dvar->targets[0]; PointerRNA dtar_ptr; uiLayout *row, *col; - uiBlock *block; /* initialise RNA pointer to the target */ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); @@ -407,9 +406,8 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa RNA_id_pointer_create(dtar->id, &root_ptr); col= uiLayoutColumn(layout, 1); - block= uiLayoutGetBlock(col); - /* rna path */ - uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, "Path"); + /* rna path */ + uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, "Path"); } } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 4277a7e85e3..b404a7be27c 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1214,7 +1214,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa) View3D *v3d= CTX_wm_view3d(C); //uiBut *bt; Object *ob= OBACT; - TransformProperties *tfp; + // TransformProperties *tfp; // UNUSED PointerRNA obptr; uiLayout *col, *row; float lim; @@ -1222,12 +1222,13 @@ static void view3d_panel_object(const bContext *C, Panel *pa) if(ob==NULL) return; /* make sure we got storage */ + /* if(v3d->properties_storage==NULL) v3d->properties_storage= MEM_callocN(sizeof(TransformProperties), "TransformProperties"); tfp= v3d->properties_storage; // XXX uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); - /* + if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) { } else { diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 4914020fc02..7d84a47bddf 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -563,7 +563,8 @@ static int flyApply(bContext *C, FlyInfo *fly) moffset[2], /* mouse offset from the views center */ tmp_quat[4]; /* used for rotating the view */ - int cent_orig[2], /* view center */ + int +// cent_orig[2], /* view center */ //XXX- can avoid using // cent[2], /* view center modified */ xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */ unsigned char @@ -582,8 +583,9 @@ static int flyApply(bContext *C, FlyInfo *fly) xmargin= ar->winx/20.0f; ymargin= ar->winy/20.0f; - cent_orig[0]= ar->winrct.xmin + ar->winx/2; - cent_orig[1]= ar->winrct.ymin + ar->winy/2; + // UNUSED + // cent_orig[0]= ar->winrct.xmin + ar->winx/2; + // cent_orig[1]= ar->winrct.ymin + ar->winy/2; { diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index a7317d18df1..ded89e8b66b 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -104,7 +104,7 @@ static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max) } /* epsilon for how close one end of shapekey range can get to the other */ -#define SHAPEKEY_SLIDER_TOL 0.001 +#define SHAPEKEY_SLIDER_TOL 0.001f static void rna_ShapeKey_slider_min_range(PointerRNA *ptr, float *min, float *max) { diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 5f274a09f5d..c689c4ae90a 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -138,13 +138,13 @@ static void rna_Lamp_sky_update(Main *bmain, Scene *scene, PointerRNA *ptr) static float rna_Lamp_spot_size_get(PointerRNA *ptr) { Lamp *la= ptr->id.data; - return la->spotsize * (M_PI / 180.0); + return DEG2RADF(la->spotsize); } static void rna_Lamp_spot_size_set(PointerRNA *ptr, float value) { Lamp *la= ptr->id.data; - la->spotsize= value * (180.0 / M_PI); + la->spotsize= RAD2DEGF(value); } @@ -649,7 +649,7 @@ static void rna_def_spot_lamp(BlenderRNA *brna) prop= RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_ANGLE); // RNA_def_property_float_sdna(prop, NULL, "spotsize"); - RNA_def_property_range(prop, M_PI/180.0f, M_PI); + RNA_def_property_range(prop, M_PI/180.0, M_PI); RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam in degrees"); RNA_def_property_float_funcs(prop, "rna_Lamp_spot_size_get", "rna_Lamp_spot_size_set", NULL); /* only for deg/rad conversion */ RNA_def_property_update(prop, 0, "rna_Lamp_draw_update"); diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index a921bbbafad..719cc6755d6 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -163,7 +163,7 @@ static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value) len= data->end - data->start; actlen= data->actend - data->actstart; - if (IS_EQ(actlen, 0.0f)) actlen= 1.0f; + if (IS_EQF(actlen, 0.0f)) actlen= 1.0f; /* now, adjust the 'scale' setting to reflect this (so that this change can be valid) */ data->scale= len / ((actlen) * data->repeat); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 1531b6a9dc0..c22809c6b22 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -505,7 +505,7 @@ static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, floa if(settings->type==PART_HAIR) { *min = 0.0f; - *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0; + *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f; } else { *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f; diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index ca3852c0fd0..10c784b51e7 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -734,12 +734,12 @@ static int rna_enum_check_separator(CollectionPropertyIterator *iter, void *data static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; - EnumPropertyRNA *eprop; + // EnumPropertyRNA *eprop; // UNUSED EnumPropertyItem *item= NULL; int totitem, free= 0; rna_idproperty_check(&prop, ptr); - eprop= (EnumPropertyRNA*)prop; + // eprop= (EnumPropertyRNA*)prop; RNA_property_enum_items(NULL, ptr, prop, &item, &totitem, &free); rna_iterator_array_begin(iter, (void*)item, sizeof(EnumPropertyItem), totitem, free, rna_enum_check_separator); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 0d1463428bb..ea26663df44 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -918,8 +918,8 @@ static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void * int idlen = strlen(_operator_idname) + 4; int namelen = strlen(_operator_name) + 1; int desclen = strlen(_operator_descr) + 1; - char *ch, *ch_arr; - ch_arr= ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ + char *ch; + ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */ dummyot.idname= ch; ch += idlen; @@ -985,8 +985,8 @@ static StructRNA *rna_MacroOperator_register(bContext *C, ReportList *reports, v int idlen = strlen(_operator_idname) + 4; int namelen = strlen(_operator_name) + 1; int desclen = strlen(_operator_descr) + 1; - char *ch, *ch_arr; - ch_arr= ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ + char *ch; + ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */ dummyot.idname= ch; ch += idlen; |