Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-24 10:38:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-24 10:38:07 +0400
commitab4a2aaf4a4b2b4e416aa1f113b30362cbe0dec3 (patch)
tree81af4c18519181490074508dbe9a8d515eab634f /source/blender/editors/transform
parent5a90ea77bc1333efe4e1e54984a080550ed3f707 (diff)
style cleanup: follow style guide for formatting of if/for/while loops, and else if's
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c347
-rw-r--r--source/blender/editors/transform/transform_constraints.c38
-rw-r--r--source/blender/editors/transform/transform_conversions.c643
-rw-r--r--source/blender/editors/transform/transform_generics.c146
-rw-r--r--source/blender/editors/transform/transform_input.c6
-rw-r--r--source/blender/editors/transform/transform_manipulator.c386
-rw-r--r--source/blender/editors/transform/transform_ops.c6
-rw-r--r--source/blender/editors/transform/transform_orientations.c51
-rw-r--r--source/blender/editors/transform/transform_snap.c65
9 files changed, 868 insertions, 820 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index e027e0a37f7..04b6a095117 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);
@@ -144,7 +144,7 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
mval_f[1] = dy;
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, r_vec, dx, dy);
@@ -153,13 +153,13 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
r_vec[0] *= aspx;
r_vec[1] *= aspy;
}
- else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
+ 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)) {
+ 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;
@@ -179,10 +179,10 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
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, const float vec[3], int adr[2])
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,21 +210,21 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
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);
}
}
@@ -262,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);
@@ -282,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);
@@ -301,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);
@@ -323,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) {
@@ -351,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);
@@ -362,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);
@@ -393,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
@@ -418,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);
@@ -442,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);
@@ -531,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);
@@ -610,15 +618,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;
@@ -628,8 +636,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);
@@ -648,7 +656,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);
@@ -760,9 +768,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);
}
@@ -863,7 +871,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);
@@ -873,7 +881,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);
@@ -883,8 +891,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);
@@ -918,21 +926,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)
@@ -947,21 +959,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)
@@ -976,14 +992,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)
@@ -1000,9 +1018,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);
}
@@ -1017,7 +1035,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);
}
@@ -1060,7 +1078,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;
@@ -1205,7 +1223,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);
}
@@ -1218,7 +1236,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;
}
@@ -1236,13 +1254,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
@@ -1436,7 +1454,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;
}
@@ -1474,7 +1493,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);
}
@@ -1509,7 +1529,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;
}
}
@@ -1540,7 +1560,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);
@@ -1550,13 +1570,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;
@@ -1572,7 +1592,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;
@@ -1646,7 +1666,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);
@@ -1711,7 +1731,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;
@@ -1723,9 +1743,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");
}
@@ -1784,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);
}
@@ -1823,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;
@@ -1847,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;
@@ -1868,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];
}
@@ -2125,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;
}
@@ -2149,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 */
@@ -2278,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);
@@ -2369,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;
@@ -2505,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;
@@ -2620,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];
}
@@ -2674,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);
@@ -2731,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;
}
@@ -2767,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;
@@ -2784,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);
}
@@ -2819,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);
}
@@ -2861,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;
@@ -2953,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 */
@@ -2998,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) {
@@ -3148,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;
@@ -3180,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);
}
@@ -3251,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;
@@ -3342,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) {
@@ -3351,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;
@@ -3383,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 {
@@ -3396,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';
@@ -3427,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]);
@@ -3445,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;
@@ -3594,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;
@@ -3664,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;
@@ -3731,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;
@@ -3802,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;
@@ -3872,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:
@@ -3933,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];
}
@@ -4005,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;
@@ -4078,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;
@@ -4199,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;
@@ -4261,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;
@@ -4314,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);
@@ -4330,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;
@@ -4379,7 +4404,8 @@ static int createSlideVerts(TransInfo *t)
if (!v3d) {
/*ok, let's try to survive this*/
unit_m4(projectMat);
- } else {
+ }
+ else {
ED_view3d_ob_project_mat_get(rv3d, t->obedit, projectMat);
}
@@ -4480,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;
}
@@ -4573,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);
}
@@ -4710,7 +4739,8 @@ void projectSVData(TransInfo *t, int final)
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)
@@ -4742,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;
@@ -4764,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;
}
@@ -4803,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;
}
@@ -4993,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);
@@ -5025,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;
@@ -5084,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;
@@ -5103,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;
@@ -5115,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)");
@@ -5144,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];
@@ -5159,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);
}
}
@@ -5219,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)
@@ -5574,7 +5604,8 @@ void initTimeSlide(TransInfo *t)
/* set flag for drawing stuff */
saction->flag |= SACTION_MOVING;
- } else {
+ }
+ else {
t->state = TRANS_CANCEL;
}
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 017501bd78e..18e9c1a47b8 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -183,21 +183,21 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3])
{
- if(t->spacetype == SPACE_VIEW3D) {
+ if (t->spacetype == SPACE_VIEW3D) {
// View3D *v3d = t->sa->spacedata.first;
const float min_dist= 1.0f; // v3d->near;
float dir[3];
float l;
sub_v3_v3v3(dir, t_con_center, t->viewinv[3]);
- if(dot_v3v3(dir, t->viewinv[2]) < 0.0f) {
+ if (dot_v3v3(dir, t->viewinv[2]) < 0.0f) {
negate_v3(dir);
}
project_v3_v3v3(dir, dir, t->viewinv[2]);
l= len_v3(dir);
- if(l < min_dist) {
+ if (l < min_dist) {
float diff[3];
normalize_v3_v3(diff, t->viewinv[2]);
mul_v3_fl(diff, min_dist - l);
@@ -212,7 +212,7 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
float norm[3], vec[3], factor, angle;
float t_con_center[3];
- if(in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
+ if (in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
return;
copy_v3_v3(t_con_center, t->con.center);
@@ -229,11 +229,11 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
/* For when view is parallel to constraint... will cause NaNs otherwise
* So we take vertical motion in 3D space and apply it to the
* constraint axis. Nice for camera grab + MMB */
- if(angle < 5.0f) {
+ if (angle < 5.0f) {
project_v3_v3v3(vec, in, t->viewinv[1]);
factor = dot_v3v3(t->viewinv[1], vec) * 2.0f;
/* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */
- if(factor<0.0f) factor*= -factor;
+ if (factor<0.0f) factor*= -factor;
else factor*= factor;
copy_v3_v3(out, axis);
@@ -261,10 +261,12 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
copy_v3_v3(out, axis);
if (factor > 0) {
mul_v3_fl(out, 1000000000.0f);
- } else {
+ }
+ else {
mul_v3_fl(out, -1000000000.0f);
}
- } else {
+ }
+ else {
add_v3_v3v3(v2, t_con_center, axis);
add_v3_v3v3(v4, v, norm);
@@ -276,9 +278,9 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
/* possible some values become nan when
* viewpoint and object are both zero */
- if(!finite(out[0])) out[0]= 0.0f;
- if(!finite(out[1])) out[1]= 0.0f;
- if(!finite(out[2])) out[2]= 0.0f;
+ if (!finite(out[0])) out[0]= 0.0f;
+ if (!finite(out[1])) out[1]= 0.0f;
+ if (!finite(out[2])) out[2]= 0.0f;
}
}
}
@@ -654,7 +656,7 @@ void drawConstraint(TransInfo *t)
/* nasty exception for Z constraint in camera view */
// TRANSFORM_FIX_ME
-// if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB)
+// if ((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB)
// return;
if (tc->drawExtra) {
@@ -676,7 +678,7 @@ void drawConstraint(TransInfo *t)
glColor3ubv((GLubyte *)col2);
depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
- if(depth_test_enabled)
+ if (depth_test_enabled)
glDisable(GL_DEPTH_TEST);
setlinestyle(1);
@@ -686,7 +688,7 @@ void drawConstraint(TransInfo *t)
glEnd();
setlinestyle(0);
- if(depth_test_enabled)
+ if (depth_test_enabled)
glEnable(GL_DEPTH_TEST);
}
@@ -712,7 +714,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
UI_ThemeColor(TH_GRID);
- if(t->spacetype == SPACE_VIEW3D && rv3d != NULL) {
+ if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) {
copy_m4_m4(tmat, rv3d->viewmat);
invert_m4_m4(imat, tmat);
}
@@ -725,10 +727,10 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
copy_v3_v3(center, t->center);
- if((t->spacetype == SPACE_VIEW3D) && t->obedit) {
+ if ((t->spacetype == SPACE_VIEW3D) && t->obedit) {
mul_m4_v3(t->obedit->obmat, center); /* because t->center is in local space */
}
- else if(t->spacetype == SPACE_IMAGE) {
+ else if (t->spacetype == SPACE_IMAGE) {
float aspx, aspy;
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
@@ -766,7 +768,7 @@ static void drawObjectConstraint(TransInfo *t)
td++;
- for(i=1;i<t->total;i++,td++) {
+ for (i=1;i<t->total;i++,td++) {
if (t->con.mode & CON_AXIS0) {
drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0);
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 1c1fea9f505..6669bfdb3ca 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -175,7 +175,7 @@ void sort_trans_data_dist(TransInfo *t)
TransData *start = t->data;
int i = 1;
- while(i < t->total && start->flag & TD_SELECTED) {
+ while (i < t->total && start->flag & TD_SELECTED) {
start++;
i++;
}
@@ -217,11 +217,11 @@ static void set_prop_dist(TransInfo *t, short with_dist)
TransData *tob;
int a;
- for(a=0, tob= t->data; a<t->total; a++, tob++) {
+ for (a=0, tob= t->data; a<t->total; a++, tob++) {
tob->rdist= 0.0f; // init, it was mallocced
- if((tob->flag & TD_SELECTED)==0) {
+ if ((tob->flag & TD_SELECTED)==0) {
TransData *td;
int i;
float dist, vec[3];
@@ -229,7 +229,7 @@ static void set_prop_dist(TransInfo *t, short with_dist)
tob->rdist = -1.0f; // signal for next loop
for (i = 0, td= t->data; i < t->total; i++, td++) {
- if(td->flag & TD_SELECTED) {
+ if (td->flag & TD_SELECTED) {
sub_v3_v3v3(vec, tob->center, td->center);
mul_m3_v3(tob->mtx, vec);
dist = normalize_v3(vec);
@@ -269,7 +269,7 @@ static void createTransTexspace(TransInfo *t)
}
id = ob->data;
- if(id == NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
+ if (id == NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
t->total = 0;
return;
}
@@ -319,7 +319,7 @@ static void createTransEdge(TransInfo *t)
if (countsel == 0)
return;
- if(propmode) {
+ if (propmode) {
t->total = count;
}
else {
@@ -332,7 +332,7 @@ static void createTransEdge(TransInfo *t)
invert_m3_m3(smtx, mtx);
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && (BM_elem_flag_test(eed, BM_ELEM_SELECT) || propmode)) {
+ if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && (BM_elem_flag_test(eed, BM_ELEM_SELECT) || propmode)) {
float *bweight = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_BWEIGHT);
float *crease = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_CREASE);
@@ -371,13 +371,13 @@ static bKinematicConstraint *has_targetless_ik(bPoseChannel *pchan)
{
bConstraint *con= pchan->constraints.first;
- for(;con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) {
+ for (;con; con= con->next) {
+ if (con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) {
bKinematicConstraint *data= con->data;
- if(data->tar==NULL)
+ if (data->tar==NULL)
return data;
- if(data->tar->type==OB_ARMATURE && data->subtarget[0]==0)
+ if (data->tar->type==OB_ARMATURE && data->subtarget[0]==0)
return data;
}
}
@@ -396,13 +396,13 @@ static short apply_targetless_ik(Object *ob)
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
data= has_targetless_ik(pchan);
- if(data && (data->flag & CONSTRAINT_IK_AUTO)) {
+ if (data && (data->flag & CONSTRAINT_IK_AUTO)) {
/* fill the array with the bones of the chain (armature.c does same, keep it synced) */
segcount= 0;
/* exclude tip from chain? */
- if(!(data->flag & CONSTRAINT_IK_TIP))
+ if (!(data->flag & CONSTRAINT_IK_TIP))
parchan= pchan->parent;
else
parchan= pchan;
@@ -412,9 +412,9 @@ static short apply_targetless_ik(Object *ob)
chanlist[segcount]= parchan;
segcount++;
- if(segcount==data->rootbone || segcount>255) break; // 255 is weak
+ if (segcount==data->rootbone || segcount>255) break; // 255 is weak
}
- for(;segcount;segcount--) {
+ for (;segcount;segcount--) {
Bone *bone;
float rmat[4][4]/*, tmat[4][4], imat[4][4]*/;
@@ -429,7 +429,7 @@ static short apply_targetless_ik(Object *ob)
/* XXX Old code. Will remove it later. */
#if 0
- if(parchan->parent) {
+ if (parchan->parent) {
Bone *parbone= parchan->parent->bone;
float offs_bone[4][4];
@@ -443,7 +443,7 @@ static short apply_targetless_ik(Object *ob)
offs_bone[3][1]+= parbone->length;
/* pose_mat(b-1) * offs_bone */
- if(parchan->bone->flag & BONE_HINGE) {
+ if (parchan->bone->flag & BONE_HINGE) {
/* the rotation of the parent restposition */
copy_m4_m4(rmat, parbone->arm_mat); /* rmat used as temp */
@@ -454,7 +454,7 @@ static short apply_targetless_ik(Object *ob)
mult_m4_m4m4(tmat, rmat, offs_bone);
}
- else if(parchan->bone->flag & BONE_NO_SCALE) {
+ else if (parchan->bone->flag & BONE_NO_SCALE) {
mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
normalize_m4(tmat);
}
@@ -612,9 +612,9 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
copy_m3_m3(bmat, pchan->bone->bone_mat);
if (pchan->parent) {
- if(pchan->bone->flag & BONE_HINGE) {
+ if (pchan->bone->flag & BONE_HINGE) {
copy_m3_m4(pmat, pchan->parent->bone->arm_mat);
- if(!(pchan->bone->flag & BONE_NO_SCALE)) {
+ if (!(pchan->bone->flag & BONE_NO_SCALE)) {
float tsize[3], tsmat[3][3];
mat4_to_size(tsize, pchan->parent->pose_mat);
size_to_mat3(tsmat, tsize);
@@ -623,7 +623,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
}
else {
copy_m3_m4(pmat, pchan->parent->pose_mat);
- if(pchan->bone->flag & BONE_NO_SCALE)
+ if (pchan->bone->flag & BONE_NO_SCALE)
normalize_m3(pmat);
}
@@ -651,7 +651,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
/* exceptional case: rotate the pose bone which also applies transformation
* when a parentless bone has BONE_NO_LOCAL_LOCATION [] */
if (!ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) {
- if(pchan->parent) {
+ if (pchan->parent) {
/* same as td->smtx but without pchan->bone->bone_mat */
td->flag |= TD_PBONE_LOCAL_MTX_C;
mul_m3_m3m3(td->ext->l_smtx, pchan->bone->bone_mat, td->smtx);
@@ -669,7 +669,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
if (t->mode==TFM_BONESIZE) {
bArmature *arm= t->poseobj->data;
- if(arm->drawtype==ARM_ENVELOPE) {
+ if (arm->drawtype==ARM_ENVELOPE) {
td->loc= NULL;
td->val= &bone->dist;
td->ival= bone->dist;
@@ -685,8 +685,8 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
/* in this case we can do target-less IK grabbing */
if (t->mode==TFM_TRANSLATION) {
bKinematicConstraint *data= has_targetless_ik(pchan);
- if(data) {
- if(data->flag & CONSTRAINT_IK_TIP) {
+ if (data) {
+ if (data->flag & CONSTRAINT_IK_TIP) {
copy_v3_v3(data->grabtarget, pchan->pose_tail);
}
else {
@@ -710,8 +710,8 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb)
{
Bone *bone= lb->first;
- for(;bone;bone= bone->next) {
- if((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED))
+ for (;bone;bone= bone->next) {
+ if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED))
{
bone->flag |= BONE_HINGE_CHILD_TRANSFORM;
}
@@ -757,28 +757,28 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
/* make sure no bone can be transformed when a parent is transformed */
/* since pchans are depsgraph sorted, the parents are in beginning of list */
- if(mode != TFM_BONESIZE) {
- for(pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+ if (mode != TFM_BONESIZE) {
+ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
- if(bone->flag & BONE_TRANSFORM)
+ if (bone->flag & BONE_TRANSFORM)
bone_children_clear_transflag(mode, around, &bone->childbase);
}
}
/* now count, and check if we have autoIK or have to switch from translate to rotate */
hastranslation = 0;
- for(pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
- if(bone->flag & BONE_TRANSFORM) {
+ if (bone->flag & BONE_TRANSFORM) {
total++;
- if(mode == TFM_TRANSLATION) {
- if( has_targetless_ik(pchan)==NULL ) {
- if(pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
- if(pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
+ if (mode == TFM_TRANSLATION) {
+ if ( has_targetless_ik(pchan)==NULL ) {
+ if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
+ if (pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
hastranslation = 1;
}
- else if((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC)
+ else if ((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC)
hastranslation = 1;
}
else
@@ -788,7 +788,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
}
/* if there are no translatable bones, do rotation */
- if(mode == TFM_TRANSLATION && !hastranslation)
+ if (mode == TFM_TRANSLATION && !hastranslation)
{
*out_mode = TFM_ROTATION;
}
@@ -876,7 +876,7 @@ static void pose_grab_with_ik_clear(Object *ob)
continue;
}
pchan->constflag |= PCHAN_HAS_IK;
- if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
+ if (data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
pchan->constflag |= PCHAN_HAS_TARGET;
}
}
@@ -1067,7 +1067,7 @@ static void createTransPose(TransInfo *t, Object *ob)
/* set flags and count total (warning, can change transform to rotate) */
t->total = count_set_pose_transflags(&t->mode, t->around, ob);
- if(t->total == 0) return;
+ if (t->total == 0) return;
t->flag |= T_POSE;
t->poseobj= ob; /* we also allow non-active objects to be transformed, in weightpaint */
@@ -1075,7 +1075,7 @@ static void createTransPose(TransInfo *t, Object *ob)
/* init trans data */
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransPoseBone");
tdx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransPoseBoneExt");
- for(i=0; i<t->total; i++, td++, tdx++) {
+ for (i=0; i<t->total; i++, td++, tdx++) {
td->ext= tdx;
td->val = NULL;
}
@@ -1089,7 +1089,7 @@ static void createTransPose(TransInfo *t, Object *ob)
}
}
- if(td != (t->data+t->total)) {
+ if (td != (t->data+t->total)) {
// XXX use transform operator reports
// BKE_report(op->reports, RPT_DEBUG, "Bone selection count error");
}
@@ -1191,7 +1191,7 @@ static void createTransArmatureVerts(TransInfo *t)
}
else if (t->mode==TFM_BONESIZE) {
if (ebo->flag & BONE_SELECTED) {
- if(arm->drawtype==ARM_ENVELOPE)
+ if (arm->drawtype==ARM_ENVELOPE)
{
td->loc= NULL;
td->val= &ebo->dist;
@@ -1305,15 +1305,15 @@ static void createTransMBallVerts(TransInfo *t)
int propmode = t->flag & T_PROP_EDIT;
/* count totals */
- for(ml= mb->editelems->first; ml; ml= ml->next) {
- if(ml->flag & SELECT) countsel++;
- if(propmode) count++;
+ for (ml= mb->editelems->first; ml; ml= ml->next) {
+ if (ml->flag & SELECT) countsel++;
+ if (propmode) count++;
}
/* note: in prop mode we need at least 1 selected */
if (countsel==0) return;
- if(propmode) t->total = count;
+ if (propmode) t->total = count;
else t->total = countsel;
td = t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(MBall EditMode)");
@@ -1322,13 +1322,13 @@ static void createTransMBallVerts(TransInfo *t)
copy_m3_m4(mtx, t->obedit->obmat);
invert_m3_m3(smtx, mtx);
- for(ml= mb->editelems->first; ml; ml= ml->next) {
- if(propmode || (ml->flag & SELECT)) {
+ for (ml= mb->editelems->first; ml; ml= ml->next) {
+ if (propmode || (ml->flag & SELECT)) {
td->loc= &ml->x;
copy_v3_v3(td->iloc, td->loc);
copy_v3_v3(td->center, td->loc);
- if(ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
+ if (ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
else td->flag= TD_USEQUAT;
copy_m3_m3(td->smtx, smtx);
@@ -1337,11 +1337,11 @@ static void createTransMBallVerts(TransInfo *t)
td->ext = tx;
/* Radius of MetaElem (mass of MetaElem influence) */
- if(ml->flag & MB_SCALE_RAD) {
+ if (ml->flag & MB_SCALE_RAD) {
td->val = &ml->rad;
td->ival = ml->rad;
}
- else{
+ else {
td->val = &ml->s;
td->ival = ml->s;
}
@@ -1374,7 +1374,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail)
td_near = td;
td->dist = 0.0f;
}
- else if(td_near) {
+ else if (td_near) {
float dist;
dist = len_v3v3(td_near->center, td->center);
if (dist < (td-1)->dist) {
@@ -1395,7 +1395,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail)
td_near = td;
td->dist = 0.0f;
}
- else if(td_near) {
+ else if (td_near) {
float dist;
dist = len_v3v3(td_near->center, td->center);
if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td+1)->dist < td->dist) {
@@ -1440,31 +1440,32 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
ListBase *nurbs;
/* to be sure */
- if(cu->editnurb==NULL) return;
+ if (cu->editnurb==NULL) return;
/* count total of vertices, check identical as in 2nd loop for making transdata! */
nurbs= curve_editnurbs(cu);
- for(nu= nurbs->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
- for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
- if(bezt->hide==0) {
+ for (nu= nurbs->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
+ for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
+ if (bezt->hide==0) {
if (hide_handles) {
- if(bezt->f2 & SELECT) countsel+=3;
- if(propmode) count+= 3;
- } else {
- if(bezt->f1 & SELECT) countsel++;
- if(bezt->f2 & SELECT) countsel++;
- if(bezt->f3 & SELECT) countsel++;
- if(propmode) count+= 3;
+ if (bezt->f2 & SELECT) countsel+=3;
+ if (propmode) count+= 3;
+ }
+ else {
+ if (bezt->f1 & SELECT) countsel++;
+ if (bezt->f2 & SELECT) countsel++;
+ if (bezt->f3 & SELECT) countsel++;
+ if (propmode) count+= 3;
}
}
}
}
else {
- for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
- if(bp->hide==0) {
- if(propmode) count++;
- if(bp->f1 & SELECT) countsel++;
+ for (a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
+ if (bp->hide==0) {
+ if (propmode) count++;
+ if (bp->f1 & SELECT) countsel++;
}
}
}
@@ -1472,7 +1473,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
/* note: in prop mode we need at least 1 selected */
if (countsel==0) return;
- if(propmode) t->total = count;
+ if (propmode) t->total = count;
else t->total = countsel;
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Curve EditMode)");
@@ -1480,15 +1481,15 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
invert_m3_m3(smtx, mtx);
td = t->data;
- for(nu= nurbs->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= nurbs->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
TransData *head, *tail;
head = tail = td;
- for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
- if(bezt->hide==0) {
+ for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
+ if (bezt->hide==0) {
TransDataCurveHandleFlags *hdata = NULL;
- if( propmode ||
+ if ( propmode ||
((bezt->f2 & SELECT) && hide_handles) ||
((bezt->f1 & SELECT) && hide_handles == 0)
) {
@@ -1496,10 +1497,11 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
td->loc= bezt->vec[0];
copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:0]);
if (hide_handles) {
- if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
+ if (bezt->f2 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
- } else {
- if(bezt->f1 & SELECT) td->flag= TD_SELECTED;
+ }
+ else {
+ if (bezt->f1 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
}
td->ext = NULL;
@@ -1516,21 +1518,23 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
}
/* This is the Curve Point, the other two are handles */
- if(propmode || (bezt->f2 & SELECT)) {
+ if (propmode || (bezt->f2 & SELECT)) {
copy_v3_v3(td->iloc, bezt->vec[1]);
td->loc= bezt->vec[1];
copy_v3_v3(td->center, td->loc);
- if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
+ if (bezt->f2 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
td->ext = NULL;
if (t->mode==TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */
td->val = &(bezt->radius);
td->ival = bezt->radius;
- } else if (t->mode==TFM_TILT) {
+ }
+ else if (t->mode==TFM_TILT) {
td->val = &(bezt->alfa);
td->ival = bezt->alfa;
- } else {
+ }
+ else {
td->val = NULL;
}
@@ -1547,7 +1551,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
count++;
tail++;
}
- if( propmode ||
+ if ( propmode ||
((bezt->f2 & SELECT) && hide_handles) ||
((bezt->f3 & SELECT) && hide_handles == 0)
) {
@@ -1555,10 +1559,11 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
td->loc= bezt->vec[2];
copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:2]);
if (hide_handles) {
- if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
+ if (bezt->f2 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
- } else {
- if(bezt->f3 & SELECT) td->flag= TD_SELECTED;
+ }
+ else {
+ if (bezt->f3 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
}
td->ext = NULL;
@@ -1594,20 +1599,21 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
else {
TransData *head, *tail;
head = tail = td;
- for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
- if(bp->hide==0) {
- if(propmode || (bp->f1 & SELECT)) {
+ for (a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
+ if (bp->hide==0) {
+ if (propmode || (bp->f1 & SELECT)) {
copy_v3_v3(td->iloc, bp->vec);
td->loc= bp->vec;
copy_v3_v3(td->center, td->loc);
- if(bp->f1 & SELECT) td->flag= TD_SELECTED;
+ if (bp->f1 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
td->ext = NULL;
if (t->mode==TFM_CURVE_SHRINKFATTEN || t->mode==TFM_RESIZE) {
td->val = &(bp->radius);
td->ival = bp->radius;
- } else {
+ }
+ else {
td->val = &(bp->alfa);
td->ival = bp->alfa;
}
@@ -1645,10 +1651,10 @@ static void createTransLatticeVerts(TransInfo *t)
bp = latt->def;
a = latt->pntsu * latt->pntsv * latt->pntsw;
- while(a--) {
- if(bp->hide==0) {
- if(bp->f1 & SELECT) countsel++;
- if(propmode) count++;
+ while (a--) {
+ if (bp->hide==0) {
+ if (bp->f1 & SELECT) countsel++;
+ if (propmode) count++;
}
bp++;
}
@@ -1656,7 +1662,7 @@ static void createTransLatticeVerts(TransInfo *t)
/* note: in prop mode we need at least 1 selected */
if (countsel==0) return;
- if(propmode) t->total = count;
+ if (propmode) t->total = count;
else t->total = countsel;
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Lattice EditMode)");
@@ -1666,13 +1672,13 @@ static void createTransLatticeVerts(TransInfo *t)
td = t->data;
bp = latt->def;
a = latt->pntsu * latt->pntsv * latt->pntsw;
- while(a--) {
- if(propmode || (bp->f1 & SELECT)) {
- if(bp->hide==0) {
+ while (a--) {
+ if (propmode || (bp->f1 & SELECT)) {
+ if (bp->hide==0) {
copy_v3_v3(td->iloc, bp->vec);
td->loc= bp->vec;
copy_v3_v3(td->center, td->loc);
- if(bp->f1 & SELECT) td->flag= TD_SELECTED;
+ if (bp->f1 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
copy_m3_m3(td->smtx, smtx);
copy_m3_m3(td->mtx, mtx);
@@ -1706,33 +1712,33 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
int count = 0, hasselected = 0;
int propmode = t->flag & T_PROP_EDIT;
- if(edit==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return;
+ if (edit==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return;
psys = edit->psys;
- if(psys)
+ if (psys)
psmd = psys_get_modifier(ob,psys);
base->flag |= BA_HAS_RECALC_DATA;
- for(i=0, point=edit->points; i<edit->totpoint; i++, point++) {
+ for (i=0, point=edit->points; i<edit->totpoint; i++, point++) {
point->flag &= ~PEP_TRANSFORM;
transformparticle= 0;
- if((point->flag & PEP_HIDE)==0) {
- for(k=0, key=point->keys; k<point->totkey; k++, key++) {
- if((key->flag&PEK_HIDE)==0) {
- if(key->flag&PEK_SELECT) {
+ if ((point->flag & PEP_HIDE)==0) {
+ for (k=0, key=point->keys; k<point->totkey; k++, key++) {
+ if ((key->flag&PEK_HIDE)==0) {
+ if (key->flag&PEK_SELECT) {
hasselected= 1;
transformparticle= 1;
}
- else if(propmode)
+ else if (propmode)
transformparticle= 1;
}
}
}
- if(transformparticle) {
+ if (transformparticle) {
count += point->totkey;
point->flag |= PEP_TRANSFORM;
}
@@ -1744,7 +1750,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
t->total = count;
td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Particle Mode)");
- if(t->mode == TFM_BAKE_TIME)
+ if (t->mode == TFM_BAKE_TIME)
tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "Particle_TransExtension");
else
tx = t->ext = NULL;
@@ -1753,17 +1759,17 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
invert_m4_m4(ob->imat,ob->obmat);
- for(i=0, point=edit->points; i<edit->totpoint; i++, point++) {
+ for (i=0, point=edit->points; i<edit->totpoint; i++, point++) {
TransData *head, *tail;
head = tail = td;
- if(!(point->flag & PEP_TRANSFORM)) continue;
+ if (!(point->flag & PEP_TRANSFORM)) continue;
- if(psys && !(psys->flag & PSYS_GLOBAL_HAIR))
+ if (psys && !(psys->flag & PSYS_GLOBAL_HAIR))
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
- for(k=0, key=point->keys; k<point->totkey; k++, key++) {
- if(key->flag & PEK_USE_WCO) {
+ for (k=0, key=point->keys; k<point->totkey; k++, key++) {
+ if (key->flag & PEK_USE_WCO) {
copy_v3_v3(key->world_co, key->co);
mul_m4_v3(mat, key->world_co);
td->loc = key->world_co;
@@ -1774,34 +1780,34 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
copy_v3_v3(td->iloc, td->loc);
copy_v3_v3(td->center, td->loc);
- if(key->flag & PEK_SELECT)
+ if (key->flag & PEK_SELECT)
td->flag |= TD_SELECTED;
- else if(!propmode)
+ else if (!propmode)
td->flag |= TD_SKIP;
unit_m3(td->mtx);
unit_m3(td->smtx);
/* don't allow moving roots */
- if(k==0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR)))
+ if (k==0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR)))
td->protectflag |= OB_LOCK_LOC;
td->ob = ob;
td->ext = tx;
- if(t->mode == TFM_BAKE_TIME) {
+ if (t->mode == TFM_BAKE_TIME) {
td->val = key->time;
td->ival = *(key->time);
/* abuse size and quat for min/max values */
td->flag |= TD_NO_EXT;
- if(k==0) tx->size = NULL;
+ if (k==0) tx->size = NULL;
else tx->size = (key - 1)->time;
- if(k == point->totkey - 1) tx->quat = NULL;
+ if (k == point->totkey - 1) tx->quat = NULL;
else tx->quat = (key + 1)->time;
}
td++;
- if(tx)
+ if (tx)
tx++;
tail++;
}
@@ -1823,26 +1829,26 @@ void flushTransParticles(TransInfo *t)
float mat[4][4], imat[4][4], co[3];
int i, k, propmode = t->flag & T_PROP_EDIT;
- if(psys)
+ if (psys)
psmd = psys_get_modifier(ob, psys);
/* we do transform in world space, so flush world space position
* back to particle local space (only for hair particles) */
td= t->data;
- for(i=0, point=edit->points; i<edit->totpoint; i++, point++, td++) {
- if(!(point->flag & PEP_TRANSFORM)) continue;
+ for (i=0, point=edit->points; i<edit->totpoint; i++, point++, td++) {
+ if (!(point->flag & PEP_TRANSFORM)) continue;
- if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+ if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
invert_m4_m4(imat,mat);
- for(k=0, key=point->keys; k<point->totkey; k++, key++) {
+ for (k=0, key=point->keys; k<point->totkey; k++, key++) {
copy_v3_v3(co, key->world_co);
mul_m4_v3(imat, co);
/* optimization for proportional edit */
- if(!propmode || !compare_v3v3(key->co, co, 0.0001f)) {
+ if (!propmode || !compare_v3v3(key->co, co, 0.0001f)) {
copy_v3_v3(key->co, co);
point->flag |= PEP_EDIT_RECALC;
}
@@ -1985,10 +1991,10 @@ static void VertsToTransData(TransInfo *t, TransData *td, BMEditMesh *em, BMVert
copy_v3_v3(td->center, td->loc);
- if(t->around==V3D_LOCAL) {
- if(em->selectmode & SCE_SELECT_FACE)
+ if (t->around==V3D_LOCAL) {
+ if (em->selectmode & SCE_SELECT_FACE)
get_face_center(td->center, em->bm, eve);
- else if(em->selectmode & SCE_SELECT_EDGE)
+ else if (em->selectmode & SCE_SELECT_EDGE)
get_edge_center(td->center, em->bm, eve);
}
copy_v3_v3(td->iloc, td->loc);
@@ -2044,19 +2050,19 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
* use the values for vertex mirror - campbell */
// transform now requires awareness for select mode, so we tag the f1 flags in verts
- if(selectmode & SCE_SELECT_VERTEX) {
+ if (selectmode & SCE_SELECT_VERTEX) {
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
BM_elem_flag_set(eve, BM_ELEM_TAG, BM_elem_flag_test(eve, BM_ELEM_SELECT));
}
}
- else if(selectmode & SCE_SELECT_EDGE) {
+ else if (selectmode & SCE_SELECT_EDGE) {
BMEdge *eed;
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
+ for ( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
eed = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL);
- for( ; eed; eed=BM_iter_step(&iter)) {
+ for ( ; eed; eed=BM_iter_step(&iter)) {
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
BM_elem_flag_enable(eed->v1, BM_ELEM_TAG);
BM_elem_flag_enable(eed->v2, BM_ELEM_TAG);
@@ -2066,10 +2072,10 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
else {
BMFace *efa;
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
+ for ( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
efa = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL);
- for( ; efa; efa=BM_iter_step(&iter)) {
+ for ( ; efa; efa=BM_iter_step(&iter)) {
if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BMIter liter;
BMLoop *l;
@@ -2087,13 +2093,13 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
* verts*/
selstate = MEM_callocN(sizeof(*selstate) * bm->totvert, __func__);
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for(a=0; eve; eve=BM_iter_step(&iter), a++) {
+ for (a=0; eve; eve=BM_iter_step(&iter), a++) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
if (BM_elem_flag_test(eve, BM_ELEM_TAG)) {
selstate[a] = 1;
countsel++;
}
- if(propmode) count++;
+ if (propmode) count++;
}
}
@@ -2111,7 +2117,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
- if(propmode) {
+ if (propmode) {
t->total = count;
/* allocating scratch arrays */
@@ -2125,13 +2131,13 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
copy_m3_m4(mtx, t->obedit->obmat);
invert_m3_m3(smtx, mtx);
- if(propmode & T_PROP_CONNECTED) {
+ if (propmode & T_PROP_CONNECTED) {
editmesh_set_connectivity_distance(em, mtx, dists);
}
/* detect CrazySpace [tm] */
- if(modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) {
- if(modifiers_isCorrectableDeformed(t->obedit)) {
+ if (modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) {
+ if (modifiers_isCorrectableDeformed(t->obedit)) {
/* check if we can use deform matrices for modifier from the
* start up to stack, they are more accurate than quats */
totleft= editbmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos);
@@ -2139,25 +2145,25 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
/* if we still have more modifiers, also do crazyspace
* correction with quats, relative to the coordinates after
* the modifiers that support deform matrices (defcos) */
- if(totleft > 0) {
+ if (totleft > 0) {
mappedcos= crazyspace_get_mapped_editverts(t->scene, t->obedit);
quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats");
crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats); /* BMESH_TODO, abuses vertex index, should use an int array */
- if(mappedcos)
+ if (mappedcos)
MEM_freeN(mappedcos);
}
- if(defcos)
+ if (defcos)
MEM_freeN(defcos);
}
}
/* find out which half we do */
- if(mirror) {
+ if (mirror) {
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for(a=0; eve; eve=BM_iter_step(&iter), a++) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && selstate[a] && eve->co[0]!=0.0f) {
- if(eve->co[0]<0.0f)
+ for (a=0; eve; eve=BM_iter_step(&iter), a++) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && selstate[a] && eve->co[0]!=0.0f) {
+ if (eve->co[0]<0.0f)
{
t->mirror = -1;
mirror = -1;
@@ -2168,37 +2174,38 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
- for(a=0; eve; eve=BM_iter_step(&iter), a++) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- if(propmode || selstate[a]) {
+ for (a=0; eve; eve=BM_iter_step(&iter), a++) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ if (propmode || selstate[a]) {
float *bweight = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_BWEIGHT);
VertsToTransData(t, tob, em, eve, bweight);
/* selected */
- if(selstate[a]) tob->flag |= TD_SELECTED;
+ if (selstate[a]) tob->flag |= TD_SELECTED;
/* active */
- if(eve == eve_act) tob->flag |= TD_ACTIVE;
+ if (eve == eve_act) tob->flag |= TD_ACTIVE;
- if(propmode) {
+ if (propmode) {
if (propmode & T_PROP_CONNECTED) {
tob->dist = dists[a];
- } else {
+ }
+ else {
tob->flag |= TD_NOTCONNECTED;
tob->dist = MAXFLOAT;
}
}
/* CrazySpace */
- if(defmats || (quats && BM_elem_index_get(eve) != -1)) {
+ if (defmats || (quats && BM_elem_index_get(eve) != -1)) {
float mat[3][3], qmat[3][3], imat[3][3];
/* use both or either quat and defmat correction */
- if(quats && BM_elem_index_get(eve) != -1) {
+ if (quats && BM_elem_index_get(eve) != -1) {
quat_to_mat3(qmat, quats + 4*BM_elem_index_get(eve));
- if(defmats)
+ if (defmats)
mul_serie_m3(mat, mtx, qmat, defmats[a],
NULL, NULL, NULL, NULL, NULL);
else
@@ -2218,9 +2225,9 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
/* Mirror? */
- if( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
+ if ( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
BMVert *vmir= EDBM_GetMirrorVert(em, eve); //t->obedit, em, eve, tob->iloc, a);
- if(vmir && vmir != eve) {
+ if (vmir && vmir != eve) {
tob->extra = vmir;
}
}
@@ -2232,7 +2239,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
if (mirror != 0)
{
tob = t->data;
- for( a = 0; a < t->total; a++, tob++ )
+ for ( a = 0; a < t->total; a++, tob++ )
{
if (ABS(tob->loc[0]) <= 0.00001f)
{
@@ -2243,9 +2250,9 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
cleanup:
/* crazy space free */
- if(quats)
+ if (quats)
MEM_freeN(quats);
- if(defmats)
+ if (defmats)
MEM_freeN(defmats);
if (dists)
MEM_freeN(dists);
@@ -2265,13 +2272,13 @@ void flushTransNodes(TransInfo *t)
TransData2D *td;
/* flush to 2d vector from internally used 3d vector */
- for(a=0, td= t->data2d; a<t->total; a++, td++) {
+ for (a=0, td= t->data2d; a<t->total; a++, td++) {
td->loc2d[0]= td->loc[0];
td->loc2d[1]= td->loc[1];
}
/* handle intersection with noodles */
- if(t->total==1) {
+ if (t->total==1) {
ED_node_link_intersect_test(t->sa, 1);
}
@@ -2301,7 +2308,7 @@ void flushTransSeq(TransInfo *t)
Sequence *seq_prev= NULL;
/* flush to 2d vector from internally used 3d vector */
- for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
+ for (a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
tdsq= (TransDataSeq *)td->extra;
seq= tdsq->seq;
old_start = seq->start;
@@ -2334,7 +2341,7 @@ void flushTransSeq(TransInfo *t)
}
if (seq != seq_prev) {
- if(seq->depth==0) {
+ if (seq->depth==0) {
/* Calculate this strip and all nested strips
* children are ALWAYS transformed first
* so we don't need to do this in another loop. */
@@ -2344,7 +2351,7 @@ void flushTransSeq(TransInfo *t)
calc_sequence_disp(t->scene, seq);
}
- if(tdsq->sel_flag == SELECT)
+ if (tdsq->sel_flag == SELECT)
seq_offset_animdata(t->scene, seq, seq->start - old_start);
}
seq_prev= seq;
@@ -2370,16 +2377,16 @@ void flushTransSeq(TransInfo *t)
/* need to do the overlap check in a new loop otherwise adjacent strips
* will not be updated and we'll get false positives */
seq_prev= NULL;
- for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
+ for (a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
tdsq= (TransDataSeq *)td->extra;
seq= tdsq->seq;
if (seq != seq_prev) {
- if(seq->depth==0) {
+ if (seq->depth==0) {
/* test overlap, displayes red outline */
seq->flag &= ~SEQ_OVERLAP;
- if( seq_test_overlap(seqbasep, seq) ) {
+ if ( seq_test_overlap(seqbasep, seq) ) {
seq->flag |= SEQ_OVERLAP;
}
}
@@ -2415,7 +2422,7 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f
td->ext= NULL; td->val= NULL;
- if(selected) {
+ if (selected) {
td->flag |= TD_SELECTED;
td->dist= 0.0;
}
@@ -2442,13 +2449,13 @@ static void createTransUVs(bContext *C, TransInfo *t)
int count=0, countsel=0;
int propmode = t->flag & T_PROP_EDIT;
- if(!ED_space_image_show_uvedit(sima, t->obedit)) return;
+ if (!ED_space_image_show_uvedit(sima, t->obedit)) return;
/* count */
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- if(!uvedit_face_visible(scene, ima, efa, tf)) {
+ if (!uvedit_face_visible(scene, ima, efa, tf)) {
BM_elem_flag_disable(efa, BM_ELEM_TAG);
continue;
}
@@ -2458,7 +2465,7 @@ static void createTransUVs(bContext *C, TransInfo *t)
if (uvedit_uv_selected(em, scene, l))
countsel++;
- if(propmode)
+ if (propmode)
count++;
}
}
@@ -2472,7 +2479,7 @@ static void createTransUVs(bContext *C, TransInfo *t)
* treated just as if they were 3d verts */
t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransObData2D(UV Editing)");
- if(sima->flag & SI_CLIP_UV)
+ if (sima->flag & SI_CLIP_UV)
t->flag |= T_CLIP_UV;
td= t->data;
@@ -2508,11 +2515,11 @@ void flushTransUVs(TransInfo *t)
invy= 1.0f/aspy;
/* flush to 2d vector from internally used 3d vector */
- for(a=0, td= t->data2d; a<t->total; a++, td++) {
+ for (a=0, td= t->data2d; a<t->total; a++, td++) {
td->loc2d[0]= td->loc[0]*invx;
td->loc2d[1]= td->loc[1]*invy;
- if((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
+ if ((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
td->loc2d[0]= (float)floor(width*td->loc2d[0] + 0.5f)/width;
td->loc2d[1]= (float)floor(height*td->loc2d[1] + 0.5f)/height;
}
@@ -2529,36 +2536,36 @@ int clipUVTransform(TransInfo *t, float *vec, int resize)
min[0]= min[1]= 0.0f;
max[0]= aspx; max[1]= aspy;
- for(a=0, td= t->data; a<t->total; a++, td++) {
+ for (a=0, td= t->data; a<t->total; a++, td++) {
DO_MINMAX2(td->loc, min, max);
}
- if(resize) {
- if(min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx*0.5f)
+ if (resize) {
+ if (min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx*0.5f)
vec[0] *= t->center[0]/(t->center[0] - min[0]);
- else if(max[0] > aspx && t->center[0] < aspx)
+ else if (max[0] > aspx && t->center[0] < aspx)
vec[0] *= (t->center[0] - aspx)/(t->center[0] - max[0]);
else
clipx= 0;
- if(min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy*0.5f)
+ if (min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy*0.5f)
vec[1] *= t->center[1]/(t->center[1] - min[1]);
- else if(max[1] > aspy && t->center[1] < aspy)
+ else if (max[1] > aspy && t->center[1] < aspy)
vec[1] *= (t->center[1] - aspy)/(t->center[1] - max[1]);
else
clipy= 0;
}
else {
- if(min[0] < 0.0f)
+ if (min[0] < 0.0f)
vec[0] -= min[0];
- else if(max[0] > aspx)
+ else if (max[0] > aspx)
vec[0] -= max[0]-aspx;
else
clipx= 0;
- if(min[1] < 0.0f)
+ if (min[1] < 0.0f)
vec[1] -= min[1];
- else if(max[1] > aspy)
+ else if (max[1] > aspy)
vec[1] -= max[1]-aspy;
else
clipy= 0;
@@ -3711,9 +3718,9 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
td2d->loc2d= (bezts + bezm->newIndex)->vec[1];
/* if only control point is selected, the handle pointers need to be updated as well */
- if(td2d->h1)
+ if (td2d->h1)
td2d->h1= (bezts + bezm->newIndex)->vec[0];
- if(td2d->h2)
+ if (td2d->h2)
td2d->h2= (bezts + bezm->newIndex)->vec[2];
adjusted[j] = 1;
@@ -3721,7 +3728,7 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
/* the handle type pointer has to be updated too */
if (adjusted[j] && td->flag & TD_BEZTRIPLE && td->hdata) {
- if(bezm->swapHs == 1) {
+ if (bezm->swapHs == 1) {
td->hdata->h1 = &(bezts + bezm->newIndex)->h2;
td->hdata->h2 = &(bezts + bezm->newIndex)->h1;
}
@@ -3890,7 +3897,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
else *flag |= SEQ_LEFTSEL;
}
}
- } else {
+ }
+ else {
t->frame_side= 'B';
@@ -3910,7 +3918,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
if ((seq->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) == (SEQ_LEFTSEL|SEQ_RIGHTSEL)) {
*flag= seq->flag;
*count= 2; /* we need 2 transdata's */
- } else {
+ }
+ else {
*flag= seq->flag;
*count= 1; /* selected or with a handle selected */
}
@@ -4086,7 +4095,7 @@ static void freeSeqData(TransInfo *t)
{
Editing *ed= seq_give_editing(t->scene, FALSE);
- if(ed != NULL) {
+ if (ed != NULL) {
ListBase *seqbasep= ed->seqbasep;
TransData *td= t->data;
int a;
@@ -4103,7 +4112,7 @@ static void freeSeqData(TransInfo *t)
#if 0 // default 2.4 behavior
/* flush to 2d vector from internally used 3d vector */
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
seq= ((TransDataSeq *)td->extra)->seq;
shuffle_seq(seqbasep, seq);
@@ -4116,7 +4125,7 @@ static void freeSeqData(TransInfo *t)
{
int overlap= 0;
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq_prev= NULL;
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
@@ -4126,18 +4135,18 @@ static void freeSeqData(TransInfo *t)
seq_prev= seq;
}
- if(overlap) {
+ if (overlap) {
int has_effect= 0;
- for(seq= seqbasep->first; seq; seq= seq->next)
+ for (seq= seqbasep->first; seq; seq= seq->next)
seq->tmp= NULL;
td= t->data;
seq_prev= NULL;
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev)) {
/* check effects strips, we cant change their time */
- if((seq->type & SEQ_EFFECT) && seq->seq1) {
+ if ((seq->type & SEQ_EFFECT) && seq->seq1) {
has_effect= TRUE;
}
else {
@@ -4149,14 +4158,14 @@ static void freeSeqData(TransInfo *t)
shuffle_seq_time(seqbasep, t->scene);
- if(has_effect) {
+ if (has_effect) {
/* update effects strips based on strips just moved in time */
td= t->data;
seq_prev= NULL;
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev)) {
- if((seq->type & SEQ_EFFECT) && seq->seq1) {
+ if ((seq->type & SEQ_EFFECT) && seq->seq1) {
calc_sequence(t->scene, seq);
}
}
@@ -4165,11 +4174,11 @@ static void freeSeqData(TransInfo *t)
/* now if any effects _still_ overlap, we need to move them up */
td= t->data;
seq_prev= NULL;
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev)) {
- if((seq->type & SEQ_EFFECT) && seq->seq1) {
- if(seq_test_overlap(seqbasep, seq)) {
+ if ((seq->type & SEQ_EFFECT) && seq->seq1) {
+ if (seq_test_overlap(seqbasep, seq)) {
shuffle_seq(seqbasep, seq, t->scene);
}
}
@@ -4181,9 +4190,9 @@ static void freeSeqData(TransInfo *t)
}
#endif
- for(seq= seqbasep->first; seq; seq= seq->next) {
+ for (seq= seqbasep->first; seq; seq= seq->next) {
/* We might want to build a list of effects that need to be updated during transform */
- if(seq->type & SEQ_EFFECT) {
+ if (seq->type & SEQ_EFFECT) {
if (seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(t->scene, seq);
else if (seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(t->scene, seq);
else if (seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(t->scene, seq);
@@ -4194,7 +4203,7 @@ static void freeSeqData(TransInfo *t)
}
else {
/* Cancelled, need to update the strips display */
- for(a=0; a<t->total; a++, td++) {
+ for (a=0; a<t->total; a++, td++) {
seq= ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev) && (seq->depth==0)) {
calc_sequence_disp(t->scene, seq);
@@ -4250,12 +4259,12 @@ static void createTransSeqData(bContext *C, TransInfo *t)
#ifdef XXX_DURIAN_ANIM_TX_HACK
{
Sequence *seq;
- for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
/* hack */
- if((seq->flag & SELECT)==0 && seq->type & SEQ_EFFECT) {
+ if ((seq->flag & SELECT)==0 && seq->type & SEQ_EFFECT) {
Sequence *seq_user;
int i;
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
seq_user= *((&seq->seq1) + i);
if ( seq_user && (seq_user->flag & SELECT) &&
!(seq_user->flag & SEQ_LOCK) &&
@@ -4458,7 +4467,7 @@ static void set_trans_object_base_flags(TransInfo *t)
Base *base;
/* don't do it if we're not actually going to recalculate anything */
- if(t->mode == TFM_DUMMY)
+ if (t->mode == TFM_DUMMY)
return;
/* makes sure base flags and object flags are identical */
@@ -4466,22 +4475,22 @@ static void set_trans_object_base_flags(TransInfo *t)
/* handle pending update events, otherwise they got copied below */
for (base= scene->base.first; base; base= base->next) {
- if(base->object->recalc)
+ if (base->object->recalc)
object_handle_update(t->scene, base->object);
}
for (base= scene->base.first; base; base= base->next) {
base->flag &= ~BA_WAS_SEL;
- if(TESTBASELIB_BGMODE(v3d, scene, base)) {
+ if (TESTBASELIB_BGMODE(v3d, scene, base)) {
Object *ob= base->object;
Object *parsel= ob->parent;
/* if parent selected, deselect */
- while(parsel) {
- if(parsel->flag & SELECT) {
+ while (parsel) {
+ if (parsel->flag & SELECT) {
Base *parbase = object_in_scene(parsel, scene);
- if(parbase) { /* in rare cases this can fail */
+ if (parbase) { /* in rare cases this can fail */
if TESTBASELIB_BGMODE(v3d, scene, parbase) {
break;
}
@@ -4490,12 +4499,13 @@ static void set_trans_object_base_flags(TransInfo *t)
parsel= parsel->parent;
}
- if(parsel)
+ if (parsel)
{
/* rotation around local centers are allowed to propagate */
if ((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL) {
base->flag |= BA_TRANSFORM_CHILD;
- } else {
+ }
+ else {
base->flag &= ~SELECT;
base->flag |= BA_WAS_SEL;
}
@@ -4511,9 +4521,9 @@ static void set_trans_object_base_flags(TransInfo *t)
/* and we store them temporal in base (only used for transform code) */
/* this because after doing updates, the object->recalc is cleared */
for (base= scene->base.first; base; base= base->next) {
- if(base->object->recalc & OB_RECALC_OB)
+ if (base->object->recalc & OB_RECALC_OB)
base->flag |= BA_HAS_RECALC_OB;
- if(base->object->recalc & OB_RECALC_DATA)
+ if (base->object->recalc & OB_RECALC_DATA)
base->flag |= BA_HAS_RECALC_DATA;
}
}
@@ -4547,11 +4557,11 @@ static int count_proportional_objects(TransInfo *t)
{
/* mark all parents */
for (base= scene->base.first; base; base= base->next) {
- if(TESTBASELIB_BGMODE(v3d, scene, base)) {
+ if (TESTBASELIB_BGMODE(v3d, scene, base)) {
Object *parent = base->object->parent;
/* flag all parents */
- while(parent) {
+ while (parent) {
parent->flag |= BA_TRANSFORM_PARENT;
parent = parent->parent;
}
@@ -4591,9 +4601,9 @@ static int count_proportional_objects(TransInfo *t)
/* and we store them temporal in base (only used for transform code) */
/* this because after doing updates, the object->recalc is cleared */
for (base= scene->base.first; base; base= base->next) {
- if(base->object->recalc & OB_RECALC_OB)
+ if (base->object->recalc & OB_RECALC_OB)
base->flag |= BA_HAS_RECALC_OB;
- if(base->object->recalc & OB_RECALC_DATA)
+ if (base->object->recalc & OB_RECALC_DATA)
base->flag |= BA_HAS_RECALC_DATA;
}
@@ -4607,7 +4617,7 @@ static void clear_trans_object_base_flags(TransInfo *t)
for (base= sce->base.first; base; base = base->next)
{
- if(base->flag & BA_WAS_SEL)
+ if (base->flag & BA_WAS_SEL)
base->flag |= SELECT;
base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_TEMP_TAG|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT);
@@ -4868,7 +4878,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (t->obedit) {
if (canceled==0) {
/* we need to delete the temporary faces before automerging */
- if(t->mode == TFM_EDGE_SLIDE){
+ if (t->mode == TFM_EDGE_SLIDE) {
SlideData *sld = t->customData;
/* handle multires re-projection, done
@@ -4910,8 +4920,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* cant use , TFM_TIME_EXTEND
* for some reason EXTEND is changed into TRANSLATE, so use frame_side instead */
- if(t->mode == TFM_SEQ_SLIDE) {
- if(t->frame_side == 'B')
+ if (t->mode == TFM_SEQ_SLIDE) {
+ if (t->frame_side == 'B')
ED_markers_post_apply_transform(&t->scene->markers, t->scene, TFM_TIME_TRANSLATE, t->values[0], t->frame_side);
}
else if (ELEM(t->frame_side, 'L', 'R')) {
@@ -4924,7 +4934,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
SpaceNode *snode= (SpaceNode *)t->sa->spacedata.first;
ED_node_update_hierarchy(C, snode->edittree);
- if(canceled == 0)
+ if (canceled == 0)
ED_node_link_insert(t->sa);
/* clear link line */
@@ -4934,7 +4944,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
SpaceClip *sc= t->sa->spacedata.first;
MovieClip *clip= ED_space_clip(sc);
- if(t->scene->nodetree) {
+ if (t->scene->nodetree) {
/* tracks can be used for stabilization nodes,
* flush update for such nodes */
nodeUpdateID(t->scene->nodetree, &clip->id);
@@ -5104,7 +5114,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* Note: if the refresh is really needed after cancel then some way
* has to be added to not update handle types (see bug 22289).
*/
- if(!canceled)
+ if (!canceled)
ANIM_editkeyframes_refresh(&ac);
}
else if (t->spacetype == SPACE_NLA) {
@@ -5156,7 +5166,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
ob= t->poseobj;
arm= ob->data;
- if((t->flag & T_AUTOIK) && (t->options & CTX_AUTOCONFIRM)) {
+ if ((t->flag & T_AUTOIK) && (t->options & CTX_AUTOCONFIRM)) {
/* when running transform non-interactively (operator exec),
* we need to update the pose otherwise no updates get called during
* transform and the auto-ik is not applied. see [#26164] */
@@ -5175,7 +5185,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* not forget to clear the auto flag */
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
bKinematicConstraint *data= has_targetless_ik(pchan);
- if(data) data->flag &= ~CONSTRAINT_IK_AUTO;
+ if (data) data->flag &= ~CONSTRAINT_IK_AUTO;
}
}
@@ -5220,8 +5230,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* flag object caches as outdated */
BKE_ptcache_ids_from_object(&pidlist, ob, t->scene, MAX_DUPLI_RECUR);
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
+ for (pid=pidlist.first; pid; pid=pid->next) {
+ if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
pid->cache->flag |= PTCACHE_OUTDATED;
}
BLI_freelistN(&pidlist);
@@ -5270,7 +5280,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
#if 0 // TRANSFORM_FIX_ME
- if(resetslowpar)
+ if (resetslowpar)
reset_slowparents();
#endif
}
@@ -5286,7 +5296,7 @@ static void createTransObject(bContext *C, TransInfo *t)
/* count */
t->total= CTX_DATA_COUNT(C, selected_objects);
- if(!t->total) {
+ if (!t->total) {
/* clear here, main transform function escapes too */
clear_trans_object_base_flags(t);
return;
@@ -5390,7 +5400,7 @@ static void createTransNodeData(bContext *C, TransInfo *t)
SpaceNode *snode= t->sa->spacedata.first;
bNode *node;
- if(!snode->edittree) {
+ if (!snode->edittree) {
t->total= 0;
return;
}
@@ -5445,13 +5455,14 @@ static void markerToTransDataInit(TransData *td, TransData2D *td2d,
tdt->mode = transDataTracking_ModeTracks;
- if(anchor) {
+ if (anchor) {
td2d->loc[0] = rel[0]; /* hold original location */
td2d->loc[1] = rel[1];
tdt->loc= loc;
td2d->loc2d = loc; /* current location */
- } else {
+ }
+ else {
td2d->loc[0] = loc[0]; /* hold original location */
td2d->loc[1] = loc[1];
@@ -5465,8 +5476,8 @@ static void markerToTransDataInit(TransData *td, TransData2D *td2d,
tdt->markersnr= track->markersnr;
tdt->markers= track->markers;
- if(rel) {
- if(!anchor) {
+ if (rel) {
+ if (!anchor) {
td2d->loc[0]+= rel[0];
td2d->loc[1]+= rel[1];
}
@@ -5474,7 +5485,7 @@ static void markerToTransDataInit(TransData *td, TransData2D *td2d,
copy_v2_v2(tdt->srelative, rel);
}
- if(off)
+ if (off)
copy_v2_v2(tdt->soffset, off);
td->flag = 0;
@@ -5504,15 +5515,15 @@ static void trackToTransData(SpaceClip *sc, TransData *td, TransData2D *td2d,
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_POINT, track->offset, marker->pos, track->offset);
- if(track->flag&SELECT)
+ if (track->flag&SELECT)
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_POINT, marker->pos, NULL, NULL);
- if(track->pat_flag&SELECT) {
+ if (track->pat_flag&SELECT) {
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_PAT, track->pat_min, marker->pos, NULL);
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_PAT, track->pat_max, marker->pos, NULL);
}
- if(track->search_flag&SELECT) {
+ if (track->search_flag&SELECT) {
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_SEARCH, track->search_min, marker->pos, NULL);
markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_SEARCH, track->search_max, marker->pos, NULL);
}
@@ -5522,8 +5533,8 @@ static void transDataTrackingFree(TransInfo *t)
{
TransDataTracking *tdt= t->customData;
- if(tdt) {
- if(tdt->smarkers) MEM_freeN(tdt->smarkers);
+ if (tdt) {
+ if (tdt->smarkers) MEM_freeN(tdt->smarkers);
MEM_freeN(tdt);
}
}
@@ -5544,21 +5555,21 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
t->total = 0;
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
marker= BKE_tracking_get_marker(track, framenr);
t->total++; /* offset */
- if(track->flag&SELECT) t->total++;
- if(track->pat_flag&SELECT) t->total+= 2;
- if(track->search_flag&SELECT) t->total+= 2;
+ if (track->flag&SELECT) t->total++;
+ if (track->pat_flag&SELECT) t->total+= 2;
+ if (track->search_flag&SELECT) t->total+= 2;
}
track = track->next;
}
- if(t->total==0)
+ if (t->total==0)
return;
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransTracking TransData");
@@ -5569,8 +5580,8 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
/* create actual data */
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
marker= BKE_tracking_get_marker(track, framenr);
trackToTransData(sc, td, td2d, tdt, track);
@@ -5580,17 +5591,17 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
td2d++;
tdt++;
- if((marker->flag&MARKER_DISABLED)==0) {
- if(track->flag&SELECT) {td++; td2d++; tdt++;}
- if(track->pat_flag&SELECT) {td+= 2; td2d+= 2;tdt+=2;}
+ if ((marker->flag&MARKER_DISABLED)==0) {
+ if (track->flag&SELECT) {td++; td2d++; tdt++;}
+ if (track->pat_flag&SELECT) {td+= 2; td2d+= 2;tdt+=2;}
}
- if(track->search_flag&SELECT) {
+ if (track->search_flag&SELECT) {
td+= 2;
td2d+= 2;
tdt+= 2;
- if(marker->flag&MARKER_DISABLED) {
+ if (marker->flag&MARKER_DISABLED) {
td+= 3;
td2d+= 3;
tdt+= 3;
@@ -5658,19 +5669,19 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
t->total = 0;
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
- for(i = 1; i < track->markersnr; i++) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ for (i = 1; i < track->markersnr; i++) {
marker = &track->markers[i];
prev_marker = &track->markers[i-1];
- if((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
+ if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
continue;
- if(marker->flag & MARKER_GRAPH_SEL_X)
+ if (marker->flag & MARKER_GRAPH_SEL_X)
t->total += 1;
- if(marker->flag & MARKER_GRAPH_SEL_Y)
+ if (marker->flag & MARKER_GRAPH_SEL_Y)
t->total += 1;
}
}
@@ -5678,7 +5689,7 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
track = track->next;
}
- if(t->total==0)
+ if (t->total==0)
return;
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransTracking TransData");
@@ -5689,23 +5700,23 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
/* create actual data */
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
- for(i = 1; i < track->markersnr; i++) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ for (i = 1; i < track->markersnr; i++) {
marker = &track->markers[i];
prev_marker = &track->markers[i-1];
- if((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
+ if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
continue;
- if(marker->flag & MARKER_GRAPH_SEL_X) {
+ if (marker->flag & MARKER_GRAPH_SEL_X) {
markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i-1], 0, width);
td += 1;
td2d += 1;
tdt += 1;
}
- if(marker->flag & MARKER_GRAPH_SEL_Y) {
+ if (marker->flag & MARKER_GRAPH_SEL_Y) {
markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i-1], 1, height);
td += 1;
@@ -5727,13 +5738,13 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
t->total = 0;
- if(!clip || !BKE_movieclip_has_frame(clip, &sc->user))
+ if (!clip || !BKE_movieclip_has_frame(clip, &sc->user))
return;
- if(!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
+ if (!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
return;
- if(ar->regiontype == RGN_TYPE_PREVIEW) {
+ if (ar->regiontype == RGN_TYPE_PREVIEW) {
/* transformation was called from graph editor */
createTransTrackingCurvesData(C, t);
}
@@ -5752,37 +5763,37 @@ static void cancelTransTracking(TransInfo *t)
MovieTrackingMarker *marker;
int a, framenr = sc->user.framenr;
- if(tdt->mode == transDataTracking_ModeTracks) {
+ if (tdt->mode == transDataTracking_ModeTracks) {
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
marker = BKE_tracking_get_marker(track, framenr);
marker->flag = tdt->flag;
tdt++;
- if(track->flag&SELECT) tdt++;
- if(track->pat_flag&SELECT) tdt += 2;
- if(track->search_flag&SELECT) tdt += 2;
+ if (track->flag&SELECT) tdt++;
+ if (track->pat_flag&SELECT) tdt += 2;
+ if (track->search_flag&SELECT) tdt += 2;
}
track = track->next;
}
}
- else if(tdt->mode == transDataTracking_ModeCurves) {
+ else if (tdt->mode == transDataTracking_ModeCurves) {
MovieTrackingMarker *prev_marker;
track = tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
- for(a = 1; a < track->markersnr; a++) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ for (a = 1; a < track->markersnr; a++) {
marker = &track->markers[a];
prev_marker = &track->markers[a-1];
- if((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
+ if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
continue;
- if(marker->flag & (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y)) {
+ if (marker->flag & (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y)) {
marker->flag = tdt->flag;
}
}
@@ -5800,19 +5811,19 @@ void flushTransTracking(TransInfo *t)
TransDataTracking *tdt;
int a;
- if(t->state == TRANS_CANCEL)
+ if (t->state == TRANS_CANCEL)
cancelTransTracking(t);
/* flush to 2d vector from internally used 3d vector */
- for(a=0, td= t->data, td2d= t->data2d, tdt= t->customData; a<t->total; a++, td2d++, td++, tdt++) {
- if(tdt->mode == transDataTracking_ModeTracks) {
- if(t->flag&T_ALT_TRANSFORM) {
- if(tdt->area==TRACK_AREA_POINT && tdt->relative) {
+ for (a=0, td= t->data, td2d= t->data2d, tdt= t->customData; a<t->total; a++, td2d++, td++, tdt++) {
+ if (tdt->mode == transDataTracking_ModeTracks) {
+ if (t->flag&T_ALT_TRANSFORM) {
+ if (tdt->area==TRACK_AREA_POINT && tdt->relative) {
float d[2], d2[2];
- if(!tdt->smarkers) {
+ if (!tdt->smarkers) {
tdt->smarkers= MEM_callocN(sizeof(*tdt->smarkers)*tdt->markersnr, "flushTransTracking markers");
- for(a= 0; a<tdt->markersnr; a++)
+ for (a= 0; a<tdt->markersnr; a++)
copy_v2_v2(tdt->smarkers[a], tdt->markers[a].pos);
}
@@ -5821,22 +5832,22 @@ void flushTransTracking(TransInfo *t)
sub_v2_v2v2(d2, td2d->loc, tdt->srelative);
- for(a= 0; a<tdt->markersnr; a++)
+ for (a= 0; a<tdt->markersnr; a++)
add_v2_v2v2(tdt->markers[a].pos, tdt->smarkers[a], d2);
negate_v2_v2(td2d->loc2d, d);
}
}
- if(tdt->area!=TRACK_AREA_POINT || tdt->relative==0) {
+ if (tdt->area!=TRACK_AREA_POINT || tdt->relative==0) {
td2d->loc2d[0] = td2d->loc[0];
td2d->loc2d[1] = td2d->loc[1];
- if(tdt->relative)
+ if (tdt->relative)
sub_v2_v2(td2d->loc2d, tdt->relative);
}
}
- else if(tdt->mode == transDataTracking_ModeCurves) {
+ else if (tdt->mode == transDataTracking_ModeCurves) {
td2d->loc2d[tdt->coord] = tdt->prev_pos[tdt->coord] + td2d->loc[1] * tdt->scale;
}
}
@@ -5855,7 +5866,7 @@ void createTransData(bContext *C, TransInfo *t)
t->ext = NULL;
t->flag |= T_EDIT;
createTransEdge(t);
- if(t->data && t->flag & T_PROP_EDIT) {
+ if (t->data && t->flag & T_PROP_EDIT) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 1);
sort_trans_data_dist(t);
@@ -5868,7 +5879,7 @@ void createTransData(bContext *C, TransInfo *t)
else if (t->spacetype == SPACE_IMAGE) {
t->flag |= T_POINTS|T_2D_EDIT;
createTransUVs(C, t);
- if(t->data && (t->flag & T_PROP_EDIT)) {
+ if (t->data && (t->flag & T_PROP_EDIT)) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 1);
sort_trans_data_dist(t);
@@ -5898,7 +5909,7 @@ void createTransData(bContext *C, TransInfo *t)
}
#endif
}
- else if(t->spacetype == SPACE_NODE) {
+ else if (t->spacetype == SPACE_NODE) {
t->flag |= T_2D_EDIT|T_POINTS;
createTransNodeData(C, t);
if (t->data && (t->flag & T_PROP_EDIT)) {
@@ -5935,7 +5946,7 @@ void createTransData(bContext *C, TransInfo *t)
t->flag |= T_EDIT|T_POINTS;
- if(t->data && t->flag & T_PROP_EDIT) {
+ if (t->data && t->flag & T_PROP_EDIT) {
if (ELEM(t->obedit->type, OB_CURVE, OB_MESH)) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 0);
@@ -5949,7 +5960,7 @@ void createTransData(bContext *C, TransInfo *t)
}
/* exception... hackish, we want bonesize to use bone orientation matrix (ton) */
- if(t->mode==TFM_BONESIZE) {
+ if (t->mode==TFM_BONESIZE) {
t->flag &= ~(T_EDIT|T_POINTS);
t->flag |= T_POSE;
t->poseobj = ob; /* <- tsk tsk, this is going to give issues one day */
@@ -5964,11 +5975,11 @@ void createTransData(bContext *C, TransInfo *t)
/* important that ob_armature can be set even when its not selected [#23412]
* lines below just check is also visible */
Object *ob_armature= modifiers_isDeformedByArmature(ob);
- if(ob_armature && ob_armature->mode & OB_MODE_POSE) {
+ if (ob_armature && ob_armature->mode & OB_MODE_POSE) {
Base *base_arm= object_in_scene(ob_armature, t->scene);
- if(base_arm) {
+ if (base_arm) {
View3D *v3d = t->view;
- if(BASE_VISIBLE(v3d, base_arm)) {
+ if (BASE_VISIBLE(v3d, base_arm)) {
createTransPose(t, ob_armature);
}
}
@@ -5980,7 +5991,7 @@ void createTransData(bContext *C, TransInfo *t)
createTransParticleVerts(C, t);
t->flag |= T_POINTS;
- if(t->data && t->flag & T_PROP_EDIT) {
+ if (t->data && t->flag & T_PROP_EDIT) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 1);
sort_trans_data_dist(t);
@@ -5997,7 +6008,7 @@ void createTransData(bContext *C, TransInfo *t)
createTransObject(C, t);
t->flag |= T_OBJECT;
- if(t->data && t->flag & T_PROP_EDIT) {
+ if (t->data && t->flag & T_PROP_EDIT) {
// selected objects are already first, no need to presort
set_prop_dist(t, 1);
sort_trans_data_dist(t);
@@ -6007,7 +6018,7 @@ void createTransData(bContext *C, TransInfo *t)
{
View3D *v3d = t->view;
RegionView3D *rv3d = CTX_wm_region_view3d(C);
- if(rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
+ if (rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
{
t->flag |= T_CAMERA;
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 350d2365511..8e22ccd943d 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -147,17 +147,17 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
- if(mmd->flag & MOD_MIR_CLIPPING) {
+ if (mmd->flag & MOD_MIR_CLIPPING) {
axis = 0;
- if(mmd->flag & MOD_MIR_AXIS_X) {
+ if (mmd->flag & MOD_MIR_AXIS_X) {
axis |= 1;
tolerance[0] = mmd->tolerance;
}
- if(mmd->flag & MOD_MIR_AXIS_Y) {
+ if (mmd->flag & MOD_MIR_AXIS_Y) {
axis |= 2;
tolerance[1] = mmd->tolerance;
}
- if(mmd->flag & MOD_MIR_AXIS_Z) {
+ if (mmd->flag & MOD_MIR_AXIS_Z) {
axis |= 4;
tolerance[2] = mmd->tolerance;
}
@@ -174,7 +174,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
invert_m4_m4(imtx, mtx);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
int clip;
float loc[3], iloc[3];
@@ -195,8 +195,8 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
}
clip = 0;
- if(axis & 1) {
- if(fabsf(iloc[0])<=tolerance[0] ||
+ if (axis & 1) {
+ if (fabsf(iloc[0])<=tolerance[0] ||
loc[0]*iloc[0]<0.0f)
{
loc[0]= 0.0f;
@@ -204,16 +204,16 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
}
}
- if(axis & 2) {
- if(fabs(iloc[1])<=tolerance[1] ||
+ if (axis & 2) {
+ if (fabs(iloc[1])<=tolerance[1] ||
loc[1]*iloc[1]<0.0f)
{
loc[1]= 0.0f;
clip = 1;
}
}
- if(axis & 4) {
- if(fabs(iloc[2])<=tolerance[2] ||
+ if (axis & 4) {
+ if (fabs(iloc[2])<=tolerance[2] ||
loc[2]*iloc[2]<0.0f)
{
loc[2]= 0.0f;
@@ -241,7 +241,7 @@ static void editbmesh_apply_to_mirror(TransInfo *t)
BMVert *eve;
int i;
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
break;
if (td->loc==NULL)
@@ -627,7 +627,7 @@ static void recalcData_image(TransInfo *t)
SpaceImage *sima= t->sa->spacedata.first;
flushTransUVs(t);
- if(sima->flag & SI_LIVE_UNWRAP)
+ if (sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_re_solve();
DAG_id_tag_update(t->obedit->data, 0);
@@ -645,18 +645,18 @@ static void recalcData_clip(TransInfo *t)
flushTransTracking(t);
track= tracksbase->first;
- while(track) {
- if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+ while (track) {
+ if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
if (t->mode == TFM_TRANSLATION) {
- if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
+ if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
BKE_tracking_clamp_track(track, CLAMP_PAT_POS);
- if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
+ if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
BKE_tracking_clamp_track(track, CLAMP_SEARCH_POS);
}
else if (t->mode == TFM_RESIZE) {
- if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
+ if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
- if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
+ if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
}
}
@@ -678,7 +678,7 @@ static void recalcData_view3d(TransInfo *t)
ListBase *nurbs= curve_editnurbs(cu);
Nurb *nu= nurbs->first;
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
clipMirrorModifier(t, t->obedit);
applyProject(t);
}
@@ -686,40 +686,40 @@ static void recalcData_view3d(TransInfo *t)
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
if (t->state == TRANS_CANCEL) {
- while(nu) {
+ while (nu) {
calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
nu= nu->next;
}
}
else {
/* Normal updating */
- while(nu) {
+ while (nu) {
test2DNurb(nu);
calchandlesNurb(nu);
nu= nu->next;
}
}
}
- else if(t->obedit->type==OB_LATTICE) {
+ else if (t->obedit->type==OB_LATTICE) {
Lattice *la= t->obedit->data;
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
- if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
+ if (la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
}
else if (t->obedit->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(t->obedit);
/* mirror modifier clipping? */
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
/* apply clipping after so we never project past the clip plane [#25423] */
applyProject(t);
clipMirrorModifier(t, t->obedit);
}
- if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
+ if ((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
editbmesh_apply_to_mirror(t);
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
@@ -727,14 +727,14 @@ static void recalcData_view3d(TransInfo *t)
EDBM_RecalcNormals(em);
BMEdit_RecalcTessellation(em);
}
- else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
+ else if (t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
bArmature *arm= t->obedit->data;
ListBase *edbo = arm->edbo;
EditBone *ebo;
TransData *td = t->data;
int i;
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
@@ -745,27 +745,27 @@ static void recalcData_view3d(TransInfo *t)
/* If this bone has a parent tip that has been moved */
if (ebo->parent->flag & BONE_TIPSEL) {
copy_v3_v3 (ebo->head, ebo->parent->tail);
- if(t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
+ if (t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
}
/* If this bone has a parent tip that has NOT been moved */
- else{
+ else {
copy_v3_v3 (ebo->parent->tail, ebo->head);
- if(t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
+ if (t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
}
}
/* on extrude bones, oldlength==0.0f, so we scale radius of points */
ebo->length= len_v3v3(ebo->head, ebo->tail);
- if(ebo->oldlength==0.0f) {
+ if (ebo->oldlength==0.0f) {
ebo->rad_head= 0.25f*ebo->length;
ebo->rad_tail= 0.10f*ebo->length;
ebo->dist= 0.25f*ebo->length;
- if(ebo->parent) {
- if(ebo->rad_head > ebo->parent->rad_tail)
+ if (ebo->parent) {
+ if (ebo->rad_head > ebo->parent->rad_tail)
ebo->rad_head= ebo->parent->rad_tail;
}
}
- else if(t->mode!=TFM_BONE_ENVELOPE) {
+ else if (t->mode!=TFM_BONE_ENVELOPE) {
/* if bones change length, lets do that for the deform distance as well */
ebo->dist*= ebo->length/ebo->oldlength;
ebo->rad_head*= ebo->length/ebo->oldlength;
@@ -778,7 +778,7 @@ static void recalcData_view3d(TransInfo *t)
if (t->mode != TFM_BONE_ROLL)
{
/* fix roll */
- for(i = 0; i < t->total; i++, td++)
+ for (i = 0; i < t->total; i++, td++)
{
if (td->extra)
{
@@ -804,18 +804,18 @@ static void recalcData_view3d(TransInfo *t)
}
}
- if(arm->flag & ARM_MIRROR_EDIT)
+ if (arm->flag & ARM_MIRROR_EDIT)
transform_armature_mirror_update(t->obedit);
}
else {
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
}
}
- else if( (t->flag & T_POSE) && t->poseobj) {
+ else if ( (t->flag & T_POSE) && t->poseobj) {
Object *ob= t->poseobj;
bArmature *arm= ob->data;
@@ -840,8 +840,8 @@ static void recalcData_view3d(TransInfo *t)
else
where_is_pose(t->scene, ob);
}
- else if(base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) {
- if(t->state != TRANS_CANCEL) {
+ else if (base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
flushTransParticles(t);
@@ -849,7 +849,7 @@ static void recalcData_view3d(TransInfo *t)
else {
int i;
- if(t->state != TRANS_CANCEL) {
+ if (t->state != TRANS_CANCEL) {
applyProject(t);
}
@@ -965,8 +965,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
/* moving: is shown in drawobject() (transform color) */
// TRANSFORM_FIX_ME
-// if(obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
-// else if(G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
+// if (obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
+// else if (G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
// else G.moving= G_TRANSFORM_OBJ;
t->scene = sce;
@@ -1029,7 +1029,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
/* Assign the space type, some exceptions for running in different mode */
- if(sa == NULL) {
+ if (sa == NULL) {
/* background mode */
t->spacetype= SPACE_EMPTY;
}
@@ -1043,7 +1043,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
- if(t->spacetype == SPACE_VIEW3D)
+ if (t->spacetype == SPACE_VIEW3D)
{
View3D *v3d = sa->spacedata.first;
@@ -1057,7 +1057,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
v3d->twtype = 0;
}
- if(v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
+ if (v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
t->around = v3d->around;
if (op && RNA_struct_find_property(op->ptr, "constraint_orientation") && RNA_struct_property_is_set(op->ptr, "constraint_orientation"))
@@ -1074,16 +1074,16 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
/* exceptional case */
- if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
- if(ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
+ if (t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
+ if (ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
t->options |= CTX_NO_PET;
}
}
/* initialize UV transform from */
if (op && RNA_struct_find_property(op->ptr, "correct_uv")) {
- if(RNA_struct_property_is_set(op->ptr, "correct_uv")) {
- if(RNA_boolean_get(op->ptr, "correct_uv")) {
+ if (RNA_struct_property_is_set(op->ptr, "correct_uv")) {
+ if (RNA_boolean_get(op->ptr, "correct_uv")) {
t->settings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT;
}
else {
@@ -1096,24 +1096,24 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
}
- else if(t->spacetype==SPACE_IMAGE) {
+ else if (t->spacetype==SPACE_IMAGE) {
SpaceImage *sima = sa->spacedata.first;
// XXX for now, get View2D from the active region
t->view = &ar->v2d;
t->around = sima->around;
}
- else if(t->spacetype==SPACE_NODE) {
+ else if (t->spacetype==SPACE_NODE) {
// XXX for now, get View2D from the active region
t->view = &ar->v2d;
t->around = V3D_CENTER;
}
- else if(t->spacetype==SPACE_IPO) {
+ else if (t->spacetype==SPACE_IPO) {
SpaceIpo *sipo= sa->spacedata.first;
t->view = &ar->v2d;
t->around = sipo->around;
}
else {
- if(ar) {
+ if (ar) {
// XXX for now, get View2D from the active region
t->view = &ar->v2d;
// XXX for now, the center point is the midpoint of the data
@@ -1254,7 +1254,7 @@ void postTrans (bContext *C, TransInfo *t)
int a;
/* free data malloced per trans-data */
- for(a=0, td= t->data; a<t->total; a++, td++) {
+ for (a=0, td= t->data; a<t->total; a++, td++) {
if (td->flag & TD_BEZTRIPLE)
MEM_freeN(td->hdata);
}
@@ -1269,12 +1269,12 @@ void postTrans (bContext *C, TransInfo *t)
t->data2d= NULL;
}
- if(t->spacetype==SPACE_IMAGE) {
+ if (t->spacetype==SPACE_IMAGE) {
SpaceImage *sima= t->sa->spacedata.first;
- if(sima->flag & SI_LIVE_UNWRAP)
+ if (sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_end(t->state == TRANS_CANCEL);
}
- else if(t->spacetype==SPACE_VIEW3D) {
+ else if (t->spacetype==SPACE_VIEW3D) {
View3D *v3d = t->sa->spacedata.first;
/* restore manipulator */
if (t->flag & T_MODAL) {
@@ -1318,10 +1318,10 @@ static void restoreElement(TransData *td)
if (td->ext->rot) {
copy_v3_v3(td->ext->rot, td->ext->irot);
}
- if(td->ext->rotAngle) {
+ if (td->ext->rotAngle) {
*td->ext->rotAngle= td->ext->irotAngle;
}
- if(td->ext->rotAxis) {
+ if (td->ext->rotAxis) {
copy_v3_v3(td->ext->rotAxis, td->ext->irotAxis);
}
/* XXX, drotAngle & drotAxis not used yet */
@@ -1405,7 +1405,7 @@ void calculateCenterCursor2D(TransInfo *t)
float aspx=1.0, aspy=1.0;
float *cursor= NULL;
- if(t->spacetype==SPACE_IMAGE) {
+ if (t->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)t->sa->spacedata.first;
/* only space supported right now but may change */
ED_space_image_uv_aspect(sima, &aspx, &aspy);
@@ -1438,7 +1438,7 @@ void calculateCenterMedian(TransInfo *t)
int total = 0;
int i;
- for(i = 0; i < t->total; i++) {
+ for (i = 0; i < t->total; i++) {
if (t->data[i].flag & TD_SELECTED) {
if (!(t->data[i].flag & TD_NOCENTER))
{
@@ -1454,7 +1454,7 @@ void calculateCenterMedian(TransInfo *t)
break;
}
}
- if(i)
+ if (i)
mul_v3_fl(partial, 1.0f / total);
copy_v3_v3(t->center, partial);
@@ -1466,7 +1466,7 @@ void calculateCenterBound(TransInfo *t)
float max[3];
float min[3];
int i;
- for(i = 0; i < t->total; i++) {
+ for (i = 0; i < t->total; i++) {
if (i) {
if (t->data[i].flag & TD_SELECTED) {
if (!(t->data[i].flag & TD_NOCENTER))
@@ -1501,9 +1501,9 @@ void calculateCenter(TransInfo *t)
calculateCenterMedian(t);
break;
case V3D_CURSOR:
- if(t->spacetype==SPACE_IMAGE)
+ if (t->spacetype==SPACE_IMAGE)
calculateCenterCursor2D(t);
- else if(t->spacetype==SPACE_IPO)
+ else if (t->spacetype==SPACE_IPO)
calculateCenterCursorGraph2D(t);
else
calculateCenterCursor(t);
@@ -1542,7 +1542,7 @@ void calculateCenter(TransInfo *t)
} /* END EDIT MODE ACTIVE ELEMENT */
calculateCenterMedian(t);
- if((t->flag & (T_EDIT|T_POSE))==0)
+ if ((t->flag & (T_EDIT|T_POSE))==0)
{
Scene *scene = t->scene;
Object *ob= OBACT;
@@ -1583,7 +1583,7 @@ void calculateCenter(TransInfo *t)
projectIntView(t, axis, t->center2d);
/* rotate only needs correct 2d center, grab needs initgrabz() value */
- if(t->mode==TFM_TRANSLATION)
+ if (t->mode==TFM_TRANSLATION)
{
copy_v3_v3(t->center, axis);
copy_v3_v3(t->con.center, t->center);
@@ -1594,7 +1594,7 @@ void calculateCenter(TransInfo *t)
if (t->spacetype==SPACE_VIEW3D) {
/* initgrabz() defines a factor for perspective depth correction, used in window_to_3d_delta() */
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
float vec[3];
@@ -1616,7 +1616,7 @@ void calculatePropRatio(TransInfo *t)
short connected = t->flag & T_PROP_CONNECTED;
if (t->flag & T_PROP_EDIT) {
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_SELECTED) {
td->factor = 1.0f;
}
@@ -1710,7 +1710,7 @@ void calculatePropRatio(TransInfo *t)
}
}
else {
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
td->factor = 1.0;
}
t->proptext[0]= '\0';
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 3faddeb6639..bd3fb20f77f 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -236,7 +236,7 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
float dphi;
dphi = saacos((float)deler);
- if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
+ if ( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
/* If the angle is zero, because of lack of precision close to the 1.0 value in acos
* approximate the angle with the opposite side of the normalized triangle
@@ -256,7 +256,7 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
dy = dy1 - dy2;
dphi = sqrt(dx*dx + dy*dy);
- if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
+ if ( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
}
if (mi->precision) {
@@ -307,7 +307,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
/* TODO, holding R-key can cause mem leak, but this causes [#28903]
* disable for now. */
#if 0
- if(mi->data) {
+ if (mi->data) {
MEM_freeN(mi->data);
mi->data= NULL;
}
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index faf8071bd45..e30406ea568 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -120,25 +120,25 @@ static void calc_tw_center(Scene *scene, float *co)
static void protectflag_to_drawflags(short protectflag, short *drawflags)
{
- if(protectflag & OB_LOCK_LOCX)
+ if (protectflag & OB_LOCK_LOCX)
*drawflags &= ~MAN_TRANS_X;
- if(protectflag & OB_LOCK_LOCY)
+ if (protectflag & OB_LOCK_LOCY)
*drawflags &= ~MAN_TRANS_Y;
- if(protectflag & OB_LOCK_LOCZ)
+ if (protectflag & OB_LOCK_LOCZ)
*drawflags &= ~MAN_TRANS_Z;
- if(protectflag & OB_LOCK_ROTX)
+ if (protectflag & OB_LOCK_ROTX)
*drawflags &= ~MAN_ROT_X;
- if(protectflag & OB_LOCK_ROTY)
+ if (protectflag & OB_LOCK_ROTY)
*drawflags &= ~MAN_ROT_Y;
- if(protectflag & OB_LOCK_ROTZ)
+ if (protectflag & OB_LOCK_ROTZ)
*drawflags &= ~MAN_ROT_Z;
- if(protectflag & OB_LOCK_SCALEX)
+ if (protectflag & OB_LOCK_SCALEX)
*drawflags &= ~MAN_SCALE_X;
- if(protectflag & OB_LOCK_SCALEY)
+ if (protectflag & OB_LOCK_SCALEY)
*drawflags &= ~MAN_SCALE_Y;
- if(protectflag & OB_LOCK_SCALEZ)
+ if (protectflag & OB_LOCK_SCALEZ)
*drawflags &= ~MAN_SCALE_Z;
}
@@ -147,7 +147,7 @@ static void stats_pose(Scene *scene, RegionView3D *rv3d, bPoseChannel *pchan)
{
Bone *bone= pchan->bone;
- if(bone) {
+ if (bone) {
if (bone->flag & BONE_TRANSFORM) {
calc_tw_center(scene, pchan->pose_head);
protectflag_to_drawflags(pchan->protectflag, &rv3d->twdrawflag);
@@ -205,9 +205,9 @@ int gimbal_axis(Object *ob, float gmat[][3])
if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan= get_active_posechannel(ob);
- if(pchan) {
+ if (pchan) {
float mat[3][3], tmat[3][3], obmat[3][3];
- if(test_rotmode_euler(pchan->rotmode)) {
+ if (test_rotmode_euler(pchan->rotmode)) {
eulO_to_gimbal_axis(mat, pchan->eul, pchan->rotmode);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
@@ -242,10 +242,10 @@ int gimbal_axis(Object *ob, float gmat[][3])
}
}
else {
- if(test_rotmode_euler(ob->rotmode)) {
+ if (test_rotmode_euler(ob->rotmode)) {
eulO_to_gimbal_axis(gmat, ob->rot, ob->rotmode);
}
- else if(ob->rotmode == ROT_MODE_AXISANGLE) {
+ else if (ob->rotmode == ROT_MODE_AXISANGLE) {
axis_angle_to_gimbal_axis(gmat, ob->rotAxis, ob->rotAngle);
}
else { /* quat */
@@ -290,11 +290,11 @@ int calc_manipulator_stats(const bContext *C)
INIT_MINMAX(scene->twmin, scene->twmax);
zero_v3(scene->twcent);
- if(obedit) {
+ if (obedit) {
ob= obedit;
- if((ob->lay & v3d->lay)==0) return 0;
+ if ((ob->lay & v3d->lay)==0) return 0;
- if(obedit->type==OB_MESH) {
+ if (obedit->type==OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(obedit);
BMEditSelection ese;
float vec[3]= {0,0,0};
@@ -314,24 +314,24 @@ int calc_manipulator_stats(const bContext *C)
/* do vertices/edges/faces for center depending on selection
* mode. note we can't use just vertex selection flag because
* it is not flush down on changes */
- if(ts->selectmode & SCE_SELECT_VERTEX) {
+ if (ts->selectmode & SCE_SELECT_VERTEX) {
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
totsel++;
calc_tw_center(scene, eve->co);
}
}
}
}
- else if(ts->selectmode & SCE_SELECT_EDGE) {
+ else if (ts->selectmode & SCE_SELECT_EDGE) {
BMIter itersub;
BMEdge *eed;
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
/* check the vertex has a selected edge, only add it once */
BM_ITER(eed, &itersub, bm, BM_EDGES_OF_VERT, eve) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
totsel++;
calc_tw_center(scene, eve->co);
break;
@@ -344,10 +344,10 @@ int calc_manipulator_stats(const bContext *C)
BMIter itersub;
BMFace *efa;
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
/* check the vertex has a selected face, only add it once */
BM_ITER(efa, &itersub, bm, BM_FACES_OF_VERT, eve) {
- if(BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
totsel++;
calc_tw_center(scene, eve->co);
break;
@@ -362,7 +362,7 @@ int calc_manipulator_stats(const bContext *C)
bArmature *arm= obedit->data;
EditBone *ebo;
for (ebo= arm->edbo->first; ebo; ebo=ebo->next) {
- if(EBONE_VISIBLE(arm, ebo)) {
+ if (EBONE_VISIBLE(arm, ebo)) {
if (ebo->flag & BONE_TIPSEL) {
calc_tw_center(scene, ebo->tail);
totsel++;
@@ -392,11 +392,11 @@ int calc_manipulator_stats(const bContext *C)
ListBase *nurbs= curve_editnurbs(cu);
nu= nurbs->first;
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
+ while (a--) {
/* exceptions
* if handles are hidden then only check the center points.
* If the center knot is selected then only use this as the center point.
@@ -412,11 +412,11 @@ int calc_manipulator_stats(const bContext *C)
totsel++;
}
else {
- if(bezt->f1) {
+ if (bezt->f1) {
calc_tw_center(scene, bezt->vec[0]);
totsel++;
}
- if(bezt->f3) {
+ if (bezt->f3) {
calc_tw_center(scene, bezt->vec[2]);
totsel++;
}
@@ -427,8 +427,8 @@ int calc_manipulator_stats(const bContext *C)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
calc_tw_center(scene, bp->vec);
totsel++;
}
@@ -439,13 +439,13 @@ int calc_manipulator_stats(const bContext *C)
}
}
}
- else if(obedit->type==OB_MBALL) {
+ else if (obedit->type==OB_MBALL) {
MetaBall *mb = (MetaBall*)obedit->data;
MetaElem *ml /* , *ml_sel=NULL */ /* UNUSED */;
ml= mb->editelems->first;
- while(ml) {
- if(ml->flag & SELECT) {
+ while (ml) {
+ if (ml->flag & SELECT) {
calc_tw_center(scene, &ml->x);
/* ml_sel = ml; */ /* UNUSED */
totsel++;
@@ -453,15 +453,15 @@ int calc_manipulator_stats(const bContext *C)
ml= ml->next;
}
}
- else if(obedit->type==OB_LATTICE) {
+ else if (obedit->type==OB_LATTICE) {
BPoint *bp;
Lattice *lt= obedit->data;
bp= lt->editlatt->latt->def;
a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
calc_tw_center(scene, bp->vec);
totsel++;
}
@@ -470,24 +470,24 @@ int calc_manipulator_stats(const bContext *C)
}
/* selection center */
- if(totsel) {
+ if (totsel) {
mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
mul_m4_v3(obedit->obmat, scene->twcent);
mul_m4_v3(obedit->obmat, scene->twmin);
mul_m4_v3(obedit->obmat, scene->twmax);
}
}
- else if(ob && (ob->mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
bPoseChannel *pchan;
int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed
- if((ob->lay & v3d->lay)==0) return 0;
+ if ((ob->lay & v3d->lay)==0) return 0;
totsel = count_set_pose_transflags(&mode, 0, ob);
- if(totsel) {
+ if (totsel) {
/* use channels to get stats */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
stats_pose(scene, rv3d, pchan);
}
@@ -497,22 +497,22 @@ int calc_manipulator_stats(const bContext *C)
mul_m4_v3(ob->obmat, scene->twmax);
}
}
- else if(ob && (ob->mode & OB_MODE_ALL_PAINT)) {
+ else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) {
;
}
- else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
+ else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
PTCacheEdit *edit= PE_get_current(scene, ob);
PTCacheEditPoint *point;
PTCacheEditKey *ek;
int k;
- if(edit) {
+ if (edit) {
point = edit->points;
- for(a=0; a<edit->totpoint; a++,point++) {
- if(point->flag & PEP_HIDE) continue;
+ for (a=0; a<edit->totpoint; a++,point++) {
+ if (point->flag & PEP_HIDE) continue;
- for(k=0, ek=point->keys; k<point->totkey; k++, ek++) {
- if(ek->flag & PEK_SELECT) {
+ for (k=0, ek=point->keys; k<point->totkey; k++, ek++) {
+ if (ek->flag & PEK_SELECT) {
calc_tw_center(scene, ek->flag & PEK_USE_WCO ? ek->world_co : ek->co);
totsel++;
}
@@ -520,7 +520,7 @@ int calc_manipulator_stats(const bContext *C)
}
/* selection center */
- if(totsel)
+ if (totsel)
mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
}
}
@@ -528,11 +528,11 @@ int calc_manipulator_stats(const bContext *C)
/* we need the one selected object, if its not active */
ob= OBACT;
- if(ob && !(ob->flag & SELECT)) ob= NULL;
+ if (ob && !(ob->flag & SELECT)) ob= NULL;
- for(base= scene->base.first; base; base= base->next) {
+ for (base= scene->base.first; base; base= base->next) {
if TESTBASELIB(v3d, base) {
- if(ob==NULL)
+ if (ob==NULL)
ob= base->object;
calc_tw_center(scene, base->object->obmat[3]);
protectflag_to_drawflags(base->object->protectflag, &rv3d->twdrawflag);
@@ -541,13 +541,13 @@ int calc_manipulator_stats(const bContext *C)
}
/* selection center */
- if(totsel) {
+ if (totsel) {
mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
}
}
/* global, local or normal orientation? */
- if(ob && totsel) {
+ if (ob && totsel) {
switch(v3d->twmode) {
@@ -564,7 +564,7 @@ int calc_manipulator_stats(const bContext *C)
/* if not gimbal, fall through to normal */
}
case V3D_MANIP_NORMAL:
- if(obedit || ob->mode & OB_MODE_POSE) {
+ if (obedit || ob->mode & OB_MODE_POSE) {
float mat[3][3];
ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE));
copy_m4_m3(rv3d->twmat, mat);
@@ -664,7 +664,7 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i
float ring_delta, side_delta;
int i, j, docaps= 1;
- if(start==0 && end==nrings) docaps= 0;
+ if (start==0 && end==nrings) docaps= 0;
ring_delta= 2.0f*(float)M_PI/(float)nrings;
side_delta= 2.0f*(float)M_PI/(float)nsides;
@@ -673,15 +673,15 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i
cos_theta= (float)cos(theta);
sin_theta= (float)sin(theta);
- for(i= nrings - 1; i >= 0; i--) {
+ for (i= nrings - 1; i >= 0; i--) {
theta1= theta + ring_delta;
cos_theta1= (float)cos(theta1);
sin_theta1= (float)sin(theta1);
- if(docaps && i==start) { // cap
+ if (docaps && i==start) { // cap
glBegin(GL_POLYGON);
phi= 0.0;
- for(j= nsides; j >= 0; j--) {
+ for (j= nsides; j >= 0; j--) {
float cos_phi, sin_phi, dist;
phi += side_delta;
@@ -693,10 +693,10 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i
}
glEnd();
}
- if(i>=start && i<=end) {
+ if (i>=start && i<=end) {
glBegin(GL_QUAD_STRIP);
phi= 0.0;
- for(j= nsides; j >= 0; j--) {
+ for (j= nsides; j >= 0; j--) {
float cos_phi, sin_phi, dist;
phi += side_delta;
@@ -710,10 +710,10 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i
glEnd();
}
- if(docaps && i==end) { // cap
+ if (docaps && i==end) { // cap
glBegin(GL_POLYGON);
phi= 0.0;
- for(j= nsides; j >= 0; j--) {
+ for (j= nsides; j >= 0; j--) {
float cos_phi, sin_phi, dist;
phi -= side_delta;
@@ -754,22 +754,22 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned c
unsigned char col[4]= {0};
col[3]= alpha;
- if(colcode==MAN_GHOST) {
+ if (colcode==MAN_GHOST) {
col[3]= 70;
}
- else if(colcode==MAN_MOVECOL) {
+ else if (colcode==MAN_MOVECOL) {
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
}
else {
switch(axis) {
case 'C':
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
- if(v3d->twmode == V3D_MANIP_LOCAL) {
+ if (v3d->twmode == V3D_MANIP_LOCAL) {
col[0]= col[0]>200?255:col[0]+55;
col[1]= col[1]>200?255:col[1]+55;
col[2]= col[2]>200?255:col[2]+55;
}
- else if(v3d->twmode == V3D_MANIP_NORMAL) {
+ else if (v3d->twmode == V3D_MANIP_NORMAL) {
col[0]= col[0]<55?0:col[0]-55;
col[1]= col[1]<55?0:col[1]-55;
col[2]= col[2]<55?0:col[2]-55;
@@ -799,27 +799,27 @@ static void draw_manipulator_axes(View3D *v3d, RegionView3D *rv3d, int colcode,
{
/* axes */
- if(flagx) {
+ if (flagx) {
manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
- if(flagx & MAN_SCALE_X) glLoadName(MAN_SCALE_X);
- else if(flagx & MAN_TRANS_X) glLoadName(MAN_TRANS_X);
+ if (flagx & MAN_SCALE_X) glLoadName(MAN_SCALE_X);
+ else if (flagx & MAN_TRANS_X) glLoadName(MAN_TRANS_X);
glBegin(GL_LINES);
glVertex3f(0.2f, 0.0f, 0.0f);
glVertex3f(1.0f, 0.0f, 0.0f);
glEnd();
}
- if(flagy) {
- if(flagy & MAN_SCALE_Y) glLoadName(MAN_SCALE_Y);
- else if(flagy & MAN_TRANS_Y) glLoadName(MAN_TRANS_Y);
+ if (flagy) {
+ if (flagy & MAN_SCALE_Y) glLoadName(MAN_SCALE_Y);
+ else if (flagy & MAN_TRANS_Y) glLoadName(MAN_TRANS_Y);
manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
glBegin(GL_LINES);
glVertex3f(0.0f, 0.2f, 0.0f);
glVertex3f(0.0f, 1.0f, 0.0f);
glEnd();
}
- if(flagz) {
- if(flagz & MAN_SCALE_Z) glLoadName(MAN_SCALE_Z);
- else if(flagz & MAN_TRANS_Z) glLoadName(MAN_TRANS_Z);
+ if (flagz) {
+ if (flagz & MAN_SCALE_Z) glLoadName(MAN_SCALE_Z);
+ else if (flagz & MAN_TRANS_Z) glLoadName(MAN_TRANS_Z);
manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.2f);
@@ -859,11 +859,11 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
int colcode;
int ortho;
- if(moving) colcode= MAN_MOVECOL;
+ if (moving) colcode= MAN_MOVECOL;
else colcode= MAN_RGB;
/* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_ROT_C)==0) return;
+ if ((drawflags & MAN_ROT_C)==0) return;
/* Init stuff */
glDisable(GL_DEPTH_TEST);
@@ -877,7 +877,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glPushMatrix();
glTranslatef(rv3d->twmat[3][0], rv3d->twmat[3][1], rv3d->twmat[3][2]);
- if(arcs) {
+ if (arcs) {
/* clipplane makes nice handles, calc here because of multmatrix but with translate! */
copy_v3db_v3fl(plane, rv3d->viewinv[2]);
plane[3]= -0.02f*size; // clip just a bit more
@@ -887,28 +887,28 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glRotatef( -360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
/* Screen aligned help circle */
- if(arcs) {
- if((G.f & G_PICKSEL)==0) {
+ if (arcs) {
+ if ((G.f & G_PICKSEL)==0) {
UI_ThemeColorShade(TH_BACK, -30);
drawcircball(GL_LINE_LOOP, unitmat[3], size, unitmat);
}
}
/* Screen aligned trackball rot circle */
- if(drawflags & MAN_ROT_T) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_T);
+ if (drawflags & MAN_ROT_T) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_T);
UI_ThemeColor(TH_TRANSFORM);
drawcircball(GL_LINE_LOOP, unitmat[3], 0.2f*size, unitmat);
}
/* Screen aligned view rot circle */
- if(drawflags & MAN_ROT_V) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
+ if (drawflags & MAN_ROT_V) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
UI_ThemeColor(TH_TRANSFORM);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f*size, unitmat);
- if(moving) {
+ if (moving) {
float vec[3];
vec[0]= 0; // XXX (float)(t->imval[0] - t->center2d[0]);
vec[1]= 0; // XXX (float)(t->imval[1] - t->center2d[1]);
@@ -927,7 +927,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
ortho = is_orthogonal_m4(rv3d->twmat);
/* apply the transform delta */
- if(moving) {
+ if (moving) {
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
// XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
if (ortho) {
@@ -943,11 +943,11 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
}
/* axes */
- if(arcs==0) {
- if(!(G.f & G_PICKSEL)) {
- if( (combo & V3D_MANIP_SCALE)==0) {
+ if (arcs==0) {
+ if (!(G.f & G_PICKSEL)) {
+ if ( (combo & V3D_MANIP_SCALE)==0) {
/* axis */
- if( (drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z)) ) {
+ if ( (drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z)) ) {
preOrthoFront(ortho, rv3d->twmat, 2);
manipulator_setcolor(v3d, 'X', colcode, 255);
glBegin(GL_LINES);
@@ -956,7 +956,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glEnd();
postOrtho(ortho);
}
- if( (drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X)) ) {
+ if ( (drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X)) ) {
preOrthoFront(ortho, rv3d->twmat, 0);
manipulator_setcolor(v3d, 'Y', colcode, 255);
glBegin(GL_LINES);
@@ -965,7 +965,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glEnd();
postOrtho(ortho);
}
- if( (drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y)) ) {
+ if ( (drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y)) ) {
preOrthoFront(ortho, rv3d->twmat, 1);
manipulator_setcolor(v3d, 'Z', colcode, 255);
glBegin(GL_LINES);
@@ -978,20 +978,20 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
}
}
- if(arcs==0 && moving) {
+ if (arcs==0 && moving) {
/* Z circle */
- if(drawflags & MAN_ROT_Z) {
+ if (drawflags & MAN_ROT_Z) {
preOrthoFront(ortho, matt, 2);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
manipulator_setcolor(v3d, 'Z', colcode, 255);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
postOrtho(ortho);
}
/* X circle */
- if(drawflags & MAN_ROT_X) {
+ if (drawflags & MAN_ROT_X) {
preOrthoFront(ortho, matt, 0);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
glRotatef(90.0, 0.0, 1.0, 0.0);
manipulator_setcolor(v3d, 'X', colcode, 255);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
@@ -999,9 +999,9 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
postOrtho(ortho);
}
/* Y circle */
- if(drawflags & MAN_ROT_Y) {
+ if (drawflags & MAN_ROT_Y) {
preOrthoFront(ortho, matt, 1);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
glRotatef(-90.0, 1.0, 0.0, 0.0);
manipulator_setcolor(v3d, 'Y', colcode, 255);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
@@ -1009,24 +1009,24 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
postOrtho(ortho);
}
- if(arcs) glDisable(GL_CLIP_PLANE0);
+ if (arcs) glDisable(GL_CLIP_PLANE0);
}
// donut arcs
- if(arcs) {
+ if (arcs) {
glEnable(GL_CLIP_PLANE0);
/* Z circle */
- if(drawflags & MAN_ROT_Z) {
+ if (drawflags & MAN_ROT_Z) {
preOrthoFront(ortho, rv3d->twmat, 2);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
manipulator_setcolor(v3d, 'Z', colcode, 255);
partial_doughnut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
postOrtho(ortho);
}
/* X circle */
- if(drawflags & MAN_ROT_X) {
+ if (drawflags & MAN_ROT_X) {
preOrthoFront(ortho, rv3d->twmat, 0);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
glRotatef(90.0, 0.0, 1.0, 0.0);
manipulator_setcolor(v3d, 'X', colcode, 255);
partial_doughnut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
@@ -1034,9 +1034,9 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
postOrtho(ortho);
}
/* Y circle */
- if(drawflags & MAN_ROT_Y) {
+ if (drawflags & MAN_ROT_Y) {
preOrthoFront(ortho, rv3d->twmat, 1);
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
glRotatef(-90.0, 1.0, 0.0, 0.0);
manipulator_setcolor(v3d, 'Y', colcode, 255);
partial_doughnut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
@@ -1047,13 +1047,13 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glDisable(GL_CLIP_PLANE0);
}
- if(arcs==0) {
+ if (arcs==0) {
/* Z handle on X axis */
- if(drawflags & MAN_ROT_Z) {
+ if (drawflags & MAN_ROT_Z) {
preOrthoFront(ortho, rv3d->twmat, 2);
glPushMatrix();
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
manipulator_setcolor(v3d, 'Z', colcode, 255);
partial_doughnut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
@@ -1063,10 +1063,10 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
}
/* Y handle on X axis */
- if(drawflags & MAN_ROT_Y) {
+ if (drawflags & MAN_ROT_Y) {
preOrthoFront(ortho, rv3d->twmat, 1);
glPushMatrix();
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
manipulator_setcolor(v3d, 'Y', colcode, 255);
glRotatef(90.0, 1.0, 0.0, 0.0);
@@ -1078,10 +1078,10 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
}
/* X handle on Z axis */
- if(drawflags & MAN_ROT_X) {
+ if (drawflags & MAN_ROT_X) {
preOrthoFront(ortho, rv3d->twmat, 0);
glPushMatrix();
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
manipulator_setcolor(v3d, 'X', colcode, 255);
glRotatef(-90.0, 0.0, 1.0, 0.0);
@@ -1097,7 +1097,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
/* restore */
glLoadMatrixf(rv3d->viewmat);
gluDeleteQuadric(qobj);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -1168,17 +1168,17 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
float cusize= cywid*0.75f, dz;
/* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_SCALE_C)==0) return;
+ if ((drawflags & MAN_SCALE_C)==0) return;
glDisable(GL_DEPTH_TEST);
/* not in combo mode */
- if( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) {
+ if ( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) {
float size, unitmat[4][4];
int shift= 0; // XXX
/* center circle, do not add to selection when shift is pressed (planar constraint) */
- if( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_SCALE_C);
+ if ( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_SCALE_C);
manipulator_setcolor(v3d, 'C', colcode, 255);
glPushMatrix();
@@ -1191,7 +1191,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
}
else dz= 1.0f-4.0f*cusize;
- if(moving) {
+ if (moving) {
float matt[4][4];
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
@@ -1211,31 +1211,31 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
/* Z cube */
glTranslatef(0.0, 0.0, dz);
- if(drawflags & MAN_SCALE_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z);
+ if (drawflags & MAN_SCALE_Z) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z);
manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
drawsolidcube(cusize);
}
/* X cube */
glTranslatef(dz, 0.0, -dz);
- if(drawflags & MAN_SCALE_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_X);
+ if (drawflags & MAN_SCALE_X) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_X);
manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
drawsolidcube(cusize);
}
/* Y cube */
glTranslatef(-dz, dz, 0.0);
- if(drawflags & MAN_SCALE_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y);
+ if (drawflags & MAN_SCALE_Y) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y);
manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
drawsolidcube(cusize);
}
/* if shiftkey, center point as last, for selectbuffer order */
- if(G.f & G_PICKSEL) {
+ if (G.f & G_PICKSEL) {
int shift= 0; // XXX
- if(shift) {
+ if (shift) {
glTranslatef(0.0, -dz, 0.0);
glLoadName(MAN_SCALE_C);
glBegin(GL_POINTS);
@@ -1247,7 +1247,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
/* restore */
glLoadMatrixf(rv3d->viewmat);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
glFrontFace(GL_CCW);
}
@@ -1287,7 +1287,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
int shift= 0; // XXX
/* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_TRANS_C)==0) return;
+ if ((drawflags & MAN_TRANS_C)==0) return;
// XXX if(moving) glTranslatef(t->vec[0], t->vec[1], t->vec[2]);
glDisable(GL_DEPTH_TEST);
@@ -1296,7 +1296,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
gluQuadricDrawStyle(qobj, GLU_FILL);
/* center circle, do not add to selection when shift is pressed (planar constraint) */
- if( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_TRANS_C);
+ if ( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_TRANS_C);
manipulator_setcolor(v3d, 'C', colcode, 255);
glPushMatrix();
@@ -1312,26 +1312,26 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
glLoadName(-1);
// translate drawn as last, only axis when no combo with scale, or for ghosting
- if((combo & V3D_MANIP_SCALE)==0 || colcode==MAN_GHOST)
+ if ((combo & V3D_MANIP_SCALE)==0 || colcode==MAN_GHOST)
draw_manipulator_axes(v3d, rv3d, colcode, drawflags & MAN_TRANS_X, drawflags & MAN_TRANS_Y, drawflags & MAN_TRANS_Z);
/* offset in combo mode, for rotate a bit more */
- if(combo & (V3D_MANIP_ROTATE)) dz= 1.0f+2.0f*cylen;
- else if(combo & (V3D_MANIP_SCALE)) dz= 1.0f+0.5f*cylen;
+ if (combo & (V3D_MANIP_ROTATE)) dz= 1.0f+2.0f*cylen;
+ else if (combo & (V3D_MANIP_SCALE)) dz= 1.0f+0.5f*cylen;
else dz= 1.0f;
/* Z Cone */
glTranslatef(0.0, 0.0, dz);
- if(drawflags & MAN_TRANS_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z);
+ if (drawflags & MAN_TRANS_Z) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z);
manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
draw_cone(qobj, cylen, cywid);
}
/* X Cone */
glTranslatef(dz, 0.0, -dz);
- if(drawflags & MAN_TRANS_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_X);
+ if (drawflags & MAN_TRANS_X) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_X);
glRotatef(90.0, 0.0, 1.0, 0.0);
manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
draw_cone(qobj, cylen, cywid);
@@ -1339,8 +1339,8 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
}
/* Y Cone */
glTranslatef(-dz, dz, 0.0);
- if(drawflags & MAN_TRANS_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y);
+ if (drawflags & MAN_TRANS_Y) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y);
glRotatef(-90.0, 1.0, 0.0, 0.0);
manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
draw_cone(qobj, cylen, cywid);
@@ -1349,7 +1349,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
gluDeleteQuadric(qobj);
glLoadMatrixf(rv3d->viewmat);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -1361,7 +1361,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
float cywid= 0.25f*cylen;
/* when called while moving in mixed mode, do not draw when... */
- if((drawflags & MAN_ROT_C)==0) return;
+ if ((drawflags & MAN_ROT_C)==0) return;
/* prepare for screen aligned draw */
glPushMatrix();
@@ -1372,14 +1372,14 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
qobj= gluNewQuadric();
/* Screen aligned view rot circle */
- if(drawflags & MAN_ROT_V) {
+ if (drawflags & MAN_ROT_V) {
float unitmat[4][4]= MAT4_UNITY;
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
UI_ThemeColor(TH_TRANSFORM);
drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f*size, unitmat);
- if(moving) {
+ if (moving) {
float vec[3];
vec[0]= 0; // XXX (float)(t->imval[0] - t->center2d[0]);
vec[1]= 0; // XXX (float)(t->imval[1] - t->center2d[1]);
@@ -1395,7 +1395,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
glPopMatrix();
/* apply the transform delta */
- if(moving) {
+ if (moving) {
float matt[4][4];
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
// XXX if (t->flag & T_USES_MANIPULATOR) {
@@ -1410,10 +1410,10 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW);
/* axis */
- if( (G.f & G_PICKSEL)==0 ) {
+ if ( (G.f & G_PICKSEL)==0 ) {
// only draw axis when combo didn't draw scale axes
- if((combo & V3D_MANIP_SCALE)==0)
+ if ((combo & V3D_MANIP_SCALE)==0)
draw_manipulator_axes(v3d, rv3d, colcode, drawflags & MAN_ROT_X, drawflags & MAN_ROT_Y, drawflags & MAN_ROT_Z);
/* only has to be set when not in picking */
@@ -1422,15 +1422,15 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
/* Z cyl */
glTranslatef(0.0, 0.0, 1.0);
- if(drawflags & MAN_ROT_Z) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+ if (drawflags & MAN_ROT_Z) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
manipulator_setcolor(v3d, 'Z', colcode, 255);
draw_cylinder(qobj, cylen, cywid);
}
/* X cyl */
glTranslatef(1.0, 0.0, -1.0);
- if(drawflags & MAN_ROT_X) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+ if (drawflags & MAN_ROT_X) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
glRotatef(90.0, 0.0, 1.0, 0.0);
manipulator_setcolor(v3d, 'X', colcode, 255);
draw_cylinder(qobj, cylen, cywid);
@@ -1438,8 +1438,8 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
}
/* Y cylinder */
glTranslatef(-1.0, 1.0, 0.0);
- if(drawflags & MAN_ROT_Y) {
- if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+ if (drawflags & MAN_ROT_Y) {
+ if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
glRotatef(-90.0, 1.0, 0.0, 0.0);
manipulator_setcolor(v3d, 'Y', colcode, 255);
draw_cylinder(qobj, cylen, cywid);
@@ -1450,7 +1450,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
gluDeleteQuadric(qobj);
glLoadMatrixf(rv3d->viewmat);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -1470,15 +1470,15 @@ void BIF_draw_manipulator(const bContext *C)
RegionView3D *rv3d= ar->regiondata;
int totsel;
- if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return;
-// if(G.moving && (G.moving & G_TRANSFORM_MANIP)==0) return;
+ if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return;
+// if (G.moving && (G.moving & G_TRANSFORM_MANIP)==0) return;
-// if(G.moving==0) {
+// if (G.moving==0) {
{
v3d->twflag &= ~V3D_DRAW_MANIPULATOR;
totsel= calc_manipulator_stats(C);
- if(totsel==0) return;
+ if (totsel==0) return;
v3d->twflag |= V3D_DRAW_MANIPULATOR;
@@ -1489,9 +1489,9 @@ void BIF_draw_manipulator(const bContext *C)
rv3d->twmat[3][0]= (scene->twmin[0] + scene->twmax[0])/2.0f;
rv3d->twmat[3][1]= (scene->twmin[1] + scene->twmax[1])/2.0f;
rv3d->twmat[3][2]= (scene->twmin[2] + scene->twmax[2])/2.0f;
- if(v3d->around==V3D_ACTIVE && scene->obedit==NULL) {
+ if (v3d->around==V3D_ACTIVE && scene->obedit==NULL) {
Object *ob= OBACT;
- if(ob && !(ob->mode & OB_MODE_POSE))
+ if (ob && !(ob->mode & OB_MODE_POSE))
copy_v3_v3(rv3d->twmat[3], ob->obmat[3]);
}
break;
@@ -1510,23 +1510,23 @@ void BIF_draw_manipulator(const bContext *C)
test_manipulator_axis(C);
drawflags= rv3d->twdrawflag; /* set in calc_manipulator_stats */
- if(v3d->twflag & V3D_DRAW_MANIPULATOR) {
+ if (v3d->twflag & V3D_DRAW_MANIPULATOR) {
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- if(v3d->twtype & V3D_MANIP_ROTATE) {
+ if (v3d->twtype & V3D_MANIP_ROTATE) {
- if(G.rt==3) {
- if(G.moving) draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL);
+ if (G.rt==3) {
+ if (G.moving) draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL);
else draw_manipulator_rotate_cyl(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
}
else
draw_manipulator_rotate(v3d, rv3d, 0 /* G.moving*/, drawflags, v3d->twtype);
}
- if(v3d->twtype & V3D_MANIP_SCALE) {
+ if (v3d->twtype & V3D_MANIP_SCALE) {
draw_manipulator_scale(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
}
- if(v3d->twtype & V3D_MANIP_TRANSLATE) {
+ if (v3d->twtype & V3D_MANIP_TRANSLATE) {
draw_manipulator_translate(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
}
@@ -1559,13 +1559,13 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
glPushName(-2);
/* do the drawing */
- if(v3d->twtype & V3D_MANIP_ROTATE) {
- if(G.rt==3) draw_manipulator_rotate_cyl(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
+ if (v3d->twtype & V3D_MANIP_ROTATE) {
+ if (G.rt==3) draw_manipulator_rotate_cyl(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
else draw_manipulator_rotate(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype);
}
- if(v3d->twtype & V3D_MANIP_SCALE)
+ if (v3d->twtype & V3D_MANIP_SCALE)
draw_manipulator_scale(v3d, rv3d, 0, MAN_SCALE_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
- if(v3d->twtype & V3D_MANIP_TRANSLATE)
+ if (v3d->twtype & V3D_MANIP_TRANSLATE)
draw_manipulator_translate(v3d, rv3d, 0, MAN_TRANS_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
glPopName();
@@ -1575,29 +1575,29 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
setwinmatrixview3d(ar, v3d, NULL);
mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
- if(hits==1) return buffer[3];
- else if(hits>1) {
+ if (hits==1) return buffer[3];
+ else if (hits>1) {
GLuint val, dep, mindep=0, mindeprot=0, minval=0, minvalrot=0;
int a;
/* we compare the hits in buffer, but value centers highest */
/* we also store the rotation hits separate (because of arcs) and return hits on other widgets if there are */
- for(a=0; a<hits; a++) {
+ for (a=0; a<hits; a++) {
dep= buffer[4*a + 1];
val= buffer[4*a + 3];
- if(val==MAN_TRANS_C) return MAN_TRANS_C;
- else if(val==MAN_SCALE_C) return MAN_SCALE_C;
+ if (val==MAN_TRANS_C) return MAN_TRANS_C;
+ else if (val==MAN_SCALE_C) return MAN_SCALE_C;
else {
- if(val & MAN_ROT_C) {
- if(minvalrot==0 || dep<mindeprot) {
+ if (val & MAN_ROT_C) {
+ if (minvalrot==0 || dep<mindeprot) {
mindeprot= dep;
minvalrot= val;
}
}
else {
- if(minval==0 || dep<mindep) {
+ if (minval==0 || dep<mindep) {
mindep= dep;
minval= val;
}
@@ -1605,7 +1605,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
}
}
- if(minval)
+ if (minval)
return minval;
else
return minvalrot;
@@ -1624,26 +1624,26 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
int val;
int shift = event->shift;
- if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return 0;
- if(!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return 0;
+ if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return 0;
+ if (!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return 0;
/* Force orientation */
RNA_enum_set(op->ptr, "constraint_orientation", v3d->twmode);
// find the hotspots first test narrow hotspot
val= manipulator_selectbuf(sa, ar, event->mval, 0.5f*(float)U.tw_hotspot);
- if(val) {
+ if (val) {
// drawflags still global, for drawing call above
drawflags= manipulator_selectbuf(sa, ar, event->mval, 0.2f*(float)U.tw_hotspot);
- if(drawflags==0) drawflags= val;
+ if (drawflags==0) drawflags= val;
if (drawflags & MAN_TRANS_C) {
switch(drawflags) {
case MAN_TRANS_C:
break;
case MAN_TRANS_X:
- if(shift) {
+ if (shift) {
constraint_axis[1] = 1;
constraint_axis[2] = 1;
}
@@ -1651,7 +1651,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
constraint_axis[0] = 1;
break;
case MAN_TRANS_Y:
- if(shift) {
+ if (shift) {
constraint_axis[0] = 1;
constraint_axis[2] = 1;
}
@@ -1659,7 +1659,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
constraint_axis[1] = 1;
break;
case MAN_TRANS_Z:
- if(shift) {
+ if (shift) {
constraint_axis[0] = 1;
constraint_axis[1] = 1;
}
@@ -1674,7 +1674,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
else if (drawflags & MAN_SCALE_C) {
switch(drawflags) {
case MAN_SCALE_X:
- if(shift) {
+ if (shift) {
constraint_axis[1] = 1;
constraint_axis[2] = 1;
}
@@ -1682,7 +1682,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
constraint_axis[0] = 1;
break;
case MAN_SCALE_Y:
- if(shift) {
+ if (shift) {
constraint_axis[0] = 1;
constraint_axis[2] = 1;
}
@@ -1690,7 +1690,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
constraint_axis[1] = 1;
break;
case MAN_SCALE_Z:
- if(shift) {
+ if (shift) {
constraint_axis[0] = 1;
constraint_axis[1] = 1;
}
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index ac6243e74ed..7c3bcb857eb 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -245,7 +245,7 @@ static int delete_orientation_poll(bContext *C)
return 0;
- if(v3d) {
+ if (v3d) {
selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
}
@@ -341,7 +341,7 @@ static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
G.moving = 1;
/* store data */
- if(retval) {
+ if (retval) {
op->customdata = t;
}
else {
@@ -429,7 +429,7 @@ static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED;
}
- if(RNA_struct_property_is_set(op->ptr, "value")) {
+ if (RNA_struct_property_is_set(op->ptr, "value")) {
return transform_exec(C, op);
}
else {
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 6b68042444e..a1d4c3c990d 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -74,7 +74,7 @@ void BIF_clearTransformOrientation(bContext *C)
BLI_freelistN(transform_spaces);
// Need to loop over all view3d
- if(v3d && v3d->twmode >= V3D_MANIP_CUSTOM) {
+ if (v3d && v3d->twmode >= V3D_MANIP_CUSTOM) {
v3d->twmode = V3D_MANIP_GLOBAL; /* fallback to global */
}
}
@@ -297,7 +297,7 @@ void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target)
for (i = 0, ts = transform_spaces->first; ts; ts = ts->next, i++) {
if (ts == target) {
View3D *v3d = CTX_wm_view3d(C);
- if(v3d) {
+ if (v3d) {
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
// Transform_fix_me NEED TO DO THIS FOR ALL VIEW3D
@@ -323,7 +323,7 @@ void BIF_removeTransformOrientationIndex(bContext *C, int index)
if (ts) {
View3D *v3d = CTX_wm_view3d(C);
- if(v3d) {
+ if (v3d) {
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
// Transform_fix_me NEED TO DO THIS FOR ALL VIEW3D
@@ -358,7 +358,7 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
void BIF_selectTransformOrientationValue(bContext *C, int orientation)
{
View3D *v3d = CTX_wm_view3d(C);
- if(v3d) /* currently using generic poll */
+ if (v3d) /* currently using generic poll */
v3d->twmode = orientation;
}
@@ -381,19 +381,19 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C)
RNA_enum_item_add(&item, &totitem, &local);
RNA_enum_item_add(&item, &totitem, &view);
- if(C) {
+ if (C) {
scene= CTX_data_scene(C);
- if(scene) {
+ if (scene) {
transform_spaces = &scene->transform_spaces;
ts = transform_spaces->first;
}
}
- if(ts)
+ if (ts)
RNA_enum_item_add_separator(&item, &totitem);
- for(; ts; ts = ts->next) {
+ for (; ts; ts = ts->next) {
tmp.identifier = "CUSTOM";
tmp.name= ts->name;
tmp.value = i++;
@@ -469,11 +469,11 @@ static int count_bone_select(bArmature *arm, ListBase *lb, int do_it)
int do_next;
int total = 0;
- for(bone= lb->first; bone; bone= bone->next) {
+ for (bone= lb->first; bone; bone= bone->next) {
bone->flag &= ~BONE_TRANSFORM;
do_next = do_it;
- if(do_it) {
- if(bone->layer & arm->layer) {
+ if (do_it) {
+ if (bone->layer & arm->layer) {
if (bone->flag & BONE_SELECTED) {
bone->flag |= BONE_TRANSFORM;
total++;
@@ -507,7 +507,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
}
/* no gimbal fallthrough to normal */
case V3D_MANIP_NORMAL:
- if(obedit || (ob && ob->mode & OB_MODE_POSE)) {
+ if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
strcpy(t->spacename, "normal");
ED_getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE));
break;
@@ -516,10 +516,11 @@ void initTransformOrientation(bContext *C, TransInfo *t)
case V3D_MANIP_LOCAL:
strcpy(t->spacename, "local");
- if(ob) {
+ if (ob) {
copy_m3_m4(t->spacemtx, ob->obmat);
normalize_m3(t->spacemtx);
- } else {
+ }
+ else {
unit_m3(t->spacemtx);
}
@@ -599,7 +600,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BMIter iter;
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
add_v3_v3(normal, efa->no);
sub_v3_v3v3(vec,
BM_FACE_FIRST_LOOP(efa)->v->co,
@@ -640,7 +641,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BMIter iter;
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
break;
}
@@ -654,7 +655,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BMIter iter;
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
/* use average vert normals as plane and edge vector as normal */
copy_v3_v3(plane, eed->v1->no);
add_v3_v3(plane, eed->v2->no);
@@ -749,7 +750,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
result = ORIENTATION_NORMAL;
}
}
- else if(obedit->type==OB_MBALL){
+ else if (obedit->type==OB_MBALL) {
#if 0 // XXX
/* editmball.c */
MetaElem *ml, *ml_sel = NULL;
@@ -820,17 +821,17 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
mul_m3_v3(mat, plane);
}
}
- else if(ob && (ob->mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
bArmature *arm= ob->data;
bPoseChannel *pchan;
int totsel;
totsel = count_bone_select(arm, &arm->bonebase, 1);
- if(totsel) {
+ if (totsel) {
float imat[3][3], mat[3][3];
/* use channels to get stats */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if (pchan->bone && pchan->bone->flag & BONE_TRANSFORM) {
add_v3_v3(normal, pchan->pose_mat[2]);
add_v3_v3(plane, pchan->pose_mat[1]);
@@ -849,17 +850,17 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
result = ORIENTATION_EDGE;
}
}
- else if(ob && (ob->mode & (OB_MODE_ALL_PAINT|OB_MODE_PARTICLE_EDIT))) {
+ else if (ob && (ob->mode & (OB_MODE_ALL_PAINT|OB_MODE_PARTICLE_EDIT))) {
/* pass */
}
else {
/* we need the one selected object, if its not active */
ob = OBACT;
- if(ob && !(ob->flag & SELECT)) ob = NULL;
+ if (ob && !(ob->flag & SELECT)) ob = NULL;
- for(base= scene->base.first; base; base= base->next) {
+ for (base= scene->base.first; base; base= base->next) {
if TESTBASELIB(v3d, base) {
- if(ob == NULL) {
+ if (ob == NULL) {
ob= base->object;
break;
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 5713812ebd6..7ad7b0f5c40 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -169,7 +169,8 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
for (p = t->tsnap.points.first; p; p = p->next) {
if (p == t->tsnap.selectedPoint) {
glColor4ubv(selectedCol);
- } else {
+ }
+ else {
glColor4ubv(col);
}
@@ -195,7 +196,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
glEnd();
}
- if(v3d->zbuf)
+ if (v3d->zbuf)
glEnable(GL_DEPTH_TEST);
}
else if (t->spacetype==SPACE_IMAGE) {
@@ -265,12 +266,12 @@ void applyProject(TransInfo *t)
float imat[4][4];
int i;
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob = t->obedit?t->obedit:t->poseobj;
invert_m4_m4(imat, ob->obmat);
}
- for(i = 0 ; i < t->total; i++, td++) {
+ for (i = 0 ; i < t->total; i++, td++) {
float iloc[3], loc[3], no[3];
float mval[2];
int dist = 1000;
@@ -297,7 +298,7 @@ void applyProject(TransInfo *t)
if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect))
{
-// if(t->flag & (T_EDIT|T_POSE)) {
+// if (t->flag & (T_EDIT|T_POSE)) {
// mul_m4_v3(imat, loc);
// }
//
@@ -476,7 +477,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
}
/* use scene defaults only when transform is modal */
else if (t->flag & T_MODAL) {
- if(ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
+ if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
if (ts->snap_flag & SCE_SNAP) {
t->modifiers |= MOD_SNAP;
}
@@ -569,7 +570,7 @@ int updateSelectedSnapPoint(TransInfo *t)
int closest_dist = 0;
int screen_loc[2];
- for( p = t->tsnap.points.first; p; p = p->next ) {
+ for ( p = t->tsnap.points.first; p; p = p->next ) {
int dx, dy;
int dist;
@@ -631,7 +632,8 @@ void getSnapPoint(TransInfo *t, float vec[3])
}
mul_v3_fl(vec, 1.0f / total);
- } else {
+ }
+ else {
copy_v3_v3(vec, t->tsnap.snapPoint);
}
}
@@ -681,7 +683,7 @@ static float RotationBetween(TransInfo *t, float p1[3], float p2[3])
float angle, start[3], end[3], center[3];
copy_v3_v3(center, t->center);
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, center);
}
@@ -737,7 +739,7 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
float d1[3], d2[3], center[3], len_d1;
copy_v3_v3(center, t->center);
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, center);
}
@@ -897,7 +899,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], co, co+1);
- if(ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
+ if (ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
{
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
t->tsnap.snapPoint[0] *= aspx;
@@ -919,7 +921,7 @@ static void TargetSnapCenter(TransInfo *t)
if ((t->tsnap.status & TARGET_INIT) == 0)
{
copy_v3_v3(t->tsnap.snapTarget, t->center);
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
@@ -937,7 +939,7 @@ static void TargetSnapActive(TransInfo *t)
TransData *active_td = NULL;
int i;
- for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
{
if (td->flag & TD_ACTIVE)
{
@@ -950,7 +952,7 @@ static void TargetSnapActive(TransInfo *t)
{
copy_v3_v3(t->tsnap.snapTarget, active_td->center);
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
@@ -978,14 +980,14 @@ static void TargetSnapMedian(TransInfo *t)
t->tsnap.snapTarget[1] = 0;
t->tsnap.snapTarget[2] = 0;
- for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
{
add_v3_v3(t->tsnap.snapTarget, td->center);
}
mul_v3_fl(t->tsnap.snapTarget, 1.0 / i);
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
@@ -1005,7 +1007,7 @@ static void TargetSnapClosest(TransInfo *t)
if (t->flag & T_OBJECT)
{
int i;
- for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
{
struct BoundBox *bb = object_get_boundbox(td->ob);
@@ -1050,13 +1052,13 @@ static void TargetSnapClosest(TransInfo *t)
}
else {
int i;
- for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) {
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) {
float loc[3];
float dist;
copy_v3_v3(loc, td->center);
- if(t->flag & (T_EDIT|T_POSE)) {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, loc);
}
@@ -1278,7 +1280,7 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
mul_m4_v3(imat, ray_start_local);
mul_mat3_m4_v3(imat, ray_normal_local);
- if(arm->edbo)
+ if (arm->edbo)
{
EditBone *eBone;
@@ -1381,9 +1383,9 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
hit.index = -1;
hit.dist = *r_depth * (*r_depth == FLT_MAX ? 1.0f : local_scale);
- if(treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
+ if (treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
{
- if(hit.dist/local_scale <= *r_depth) {
+ if (hit.dist/local_scale <= *r_depth) {
*r_depth= hit.dist/local_scale;
copy_v3_v3(r_loc, hit.co);
copy_v3_v3(r_no, hit.no);
@@ -1413,7 +1415,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
EDBM_init_index_arrays(em, 0, 0, 1);
}
- for( i = 0; i < totface; i++) {
+ for ( i = 0; i < totface; i++) {
BMFace *efa = NULL;
MFace *f = faces + i;
@@ -1437,7 +1439,8 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
{
test = 0;
- } else if (efa) {
+ }
+ else if (efa) {
BMIter iter;
BMLoop *l;
@@ -1493,7 +1496,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
EDBM_init_index_arrays(em, 1, 0, 0);
}
- for( i = 0; i < totvert; i++) {
+ for ( i = 0; i < totvert; i++) {
BMVert *eve = NULL;
MVert *v = verts + i;
@@ -1548,7 +1551,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
EDBM_init_index_arrays(em, 0, 1, 0);
}
- for( i = 0; i < totedge; i++) {
+ for ( i = 0; i < totedge; i++) {
BMEdge *eed = NULL;
MEdge *e = edges + i;
@@ -1670,7 +1673,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
DupliObject *dupli_ob;
ListBase *lb = object_duplilist(scene, ob);
- for(dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
+ for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
{
Object *dob = dupli_ob->ob;
@@ -1792,7 +1795,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
MFace *faces = dm->getTessFaceArray(dm);
int i;
- for( i = 0; i < totface; i++) {
+ for ( i = 0; i < totface; i++) {
MFace *f = faces + i;
float lambda;
int result;
@@ -1879,7 +1882,7 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
DupliObject *dupli_ob;
ListBase *lb = object_duplilist(scene, ob);
- for(dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
+ for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
{
Object *dob = dupli_ob->ob;
@@ -1992,7 +1995,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea
int i;
float asp[3] = {1.0f, 1.0f, 1.0f}; // TODO: Remove hard coded limit here (3)
- if(max_index > 2) {
+ if (max_index > 2) {
printf("applyGrid: invalid index %d, clamping\n", max_index);
max_index= 2;
}
@@ -2002,7 +2005,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea
return;
/* evil hack - snapping needs to be adapted for image aspect ratio */
- if((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
+ if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
ED_space_image_uv_aspect(t->sa->spacedata.first, asp, asp+1);
}