diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-18 20:35:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-18 20:35:13 +0400 |
commit | 9ab3d4ff1eaacb8156043ac33bca7e9ac07806e6 (patch) | |
tree | 5a09f44a9c7b9487aecf6234eaf3f40e67813109 /source/blender/editors/transform | |
parent | 4cd487d731a69b1f6c4144eebec56a28e25cd201 (diff) |
fix [#34303] Rotation fcurves don't work with transforming with individual centers
Diffstat (limited to 'source/blender/editors/transform')
4 files changed, 28 insertions, 4 deletions
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 */ |