diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-01 14:14:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-01 14:14:09 +0400 |
commit | 1093f69e506e56e0bf605c44aefc34d6f9bc27fe (patch) | |
tree | d639e38ba6021c1e307bca0ba31a54f47a1fdec4 /source/blender/editors | |
parent | b6ec6e5ca54ae7d5747f7aa6412be1ab6103ce2d (diff) |
Style Cleanup
- duplicate cases in if/else
- calc inside sizeof(...)
- redundant NULL checks.
- assignment to self.
- fix error getting text prefix for screen ID button.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 14 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 14 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 9 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 8 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_input.c | 4 |
8 files changed, 44 insertions, 21 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index c9b5b9f2848..f9c97c36bdd 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1578,7 +1578,7 @@ void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, fl } -void ui_dropshadow(rctf *rct, float radius, float aspect, int select) +void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select)) { int i; float rad; @@ -1593,7 +1593,17 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int select) rad= radius; i= 12; - if(select) a= i*aspect; else a= i*aspect; +#if 0 + if(select) { + a= i*aspect; /* same as below */ + } + else +#endif + { + a= i*aspect; + + } + for(; i--; a-=aspect) { /* alpha ranges from 2 to 20 or so */ glColor4ub(0, 0, 0, alpha); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index cf11effc57b..ae5af185442 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2801,10 +2801,16 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton tempf= data->value; temp= (int)data->value; - - /* XXX useles "if", same result for f, uh??? */ - if(but->type==SLI) f= (float)(mx-but->x1)/(but->x2-but->x1); - else f= (float)(mx- but->x1)/(but->x2-but->x1); + +#if 0 + if(but->type==SLI) { + f= (float)(mx-but->x1)/(but->x2-but->x1); /* same as below */ + } + else +#endif + { + f= (float)(mx- but->x1)/(but->x2-but->x1); + } f= softmin + f*softrange; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index b5f980ab7cb..e2d7147d21f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1795,20 +1795,22 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) bDopeSheet ads= {NULL}; DLRBT_Tree keys; ActKeyColumn *ak; - float cfra= (scene)? (float)(CFRA) : 0.0f; + float cfra; short next= RNA_boolean_get(op->ptr, "next"); short done = 0; /* sanity checks */ if (scene == NULL) return OPERATOR_CANCELLED; - + + cfra= (float)(CFRA); + /* init binarytree-list for getting keyframes */ BLI_dlrbTree_init(&keys); /* populate tree with keyframe nodes */ - if (scene) - scene_to_keylist(&ads, scene, &keys, NULL); + scene_to_keylist(&ads, scene, &keys, NULL); + if (ob) ob_to_keylist(&ads, ob, &keys, NULL); @@ -1844,7 +1846,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) sound_seek_scene(C); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C)); + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index bf7501ae5ce..903af649caa 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -269,8 +269,6 @@ static int get_file_icon(struct direntry *file) return ICON_FILE_MOVIE; else if (file->flags & PYSCRIPTFILE) return ICON_FILE_SCRIPT; - else if (file->flags & PYSCRIPTFILE) - return ICON_FILE_SCRIPT; else if (file->flags & SOUNDFILE) return ICON_FILE_SOUND; else if (file->flags & FTFONTFILE) diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 0a8ae56c291..b097ad0f55e 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -797,8 +797,6 @@ int ED_file_extension_icon(char *relname) return ICON_FILE_MOVIE; else if (type == PYSCRIPTFILE) return ICON_FILE_SCRIPT; - else if (type == PYSCRIPTFILE) - return ICON_FILE_SCRIPT; else if (type == SOUNDFILE) return ICON_FILE_SOUND; else if (type == FTFONTFILE) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 5e227cba523..614b048e0b8 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -192,15 +192,18 @@ void projectIntView(TransInfo *t, float *vec, int *adr) UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1); } else if(t->spacetype == SPACE_ACTION) { - SpaceAction *sact = t->sa->spacedata.first; int out[2] = {0, 0}; +#if 0 + SpaceAction *sact = t->sa->spacedata.first; if (sact->flag & SACTION_DRAWTIME) { //vec[0] = vec[0]/((t->scene->r.frs_sec / t->scene->r.frs_sec_base)); - + /* same as below */ UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1); } - else { + else +#endif + { UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1); } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 5e960593bd7..6be095fa98b 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4811,10 +4811,16 @@ void special_aftertrans_update(bContext *C, TransInfo *t) */ if ((saction->flag & SACTION_MARKERS_MOVE) && (cancelled == 0)) { if (t->mode == TFM_TIME_TRANSLATE) { - if (ELEM(t->frame_side, 'L', 'R')) /* TFM_TIME_EXTEND */ +#if 0 + if (ELEM(t->frame_side, 'L', 'R')) { /* TFM_TIME_EXTEND */ + /* same as below */ ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->vec[0], t->frame_side); + } else /* TFM_TIME_TRANSLATE */ +#endif + { ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->vec[0], t->frame_side); + } } else if (t->mode == TFM_TIME_SCALE) { ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->vec[0], t->frame_side); diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 5097c12d785..b6c4deffe0a 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -235,8 +235,8 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2] /* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */ double deler = ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3)) - / (2.0 * (A*B?A*B:1.0)); - /* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */ + / (2.0 * ((A*B)?(A*B):1.0)); + /* ((A*B)?(A*B):1.0) this takes care of potential divide by zero errors */ float dphi; |