diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-03-25 12:20:19 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-03-25 12:20:19 +0400 |
commit | 3b711a6ed009b35bb69cd0ca878eeb8d55fa0e77 (patch) | |
tree | b3fdb366cb49bdea5b57dfa6ba4a82635c68d0ee /source/blender/editors/transform/transform.c | |
parent | a2ebfc82dbe954acc432ae017ac62a30a11b6a16 (diff) | |
parent | e99a23fc6b33b5097eab44aac19c2a089ddebce6 (diff) |
Merged changes in the trunk up to revision 45133.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/intern/bmesh_construct.c
source/blender/bmesh/intern/bmesh_mesh_conv.c
source/blender/bmesh/intern/bmesh_mesh_conv.h
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/resources.c
source/blender/editors/mesh/bmesh_select.c
source/blender/editors/mesh/bmesh_tools.c
source/blender/editors/space_view3d/drawobject.c
source/blender/render/intern/source/shadeoutput.c
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r-- | source/blender/editors/transform/transform.c | 441 |
1 files changed, 238 insertions, 203 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 43427d0dbe8..fe224398980 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -104,7 +104,7 @@ static int doEdgeSlide(TransInfo *t, float perc); void setTransformViewMatrices(TransInfo *t) { - if(t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { + if (t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { RegionView3D *rv3d = t->ar->regiondata; copy_m4_m4(t->viewmat, rv3d->viewmat); @@ -136,53 +136,53 @@ static void convertViewVec2D(View2D *v2d, float vec[3], int dx, int dy) vec[2]= 0.0f; } -void convertViewVec(TransInfo *t, float vec[3], int dx, int dy) +void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy) { if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) { float mval_f[2]; mval_f[0] = dx; mval_f[1] = dy; - ED_view3d_win_to_delta(t->ar, mval_f, vec); + ED_view3d_win_to_delta(t->ar, mval_f, r_vec); } - else if(t->spacetype==SPACE_IMAGE) { + else if (t->spacetype==SPACE_IMAGE) { float aspx, aspy; - convertViewVec2D(t->view, vec, dx, dy); + convertViewVec2D(t->view, r_vec, dx, dy); ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); - vec[0]*= aspx; - vec[1]*= aspy; + r_vec[0] *= aspx; + r_vec[1] *= aspy; } - else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) { - convertViewVec2D(t->view, vec, dx, dy); + else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) { + convertViewVec2D(t->view, r_vec, dx, dy); } - else if(ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) { - convertViewVec2D(&t->ar->v2d, vec, dx, dy); + else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) { + convertViewVec2D(&t->ar->v2d, r_vec, dx, dy); } - else if(t->spacetype==SPACE_CLIP) { + else if (t->spacetype==SPACE_CLIP) { View2D *v2d = t->view; float divx, divy; divx= v2d->mask.xmax-v2d->mask.xmin; divy= v2d->mask.ymax-v2d->mask.ymin; - vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx; - vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy; - vec[2]= 0.0f; + r_vec[0] = (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx; + r_vec[1] = (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy; + r_vec[2] = 0.0f; } else { printf("%s: called in an invalid context\n", __func__); - zero_v3(vec); + zero_v3(r_vec); } } -void projectIntView(TransInfo *t, float *vec, int *adr) +void projectIntView(TransInfo *t, const float vec[3], int adr[2]) { if (t->spacetype==SPACE_VIEW3D) { - if(t->ar->regiontype == RGN_TYPE_WINDOW) + if (t->ar->regiontype == RGN_TYPE_WINDOW) project_int_noclip(t->ar, vec, adr); } - else if(t->spacetype==SPACE_IMAGE) { + else if (t->spacetype==SPACE_IMAGE) { float aspx, aspy, v[2]; ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); @@ -191,7 +191,7 @@ 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) { + else if (t->spacetype == SPACE_ACTION) { int out[2] = {0, 0}; #if 0 SpaceAction *sact = t->sa->spacedata.first; @@ -210,45 +210,50 @@ void projectIntView(TransInfo *t, float *vec, int *adr) adr[0]= out[0]; adr[1]= out[1]; } - else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) { + else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) { int out[2] = {0, 0}; UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1); adr[0]= out[0]; adr[1]= out[1]; } - else if(t->spacetype==SPACE_SEQ) { /* XXX not tested yet, but should work */ + else if (t->spacetype==SPACE_SEQ) { /* XXX not tested yet, but should work */ int out[2] = {0, 0}; UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1); adr[0]= out[0]; adr[1]= out[1]; } - else if(t->spacetype==SPACE_CLIP) { + else if (t->spacetype==SPACE_CLIP) { UI_view2d_to_region_no_clip(t->view, vec[0], vec[1], adr, adr+1); } } -void projectFloatView(TransInfo *t, float *vec, float *adr) +void projectFloatView(TransInfo *t, const float vec[3], float adr[2]) { - if (t->spacetype==SPACE_VIEW3D) { - if(t->ar->regiontype == RGN_TYPE_WINDOW) - project_float_noclip(t->ar, vec, adr); - } - else if(ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) { - int a[2]; - - projectIntView(t, vec, a); - adr[0]= a[0]; - adr[1]= a[1]; + switch (t->spacetype) { + case SPACE_VIEW3D: + { + if (t->ar->regiontype == RGN_TYPE_WINDOW) { + project_float_noclip(t->ar, vec, adr); + return; + } + break; + } + case SPACE_IMAGE: + case SPACE_CLIP: + case SPACE_IPO: + case SPACE_NLA: + { + int a[2]; + projectIntView(t, vec, a); + adr[0] = a[0]; + adr[1] = a[1]; + return; + } } - else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) { - int a[2]; - projectIntView(t, vec, a); - adr[0]= a[0]; - adr[1]= a[1]; - } + zero_v2(adr); } void applyAspectRatio(TransInfo *t, float *vec) @@ -257,7 +262,7 @@ void applyAspectRatio(TransInfo *t, float *vec) SpaceImage *sima= t->sa->spacedata.first; float aspx, aspy; - if((sima->flag & SI_COORDFLOATS)==0) { + if ((sima->flag & SI_COORDFLOATS)==0) { int width, height; ED_space_image_size(sima, &width, &height); @@ -277,7 +282,7 @@ void removeAspectRatio(TransInfo *t, float *vec) SpaceImage *sima= t->sa->spacedata.first; float aspx, aspy; - if((sima->flag & SI_COORDFLOATS)==0) { + if ((sima->flag & SI_COORDFLOATS)==0) { int width, height; ED_space_image_size(sima, &width, &height); @@ -296,7 +301,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) if (t->spacetype == SPACE_VIEW3D) { /* Do we need more refined tags? */ - if(t->flag & T_POSE) + if (t->flag & T_POSE) WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); else WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -318,17 +323,17 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) else if (t->spacetype == SPACE_NLA) { WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL); } - else if(t->spacetype == SPACE_NODE) { + else if (t->spacetype == SPACE_NODE) { //ED_area_tag_redraw(t->sa); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE_VIEW, NULL); } - else if(t->spacetype == SPACE_SEQ) { + else if (t->spacetype == SPACE_SEQ) { WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL); } else if (t->spacetype==SPACE_IMAGE) { // XXX how to deal with lock? SpaceImage *sima= (SpaceImage*)t->sa->spacedata.first; - if(sima->lock) WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data); + if (sima->lock) WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data); else ED_area_tag_redraw(t->sa); } else if (t->spacetype==SPACE_CLIP) { @@ -346,7 +351,7 @@ static void viewRedrawPost(bContext *C, TransInfo *t) { ED_area_headerprint(t->sa, NULL); - if(t->spacetype == SPACE_VIEW3D) { + if (t->spacetype == SPACE_VIEW3D) { /* if autokeying is enabled, send notifiers that keyframes were added */ if (IS_AUTOKEY_ON(t->scene)) WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); @@ -357,15 +362,15 @@ static void viewRedrawPost(bContext *C, TransInfo *t) } #if 0 // TRANSFORM_FIX_ME - if(t->spacetype==SPACE_VIEW3D) { + if (t->spacetype==SPACE_VIEW3D) { allqueue(REDRAWBUTSOBJECT, 0); allqueue(REDRAWVIEW3D, 0); } - else if(t->spacetype==SPACE_IMAGE) { + else if (t->spacetype==SPACE_IMAGE) { allqueue(REDRAWIMAGE, 0); allqueue(REDRAWVIEW3D, 0); } - else if(ELEM3(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) { + else if (ELEM3(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) { allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWACTION, 0); allqueue(REDRAWNLA, 0); @@ -388,7 +393,7 @@ void BIF_selectOrientation(void) val= pupmenu(str_menu); MEM_freeN(str_menu); - if(val >= 0) { + if (val >= 0) { G.vd->twmode = val; } #endif @@ -413,23 +418,27 @@ static void view_editmove(unsigned short UNUSED(event)) switch(event) { case WHEELUPMOUSE: - if( G.qual & LR_SHIFTKEY ) { - if( G.qual & LR_ALTKEY ) { + if ( G.qual & LR_SHIFTKEY ) { + if ( G.qual & LR_ALTKEY ) { G.qual &= ~LR_SHIFTKEY; persptoetsen(PAD2); G.qual |= LR_SHIFTKEY; - } else { + } + else { persptoetsen(PAD2); } - } else if( G.qual & LR_CTRLKEY ) { - if( G.qual & LR_ALTKEY ) { + } + else if ( G.qual & LR_CTRLKEY ) { + if ( G.qual & LR_ALTKEY ) { G.qual &= ~LR_CTRLKEY; persptoetsen(PAD4); G.qual |= LR_CTRLKEY; - } else { + } + else { persptoetsen(PAD4); } - } else if(U.uiflag & USER_WHEELZOOMDIR) + } + else if (U.uiflag & USER_WHEELZOOMDIR) persptoetsen(PADMINUS); else persptoetsen(PADPLUSKEY); @@ -437,23 +446,27 @@ static void view_editmove(unsigned short UNUSED(event)) refresh = 1; break; case WHEELDOWNMOUSE: - if( G.qual & LR_SHIFTKEY ) { - if( G.qual & LR_ALTKEY ) { + if ( G.qual & LR_SHIFTKEY ) { + if ( G.qual & LR_ALTKEY ) { G.qual &= ~LR_SHIFTKEY; persptoetsen(PAD8); G.qual |= LR_SHIFTKEY; - } else { + } + else { persptoetsen(PAD8); } - } else if( G.qual & LR_CTRLKEY ) { - if( G.qual & LR_ALTKEY ) { + } + else if ( G.qual & LR_CTRLKEY ) { + if ( G.qual & LR_ALTKEY ) { G.qual &= ~LR_CTRLKEY; persptoetsen(PAD6); G.qual |= LR_CTRLKEY; - } else { + } + else { persptoetsen(PAD6); } - } else if(U.uiflag & USER_WHEELZOOMDIR) + } + else if (U.uiflag & USER_WHEELZOOMDIR) persptoetsen(PADPLUSKEY); else persptoetsen(PADMINUS); @@ -526,7 +539,7 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map"); /* this function is called for each spacetype, only needs to add map once */ - if(keymap) return NULL; + if (keymap) return NULL; keymap= WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items); @@ -602,15 +615,15 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case TFM_MODAL_TRANSLATE: /* only switch when... */ - if( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) { + if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) { resetTransRestrictions(t); restoreTransObjects(t); initTranslation(t); initSnapping(t, NULL); // need to reinit after mode change t->redraw |= TREDRAW_HARD; } - else if(t->mode == TFM_TRANSLATION) { - if(t->options&CTX_MOVIECLIP) { + else if (t->mode == TFM_TRANSLATION) { + if (t->options&CTX_MOVIECLIP) { restoreTransObjects(t); t->flag^= T_ALT_TRANSFORM; @@ -620,8 +633,8 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case TFM_MODAL_ROTATE: /* only switch when... */ - if(!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) { - if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) { + if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) { + if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) { resetTransRestrictions(t); @@ -640,7 +653,7 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case TFM_MODAL_RESIZE: /* only switch when... */ - if( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) { + if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) { resetTransRestrictions(t); restoreTransObjects(t); initResize(t); @@ -752,9 +765,9 @@ int transformEvent(TransInfo *t, wmEvent *event) t->redraw |= TREDRAW_HARD; break; case TFM_MODAL_PROPSIZE_UP: - if(t->flag & T_PROP_EDIT) { + if (t->flag & T_PROP_EDIT) { t->prop_size*= 1.1f; - if(t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO) + if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO) t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far); calculatePropRatio(t); } @@ -855,7 +868,7 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case GKEY: /* only switch when... */ - if( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) { + if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) { resetTransRestrictions(t); restoreTransObjects(t); initTranslation(t); @@ -865,7 +878,7 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case SKEY: /* only switch when... */ - if( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) { + if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) { resetTransRestrictions(t); restoreTransObjects(t); initResize(t); @@ -875,8 +888,8 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case RKEY: /* only switch when... */ - if(!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) { - if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) { + if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) { + if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) { resetTransRestrictions(t); @@ -910,21 +923,25 @@ int transformEvent(TransInfo *t, wmEvent *event) if (t->flag & T_2D_EDIT) { if (cmode == 'X') { stopConstraint(t); - } else { + } + else { setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along X"); } - } else { + } + else { if (cmode == 'X') { if (t->con.orientation != V3D_MANIP_GLOBAL) { stopConstraint(t); - } else { + } + else { short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL; if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setUserConstraint(t, orientation, (CON_AXIS0), "along %s X"); else if (t->modifiers & MOD_CONSTRAINT_PLANE) setUserConstraint(t, orientation, (CON_AXIS1|CON_AXIS2), "locking %s X"); } - } else { + } + else { if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along %s X"); else if (t->modifiers & MOD_CONSTRAINT_PLANE) @@ -939,21 +956,25 @@ int transformEvent(TransInfo *t, wmEvent *event) if (t->flag & T_2D_EDIT) { if (cmode == 'Y') { stopConstraint(t); - } else { + } + else { setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along Y"); } - } else { + } + else { if (cmode == 'Y') { if (t->con.orientation != V3D_MANIP_GLOBAL) { stopConstraint(t); - } else { + } + else { short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL; if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setUserConstraint(t, orientation, (CON_AXIS1), "along %s Y"); else if (t->modifiers & MOD_CONSTRAINT_PLANE) setUserConstraint(t, orientation, (CON_AXIS0|CON_AXIS2), "locking %s Y"); } - } else { + } + else { if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along %s Y"); else if (t->modifiers & MOD_CONSTRAINT_PLANE) @@ -968,14 +989,16 @@ int transformEvent(TransInfo *t, wmEvent *event) if (cmode == 'Z') { if (t->con.orientation != V3D_MANIP_GLOBAL) { stopConstraint(t); - } else { + } + else { short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL; if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setUserConstraint(t, orientation, (CON_AXIS2), "along %s Z"); else if (t->modifiers & MOD_CONSTRAINT_PLANE) setUserConstraint(t, orientation, (CON_AXIS0|CON_AXIS1), "locking %s Z"); } - } else { + } + else { if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0) setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS2), "along %s Z"); else if (t->modifiers & MOD_CONSTRAINT_PLANE) @@ -992,9 +1015,9 @@ int transformEvent(TransInfo *t, wmEvent *event) } break; case PADPLUSKEY: - if(event->alt && t->flag & T_PROP_EDIT) { + if (event->alt && t->flag & T_PROP_EDIT) { t->prop_size *= 1.1f; - if(t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO) + if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO) t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far); calculatePropRatio(t); } @@ -1009,7 +1032,7 @@ int transformEvent(TransInfo *t, wmEvent *event) t->redraw= 1; break; case PADMINUS: - if(event->alt && t->flag & T_PROP_EDIT) { + if (event->alt && t->flag & T_PROP_EDIT) { t->prop_size*= 0.90909090f; calculatePropRatio(t); } @@ -1052,7 +1075,7 @@ int transformEvent(TransInfo *t, wmEvent *event) break; // case LEFTMOUSE: // case RIGHTMOUSE: -// if(WM_modal_tweak_exit(event, t->event_type)) +// if (WM_modal_tweak_exit(event, t->event_type)) //// if (t->options & CTX_TWEAK) // t->state = TRANS_CONFIRM; // break; @@ -1197,7 +1220,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments glBegin(GL_LINE_STRIP); - for( angle = angle_start; angle < angle_end; angle += delta) + for ( angle = angle_start; angle < angle_end; angle += delta) { glVertex2f( cosf(angle) * size, sinf(angle) * size); } @@ -1210,7 +1233,7 @@ static int helpline_poll(bContext *C) { ARegion *ar= CTX_wm_region(C); - if(ar && ar->regiontype==RGN_TYPE_WINDOW) + if (ar && ar->regiontype==RGN_TYPE_WINDOW) return 1; return 0; } @@ -1228,13 +1251,13 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) mval[1]= y; copy_v3_v3(vecrot, t->center); - if(t->flag & T_EDIT) { + if (t->flag & T_EDIT) { Object *ob= t->obedit; - if(ob) mul_m4_v3(ob->obmat, vecrot); + if (ob) mul_m4_v3(ob->obmat, vecrot); } - else if(t->flag & T_POSE) { + else if (t->flag & T_POSE) { Object *ob=t->poseobj; - if(ob) mul_m4_v3(ob->obmat, vecrot); + if (ob) mul_m4_v3(ob->obmat, vecrot); } projectFloatView(t, vecrot, cent); // no overflow in extreme cases @@ -1428,7 +1451,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) /* do we check for parameter? */ if (t->modifiers & MOD_SNAP) { ts->snap_flag |= SCE_SNAP; - } else { + } + else { ts->snap_flag &= ~SCE_SNAP; } @@ -1466,7 +1490,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) * */ if (t->con.mode & CON_APPLY) { RNA_enum_set(op->ptr, "constraint_orientation", t->con.orientation); - } else { + } + else { RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation); } @@ -1501,7 +1526,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop)) { - if(RNA_property_boolean_get(op->ptr, prop)) { + if (RNA_property_boolean_get(op->ptr, prop)) { options |= CTX_TEXTURE; } } @@ -1532,7 +1557,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int return 0; } - if(t->spacetype == SPACE_VIEW3D) + if (t->spacetype == SPACE_VIEW3D) { //calc_manipulator_stats(curarea); initTransformOrientation(C, t); @@ -1542,12 +1567,13 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int //t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); } - else if(t->spacetype == SPACE_IMAGE) { + else if (t->spacetype == SPACE_IMAGE) { unit_m3(t->spacemtx); t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); //t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); + t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); } - else if(t->spacetype == SPACE_CLIP) { + else if (t->spacetype == SPACE_CLIP) { unit_m3(t->spacemtx); t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->options |= CTX_MOVIECLIP; @@ -1563,7 +1589,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int } /* Stupid code to have Ctrl-Click on manipulator work ok */ - if(event) + if (event) { wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap); wmKeyMapItem *kmi; @@ -1637,7 +1663,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int case TFM_BONESIZE: { /* used for both B-Bone width (bonesize) as for deform-dist (envelope) */ bArmature *arm= t->poseobj->data; - if(arm->drawtype==ARM_ENVELOPE) + if (arm->drawtype==ARM_ENVELOPE) initBoneEnvelope(t); else initBoneSize(t); @@ -1702,7 +1728,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int break; } - if(t->state == TRANS_CANCEL) + if (t->state == TRANS_CANCEL) { postTrans(C, t); return 0; @@ -1714,9 +1740,10 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int { float values[4]= {0}; /* in case value isn't length 4, avoid uninitialized memory */ - if(RNA_property_array_check(prop)) { + if (RNA_property_array_check(prop)) { RNA_float_get_array(op->ptr, "value", values); - } else { + } + else { values[0]= RNA_float_get(op->ptr, "value"); } @@ -1778,7 +1805,8 @@ void transformApply(bContext *C, TransInfo *t) viewRedrawForce(C, t); } t->redraw = TREDRAW_NOTHING; - } else if (t->redraw & TREDRAW_SOFT) { + } + else if (t->redraw & TREDRAW_SOFT) { viewRedrawForce(C, t); } @@ -1817,10 +1845,10 @@ int transformEnd(bContext *C, TransInfo *t) if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) { /* handle restoring objects */ - if(t->state == TRANS_CANCEL) + if (t->state == TRANS_CANCEL) { /* exception, edge slide transformed UVs too */ - if(t->mode==TFM_EDGE_SLIDE) + if (t->mode==TFM_EDGE_SLIDE) doEdgeSlide(t, 0.0f); exit_code = OPERATOR_CANCELLED; @@ -1841,11 +1869,11 @@ int transformEnd(bContext *C, TransInfo *t) /* Undo as last, certainly after special_trans_update! */ - if(t->state == TRANS_CANCEL) { -// if(t->undostr) ED_undo_push(C, t->undostr); + if (t->state == TRANS_CANCEL) { +// if (t->undostr) ED_undo_push(C, t->undostr); } else { -// if(t->undostr) ED_undo_push(C, t->undostr); +// if (t->undostr) ED_undo_push(C, t->undostr); // else ED_undo_push(C, transform_to_undostr(t)); } t->undostr= NULL; @@ -1862,31 +1890,31 @@ int transformEnd(bContext *C, TransInfo *t) static void protectedTransBits(short protectflag, float *vec) { - if(protectflag & OB_LOCK_LOCX) + if (protectflag & OB_LOCK_LOCX) vec[0]= 0.0f; - if(protectflag & OB_LOCK_LOCY) + if (protectflag & OB_LOCK_LOCY) vec[1]= 0.0f; - if(protectflag & OB_LOCK_LOCZ) + if (protectflag & OB_LOCK_LOCZ) vec[2]= 0.0f; } static void protectedSizeBits(short protectflag, float *size) { - if(protectflag & OB_LOCK_SCALEX) + if (protectflag & OB_LOCK_SCALEX) size[0]= 1.0f; - if(protectflag & OB_LOCK_SCALEY) + if (protectflag & OB_LOCK_SCALEY) size[1]= 1.0f; - if(protectflag & OB_LOCK_SCALEZ) + if (protectflag & OB_LOCK_SCALEZ) size[2]= 1.0f; } static void protectedRotateBits(short protectflag, float *eul, float *oldeul) { - if(protectflag & OB_LOCK_ROTX) + if (protectflag & OB_LOCK_ROTX) eul[0]= oldeul[0]; - if(protectflag & OB_LOCK_ROTY) + if (protectflag & OB_LOCK_ROTY) eul[1]= oldeul[1]; - if(protectflag & OB_LOCK_ROTZ) + if (protectflag & OB_LOCK_ROTZ) eul[2]= oldeul[2]; } @@ -2119,7 +2147,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) continue; /* only do conversion if necessary, to preserve quats and eulers */ - if(!dolimit) { + if (!dolimit) { constraintob_from_transdata(&cob, td); dolimit= 1; } @@ -2143,7 +2171,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) } } - if(dolimit) { + if (dolimit) { /* copy results from cob->matrix */ if (td->ext->rotOrder == ROT_MODE_QUAT) { /* quats */ @@ -2272,7 +2300,7 @@ void initWarp(TransInfo *t) t->flag |= T_NO_CONSTRAINT; /* we need min/max in view space */ - for(i = 0; i < t->total; i++) { + for (i = 0; i < t->total; i++) { float center[3]; copy_v3_v3(center, t->data[i].center); mul_m3_v3(t->data[i].mtx, center); @@ -2363,7 +2391,7 @@ int Warp(TransInfo *t, const int UNUSED(mval[2])) circumfac /= 2; /* only need 180 on each side to make 360 */ - for(i = 0; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { float loc[3]; if (td->flag & TD_NOACTION) break; @@ -2449,7 +2477,7 @@ int handleEventShear(TransInfo *t, wmEvent *event) initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_ABSOLUTE); t->customData = NULL; } - + status = 1; } @@ -2499,7 +2527,7 @@ int Shear(TransInfo *t, const int UNUSED(mval[2])) mul_m3_m3m3(tmat, smat, persmat); mul_m3_m3m3(totmat, persinv, tmat); - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -2614,9 +2642,9 @@ static void TransMat3ToSize( float mat[][3], float smat[][3], float *size) size[2]= normalize_v3(vec); /* first tried with dotproduct... but the sign flip is crucial */ - if( VECSIGNFLIP(mat[0], smat[0]) ) size[0]= -size[0]; - if( VECSIGNFLIP(mat[1], smat[1]) ) size[1]= -size[1]; - if( VECSIGNFLIP(mat[2], smat[2]) ) size[2]= -size[2]; + if ( VECSIGNFLIP(mat[0], smat[0]) ) size[0]= -size[0]; + if ( VECSIGNFLIP(mat[1], smat[1]) ) size[1]= -size[1]; + if ( VECSIGNFLIP(mat[2], smat[2]) ) size[2]= -size[2]; } @@ -2668,7 +2696,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) protectedSizeBits(td->protectflag, fsize); if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't resize objects itself - if((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) { + if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) { /* scale val and reset size */ *td->val = td->ival * (1 + (fsize[0] - 1) * td->factor); @@ -2725,7 +2753,7 @@ int Resize(TransInfo *t, const int mval[2]) char str[200]; /* for manipulator, center handle, the scaling can't be done relative to center */ - if( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0) + if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0) { ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f; } @@ -2761,7 +2789,7 @@ int Resize(TransInfo *t, const int mval[2]) headerResize(t, size, str); - for(i = 0, td=t->data; i < t->total; i++, td++) { + for (i = 0, td=t->data; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -2778,7 +2806,7 @@ int Resize(TransInfo *t, const int mval[2]) if (t->con.applySize) t->con.applySize(t, NULL, mat); - for(i = 0, td=t->data; i < t->total; i++, td++) + for (i = 0, td=t->data; i < t->total; i++, td++) ElementResize(t, td, mat); } @@ -2813,7 +2841,7 @@ void initToSphere(TransInfo *t) t->flag |= T_NO_CONSTRAINT; // Calculate average radius - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { t->val += len_v3v3(t->center, td->iloc); } @@ -2855,7 +2883,7 @@ int ToSphere(TransInfo *t, const int UNUSED(mval[2])) } - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { float tratio; if (td->flag & TD_NOACTION) break; @@ -2947,11 +2975,11 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short add_v3_v3v3(td->loc, td->iloc, vec); - if(td->flag & TD_USEQUAT) { + if (td->flag & TD_USEQUAT) { mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL); mat3_to_quat( quat,fmat); // Actual transform - if(td->ext->quat) { + if (td->ext->quat) { mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat); /* is there a reason not to have this here? -jahka */ @@ -2992,7 +3020,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short sub_v3_v3v3(vec, vec, td->center); // Translation needed from the initial location /* special exception, see TD_PBONE_LOCAL_MTX definition comments */ - if(td->flag & TD_PBONE_LOCAL_MTX_P) { + if (td->flag & TD_PBONE_LOCAL_MTX_P) { /* do nothing */ } else if (td->flag & TD_PBONE_LOCAL_MTX_C) { @@ -3142,7 +3170,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) vec_rot_to_mat3( mat,axis, angle); - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3174,7 +3202,8 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2])) if ((t->con.mode & CON_APPLY) && t->con.applyRot) { t->con.applyRot(t, NULL, t->axis, NULL); - } else { + } + else { /* reset axis if constraint is not set */ copy_v3_v3(t->axis, t->axis_orig); } @@ -3245,7 +3274,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a mul_m3_m3m3(mat, smat, totmat); - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3336,7 +3365,7 @@ void initTranslation(TransInfo *t) t->num.flag = 0; t->num.idx_max = t->idx_max; - if(t->spacetype == SPACE_VIEW3D) { + if (t->spacetype == SPACE_VIEW3D) { RegionView3D *rv3d = t->ar->regiondata; if (rv3d) { @@ -3345,7 +3374,7 @@ void initTranslation(TransInfo *t) t->snap[2] = t->snap[1] * 0.1f; } } - else if(ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) { + else if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) { t->snap[0] = 0.0f; t->snap[1] = 0.125f; t->snap[2] = 0.0625f; @@ -3377,10 +3406,10 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) applyAspectRatio(t, dvec); dist = len_v3(vec); - if(!(t->flag & T_2D_EDIT) && t->scene->unit.system) { + if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) { int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0; - for(i=0; i<3; i++) + for (i=0; i<3; i++) bUnit_AsString(&tvec[i*20], 20, dvec[i]*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1); } else { @@ -3390,17 +3419,17 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) } } - if(!(t->flag & T_2D_EDIT) && t->scene->unit.system) + if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) bUnit_AsString(distvec, sizeof(distvec), dist*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0); - else if( dist > 1e10f || dist < -1e10f ) /* prevent string buffer overflow */ + else if ( dist > 1e10f || dist < -1e10f ) /* prevent string buffer overflow */ sprintf(distvec, "%.4e", dist); else sprintf(distvec, "%.4f", dist); - if(t->flag & T_AUTOIK) { + if (t->flag & T_AUTOIK) { short chainlen= t->settings->autoik_chainlen; - if(chainlen) + if (chainlen) sprintf(autoik, "AutoIK-Len: %d", chainlen); else autoik[0]= '\0'; @@ -3421,7 +3450,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) } } else { - if(t->flag & T_2D_EDIT) + if (t->flag & T_2D_EDIT) spos += sprintf(spos, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext); else spos += sprintf(spos, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]); @@ -3439,7 +3468,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) float tvec[3]; int i; - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3588,7 +3617,7 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) } - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3658,7 +3687,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Tilt: %.2f %s", RAD2DEGF(final), t->proptext); } - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3725,14 +3754,14 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Shrink/Fatten: %3f", ratio); } - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; if (td->flag & TD_SKIP) continue; - if(td->val) { + if (td->val) { // *td->val= ratio; *td->val= td->ival*ratio; if (*td->val <= 0.0f) *td->val = 0.001f; @@ -3796,7 +3825,7 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2])) t->con.applyRot(t, NULL, axis, NULL); } - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3866,7 +3895,7 @@ void initBevel(TransInfo *t) int handleEventBevel(TransInfo *t, wmEvent *event) { if (event->val==KM_PRESS) { - if(!G.editBMesh) return 0; + if (!G.editBMesh) return 0; switch (event->type) { case MIDDLEMOUSE: @@ -3927,7 +3956,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2])) } if (distance < 0) distance = -distance; - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->axismtx[1][0] > 0 && distance > td->axismtx[1][0]) { d = td->axismtx[1][0]; } @@ -3999,7 +4028,7 @@ int BevelWeight(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Bevel Weight: %.3f %s", weight, t->proptext); } - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4072,7 +4101,7 @@ int Crease(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Crease: %.3f %s", crease, t->proptext); } - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4193,7 +4222,7 @@ int BoneSize(TransInfo *t, const int mval[2]) headerBoneSize(t, size, str); - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4255,7 +4284,7 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Envelope: %3f", ratio); } - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4308,7 +4337,8 @@ static BMLoop *get_next_loop(BMesh *UNUSED(bm), BMVert *v, BMLoop *l, if (l->e == nexte) { if (i) { mul_v3_fl(a, 1.0f / (float)i); - } else { + } + else { float f1[3], f2[3], f3[3]; sub_v3_v3v3(f1, BM_edge_other_vert(olde, v)->co, v->co); @@ -4324,7 +4354,8 @@ static BMLoop *get_next_loop(BMesh *UNUSED(bm), BMVert *v, BMLoop *l, copy_v3_v3(vec, a); return l; - } else { + } + else { sub_v3_v3v3(n, BM_edge_other_vert(l->e, v)->co, v->co); add_v3_v3v3(a, a, n); i += 1; @@ -4355,7 +4386,7 @@ static int createSlideVerts(TransInfo *t) BMEditMesh *em = me->edit_btmesh; BMesh *bm = em->bm; BMIter iter, iter2; - BMEdge *e, *e1, *ee, *le; + BMEdge *e, *e1 /*, *ee, *le */ /* UNUSED */; BMVert *v, *v2, *first; BMLoop *l, *l1, *l2; TransDataSlideVert *tempsv; @@ -4367,13 +4398,14 @@ static int createSlideVerts(TransInfo *t) ARegion *ar = t->ar; float projectMat[4][4]; float start[3] = {0.0f, 0.0f, 0.0f}, dir[3], end[3] = {0.0f, 0.0f, 0.0f}; - float vec[3], vec2[3], lastvec[3], size, dis=0.0, z; + float vec[3], vec2[3], lastvec[3] /*, size, dis=0.0, z */ /* UNUSED */; int numsel, i, j; if (!v3d) { /*ok, let's try to survive this*/ unit_m4(projectMat); - } else { + } + else { ED_view3d_ob_project_mat_get(rv3d, t->obedit, projectMat); } @@ -4474,7 +4506,8 @@ static int createSlideVerts(TransInfo *t) if (l2 != l1) { l = BM_face_other_edge_loop(l2->f, l2->e, v); sub_v3_v3v3(vec2, BM_edge_other_vert(l->e, v)->co, v->co); - } else { + } + else { l2 = NULL; } @@ -4541,10 +4574,10 @@ static int createSlideVerts(TransInfo *t) sld->totsv = j; /*find mouse vector*/ - dis = z = -1.0f; - size = 50.0; + /* dis = z = -1.0f; */ /* UNUSED */ + /* size = 50.0; */ /* UNUSED */ zero_v3(lastvec); zero_v3(dir); - ee = le = NULL; + /* ee = le = NULL; */ /* UNUSED */ BM_ITER(e, &iter, em->bm, BM_EDGES_OF_MESH, NULL) { if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { BMIter iter2; @@ -4552,7 +4585,7 @@ static int createSlideVerts(TransInfo *t) float vec1[3], dis2, mval[2] = {t->mval[0], t->mval[1]}, d; /* search cross edges for visible edge to the mouse cursor, - * then use the shared vertex to calculate screen vector*/ + * then use the shared vertex to calculate screen vector*/ dis2 = -1.0f; for (i=0; i<2; i++) { v = i?e->v1:e->v2; @@ -4567,14 +4600,16 @@ static int createSlideVerts(TransInfo *t) if (tempsv[j].down) { ED_view3d_project_float_v3(ar, tempsv[j].down->co, vec1, projectMat); - } else { + } + else { add_v3_v3v3(vec1, v->co, tempsv[j].downvec); ED_view3d_project_float_v3(ar, vec1, vec1, projectMat); } if (tempsv[j].up) { ED_view3d_project_float_v3(ar, tempsv[j].up->co, vec2, projectMat); - } else { + } + else { add_v3_v3v3(vec1, v->co, tempsv[j].upvec); ED_view3d_project_float_v3(ar, vec2, vec2, projectMat); } @@ -4582,16 +4617,15 @@ static int createSlideVerts(TransInfo *t) d = dist_to_line_segment_v2(mval, vec1, vec2); if (dis2 == -1.0f || d < dis2) { dis2 = d; - ee = e2; - size = len_v3v3(vec1, vec2); + /* ee = e2; */ /* UNUSED */ + /* size = len_v3v3(vec1, vec2); */ /* UNUSED */ sub_v3_v3v3(dir, vec1, vec2); } } } } } - - em->bm->ob = t->obedit; + bmesh_edit_begin(em->bm, BMO_OP_FLAG_UNTAN_MULTIRES); /*create copies of faces for customdata projection*/ @@ -4661,7 +4695,7 @@ void projectSVData(TransInfo *t, int final) /* BMESH_TODO, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) * currently all vertex data is interpolated which is nice mostly - * except for shape keys where you dont want to modify UVs for eg. + * except for shape keys where you don't want to modify UVs for eg. * current BMesh code doesnt make it easy to pick which data we interpolate * - campbell */ @@ -4675,7 +4709,7 @@ void projectSVData(TransInfo *t, int final) BMIter liter2; BMFace *copyf, *copyf2; BMLoop *l2; - int sel, hide, do_vdata; + int sel, hide /*, do_vdata */ /* UNUSED */; if (BLI_smallhash_haskey(&visit, (uintptr_t)f)) continue; @@ -4693,19 +4727,20 @@ void projectSVData(TransInfo *t, int final) /*project onto copied projection face*/ BM_ITER(l2, &liter2, em->bm, BM_LOOPS_OF_FACE, f) { copyf = copyf2; - do_vdata = l2->v==tempsv->v; + /* do_vdata = l2->v==tempsv->v; */ /* UNUSED */ if (BM_elem_flag_test(l2->e, BM_ELEM_SELECT) || BM_elem_flag_test(l2->prev->e, BM_ELEM_SELECT)) { BMLoop *l3 = l2; - do_vdata = 1; + /* do_vdata = 1; */ /* UNUSED */ if (!BM_elem_flag_test(l2->e, BM_ELEM_SELECT)) l3 = l3->prev; if (sld->perc < 0.0 && BM_vert_in_face(l3->radial_next->f, tempsv->down)) { copyf = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l3->radial_next->f); - } else if (sld->perc > 0.0 && BM_vert_in_face(l3->radial_next->f, tempsv->up)) { + } + else if (sld->perc > 0.0 && BM_vert_in_face(l3->radial_next->f, tempsv->up)) { copyf = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l3->radial_next->f); } if (!copyf) @@ -4737,8 +4772,8 @@ void projectSVData(TransInfo *t, int final) BLI_smallhash_release(&visit); } -void freeSlideTempFaces(SlideData *sld){ - if(sld->origfaces_init){ +void freeSlideTempFaces(SlideData *sld) { + if (sld->origfaces_init) { SmallHashIter hiter; BMFace *copyf; @@ -4759,13 +4794,13 @@ void freeSlideVerts(TransInfo *t) SlideData *sld = t->customData; #if 0 /*BMESH_TODO*/ - if(me->drawflag & ME_DRAWEXTRA_EDGELEN) { + if (me->drawflag & ME_DRAWEXTRA_EDGELEN) { TransDataSlideVert *tempsv; LinkNode *look = sld->vertlist; GHash *vertgh = sld->vhash; - while(look) { + while (look) { tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link); - if(tempsv != NULL) { + if (tempsv != NULL) { tempsv->up->f &= !SELECT; tempsv->down->f &= !SELECT; } @@ -4779,7 +4814,6 @@ void freeSlideVerts(TransInfo *t) freeSlideTempFaces(sld); - sld->em->bm->ob = t->obedit; bmesh_edit_end(sld->em->bm, BMO_OP_FLAG_UNTAN_MULTIRES); BLI_smallhash_release(&sld->vhash); @@ -4799,7 +4833,7 @@ void initEdgeSlide(TransInfo *t) t->mode = TFM_EDGE_SLIDE; t->transform = EdgeSlide; - if(!createSlideVerts(t)) { + if (!createSlideVerts(t)) { t->state= TRANS_CANCEL; return; } @@ -4989,7 +5023,7 @@ int BakeTime(TransInfo *t, const int mval[2]) float fac = 0.1f; - if(t->mouse.precision) { + if (t->mouse.precision) { /* calculate ratio for shiftkey pos, and for total, and blend these for precision */ time= (float)(t->center2d[0] - t->mouse.precision_mval[0]) * fac; time+= 0.1f*((float)(t->center2d[0]*fac - mval[0]) -time); @@ -5021,7 +5055,7 @@ int BakeTime(TransInfo *t, const int mval[2]) sprintf(str, "Time: %.3f %s", time, t->proptext); } - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -5080,7 +5114,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Mirror%s", t->con.text); - for(i = 0, td=t->data; i < t->total; i++, td++) { + for (i = 0, td=t->data; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -5099,7 +5133,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2])) size_to_mat3( mat,size); - for(i = 0, td=t->data; i < t->total; i++, td++) { + for (i = 0, td=t->data; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -5111,7 +5145,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2])) recalcData(t); - if(t->flag & T_2D_EDIT) + if (t->flag & T_2D_EDIT) ED_area_headerprint(t->sa, "Select a mirror axis (X, Y)"); else ED_area_headerprint(t->sa, "Select a mirror axis (X, Y, Z)"); @@ -5140,7 +5174,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2])) /* saving original center */ copy_v3_v3(center, t->center); - for(i = 0 ; i < t->total; i++, td++) + for (i = 0 ; i < t->total; i++, td++) { float mat[3][3], invmat[3][3]; @@ -5155,7 +5189,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2])) copy_v3_v3(t->center, td->center); } else { - if(t->settings->selectmode & SCE_SELECT_FACE) { + if (t->settings->selectmode & SCE_SELECT_FACE) { copy_v3_v3(t->center, td->center); } } @@ -5215,7 +5249,7 @@ static void applySeqSlide(TransInfo *t, float val[2]) TransData *td = t->data; int i; - for(i = 0 ; i < t->total; i++, td++) { + for (i = 0 ; i < t->total; i++, td++) { float tvec[2]; if (td->flag & TD_NOACTION) @@ -5570,7 +5604,8 @@ void initTimeSlide(TransInfo *t) /* set flag for drawing stuff */ saction->flag |= SACTION_MOVING; - } else { + } + else { t->state = TRANS_CANCEL; } |