diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-18 06:35:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-18 06:35:26 +0400 |
commit | 96ada15d7940a72744dc1a63f13dbd9383b42a11 (patch) | |
tree | 4e5527c0be1706fa28f715305d7f5b8eea4379ae /source/blender/editors | |
parent | 1b5d16f1bf80f2da8d3d4da5bbfaf4819c14a225 (diff) | |
parent | 5db33d11bd569f4040fd58e4f39cf97ed94fec29 (diff) |
svn merge -r40197:40311 ^/trunk/blender
Diffstat (limited to 'source/blender/editors')
36 files changed, 218 insertions, 155 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 70974386917..d2b1fcc4abd 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -404,9 +404,9 @@ float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short res /* if the radians flag is not set, default to using degrees which need conversions */ if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) { if (restore) - return M_PI / 180.0; /* degrees to radians */ + return DEG2RADF(1.0f); /* degrees to radians */ else - return 180.0 / M_PI; /* radians to degrees */ + return RAD2DEGF(1.0f); /* radians to degrees */ } } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index bb710a32794..bd5935c893c 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -893,7 +893,7 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner */ static short skip_fcurve_with_name (bDopeSheet *ads, FCurve *fcu, ID *owner_id) { - bAnimListElem ale_dummy = {0}; + bAnimListElem ale_dummy = {NULL}; bAnimChannelType *acf; /* create a dummy wrapper for the F-Curve */ diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 2305848e7b3..fa619e4cf44 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -204,8 +204,8 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o int filter; int ret=0; - bAnimListElem dummychan = {0}; - Base dummybase = {0}; + bAnimListElem dummychan = {NULL}; + Base dummybase = {NULL}; if (ob == NULL) return 0; @@ -249,7 +249,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene int filter; int ret=0; - bAnimListElem dummychan = {0}; + bAnimListElem dummychan = {NULL}; if (sce == NULL) return 0; diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 80a7e703474..9a6be695555 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -361,7 +361,7 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist) print_m4("premat", premat); print_m4("postmat", postmat); print_m4("difmat", difmat); - printf ("Roll = %f\n", (-atan2(difmat[2][0], difmat[2][2]) * (180.0/M_PI))); + printf ("Roll = %f\n", RAD2DEGF(-atan2(difmat[2][0], difmat[2][2]))); #endif curBone->roll = (float)-atan2(difmat[2][0], difmat[2][2]); diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 6e64d332cfd..67c93c4c906 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -1439,9 +1439,7 @@ static void poselib_preview_init_data (bContext *C, wmOperator *op) pld->pose->flag &= ~POSE_DO_UNLOCK; /* clear strings + search */ - strcpy(pld->headerstr, ""); - strcpy(pld->searchstr, ""); - strcpy(pld->searchold, ""); + pld->headerstr[0]= pld->searchstr[0]= pld->searchold[0]= '\0'; pld->search_cursor= 0; } diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index adf4f0fac2e..6b85523ac82 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -46,6 +46,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_curve.h" #include "ED_object.h" #include "ED_screen.h" #include "ED_transform.h" diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index a23f2064a9e..da3310ae883 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1878,7 +1878,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) static EnumPropertyItem prop_gpencil_drawmodes[] = { {GP_PAINTMODE_DRAW, "DRAW", 0, "Draw Freehand", ""}, {GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", ""}, - {GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Dtaw Poly Line", ""}, + {GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", ""}, {GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 0dee7a3813a..abc668d72dd 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -58,6 +58,7 @@ #include "UI_interface.h" +#include "IMB_imbuf.h" #include "WM_api.h" #include "WM_types.h" @@ -1894,6 +1895,8 @@ static void ui_free_but(const bContext *C, uiBut *but) if(but->str && but->str != but->strdata) MEM_freeN(but->str); ui_free_link(but->link); + if((but->type == BUT_IMAGE) && but->poin) IMB_freeImBuf((struct ImBuf *)but->poin); + MEM_freeN(but); } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 33aeb2df926..a1275e237c1 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -461,19 +461,14 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel) /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ -void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect) +void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) { #ifdef WITH_HEADLESS (void)rect; #else - extern char datatoc_splash_png[]; - extern int datatoc_splash_png_size; - ImBuf *ibuf; + ImBuf *ibuf= (ImBuf *)but->poin; //GLint scissor[4]; //int w, h; - - /* hardcoded to splash, loading and freeing every draw, eek! */ - ibuf= IMB_ibImageFromMemory((unsigned char*)datatoc_splash_png, datatoc_splash_png_size, IB_rect); if (!ibuf) return; @@ -501,7 +496,6 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors * glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); */ - IMB_freeImBuf(ibuf); #endif } @@ -959,13 +953,13 @@ static float polar_to_y(float center, float diam, float ampli, float angle) return center + diam * ampli * sinf(angle); } -static void vectorscope_draw_target(float centerx, float centery, float diam, float r, float g, float b) +static void vectorscope_draw_target(float centerx, float centery, float diam, const float colf[3]) { float y,u,v; float tangle=0.f, tampli; float dangle, dampli, dangle2, dampli2; - rgb_to_yuv(r,g,b, &y, &u, &v); + rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v); if (u>0 && v>=0) tangle=atanf(v/u); else if (u>0 && v<0) tangle= atanf(v/u) + 2.0f * (float)M_PI; else if (u<0) tangle=atanf(v/u) + (float)M_PI; @@ -975,7 +969,7 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl /* small target vary by 2.5 degree and 2.5 IRE unit */ glColor4f(1.0f, 1.0f, 1.0, 0.12f); - dangle= 2.5f*(float)M_PI/180.0f; + dangle= DEG2RADF(2.5f); dampli= 2.5f/200.0f; glBegin(GL_LINE_STRIP); glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle)); @@ -986,9 +980,9 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl glEnd(); /* big target vary by 10 degree and 20% amplitude */ glColor4f(1.0f, 1.0f, 1.0, 0.12f); - dangle= 10.0f*(float)M_PI/180.0f; + dangle= DEG2RADF(10.0f); dampli= 0.2f*tampli; - dangle2= 5.0f*(float)M_PI/180.0f; + dangle2= DEG2RADF(5.0f); dampli2= 0.5f*dampli; glBegin(GL_LINE_STRIP); glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle+dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle+dangle)); @@ -1014,13 +1008,13 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { + const float skin_rad= DEG2RADF(123.0f); /* angle in radians of the skin tone line */ Scopes *scopes = (Scopes *)but->poin; rctf rect; int i, j; - int skina= 123; /* angle in degree of the skin tone line */ float w, h, centerx, centery, diam; float alpha; - float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}}; + const float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}}; GLint scissor[4]; rect.xmin = (float)recti->xmin+1; @@ -1056,19 +1050,19 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco for(j=0; j<5; j++) { glBegin(GL_LINE_STRIP); for(i=0; i<=360; i=i+15) { - float a= i*M_PI/180.0; - float r= (j+1)/10.0f; - glVertex2f( polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a)); + const float a= DEG2RADF((float)i); + const float r= (j+1)/10.0f; + glVertex2f(polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a)); } glEnd(); } /* skin tone line */ glColor4f(1.f, 0.4f, 0.f, 0.2f); - fdrawline( polar_to_x(centerx, diam, 0.5f, skina*M_PI/180.0), polar_to_y(centery,diam,0.5,skina*M_PI/180.0), - polar_to_x(centerx, diam, 0.1f, skina*M_PI/180.0), polar_to_y(centery,diam,0.1,skina*M_PI/180.0)); + fdrawline(polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery,diam,0.5,skin_rad), + polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery,diam,0.1,skin_rad)); /* saturation points */ for(i=0; i<6; i++) - vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]); + vectorscope_draw_target(centerx, centery, diam, colors[i]); if (scopes->ok && scopes->vecscope != NULL) { /* pixel point cloud */ diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index a55ee01202c..f31c16cd020 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1235,7 +1235,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, ysize= block->maxy - block->miny+4; /*aspect/= (float)xsize;*/ /*UNUSED*/ - if(but) { + { int left=0, right=0, top=0, down=0; int winx, winy; // int offscreen; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 8813b0027cd..17f174a5069 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -724,7 +724,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); ModifierData *md = edit_modifier_property_get(op, ob, 0); - int mode_orig = ob->mode; + int mode_orig = ob ? ob->mode : 0; if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_navmesh.cpp b/source/blender/editors/object/object_navmesh.cpp index d0768d30236..ae97b40eb49 100644 --- a/source/blender/editors/object/object_navmesh.cpp +++ b/source/blender/editors/object/object_navmesh.cpp @@ -575,7 +575,7 @@ static int findFreeNavPolyIndex(EditMesh* em) else if (indices[i]>freeIdx) break; } - delete indices; + delete [] indices; return freeIdx; } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index ef0f4ace2b8..8992dc81784 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -717,7 +717,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float * 1 : occluded 2 : occluded with w[3] weights set (need to know in some cases) */ -static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], float v3[3], float w[3], int is_ortho) +static int project_paint_occlude_ptv(float pt[3], float v1[4], float v2[4], float v3[4], float w[3], int is_ortho) { /* if all are behind us, return false */ if(v1[2] > pt[2] && v2[2] > pt[2] && v3[2] > pt[2]) @@ -749,7 +749,7 @@ static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], floa static int project_paint_occlude_ptv_clip( const ProjPaintState *ps, const MFace *mf, - float pt[3], float v1[3], float v2[3], float v3[3], + float pt[3], float v1[4], float v2[4], float v3[4], const int side ) { float w[3], wco[3]; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 9500c7f663c..767001ff163 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -447,9 +447,9 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) { /* brush rotation */ glTranslatef(0.5, 0.5, 0); - glRotatef((double)((brush->flag & BRUSH_RAKE) ? - sd->last_angle : sd->special_rotation) * (180.0/M_PI), - 0.0, 0.0, 1.0); + glRotatef((double)RAD2DEGF((brush->flag & BRUSH_RAKE) ? + sd->last_angle : sd->special_rotation), + 0.0, 0.0, 1.0); glTranslatef(-0.5f, -0.5f, 0); /* scale based on tablet pressure */ @@ -683,7 +683,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev /* TODO: as sculpt and other paint modes are unified, this separation will go away */ if(stroke->vc.obact->sculpt) { - float delta[3]; + float delta[2]; brush_jitter_pos(brush, mouse_in, mouse); @@ -691,13 +691,14 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev brush_jitter_pos isn't written in the best way to be reused here */ if(brush->flag & BRUSH_JITTER_PRESSURE) { - sub_v3_v3v3(delta, mouse, mouse_in); - mul_v3_fl(delta, pressure); - add_v3_v3v3(mouse, mouse_in, delta); + sub_v2_v2v2(delta, mouse, mouse_in); + mul_v2_fl(delta, pressure); + add_v2_v2v2(mouse, mouse_in, delta); } } - else - copy_v3_v3(mouse, mouse_in); + else { + copy_v2_v2(mouse, mouse_in); + } /* TODO: can remove the if statement once all modes have this */ if(stroke->get_location) diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 92bc60e8b77..0bdb027a903 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2996,7 +2996,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush) copy_v3_v3(cache->true_location, cache->orig_grab_location); sd->draw_anchored = 1; - copy_v3_v3(sd->anchored_initial_mouse, cache->initial_mouse); + copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse); sd->anchored_size = cache->pixel_radius; } } diff --git a/source/blender/editors/sound/sound_intern.h b/source/blender/editors/sound/sound_intern.h index b17ef99132f..cde0b3c4479 100644 --- a/source/blender/editors/sound/sound_intern.h +++ b/source/blender/editors/sound/sound_intern.h @@ -36,7 +36,5 @@ struct wmOperatorType; -void SOUND_OT_open(wmOperatorType *ot); - #endif /* ED_SOUND_INTERN_H */ diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 19cae6aa67d..60d665de94c 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -175,7 +175,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) return WM_operator_filesel(C, op, event); } -void SOUND_OT_open(wmOperatorType *ot) +static void SOUND_OT_open(wmOperatorType *ot) { /* identifiers */ ot->name= "Open Sound"; @@ -196,7 +196,7 @@ void SOUND_OT_open(wmOperatorType *ot) RNA_def_boolean(ot->srna, "mono", FALSE, "Mono", "Mixdown the sound to mono."); } -void SOUND_OT_open_mono(wmOperatorType *ot) +static void SOUND_OT_open_mono(wmOperatorType *ot) { /* identifiers */ ot->name= "Open Sound Mono"; @@ -659,7 +659,7 @@ static int update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void SOUND_OT_update_animation_flags(wmOperatorType *ot) +static void SOUND_OT_update_animation_flags(wmOperatorType *ot) { /* This operator is needed to set a correct state of the sound animation @@ -703,7 +703,7 @@ static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void SOUND_OT_bake_animation(wmOperatorType *ot) +static void SOUND_OT_bake_animation(wmOperatorType *ot) { /* identifiers */ ot->name= "Update animation cache"; diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index b5dfdcdc668..60662334e20 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -535,7 +535,7 @@ void ACTION_OT_paste (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys"); - RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merking pasted keys and existing"); + RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing"); } /* ******************** Insert Keyframes Operator ************************* */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index aa29e54f436..32594e710a4 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -580,7 +580,7 @@ void ACTION_OT_select_linked (wmOperatorType *ot) /* identifiers */ ot->name = "Select Linked"; ot->idname= "ACTION_OT_select_linked"; - ot->description = "Select keyframes occurring the same F-Curves as selected ones"; + ot->description = "Select keyframes occurring in the same F-Curves as selected ones"; /* api callbacks */ ot->exec= actkeys_select_linked_exec; diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 4707baa279b..51e2679e8c2 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -54,6 +54,14 @@ #include "console_intern.h" +/* so when we type - the view scrolls to the bottom */ +static void console_scroll_bottom(ARegion *ar) +{ + View2D *v2d= &ar->v2d; + v2d->cur.ymin = 0.0; + v2d->cur.ymax =(float)v2d->winy; +} + static void console_textview_update_rect(SpaceConsole *sc, ARegion *ar) { View2D *v2d= &ar->v2d; @@ -339,9 +347,14 @@ static int move_exec(bContext *C, wmOperator *op) } if(done) { - ED_area_tag_redraw(CTX_wm_area(C)); + ScrArea *sa= CTX_wm_area(C); + ARegion *ar= CTX_wm_region(C); + + ED_area_tag_redraw(sa); + console_scroll_bottom(ar); } - + + return OPERATOR_FINISHED; } @@ -391,7 +404,9 @@ static int insert_exec(bContext *C, wmOperator *op) console_textview_update_rect(sc, ar); ED_area_tag_redraw(CTX_wm_area(C)); - + + console_scroll_bottom(ar); + return OPERATOR_FINISHED; } @@ -478,6 +493,8 @@ static int delete_exec(bContext *C, wmOperator *op) console_textview_update_rect(sc, ar); ED_area_tag_redraw(CTX_wm_area(C)); + + console_scroll_bottom(ar); return OPERATOR_FINISHED; } @@ -589,6 +606,8 @@ static int history_cycle_exec(bContext *C, wmOperator *op) console_textview_update_rect(sc, ar); ED_area_tag_redraw(CTX_wm_area(C)); + console_scroll_bottom(ar); + return OPERATOR_FINISHED; } @@ -604,7 +623,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot) ot->poll= ED_operator_console_active; /* properties */ - RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "reverse cycle history"); + RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "Reverse cycle history"); } @@ -612,6 +631,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot) static int history_append_exec(bContext *C, wmOperator *op) { SpaceConsole *sc= CTX_wm_space_console(C); + ARegion *ar= CTX_wm_region(C); ScrArea *sa= CTX_wm_area(C); ConsoleLine *ci= console_history_verify(C); char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */ @@ -637,6 +657,8 @@ static int history_append_exec(bContext *C, wmOperator *op) ED_area_tag_redraw(sa); + console_scroll_bottom(ar); + return OPERATOR_FINISHED; } @@ -825,6 +847,8 @@ static int paste_exec(bContext *C, wmOperator *UNUSED(op)) console_textview_update_rect(sc, ar); ED_area_tag_redraw(CTX_wm_area(C)); + console_scroll_bottom(ar); + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index c8fa049f5eb..5a965fc076b 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -138,8 +138,17 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) wmKeyMap *keymap; ListBase *lb; + const int prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */ + UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); + /* always keep the bottom part of the view aligned, less annoying */ + if(prev_y_min != ar->v2d.cur.ymin) { + const float cur_y_range= ar->v2d.cur.ymax - ar->v2d.cur.ymin; + ar->v2d.cur.ymin= prev_y_min; + ar->v2d.cur.ymax= prev_y_min + cur_y_range; + } + /* own keymap */ keymap= WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 1b0893e50e0..43d5a5c9b4b 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -164,22 +164,26 @@ static FileSelect file_select_do(bContext* C, int selected_idx) SpaceFile *sfile= CTX_wm_space_file(C); FileSelectParams *params = ED_fileselect_get_params(sfile); int numfiles = filelist_numfiles(sfile->files); + struct direntry* file; /* make the selected file active */ - if ( (selected_idx >= 0) && (selected_idx < numfiles)) { - struct direntry* file = filelist_file(sfile->files, selected_idx); + if ( (selected_idx >= 0) && + (selected_idx < numfiles) && + (file= filelist_file(sfile->files, selected_idx))) + { params->active_file = selected_idx; - if(file && S_ISDIR(file->type)) { + if(S_ISDIR(file->type)) { /* the path is too long and we are not going up! */ - if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) - { + if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) { // XXX error("Path too long, cannot enter this directory"); - } else { - if (strcmp(file->relname, "..")==0) { - /* avoids /../../ */ - BLI_parent_dir(params->dir); - } else { + } + else { + if (strcmp(file->relname, "..")==0) { + /* avoids /../../ */ + BLI_parent_dir(params->dir); + } + else { BLI_cleanup_dir(G.main->name, params->dir); strcat(params->dir, file->relname); BLI_add_slash(params->dir); @@ -189,8 +193,7 @@ static FileSelect file_select_do(bContext* C, int selected_idx) retval = FILE_SELECT_DIR; } } - else if (file) - { + else { if (file->relname) { BLI_strncpy(params->file, file->relname, FILE_MAXFILE); } diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 900aa6f6197..f115fd93c2e 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -763,7 +763,7 @@ void GRAPH_OT_paste (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys"); - RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merking pasted keys and existing"); + RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing"); } /* ******************** Duplicate Keyframes Operator ************************* */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index b8c5d79df18..40380db03d4 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -585,7 +585,7 @@ void GRAPH_OT_select_linked (wmOperatorType *ot) /* identifiers */ ot->name = "Select Linked"; ot->idname= "GRAPH_OT_select_linked"; - ot->description = "Select keyframes occurring the same F-Curves as selected ones"; + ot->description = "Select keyframes occurring in the same F-Curves as selected ones"; /* api callbacks */ ot->exec= graphkeys_select_linked_exec; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 9ea1e8ee877..cd521f7e8c7 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -97,7 +97,7 @@ static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v) } } -void node_socket_button_default(const bContext *C, uiBlock *block, +static void node_socket_button_default(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { @@ -135,7 +135,7 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v) return block; } -void node_socket_button_components(const bContext *C, uiBlock *block, +static void node_socket_button_components(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { @@ -157,7 +157,7 @@ void node_socket_button_components(const bContext *C, uiBlock *block, uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, ""); } -void node_socket_button_color(const bContext *C, uiBlock *block, +static void node_socket_button_color(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { @@ -179,7 +179,7 @@ void node_socket_button_color(const bContext *C, uiBlock *block, /* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */ -void node_draw_socket_new(bNodeSocket *sock, float size) +static void node_draw_socket_new(bNodeSocket *sock, float size) { float x=sock->locx, y=sock->locy; diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 357730aff39..65ce2e71d8d 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1008,6 +1008,10 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto UI_icon_draw(x, y, ICON_MOD_SOLIDIFY); break; case eModifierType_Screw: UI_icon_draw(x, y, ICON_MOD_SCREW); break; + case eModifierType_WeightVGEdit: + case eModifierType_WeightVGMix: + case eModifierType_WeightVGProximity: + UI_icon_draw(x, y, ICON_MOD_VERTEX_WEIGHT); break; default: UI_icon_draw(x, y, ICON_DOT); break; } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 05eace0d4ef..6172273f7e1 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -218,7 +218,7 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot) /* Rename --------------------------------------------------- */ -void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports) +static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports) { /* can't rename rna datablocks entries */ if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) @@ -765,7 +765,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so } else { /* pop up panel - no previous, or user didn't want search after previous */ - strcpy(name, ""); + name[0]= '\0'; // XXX if (sbutton(name, 0, sizeof(name)-1, "Find: ") && name[0]) { // te= outliner_find_named(soops, &soops->tree, name, flags, NULL, &prevFound); // } diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index b2fdd34aab2..efbfbd51fb5 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -342,7 +342,7 @@ static void singleuser_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement if (id) { IdAdtTemplate *iat = (IdAdtTemplate *)tsep->id; - PointerRNA ptr = {{0}}; + PointerRNA ptr = {{NULL}}; PropertyRNA *prop; RNA_pointer_create(&iat->id, &RNA_AnimData, iat->adt, &ptr); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 7e9eabc08db..0a1f7a3599d 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -473,7 +473,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a); ten->name= pchan->name; ten->directdata= pchan; - pchan->prev= (bPoseChannel *)ten; + pchan->temp= (void *)ten; if(pchan->constraints.first) { //Object *target; @@ -506,19 +506,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree pchan= (bPoseChannel *)ten->directdata; if(pchan->parent) { BLI_remlink(&tenla->subtree, ten); - par= (TreeElement *)pchan->parent->prev; + par= (TreeElement *)pchan->parent->temp; BLI_addtail(&par->subtree, ten); ten->parent= par; } } ten= nten; } - /* restore prev pointers */ - pchan= ob->pose->chanbase.first; - if(pchan) pchan->prev= NULL; - for(; pchan; pchan= pchan->next) { - if(pchan->next) pchan->next->prev= pchan; - } } /* Pose Groups */ @@ -775,7 +769,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor ebone->temp= ten; } /* make hierarchy */ - ten= te->subtree.first; + ten= arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp : NULL; while(ten) { TreeElement *nten= ten->next, *par; ebone= (EditBone *)ten->directdata; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index e7673651546..c3165adaf49 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -188,7 +188,7 @@ static void proxy_endjob(void *UNUSED(customdata)) } -void seq_proxy_build_job(const bContext *C, Sequence * seq) +static void seq_proxy_build_job(const bContext *C, Sequence * seq) { wmJob * steve; ProxyJob *pj; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7a10a7216d9..5bbc6a24761 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -259,7 +259,9 @@ static float cube[8][3] = { /* ----------------- OpenGL Circle Drawing - Tables for Optimised Drawing Speed ------------------ */ /* 32 values of sin function (still same result!) */ -static float sinval[32] = { +#define CIRCLE_RESOL 32 + +static const float sinval[CIRCLE_RESOL] = { 0.00000000, 0.20129852, 0.39435585, @@ -295,7 +297,7 @@ static float sinval[32] = { }; /* 32 values of cos function (still same result!) */ -static float cosval[32] ={ +static const float cosval[CIRCLE_RESOL] = { 1.00000000, 0.97952994, 0.91895781, @@ -613,28 +615,39 @@ static void draw_empty_image(Object *ob) glPopMatrix(); } -void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]) +static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3], float rad, float tmat[][4]) { - float vec[3], vx[3], vy[3]; - int a, tot=32; + float vx[3], vy[3]; + float *viter= (float *)verts; + unsigned int a; mul_v3_v3fl(vx, tmat[0], rad); mul_v3_v3fl(vy, tmat[1], rad); - glBegin(mode); - for(a=0; a<tot; a++) { - vec[0]= cent[0] + *(sinval+a) * vx[0] + *(cosval+a) * vy[0]; - vec[1]= cent[1] + *(sinval+a) * vx[1] + *(cosval+a) * vy[1]; - vec[2]= cent[2] + *(sinval+a) * vx[2] + *(cosval+a) * vy[2]; - glVertex3fv(vec); + for (a=0; a < CIRCLE_RESOL; a++, viter += 3) { + viter[0]= cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0]; + viter[1]= cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1]; + viter[2]= cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2]; } - glEnd(); +} + +void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]) +{ + float verts[CIRCLE_RESOL][3]; + + circball_array_fill(verts, cent, rad, tmat); + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, verts); + glDrawArrays(mode, 0, CIRCLE_RESOL); + glDisableClientState(GL_VERTEX_ARRAY); } /* circle for object centers, special_color is for library or ob users */ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3], int selstate, int special_color) { const float size= ED_view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f; + float verts[CIRCLE_RESOL][3]; /* using gldepthfunc guarantees that it does write z values, but not checks for it, so centers remain visible independt order of drawing */ if(v3d->zbuf) glDepthFunc(GL_ALWAYS); @@ -650,12 +663,25 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3], else if (selstate == SELECT) UI_ThemeColorShadeAlpha(TH_SELECT, 0, -80); else if (selstate == DESELECT) UI_ThemeColorShadeAlpha(TH_TRANSFORM, 0, -80); } - drawcircball(GL_POLYGON, co, size, rv3d->viewinv); - + + circball_array_fill(verts, co, size, rv3d->viewinv); + + /* enable vertex array */ + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, verts); + + /* 1. draw filled, blended polygon */ + glDrawArrays(GL_POLYGON, 0, CIRCLE_RESOL); + + /* 2. draw outline */ UI_ThemeColorShadeAlpha(TH_WIRE, 0, -30); - drawcircball(GL_LINE_LOOP, co, size, rv3d->viewinv); - + glDrawArrays(GL_LINE_LOOP, 0, CIRCLE_RESOL); + + /* finishe up */ + glDisableClientState(GL_VERTEX_ARRAY); + glDisable(GL_BLEND); + if(v3d->zbuf) glDepthFunc(GL_LEQUAL); } @@ -4587,16 +4613,22 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) { BezTriple *bezt; float *fp; - int basecol; int a; - + if(nu->hide || hide_handles) return; glBegin(GL_LINES); - + if(nu->type == CU_BEZIER) { - if(sel) basecol= TH_HANDLE_SEL_FREE; - else basecol= TH_HANDLE_FREE; + +#define TH_HANDLE_COL_TOT ((TH_HANDLE_SEL_FREE - TH_HANDLE_FREE) + 1) + /* use MIN2 when indexing to ensure newer files dont read outside the array */ + unsigned char handle_cols[TH_HANDLE_COL_TOT][3]; + const int basecol= sel ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE; + + for (a=0; a < TH_HANDLE_COL_TOT; a++) { + UI_GetThemeColor3ubv(basecol + a, handle_cols[a]); + } bezt= nu->bezt; a= nu->pntsu; @@ -4605,31 +4637,34 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) if( (bezt->f2 & SELECT)==sel) { fp= bezt->vec[0]; - UI_ThemeColor(basecol + bezt->h1); + glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]); glVertex3fv(fp); glVertex3fv(fp+3); - UI_ThemeColor(basecol + bezt->h2); + glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]); glVertex3fv(fp+3); glVertex3fv(fp+6); } else if( (bezt->f1 & SELECT)==sel) { fp= bezt->vec[0]; - UI_ThemeColor(basecol + bezt->h1); + glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]); glVertex3fv(fp); glVertex3fv(fp+3); } else if( (bezt->f3 & SELECT)==sel) { fp= bezt->vec[1]; - UI_ThemeColor(basecol + bezt->h2); + glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]); glVertex3fv(fp); glVertex3fv(fp+3); } } bezt++; } + +#undef TH_HANDLE_COL_TOT + } glEnd(); } @@ -5097,7 +5132,7 @@ static void curve_draw_speed(Scene *scene, Object *ob) #endif // XXX old animation system stuff -static void draw_textcurs(float textcurs[][2]) +static void draw_textcurs(float textcurs[4][2]) { cpack(0); @@ -5114,12 +5149,13 @@ static void draw_textcurs(float textcurs[][2]) static void drawspiral(const float cent[3], float rad, float tmat[][4], int start) { float vec[3], vx[3], vy[3]; - int a, tot=32; - char inverse=0; - + const float tot_inv= (1.0f / (float)CIRCLE_RESOL); + int a; + char inverse= FALSE; + if (start < 0) { - inverse = 1; - start *= -1; + inverse = TRUE; + start= -start; } mul_v3_v3fl(vx, tmat[0], rad); @@ -5128,31 +5164,31 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star copy_v3_v3(vec, cent); if (inverse==0) { - for(a=0; a<tot; a++) { + for(a=0; a<CIRCLE_RESOL; a++) { if (a+start>31) start=-a + 1; glBegin(GL_LINES); glVertex3fv(vec); - vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)a/(float)tot) + *(cosval+a+start) * (vy[0] * (float)a/(float)tot); - vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)a/(float)tot) + *(cosval+a+start) * (vy[1] * (float)a/(float)tot); - vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)a/(float)tot) + *(cosval+a+start) * (vy[2] * (float)a/(float)tot); + vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)a * tot_inv) + cosval[a+start] * (vy[0] * (float)a * tot_inv); + vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)a * tot_inv) + cosval[a+start] * (vy[1] * (float)a * tot_inv); + vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)a * tot_inv) + cosval[a+start] * (vy[2] * (float)a * tot_inv); glVertex3fv(vec); glEnd(); } } else { a=0; - vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot); - vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot); - vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot); - for(a=0; a<tot; a++) { + vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv); + vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv); + vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv); + for(a=0; a<CIRCLE_RESOL; a++) { if (a+start>31) start=-a + 1; glBegin(GL_LINES); glVertex3fv(vec); - vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot); - vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot); - vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot); + vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv); + vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv); + vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv); glVertex3fv(vec); glEnd(); } @@ -5170,9 +5206,9 @@ static void drawcircle_size(float size) glBegin(GL_LINE_LOOP); /* coordinates are: cos(degrees*11.25)=x, sin(degrees*11.25)=y, 0.0f=z */ - for (degrees=0; degrees<32; degrees++) { - x= *(cosval + degrees); - y= *(sinval + degrees); + for (degrees=0; degrees<CIRCLE_RESOL; degrees++) { + x= cosval[degrees]; + y= sinval[degrees]; glVertex3f(x*size, 0.0f, y*size); } @@ -5440,8 +5476,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d) unit_m4(tmat); - radius=(pd->flag&PFIELD_USEMAXR)?pd->maxrad:1.0f; - radius*=(float)M_PI/180.0f; + radius= DEG2RADF((pd->flag&PFIELD_USEMAXR) ? pd->maxrad : 1.0f); distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f; if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)){ @@ -5450,8 +5485,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d) drawcone(vec, distance * sinf(radius),-distance * cosf(radius),tmat); } - radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f; - radius*=(float)M_PI/180.0f; + radius= DEG2RADF((pd->flag&PFIELD_USEMINR) ? pd->minrad : 1.0f); distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f; if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)){ diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 50c587194b7..6c69e816b30 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -887,9 +887,9 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob) quat_to_eul( tfp->ob_eul,pchan->quat); else copy_v3_v3(tfp->ob_eul, pchan->eul); - tfp->ob_eul[0]*= 180.0/M_PI; - tfp->ob_eul[1]*= 180.0/M_PI; - tfp->ob_eul[2]*= 180.0/M_PI; + tfp->ob_eul[0]*= RAD2DEGF(1.0f); + tfp->ob_eul[1]*= RAD2DEGF(1.0f); + tfp->ob_eul[2]*= RAD2DEGF(1.0f); uiDefBut(block, LABEL, 0, "Location:", 0, 240, 100, 20, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); @@ -1097,9 +1097,9 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event if (!pchan) return; /* make a copy to eul[3], to allow TAB on buttons to work */ - eul[0]= (float)M_PI*tfp->ob_eul[0]/180.0f; - eul[1]= (float)M_PI*tfp->ob_eul[1]/180.0f; - eul[2]= (float)M_PI*tfp->ob_eul[2]/180.0f; + eul[0]= DEG2RADF(tfp->ob_eul[0]); + eul[1]= DEG2RADF(tfp->ob_eul[1]); + eul[2]= DEG2RADF(tfp->ob_eul[2]); if (pchan->rotmode == ROT_MODE_AXISANGLE) { float quat[4]; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 44ae6837aa2..c7feaebcddc 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -525,8 +525,8 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2] ED_view3d_win_to_vector(ar, mval, vec); copy_v3_v3(ray_start, rv3d->viewinv[3]); - VECADDFAC(ray_start, rv3d->viewinv[3], vec, v3d->near); - VECADDFAC(ray_end, rv3d->viewinv[3], vec, v3d->far); + madd_v3_v3v3fl(ray_start, rv3d->viewinv[3], vec, v3d->near); + madd_v3_v3v3fl(ray_end, rv3d->viewinv[3], vec, v3d->far); } else { float vec[4]; @@ -537,8 +537,8 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2] mul_m4_v4(rv3d->persinv, vec); - VECADDFAC(ray_start, vec, rv3d->viewinv[2], 1000.0f); - VECADDFAC(ray_end, vec, rv3d->viewinv[2], -1000.0f); + madd_v3_v3v3fl(ray_start, vec, rv3d->viewinv[2], 1000.0f); + madd_v3_v3v3fl(ray_end, vec, rv3d->viewinv[2], -1000.0f); } /* clipping */ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 82598e0b5c6..c8b95727304 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3371,10 +3371,10 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) { if(chainlen) sprintf(autoik, "AutoIK-Len: %d", chainlen); else - strcpy(autoik, ""); + autoik[0]= '\0'; } else - strcpy(autoik, ""); + autoik[0]= '\0'; if (t->con.mode & CON_APPLY) { switch(t->num.idx_max) { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b187ca0650c..38776b51c62 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1666,13 +1666,13 @@ void calculatePropRatio(TransInfo *t) strcpy(t->proptext, "(Random)"); break; default: - strcpy(t->proptext, ""); + t->proptext[0]= '\0'; } } else { for(i = 0 ; i < t->total; i++, td++) { td->factor = 1.0; } - strcpy(t->proptext, ""); + t->proptext[0]= '\0'; } } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 453bea0969b..d5a94c9b56a 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -275,7 +275,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac VECSUB2D(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4); /* This is the correct angle however we are only comparing angles - * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90);*/ + * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * RAD2DEGF(1.0f))-90);*/ uvang1 = angle_normalized_v2v2(av1, av2); uvang2 = angle_normalized_v2v2(av2, av3); uvang3 = angle_normalized_v2v2(av3, av4); @@ -288,7 +288,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac VECSUB(av4, efa->v3->co, efa->v4->co); normalize_v3(av4); /* This is the correct angle however we are only comparing angles - * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90);*/ + * ang1 = 90-((angle_normalized_v3v3(av1, av2) * RAD2DEGF(1.0f))-90);*/ ang1 = angle_normalized_v3v3(av1, av2); ang2 = angle_normalized_v3v3(av2, av3); ang3 = angle_normalized_v3v3(av3, av4); |