diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 07:44:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 07:44:03 +0300 |
commit | b99d064e9142b2e9d790731f4c4c6c107ca43696 (patch) | |
tree | 272ff820a1162765a48f6ce6c64c85bf0c0ca055 /source/blender/editors/transform/transform.c | |
parent | c84b8d480196a8c1d18a46c3e704dc9ce88f5c8b (diff) |
Cleanup: trailing space
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r-- | source/blender/editors/transform/transform.c | 584 |
1 files changed, 292 insertions, 292 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 4a8bd5287df..69e8ebf5ca4 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -638,7 +638,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) static void viewRedrawPost(bContext *C, TransInfo *t) { ED_area_headerprint(t->sa, NULL); - + if (t->spacetype == SPACE_VIEW3D) { /* if autokeying is enabled, send notifiers that keyframes were added */ if (IS_AUTOKEY_ON(t->scene)) @@ -650,12 +650,12 @@ static void viewRedrawPost(bContext *C, TransInfo *t) { WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL); } - + /* XXX temp, first hack to get auto-render in compositor work (ton) */ WM_event_add_notifier(C, NC_SCENE | ND_TRANSFORM_DONE, CTX_data_scene(C)); } - + #if 0 // TRANSFORM_FIX_ME if (t->spacetype == SPACE_VIEW3D) { allqueue(REDRAWBUTSOBJECT, 0); @@ -831,14 +831,14 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) {TFM_MODAL_INSERTOFS_TOGGLE_DIR, "INSERTOFS_TOGGLE_DIR", 0, "Toggle Direction for Node Auto-offset", ""}, {0, NULL, 0, NULL, NULL} }; - + wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Transform Modal Map"); - + /* this function is called for each spacetype, only needs to add map once */ if (keymap && keymap->modal_items) return NULL; - + keymap = WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items); - + /* items for modal map */ WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM); @@ -848,7 +848,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, GKEY, KM_PRESS, 0, 0, TFM_MODAL_TRANSLATE); WM_modalkeymap_add_item(keymap, RKEY, KM_PRESS, 0, 0, TFM_MODAL_ROTATE); WM_modalkeymap_add_item(keymap, SKEY, KM_PRESS, 0, 0, TFM_MODAL_RESIZE); - + WM_modalkeymap_add_item(keymap, TABKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_SNAP_TOGGLE); WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_SNAP_INV_ON); @@ -856,7 +856,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_SNAP_INV_ON); WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_RELEASE, KM_ANY, 0, TFM_MODAL_SNAP_INV_OFF); - + WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, 0, 0, TFM_MODAL_ADD_SNAP); WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, KM_ALT, 0, TFM_MODAL_REMOVE_SNAP); @@ -872,7 +872,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0, TFM_MODAL_EDGESLIDE_UP); WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_ALT, 0, TFM_MODAL_EDGESLIDE_DOWN); - + WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC); WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); @@ -891,7 +891,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm const bool edit_2d = (t->flag & T_2D_EDIT) != 0; const char *msg1 = "", *msg2 = "", *msg3 = ""; char axis; - + /* Initialize */ switch (key_type) { case XKEY: @@ -1062,7 +1062,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) restoreTransObjects(t); resetTransModal(t); resetTransRestrictions(t); - + if (t->mode == TFM_ROTATION) { initTrackball(t); } @@ -1107,7 +1107,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) } } break; - + case TFM_MODAL_SNAP_INV_ON: t->modifiers |= MOD_SNAP_INVERT; t->redraw |= TREDRAW_HARD; @@ -1683,7 +1683,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments static int helpline_poll(bContext *C) { ARegion *ar = CTX_wm_region(C); - + if (ar && ar->regiontype == RGN_TYPE_WINDOW) return 1; return 0; @@ -1810,7 +1810,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; - + glLineWidth(1.0); drawConstraint(t); @@ -1831,12 +1831,12 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) int xco, yco; ED_region_visible_rect(ar, &rect); - + BLF_width_and_height_default(printable, BLF_DRAW_STR_DUMMY_MAX, &printable_size[0], &printable_size[1]); - + xco = (rect.xmax - U.widget_unit) - (int)printable_size[0]; yco = (rect.ymax - U.widget_unit); - + /* warning text (to clarify meaning of overlays) * - original color was red to match the icon, but that clashes badly with a less nasty border */ @@ -1846,27 +1846,27 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) #else BLF_draw_default_ascii(xco, yco, 0.0f, printable, BLF_DRAW_STR_DUMMY_MAX); #endif - + /* autokey recording icon... */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - + xco -= U.widget_unit; yco -= (int)printable_size[1] / 2; UI_icon_draw(xco, yco, ICON_REC); - + glDisable(GL_BLEND); } static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, void *arg) -{ +{ TransInfo *t = arg; Scene *scene = t->scene; Object *ob = OBACT; - - /* draw autokeyframing hint in the corner - * - only draw if enabled (advanced users may be distracted/annoyed), + + /* draw autokeyframing hint in the corner + * - only draw if enabled (advanced users may be distracted/annoyed), * for objects that will be autokeyframed (no point ohterwise), * AND only for the active region (as showing all is too overwhelming) */ @@ -1957,7 +1957,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) ts->prop_mode = t->prop_mode; } } - + /* do we check for parameter? */ if (t->modifiers & MOD_SNAP) { ts->snap_flag |= SCE_SNAP; @@ -1976,7 +1976,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } } } - + if ((prop = RNA_struct_find_property(op->ptr, "proportional"))) { RNA_property_enum_set(op->ptr, prop, proportional); RNA_enum_set(op->ptr, "proportional_edit_falloff", t->prop_mode); @@ -2055,7 +2055,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve options |= CTX_TEXTURE; } } - + if ((prop = RNA_struct_find_property(op->ptr, "gpencil_strokes")) && RNA_property_is_set(op->ptr, prop)) { if (RNA_property_boolean_get(op->ptr, prop)) { options |= CTX_GPENCIL_STROKES; @@ -2414,7 +2414,7 @@ int transformEnd(bContext *C, TransInfo *t) else if (t->mode == TFM_VERT_SLIDE) { doVertSlide(t, 0.0f); } - + exit_code = OPERATOR_CANCELLED; restoreTransObjects(t); // calls recalcData() } @@ -2479,7 +2479,7 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl /* check that protection flags are set */ if ((protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) == 0) return; - + if (protectflag & OB_LOCK_ROT4D) { /* axis-angle getting limited as 4D entities that they are... */ if (protectflag & OB_LOCK_ROTW) @@ -2494,19 +2494,19 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl else { /* axis-angle get limited with euler... */ float eul[3], oldeul[3]; - + axis_angle_to_eulO(eul, EULER_ORDER_DEFAULT, axis, *angle); axis_angle_to_eulO(oldeul, EULER_ORDER_DEFAULT, oldAxis, oldAngle); - + if (protectflag & OB_LOCK_ROTX) eul[0] = oldeul[0]; if (protectflag & OB_LOCK_ROTY) eul[1] = oldeul[1]; if (protectflag & OB_LOCK_ROTZ) eul[2] = oldeul[2]; - + eulO_to_axis_angle(axis, angle, eul, EULER_ORDER_DEFAULT); - + /* when converting to axis-angle, we need a special exception for the case when there is no axis */ if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) { /* for now, rotate around y-axis then (so that it simply becomes the roll) */ @@ -2521,7 +2521,7 @@ static void protectedQuaternionBits(short protectflag, float quat[4], const floa /* check that protection flags are set */ if ((protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) == 0) return; - + if (protectflag & OB_LOCK_ROT4D) { /* quaternions getting limited as 4D entities that they are... */ if (protectflag & OB_LOCK_ROTW) @@ -2555,7 +2555,7 @@ static void protectedQuaternionBits(short protectflag, float quat[4], const floa /* restore original quat size */ mul_qt_fl(quat, qlen); - + /* quaternions flip w sign to accumulate rotations correctly */ if ((nquat[0] < 0.0f && quat[0] > 0.0f) || (nquat[0] > 0.0f && quat[0] < 0.0f)) @@ -2572,43 +2572,43 @@ static void constraintTransLim(TransInfo *t, TransData *td) if (td->con) { const bConstraintTypeInfo *ctiLoc = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_LOCLIMIT); const bConstraintTypeInfo *ctiDist = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_DISTLIMIT); - + bConstraintOb cob = {NULL}; bConstraint *con; float ctime = (float)(t->scene->r.cfra); - + /* Make a temporary bConstraintOb for using these limit constraints * - they only care that cob->matrix is correctly set ;-) * - current space should be local */ unit_m4(cob.matrix); copy_v3_v3(cob.matrix[3], td->loc); - + /* Evaluate valid constraints */ for (con = td->con; con; con = con->next) { const bConstraintTypeInfo *cti = NULL; ListBase targets = {NULL, NULL}; - + /* only consider constraint if enabled */ if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue; if (con->enforce == 0.0f) continue; - + /* only use it if it's tagged for this purpose (and the right type) */ if (con->type == CONSTRAINT_TYPE_LOCLIMIT) { bLocLimitConstraint *data = con->data; - + if ((data->flag2 & LIMIT_TRANSFORM) == 0) continue; cti = ctiLoc; } else if (con->type == CONSTRAINT_TYPE_DISTLIMIT) { bDistLimitConstraint *data = con->data; - + if ((data->flag & LIMITDIST_TRANSFORM) == 0) continue; cti = ctiDist; } - + if (cti) { /* do space conversions */ if (con->ownspace == CONSTRAINT_SPACE_WORLD) { @@ -2619,24 +2619,24 @@ static void constraintTransLim(TransInfo *t, TransData *td) /* skip... incompatable spacetype */ continue; } - + /* get constraint targets if needed */ BKE_constraint_targets_for_solving_get(con, &cob, &targets, ctime); - + /* do constraint */ cti->evaluate_constraint(con, &cob, &targets); - + /* convert spaces again */ if (con->ownspace == CONSTRAINT_SPACE_WORLD) { /* just multiply by td->smtx (this should be ok) */ mul_m4_m3m4(cob.matrix, td->smtx, cob.matrix); } - + /* free targets list */ BLI_freelistN(&targets); } } - + /* copy results from cob->matrix */ copy_v3_v3(td->loc, cob.matrix[3]); } @@ -2707,10 +2707,10 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) /* just multiply by td->mtx (this should be ok) */ mul_m4_m3m4(cob.matrix, td->mtx, cob.matrix); } - + /* do constraint */ cti->evaluate_constraint(con, &cob, NULL); - + /* convert spaces again */ if (con->ownspace == CONSTRAINT_SPACE_WORLD) { /* just multiply by td->smtx (this should be ok) */ @@ -2718,7 +2718,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) } } } - + if (do_limit) { /* copy results from cob->matrix */ if (td->ext->rotOrder == ROT_MODE_QUAT) { @@ -2745,7 +2745,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td) bConstraint *con; float size_sign[3], size_abs[3]; int i; - + /* Make a temporary bConstraintOb for using these limit constraints * - they only care that cob->matrix is correctly set ;-) * - current space should be local @@ -2764,24 +2764,24 @@ static void constraintSizeLim(TransInfo *t, TransData *td) size_sign[i] = signf(td->ext->size[i]); size_abs[i] = fabsf(td->ext->size[i]); } - + size_to_mat4(cob.matrix, size_abs); } - + /* Evaluate valid constraints */ for (con = td->con; con; con = con->next) { /* only consider constraint if enabled */ if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue; if (con->enforce == 0.0f) continue; - + /* we're only interested in Limit-Scale constraints */ if (con->type == CONSTRAINT_TYPE_SIZELIMIT) { bSizeLimitConstraint *data = con->data; - + /* only use it if it's tagged for this purpose */ if ((data->flag2 & LIMIT_TRANSFORM) == 0) continue; - + /* do space conversions */ if (con->ownspace == CONSTRAINT_SPACE_WORLD) { /* just multiply by td->mtx (this should be ok) */ @@ -2791,10 +2791,10 @@ static void constraintSizeLim(TransInfo *t, TransData *td) /* skip... incompatible spacetype */ continue; } - + /* do constraint */ cti->evaluate_constraint(con, &cob, NULL); - + /* convert spaces again */ if (con->ownspace == CONSTRAINT_SPACE_WORLD) { /* just multiply by td->smtx (this should be ok) */ @@ -2844,14 +2844,14 @@ static void initBend(TransInfo *t) const float *curs; float tvec[3]; struct BendCustomData *data; - + t->mode = TFM_BEND; t->transform = Bend; t->handleEvent = handleEventBend; - + setInputPostFct(&t->mouse, postInputRotation); initMouseInputMode(t, &t->mouse, INPUT_ANGLE_SPRING); - + t->idx_max = 1; t->num.idx_max = 1; t->snap[0] = 0.0f; @@ -2901,11 +2901,11 @@ static void initBend(TransInfo *t) static eRedrawFlag handleEventBend(TransInfo *UNUSED(t), const wmEvent *event) { eRedrawFlag status = TREDRAW_NOTHING; - + if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) { status = TREDRAW_HARD; } - + return status; } @@ -2953,7 +2953,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2])) char c[NUM_STR_REP_LEN * 2]; outputNumInput(&(t->num), c, &t->scene->unit); - + BLI_snprintf(str, sizeof(str), IFACE_("Bend Angle: %s Radius: %s Alt, Clamp %s"), &c[0], &c[NUM_STR_REP_LEN], WM_bool_as_string(is_clamp)); @@ -2964,10 +2964,10 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2])) RAD2DEGF(values.angle), values.scale * data->warp_init_dist, WM_bool_as_string(is_clamp)); } - + values.angle *= -1.0f; values.scale *= data->warp_init_dist; - + /* calc 'data->warp_end' from 'data->warp_end_init' */ copy_v3_v3(warp_end_radius, data->warp_end); dist_ensure_v3_v3fl(warp_end_radius, data->warp_sta, values.scale); @@ -2989,7 +2989,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2])) if (td->flag & TD_NOACTION) break; - + if (td->flag & TD_SKIP) continue; @@ -3028,9 +3028,9 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2])) /* location */ copy_v3_v3(td->loc, vec); } - + recalcData(t); - + ED_area_headerprint(t->sa, str); } /** \} */ @@ -3049,7 +3049,7 @@ static void initShear(TransInfo *t) t->handleEvent = handleEventShear; initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_RATIO); - + t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; @@ -3066,7 +3066,7 @@ static void initShear(TransInfo *t) static eRedrawFlag handleEventShear(TransInfo *t, const wmEvent *event) { eRedrawFlag status = TREDRAW_NOTHING; - + if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) { /* Use custom.mode.data pointer to signal Shear direction */ if (t->custom.mode.data == NULL) { @@ -3083,16 +3083,16 @@ static eRedrawFlag handleEventShear(TransInfo *t, const wmEvent *event) else if (event->type == XKEY && event->val == KM_PRESS) { initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_RATIO); t->custom.mode.data = NULL; - + status = TREDRAW_HARD; } else if (event->type == YKEY && event->val == KM_PRESS) { initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_RATIO); t->custom.mode.data = (void *)1; - + status = TREDRAW_HARD; } - + return status; } @@ -3106,39 +3106,39 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2])) int i; char str[UI_MAX_DRAW_STR]; const bool is_local_center = transdata_check_local_center(t, t->around); - + copy_m3_m4(persmat, t->viewmat); invert_m3_m3(persinv, persmat); - + value = t->values[0]; - + snapGridIncrement(t, &value); - + applyNumInput(&t->num, &value); - + t->values[0] = value; /* header print for NumInput */ if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - + outputNumInput(&(t->num), c, &t->scene->unit); - + BLI_snprintf(str, sizeof(str), IFACE_("Shear: %s %s"), c, t->proptext); } else { /* default header print */ BLI_snprintf(str, sizeof(str), IFACE_("Shear: %.3f %s (Press X or Y to set shear axis)"), value, t->proptext); } - + unit_m3(smat); - + // Custom data signals shear direction if (t->custom.mode.data == NULL) smat[1][0] = value; else smat[0][1] = value; - + mul_m3_m3m3(tmat, smat, persmat); mul_m3_m3m3(totmat, persinv, tmat); @@ -3147,10 +3147,10 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2])) if (td->flag & TD_NOACTION) break; - + if (td->flag & TD_SKIP) continue; - + if (t->obedit) { float mat3[3][3]; mul_m3_m3m3(mat3, totmat, td->mtx); @@ -3170,19 +3170,19 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2])) } sub_v3_v3v3(vec, co, center); - + mul_m3_v3(tmat, vec); - + add_v3_v3(vec, center); sub_v3_v3(vec, co); - + mul_v3_fl(vec, td->factor); - + add_v3_v3v3(td->loc, td->iloc, vec); } - + recalcData(t); - + ED_area_headerprint(t->sa, str); } /** \} */ @@ -3198,9 +3198,9 @@ static void initResize(TransInfo *t) { t->mode = TFM_RESIZE; t->transform = applyResize; - + initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP); - + t->flag |= T_NULL_ONE; t->num.val_flag[0] |= NUM_NULL_ONE; t->num.val_flag[1] |= NUM_NULL_ONE; @@ -3214,7 +3214,7 @@ static void initResize(TransInfo *t) t->num.val_flag[2] |= NUM_NO_ZERO; #endif } - + t->idx_max = 2; t->num.idx_max = 2; t->snap[0] = 0.0f; @@ -3294,7 +3294,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { float tmat[3][3], smat[3][3], center[3]; float vec[3]; - + if (t->flag & T_EDIT) { mul_m3_m3m3(smat, mat, td->mtx); mul_m3_m3m3(tmat, td->smtx, smat); @@ -3302,11 +3302,11 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) else { copy_m3_m3(tmat, mat); } - + if (t->con.applySize) { t->con.applySize(t, td, tmat); } - + /* local constraint shouldn't alter center */ if (transdata_check_local_center(t, t->around)) { copy_v3_v3(center, td->center); @@ -3325,7 +3325,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) if (td->ext) { float fsize[3]; - + if (t->flag & (T_OBJECT | T_TEXTURE | T_POSE)) { float obsizemat[3][3]; /* Reorient the size mat to fit the oriented object. */ @@ -3337,14 +3337,14 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) else { mat3_to_size(fsize, tmat); } - + 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)) { /* scale val and reset size */ *td->val = td->ival * (1 + (fsize[0] - 1) * td->factor); - + td->ext->size[0] = td->ext->isize[0]; td->ext->size[1] = td->ext->isize[1]; td->ext->size[2] = td->ext->isize[2]; @@ -3353,13 +3353,13 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) /* Reset val if SINGLESIZE but using a constraint */ if (td->flag & TD_SINGLESIZE) *td->val = td->ival; - + td->ext->size[0] = td->ext->isize[0] * (1 + (fsize[0] - 1) * td->factor); td->ext->size[1] = td->ext->isize[1] * (1 + (fsize[1] - 1) * td->factor); td->ext->size[2] = td->ext->isize[2] * (1 + (fsize[2] - 1) * td->factor); } } - + constraintSizeLim(t, td); } @@ -3368,26 +3368,26 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) sub_v3_v3v3(vec, td->iloc, center); else sub_v3_v3v3(vec, td->center, center); - + mul_m3_v3(tmat, vec); - + add_v3_v3(vec, center); if (t->flag & T_POINTS) sub_v3_v3(vec, td->iloc); else sub_v3_v3(vec, td->center); - + mul_v3_fl(vec, td->factor); - + if (t->flag & (T_OBJECT | T_POSE)) { mul_m3_v3(td->smtx, vec); } - + protectedTransBits(td->protectflag, vec); if (td->loc) { add_v3_v3v3(td->loc, td->iloc, vec); } - + constraintTransLim(t, td); } @@ -3422,34 +3422,34 @@ static void applyResize(TransInfo *t, const int mval[2]) applySnapping(t, t->values); } - + size_to_mat3(mat, t->values); - + if (t->con.applySize) { t->con.applySize(t, NULL, mat); } - + copy_m3_m3(t->mat, mat); // used in manipulator - + headerResize(t, t->values, str); - + for (i = 0, td = t->data; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; - + if (td->flag & TD_SKIP) continue; - + ElementResize(t, td, mat); } - + /* evil hack - redo resize if cliping needed */ if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 1)) { size_to_mat3(mat, t->values); - + if (t->con.applySize) t->con.applySize(t, NULL, mat); - + for (i = 0, td = t->data; i < t->total; i++, td++) ElementResize(t, td, mat); @@ -3461,9 +3461,9 @@ static void applyResize(TransInfo *t, const int mval[2]) clipUVData(t); } } - + recalcData(t); - + ED_area_headerprint(t->sa, str); } /** \} */ @@ -3479,9 +3479,9 @@ static void initSkinResize(TransInfo *t) { t->mode = TFM_SKIN_RESIZE; t->transform = applySkinResize; - + initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP); - + t->flag |= T_NULL_ONE; t->num.val_flag[0] |= NUM_NULL_ONE; t->num.val_flag[1] |= NUM_NULL_ONE; @@ -3495,7 +3495,7 @@ static void initSkinResize(TransInfo *t) t->num.val_flag[2] |= NUM_NO_ZERO; #endif } - + t->idx_max = 2; t->num.idx_max = 2; t->snap[0] = 0.0f; @@ -3515,34 +3515,34 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2])) float size[3], mat[3][3]; int i; char str[UI_MAX_DRAW_STR]; - + copy_v3_fl(size, t->values[0]); - + snapGridIncrement(t, size); - + if (applyNumInput(&t->num, size)) { constraintNumInput(t, size); } - + applySnapping(t, size); - + if (t->flag & T_AUTOVALUES) { copy_v3_v3(size, t->auto_values); } - + copy_v3_v3(t->values, size); - + size_to_mat3(mat, size); - + headerResize(t, size, str); - + for (i = 0, td = t->data; i < t->total; i++, td++) { float tmat[3][3], smat[3][3]; float fsize[3]; - + if (td->flag & TD_NOACTION) break; - + if (td->flag & TD_SKIP) continue; @@ -3553,7 +3553,7 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2])) else { copy_m3_m3(tmat, mat); } - + if (t->con.applySize) { t->con.applySize(t, NULL, tmat); } @@ -3562,9 +3562,9 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2])) td->val[0] = td->ext->isize[0] * (1 + (fsize[0] - 1) * td->factor); td->val[1] = td->ext->isize[1] * (1 + (fsize[1] - 1) * td->factor); } - + recalcData(t); - + ED_area_headerprint(t->sa, str); } /** \} */ @@ -3580,30 +3580,30 @@ static void initToSphere(TransInfo *t) { TransData *td = t->data; int i; - + t->mode = TFM_TOSPHERE; t->transform = applyToSphere; - + initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_RATIO); - + t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; t->snap[1] = 0.1f; t->snap[2] = t->snap[1] * 0.1f; - + copy_v3_fl(t->num.val_inc, t->snap[1]); t->num.unit_sys = t->scene->unit.system; t->num.unit_type[0] = B_UNIT_NONE; t->num.val_flag[0] |= NUM_NULL_ONE | NUM_NO_NEGATIVE; t->flag |= T_NO_CONSTRAINT; - + // Calculate average radius for (i = 0; i < t->total; i++, td++) { t->val += len_v3v3(t->center, td->iloc); } - + t->val /= (float)t->total; } @@ -3614,53 +3614,53 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2])) int i; char str[UI_MAX_DRAW_STR]; TransData *td = t->data; - + ratio = t->values[0]; - + snapGridIncrement(t, &ratio); - + applyNumInput(&t->num, &ratio); - + CLAMP(ratio, 0.0f, 1.0f); - + t->values[0] = ratio; /* header print for NumInput */ if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - + outputNumInput(&(t->num), c, &t->scene->unit); - + BLI_snprintf(str, sizeof(str), IFACE_("To Sphere: %s %s"), c, t->proptext); } else { /* default header print */ BLI_snprintf(str, sizeof(str), IFACE_("To Sphere: %.4f %s"), ratio, t->proptext); } - - + + for (i = 0; i < t->total; i++, td++) { float tratio; if (td->flag & TD_NOACTION) break; - + if (td->flag & TD_SKIP) continue; - + sub_v3_v3v3(vec, td->iloc, t->center); - + radius = normalize_v3(vec); - + tratio = ratio * td->factor; - + mul_v3_fl(vec, radius * (1.0f - tratio) + t->val * tratio); - + add_v3_v3v3(td->loc, t->center, vec); } - - + + recalcData(t); - + ED_area_headerprint(t->sa, str); } /** \} */ @@ -3683,16 +3683,16 @@ static void initRotation(TransInfo *t) { t->mode = TFM_ROTATION; t->transform = applyRotation; - + setInputPostFct(&t->mouse, postInputRotation); initMouseInputMode(t, &t->mouse, INPUT_ANGLE); - + t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; t->snap[1] = DEG2RAD(5.0); t->snap[2] = DEG2RAD(1.0); - + copy_v3_fl(t->num.val_inc, t->snap[2]); t->num.unit_sys = t->scene->unit.system; t->num.unit_use_radians = (t->scene->unit.system_rotation == USER_UNIT_ROT_RADIANS); @@ -3728,24 +3728,24 @@ static void ElementRotation_ex(TransInfo *t, TransData *td, float mat[3][3], con if (t->flag & T_POINTS) { mul_m3_m3m3(totmat, mat, td->mtx); mul_m3_m3m3(smat, td->smtx, totmat); - + sub_v3_v3v3(vec, td->iloc, center); mul_m3_v3(smat, vec); - + add_v3_v3v3(td->loc, vec, center); - + sub_v3_v3v3(vec, td->loc, td->iloc); protectedTransBits(td->protectflag, vec); add_v3_v3v3(td->loc, td->iloc, vec); - - + + if (td->flag & TD_USEQUAT) { mul_m3_series(fmat, td->smtx, mat, td->mtx); mat3_to_quat(quat, fmat); // Actual transform - + if (td->ext->quat) { mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat); - + /* is there a reason not to have this here? -jahka */ protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat); } @@ -3765,23 +3765,23 @@ static void ElementRotation_ex(TransInfo *t, TransData *td, float mat[3][3], con */ else if (t->flag & T_POSE) { float pmtx[3][3], imtx[3][3]; - + // Extract and invert armature object matrix copy_m3_m4(pmtx, t->poseobj->obmat); invert_m3_m3(imtx, pmtx); - + if ((td->flag & TD_NO_LOC) == 0) { sub_v3_v3v3(vec, td->center, center); - + mul_m3_v3(pmtx, vec); // To Global space mul_m3_v3(mat, vec); // Applying rotation mul_m3_v3(imtx, vec); // To Local space - + add_v3_v3(vec, center); /* vec now is the location where the object has to be */ - + 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) { /* do nothing */ @@ -3796,12 +3796,12 @@ static void ElementRotation_ex(TransInfo *t, TransData *td, float mat[3][3], con } protectedTransBits(td->protectflag, vec); - + add_v3_v3v3(td->loc, td->iloc, vec); - + constraintTransLim(t, td); } - + /* rotation */ /* MORE HACK: as in some cases the matrix to apply location and rot/scale is not the same, * and ElementRotation() might be called in Translation context (with align snapping), @@ -3811,50 +3811,50 @@ static void ElementRotation_ex(TransInfo *t, TransData *td, float mat[3][3], con /* euler or quaternion/axis-angle? */ if (td->ext->rotOrder == ROT_MODE_QUAT) { mul_m3_series(fmat, td->ext->r_smtx, mat, td->ext->r_mtx); - + mat3_to_quat(quat, fmat); /* Actual transform */ - + mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat); /* this function works on end result */ protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat); - + } else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) { /* calculate effect based on quats */ float iquat[4], tquat[4]; - + axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle); - + mul_m3_series(fmat, td->ext->r_smtx, mat, td->ext->r_mtx); mat3_to_quat(quat, fmat); /* Actual transform */ mul_qt_qtqt(tquat, quat, iquat); - + quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat); - + /* this function works on end result */ protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle); } else { float eulmat[3][3]; - + mul_m3_m3m3(totmat, mat, td->ext->r_mtx); mul_m3_m3m3(smat, td->ext->r_smtx, totmat); - + /* calculate the total rotatation in eulers */ copy_v3_v3(eul, td->ext->irot); eulO_to_mat3(eulmat, eul, td->ext->rotOrder); - + /* mat = transform, obmat = bone rotation */ mul_m3_m3m3(fmat, smat, eulmat); - + mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat); - + /* and apply (to end result only) */ protectedRotateBits(td->protectflag, eul, td->ext->irot); copy_v3_v3(td->ext->rot, eul); } - + constraintRotLim(t, td); } } @@ -3867,15 +3867,15 @@ static void ElementRotation_ex(TransInfo *t, TransData *td, float mat[3][3], con /* vec now is the location where the object has to be */ sub_v3_v3(vec, td->center); mul_m3_v3(td->smtx, vec); - + protectedTransBits(td->protectflag, vec); - + add_v3_v3v3(td->loc, td->iloc, vec); } - - + + constraintTransLim(t, td); - + /* rotation */ if ((t->flag & T_V3D_ALIGN) == 0) { // align mode doesn't rotate objects itself /* euler or quaternion? */ @@ -3884,7 +3884,7 @@ static void ElementRotation_ex(TransInfo *t, TransData *td, float mat[3][3], con if (td->ext->quat) { mul_m3_series(fmat, td->smtx, mat, td->mtx); mat3_to_quat(quat, fmat); // Actual transform - + mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat); /* this function works on end result */ protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat); @@ -3893,41 +3893,41 @@ static void ElementRotation_ex(TransInfo *t, TransData *td, float mat[3][3], con else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) { /* calculate effect based on quats */ float iquat[4], tquat[4]; - + axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle); - + mul_m3_series(fmat, td->smtx, mat, td->mtx); mat3_to_quat(quat, fmat); // Actual transform mul_qt_qtqt(tquat, quat, iquat); - + quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat); - + /* this function works on end result */ protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle); } else { float obmat[3][3]; - + mul_m3_m3m3(totmat, mat, td->mtx); mul_m3_m3m3(smat, td->smtx, totmat); - + /* calculate the total rotatation in eulers */ add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */ eulO_to_mat3(obmat, eul, td->ext->rotOrder); /* mat = transform, obmat = object rotation */ mul_m3_m3m3(fmat, smat, obmat); - + mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat); - + /* correct back for delta rot */ sub_v3_v3v3(eul, eul, td->ext->drot); - + /* and apply */ protectedRotateBits(td->protectflag, eul, td->ext->irot); copy_v3_v3(td->ext->rot, eul); } - + constraintRotLim(t, td); } } @@ -3953,17 +3953,17 @@ static void applyRotationValue(TransInfo *t, float angle, float axis[3]) TransData *td = t->data; float mat[3][3]; int i; - + axis_angle_normalized_to_mat3(mat, axis, angle); - + for (i = 0; i < t->total; i++, td++) { - + if (td->flag & TD_NOACTION) break; - + if (td->flag & TD_SKIP) continue; - + if (t->con.applyRot) { t->con.applyRot(t, td, axis, NULL); axis_angle_normalized_to_mat3(mat, axis, angle * td->factor); @@ -3971,7 +3971,7 @@ static void applyRotationValue(TransInfo *t, float angle, float axis[3]) else if (t->flag & T_PROP_EDIT) { axis_angle_normalized_to_mat3(mat, axis, angle * td->factor); } - + ElementRotation(t, td, mat, t->around); } } @@ -4004,24 +4004,24 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2])) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - + outputNumInput(&(t->num), c, &t->scene->unit); - + ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("Rot: %s %s %s"), &c[0], t->con.text, t->proptext); } else { ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("Rot: %.2f%s %s"), RAD2DEGF(final), t->con.text, t->proptext); } - + if (t->flag & T_PROP_EDIT_ALL) { ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size); } applyRotationValue(t, final, t->axis); - + recalcData(t); - + ED_area_headerprint(t->sa, str); } /** \} */ @@ -4189,7 +4189,7 @@ static void initTranslation(TransInfo *t) { if (t->spacetype == SPACE_ACTION) { /* this space uses time translate */ - BKE_report(t->reports, RPT_ERROR, + BKE_report(t->reports, RPT_ERROR, "Use 'Time_Translate' transform mode instead of 'Translation' mode " "for translating keyframes in Dope Sheet Editor"); t->state = TRANS_CANCEL; @@ -4354,7 +4354,7 @@ static void applyTranslationValue(TransInfo *t, const float vec[3]) for (int i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; - + if (td->flag & TD_SKIP) continue; @@ -4399,12 +4399,12 @@ static void applyTranslationValue(TransInfo *t, const float vec[3]) if (use_rotate_offset) { add_v3_v3(tvec, rotate_offset); } - + mul_m3_v3(td->smtx, tvec); mul_v3_fl(tvec, td->factor); - + protectedTransBits(td->protectflag, tvec); - + if (td->loc) add_v3_v3v3(td->loc, td->iloc, tvec); @@ -5244,7 +5244,7 @@ static void applyBoneSize(TransInfo *t, const int mval[2]) float ratio; int i; char str[UI_MAX_DRAW_STR]; - + // TRANSFORM_FIX_ME MOVE TO MOUSE INPUT /* for manipulator, center handle, the scaling can't be done relative to center */ if ((t->flag & T_USES_MANIPULATOR) && t->con.mode == 0) { @@ -5253,39 +5253,39 @@ static void applyBoneSize(TransInfo *t, const int mval[2]) else { ratio = t->values[0]; } - + copy_v3_fl(size, ratio); - + snapGridIncrement(t, size); - + if (applyNumInput(&t->num, size)) { constraintNumInput(t, size); } - + copy_v3_v3(t->values, size); size_to_mat3(mat, size); - + if (t->con.applySize) { t->con.applySize(t, NULL, mat); } - + copy_m3_m3(t->mat, mat); // used in manipulator - + headerBoneSize(t, size, str); - + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; - + if (td->flag & TD_SKIP) continue; - + ElementBoneSize(t, td, mat); } - + recalcData(t); - + ED_area_headerprint(t->sa, str); } /** \} */ @@ -5301,15 +5301,15 @@ static void initBoneEnvelope(TransInfo *t) { t->mode = TFM_BONE_ENVELOPE; t->transform = applyBoneEnvelope; - + initMouseInputMode(t, &t->mouse, INPUT_SPRING); - + t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; t->snap[1] = 0.1f; t->snap[2] = t->snap[1] * 0.1f; - + copy_v3_fl(t->num.val_inc, t->snap[1]); t->num.unit_sys = t->scene->unit.system; t->num.unit_type[0] = B_UNIT_NONE; @@ -5323,33 +5323,33 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) float ratio; int i; char str[UI_MAX_DRAW_STR]; - + ratio = t->values[0]; - + snapGridIncrement(t, &ratio); - + applyNumInput(&t->num, &ratio); - + t->values[0] = ratio; /* header print for NumInput */ if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - + outputNumInput(&(t->num), c, &t->scene->unit); BLI_snprintf(str, sizeof(str), IFACE_("Envelope: %s"), c); } else { BLI_snprintf(str, sizeof(str), IFACE_("Envelope: %3f"), ratio); } - + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; - + if (td->flag & TD_SKIP) continue; - + if (td->val) { /* if the old/original value was 0.0f, then just use ratio */ if (td->ival) @@ -5358,9 +5358,9 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) *td->val = ratio; } } - + recalcData(t); - + ED_area_headerprint(t->sa, str); } /** \} */ @@ -5840,7 +5840,7 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l, l_first = l; do { l = BM_loop_other_edge_loop(l, v); - + if (l->e == e_next) { if (i) { normalize_v3_length(vec_accum, vec_accum_len / (float)i); @@ -5912,9 +5912,9 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l, if (i) { normalize_v3_length(vec_accum, vec_accum_len / (float)i); } - + copy_v3_v3(r_slide_vec, vec_accum); - + return NULL; } @@ -6247,7 +6247,7 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, bool use_even, bool f if (!v->e) continue; - + v_first = v; /*walk along the edge loop*/ @@ -6481,11 +6481,11 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, bool use_even, bool f } sld->em = em; - + sld->perc = 0.0f; - + t->custom.mode.data = sld; - + MEM_freeN(sv_table); return true; @@ -6714,17 +6714,17 @@ void freeEdgeSlideTempFaces(EdgeSlideData *sld) void freeEdgeSlideVerts(TransInfo *UNUSED(t), TransCustomData *custom_data) { EdgeSlideData *sld = custom_data->data; - + if (!sld) return; freeEdgeSlideTempFaces(sld); bmesh_edit_end(sld->em->bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); - + MEM_freeN(sld->sv); MEM_freeN(sld); - + custom_data->data = NULL; } @@ -6748,7 +6748,7 @@ static void initEdgeSlide_ex(TransInfo *t, bool use_double_side, bool use_even, t->state = TRANS_CANCEL; return; } - + sld = t->custom.mode.data; if (!sld) @@ -6759,7 +6759,7 @@ static void initEdgeSlide_ex(TransInfo *t, bool use_double_side, bool use_even, /* set custom point first if you want value to be initialized by init */ calcEdgeSlideCustomPoints(t); initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO_FLIP); - + t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; @@ -8049,30 +8049,30 @@ static void applySeqSlide(TransInfo *t, const int mval[2]) static short getAnimEdit_SnapMode(TransInfo *t) { short autosnap = SACTSNAP_OFF; - + if (t->spacetype == SPACE_ACTION) { SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; - + if (saction) autosnap = saction->autosnap; } else if (t->spacetype == SPACE_IPO) { SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; - + if (sipo) autosnap = sipo->autosnap; } else if (t->spacetype == SPACE_NLA) { SpaceNla *snla = (SpaceNla *)t->sa->spacedata.first; - + if (snla) autosnap = snla->autosnap; } else { autosnap = SACTSNAP_OFF; } - - /* toggle autosnap on/off + + /* toggle autosnap on/off * - when toggling on, prefer nearest frame over 1.0 frame increments */ if (t->modifiers & MOD_SNAP_INVERT) { @@ -8095,13 +8095,13 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, const Scene *scene = t->scene; const double secf = FPS; double val; - + /* convert frame to nla-action time (if needed) */ if (adt) val = BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP); else val = *(td->val); - + /* do the snapping to nearest frame/second */ if (autosnap == SACTSNAP_FRAME) { val = floorf(val + 0.5); @@ -8109,7 +8109,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, else if (autosnap == SACTSNAP_SECOND) { val = (float)(floor((val / secf) + 0.5) * secf); } - + /* convert frame out of nla-action time */ if (adt) *(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); @@ -8119,26 +8119,26 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, /* snap key to nearest marker? */ else if (autosnap == SACTSNAP_MARKER) { float val; - + /* convert frame to nla-action time (if needed) */ if (adt) val = BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP); else val = *(td->val); - + /* snap to nearest marker */ // TODO: need some more careful checks for where data comes from val = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, val); - + /* convert frame out of nla-action time */ if (adt) *(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); else *(td->val) = val; } - - /* if the handles are to be moved too (as side-effect of keyframes moving, to keep the general effect) - * offset them by the same amount so that the general angles are maintained (i.e. won't change while + + /* if the handles are to be moved too (as side-effect of keyframes moving, to keep the general effect) + * offset them by the same amount so that the general angles are maintained (i.e. won't change while * handles are free-to-roam and keyframes are snap-locked) */ if ((td->flag & TD_MOVEHANDLE1) && td2d->h1) { @@ -8198,7 +8198,7 @@ static void headerTimeTranslate(TransInfo *t, char str[UI_MAX_DRAW_STR]) const short autosnap = getAnimEdit_SnapMode(t); const double secf = FPS; float val = t->values[0]; - + /* apply snapping + frame->seconds conversions */ if (autosnap == SACTSNAP_STEP) { /* frame step */ @@ -8212,7 +8212,7 @@ static void headerTimeTranslate(TransInfo *t, char str[UI_MAX_DRAW_STR]) /* nearest second */ val = (float)((double)val / secf); } - + if (autosnap == SACTSNAP_FRAME) BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%d.00 (%.4f)", (int)val, val); else if (autosnap == SACTSNAP_SECOND) @@ -8236,7 +8236,7 @@ static void applyTimeTranslateValue(TransInfo *t) TransData2D *td2d = t->data2d; Scene *scene = t->scene; int i; - + const short autosnap = getAnimEdit_SnapMode(t); const double secf = FPS; @@ -8353,11 +8353,11 @@ static void initTimeSlide(TransInfo *t) for (i = 0; i < t->total; i++, td++) { AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; float val = *(td->val); - + /* strip/action time to global (mapped) time */ if (adt) val = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_MAP); - + if (min > val) min = val; if (max < val) max = val; } @@ -8434,13 +8434,13 @@ static void applyTimeSlideValue(TransInfo *t, float sval) */ AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; float cval = t->values[0]; - + /* only apply to data if in range */ if ((sval > minx) && (sval < maxx)) { float cvalc = CLAMPIS(cval, minx, maxx); float ival = td->ival; float timefac; - + /* NLA mapping magic here works as follows: * - "ival" goes from strip time to global time * - calculation is performed into td->val in global time @@ -8451,7 +8451,7 @@ static void applyTimeSlideValue(TransInfo *t, float sval) /* strip to global */ ival = BKE_nla_tweakedit_remap(adt, ival, NLATIME_CONVERT_MAP); } - + /* left half? */ if (ival < sval) { timefac = (sval - ival) / (sval - minx); @@ -8461,7 +8461,7 @@ static void applyTimeSlideValue(TransInfo *t, float sval) timefac = (ival - sval) / (maxx - sval); *(td->val) = cvalc + timefac * (maxx - cvalc); } - + if (adt) { /* global to strip */ *(td->val) = BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_UNMAP); @@ -8606,7 +8606,7 @@ static void applyTimeScaleValue(TransInfo *t) static void applyTimeScale(TransInfo *t, const int UNUSED(mval[2])) { char str[UI_MAX_DRAW_STR]; - + /* handle numeric-input stuff */ t->vec[0] = t->values[0]; applyNumInput(&t->num, &t->vec[0]); |