[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33688] trunk/blender/source/blender/ editors/transform/transform_conversions.c: dont transform hidden handles in the graph editor.
Campbell Barton
ideasman42 at gmail.com
Wed Dec 15 17:07:49 CET 2010
Revision: 33688
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33688
Author: campbellbarton
Date: 2010-12-15 17:07:49 +0100 (Wed, 15 Dec 2010)
Log Message:
-----------
dont transform hidden handles in the graph editor.
Modified Paths:
--------------
trunk/blender/source/blender/editors/transform/transform_conversions.c
Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c 2010-12-15 15:59:10 UTC (rev 33687)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c 2010-12-15 16:07:49 UTC (rev 33688)
@@ -3351,7 +3351,7 @@
static void createTransGraphEditData(bContext *C, TransInfo *t)
{
- SpaceIpo *sipo= CTX_wm_space_graph(C);
+ SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
Scene *scene= t->scene;
ARegion *ar= t->ar;
View2D *v2d= &ar->v2d;
@@ -3368,6 +3368,7 @@
int count=0, i;
float cfra;
float mtx[3][3], smtx[3][3];
+ const short use_handle = !(sipo->flag & SIPO_NOHANDLES);
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -3411,13 +3412,17 @@
/* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse */
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
+ const char sel1= use_handle ? bezt->f1 & SELECT : 0;
+ const char sel2= bezt->f2 & SELECT;
+ const char sel3= use_handle ? bezt->f3 & SELECT : 0;
+
if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) {
/* for 'normal' pivots - just include anything that is selected.
this works a bit differently in translation modes */
- if (bezt->f2 & SELECT) count++;
+ if (sel2) count++;
else {
- if (bezt->f1 & SELECT) count++;
- if (bezt->f3 & SELECT) count++;
+ if (sel1) count++;
+ if (sel3) count++;
}
}
else if (sipo->around == V3D_LOCAL) {
@@ -3425,17 +3430,17 @@
* don't get moved wrong
*/
if (bezt->ipo == BEZT_IPO_BEZ) {
- if (bezt->f1 & SELECT) count++;
- if (bezt->f3 & SELECT) count++;
+ if (sel1) count++;
+ if (sel3) count++;
}
- /* else if (bezt->f2 & SELECT) count++; // TODO: could this cause problems? */
+ /* else if (sel2) count++; // TODO: could this cause problems? */
/* - yes this causes problems, because no td is created for the center point */
}
else {
/* for 'normal' pivots - just include anything that is selected */
- if (bezt->f1 & SELECT) count++;
- if (bezt->f2 & SELECT) count++;
- if (bezt->f3 & SELECT) count++;
+ if (sel1) count++;
+ if (sel2) count++;
+ if (sel3) count++;
}
}
}
@@ -3500,21 +3505,25 @@
/* 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++) {
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
+ const char sel1= use_handle ? bezt->f1 & SELECT : 0;
+ const char sel2= bezt->f2 & SELECT;
+ const char sel3= use_handle ? bezt->f3 & SELECT : 0;
+
TransDataCurveHandleFlags *hdata = NULL;
short h1=1, h2=1;
/* only include handles if selected, irrespective of the interpolation modes.
* also, only treat handles specially if the center point isn't selected.
*/
- if (!ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE) || !(bezt->f2 & SELECT)) {
- if (bezt->f1 & SELECT) {
+ if (!ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE) || !(sel2)) {
+ if (sel1) {
hdata = initTransDataCurveHandles(td, bezt);
bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals, mtx, smtx);
}
else
h1= 0;
- if (bezt->f3 & SELECT) {
+ if (sel3) {
if (hdata==NULL)
hdata = initTransDataCurveHandles(td, bezt);
bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals, mtx, smtx);
@@ -3524,16 +3533,16 @@
}
/* only include main vert if selected */
- if (bezt->f2 & SELECT && (sipo->around != V3D_LOCAL || ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE))) {
+ if (sel2 && (sipo->around != V3D_LOCAL || ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE))) {
/* move handles relative to center */
if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) {
- if (bezt->f1 & SELECT) td->flag |= TD_MOVEHANDLE1;
- if (bezt->f3 & SELECT) td->flag |= TD_MOVEHANDLE2;
+ if (sel1) td->flag |= TD_MOVEHANDLE1;
+ if (sel3) td->flag |= TD_MOVEHANDLE2;
}
/* if handles were not selected, store their selection status */
- if (!(bezt->f1 & SELECT) && !(bezt->f3 & SELECT)) {
+ if (!(sel1) && !(sel3)) {
if (hdata == NULL)
hdata = initTransDataCurveHandles(td, bezt);
}
@@ -3547,7 +3556,7 @@
* - If so, change them auto-handles to aligned handles so that handles get affected too
*/
if ((bezt->h1 == HD_AUTO) && (bezt->h2 == HD_AUTO) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
- if (hdata && (bezt->f1 & SELECT) && (bezt->f3 & SELECT)) {
+ if (hdata && (sel1) && (sel3)) {
bezt->h1= HD_ALIGN;
bezt->h2= HD_ALIGN;
}
@@ -3579,7 +3588,7 @@
/* This function converts an FCurve's BezTriple array to a BeztMap array
* NOTE: this allocates memory that will need to get freed later
*/
-static BeztMap *bezt_to_beztmaps (BezTriple *bezts, int totvert)
+static BeztMap *bezt_to_beztmaps (BezTriple *bezts, int totvert, const short UNUSED(use_handle))
{
BezTriple *bezt= bezts;
BezTriple *prevbezt= NULL;
@@ -3606,7 +3615,7 @@
}
/* This function copies the code of sort_time_ipocurve, but acts on BeztMap structs instead */
-static void sort_time_beztmaps (BeztMap *bezms, int totvert)
+static void sort_time_beztmaps (BeztMap *bezms, int totvert, const short UNUSED(use_handle))
{
BeztMap *bezm;
int i, ok= 1;
@@ -3652,7 +3661,7 @@
}
/* This function firstly adjusts the pointers that the transdata has to each BezTriple */
-static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totvert)
+static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totvert, const short use_handle)
{
BezTriple *bezts = fcu->bezt;
BeztMap *bezm;
@@ -3679,7 +3688,7 @@
/* only selected verts */
if (bezm->pipo == BEZT_IPO_BEZ) {
- if (bezm->bezt->f1 & SELECT) {
+ if (use_handle && bezm->bezt->f1 & SELECT) {
if (td->loc2d == bezm->bezt->vec[0]) {
if (bezm->swapHs == 1)
td->loc2d= (bezts + bezm->newIndex)->vec[2];
@@ -3690,7 +3699,7 @@
}
}
if (bezm->cipo == BEZT_IPO_BEZ) {
- if (bezm->bezt->f3 & SELECT) {
+ if (use_handle && bezm->bezt->f3 & SELECT) {
if (td->loc2d == bezm->bezt->vec[2]) {
if (bezm->swapHs == 1)
td->loc2d= (bezts + bezm->newIndex)->vec[0];
@@ -3728,7 +3737,9 @@
*/
void remake_graph_transdata (TransInfo *t, ListBase *anim_data)
{
+ SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
bAnimListElem *ale;
+ const short use_handle = !(sipo->flag & SIPO_NOHANDLES);
/* sort and reassign verts */
for (ale= anim_data->first; ale; ale= ale->next) {
@@ -3738,9 +3749,9 @@
BeztMap *bezm;
/* adjust transform-data pointers */
- bezm= bezt_to_beztmaps(fcu->bezt, fcu->totvert);
- sort_time_beztmaps(bezm, fcu->totvert);
- beztmap_to_data(t, fcu, bezm, fcu->totvert);
+ 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);
More information about the Bf-blender-cvs
mailing list