diff options
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 17 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 3 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 7 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.h | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 16 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 5 |
6 files changed, 40 insertions, 12 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index d83d1805f0e..eb1f5ef1043 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -399,20 +399,23 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest static short bezt_unit_mapping_apply(KeyframeEditData *ked, BezTriple *bezt) { /* mapping factor is stored in f1, flags are stored in i1 */ - short only_keys = (ked->i1 & ANIM_UNITCONV_ONLYKEYS); - short sel_vs = (ked->i1 & ANIM_UNITCONV_SELVERTS); + const bool only_keys = (ked->i1 & ANIM_UNITCONV_ONLYKEYS); + const bool sel_vs = (ked->i1 & ANIM_UNITCONV_SELVERTS); + const bool skip_knot = (ked->i1 & ANIM_UNITCONV_SKIPKNOTS); float fac = ked->f1; /* adjust BezTriple handles only if allowed to */ - if (only_keys == 0) { - if ((sel_vs == 0) || (bezt->f1 & SELECT)) + if (only_keys == false) { + if ((sel_vs == false) || (bezt->f1 & SELECT)) bezt->vec[0][1] *= fac; - if ((sel_vs == 0) || (bezt->f3 & SELECT)) + if ((sel_vs == false) || (bezt->f3 & SELECT)) bezt->vec[2][1] *= fac; } - if ((sel_vs == 0) || (bezt->f2 & SELECT)) - bezt->vec[1][1] *= fac; + if (skip_knot == false) { + if ((sel_vs == false) || (bezt->f2 & SELECT)) + bezt->vec[1][1] *= fac; + } return 0; } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 551d3041398..20f568a3642 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -552,7 +552,8 @@ typedef enum eAnimUnitConv_Flags { /* only touch selected BezTriples */ ANIM_UNITCONV_ONLYSEL = (1 << 2), /* only touch selected vertices */ - ANIM_UNITCONV_SELVERTS = (1 << 3) + ANIM_UNITCONV_SELVERTS = (1 << 3), + ANIM_UNITCONV_SKIPKNOTS = (1 << 4), } eAnimUnitConv_Flags; /* Get unit conversion factor for given ID + F-Curve */ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a8efd998583..befeb2bce25 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -7388,3 +7388,10 @@ void BIF_TransformSetUndo(const char *UNUSED(str)) // TRANSFORM_FIX_ME //Trans.undostr = str; } + + +/* TODO, move to: transform_queries.c */ +bool checkUseLocalCenter_GraphEdit(TransInfo *t) +{ + return ((t->around == V3D_LOCAL) && !ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)); +} diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 4e3f2b04de0..9c57c74a26d 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -745,4 +745,8 @@ void projectEdgeSlideData(TransInfo *t, bool is_final); void freeVertSlideVerts(TransInfo *t); + +/* TODO. transform_queries.c */ +bool checkUseLocalCenter_GraphEdit(TransInfo *t); + #endif diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 7d62775ae58..32ceaf97331 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -123,6 +123,7 @@ #include "BLO_sys_types.h" // for intptr_t support + /* local function prototype - for Object/Bone Constraints */ static short constraints_list_needinv(TransInfo *t, ListBase *list); @@ -3530,7 +3531,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) int count = 0, i; float cfra; float mtx[3][3], smtx[3][3]; - const short use_handle = !(sipo->flag & SIPO_NOHANDLES); + const bool use_handle = !(sipo->flag & SIPO_NOHANDLES); + const bool use_local_center = checkUseLocalCenter_GraphEdit(t); + const 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) @@ -3662,7 +3665,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) if (fcu->bezt == NULL) continue; - ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS); + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, anim_map_flag); /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */ for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { @@ -3697,7 +3700,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) } /* only include main vert if selected */ - if (sel2 && (sipo->around != V3D_LOCAL || ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE))) { + if (sel2 && (use_local_center == false)) { /* move handles relative to center */ if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) { @@ -3733,6 +3736,13 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) /* Sets handles based on the selection */ testhandles_fcurve(fcu, use_handle); + + /* even though transform values are written back right after during transform, + * using individual center's with rotation means the center point wont + * be touched again see: [#34303] */ + if (use_local_center) { + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, anim_map_flag | ANIM_UNITCONV_RESTORE); + } } /* cleanup temp list */ diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index ef775ae3128..da761365671 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -130,6 +130,7 @@ void getViewVector(TransInfo *t, float coord[3], float vec[3]) /* ************************** GENERICS **************************** */ + static void clipMirrorModifier(TransInfo *t, Object *ob) { ModifierData *md = ob->modifiers.first; @@ -407,7 +408,9 @@ static void recalcData_graphedit(TransInfo *t) continue; // fixme: only do this for selected verts... - ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS | ANIM_UNITCONV_RESTORE); + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, + ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS | ANIM_UNITCONV_RESTORE | + (checkUseLocalCenter_GraphEdit(t) ? ANIM_UNITCONV_SKIPKNOTS : 0)); /* watch it: if the time is wrong: do not correct handles yet */ |