[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54637] trunk/blender/source/blender/ editors: fix [#34303] Rotation fcurves don' t work with transforming with individual centers
Campbell Barton
ideasman42 at gmail.com
Mon Feb 18 17:35:14 CET 2013
Revision: 54637
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54637
Author: campbellbarton
Date: 2013-02-18 16:35:13 +0000 (Mon, 18 Feb 2013)
Log Message:
-----------
fix [#34303] Rotation fcurves don't work with transforming with individual centers
Modified Paths:
--------------
trunk/blender/source/blender/editors/animation/anim_draw.c
trunk/blender/source/blender/editors/include/ED_anim_api.h
trunk/blender/source/blender/editors/transform/transform.c
trunk/blender/source/blender/editors/transform/transform.h
trunk/blender/source/blender/editors/transform/transform_conversions.c
trunk/blender/source/blender/editors/transform/transform_generics.c
Modified: trunk/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_draw.c 2013-02-18 15:47:13 UTC (rev 54636)
+++ trunk/blender/source/blender/editors/animation/anim_draw.c 2013-02-18 16:35:13 UTC (rev 54637)
@@ -399,20 +399,23 @@
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;
}
Modified: trunk/blender/source/blender/editors/include/ED_anim_api.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_anim_api.h 2013-02-18 15:47:13 UTC (rev 54636)
+++ trunk/blender/source/blender/editors/include/ED_anim_api.h 2013-02-18 16:35:13 UTC (rev 54637)
@@ -552,7 +552,8 @@
/* 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 */
Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c 2013-02-18 15:47:13 UTC (rev 54636)
+++ trunk/blender/source/blender/editors/transform/transform.c 2013-02-18 16:35:13 UTC (rev 54637)
@@ -7388,3 +7388,10 @@
// 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));
+}
Modified: trunk/blender/source/blender/editors/transform/transform.h
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.h 2013-02-18 15:47:13 UTC (rev 54636)
+++ trunk/blender/source/blender/editors/transform/transform.h 2013-02-18 16:35:13 UTC (rev 54637)
@@ -745,4 +745,8 @@
void freeVertSlideVerts(TransInfo *t);
+
+/* TODO. transform_queries.c */
+bool checkUseLocalCenter_GraphEdit(TransInfo *t);
+
#endif
Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c 2013-02-18 15:47:13 UTC (rev 54636)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c 2013-02-18 16:35:13 UTC (rev 54637)
@@ -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 @@
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 @@
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 @@
}
/* 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 @@
/* 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 */
Modified: trunk/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_generics.c 2013-02-18 15:47:13 UTC (rev 54636)
+++ trunk/blender/source/blender/editors/transform/transform_generics.c 2013-02-18 16:35:13 UTC (rev 54637)
@@ -130,6 +130,7 @@
/* ************************** GENERICS **************************** */
+
static void clipMirrorModifier(TransInfo *t, Object *ob)
{
ModifierData *md = ob->modifiers.first;
@@ -407,7 +408,9 @@
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 */
More information about the Bf-blender-cvs
mailing list