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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-05-13 07:56:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-13 07:56:51 +0300
commit59c6487e9314dd43003af1a018fc092b041e7e10 (patch)
treede8cc7dd06b875d174cb79cad7558874c8bffa5e /source/blender/editors/transform
parent7a56d31af3523081e33a67d7aea11314c37c7104 (diff)
parentb99d064e9142b2e9d790731f4c4c6c107ca43696 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c452
-rw-r--r--source/blender/editors/transform/transform.h10
-rw-r--r--source/blender/editors/transform/transform_constraints.c10
-rw-r--r--source/blender/editors/transform/transform_conversions.c550
-rw-r--r--source/blender/editors/transform/transform_generics.c196
-rw-r--r--source/blender/editors/transform/transform_input.c6
-rw-r--r--source/blender/editors/transform/transform_ops.c46
-rw-r--r--source/blender/editors/transform/transform_orientations.c52
-rw-r--r--source/blender/editors/transform/transform_snap.c150
9 files changed, 736 insertions, 736 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 632779d50a4..405c6213017 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -652,7 +652,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))
@@ -664,12 +664,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);
@@ -845,14 +845,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);
@@ -862,7 +862,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);
@@ -870,7 +870,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);
@@ -886,7 +886,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);
@@ -905,7 +905,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:
@@ -1078,7 +1078,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
restoreTransObjects(t);
resetTransModal(t);
resetTransRestrictions(t);
-
+
if (t->mode == TFM_ROTATION) {
initTrackball(t);
}
@@ -1123,7 +1123,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
}
}
break;
-
+
case TFM_MODAL_SNAP_INV_ON:
t->modifiers |= MOD_SNAP_INVERT;
t->redraw |= TREDRAW_HARD;
@@ -1705,7 +1705,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;
@@ -1867,7 +1867,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.0f);
drawConstraint(t);
@@ -1891,10 +1891,10 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
const int font_id = BLF_default();
BLF_width_and_height(font_id, 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
*/
@@ -1906,28 +1906,28 @@ 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... */
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, 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;
ViewLayer *view_layer = t->view_layer;
Object *ob = OBACT(view_layer);
-
- /* 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)
*/
@@ -2018,7 +2018,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;
@@ -2038,7 +2038,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);
@@ -2121,7 +2121,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;
@@ -2490,7 +2490,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()
}
@@ -2555,7 +2555,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)
@@ -2570,19 +2570,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) */
@@ -2597,7 +2597,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)
@@ -2631,7 +2631,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))
@@ -2648,43 +2648,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) {
@@ -2695,24 +2695,24 @@ static void constraintTransLim(TransInfo *t, TransData *td)
/* skip... incompatable spacetype */
continue;
}
-
+
/* get constraint targets if needed */
BKE_constraint_targets_for_solving_get(t->depsgraph, 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]);
}
@@ -2783,10 +2783,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) */
@@ -2794,7 +2794,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
}
}
}
-
+
if (do_limit) {
/* copy results from cob->matrix */
if (td->ext->rotOrder == ROT_MODE_QUAT) {
@@ -2821,7 +2821,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
@@ -2840,24 +2840,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) */
@@ -2867,10 +2867,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) */
@@ -2921,14 +2921,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;
@@ -2974,11 +2974,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;
}
@@ -3025,7 +3025,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));
@@ -3036,10 +3036,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_global, data->warp_end);
dist_ensure_v3_v3fl(warp_end_radius_global, data->warp_sta, values.scale);
@@ -3125,7 +3125,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
}
recalcData(t);
-
+
ED_area_headerprint(t->sa, str);
}
/** \} */
@@ -3144,7 +3144,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;
@@ -3161,7 +3161,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) {
@@ -3178,16 +3178,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;
}
@@ -3200,39 +3200,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);
@@ -3279,7 +3279,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
}
recalcData(t);
-
+
ED_area_headerprint(t->sa, str);
}
/** \} */
@@ -3295,9 +3295,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;
@@ -3311,7 +3311,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;
@@ -3391,7 +3391,7 @@ static void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, f
{
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);
@@ -3399,11 +3399,11 @@ static void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, f
else {
copy_m3_m3(tmat, mat);
}
-
+
if (t->con.applySize) {
t->con.applySize(t, tc, td, tmat);
}
-
+
/* local constraint shouldn't alter center */
if (transdata_check_local_center(t, t->around)) {
copy_v3_v3(center, td->center);
@@ -3422,7 +3422,7 @@ static void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, f
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. */
@@ -3434,14 +3434,14 @@ static void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, f
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];
@@ -3450,13 +3450,13 @@ static void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, f
/* 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);
}
@@ -3465,26 +3465,26 @@ static void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, f
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);
}
@@ -3510,15 +3510,15 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
applySnapping(t, t->values);
}
-
+
size_to_mat3(mat, t->values);
-
+
if (t->con.applySize) {
t->con.applySize(t, NULL, NULL, mat);
}
-
+
copy_m3_m3(t->mat, mat); // used in manipulator
-
+
headerResize(t, t->values, str);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
@@ -3556,9 +3556,9 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
}
}
}
-
+
recalcData(t);
-
+
ED_area_headerprint(t->sa, str);
}
/** \} */
@@ -3574,9 +3574,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;
@@ -3590,7 +3590,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;
@@ -3609,25 +3609,25 @@ 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);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
@@ -3661,7 +3661,7 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
}
recalcData(t);
-
+
ED_area_headerprint(t->sa, str);
}
/** \} */
@@ -3676,18 +3676,18 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
static void initToSphere(TransInfo *t)
{
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;
@@ -3714,21 +3714,21 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
char str[UI_MAX_DRAW_STR];
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 {
@@ -3759,7 +3759,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
}
recalcData(t);
-
+
ED_area_headerprint(t->sa, str);
}
/** \} */
@@ -3782,16 +3782,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);
@@ -3827,24 +3827,24 @@ static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *
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);
}
@@ -3867,16 +3867,16 @@ static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *
if ((td->flag & TD_NO_LOC) == 0) {
sub_v3_v3v3(vec, td->center, center);
-
+
mul_m3_v3(tc->mat3, vec); // To Global space
mul_m3_v3(mat, vec); // Applying rotation
mul_m3_v3(tc->imat3, 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 */
@@ -3891,12 +3891,12 @@ static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *
}
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),
@@ -3906,50 +3906,50 @@ static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *
/* 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);
}
}
@@ -3962,15 +3962,15 @@ static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *
/* 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? */
@@ -3979,7 +3979,7 @@ static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *
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);
@@ -3988,41 +3988,41 @@ static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *
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);
}
}
@@ -4047,7 +4047,7 @@ static void applyRotationValue(TransInfo *t, float angle, float axis[3])
{
float mat[3][3];
int i;
-
+
axis_angle_normalized_to_mat3(mat, axis, angle);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
@@ -4101,24 +4101,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);
}
/** \} */
@@ -4288,7 +4288,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;
@@ -5365,23 +5365,23 @@ static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2]))
char str[UI_MAX_DRAW_STR];
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, NULL, mat);
}
-
+
copy_m3_m3(t->mat, mat); // used in manipulator
-
+
headerBoneSize(t, size, str);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
@@ -5398,7 +5398,7 @@ static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2]))
}
recalcData(t);
-
+
ED_area_headerprint(t->sa, str);
}
/** \} */
@@ -5414,15 +5414,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;
@@ -5435,19 +5435,19 @@ 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);
}
@@ -5475,7 +5475,7 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
}
recalcData(t);
-
+
ED_area_headerprint(t->sa, str);
}
/** \} */
@@ -5957,7 +5957,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);
@@ -6029,9 +6029,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;
}
@@ -6362,7 +6362,7 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t
if (!v->e)
continue;
-
+
v_first = v;
/*walk along the edge loop*/
@@ -6821,17 +6821,17 @@ void freeEdgeSlideTempFaces(EdgeSlideData *sld)
void freeEdgeSlideVerts(TransInfo *UNUSED(t), TransDataContainer *UNUSED(tc), 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;
}
@@ -6889,7 +6889,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;
@@ -8234,30 +8234,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) {
@@ -8280,13 +8280,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);
@@ -8294,7 +8294,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);
@@ -8304,26 +8304,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) {
@@ -8383,7 +8383,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 */
@@ -8397,7 +8397,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)
@@ -8797,7 +8797,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]);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 44c8f581755..0982f91f825 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -200,16 +200,16 @@ typedef struct TransSeq {
/* for NLA transform (stored in td->extra pointer) */
typedef struct TransDataNla {
ID *id; /* ID-block NLA-data is attached to */
-
+
struct NlaTrack *oldTrack; /* Original NLA-Track that the strip belongs to */
struct NlaTrack *nlt; /* Current NLA-Track that the strip belongs to */
-
+
struct NlaStrip *strip; /* NLA-strip this data represents */
-
+
/* dummy values for transform to write in - must have 3 elements... */
float h1[3]; /* start handle */
float h2[3]; /* end handle */
-
+
int trackIndex; /* index of track that strip is currently in */
int handle; /* handle-index: 0 for dummy entry, -1 for start, 1 for end, 2 for both ends */
} TransDataNla;
@@ -507,7 +507,7 @@ typedef struct TransInfo {
short twflag; /* backup from view3d, to restore on end */
short prop_mode;
-
+
short mirror;
float values[4];
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 0b222e54a67..02cfc9c5e35 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -208,7 +208,7 @@ static void axisProjection(TransInfo *t, const float axis[3], const float in[3],
/* checks for center being too close to the view center */
viewAxisCorrectCenter(t, t_con_center);
-
+
angle = fabsf(angle_v3v3(axis, t->viewinv[2]));
if (angle > (float)M_PI_2) {
angle = (float)M_PI - angle;
@@ -239,7 +239,7 @@ static void axisProjection(TransInfo *t, const float axis[3], const float in[3],
project_v3_v3v3(vec, in, plane);
sub_v3_v3v3(vec, in, vec);
-
+
add_v3_v3v3(v, vec, t_con_center);
getViewVector(t, v, norm);
@@ -257,11 +257,11 @@ static void axisProjection(TransInfo *t, const float axis[3], const float in[3],
else {
add_v3_v3v3(v2, t_con_center, axis);
add_v3_v3v3(v4, v, norm);
-
+
isect_line_line_v3(t_con_center, v2, v, v4, i1, i2);
-
+
sub_v3_v3v3(v, i2, v);
-
+
sub_v3_v3v3(out, i1, t_con_center);
/* possible some values become nan when
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index bdcb42e74ef..7c5f7dba045 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -495,9 +495,9 @@ static short apply_targetless_ik(Object *ob)
/* apply and decompose, doesn't work for constraints or non-uniform scale well */
{
float rmat3[3][3], qrmat[3][3], imat3[3][3], smat[3][3];
-
+
copy_m3_m4(rmat3, rmat);
-
+
/* rotation */
/* [#22409] is partially caused by this, as slight numeric error introduced during
* the solving process leads to locked-axis values changing. However, we cannot modify
@@ -510,7 +510,7 @@ static short apply_targetless_ik(Object *ob)
mat3_to_axis_angle(parchan->rotAxis, &parchan->rotAngle, rmat3);
else
mat3_to_quat(parchan->quat, rmat3);
-
+
/* for size, remove rotation */
/* causes problems with some constraints (so apply only if needed) */
if (data->flag & CONSTRAINT_IK_STRETCH) {
@@ -520,12 +520,12 @@ static short apply_targetless_ik(Object *ob)
axis_angle_to_mat3(qrmat, parchan->rotAxis, parchan->rotAngle);
else
quat_to_mat3(qrmat, parchan->quat);
-
+
invert_m3_m3(imat3, qrmat);
mul_m3_m3m3(smat, rmat3, imat3);
mat3_to_size(parchan->size, smat);
}
-
+
/* causes problems with some constraints (e.g. childof), so disable this */
/* as it is IK shouldn't affect location directly */
/* copy_v3_v3(parchan->loc, rmat[3]); */
@@ -575,7 +575,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ext->rotAxis = NULL;
td->ext->rotAngle = NULL;
td->ext->quat = NULL;
-
+
copy_v3_v3(td->ext->irot, pchan->eul);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
@@ -583,7 +583,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ext->rotAxis = pchan->rotAxis;
td->ext->rotAngle = &pchan->rotAngle;
td->ext->quat = NULL;
-
+
td->ext->irotAngle = pchan->rotAngle;
copy_v3_v3(td->ext->irotAxis, pchan->rotAxis);
}
@@ -592,7 +592,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ext->rotAxis = NULL;
td->ext->rotAngle = NULL;
td->ext->quat = pchan->quat;
-
+
copy_qt_qt(td->ext->iquat, pchan->quat);
}
td->ext->rotOrder = pchan->rotmode;
@@ -645,7 +645,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->flag |= TD_PBONE_LOCAL_MTX_P;
}
}
-
+
/* for axismat we use bone's own transform */
copy_m3_m4(pmat, pchan->pose_mat);
mul_m3_m3m3(td->axismtx, omat, pmat);
@@ -730,7 +730,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
bone->flag |= BONE_TRANSFORM;
else
bone->flag &= ~BONE_TRANSFORM;
-
+
bone->flag &= ~BONE_HINGE_CHILD_TRANSFORM;
bone->flag &= ~BONE_TRANSFORM_CHILD;
}
@@ -754,7 +754,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
bone = pchan->bone;
if (bone->flag & BONE_TRANSFORM) {
total++;
-
+
if (mode == TFM_TRANSLATION) {
if (has_targetless_ik(pchan) == NULL) {
if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
@@ -878,9 +878,9 @@ static void pose_grab_with_ik_clear(Object *ob)
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
/* clear all temporary lock flags */
pchan->ikflag &= ~(BONE_IK_NO_XDOF_TEMP | BONE_IK_NO_YDOF_TEMP | BONE_IK_NO_ZDOF_TEMP);
-
+
pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_TARGET);
-
+
/* remove all temporary IK-constraints added */
for (con = pchan->constraints.first; con; con = next) {
next = con->next;
@@ -925,15 +925,15 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
for (con = pchan->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
data = con->data;
-
+
if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == '\0')) {
/* make reference to constraint to base things off later (if it's the last targetless constraint encountered) */
targetless = (bKinematicConstraint *)con->data;
-
+
/* but, if this is a targetless IK, we make it auto anyway (for the children loop) */
if (con->enforce != 0.0f) {
data->flag |= CONSTRAINT_IK_AUTO;
-
+
/* if no chain length has been specified, just make things obey standard rotation locks too */
if (data->rootbone == 0) {
for (; pchan; pchan = pchan->parent) {
@@ -944,11 +944,11 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
if (pchan->protectflag & OB_LOCK_ROTZ) pchan->ikflag |= BONE_IK_NO_ZDOF_TEMP;
}
}
-
- return 0;
+
+ return 0;
}
}
-
+
if ((con->flag & CONSTRAINT_DISABLE) == 0 && (con->enforce != 0.0f))
return 0;
}
@@ -966,7 +966,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
data->flag |= CONSTRAINT_IK_TEMP | CONSTRAINT_IK_AUTO | CONSTRAINT_IK_POS;
copy_v3_v3(data->grabtarget, pchan->pose_tail);
data->rootbone = 0; /* watch-it! has to be 0 here, since we're still on the same bone for the first time through the loop [#25885] */
-
+
/* we only include bones that are part of a continual connected chain */
do {
/* here, we set ik-settings for bone from pchan->protectflag */
@@ -974,10 +974,10 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
if (pchan->protectflag & OB_LOCK_ROTY) pchan->ikflag |= BONE_IK_NO_YDOF_TEMP;
if (pchan->protectflag & OB_LOCK_ROTZ) pchan->ikflag |= BONE_IK_NO_ZDOF_TEMP;
-
+
/* now we count this pchan as being included */
data->rootbone++;
-
+
/* continue to parent, but only if we're connected to it */
if (pchan->bone->flag & BONE_CONNECTED)
pchan = pchan->parent;
@@ -1167,7 +1167,7 @@ void restoreBones(TransDataContainer *tc)
while (bid->bone) {
ebo = bid->bone;
-
+
ebo->dist = bid->dist;
ebo->rad_tail = bid->rad_tail;
ebo->roll = bid->roll;
@@ -1175,7 +1175,7 @@ void restoreBones(TransDataContainer *tc)
ebo->zwidth = bid->zwidth;
copy_v3_v3(ebo->head, bid->head);
copy_v3_v3(ebo->tail, bid->tail);
-
+
if (arm->flag & ARM_MIRROR_EDIT) {
EditBone *ebo_child;
@@ -1194,7 +1194,7 @@ void restoreBones(TransDataContainer *tc)
parent->rad_tail = ebo->rad_head;
}
}
-
+
bid++;
}
}
@@ -3303,12 +3303,12 @@ static void createTransNlaData(bContext *C, TransInfo *t)
SpaceNla *snla = NULL;
TransData *td = NULL;
TransDataNla *tdn = NULL;
-
+
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
int count = 0;
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
@@ -3317,16 +3317,16 @@ static void createTransNlaData(bContext *C, TransInfo *t)
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
snla = (SpaceNla *)ac.sl;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* which side of the current frame should be allowed */
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
float xmouse, ymouse;
-
+
UI_view2d_region_to_view(&ac.ar->v2d, t->mouse.imval[0], t->mouse.imval[1], &xmouse, &ymouse);
t->frame_side = (xmouse > CFRA) ? 'R' : 'L';
}
@@ -3334,15 +3334,15 @@ static void createTransNlaData(bContext *C, TransInfo *t)
/* normal transform - both sides of current frame are considered */
t->frame_side = 'B';
}
-
+
/* loop 1: count how many strips are selected (consider each strip as 2 points) */
for (ale = anim_data.first; ale; ale = ale->next) {
NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
-
+
/* make some meta-strips for chains of selected strips */
BKE_nlastrips_make_metas(&nlt->strips, 1);
-
+
/* only consider selected strips */
for (strip = nlt->strips.first; strip; strip = strip->next) {
// TODO: we can make strips have handles later on...
@@ -3355,30 +3355,30 @@ static void createTransNlaData(bContext *C, TransInfo *t)
}
}
}
-
+
/* stop if trying to build list if nothing selected */
if (count == 0) {
- /* clear temp metas that may have been created but aren't needed now
+ /* clear temp metas that may have been created but aren't needed now
* because they fell on the wrong side of CFRA
*/
for (ale = anim_data.first; ale; ale = ale->next) {
NlaTrack *nlt = (NlaTrack *)ale->data;
BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
}
-
+
/* cleanup temp list */
ANIM_animdata_freelist(&anim_data);
return;
}
-
+
/* allocate memory for data */
tc->data_len = count;
-
+
tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransData(NLA Editor)");
td = tc->data;
tc->custom.type.data = tdn = MEM_callocN(tc->data_len * sizeof(TransDataNla), "TransDataNla (NLA Editor)");
tc->custom.type.use_free = true;
-
+
/* loop 2: build transdata array */
for (ale = anim_data.first; ale; ale = ale->next) {
/* only if a real NLA-track */
@@ -3386,7 +3386,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
AnimData *adt = ale->adt;
NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
-
+
/* only consider selected strips */
for (strip = nlt->strips.first; strip; strip = strip->next) {
// TODO: we can make strips have handles later on...
@@ -3403,44 +3403,44 @@ static void createTransNlaData(bContext *C, TransInfo *t)
* cases, there will need to be 1 of these tdn elements in the array skipped...
*/
float center[3], yval;
-
+
/* firstly, init tdn settings */
tdn->id = ale->id;
tdn->oldTrack = tdn->nlt = nlt;
tdn->strip = strip;
tdn->trackIndex = BLI_findindex(&adt->nla_tracks, nlt);
-
+
yval = (float)(tdn->trackIndex * NLACHANNEL_STEP(snla));
-
+
tdn->h1[0] = strip->start;
tdn->h1[1] = yval;
tdn->h2[0] = strip->end;
tdn->h2[1] = yval;
-
+
center[0] = (float)CFRA;
center[1] = yval;
center[2] = 0.0f;
-
+
/* set td's based on which handles are applicable */
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;
-
+
/* now, link the transform data up to this data */
if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
td->loc = tdn->h1;
copy_v3_v3(td->iloc, tdn->h1);
-
+
/* store all the other gunk that is required by transform */
copy_v3_v3(td->center, center);
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
-
+
td->ext = NULL; td->val = NULL;
-
+
td->flag |= TD_SELECTED;
td->dist = 0.0f;
-
+
unit_m3(td->mtx);
unit_m3(td->smtx);
}
@@ -3449,29 +3449,29 @@ static void createTransNlaData(bContext *C, TransInfo *t)
td->val = &tdn->h1[0];
td->ival = tdn->h1[0];
}
-
+
td->extra = tdn;
td++;
}
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;
-
+
/* now, link the transform data up to this data */
if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
td->loc = tdn->h2;
copy_v3_v3(td->iloc, tdn->h2);
-
+
/* store all the other gunk that is required by transform */
copy_v3_v3(td->center, center);
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
-
+
td->ext = NULL; td->val = NULL;
-
+
td->flag |= TD_SELECTED;
td->dist = 0.0f;
-
+
unit_m3(td->mtx);
unit_m3(td->smtx);
}
@@ -3480,11 +3480,11 @@ static void createTransNlaData(bContext *C, TransInfo *t)
td->val = &tdn->h2[0];
td->ival = tdn->h2[0];
}
-
+
td->extra = tdn;
td++;
}
-
+
/* if both handles were used, skip the next tdn (i.e. leave it blank) since the counting code is dumb...
* otherwise, just advance to the next one...
*/
@@ -3497,7 +3497,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
}
}
}
-
+
/* cleanup temp list */
ANIM_animdata_freelist(&anim_data);
}
@@ -3546,7 +3546,7 @@ static int masklay_shape_cmp_frame(void *thunk, const void *a, const void *b)
static void posttrans_gpd_clean(bGPdata *gpd)
{
bGPDlayer *gpl;
-
+
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
bGPDframe *gpf, *gpfn;
bool is_double = false;
@@ -3602,7 +3602,7 @@ typedef struct tRetainedKeyframe {
struct tRetainedKeyframe *next, *prev;
float frame; /* frame to cluster around */
float val; /* average value */
-
+
size_t tot_count; /* number of keyframes that have been averaged */
size_t del_count; /* number of keyframes of this sort that have been deleted so far */
} tRetainedKeyframe;
@@ -3615,27 +3615,27 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
/* NOTE: We assume that all keys are sorted */
ListBase retained_keys = {NULL, NULL};
const bool can_average_points = ((fcu->flag & (FCURVE_INT_VALUES | FCURVE_DISCRETE_VALUES)) == 0);
-
+
/* sanity checks */
if ((fcu->totvert == 0) || (fcu->bezt == NULL))
return;
-
+
/* 1) Identify selected keyframes, and average the values on those
* in case there are collisions due to multiple keys getting scaled
* to all end up on the same frame
*/
for (int i = 0; i < fcu->totvert; i++) {
BezTriple *bezt = &fcu->bezt[i];
-
+
if (BEZT_ISSEL_ANY(bezt)) {
bool found = false;
-
+
/* If there's another selected frame here, merge it */
for (tRetainedKeyframe *rk = retained_keys.last; rk; rk = rk->prev) {
if (IS_EQT(rk->frame, bezt->vec[1][0], BEZT_BINARYSEARCH_THRESH)) {
rk->val += bezt->vec[1][1];
rk->tot_count++;
-
+
found = true;
break;
}
@@ -3644,20 +3644,20 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
break;
}
}
-
+
/* If nothing found yet, create a new one */
if (found == false) {
tRetainedKeyframe *rk = MEM_callocN(sizeof(tRetainedKeyframe), "tRetainedKeyframe");
-
+
rk->frame = bezt->vec[1][0];
rk->val = bezt->vec[1][1];
rk->tot_count = 1;
-
+
BLI_addtail(&retained_keys, rk);
}
}
}
-
+
if (BLI_listbase_is_empty(&retained_keys)) {
/* This may happen if none of the points were selected... */
if (G.debug & G_DEBUG) {
@@ -3671,15 +3671,15 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
rk->val = rk->val / (float)rk->tot_count;
}
}
-
+
/* 2) Delete all keyframes duplicating the "retained keys" found above
* - Most of these will be unselected keyframes
* - Some will be selected keyframes though. For those, we only keep the last one
- * (or else everything is gone), and replace its value with the averaged value.
+ * (or else everything is gone), and replace its value with the averaged value.
*/
for (int i = fcu->totvert - 1; i >= 0; i--) {
BezTriple *bezt = &fcu->bezt[i];
-
+
/* Is this keyframe a candidate for deletion? */
/* TODO: Replace loop with an O(1) lookup instead */
for (tRetainedKeyframe *rk = retained_keys.last; rk; rk = rk->prev) {
@@ -3702,7 +3702,7 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
/* Delete Keyframe */
delete_fcurve_key(fcu, i, 0);
}
-
+
/* Update count of how many we've deleted
* - It should only matter that we're doing this for all but the last one
*/
@@ -3712,16 +3712,16 @@ static void posttrans_fcurve_clean(FCurve *fcu, const bool use_handle)
/* Always delete - Unselected keys don't matter */
delete_fcurve_key(fcu, i, 0);
}
-
+
/* Stop the RK search... we've found our match now */
break;
}
}
}
-
+
/* 3) Recalculate handles */
testhandles_fcurve(fcu, use_handle);
-
+
/* cleanup */
BLI_freelistN(&retained_keys);
}
@@ -3746,7 +3746,7 @@ static void posttrans_action_clean(bAnimContext *ac, bAction *act)
*/
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
+
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
posttrans_fcurve_clean(ale->key_data, false); /* only use handles in graph editor */
@@ -3793,10 +3793,10 @@ static int count_gplayer_frames(bGPDlayer *gpl, char side, float cfra, bool is_p
{
bGPDframe *gpf;
int count = 0, count_all = 0;
-
+
if (gpl == NULL)
return count;
-
+
/* only include points that occur on the right side of cfra */
for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
if (FrameOnMouseSide(side, (float)gpf->framenum, cfra)) {
@@ -3805,7 +3805,7 @@ static int count_gplayer_frames(bGPDlayer *gpl, char side, float cfra, bool is_p
count_all++;
}
}
-
+
if (is_prop_edit && count > 0)
return count_all;
else
@@ -3875,7 +3875,7 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC
/* only add if on the right 'side' of the current frame */
if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
TimeToTransData(td, bezt->vec[1], adt, ypos);
-
+
if (bezt->f2 & SELECT)
td->flag |= TD_SELECTED;
@@ -3883,18 +3883,18 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC
td->flag |= TD_MOVEHANDLE1 | TD_MOVEHANDLE2;
td2d->h1 = bezt->vec[0];
td2d->h2 = bezt->vec[2];
-
+
copy_v2_v2(td2d->ih1, td2d->h1);
copy_v2_v2(td2d->ih2, td2d->h2);
-
+
td++;
td2d++;
}
}
}
-
+
*td2dv = td2d;
-
+
return td;
}
@@ -3927,7 +3927,7 @@ static int GPLayerToTransData(TransData *td, tGPFtransdata *tfd, bGPDlayer *gpl,
{
bGPDframe *gpf;
int count = 0;
-
+
/* check for select frames on right side of current frame */
for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
if (is_prop_edit || (gpf->flag & GP_FRAME_SELECT)) {
@@ -3935,13 +3935,13 @@ static int GPLayerToTransData(TransData *td, tGPFtransdata *tfd, bGPDlayer *gpl,
/* memory is calloc'ed, so that should zero everything nicely for us */
td->val = &tfd->val;
td->ival = (float)gpf->framenum;
-
+
td->center[0] = td->ival;
td->center[1] = ypos;
tfd->val = (float)gpf->framenum;
tfd->sdata = &gpf->framenum;
-
+
/* advance td now */
td++;
tfd++;
@@ -3949,7 +3949,7 @@ static int GPLayerToTransData(TransData *td, tGPFtransdata *tfd, bGPDlayer *gpl,
}
}
}
-
+
return count;
}
@@ -4013,19 +4013,19 @@ static void createTransActionData(bContext *C, TransInfo *t)
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
-
+
/* filter data */
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
else
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* which side of the current frame should be allowed */
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
float xmouse, ymouse;
-
+
UI_view2d_region_to_view(&ac.ar->v2d, t->mouse.imval[0], t->mouse.imval[1], &xmouse, &ymouse);
t->frame_side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
}
@@ -4033,7 +4033,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
/* normal transform - both sides of current frame are considered */
t->frame_side = 'B';
}
-
+
/* loop 1: fully select ipo-keys and count how many BezTriples are selected */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
@@ -4045,7 +4045,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
else
cfra = (float)CFRA;
-
+
if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE))
adt_count = count_fcurve_keys(ale->key_data, t->frame_side, cfra, is_prop_edit);
else if (ale->type == ANIMTYPE_GPLAYER)
@@ -4060,7 +4060,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
ale->tag = true;
}
}
-
+
/* stop if trying to build list if nothing selected */
if (count == 0) {
/* cleanup temp list */
@@ -4072,17 +4072,17 @@ static void createTransActionData(bContext *C, TransInfo *t)
/* allocate memory for data */
tc->data_len = count;
-
+
tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransData(Action Editor)");
tc->data_2d = MEM_callocN(tc->data_len * sizeof(TransData2D), "transdata2d");
td = tc->data;
td2d = tc->data_2d;
-
+
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
tc->custom.type.data = tfd = MEM_callocN(sizeof(tGPFtransdata) * count, "tGPFtransdata");
tc->custom.type.use_free = true;
}
-
+
/* loop 2: build transdata array */
for (ale = anim_data.first; ale; ale = ale->next) {
@@ -4102,7 +4102,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
if (ale->type == ANIMTYPE_GPLAYER) {
bGPDlayer *gpl = (bGPDlayer *)ale->data;
int i;
-
+
i = GPLayerToTransData(td, tfd, gpl, t->frame_side, cfra, is_prop_edit, ypos);
td += i;
tfd += i;
@@ -4118,7 +4118,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
else {
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
-
+
td = ActionFCurveToTransData(td, &td2d, fcu, adt, t->frame_side, cfra, is_prop_edit, ypos);
}
}
@@ -4254,18 +4254,18 @@ static void bezt_to_transdata(TransData *td, TransData2D *td2d, TransDataGraph *
* Due to NLA mapping, we apply NLA mapping to some of the verts here,
* and then that mapping will be undone after transform is done.
*/
-
+
if (adt) {
td2d->loc[0] = BKE_nla_tweakedit_remap(adt, loc[0], NLATIME_CONVERT_MAP);
td2d->loc[1] = (loc[1] + offset) * unit_scale;
td2d->loc[2] = 0.0f;
td2d->loc2d = loc;
-
+
td->loc = td2d->loc;
td->center[0] = BKE_nla_tweakedit_remap(adt, cent[0], NLATIME_CONVERT_MAP);
td->center[1] = (cent[1] + offset) * unit_scale;
td->center[2] = 0.0f;
-
+
copy_v3_v3(td->iloc, td->loc);
}
else {
@@ -4273,7 +4273,7 @@ static void bezt_to_transdata(TransData *td, TransData2D *td2d, TransDataGraph *
td2d->loc[1] = (loc[1] + offset) * unit_scale;
td2d->loc[2] = 0.0f;
td2d->loc2d = loc;
-
+
td->loc = td2d->loc;
copy_v3_v3(td->center, cent);
td->center[1] = (td->center[1] + offset) * unit_scale;
@@ -4293,19 +4293,19 @@ static void bezt_to_transdata(TransData *td, TransData2D *td2d, TransDataGraph *
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
-
+
td->ext = NULL; td->val = NULL;
-
+
/* store AnimData info in td->extra, for applying mapping when flushing */
td->extra = adt;
-
+
if (selected) {
td->flag |= TD_SELECTED;
td->dist = 0.0f;
}
else
td->dist = FLT_MAX;
-
+
if (ishandle)
td->flag |= TD_NOTIMESNAP;
if (intvals)
@@ -4359,16 +4359,16 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
Scene *scene = t->scene;
ARegion *ar = t->ar;
View2D *v2d = &ar->v2d;
-
+
TransData *td = NULL;
TransData2D *td2d = NULL;
TransDataGraph *tdg = NULL;
-
+
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
BezTriple *bezt;
int count = 0, i;
float mtx[3][3], smtx[3][3];
@@ -4377,7 +4377,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
const bool use_local_center = graph_edit_use_local_center(t);
const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
short anim_map_flag = ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS;
-
+
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
@@ -4387,13 +4387,13 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* which side of the current frame should be allowed */
// XXX we still want this mode, but how to get this using standard transform too?
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
float xmouse, ymouse;
-
+
UI_view2d_region_to_view(v2d, t->mouse.imval[0], t->mouse.imval[1], &xmouse, &ymouse);
t->frame_side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
}
@@ -4401,7 +4401,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
/* normal transform - both sides of current frame are considered */
t->frame_side = 'B';
}
-
+
/* loop 1: count how many BezTriples (specifically their verts) are selected (or should be edited) */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
@@ -4460,7 +4460,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
}
}
}
-
+
/* stop if trying to build list if nothing selected */
if (count == 0) {
/* cleanup temp list */
@@ -4472,36 +4472,36 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
/* allocate memory for data */
tc->data_len = count;
-
+
tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransData (Graph Editor)");
/* for each 2d vert a 3d vector is allocated, so that they can be treated just as if they were 3d verts */
tc->data_2d = MEM_callocN(tc->data_len * sizeof(TransData2D), "TransData2D (Graph Editor)");
tc->custom.type.data = MEM_callocN(tc->data_len * sizeof(TransDataGraph), "TransDataGraph");
tc->custom.type.use_free = true;
-
+
td = tc->data;
td2d = tc->data_2d;
tdg = tc->custom.type.data;
-
+
/* precompute space-conversion matrices for dealing with non-uniform scaling of Graph Editor */
unit_m3(mtx);
unit_m3(smtx);
-
+
if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
float xscale, yscale;
-
+
/* apply scale factors to x and y axes of space-conversion matrices */
UI_view2d_scale_get(v2d, &xscale, &yscale);
-
+
/* mtx is data to global (i.e. view) conversion */
mul_v3_fl(mtx[0], xscale);
mul_v3_fl(mtx[1], yscale);
-
+
/* smtx is global (i.e. view) to data conversion */
if (IS_EQF(xscale, 0.0f) == 0) mul_v3_fl(smtx[0], 1.0f / xscale);
if (IS_EQF(yscale, 0.0f) == 0) mul_v3_fl(smtx[1], 1.0f / yscale);
}
-
+
/* loop 2: build transdata arrays */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
@@ -4533,7 +4533,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
TransDataCurveHandleFlags *hdata = NULL;
/* short h1=1, h2=1; */ /* UNUSED */
-
+
if (is_prop_edit) {
bool is_sel = (sel2 || sel1 || sel3);
/* we always select all handles for proportional editing if central handle is selected */
@@ -4601,7 +4601,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
}
}
}
-
+
/* Sets handles based on the selection */
testhandles_fcurve(fcu, use_handle);
}
@@ -4689,19 +4689,19 @@ static BeztMap *bezt_to_beztmaps(BezTriple *bezts, int totvert, const short UNUS
BezTriple *prevbezt = NULL;
BeztMap *bezm, *bezms;
int i;
-
+
/* allocate memory for this array */
if (totvert == 0 || bezts == NULL)
return NULL;
bezm = bezms = MEM_callocN(sizeof(BeztMap) * totvert, "BeztMaps");
-
+
/* assign beztriples to beztmaps */
for (i = 0; i < totvert; i++, bezm++, prevbezt = bezt, bezt++) {
bezm->bezt = bezt;
-
+
bezm->oldIndex = i;
bezm->newIndex = i;
-
+
bezm->pipo = (prevbezt) ? prevbezt->ipo : bezt->ipo;
bezm->cipo = bezt->ipo;
}
@@ -4714,11 +4714,11 @@ static void sort_time_beztmaps(BeztMap *bezms, int totvert, const short UNUSED(u
{
BeztMap *bezm;
int i, ok = 1;
-
+
/* keep repeating the process until nothing is out of place anymore */
while (ok) {
ok = 0;
-
+
bezm = bezms;
i = totvert;
while (i--) {
@@ -4727,13 +4727,13 @@ static void sort_time_beztmaps(BeztMap *bezms, int totvert, const short UNUSED(u
if (bezm->bezt->vec[1][0] > (bezm + 1)->bezt->vec[1][0]) {
bezm->newIndex++;
(bezm + 1)->newIndex--;
-
+
SWAP(BeztMap, *bezm, *(bezm + 1));
-
+
ok = 1;
}
}
-
+
/* do we need to check if the handles need to be swapped?
* optimization: this only needs to be performed in the first loop
*/
@@ -4749,7 +4749,7 @@ static void sort_time_beztmaps(BeztMap *bezms, int totvert, const short UNUSED(u
bezm->swapHs = -1;
}
}
-
+
bezm++;
}
}
@@ -4772,7 +4772,7 @@ static void beztmap_to_data(TransInfo *t, FCurve *fcu, BeztMap *bezms, int totve
* already done
*/
adjusted = MEM_callocN(tc->data_len, "beztmap_adjusted_map");
-
+
/* for each beztmap item, find if it is used anywhere */
bezm = bezms;
for (i = 0; i < totvert; i++, bezm++) {
@@ -4784,7 +4784,7 @@ static void beztmap_to_data(TransInfo *t, FCurve *fcu, BeztMap *bezms, int totve
for (j = 0; j < tc->data_len; j++, td2d++, td++) {
/* skip item if already marked */
if (adjusted[j] != 0) continue;
-
+
/* update all transdata pointers, no need to check for selections etc,
* since only points that are really needed were created as transdata
*/
@@ -4804,13 +4804,13 @@ static void beztmap_to_data(TransInfo *t, FCurve *fcu, BeztMap *bezms, int totve
}
else if (td2d->loc2d == bezm->bezt->vec[1]) {
td2d->loc2d = (bezts + bezm->newIndex)->vec[1];
-
+
/* if only control point is selected, the handle pointers need to be updated as well */
if (td2d->h1)
td2d->h1 = (bezts + bezm->newIndex)->vec[0];
if (td2d->h2)
td2d->h2 = (bezts + bezm->newIndex)->vec[2];
-
+
adjusted[j] = 1;
}
@@ -4826,9 +4826,9 @@ static void beztmap_to_data(TransInfo *t, FCurve *fcu, BeztMap *bezms, int totve
}
}
}
-
+
}
-
+
/* free temp memory used for 'adjusted' array */
MEM_freeN(adjusted);
}
@@ -4845,26 +4845,26 @@ void remake_graph_transdata(TransInfo *t, ListBase *anim_data)
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
bAnimListElem *ale;
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
-
+
/* sort and reassign verts */
for (ale = anim_data->first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
-
+
if (fcu->bezt) {
BeztMap *bezm;
-
+
/* adjust transform-data pointers */
/* note, none of these functions use 'use_handle', it could be removed */
bezm = bezt_to_beztmaps(fcu->bezt, fcu->totvert, use_handle);
sort_time_beztmaps(bezm, fcu->totvert, use_handle);
beztmap_to_data(t, fcu, bezm, fcu->totvert, use_handle);
-
+
/* free mapping stuff */
MEM_freeN(bezm);
-
+
/* re-sort actual beztriples (perhaps this could be done using the beztmaps to save time?) */
sort_time_fcurve(fcu);
-
+
/* make sure handles are all set correctly */
testhandles_fcurve(fcu, use_handle);
}
@@ -4904,11 +4904,11 @@ void flushTransGraphData(TransInfo *t)
case SACTSNAP_FRAME: /* snap to nearest frame */
td2d->loc[0] = floor((double)td2d->loc[0] + 0.5);
break;
-
+
case SACTSNAP_SECOND: /* snap to nearest second */
td2d->loc[0] = floor(((double)td2d->loc[0] / secf) + 0.5) * secf;
break;
-
+
case SACTSNAP_MARKER: /* snap to nearest marker */
td2d->loc[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, td2d->loc[0]);
break;
@@ -4920,7 +4920,7 @@ void flushTransGraphData(TransInfo *t)
td2d->loc2d[0] = BKE_nla_tweakedit_remap(adt, td2d->loc[0], NLATIME_CONVERT_UNMAP);
else
td2d->loc2d[0] = td2d->loc[0];
-
+
/* Time-stepping auto-snapping modes don't get applied for Graph Editor transforms,
* as these use the generic transform modes which don't account for this sort of thing.
* These ones aren't affected by NLA mapping, so we do this after the conversion...
@@ -4929,15 +4929,15 @@ void flushTransGraphData(TransInfo *t)
* to, otherwise we get "swimming handles"
* NOTE: We don't do this when canceling transforms, or else these changes don't go away
*/
- if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0 &&
- ELEM(sipo->autosnap, SACTSNAP_STEP, SACTSNAP_TSTEP))
+ if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0 &&
+ ELEM(sipo->autosnap, SACTSNAP_STEP, SACTSNAP_TSTEP))
{
switch (sipo->autosnap) {
case SACTSNAP_STEP: /* frame step */
td2d->loc2d[0] = floor((double)td2d->loc[0] + 0.5);
td->loc[0] = floor((double)td->loc[0] + 0.5);
break;
-
+
case SACTSNAP_TSTEP: /* second step */
/* XXX: the handle behaviour in this case is still not quite right... */
td2d->loc[0] = floor(((double)td2d->loc[0] / secf) + 0.5) * secf;
@@ -4945,18 +4945,18 @@ void flushTransGraphData(TransInfo *t)
break;
}
}
-
+
/* if int-values only, truncate to integers */
if (td->flag & TD_INTVALUES)
td2d->loc2d[1] = floorf(td2d->loc[1] * inv_unit_scale - tdg->offset + 0.5f);
else
td2d->loc2d[1] = td2d->loc[1] * inv_unit_scale - tdg->offset;
-
+
if ((td->flag & TD_MOVEHANDLE1) && td2d->h1) {
td2d->h1[0] = td2d->ih1[0] + td->loc[0] - td->iloc[0];
td2d->h1[1] = td2d->ih1[1] + (td->loc[1] - td->iloc[1]) * inv_unit_scale;
}
-
+
if ((td->flag & TD_MOVEHANDLE2) && td2d->h2) {
td2d->h2[0] = td2d->ih2[0] + td->loc[0] - td->iloc[0];
td2d->h2[1] = td2d->ih2[1] + (td->loc[1] - td->iloc[1]) * inv_unit_scale;
@@ -5505,7 +5505,7 @@ static void createTransSeqData(bContext *C, TransInfo *t)
/* loop 2: build transdata array */
SeqToTransData_Recursive(t, ed->seqbasep, td, td2d, tdsq);
SeqTransDataBounds(t, ed->seqbasep, ts);
-
+
/* set the snap mode based on how close the mouse is at the end/start points */
if (abs(xmouse - ts->max) > abs(xmouse - ts->min))
ts->snap_left = true;
@@ -5543,19 +5543,19 @@ static bool constraints_list_needinv(TransInfo *t, ListBase *list)
{
return true;
}
-
+
/* constraints that require this only under special conditions */
if (con->type == CONSTRAINT_TYPE_CHILDOF) {
/* ChildOf constraint only works when using all location components, see T42256. */
bChildOfConstraint *data = (bChildOfConstraint *)con->data;
-
+
if ((data->flag & CHILDOF_LOCX) && (data->flag & CHILDOF_LOCY) && (data->flag & CHILDOF_LOCZ))
return true;
}
else if (con->type == CONSTRAINT_TYPE_ROTLIKE) {
/* CopyRot constraint only does this when rotating, and offset is on */
bRotateLikeConstraint *data = (bRotateLikeConstraint *)con->data;
-
+
if ((data->flag & ROTLIKE_OFFSET) && (t->mode == TFM_ROTATION))
return true;
}
@@ -5563,7 +5563,7 @@ static bool constraints_list_needinv(TransInfo *t, ListBase *list)
/* Transform constraint needs it for rotation at least (r.57309),
* but doing so when translating may also mess things up [#36203]
*/
-
+
if (t->mode == TFM_ROTATION)
return true;
/* ??? (t->mode == TFM_SCALE) ? */
@@ -5639,13 +5639,13 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
td->loc = ob->loc;
copy_v3_v3(td->iloc, td->loc);
-
+
if (ob->rotmode > 0) {
td->ext->rot = ob->rot;
td->ext->rotAxis = NULL;
td->ext->rotAngle = NULL;
td->ext->quat = NULL;
-
+
copy_v3_v3(td->ext->irot, ob->rot);
copy_v3_v3(td->ext->drot, ob->drot);
}
@@ -5654,7 +5654,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
td->ext->rotAxis = ob->rotAxis;
td->ext->rotAngle = &ob->rotAngle;
td->ext->quat = NULL;
-
+
td->ext->irotAngle = ob->rotAngle;
copy_v3_v3(td->ext->irotAxis, ob->rotAxis);
// td->ext->drotAngle = ob->drotAngle; // XXX, not implemented
@@ -5665,7 +5665,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
td->ext->rotAxis = NULL;
td->ext->rotAngle = NULL;
td->ext->quat = ob->quat;
-
+
copy_qt_qt(td->ext->iquat, ob->quat);
copy_qt_qt(td->ext->dquat, ob->dquat);
}
@@ -5804,7 +5804,7 @@ static bool mark_children(Object *ob)
return true;
}
}
-
+
return false;
}
@@ -5885,7 +5885,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, O
{
ID *id = &ob->id;
FCurve *fcu;
-
+
// TODO: this should probably be done per channel instead...
if (autokeyframe_cfra_can_key(scene, id)) {
ReportList *reports = CTX_wm_reports(C);
@@ -5894,36 +5894,36 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, O
ListBase dsources = {NULL, NULL};
float cfra = (float)CFRA; // xxx this will do for now
short flag = 0;
-
+
/* get flags used for inserting keyframes */
flag = ANIM_get_keyframing_flags(scene, 1);
-
+
/* add datasource override for the object */
- ANIM_relative_keyingset_add_source(&dsources, id, NULL, NULL);
-
+ ANIM_relative_keyingset_add_source(&dsources, id, NULL, NULL);
+
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (active_ks)) {
- /* only insert into active keyingset
+ /* only insert into active keyingset
* NOTE: we assume here that the active Keying Set does not need to have its iterator overridden
*/
ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra);
}
else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) {
AnimData *adt = ob->adt;
-
+
/* only key on available channels */
if (adt && adt->action) {
for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) {
fcu->flag &= ~FCURVE_SELECTED;
insert_keyframe(reports, id, adt->action,
(fcu->grp ? fcu->grp->name : NULL),
- fcu->rna_path, fcu->array_index, cfra,
+ fcu->rna_path, fcu->array_index, cfra,
ts->keyframe_type, flag);
}
}
}
else if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED)) {
bool do_loc = false, do_rot = false, do_scale = false;
-
+
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
if (tmode == TFM_TRANSLATION) {
do_loc = true;
@@ -5936,7 +5936,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, O
else if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR) {
do_loc = true;
}
-
+
if ((scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) == 0) {
do_rot = true;
}
@@ -5974,23 +5974,23 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, O
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
}
-
+
/* only calculate paths if there are paths to be recalculated,
* assuming that since we've autokeyed the transforms this is
* now safe to apply...
- *
+ *
* NOTE: only do this when there's context info
*/
if (C && (ob->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) {
//ED_objects_clear_paths(C); // XXX for now, don't need to clear
ED_objects_recalculate_paths(C, scene);
-
- /* XXX: there's potential here for problems with unkeyed rotations/scale,
+
+ /* XXX: there's potential here for problems with unkeyed rotations/scale,
* but for now (until proper data-locality for baking operations),
* this should be a better fix for T24451 and T37755
*/
}
-
+
/* free temp info */
BLI_freelistN(&dsources);
}
@@ -6009,7 +6009,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, Object *ob, int tmode,
bPose *pose = ob->pose;
bPoseChannel *pchan;
FCurve *fcu;
-
+
// TODO: this should probably be done per channel instead...
if (autokeyframe_cfra_can_key(scene, id)) {
ReportList *reports = CTX_wm_reports(C);
@@ -6017,27 +6017,27 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, Object *ob, int tmode,
KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene);
float cfra = (float)CFRA;
short flag = 0;
-
+
/* flag is initialized from UserPref keyframing settings
* - special exception for targetless IK - INSERTKEY_MATRIX keyframes should get
* visual keyframes even if flag not set, as it's not that useful otherwise
* (for quick animation recording)
*/
flag = ANIM_get_keyframing_flags(scene, 1);
-
- if (targetless_ik)
+
+ if (targetless_ik)
flag |= INSERTKEY_MATRIX;
-
+
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone->flag & BONE_TRANSFORM) {
ListBase dsources = {NULL, NULL};
-
+
/* clear any 'unkeyed' flag it may have */
pchan->bone->flag &= ~BONE_UNKEYED;
-
+
/* add datasource override for the camera object */
- ANIM_relative_keyingset_add_source(&dsources, id, &RNA_PoseBone, pchan);
-
+ ANIM_relative_keyingset_add_source(&dsources, id, &RNA_PoseBone, pchan);
+
/* only insert into active keyingset? */
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (active_ks)) {
/* run the active Keying Set on the current datasource */
@@ -6050,17 +6050,17 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, Object *ob, int tmode,
/* only insert keyframes for this F-Curve if it affects the current bone */
if (strstr(fcu->rna_path, "bones")) {
char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
-
- /* only if bone name matches too...
+
+ /* only if bone name matches too...
* NOTE: this will do constraints too, but those are ok to do here too?
*/
if (pchanName && STREQ(pchanName, pchan->name)) {
- insert_keyframe(reports, id, act,
+ insert_keyframe(reports, id, act,
((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, fcu->array_index, cfra,
ts->keyframe_type, flag);
}
-
+
if (pchanName) MEM_freeN(pchanName);
}
}
@@ -6069,7 +6069,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, Object *ob, int tmode,
/* only insert keyframe if needed? */
else if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED)) {
bool do_loc = false, do_rot = false, do_scale = false;
-
+
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
if (tmode == TFM_TRANSLATION) {
if (targetless_ik)
@@ -6114,13 +6114,13 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, Object *ob, int tmode,
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
}
-
+
/* free temp info */
BLI_freelistN(&dsources);
}
}
-
- /* do the bone paths
+
+ /* do the bone paths
* - only do this when there is context info, since we need that to resolve
* how to do the updates and so on...
* - do not calculate unless there are paths already to update...
@@ -6218,7 +6218,7 @@ static void special_aftertrans_update__mask(bContext *C, TransInfo *t)
static void special_aftertrans_update__node(bContext *UNUSED(C), TransInfo *t)
{
const bool canceled = (t->state == TRANS_CANCEL);
-
+
if (canceled && t->remove_on_cancel) {
/* remove selected nodes on cancel */
SpaceNode *snode = (SpaceNode *)t->sa->spacedata.first;
@@ -6279,7 +6279,7 @@ static void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t)
}
/* inserting keys, pointcache, redraw events... */
-/*
+/*
* note: sequencer freeing has its own function now because of a conflict with transform's order of freeing (campbell)
* Order changed, the sequencer stuff should go back in here
* */
@@ -6379,10 +6379,10 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
special_aftertrans_update__node(C, t);
if (canceled == 0) {
ED_node_post_apply_transform(C, snode->edittree);
-
+
ED_node_link_insert(t->sa);
}
-
+
/* clear link line */
ED_node_link_intersect_test(t->sa, 0);
}
@@ -6397,26 +6397,26 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
else if (t->spacetype == SPACE_ACTION) {
SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
bAnimContext ac;
-
+
/* initialize relevant anim-context 'context' data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
-
+
ob = ac.obact;
-
+
if (ELEM(ac.datatype, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
-
+
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* these should all be F-Curves */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
-
+
/* 3 cases here for curve cleanups:
* 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
@@ -6434,7 +6434,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
posttrans_fcurve_clean(fcu, false); /* only use handles in graph editor */
}
}
-
+
/* free temp memory */
ANIM_animdata_freelist(&anim_data);
}
@@ -6447,7 +6447,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
else
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
}
-
+
/* 3 cases here for curve cleanups:
* 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
@@ -6470,7 +6470,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
((canceled == 0) || (duplicate)))
{
bGPdata *gpd;
-
+
// XXX: BAD! this get gpencil datablocks directly from main db...
// but that's how this currently works :/
for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) {
@@ -6499,9 +6499,9 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
}
}
-
+
/* marker transform, not especially nice but we may want to move markers
- * at the same time as keyframes in the dope sheet.
+ * at the same time as keyframes in the dope sheet.
*/
if ((saction->flag & SACTION_MARKERS_MOVE) && (canceled == 0)) {
if (t->mode == TFM_TIME_TRANSLATE) {
@@ -6520,11 +6520,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->values[0], t->frame_side);
}
}
-
+
/* make sure all F-Curves are set correctly */
if (!ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
ANIM_editkeyframes_refresh(&ac);
-
+
/* clear flag that was set for time-slide drawing */
saction->flag &= ~SACTION_MOVING;
}
@@ -6532,23 +6532,23 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
bAnimContext ac;
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
-
+
/* initialize relevant anim-context 'context' data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
-
+
if (ac.datatype) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
-
+
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
-
+
/* 3 cases here for curve cleanups:
* 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
@@ -6566,11 +6566,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
posttrans_fcurve_clean(fcu, use_handle);
}
}
-
+
/* free temp memory */
ANIM_animdata_freelist(&anim_data);
}
-
+
/* Make sure all F-Curves are set correctly, but not if transform was
* canceled, since then curves were already restored to initial state.
* Note: if the refresh is really needed after cancel then some way
@@ -6581,32 +6581,32 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
else if (t->spacetype == SPACE_NLA) {
bAnimContext ac;
-
+
/* initialize relevant anim-context 'context' data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
-
+
if (ac.datatype) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
-
+
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
NlaTrack *nlt = (NlaTrack *)ale->data;
-
+
/* make sure strips are in order again */
BKE_nlatrack_sort_strips(nlt);
-
+
/* remove the temp metas */
BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
}
-
+
/* free temp memory */
ANIM_animdata_freelist(&anim_data);
-
+
/* perform after-transfrom validation */
ED_nla_postop_refresh(&ac);
}
@@ -6702,7 +6702,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (td->flag & TD_NOACTION)
break;
-
+
if (td->flag & TD_SKIP)
continue;
@@ -6728,7 +6728,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (!canceled) {
autokeyframe_ob_cb_func(C, t->scene, t->view_layer, ob, t->mode);
}
-
+
/* restore rigid body transform */
if (ob->rigidbody_object && canceled) {
float ctime = BKE_scene_frame_get(t->scene);
@@ -6771,13 +6771,13 @@ static void createTransObject(bContext *C, TransInfo *t)
/* count */
tc->data_len = CTX_DATA_COUNT(C, selected_objects);
-
+
if (!tc->data_len) {
/* clear here, main transform function escapes too */
clear_trans_object_base_flags(t);
return;
}
-
+
if (is_prop_edit) {
tc->data_len += count_proportional_objects(t);
}
@@ -6788,29 +6788,29 @@ static void createTransObject(bContext *C, TransInfo *t)
CTX_DATA_BEGIN(C, Base *, base, selected_bases)
{
Object *ob = base->object;
-
+
td->flag = TD_SELECTED;
td->protectflag = ob->protectflag;
td->ext = tx;
td->ext->rotOrder = ob->rotmode;
-
+
if (base->flag & BA_TRANSFORM_CHILD) {
td->flag |= TD_NOCENTER;
td->flag |= TD_NO_LOC;
}
-
+
/* select linked objects, but skip them later */
if (ID_IS_LINKED(ob)) {
td->flag |= TD_SKIP;
}
-
+
ObjectToTransData(t, td, ob);
td->val = NULL;
td++;
tx++;
}
CTX_DATA_END;
-
+
if (is_prop_edit) {
ViewLayer *view_layer = t->view_layer;
Base *base;
@@ -6826,7 +6826,7 @@ static void createTransObject(bContext *C, TransInfo *t)
td->protectflag = ob->protectflag;
td->ext = tx;
td->ext->rotOrder = ob->rotmode;
-
+
ObjectToTransData(t, td, ob);
td->val = NULL;
td++;
@@ -6840,7 +6840,7 @@ static void createTransObject(bContext *C, TransInfo *t)
static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node, const float dpi_fac)
{
float locx, locy;
-
+
/* account for parents (nested nodes) */
if (node->parent) {
nodeToView(node->parent, node->locx, node->locy, &locx, &locy);
@@ -6849,7 +6849,7 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node, const
locx = node->locx;
locy = node->locy;
}
-
+
/* use top-left corner as the transform origin for nodes */
/* weirdo - but the node system is a mix of free 2d elements and dpi sensitive UI */
#ifdef USE_NODE_CENTER
@@ -8043,10 +8043,10 @@ static void createTransGPencil(bContext *C, TransInfo *t)
bGPDlayer *gpl;
TransData *td = NULL;
float mtx[3][3], smtx[3][3];
-
+
const Scene *scene = CTX_data_scene(C);
const int cfra_scene = CFRA;
-
+
const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
const bool is_prop_edit_connected = (t->flag & T_PROP_CONNECTED) != 0;
@@ -8059,11 +8059,11 @@ static void createTransGPencil(bContext *C, TransInfo *t)
* strokes. This may cause issues in future though.
*/
tc->data_len = 0;
-
+
if (gpd == NULL)
return;
-
- /* First Pass: Count the number of datapoints required for the strokes,
+
+ /* First Pass: Count the number of datapoints required for the strokes,
* (and additional info about the configuration - e.g. 2D/3D?)
*/
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
@@ -8099,30 +8099,30 @@ static void createTransGPencil(bContext *C, TransInfo *t)
if (gps->flag & GP_STROKE_SELECT) {
bGPDspoint *pt;
int i;
-
+
// TODO: 2D vs 3D?
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
if (pt->flag & GP_SPOINT_SELECT)
tc->data_len++;
}
}
- }
+ }
}
}
}
-
+
/* Stop trying if nothing selected */
if (tc->data_len == 0) {
return;
}
-
+
/* Allocate memory for data */
tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransData(GPencil)");
td = tc->data;
-
+
unit_m3(smtx);
unit_m3(mtx);
-
+
/* Second Pass: Build transdata array */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* only editable and visible layers are considered */
@@ -8139,7 +8139,7 @@ static void createTransGPencil(bContext *C, TransInfo *t)
/* undo matrix */
invert_m4_m4(inverse_diff_mat, diff_mat);
}
-
+
/* Make a new frame to work on if the layer's frame and the current scene frame don't match up
* - This is useful when animating as it saves that "uh-oh" moment when you realize you've
* spent too much time editing the wrong frame...
@@ -8151,13 +8151,13 @@ static void createTransGPencil(bContext *C, TransInfo *t)
continue;
}
}
-
+
/* Loop over strokes, adding TransData for points as needed... */
for (gps = gpf->strokes.first; gps; gps = gps->next) {
TransData *head = td;
TransData *tail = td;
bool stroke_ok;
-
+
/* skip strokes that are invalid for current view */
if (ED_gpencil_stroke_can_use(C, gps) == false) {
continue;
@@ -8181,26 +8181,26 @@ static void createTransGPencil(bContext *C, TransInfo *t)
/* C) Only selected points in selected strokes */
stroke_ok = (gps->flag & GP_STROKE_SELECT) != 0;
}
-
+
/* Do stroke... */
if (stroke_ok && gps->totpoints) {
bGPDspoint *pt;
int i;
-
+
#if 0 /* XXX: this isn't needed anymore; cannot calculate center this way or is_prop_edit breaks */
const float ninv = 1.0f / gps->totpoints;
float center[3] = {0.0f};
-
+
/* compute midpoint of stroke */
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
madd_v3_v3v3fl(center, center, &pt->x, ninv);
}
#endif
-
+
/* add all necessary points... */
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
bool point_ok;
-
+
/* include point? */
if (is_prop_edit) {
/* Always all points in strokes that get included */
@@ -8210,30 +8210,30 @@ static void createTransGPencil(bContext *C, TransInfo *t)
/* Only selected points in selected strokes */
point_ok = (pt->flag & GP_SPOINT_SELECT) != 0;
}
-
+
/* do point... */
if (point_ok) {
copy_v3_v3(td->iloc, &pt->x);
copy_v3_v3(td->center, &pt->x); // XXX: what about t->around == local?
-
+
td->loc = &pt->x;
-
+
td->flag = 0;
-
+
if (pt->flag & GP_SPOINT_SELECT)
td->flag |= TD_SELECTED;
-
+
/* for other transform modes (e.g. shrink-fatten), need to additional data */
if (t->mode == TFM_GPENCIL_SHRINKFATTEN) {
td->val = &pt->pressure;
td->ival = pt->pressure;
}
-
+
/* screenspace needs special matrices... */
if ((gps->flag & (GP_STROKE_3DSPACE | GP_STROKE_2DSPACE | GP_STROKE_2DIMAGE)) == 0) {
/* screenspace */
td->protectflag = OB_LOCK_LOCZ | OB_LOCK_ROTZ | OB_LOCK_SCALEZ;
-
+
/* apply parent transformations */
if (gpl->parent == NULL) {
copy_m3_m4(td->smtx, t->persmat);
@@ -8253,7 +8253,7 @@ static void createTransGPencil(bContext *C, TransInfo *t)
td->protectflag = OB_LOCK_LOCZ | OB_LOCK_ROTZ | OB_LOCK_SCALEZ;
// XXX: matrices may need to be different?
}
-
+
/* apply parent transformations */
if (gpl->parent == NULL) {
copy_m3_m3(td->smtx, smtx);
@@ -8274,7 +8274,7 @@ static void createTransGPencil(bContext *C, TransInfo *t)
tail++;
}
}
-
+
/* March over these points, and calculate the proportional editing distances */
if (is_prop_edit && (head != tail)) {
/* XXX: for now, we are similar enough that this works... */
@@ -8348,7 +8348,7 @@ void createTransData(bContext *C, TransInfo *t)
createTransGPencil(C, t);
countAndCleanTransDataContainer(t);
-
+
if (t->data_len_all && (t->flag & T_PROP_EDIT)) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 1);
@@ -8380,7 +8380,7 @@ void createTransData(bContext *C, TransInfo *t)
initTransDataContainers_FromObjectData(t);
createTransUVs(C, t);
countAndCleanTransDataContainer(t);
-
+
t->flag |= T_EDIT;
if (t->data_len_all && (t->flag & T_PROP_EDIT)) {
@@ -8538,7 +8538,7 @@ void createTransData(bContext *C, TransInfo *t)
countAndCleanTransDataContainer(t);
}
}
-
+
}
}
else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_start_edit(PE_get_current(scene, ob))) {
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 133cf445072..b7170682702 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -263,11 +263,11 @@ static void editbmesh_apply_to_mirror(TransInfo *t)
static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
{
ScreenAnimData *sad = (animtimer) ? animtimer->customdata : NULL;
-
+
/* sanity checks */
if (ELEM(NULL, scene, id, sad))
return;
-
+
/* check if we need a new strip if:
* - if animtimer is running
* - we're not only keying for available channels
@@ -278,26 +278,26 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
AnimData *adt = BKE_animdata_from_id(id);
const bool is_first = (adt) && (adt->nla_tracks.first == NULL);
-
- /* perform push-down manually with some differences
+
+ /* perform push-down manually with some differences
* NOTE: BKE_nla_action_pushdown() sync warning...
*/
if ((adt->action) && !(adt->flag & ADT_NLA_EDIT_ON)) {
float astart, aend;
-
+
/* only push down if action is more than 1-2 frames long */
calc_action_range(adt->action, &astart, &aend, 1);
if (aend > astart + 2.0f) {
NlaStrip *strip = BKE_nlastack_add_strip(adt, adt->action);
-
+
/* clear reference to action now that we've pushed it onto the stack */
id_us_min(&adt->action->id);
adt->action = NULL;
-
+
/* adjust blending + extend so that they will behave correctly */
strip->extendmode = NLASTRIP_EXTEND_NOTHING;
strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS | NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE);
-
+
/* copy current "action blending" settings from adt to the strip,
* as it was keyframed with these settings, so omitting them will
* change the effect [T54766]
@@ -305,7 +305,7 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
if (is_first == false) {
strip->blendmode = adt->act_blendmode;
strip->influence = adt->act_influence;
-
+
if (adt->act_influence < 1.0f) {
/* enable "user-controlled" influence (which will insert a default keyframe)
* so that the influence doesn't get lost on the new update
@@ -320,9 +320,9 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
BKE_nlastrip_validate_fcurves(strip);
}
}
-
- /* also, adjust the AnimData's action extend mode to be on
- * 'nothing' so that previous result still play
+
+ /* also, adjust the AnimData's action extend mode to be on
+ * 'nothing' so that previous result still play
*/
adt->act_extendmode = NLASTRIP_EXTEND_NOTHING;
}
@@ -351,12 +351,12 @@ static void recalcData_actedit(TransInfo *t)
{
ViewLayer *view_layer = t->view_layer;
SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
-
+
bAnimContext ac = {NULL};
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* initialize relevant anim-context 'context' data from TransInfo data */
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
ac.scene = t->scene;
@@ -367,9 +367,9 @@ static void recalcData_actedit(TransInfo *t)
ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
ac.spacetype = (t->sa) ? t->sa->spacetype : 0;
ac.regiontype = (t->ar) ? t->ar->regiontype : 0;
-
+
ANIM_animdata_context_getdata(&ac);
-
+
/* perform flush */
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
/* flush transform values back to actual coordinates */
@@ -379,8 +379,8 @@ static void recalcData_actedit(TransInfo *t)
/* get animdata blocks visible in editor, assuming that these will be the ones where things changed */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
- /* just tag these animdata-blocks to recalc, assuming that some data there changed
+
+ /* just tag these animdata-blocks to recalc, assuming that some data there changed
* BUT only do this if realtime updates are enabled
*/
if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) {
@@ -389,7 +389,7 @@ static void recalcData_actedit(TransInfo *t)
ANIM_list_elem_update(t->scene, ale);
}
}
-
+
/* now free temp channels */
ANIM_animdata_freelist(&anim_data);
}
@@ -399,11 +399,11 @@ static void recalcData_graphedit(TransInfo *t)
{
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
ViewLayer *view_layer = t->view_layer;
-
+
ListBase anim_data = {NULL, NULL};
bAnimContext ac = {NULL};
int filter;
-
+
bAnimListElem *ale;
int dosort = 0;
@@ -417,20 +417,20 @@ static void recalcData_graphedit(TransInfo *t)
ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
ac.spacetype = (t->sa) ? t->sa->spacetype : 0;
ac.regiontype = (t->ar) ? t->ar->regiontype : 0;
-
+
ANIM_animdata_context_getdata(&ac);
-
+
/* do the flush first */
flushTransGraphData(t);
-
+
/* get curves to check if a re-sort is needed */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* now test if there is a need to re-sort */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
-
+
/* ignore FC-Curves without any selected verts */
if (!fcu_test_selected(fcu))
continue;
@@ -440,17 +440,17 @@ static void recalcData_graphedit(TransInfo *t)
dosort++;
else
calchandles_fcurve(fcu);
-
+
/* set refresh tags for objects using this animation,
- * BUT only if realtime updates are enabled
+ * BUT only if realtime updates are enabled
*/
if ((sipo->flag & SIPO_NOREALTIMEUPDATES) == 0)
ANIM_list_elem_update(t->scene, ale);
}
-
+
/* do resort and other updates? */
if (dosort) remake_graph_transdata(t, &anim_data);
-
+
/* now free temp channels */
ANIM_animdata_freelist(&anim_data);
}
@@ -475,48 +475,48 @@ static void recalcData_nla(TransInfo *t)
PointerRNA strip_ptr;
short pExceeded, nExceeded, iter;
int delta_y1, delta_y2;
-
+
/* if this tdn has no handles, that means it is just a dummy that should be skipped */
if (tdn->handle == 0)
continue;
-
+
/* set refresh tags for objects using this animation,
- * BUT only if realtime updates are enabled
+ * BUT only if realtime updates are enabled
*/
if ((snla->flag & SNLA_NOREALTIMEUPDATES) == 0)
ANIM_id_update(t->scene, tdn->id);
-
+
/* if canceling transform, just write the values without validating, then move on */
if (t->state == TRANS_CANCEL) {
/* clear the values by directly overwriting the originals, but also need to restore
* endpoints of neighboring transition-strips
*/
-
+
/* start */
strip->start = tdn->h1[0];
-
+
if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION))
strip->prev->end = tdn->h1[0];
-
+
/* end */
strip->end = tdn->h2[0];
-
+
if ((strip->next) && (strip->next->type == NLASTRIP_TYPE_TRANSITION))
strip->next->start = tdn->h2[0];
-
+
/* flush transforms to child strips (since this should be a meta) */
BKE_nlameta_flush_transforms(strip);
-
+
/* restore to original track (if needed) */
if (tdn->oldTrack != tdn->nlt) {
/* just append to end of list for now, since strips get sorted in special_aftertrans_update() */
BLI_remlink(&tdn->nlt->strips, strip);
BLI_addtail(&tdn->oldTrack->strips, strip);
}
-
+
continue;
}
-
+
/* firstly, check if the proposed transform locations would overlap with any neighboring strips
* (barring transitions) which are absolute barriers since they are not being moved
*
@@ -525,7 +525,7 @@ static void recalcData_nla(TransInfo *t)
for (iter = 0; iter < 5; iter++) {
pExceeded = ((strip->prev) && (strip->prev->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h1[0] < strip->prev->end));
nExceeded = ((strip->next) && (strip->next->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h2[0] > strip->next->start));
-
+
if ((pExceeded && nExceeded) || (iter == 4)) {
/* both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise)
* - simply crop strip to fit within the bounds of the strips bounding it
@@ -543,21 +543,21 @@ static void recalcData_nla(TransInfo *t)
else if (nExceeded) {
/* move backwards */
float offset = tdn->h2[0] - strip->next->start;
-
+
tdn->h1[0] -= offset;
tdn->h2[0] -= offset;
}
else if (pExceeded) {
/* more forwards */
float offset = strip->prev->end - tdn->h1[0];
-
+
tdn->h1[0] += offset;
tdn->h2[0] += offset;
}
else /* all is fine and well */
break;
}
-
+
/* handle auto-snapping
* NOTE: only do this when transform is still running, or we can't restore
*/
@@ -570,7 +570,7 @@ static void recalcData_nla(TransInfo *t)
tdn->h2[0] = floorf(tdn->h2[0] + 0.5f);
break;
}
-
+
case SACTSNAP_SECOND: /* snap to nearest second */
case SACTSNAP_TSTEP: /* second step - this is basically the same, since we don't have any remapping going on */
{
@@ -585,12 +585,12 @@ static void recalcData_nla(TransInfo *t)
*/
float h1_new = (float)(floor(((double)tdn->h1[0] / secf) + 0.5) * secf);
float delta = h1_new - tdn->h1[0];
-
+
tdn->h1[0] = h1_new;
tdn->h2[0] += delta;
break;
}
-
+
case SACTSNAP_MARKER: /* snap to nearest marker */
{
tdn->h1[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h1[0]);
@@ -599,36 +599,36 @@ static void recalcData_nla(TransInfo *t)
}
}
}
-
+
/* Use RNA to write the values to ensure that constraints on these are obeyed
* (e.g. for transition strips, the values are taken from the neighbors)
- *
+ *
* NOTE: we write these twice to avoid truncation errors which can arise when
- * moving the strips a large distance using numeric input [#33852]
+ * moving the strips a large distance using numeric input [#33852]
*/
RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr);
-
+
RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]);
RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]);
-
+
RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]);
RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]);
-
+
/* flush transforms to child strips (since this should be a meta) */
BKE_nlameta_flush_transforms(strip);
-
-
+
+
/* now, check if we need to try and move track
* - we need to calculate both, as only one may have been altered by transform if only 1 handle moved
*/
delta_y1 = ((int)tdn->h1[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex);
delta_y2 = ((int)tdn->h2[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex);
-
+
if (delta_y1 || delta_y2) {
NlaTrack *track;
int delta = (delta_y2) ? delta_y2 : delta_y1;
int n;
-
+
/* move in the requested direction, checking at each layer if there's space for strip to pass through,
* stopping on the last track available or that we're able to fit in
*/
@@ -639,7 +639,7 @@ static void recalcData_nla(TransInfo *t)
/* move strip to this track */
BLI_remlink(&tdn->nlt->strips, strip);
BKE_nlatrack_add_strip(track, strip);
-
+
tdn->nlt = track;
tdn->trackIndex++;
}
@@ -650,14 +650,14 @@ static void recalcData_nla(TransInfo *t)
else {
/* make delta 'positive' before using it, since we now know to go backwards */
delta = -delta;
-
+
for (track = tdn->nlt->prev, n = 0; (track) && (n < delta); track = track->prev, n++) {
/* check if space in this track for the strip */
if (BKE_nlatrack_has_space(track, strip->start, strip->end)) {
/* move strip to this track */
BLI_remlink(&tdn->nlt->strips, strip);
BKE_nlatrack_add_strip(track, strip);
-
+
tdn->nlt = track;
tdn->trackIndex--;
}
@@ -689,7 +689,7 @@ static void recalcData_image(TransInfo *t)
}
else if ((t->flag & T_EDIT) && t->obedit_type == OB_MESH) {
SpaceImage *sima = t->sa->spacedata.first;
-
+
flushTransUVs(t);
if (sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_re_solve();
@@ -968,7 +968,7 @@ static void recalcData_objects(TransInfo *t)
}
else {
int i;
-
+
if (t->state != TRANS_CANCEL) {
applyProject(t);
}
@@ -1102,15 +1102,15 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
if (t->spacetype == SPACE_VIEW3D) {
View3D *v3d = t->view;
-
+
gpuPushMatrix();
copy_v3_v3(v3, dir);
mul_v3_fl(v3, v3d->far);
-
+
sub_v3_v3v3(v2, center, v3);
add_v3_v3v3(v1, center, v3);
-
+
if (options & DRAWLIGHT) {
col[0] = col[1] = col[2] = 220;
}
@@ -1239,7 +1239,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->reports = op ? op->reports : NULL;
t->helpline = HLP_NONE;
-
+
t->flag = 0;
t->obedit_type = (object_mode == OB_MODE_EDIT) ? object_type : -1;
@@ -1251,7 +1251,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
t->redraw = TREDRAW_HARD; /* redraw first time */
-
+
if (event) {
t->mouse.imval[0] = event->mval[0];
t->mouse.imval[1] = event->mval[1];
@@ -1260,25 +1260,25 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->mouse.imval[0] = 0;
t->mouse.imval[1] = 0;
}
-
+
t->con.imval[0] = t->mouse.imval[0];
t->con.imval[1] = t->mouse.imval[1];
-
+
t->mval[0] = t->mouse.imval[0];
t->mval[1] = t->mouse.imval[1];
-
+
t->transform = NULL;
t->handleEvent = NULL;
-
+
t->data_len_all = 0;
-
+
t->val = 0.0f;
zero_v3(t->vec);
zero_v3(t->center_global);
unit_m3(t->mat);
-
+
/* if there's an event, we're modal */
if (event) {
t->flag |= T_MODAL;
@@ -1296,7 +1296,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->remove_on_cancel = true;
}
}
-
+
/* GPencil editing context */
if ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)) {
t->options |= CTX_GPENCIL_STROKES;
@@ -1333,10 +1333,10 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
if (t->spacetype == SPACE_VIEW3D) {
View3D *v3d = sa->spacedata.first;
bScreen *animscreen = ED_screen_animation_playing(CTX_wm_manager(C));
-
+
t->view = v3d;
t->animtimer = (animscreen) ? animscreen->animtimer : NULL;
-
+
/* turn manipulator off during transform */
if (t->flag & T_MODAL) {
t->twflag = v3d->twflag;
@@ -1493,7 +1493,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->mirror = 1;
}
}
-
+
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
if (op && (prop = RNA_struct_find_property(op->ptr, "proportional"))) {
if (RNA_property_is_set(op->ptr, prop)) {
@@ -1530,7 +1530,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
}
-
+
if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) &&
RNA_property_is_set(op->ptr, prop)))
{
@@ -1539,14 +1539,14 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
else {
t->prop_size = ts->proportional_size;
}
-
-
+
+
/* TRANSFORM_FIX_ME rna restrictions */
if (t->prop_size <= 0.00001f) {
printf("Proportional size (%f) under 0.00001, resetting to 1!\n", t->prop_size);
t->prop_size = 1.0f;
}
-
+
if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) &&
RNA_property_is_set(op->ptr, prop)))
{
@@ -1559,7 +1559,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
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 0
if (t->flag & T_PROP_EDIT) {
@@ -1650,12 +1650,12 @@ void postTrans(bContext *C, TransInfo *t)
}
}
MEM_freeN(tc->data);
-
+
MEM_SAFE_FREE(tc->data_ext);
MEM_SAFE_FREE(tc->data_2d);
}
}
-
+
MEM_SAFE_FREE(t->data_container);
t->data_container = NULL;
@@ -1678,7 +1678,7 @@ void postTrans(bContext *C, TransInfo *t)
v3d->twflag = t->twflag;
}
}
-
+
if (t->mouse.data) {
MEM_freeN(t->mouse.data);
}
@@ -1732,7 +1732,7 @@ static void restoreElement(TransData *td)
copy_qt_qt(td->ext->quat, td->ext->iquat);
}
}
-
+
if (td->flag & TD_BEZTRIPLE) {
*(td->hdata->h1) = td->hdata->ih1;
*(td->hdata->h2) = td->hdata->ih2;
@@ -1764,7 +1764,7 @@ void restoreTransObjects(TransInfo *t)
unit_m3(t->mat);
}
-
+
recalcData(t);
}
@@ -1792,10 +1792,10 @@ void calculateCenterLocal(
void calculateCenterCursor(TransInfo *t, float r_center[3])
{
const float *cursor;
-
+
cursor = ED_view3d_cursor3d_get(t->scene, t->view)->location;
copy_v3_v3(r_center, cursor);
-
+
/* If edit or pose mode, move cursor in local space */
if (t->options & CTX_PAINT_CURVE) {
if (ED_view3d_project_float_global(t->ar, cursor, r_center, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) {
@@ -1809,7 +1809,7 @@ void calculateCenterCursor(TransInfo *t, float r_center[3])
void calculateCenterCursor2D(TransInfo *t, float r_center[2])
{
const float *cursor = NULL;
-
+
if (t->spacetype == SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first;
cursor = sima->cursor;
@@ -1855,7 +1855,7 @@ void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2])
{
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
Scene *scene = t->scene;
-
+
/* cursor is combination of current frame, and graph-editor cursor value */
if (sipo->mode == SIPO_MODE_DRIVERS) {
r_center[0] = sipo->cursorTime;
@@ -2031,20 +2031,20 @@ void calculateCenter(TransInfo *t)
/* for panning from cameraview */
if ((t->flag & T_OBJECT) && (t->flag & T_OVERRIDE_CENTER) == 0) {
if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
-
+
if (t->flag & T_CAMERA) {
float axis[3];
/* persinv is nasty, use viewinv instead, always right */
copy_v3_v3(axis, t->viewinv[2]);
normalize_v3(axis);
-
+
/* 6.0 = 6 grid units */
axis[0] = t->center_global[0] - 6.0f * axis[0];
axis[1] = t->center_global[1] - 6.0f * axis[1];
axis[2] = t->center_global[2] - 6.0f * axis[2];
-
+
projectFloatView(t, axis, t->center2d);
-
+
/* rotate only needs correct 2d center, grab needs ED_view3d_calc_zfac() value */
if (t->mode == TFM_TRANSLATION) {
copy_v3_v3(t->center_global, axis);
@@ -2052,7 +2052,7 @@ void calculateCenter(TransInfo *t)
}
}
}
-
+
if (t->spacetype == SPACE_VIEW3D) {
/* ED_view3d_calc_zfac() defines a factor for perspective depth correction, used in ED_view3d_win_to_delta() */
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 3e4efaa939b..2004bba4f09 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -40,7 +40,7 @@
#include "transform.h"
-#include "MEM_guardedalloc.h"
+#include "MEM_guardedalloc.h"
/* ************************** INPUT FROM MOUSE *************************** */
@@ -128,7 +128,7 @@ void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, const int mval_start[
int *data;
mi->data = MEM_reallocN(mi->data, sizeof(int) * 4);
-
+
data = mi->data;
data[0] = mval_start[0];
@@ -143,7 +143,7 @@ static void InputCustomRatioFlip(TransInfo *UNUSED(t), MouseInput *mi, const dou
double distance;
double dx, dy;
const int *data = mi->data;
-
+
if (data) {
int mdx, mdy;
dx = data[2] - data[0];
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 870c0e36a3b..36c444a0ca3 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -262,7 +262,7 @@ static int create_orientation_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C));
-
+
return OPERATOR_FINISHED;
}
@@ -466,7 +466,7 @@ static int transform_exec(bContext *C, wmOperator *op)
transformEnd(C, t);
transformops_exit(C, op);
-
+
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@@ -549,7 +549,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
RNA_def_property_flag(prop, PROP_HIDDEN);
prop = RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(prop, PROP_HIDDEN);
-
+
if (flags & P_ALIGN_SNAP) {
prop = RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -558,11 +558,11 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
}
}
-
+
if (flags & P_GPENCIL_EDIT) {
RNA_def_boolean(ot->srna, "gpencil_strokes", 0, "Edit Grease Pencil", "Edit selected Grease Pencil strokes");
}
-
+
if ((flags & P_OPTIONS) && !(flags & P_NO_TEXSPACE)) {
RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
prop = RNA_def_boolean(ot->srna, "remove_on_cancel", 0, "Remove on Cancel", "Remove elements on cancel");
@@ -616,7 +616,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Resize";
- ot->description = "Scale (resize) selected items";
+ ot->description = "Scale (resize) selected items";
ot->idname = OP_RESIZE;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@@ -649,7 +649,7 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Skin Resize";
- ot->description = "Scale selected vertices' skin radii";
+ ot->description = "Scale selected vertices' skin radii";
ot->idname = OP_SKIN_RESIZE;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@@ -720,7 +720,7 @@ static void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
/* optional -
* "Tilt selected vertices"
* "Specify an extra axis rotation for selected vertices of 3D curve" */
- ot->description = "Tilt selected control vertices of 3D curve";
+ ot->description = "Tilt selected control vertices of 3D curve";
ot->idname = OP_TILT;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@@ -833,7 +833,7 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "To Sphere";
- //added "around mesh center" to differentiate between "MESH_OT_vertices_to_sphere()"
+ //added "around mesh center" to differentiate between "MESH_OT_vertices_to_sphere()"
ot->description = "Move selected vertices outward in a spherical shape around mesh center";
ot->idname = OP_TOSPHERE;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@@ -876,7 +876,7 @@ static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
/* identifiers */
ot->name = "Edge Slide";
- ot->description = "Slide an edge loop along a mesh";
+ ot->description = "Slide an edge loop along a mesh";
ot->idname = OP_EDGE_SLIDE;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@@ -1067,7 +1067,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
{
wmKeyMapItem *kmi;
wmKeyMap *modalmap;
-
+
/* transform.c, only adds modal map once, checks if it's there */
modalmap = transform_modal_keymap(keyconf);
@@ -1080,7 +1080,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
}
WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform");
}
-
+
switch (spaceid) {
case SPACE_VIEW3D:
WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
@@ -1125,41 +1125,41 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
case SPACE_ACTION:
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
-
+
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
-
+
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
-
+
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
-
+
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SLIDE);
break;
case SPACE_IPO:
WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
-
+
WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
-
+
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
-
+
WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
-
+
WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
break;
case SPACE_NLA:
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
-
+
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
-
+
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
-
+
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
break;
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index aeea8930ccb..19df46455d7 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -192,14 +192,14 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports,
int type;
type = getTransformOrientation(C, normal, plane);
-
+
switch (type) {
case ORIENTATION_VERT:
if (createSpaceNormal(mat, normal) == 0) {
BKE_reports_prepend(reports, "Cannot use vertex with zero-length normal");
return NULL;
}
-
+
if (name[0] == 0) {
name = "Vertex";
}
@@ -209,7 +209,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports,
BKE_reports_prepend(reports, "Cannot use zero-length edge");
return NULL;
}
-
+
if (name[0] == 0) {
name = "Edge";
}
@@ -219,7 +219,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports,
BKE_reports_prepend(reports, "Cannot use zero-area face");
return NULL;
}
-
+
if (name[0] == 0) {
name = "Face";
}
@@ -234,7 +234,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports,
bool createSpaceNormal(float mat[3][3], const float normal[3])
{
float tangent[3] = {0.0f, 0.0f, 1.0f};
-
+
copy_v3_v3(mat[2], normal);
if (normalize_v3(mat[2]) == 0.0f) {
return false; /* error return */
@@ -250,7 +250,7 @@ bool createSpaceNormal(float mat[3][3], const float normal[3])
cross_v3_v3v3(mat[1], mat[2], mat[0]);
normalize_m3(mat);
-
+
return true;
}
@@ -276,13 +276,13 @@ bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const floa
if (normalize_v3(mat[0]) == 0.0f) {
return false; /* error return */
}
-
+
cross_v3_v3v3(mat[1], mat[2], mat[0]);
normalize_v3(mat[1]);
/* final matrix must be normalized, do inline */
// normalize_m3(mat);
-
+
return true;
}
@@ -406,7 +406,7 @@ static int count_bone_select(bArmature *arm, ListBase *lb, const bool do_it)
Bone *bone;
bool do_next;
int total = 0;
-
+
for (bone = lb->first; bone; bone = bone->next) {
bone->flag &= ~BONE_TRANSFORM;
do_next = do_it;
@@ -423,7 +423,7 @@ static int count_bone_select(bArmature *arm, ListBase *lb, const bool do_it)
}
total += count_bone_select(arm, &bone->childbase, do_next);
}
-
+
return total;
}
@@ -454,7 +454,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
ATTR_FALLTHROUGH; /* we define 'normal' as 'local' in Object mode */
case V3D_MANIP_LOCAL:
BLI_strncpy(t->spacename, IFACE_("local"), sizeof(t->spacename));
-
+
if (ob) {
copy_m3_m4(t->spacemtx, ob->obmat);
normalize_m3(t->spacemtx);
@@ -462,9 +462,9 @@ void initTransformOrientation(bContext *C, TransInfo *t)
else {
unit_m3(t->spacemtx);
}
-
+
break;
-
+
case V3D_MANIP_VIEW:
if ((t->spacetype == SPACE_VIEW3D) &&
(t->ar->regiontype == RGN_TYPE_WINDOW))
@@ -595,10 +595,10 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
if (obedit) {
float imat[3][3], mat[3][3];
-
+
/* we need the transpose of the inverse for a normal... */
copy_m3_m4(imat, ob->obmat);
-
+
invert_m3_m3(mat, imat);
transpose_m3(mat);
@@ -608,12 +608,12 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
BMEditMesh *em = BKE_editmesh_from_object(ob);
BMEditSelection ese;
float vec[3] = {0, 0, 0};
-
+
/* USE LAST SELECTED WITH ACTIVE */
if (activeOnly && BM_select_history_active_get(em->bm, &ese)) {
BM_editselection_normal(&ese, normal);
BM_editselection_plane(&ese, plane);
-
+
switch (ese.htype) {
case BM_VERT:
result = ORIENTATION_VERT;
@@ -638,7 +638,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
add_v3_v3(plane, vec);
}
}
-
+
result = ORIENTATION_FACE;
}
else if (em->bm->totvertsel == 3) {
@@ -699,7 +699,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
else if (em->bm->totedgesel == 1 || em->bm->totvertsel == 2) {
BMVert *v_pair[2] = {NULL, NULL};
BMEdge *eed = NULL;
-
+
if (em->bm->totedgesel == 1) {
if (bm_mesh_edges_select_get_n(em->bm, &eed, 1) == 1) {
v_pair[0] = eed->v1;
@@ -929,7 +929,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
}
}
}
-
+
if (!is_zero_v3(normal)) {
result = ORIENTATION_FACE;
}
@@ -939,7 +939,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
MetaElem *ml;
bool ok = false;
float tmat[3][3];
-
+
if (activeOnly && (ml = mb->lastelem)) {
quat_to_mat3(tmat, ml->quat);
add_v3_v3(normal, tmat[2]);
@@ -987,7 +987,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
}
}
}
-
+
if (ok) {
if (!is_zero_v3(plane)) {
result = ORIENTATION_EDGE;
@@ -1044,12 +1044,12 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
if (ok) {
/* we need the transpose of the inverse for a normal... */
copy_m3_m4(imat, ob->obmat);
-
+
invert_m3_m3(mat, imat);
transpose_m3(mat);
mul_m3_v3(mat, normal);
mul_m3_v3(mat, plane);
-
+
result = ORIENTATION_EDGE;
}
}
@@ -1073,14 +1073,14 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
}
}
}
-
+
if (ob) {
copy_v3_v3(normal, ob->obmat[2]);
copy_v3_v3(plane, ob->obmat[1]);
}
result = ORIENTATION_NORMAL;
}
-
+
return result;
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 7eff1b33acc..681f955087a 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -114,12 +114,12 @@ static NodeBorder snapNodeBorder(int snap_node_mode);
int BIF_snappingSupported(Object *obedit)
{
int status = 0;
-
+
/* only support object mesh, armature, curves */
if (obedit == NULL || ELEM(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE, OB_MBALL)) {
status = 1;
}
-
+
return status;
}
#endif
@@ -139,19 +139,19 @@ bool activeSnap(TransInfo *t)
void drawSnapping(const struct bContext *C, TransInfo *t)
{
unsigned char col[4], selectedCol[4], activeCol[4];
-
+
if (!activeSnap(t))
return;
-
+
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
col[3] = 128;
-
+
UI_GetThemeColor3ubv(TH_SELECT, selectedCol);
selectedCol[3] = 128;
-
+
UI_GetThemeColor3ubv(TH_ACTIVE, activeCol);
activeCol[3] = 192;
-
+
if (t->spacetype == SPACE_VIEW3D) {
if (validSnap(t)) {
TransSnapPoint *p;
@@ -159,11 +159,11 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
RegionView3D *rv3d = CTX_wm_region_view3d(C);
float imat[4][4];
float size;
-
+
glDisable(GL_DEPTH_TEST);
-
+
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
-
+
invert_m4_m4(imat, rv3d->viewmat);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
@@ -177,20 +177,20 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
else {
immUniformColor4ubv(col);
}
-
+
imm_drawcircball(p->co, ED_view3d_pixel_size(rv3d, p->co) * size * 0.75f, imat, pos);
}
-
+
if (t->tsnap.status & POINT_INIT) {
immUniformColor4ubv(activeCol);
-
+
imm_drawcircball(t->tsnap.snapPoint, ED_view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat, pos);
}
-
+
/* draw normal if needed */
if (usingSnappingNormal(t) && validSnappingNormal(t)) {
immUniformColor4ubv(activeCol);
-
+
immBegin(GWN_PRIM_LINES, 2);
immVertex3f(pos, t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
immVertex3f(pos, t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
@@ -216,11 +216,11 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
ARegion *ar = CTX_wm_region(C);
TransSnapPoint *p;
float size;
-
+
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
-
+
glEnable(GL_BLEND);
-
+
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -232,13 +232,13 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
else {
immUniformColor4ubv(col);
}
-
+
ED_node_draw_snap(&ar->v2d, p->co, size, 0, pos);
}
-
+
if (t->tsnap.status & POINT_INIT) {
immUniformColor4ubv(activeCol);
-
+
ED_node_draw_snap(&ar->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder, pos);
}
@@ -264,7 +264,7 @@ eRedrawFlag handleSnapping(TransInfo *t, const wmEvent *event)
if (event->type == MOUSEMOVE) {
status |= updateSelectedSnapPoint(t);
}
-
+
return status;
}
@@ -345,14 +345,14 @@ void applyGridAbsolute(TransInfo *t)
float grid_size = 0.0f;
GearsType grid_action;
int i;
-
+
if (!(activeSnap(t) && (ELEM(t->tsnap.mode, SCE_SNAP_MODE_INCREMENT, SCE_SNAP_MODE_GRID))))
return;
-
+
grid_action = BIG_GEARS;
if (t->modifiers & MOD_PRECISION)
grid_action = SMALL_GEARS;
-
+
switch (grid_action) {
case NO_GEARS: grid_size = t->snap_spatial[0]; break;
case BIG_GEARS: grid_size = t->snap_spatial[1]; break;
@@ -361,7 +361,7 @@ void applyGridAbsolute(TransInfo *t)
/* early exit on unusable grid size */
if (grid_size == 0.0f)
return;
-
+
FOREACH_TRANS_DATA_CONTAINER(t, tc) {
TransData *td;
@@ -404,21 +404,21 @@ void applySnapping(TransInfo *t, float *vec)
/* project is not applied this way */
if (t->tsnap.project)
return;
-
+
if (t->tsnap.status & SNAP_FORCED) {
t->tsnap.targetSnap(t);
-
+
t->tsnap.applySnap(t, vec);
}
else if (!ELEM(t->tsnap.mode, SCE_SNAP_MODE_INCREMENT, SCE_SNAP_MODE_GRID) && activeSnap(t)) {
double current = PIL_check_seconds_timer();
-
+
// 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) {
t->tsnap.calcSnap(t, vec);
t->tsnap.targetSnap(t);
-
+
t->tsnap.last = current;
}
if (validSnap(t)) {
@@ -441,7 +441,7 @@ void resetSnapping(TransInfo *t)
t->tsnap.snapNormal[0] = 0;
t->tsnap.snapNormal[1] = 0;
t->tsnap.snapNormal[2] = 0;
-
+
t->tsnap.snapNodeBorder = 0;
}
@@ -457,7 +457,7 @@ bool validSnappingNormal(TransInfo *t)
return true;
}
}
-
+
return false;
}
@@ -501,20 +501,20 @@ static void initSnappingMode(TransInfo *t)
if (t->spacetype == SPACE_NODE) {
/* force project off when not supported */
t->tsnap.project = 0;
-
+
t->tsnap.mode = ts->snap_node_mode;
}
else if (t->spacetype == SPACE_IMAGE) {
/* force project off when not supported */
t->tsnap.project = 0;
-
+
t->tsnap.mode = ts->snap_uv_mode;
}
else {
/* force project off when not supported */
if (ts->snap_mode != SCE_SNAP_MODE_FACE)
t->tsnap.project = 0;
-
+
t->tsnap.mode = ts->snap_mode;
}
@@ -556,7 +556,7 @@ static void initSnappingMode(TransInfo *t)
}
else if (t->spacetype == SPACE_NODE) {
setSnappingCallback(t);
-
+
if (t->tsnap.applySnap != NULL) {
t->tsnap.modeSelect = SNAP_NOT_SELECTED;
}
@@ -593,9 +593,9 @@ void initSnapping(TransInfo *t, wmOperator *op)
{
ToolSettings *ts = t->settings;
short snap_target = t->settings->snap_target;
-
+
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")) {
@@ -604,12 +604,12 @@ void initSnapping(TransInfo *t, wmOperator *op)
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")) {
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")) {
t->tsnap.align = RNA_boolean_get(op->ptr, "snap_align");
@@ -644,7 +644,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
t->tsnap.snap_spatial_grid = ((t->settings->snap_flag & SCE_SNAP_ABS_GRID) != 0);
}
}
-
+
t->tsnap.target = snap_target;
initSnappingMode(t);
@@ -863,24 +863,24 @@ static float RotationBetween(
sub_v3_v3v3(start, p1, t->center_global);
sub_v3_v3v3(end, p2, t->center_global);
-
+
// Angle around a constraint axis (error prone, will need debug)
if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) {
float axis[3], tmp[3];
-
+
t->con.applyRot(t, NULL, NULL, axis, NULL);
project_v3_v3v3(tmp, end, axis);
sub_v3_v3v3(end, end, tmp);
-
+
project_v3_v3v3(tmp, start, axis);
sub_v3_v3v3(start, start, tmp);
-
+
normalize_v3(end);
normalize_v3(start);
-
+
cross_v3_v3v3(tmp, start, end);
-
+
if (dot_v3v3(tmp, axis) < 0.0f)
angle = -acosf(dot_v3v3(start, end));
else
@@ -888,22 +888,22 @@ static float RotationBetween(
}
else {
float mtx[3][3];
-
+
copy_m3_m4(mtx, t->viewmat);
mul_m3_v3(mtx, end);
mul_m3_v3(mtx, start);
-
+
angle = atan2f(start[1], start[0]) - atan2f(end[1], end[0]);
}
-
+
if (angle > (float)M_PI) {
angle = angle - 2 * (float)M_PI;
}
else if (angle < -((float)M_PI)) {
angle = 2.0f * (float)M_PI + angle;
}
-
+
return angle;
}
@@ -920,7 +920,7 @@ static float ResizeBetween(TransInfo *t, const float p1[3], const float p2[3])
}
project_v3_v3v3(d1, d1, d2);
-
+
len_d1 = len_v3(d1);
/* Use 'invalid' dist when `center == p1` (after projecting),
@@ -944,10 +944,10 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
float mval[2];
bool found = false;
float dist_px = SNAP_MIN_DISTANCE; // Use a user defined value here
-
+
mval[0] = t->mval[0];
mval[1] = t->mval[1];
-
+
if (t->tsnap.mode == SCE_SNAP_MODE_VOLUME) {
found = peelObjectsTransform(
t, mval,
@@ -960,7 +960,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
t, mval, &dist_px,
loc, no);
}
-
+
if (found == true) {
copy_v3_v3(t->tsnap.snapPoint, loc);
copy_v3_v3(t->tsnap.snapNormal, no);
@@ -975,7 +975,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
/* same as above but for UV's */
Image *ima = ED_space_image(t->sa->spacedata.first);
float co[2];
-
+
UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], &co[0], &co[1]);
if (ED_uvedit_nearest_uv(t->scene, TRANS_DATA_CONTAINER_FIRST_EVIL(t)->obedit, ima, co, t->tsnap.snapPoint)) {
@@ -992,11 +992,11 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
float loc[2];
float dist_px = SNAP_MIN_DISTANCE; // Use a user defined value here
char node_border;
-
+
if (snapNodesTransform(t, t->mval, loc, &dist_px, &node_border)) {
copy_v2_v2(t->tsnap.snapPoint, loc);
t->tsnap.snapNodeBorder = node_border;
-
+
t->tsnap.status |= POINT_INIT;
}
else {
@@ -1014,7 +1014,7 @@ static void TargetSnapOffset(TransInfo *t, TransData *td)
char border = t->tsnap.snapNodeBorder;
float width = BLI_rctf_size_x(&node->totr);
float height = BLI_rctf_size_y(&node->totr);
-
+
#ifdef USE_NODE_CENTER
if (border & NODE_LEFT)
t->tsnap.snapTarget[0] -= 0.5f * width;
@@ -1043,7 +1043,7 @@ static void TargetSnapCenter(TransInfo *t)
if ((t->tsnap.status & TARGET_INIT) == 0) {
copy_v3_v3(t->tsnap.snapTarget, t->center_global);
TargetSnapOffset(t, NULL);
-
+
t->tsnap.status |= TARGET_INIT;
}
}
@@ -1094,9 +1094,9 @@ static void TargetSnapMedian(TransInfo *t)
}
mul_v3_fl(t->tsnap.snapTarget, 1.0 / i_accum);
-
+
TargetSnapOffset(t, NULL);
-
+
t->tsnap.status |= TARGET_INIT;
}
}
@@ -1107,7 +1107,7 @@ static void TargetSnapClosest(TransInfo *t)
if (t->tsnap.status & POINT_INIT) {
float dist_closest = 0.0f;
TransData *closest = NULL;
-
+
/* Object mode */
if (t->flag & T_OBJECT) {
int i;
@@ -1183,9 +1183,9 @@ static void TargetSnapClosest(TransInfo *t)
}
}
}
-
+
TargetSnapOffset(t, closest);
-
+
t->tsnap.status |= TARGET_INIT;
}
}
@@ -1330,9 +1330,9 @@ static bool snapNode(
bool retval = false;
rcti totr;
int new_dist;
-
+
UI_view2d_view_to_region_rcti(v2d, &node->totr, &totr);
-
+
if (border & NODE_LEFT) {
new_dist = abs(totr.xmin - mval[0]);
if (new_dist < *r_dist_px) {
@@ -1342,7 +1342,7 @@ static bool snapNode(
retval = true;
}
}
-
+
if (border & NODE_RIGHT) {
new_dist = abs(totr.xmax - mval[0]);
if (new_dist < *r_dist_px) {
@@ -1352,7 +1352,7 @@ static bool snapNode(
retval = true;
}
}
-
+
if (border & NODE_BOTTOM) {
new_dist = abs(totr.ymin - mval[1]);
if (new_dist < *r_dist_px) {
@@ -1362,7 +1362,7 @@ static bool snapNode(
retval = true;
}
}
-
+
if (border & NODE_TOP) {
new_dist = abs(totr.ymax - mval[1]);
if (new_dist < *r_dist_px) {
@@ -1372,7 +1372,7 @@ static bool snapNode(
retval = true;
}
}
-
+
return retval;
}
@@ -1384,15 +1384,15 @@ static bool snapNodes(
bNodeTree *ntree = snode->edittree;
bNode *node;
bool retval = false;
-
+
*r_node_border = 0;
-
+
for (node = ntree->nodes.first; node; node = node->next) {
if (snapNodeTest(&ar->v2d, node, snap_select)) {
retval |= snapNode(ts, snode, ar, node, mval, r_loc, r_dist_px, r_node_border);
}
}
-
+
return retval;
}
@@ -1417,7 +1417,7 @@ void snapGridIncrementAction(TransInfo *t, float *val, GearsType action)
fac[NO_GEARS] = t->snap[0];
fac[BIG_GEARS] = t->snap[1];
fac[SMALL_GEARS] = t->snap[2];
-
+
applyGridIncrement(t, val, t->idx_max, fac, action);
}