diff options
Diffstat (limited to 'source/blender/editors/transform')
9 files changed, 248 insertions, 432 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index f3819a1b83c..233719033c7 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -298,8 +298,7 @@ void removeAspectRatio(TransInfo *t, float *vec) static void viewRedrawForce(const bContext *C, TransInfo *t) { - if (t->spacetype == SPACE_VIEW3D) - { + if (t->spacetype == SPACE_VIEW3D) { /* Do we need more refined tags? */ if (t->flag & T_POSE) WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); @@ -415,7 +414,7 @@ static void view_editmove(unsigned short UNUSED(event)) if (Trans.flag & T_2D_EDIT) return; - switch(event) { + switch (event) { case WHEELUPMOUSE: if ( G.qual & LR_SHIFTKEY ) { @@ -586,8 +585,7 @@ int transformEvent(TransInfo *t, wmEvent *event) t->redraw |= handleMouseInput(t, &t->mouse, event); - if (event->type == MOUSEMOVE) - { + if (event->type == MOUSEMOVE) { if (t->modifiers & MOD_CONSTRAINT_SELECT) t->con.mode |= CON_SELECT; @@ -802,7 +800,7 @@ int transformEvent(TransInfo *t, wmEvent *event) t->redraw |= handleNumInput(&(t->num), event); } /* else do non-mapped events */ - else if (event->val==KM_PRESS) { + else if (event->val == KM_PRESS) { switch (event->type) { case RIGHTMOUSE: t->state = TRANS_CANCEL; @@ -1088,11 +1086,9 @@ int transformEvent(TransInfo *t, wmEvent *event) } /* confirm transform if launch key is released after mouse move */ - if (t->flag & T_RELEASE_CONFIRM) - { + if (t->flag & T_RELEASE_CONFIRM) { /* XXX Keyrepeat bug in Xorg fucks this up, will test when fixed */ - if (event->type == t->launch_event && (t->launch_event == LEFTMOUSE || t->launch_event == RIGHTMOUSE)) - { + if (event->type == t->launch_event && (t->launch_event == LEFTMOUSE || t->launch_event == RIGHTMOUSE)) { t->state = TRANS_CONFIRM; } } @@ -1156,8 +1152,7 @@ typedef enum { } ArrowDirection; static void drawArrow(ArrowDirection d, short offset, short length, short size) { - switch(d) - { + switch (d) { case LEFT: offset = -offset; length = -length; @@ -1191,8 +1186,7 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size) static void drawArrowHead(ArrowDirection d, short size) { - switch(d) - { + switch (d) { case LEFT: size = -size; case RIGHT: @@ -1223,8 +1217,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); } glVertex2f( cosf(angle_end) * size, sinf(angle_end) * size); @@ -1245,8 +1238,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) { TransInfo *t = (TransInfo*)customdata; - if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR)) - { + if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR)) { float vecrot[3], cent[2]; int mval[2]; @@ -1267,8 +1259,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) glPushMatrix(); - switch(t->helpline) - { + switch (t->helpline) { case HLP_SPRING: UI_ThemeColor(TH_WIRE); @@ -1417,23 +1408,23 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } /* convert flag to enum */ - switch(t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) - { - case (T_PROP_EDIT|T_PROP_CONNECTED): - proportional = PROP_EDIT_CONNECTED; - break; - case T_PROP_EDIT: - proportional = PROP_EDIT_ON; - break; - default: - proportional = PROP_EDIT_OFF; + switch (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { + case (T_PROP_EDIT|T_PROP_CONNECTED): + proportional = PROP_EDIT_CONNECTED; + break; + case T_PROP_EDIT: + proportional = PROP_EDIT_ON; + break; + default: + proportional = PROP_EDIT_OFF; } // If modal, save settings back in scene if not set as operator argument if (t->flag & T_MODAL) { /* save settings if not set in operator */ - if ( (prop = RNA_struct_find_property(op->ptr, "proportional")) && !RNA_property_is_set(op->ptr, prop)) + if ((prop = RNA_struct_find_property(op->ptr, "proportional")) && + !RNA_property_is_set(op->ptr, prop)) { if (t->obedit) ts->proportional = proportional; @@ -1441,12 +1432,14 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) ts->proportional_objects = (proportional != PROP_EDIT_OFF); } - if ( (prop = RNA_struct_find_property(op->ptr, "proportional_size")) && !RNA_property_is_set(op->ptr, prop)) + if ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) && + !RNA_property_is_set(op->ptr, prop)) { ts->proportional_size = t->prop_size; } - if ( (prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) && !RNA_property_is_set(op->ptr, prop)) + if ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) && + !RNA_property_is_set(op->ptr, prop)) { ts->prop_mode = t->prop_mode; } @@ -1460,34 +1453,31 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } if (t->spacetype == SPACE_VIEW3D) { - if ( (prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) && !RNA_property_is_set(op->ptr, prop)) + if ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) && + !RNA_property_is_set(op->ptr, prop)) { View3D *v3d = t->view; - + v3d->twmode = t->current_orientation; } } } - if (RNA_struct_find_property(op->ptr, "proportional")) - { + if (RNA_struct_find_property(op->ptr, "proportional")) { RNA_enum_set(op->ptr, "proportional", proportional); RNA_enum_set(op->ptr, "proportional_edit_falloff", t->prop_mode); RNA_float_set(op->ptr, "proportional_size", t->prop_size); } - if ((prop = RNA_struct_find_property(op->ptr, "axis"))) - { + if ((prop = RNA_struct_find_property(op->ptr, "axis"))) { RNA_property_float_set_array(op->ptr, prop, t->axis); } - if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) - { + if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) { RNA_property_boolean_set(op->ptr, prop, t->flag & T_MIRROR); } - if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) - { + if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) { /* constraint orientation can be global, event if user selects something else * so use the orientation in the constraint if set * */ @@ -1498,8 +1488,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation); } - if (t->con.mode & CON_APPLY) - { + if (t->con.mode & CON_APPLY) { if (t->con.mode & CON_AXIS0) { constraint_axis[0] = 1; } @@ -1527,8 +1516,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int t->state = TRANS_STARTING; - if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop)) - { + 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)) { options |= CTX_TEXTURE; } @@ -1540,8 +1528,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int t->launch_event = event ? event->type : -1; - if (t->launch_event == EVT_TWEAK_R) - { + if (t->launch_event == EVT_TWEAK_R) { t->launch_event = RIGHTMOUSE; } else if (t->launch_event == EVT_TWEAK_L) { @@ -1550,18 +1537,15 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int // XXX Remove this when wm_operator_call_internal doesn't use window->eventstate (which can have type = 0) // For manipulator only, so assume LEFTMOUSE - if (t->launch_event == 0) - { + if (t->launch_event == 0) { t->launch_event = LEFTMOUSE; } - if (!initTransInfo(C, t, op, event)) // internal data, mouse, vectors - { + if (!initTransInfo(C, t, op, event)) { /* internal data, mouse, vectors */ return 0; } - if (t->spacetype == SPACE_VIEW3D) - { + if (t->spacetype == SPACE_VIEW3D) { //calc_manipulator_stats(curarea); initTransformOrientation(C, t); @@ -1592,15 +1576,12 @@ 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; - for (kmi = keymap->items.first; kmi; kmi = kmi->next) - { - if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) - { + for (kmi = keymap->items.first; kmi; kmi = kmi->next) { + if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) { if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) || (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) || (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) || @@ -1731,16 +1712,14 @@ 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; } /* overwrite initial values if operator supplied a non-null vector */ - if ( (prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) - { + if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) { float values[4]= {0}; /* in case value isn't length 4, avoid uninitialized memory */ if (RNA_property_array_check(prop)) { @@ -1756,22 +1735,19 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int } /* Transformation axis from operator */ - if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) - { + if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) { RNA_property_float_get_array(op->ptr, prop, t->axis); normalize_v3(t->axis); copy_v3_v3(t->axis_orig, t->axis); } /* Constraint init from operator */ - if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) - { + if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) { int constraint_axis[3]; RNA_property_boolean_get_array(op->ptr, prop, constraint_axis); - if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) - { + if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) { t->con.mode |= CON_APPLY; if (constraint_axis[0]) { @@ -1797,8 +1773,7 @@ void transformApply(bContext *C, TransInfo *t) { t->context = C; - if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) - { + if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) { selectConstraint(t); if (t->transform) { t->transform(t, t->mval); // calls recalcData() @@ -1811,13 +1786,11 @@ void transformApply(bContext *C, TransInfo *t) } /* If auto confirm is on, break after one pass */ - if (t->options & CTX_AUTOCONFIRM) - { + if (t->options & CTX_AUTOCONFIRM) { t->state = TRANS_CONFIRM; } - if (BKE_ptcache_get_continue_physics()) - { + if (BKE_ptcache_get_continue_physics()) { // TRANSFORM_FIX_ME //do_screenhandlers(G.curscreen); t->redraw |= TREDRAW_HARD; @@ -1842,11 +1815,9 @@ int transformEnd(bContext *C, TransInfo *t) t->context = C; - if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) - { + 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) doEdgeSlide(t, 0.0f); @@ -2097,8 +2068,7 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td) * - current space should be local */ memset(cob, 0, sizeof(bConstraintOb)); - if (td->ext) - { + if (td->ext) { if (td->ext->rotOrder == ROT_MODE_QUAT) { /* quats */ /* objects and bones do normalization first too, otherwise @@ -2271,8 +2241,7 @@ static void postInputWarp(TransInfo *t, float values[3]) { mul_v3_fl(values, (float)(M_PI * 2)); - if (t->customData) /* non-null value indicates reversed input */ - { + if (t->customData) { /* non-null value indicates reversed input */ negate_v3(values); } } @@ -2324,8 +2293,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event) { int status = 0; - if (event->type == MIDDLEMOUSE && event->val==KM_PRESS) - { + if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) { // Use customData pointer to signal warp direction if (t->customData == NULL) t->customData = (void*)1; @@ -2465,11 +2433,9 @@ int handleEventShear(TransInfo *t, wmEvent *event) { int status = 0; - if (event->type == MIDDLEMOUSE && event->val==KM_PRESS) - { + if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) { // Use customData pointer to signal Shear direction - if (t->customData == NULL) - { + if (t->customData == NULL) { initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE); t->customData = (void*)1; } @@ -2603,7 +2569,7 @@ static void headerResize(TransInfo *t, float vec[3], char *str) } if (t->con.mode & CON_APPLY) { - switch(t->num.idx_max) { + switch (t->num.idx_max) { case 0: spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext); break; @@ -2755,8 +2721,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; } else { @@ -2774,8 +2739,7 @@ int Resize(TransInfo *t, const int mval[2]) applySnapping(t, size); - if (t->flag & T_AUTOVALUES) - { + if (t->flag & T_AUTOVALUES) { copy_v3_v3(size, t->auto_values); } @@ -3008,8 +2972,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short copy_m3_m4(pmtx, t->poseobj->obmat); invert_m3_m3(imtx, pmtx); - if ((td->flag & TD_NO_LOC) == 0) - { + if ((td->flag & TD_NO_LOC) == 0) { sub_v3_v3v3(vec, td->center, center); mul_m3_v3(pmtx, vec); // To Global space @@ -3093,8 +3056,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short } } else { - if ((td->flag & TD_NO_LOC) == 0) - { + if ((td->flag & TD_NO_LOC) == 0) { /* translation */ sub_v3_v3v3(vec, td->center, center); mul_m3_v3(mat, vec); @@ -3440,7 +3402,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) autoik[0]= '\0'; if (t->con.mode & CON_APPLY) { - switch(t->num.idx_max) { + switch (t->num.idx_max) { case 0: spos += sprintf(spos, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]); break; @@ -3899,7 +3861,7 @@ void initBevel(TransInfo *t) int handleEventBevel(TransInfo *t, wmEvent *event) { - if (event->val==KM_PRESS) { + if (event->val == KM_PRESS) { if (!G.editBMesh) return 0; switch (event->type) { @@ -5243,8 +5205,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]; if (td->flag & TD_NOACTION) diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 18e9c1a47b8..ebded7b0a6e 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -76,8 +76,7 @@ static void drawObjectConstraint(TransInfo *t); static void constraintAutoValues(TransInfo *t, float vec[3]) { int mode = t->con.mode; - if (mode & CON_APPLY) - { + if (mode & CON_APPLY) { float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f; if ((mode & CON_AXIS0) == 0) { @@ -478,7 +477,7 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], fl if (!td && t->con.mode & CON_APPLY) { int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2); - switch(mode) { + switch (mode) { case CON_AXIS0: case (CON_AXIS1|CON_AXIS2): copy_v3_v3(vec, t->con.mtx[0]); @@ -525,7 +524,7 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3], td= t->data; } - switch(mode) { + switch (mode) { case CON_AXIS0: case (CON_AXIS1|CON_AXIS2): copy_v3_v3(vec, td->axismtx[0]); @@ -604,7 +603,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte { char text[40]; - switch(orientation) { + switch (orientation) { case V3D_MANIP_GLOBAL: { float mtx[3][3]= MAT3_UNITY; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 062f88f8837..d33b8787121 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -127,8 +127,7 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra TransData *itail = tail; *temp = *head; - while (head < tail) - { + while (head < tail) { if (t->flag & T_PROP_CONNECTED) { while ((tail->dist >= temp->dist) && (head < tail)) tail--; @@ -138,8 +137,7 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra tail--; } - if (head != tail) - { + if (head != tail) { *head = *tail; head++; } @@ -153,8 +151,7 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra head++; } - if (head != tail) - { + if (head != tail) { *tail = *head; tail--; } @@ -535,13 +532,11 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr td->ob = ob; td->flag = TD_SELECTED; - if (bone->flag & BONE_HINGE_CHILD_TRANSFORM) - { + if (bone->flag & BONE_HINGE_CHILD_TRANSFORM) { td->flag |= TD_NOCENTER; } - if (bone->flag & BONE_TRANSFORM_CHILD) - { + if (bone->flag & BONE_TRANSFORM_CHILD) { td->flag |= TD_NOCENTER; td->flag |= TD_NO_LOC; } @@ -2707,8 +2702,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) center[2]= 0.0f; /* set td's based on which handles are applicable */ - if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA)) - { + if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA)) { /* just set tdn to assume that it only has one handle for now */ tdn->handle= -1; @@ -2739,8 +2733,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) td->extra= tdn; td++; } - if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA)) - { + if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA)) { /* if tdn is already holding the start handle, then we're doing both, otherwise, only end */ tdn->handle= (tdn->handle) ? 2 : 1; @@ -3993,7 +3986,7 @@ static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq { int start_left; - switch(sel_flag) { + switch (sel_flag) { case SELECT: /* Use seq_tx_get_final_left() and an offset here * so transform has the left hand location of the strip. @@ -4447,8 +4440,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) } /* set active flag */ - if (ob == OBACT) - { + if (ob == OBACT) { td->flag |= TD_ACTIVE; } } @@ -4500,8 +4492,7 @@ 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; @@ -4534,10 +4525,8 @@ static int mark_children(Object *ob) if (ob->flag & (SELECT|BA_TRANSFORM_CHILD)) return 1; - if (ob->parent) - { - if (mark_children(ob->parent)) - { + if (ob->parent) { + if (mark_children(ob->parent)) { ob->flag |= BA_TRANSFORM_CHILD; return 1; } @@ -4554,8 +4543,7 @@ static int count_proportional_objects(TransInfo *t) Base *base; /* rotations around local centers are allowed to propagate, so we take all objects */ - if (!((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL)) - { + if (!((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL)) { /* mark all parents */ for (base= scene->base.first; base; base= base->next) { if (TESTBASELIB_BGMODE(v3d, scene, base)) { @@ -4616,8 +4604,7 @@ static void clear_trans_object_base_flags(TransInfo *t) Scene *sce = t->scene; Base *base; - for (base= sce->base.first; base; base = base->next) - { + for (base= sce->base.first; base; base = base->next) { if (base->flag & BA_WAS_SEL) base->flag |= SELECT; @@ -5070,8 +5057,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) if (ANIM_animdata_get_context(C, &ac) == 0) return; - if (ac.datatype) - { + if (ac.datatype) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE); @@ -5120,8 +5106,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) if (ANIM_animdata_get_context(C, &ac) == 0) return; - if (ac.datatype) - { + if (ac.datatype) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT); @@ -5147,8 +5132,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) } } else if (t->obedit) { - if (t->obedit->type == OB_MESH) - { + if (t->obedit->type == OB_MESH) { BMEditMesh *em = BMEdit_FromObject(t->obedit); /* table needs to be created for each edit command, since vertices can move etc */ mesh_octree_table(t->obedit, em, NULL, 'e'); @@ -5298,8 +5282,7 @@ static void createTransObject(bContext *C, TransInfo *t) return; } - if (propmode) - { + if (propmode) { t->total += count_proportional_objects(t); } @@ -5315,8 +5298,7 @@ static void createTransObject(bContext *C, TransInfo *t) td->ext = tx; td->ext->rotOrder= ob->rotmode; - if (base->flag & BA_TRANSFORM_CHILD) - { + if (base->flag & BA_TRANSFORM_CHILD) { td->flag |= TD_NOCENTER; td->flag |= TD_NO_LOC; } @@ -5333,8 +5315,7 @@ static void createTransObject(bContext *C, TransInfo *t) } CTX_DATA_END; - if (propmode) - { + if (propmode) { Scene *scene = t->scene; View3D *v3d = t->view; Base *base; @@ -5343,7 +5324,8 @@ static void createTransObject(bContext *C, TransInfo *t) Object *ob= base->object; /* if base is not selected, not a parent of selection or not a child of selection and it is editable */ - if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base)) + if ((ob->flag & (SELECT | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && + BASE_EDITABLE_BGMODE(v3d, scene, base)) { td->protectflag= ob->protectflag; td->ext = tx; @@ -6032,12 +6014,10 @@ void createTransData(bContext *C, TransInfo *t) sort_trans_data_dist(t); } - if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) - { + if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) { 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 b500398dd76..2c5d074e2cf 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -111,8 +111,7 @@ void getViewVector(TransInfo *t, float coord[3], float vec[3]) { - if (t->persp != RV3D_ORTHO) - { + if (t->persp != RV3D_ORTHO) { float p1[4], p2[4]; copy_v3_v3(p1, coord); @@ -256,8 +255,7 @@ static void editbmesh_apply_to_mirror(TransInfo *t) eve->co[2]= td->loc[2]; } - if (td->flag & TD_MIRROR_EDGE) - { + if (td->flag & TD_MIRROR_EDGE) { td->loc[0] = 0; } } @@ -775,21 +773,17 @@ static void recalcData_view3d(TransInfo *t) } - if (t->mode != TFM_BONE_ROLL) - { + if (t->mode != TFM_BONE_ROLL) { /* fix roll */ - for (i = 0; i < t->total; i++, td++) - { - if (td->extra) - { + for (i = 0; i < t->total; i++, td++) { + if (td->extra) { float vec[3], up_axis[3]; float qrot[4]; ebo = td->extra; copy_v3_v3(up_axis, td->axismtx[2]); - if (t->mode != TFM_ROTATION) - { + if (t->mode != TFM_ROTATION) { sub_v3_v3v3(vec, ebo->tail, ebo->head); normalize_v3(vec); rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec); @@ -915,8 +909,7 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options) float v1[3], v2[3], v3[3]; unsigned char col[3], col2[3]; - if (t->spacetype == SPACE_VIEW3D) - { + if (t->spacetype == SPACE_VIEW3D) { View3D *v3d = t->view; glPushMatrix(); @@ -984,8 +977,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->redraw = 1; /* redraw first time */ - if (event) - { + if (event) { copy_v2_v2_int(t->imval, event->mval); t->event_type = event->type; } @@ -1043,8 +1035,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; t->view = v3d; @@ -1060,12 +1051,12 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) 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")) + if (op && (RNA_struct_find_property(op->ptr, "constraint_orientation") && + RNA_struct_property_is_set(op->ptr, "constraint_orientation"))) { t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation"); - - if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) - { + + if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) { t->current_orientation = V3D_MANIP_GLOBAL; } } @@ -1124,10 +1115,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->around = V3D_CENTER; } - if (op && RNA_struct_property_is_set(op->ptr, "release_confirm")) - { - if (RNA_boolean_get(op->ptr, "release_confirm")) - { + if (op && RNA_struct_property_is_set(op->ptr, "release_confirm")) { + if (RNA_boolean_get(op->ptr, "release_confirm")) { t->flag |= T_RELEASE_CONFIRM; } } @@ -1137,35 +1126,31 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } } - if (op && RNA_struct_find_property(op->ptr, "mirror") && RNA_struct_property_is_set(op->ptr, "mirror")) + if (op && (RNA_struct_find_property(op->ptr, "mirror") && + RNA_struct_property_is_set(op->ptr, "mirror"))) { - if (RNA_boolean_get(op->ptr, "mirror")) - { + if (RNA_boolean_get(op->ptr, "mirror")) { t->flag |= T_MIRROR; t->mirror = 1; } } // Need stuff to take it from edit mesh or whatnot here else if (t->spacetype == SPACE_VIEW3D) { - if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X)) - { + if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X)) { t->flag |= T_MIRROR; t->mirror = 1; } } /* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */ - if (op && RNA_struct_find_property(op->ptr, "proportional")) - { - if (RNA_struct_property_is_set(op->ptr, "proportional")) - { - switch(RNA_enum_get(op->ptr, "proportional")) - { - case PROP_EDIT_CONNECTED: - t->flag |= T_PROP_CONNECTED; - case PROP_EDIT_ON: - t->flag |= T_PROP_EDIT; - break; + if (op && RNA_struct_find_property(op->ptr, "proportional")) { + if (RNA_struct_property_is_set(op->ptr, "proportional")) { + switch (RNA_enum_get(op->ptr, "proportional")) { + case PROP_EDIT_CONNECTED: + t->flag |= T_PROP_CONNECTED; + case PROP_EDIT_ON: + t->flag |= T_PROP_EDIT; + break; } } else { @@ -1186,7 +1171,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } } - if (op && RNA_struct_find_property(op->ptr, "proportional_size") && RNA_struct_property_is_set(op->ptr, "proportional_size")) + if (op && (RNA_struct_find_property(op->ptr, "proportional_size") && + RNA_struct_property_is_set(op->ptr, "proportional_size"))) { t->prop_size = RNA_float_get(op->ptr, "proportional_size"); } @@ -1196,13 +1182,13 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) /* TRANSFORM_FIX_ME rna restrictions */ - if (t->prop_size <= 0.00001f) - { + if (t->prop_size <= 0.00001f) { printf("Proportional size (%f) under 0.00001, reseting to 1!\n", t->prop_size); t->prop_size = 1.0f; } - if (op && RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && RNA_struct_property_is_set(op->ptr, "proportional_edit_falloff")) + if (op && (RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && + RNA_struct_property_is_set(op->ptr, "proportional_edit_falloff"))) { t->prop_mode = RNA_enum_get(op->ptr, "proportional_edit_falloff"); } @@ -1210,14 +1196,12 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->prop_mode = ts->prop_mode; } } - else /* add not pet option to context when not available */ - { + else { /* add not pet option to context when not available */ t->options |= CTX_NO_PET; } // Mirror is not supported with PET, turn it off. - if (t->flag & T_PROP_EDIT) - { + if (t->flag & T_PROP_EDIT) { t->flag &= ~T_MIRROR; } @@ -1282,8 +1266,7 @@ void postTrans (bContext *C, TransInfo *t) } } - if (t->mouse.data) - { + if (t->mouse.data) { MEM_freeN(t->mouse.data); } } @@ -1440,8 +1423,7 @@ void calculateCenterMedian(TransInfo *t) for (i = 0; i < t->total; i++) { if (t->data[i].flag & TD_SELECTED) { - if (!(t->data[i].flag & TD_NOCENTER)) - { + if (!(t->data[i].flag & TD_NOCENTER)) { add_v3_v3(partial, t->data[i].center); total++; } @@ -1493,7 +1475,7 @@ void calculateCenterBound(TransInfo *t) void calculateCenter(TransInfo *t) { - switch(t->around) { + switch (t->around) { case V3D_CENTER: calculateCenterBound(t); break; @@ -1542,8 +1524,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; if (ob) { @@ -1583,8 +1564,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); } @@ -1625,11 +1605,8 @@ void calculatePropRatio(TransInfo *t) td->factor = 0.0f; restoreElement(td); } - else if ((connected && - (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size)) - || - (connected == 0 && - td->rdist > t->prop_size)) + else if ((connected && (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size)) || + (connected == 0 && td->rdist > t->prop_size)) { /* * The elements are sorted according to their dist member in the array, @@ -1656,7 +1633,7 @@ void calculatePropRatio(TransInfo *t) if (dist < 0.0f) dist = 0.0f; - switch(t->prop_mode) { + switch (t->prop_mode) { case PROP_SHARP: td->factor= dist*dist; break; @@ -1684,7 +1661,7 @@ void calculatePropRatio(TransInfo *t) } } } - switch(t->prop_mode) { + switch (t->prop_mode) { case PROP_SHARP: strcpy(t->proptext, "(Sharp)"); break; diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index bd3fb20f77f..467e3dc600e 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -313,8 +313,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) } #endif - switch(mode) - { + switch (mode) { case INPUT_VECTOR: mi->apply = InputVector; t->helpline = HLP_NONE; @@ -391,8 +390,7 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event) { int redraw = TREDRAW_NOTHING; - switch (event->type) - { + switch (event->type) { case LEFTSHIFTKEY: case RIGHTSHIFTKEY: if (event->val == KM_PRESS) { diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 5b70b25c894..c043be0c7f8 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -549,7 +549,7 @@ int calc_manipulator_stats(const bContext *C) /* global, local or normal orientation? */ if (ob && totsel) { - switch(v3d->twmode) { + switch (v3d->twmode) { case V3D_MANIP_GLOBAL: break; /* nothing to do */ @@ -761,7 +761,7 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned c UI_GetThemeColor3ubv(TH_TRANSFORM, col); } else { - switch(axis) { + switch (axis) { case 'C': UI_GetThemeColor3ubv(TH_TRANSFORM, col); if (v3d->twmode == V3D_MANIP_LOCAL) { @@ -1483,7 +1483,7 @@ void BIF_draw_manipulator(const bContext *C) v3d->twflag |= V3D_DRAW_MANIPULATOR; /* now we can define center */ - switch(v3d->around) { + switch (v3d->around) { case V3D_CENTER: case V3D_ACTIVE: rv3d->twmat[3][0]= (scene->twmin[0] + scene->twmax[0])/2.0f; @@ -1639,7 +1639,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op) if (drawflags==0) drawflags= val; if (drawflags & MAN_TRANS_C) { - switch(drawflags) { + switch (drawflags) { case MAN_TRANS_C: break; case MAN_TRANS_X: @@ -1672,7 +1672,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op) //wm_operator_invoke(C, WM_operatortype_find("TRANSFORM_OT_translate", 0), event, op->ptr, NULL, FALSE); } else if (drawflags & MAN_SCALE_C) { - switch(drawflags) { + switch (drawflags) { case MAN_SCALE_X: if (shift) { constraint_axis[1] = 1; @@ -1707,7 +1707,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op) //wm_operator_invoke(C, WM_operatortype_find("TRANSFORM_OT_trackball", 0), event, op->ptr, NULL, FALSE); } else if (drawflags & MAN_ROT_C) { - switch(drawflags) { + switch (drawflags) { case MAN_ROT_X: constraint_axis[0] = 1; break; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 09078c199c4..b9ae3180591 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -317,23 +317,19 @@ static void transformops_exit(bContext *C, wmOperator *op) static int transformops_data(bContext *C, wmOperator *op, wmEvent *event) { int retval = 1; - if (op->customdata == NULL) - { + if (op->customdata == NULL) { TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data2"); TransformModeItem *tmode; int mode = -1; - for (tmode = transform_modes; tmode->idname; tmode++) - { - if (op->type->idname == tmode->idname) - { + for (tmode = transform_modes; tmode->idname; tmode++) { + if (op->type->idname == tmode->idname) { mode = tmode->mode; break; } } - if (mode == -1) - { + if (mode == -1) { mode = RNA_enum_get(op->ptr, "mode"); } @@ -376,8 +372,7 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event) exit_code |= transformEnd(C, t); - if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) - { + if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) { transformops_exit(C, op); exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */ } @@ -400,8 +395,7 @@ static int transform_exec(bContext *C, wmOperator *op) { TransInfo *t; - if (!transformops_data(C, op, NULL)) - { + if (!transformops_data(C, op, NULL)) { G.moving = 0; return OPERATOR_CANCELLED; } @@ -423,8 +417,7 @@ static int transform_exec(bContext *C, wmOperator *op) static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if (!transformops_data(C, op, event)) - { + if (!transformops_data(C, op, event)) { G.moving = 0; return OPERATOR_CANCELLED; } @@ -445,8 +438,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) { PropertyRNA *prop; - if (flags & P_AXIS) - { + if (flags & P_AXIS) { prop= RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION); RNA_def_property_array(prop, 3); /* Make this not hidden when there's a nice axis selection widget */ @@ -455,8 +447,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) } - if (flags & P_CONSTRAINT) - { + if (flags & P_CONSTRAINT) { RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", ""); prop= RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE); RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation"); @@ -465,21 +456,18 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) } - if (flags & P_MIRROR) - { + if (flags & P_MIRROR) { RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", ""); } - if (flags & P_PROPORTIONAL) - { + if (flags & P_PROPORTIONAL) { RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", ""); RNA_def_enum(ot->srna, "proportional_edit_falloff", proportional_falloff_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode"); RNA_def_float(ot->srna, "proportional_size", 1, 0.00001f, FLT_MAX, "Proportional Size", "", 0.001, 100); } - if (flags & P_SNAP) - { + if (flags & P_SNAP) { prop= RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", ""); RNA_def_property_flag(prop, PROP_HIDDEN); @@ -497,14 +485,12 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) } } } - - if (flags & P_OPTIONS) - { + + if (flags & P_OPTIONS) { RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space"); } - if (flags & P_CORRECT_UV) - { + if (flags & P_CORRECT_UV) { RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UVs", "Correct UV coordinates when transforming"); } @@ -827,8 +813,7 @@ void transform_operatortypes(void) { TransformModeItem *tmode; - for (tmode = transform_modes; tmode->idname; tmode++) - { + for (tmode = transform_modes; tmode->idname; tmode++) { WM_operatortype_append(tmode->opfunc); } @@ -853,15 +838,13 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac if (modalmap) { TransformModeItem *tmode; - for (tmode = transform_modes; tmode->idname; tmode++) - { + for (tmode = transform_modes; tmode->idname; tmode++) { WM_modalkeymap_assign(modalmap, tmode->idname); } WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform"); } - switch(spaceid) - { + switch (spaceid) { case SPACE_VIEW3D: WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 0f929003e8f..0f9f90819d0 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -176,8 +176,7 @@ TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *na type = getTransformOrientation(C, normal, plane, 0); - switch (type) - { + switch (type) { case ORIENTATION_VERT: if (createSpaceNormal(mat, normal) == 0) { BKE_reports_prepend(reports, "Cannot use vertex with zero-length normal"); @@ -493,7 +492,7 @@ void initTransformOrientation(bContext *C, TransInfo *t) Object *ob = CTX_data_active_object(C); Object *obedit = CTX_data_active_object(C); - switch(t->current_orientation) { + switch (t->current_orientation) { case V3D_MANIP_GLOBAL: unit_m3(t->spacemtx); strcpy(t->spacename, "global"); @@ -581,8 +580,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], BM_editselection_normal(&ese, normal); BM_editselection_plane(&ese, plane); - switch (ese.htype) - { + switch (ese.htype) { case BM_VERT: result = ORIENTATION_VERT; break; @@ -724,8 +722,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], if (nu->type == CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; - while (a--) - { + while (a--) { /* exception */ if ((bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT) { sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]); @@ -886,8 +883,7 @@ void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[] type = getTransformOrientation(C, normal, plane, activeOnly); - switch (type) - { + switch (type) { case ORIENTATION_NORMAL: if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) { type = ORIENTATION_NONE; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 7bdd3ddc069..0a5613bca22 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -140,8 +140,7 @@ int activeSnap(TransInfo *t) void drawSnapping(const struct bContext *C, TransInfo *t) { - if (validSnap(t) && activeSnap(t)) - { + if (validSnap(t) && activeSnap(t)) { unsigned char col[4], selectedCol[4], activeCol[4]; UI_GetThemeColor3ubv(TH_TRANSFORM, col); @@ -184,8 +183,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) } /* draw normal if needed */ - if (usingSnappingNormal(t) && validSnappingNormal(t)) - { + if (usingSnappingNormal(t) && validSnappingNormal(t)) { glColor4ubv(activeCol); glBegin(GL_LINES); @@ -240,16 +238,14 @@ int handleSnapping(TransInfo *t, wmEvent *event) int status = 0; #if 0 // XXX need a proper selector for all snap mode - if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift) - { + if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift) { /* toggle snap and reinit */ t->settings->snap_flag ^= SCE_SNAP; initSnapping(t, NULL); status = 1; } #endif - if (event->type == MOUSEMOVE) - { + if (event->type == MOUSEMOVE) { status |= updateSelectedSnapPoint(t); } @@ -259,8 +255,7 @@ int handleSnapping(TransInfo *t, wmEvent *event) void applyProject(TransInfo *t) { /* XXX FLICKER IN OBJECT MODE */ - if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0) - { + if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0) { TransData *td = t->data; float tvec[3]; float imat[4][4]; @@ -283,8 +278,7 @@ void applyProject(TransInfo *t) continue; copy_v3_v3(iloc, td->loc); - 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, iloc); } @@ -296,8 +290,7 @@ void applyProject(TransInfo *t) project_float(t->ar, iloc, mval); - if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect)) - { + if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect)) { // if (t->flag & (T_EDIT|T_POSE)) { // mul_m4_v3(imat, loc); // } @@ -320,8 +313,7 @@ void applySnapping(TransInfo *t, float *vec) if (t->tsnap.project) return; - if (t->tsnap.status & SNAP_FORCED) - { + if (t->tsnap.status & SNAP_FORCED) { t->tsnap.targetSnap(t); t->tsnap.applySnap(t, vec); @@ -331,15 +323,13 @@ void applySnapping(TransInfo *t, float *vec) // Time base quirky code to go around findnearest slowness /* !TODO! add exception for object mode, no need to slow it down then */ - if (current - t->tsnap.last >= 0.01) - { + if (current - t->tsnap.last >= 0.01) { t->tsnap.calcSnap(t, vec); t->tsnap.targetSnap(t); t->tsnap.last = current; } - if (validSnap(t)) - { + if (validSnap(t)) { t->tsnap.applySnap(t, vec); } } @@ -368,10 +358,8 @@ int usingSnappingNormal(TransInfo *t) int validSnappingNormal(TransInfo *t) { - if (validSnap(t)) - { - if (dot_v3v3(t->tsnap.snapNormal, t->tsnap.snapNormal) > 0) - { + if (validSnap(t)) { + if (dot_v3v3(t->tsnap.snapNormal, t->tsnap.snapNormal) > 0) { return 1; } } @@ -439,38 +427,31 @@ void initSnapping(TransInfo *t, wmOperator *op) resetSnapping(t); /* if snap property exists */ - if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_struct_property_is_set(op->ptr, "snap")) - { - if (RNA_boolean_get(op->ptr, "snap")) - { + if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_struct_property_is_set(op->ptr, "snap")) { + if (RNA_boolean_get(op->ptr, "snap")) { t->modifiers |= MOD_SNAP; - if (RNA_struct_property_is_set(op->ptr, "snap_target")) - { + if (RNA_struct_property_is_set(op->ptr, "snap_target")) { snap_target = RNA_enum_get(op->ptr, "snap_target"); } - if (RNA_struct_property_is_set(op->ptr, "snap_point")) - { + if (RNA_struct_property_is_set(op->ptr, "snap_point")) { RNA_float_get_array(op->ptr, "snap_point", t->tsnap.snapPoint); t->tsnap.status |= SNAP_FORCED|POINT_INIT; } /* snap align only defined in specific cases */ - if (RNA_struct_find_property(op->ptr, "snap_align")) - { + if (RNA_struct_find_property(op->ptr, "snap_align")) { t->tsnap.align = RNA_boolean_get(op->ptr, "snap_align"); RNA_float_get_array(op->ptr, "snap_normal", t->tsnap.snapNormal); normalize_v3(t->tsnap.snapNormal); } - if (RNA_struct_find_property(op->ptr, "use_snap_project")) - { + if (RNA_struct_find_property(op->ptr, "use_snap_project")) { t->tsnap.project = RNA_boolean_get(op->ptr, "use_snap_project"); } - if (RNA_struct_find_property(op->ptr, "use_snap_self")) - { + if (RNA_struct_find_property(op->ptr, "use_snap_self")) { t->tsnap.snap_self = RNA_boolean_get(op->ptr, "use_snap_self"); } } @@ -498,8 +479,7 @@ static void setSnappingCallback(TransInfo *t) { t->tsnap.calcSnap = CalcSnapGeometry; - switch(t->tsnap.target) - { + switch (t->tsnap.target) { case SCE_SNAP_TARGET_CLOSEST: t->tsnap.targetSnap = TargetSnapClosest; break; @@ -515,8 +495,7 @@ static void setSnappingCallback(TransInfo *t) } - switch (t->mode) - { + switch (t->mode) { case TFM_TRANSLATION: t->tsnap.applySnap = ApplySnapTranslation; t->tsnap.distance = TranslationBetween; @@ -766,8 +745,7 @@ static void UNUSED_FUNCTION(CalcSnapGrid)(TransInfo *t, float *UNUSED(vec)) static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) { - if (t->spacetype == SPACE_VIEW3D) - { + if (t->spacetype == SPACE_VIEW3D) { float loc[3]; float no[3]; float mval[2]; @@ -777,8 +755,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) mval[0] = t->mval[0]; mval[1] = t->mval[1]; - if (t->tsnap.mode == SCE_SNAP_MODE_VOLUME) - { + if (t->tsnap.mode == SCE_SNAP_MODE_VOLUME) { ListBase depth_peels; DepthPeel *p1, *p2; float *last_p = NULL; @@ -799,10 +776,8 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) // } - for (p1 = depth_peels.first; p1; p1 = p1->next) - { - if (p1->flag == 0) - { + for (p1 = depth_peels.first; p1; p1 = p1->next) { + if (p1->flag == 0) { float vec[3]; float new_dist; @@ -810,13 +785,10 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) p1->flag = 1; /* if peeling objects, take the first and last from each object */ - if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT) - { + if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT) { DepthPeel *peel; - for (peel = p1->next; peel; peel = peel->next) - { - if (peel->ob == p1->ob) - { + for (peel = p1->next; peel; peel = peel->next) { + if (peel->ob == p1->ob) { peel->flag = 1; p2 = peel; } @@ -824,8 +796,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) } /* otherwise, pair first with second and so on */ else { - for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next) - { + for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next) { /* nothing to do here */ } } @@ -839,9 +810,8 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) else { copy_v3_v3(vec, p1->p); } - - if (last_p == NULL) - { + + if (last_p == NULL) { copy_v3_v3(p, vec); max_dist = 0; break; @@ -856,8 +826,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) } } - if (max_dist != FLT_MAX) - { + if (max_dist != FLT_MAX) { copy_v3_v3(loc, p); /* XXX, is there a correct normal in this case ???, for now just z up */ no[0]= 0.0; @@ -878,8 +847,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) sub_v3_v3v3(tangent, loc, t->tsnap.snapPoint); tangent[2] = 0; - if (dot_v3v3(tangent, tangent) > 0) - { + if (dot_v3v3(tangent, tangent) > 0) { copy_v3_v3(t->tsnap.snapTangent, tangent); } @@ -899,8 +867,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; t->tsnap.snapPoint[1] *= aspy; @@ -917,9 +884,8 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) static void TargetSnapCenter(TransInfo *t) { - // Only need to calculate once - if ((t->tsnap.status & TARGET_INIT) == 0) - { + /* Only need to calculate once */ + if ((t->tsnap.status & TARGET_INIT) == 0) { copy_v3_v3(t->tsnap.snapTarget, t->center); if (t->flag & (T_EDIT|T_POSE)) { Object *ob= t->obedit?t->obedit:t->poseobj; @@ -932,24 +898,20 @@ static void TargetSnapCenter(TransInfo *t) static void TargetSnapActive(TransInfo *t) { - // Only need to calculate once - if ((t->tsnap.status & TARGET_INIT) == 0) - { + /* Only need to calculate once */ + if ((t->tsnap.status & TARGET_INIT) == 0) { TransData *td = NULL; TransData *active_td = NULL; int i; - for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) - { - if (td->flag & TD_ACTIVE) - { + for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) { + if (td->flag & TD_ACTIVE) { active_td = td; break; } } - if (active_td) - { + if (active_td) { copy_v3_v3(t->tsnap.snapTarget, active_td->center); if (t->flag & (T_EDIT|T_POSE)) { @@ -971,8 +933,7 @@ static void TargetSnapActive(TransInfo *t) static void TargetSnapMedian(TransInfo *t) { // Only need to calculate once - if ((t->tsnap.status & TARGET_INIT) == 0) - { + if ((t->tsnap.status & TARGET_INIT) == 0) { TransData *td = NULL; int i; @@ -980,8 +941,7 @@ 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); } @@ -999,21 +959,17 @@ static void TargetSnapMedian(TransInfo *t) static void TargetSnapClosest(TransInfo *t) { // Only valid if a snap point has been selected - if (t->tsnap.status & POINT_INIT) - { + if (t->tsnap.status & POINT_INIT) { TransData *closest = NULL, *td = NULL; /* Object mode */ - if (t->flag & T_OBJECT) - { + 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); /* use boundbox if possible */ - if (bb) - { + if (bb) { int j; for (j = 0; j < 8; j++) { @@ -1041,8 +997,7 @@ static void TargetSnapClosest(TransInfo *t) dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint); - if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) - { + if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) { copy_v3_v3(t->tsnap.snapTarget, loc); closest = td; t->tsnap.dist = dist; @@ -1065,8 +1020,7 @@ static void TargetSnapClosest(TransInfo *t) dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint); - if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) - { + if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) { copy_v3_v3(t->tsnap.snapTarget, loc); closest = td; t->tsnap.dist = dist; @@ -1112,8 +1066,7 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl project_int(ar, location, screen_loc); new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]); - if (new_dist <= *dist && new_depth < *depth) - { + if (new_dist <= *dist && new_depth < *depth) { *depth = new_depth; retval = 1; @@ -1145,8 +1098,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh result = isect_line_line_v3(v1co, v2co, ray_start_local, ray_end, intersect, dvec); /* dvec used but we don't care about result */ - if (result) - { + if (result) { float edge_loc[3], vec[3]; float mul; @@ -1167,8 +1119,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh copy_v3_v3(intersect, v2co); } - if (dot_v3v3(ray_normal_local, dvec) > 0) - { + if (dot_v3v3(ray_normal_local, dvec) > 0) { float location[3]; float new_depth; int screen_loc[2]; @@ -1187,8 +1138,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh * this takes care of series of connected edges a bit slanted w.r.t the viewport * otherwise, it would stick to the verts of the closest edge and not slide along merrily * */ - if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f) - { + if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f) { float n1[3], n2[3]; *r_depth = new_depth; @@ -1199,8 +1149,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc); - if (r_no) - { + if (r_no) { normal_short_to_float_v3(n1, v1no); normal_short_to_float_v3(n2, v2no); interp_v3_v3v3(r_no, n2, n1, mul); @@ -1227,8 +1176,7 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4], sub_v3_v3v3(dvec, vco, ray_start_local); - if (dot_v3v3(ray_normal_local, dvec) > 0) - { + if (dot_v3v3(ray_normal_local, dvec) > 0) { float location[3]; float new_depth; int screen_loc[2]; @@ -1243,15 +1191,13 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4], project_int(ar, location, screen_loc); new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]); - if (new_dist <= *r_dist && new_depth < *r_depth) - { + if (new_dist <= *r_dist && new_depth < *r_depth) { *r_depth = new_depth; retval = 1; copy_v3_v3(r_loc, location); - if (r_no) - { + if (r_no) { normal_short_to_float_v3(r_no, vno); mul_m3_v3(timat, r_no); normalize_v3(r_no); @@ -1280,16 +1226,14 @@ 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; for (eBone=arm->edbo->first; eBone; eBone=eBone->next) { if (eBone->layer & arm->layer) { /* skip hidden or moving (selected) bones */ if ((eBone->flag & (BONE_HIDDEN_A|BONE_ROOTSEL|BONE_TIPSEL))==0) { - switch (snap_mode) - { + switch (snap_mode) { case SCE_SNAP_MODE_VERTEX: retval |= snapVertex(ar, eBone->head, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); retval |= snapVertex(ar, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); @@ -1313,8 +1257,7 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm float *head_vec = pchan->pose_head; float *tail_vec = pchan->pose_tail; - switch (snap_mode) - { + switch (snap_mode) { case SCE_SNAP_MODE_VERTEX: retval |= snapVertex(ar, head_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); retval |= snapVertex(ar, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth); @@ -1366,8 +1309,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh if (test == 1) { - switch (snap_mode) - { + switch (snap_mode) { case SCE_SNAP_MODE_FACE: { #ifdef USE_BVH_FACE_SNAP // Added for durian @@ -1383,8 +1325,7 @@ 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) { *r_depth= hit.dist/local_scale; copy_v3_v3(r_loc, hit.co); @@ -1409,8 +1350,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh int index = 0; int i; - if (em != NULL) - { + if (em != NULL) { index_array = dm->getTessFaceDataArray(dm, CD_ORIGINDEX); EDBM_index_arrays_init(em, 0, 0, 1); } @@ -1421,8 +1361,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh test = 1; /* reset for every face */ - if (em != NULL) - { + if (em != NULL) { if (index_array) { index = index_array[i]; } @@ -1436,8 +1375,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh else { efa = EDBM_face_at_index(em, index); - if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) - { + if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { test = 0; } else if (efa) { @@ -1456,28 +1394,24 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh } - if (test) - { + if (test) { int result; float *v4co = NULL; - if (f->v4) - { + if (f->v4) { v4co = verts[f->v4].co; } result = snapFace(ar, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, v4co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth); retval |= result; - if (f->v4 && result == 0) - { + if (f->v4 && result == 0) { retval |= snapFace(ar, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, verts[f->v2].co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth); } } } - if (em != NULL) - { + if (em != NULL) { EDBM_index_arrays_free(em); } #endif @@ -1490,8 +1424,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh int index = 0; int i; - if (em != NULL) - { + if (em != NULL) { index_array = dm->getVertDataArray(dm, CD_ORIGINDEX); EDBM_index_arrays_init(em, 1, 0, 0); } @@ -1516,22 +1449,19 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh else { eve = EDBM_vert_at_index(em, index); - if (eve && (BM_elem_flag_test(eve, BM_ELEM_HIDDEN) || BM_elem_flag_test(eve, BM_ELEM_SELECT))) - { + if (eve && (BM_elem_flag_test(eve, BM_ELEM_HIDDEN) || BM_elem_flag_test(eve, BM_ELEM_SELECT))) { test = 0; } } } - if (test) - { + if (test) { retval |= snapVertex(ar, v->co, v->no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth); } } - if (em != NULL) - { + if (em != NULL) { EDBM_index_arrays_free(em); } break; @@ -1545,8 +1475,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh int index = 0; int i; - if (em != NULL) - { + if (em != NULL) { index_array = dm->getEdgeDataArray(dm, CD_ORIGINDEX); EDBM_index_arrays_init(em, 0, 1, 0); } @@ -1557,8 +1486,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh test = 1; /* reset for every vert */ - if (em != NULL) - { + if (em != NULL) { if (index_array) { index = index_array[i]; } @@ -1580,16 +1508,13 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh } } } - - - if (test) - { + + if (test) { retval |= snapEdge(ar, verts[e->v1].co, verts[e->v1].no, verts[e->v2].co, verts[e->v2].no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth); } } - if (em != NULL) - { + if (em != NULL) { EDBM_index_arrays_free(em); } break; @@ -1673,8 +1598,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; retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth); @@ -1726,8 +1650,7 @@ static void removeDoublesPeel(ListBase *depth_peels) { DepthPeel *peel; - for (peel = depth_peels->first; peel; peel = peel->next) - { + for (peel = depth_peels->first; peel; peel = peel->next) { DepthPeel *next_peel = peel->next; if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f) { @@ -1881,8 +1804,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; if (dob->type == OB_MESH) { |