[Bf-blender-cvs] [bbc4a92] master: Curve selection, de-duplicate & cleanup
Campbell Barton
noreply at git.blender.org
Thu Jul 9 06:43:47 CEST 2015
Commit: bbc4a92318758ae104f796f62c7dceb1a972da44
Author: Campbell Barton
Date: Thu Jul 9 14:31:27 2015 +1000
Branches: master
https://developer.blender.org/rBbbc4a92318758ae104f796f62c7dceb1a972da44
Curve selection, de-duplicate & cleanup
===================================================================
M source/blender/blenkernel/intern/fcurve.c
M source/blender/editors/animation/keyframes_draw.c
M source/blender/editors/animation/keyframes_edit.c
M source/blender/editors/animation/keyframes_general.c
M source/blender/editors/armature/pose_slide.c
M source/blender/editors/curve/editcurve.c
M source/blender/editors/curve/editcurve_select.c
M source/blender/editors/include/ED_curve.h
M source/blender/editors/include/ED_keyframes_edit.h
M source/blender/editors/object/object_hook.c
M source/blender/editors/object/object_relations.c
M source/blender/editors/render/render_shading.c
M source/blender/editors/sculpt_paint/paint_curve.c
M source/blender/editors/space_graph/graph_buttons.c
M source/blender/editors/space_graph/graph_draw.c
M source/blender/editors/space_graph/graph_select.c
M source/blender/editors/transform/transform_conversions.c
M source/blender/editors/transform/transform_generics.c
M source/blender/makesdna/DNA_curve_types.h
===================================================================
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 077afe5..7f94ec1 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -539,7 +539,7 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple
/* find first selected */
bezt = fcu->bezt;
for (i = 0; i < fcu->totvert; bezt++, i++) {
- if (BEZSELECTED(bezt)) {
+ if (BEZT_ISSEL_ANY(bezt)) {
*first = bezt;
found = true;
break;
@@ -549,7 +549,7 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple
/* find last selected */
bezt = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, fcu->totvert);
for (i = 0; i < fcu->totvert; bezt--, i++) {
- if (BEZSELECTED(bezt)) {
+ if (BEZT_ISSEL_ANY(bezt)) {
*last = bezt;
found = true;
break;
@@ -603,7 +603,7 @@ bool calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
BezTriple *bezt, *prevbezt = NULL;
for (bezt = fcu->bezt, i = 0; i < fcu->totvert; prevbezt = bezt, bezt++, i++) {
- if ((do_sel_only == false) || BEZSELECTED(bezt)) {
+ if ((do_sel_only == false) || BEZT_ISSEL_ANY(bezt)) {
/* keyframe itself */
yminv = min_ff(yminv, bezt->vec[1][1]);
ymaxv = max_ff(ymaxv, bezt->vec[1][1]);
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 9e38dd5..6f1883c 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -105,7 +105,7 @@ static DLRBT_Node *nalloc_ak_bezt(void *data)
/* store settings based on state of BezTriple */
ak->cfra = bezt->vec[1][0];
- ak->sel = BEZSELECTED(bezt) ? SELECT : 0;
+ ak->sel = BEZT_ISSEL_ANY(bezt) ? SELECT : 0;
ak->key_type = BEZKEYTYPE(bezt);
/* set 'modified', since this is used to identify long keyframes */
@@ -121,7 +121,7 @@ static void nupdate_ak_bezt(void *node, void *data)
BezTriple *bezt = (BezTriple *)data;
/* set selection status and 'touched' status */
- if (BEZSELECTED(bezt)) ak->sel = SELECT;
+ if (BEZT_ISSEL_ANY(bezt)) ak->sel = SELECT;
ak->modified += 1;
/* for keyframe type, 'proper' keyframes have priority over breakdowns (and other types for now) */
@@ -279,7 +279,7 @@ static ActKeyBlock *bezts_to_new_actkeyblock(BezTriple *prev, BezTriple *beztn)
ab->end = beztn->vec[1][0];
ab->val = beztn->vec[1][1];
- ab->sel = (BEZSELECTED(prev) || BEZSELECTED(beztn)) ? SELECT : 0;
+ ab->sel = (BEZT_ISSEL_ANY(prev) || BEZT_ISSEL_ANY(beztn)) ? SELECT : 0;
ab->modified = 1;
return ab;
@@ -340,7 +340,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, BezTriple *first_bezt
*/
if (IS_EQT(ab->start, prev->vec[1][0], BEZT_BINARYSEARCH_THRESH)) {
/* set selection status and 'touched' status */
- if (BEZSELECTED(beztn)) ab->sel = SELECT;
+ if (BEZT_ISSEL_ANY(beztn)) ab->sel = SELECT;
ab->modified++;
/* done... no need to insert */
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index ee1bfdf..bd34f32 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -455,7 +455,7 @@ static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
/* this macro checks all beztriple handles for selection...
* only one of the verts has to be selected for this to be ok...
*/
- if (BEZSELECTED(bezt))
+ if (BEZT_ISSEL_ANY(bezt))
return KEYFRAME_OK_ALL;
else
return 0;
@@ -1181,7 +1181,7 @@ static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt)
bezt->f3 |= SELECT;
}
else {
- BEZ_SEL(bezt);
+ BEZT_SEL_ALL(bezt);
}
return 0;
@@ -1199,7 +1199,7 @@ static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt)
bezt->f3 &= ~SELECT;
}
else {
- BEZ_DESEL(bezt);
+ BEZT_DESEL_ALL(bezt);
}
return 0;
@@ -1252,7 +1252,7 @@ static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt)
int i = ked->curIndex;
/* if current is selected, just make sure it stays this way */
- if (BEZSELECTED(bezt)) {
+ if (BEZT_ISSEL_ANY(bezt)) {
map[i] = 1;
return 0;
}
@@ -1261,7 +1261,7 @@ static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt)
if (i > 0) {
BezTriple *prev = bezt - 1;
- if (BEZSELECTED(prev)) {
+ if (BEZT_ISSEL_ANY(prev)) {
map[i] = 1;
return 0;
}
@@ -1271,7 +1271,7 @@ static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt)
if (i < (fcu->totvert - 1)) {
BezTriple *next = bezt + 1;
- if (BEZSELECTED(next)) {
+ if (BEZT_ISSEL_ANY(next)) {
map[i] = 1;
return 0;
}
@@ -1289,12 +1289,12 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
/* if current is selected, check the left/right keyframes
* since it might need to be deselected (but otherwise no)
*/
- if (BEZSELECTED(bezt)) {
+ if (BEZT_ISSEL_ANY(bezt)) {
/* if previous is not selected, we're on the tip of an iceberg */
if (i > 0) {
BezTriple *prev = bezt - 1;
- if (BEZSELECTED(prev) == 0)
+ if (BEZT_ISSEL_ANY(prev) == 0)
return 0;
}
else if (i == 0) {
@@ -1306,7 +1306,7 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
if (i < (fcu->totvert - 1)) {
BezTriple *next = bezt + 1;
- if (BEZSELECTED(next) == 0)
+ if (BEZT_ISSEL_ANY(next) == 0)
return 0;
}
else if (i == (fcu->totvert - 1)) {
@@ -1344,10 +1344,10 @@ short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt)
/* select or deselect based on whether the map allows it or not */
if (on) {
- BEZ_SEL(bezt);
+ BEZT_SEL_ALL(bezt);
}
else {
- BEZ_DESEL(bezt);
+ BEZT_DESEL_ALL(bezt);
}
return 0;
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index b3dc002..c198184 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -167,11 +167,11 @@ void duplicate_fcurve_keys(FCurve *fcu)
fcu->bezt = newbezt;
/* Unselect the current key */
- BEZ_DESEL(&fcu->bezt[i]);
+ BEZT_DESEL_ALL(&fcu->bezt[i]);
i++;
/* Select the copied key */
- BEZ_SEL(&fcu->bezt[i]);
+ BEZT_SEL_ALL(&fcu->bezt[i]);
}
}
}
@@ -308,7 +308,7 @@ void smooth_fcurve(FCurve *fcu)
/* first loop through - count how many verts are selected */
bezt = fcu->bezt;
for (i = 0; i < fcu->totvert; i++, bezt++) {
- if (BEZSELECTED(bezt))
+ if (BEZT_ISSEL_ANY(bezt))
totSel++;
}
@@ -322,7 +322,7 @@ void smooth_fcurve(FCurve *fcu)
/* populate tarray with data of selected points */
bezt = fcu->bezt;
for (i = 0, x = 0; (i < fcu->totvert) && (x < totSel); i++, bezt++) {
- if (BEZSELECTED(bezt)) {
+ if (BEZT_ISSEL_ANY(bezt)) {
/* tsb simply needs pointer to vec, and index */
tsb->h1 = &bezt->vec[0][1];
tsb->h2 = &bezt->vec[1][1];
@@ -411,7 +411,7 @@ void sample_fcurve(FCurve *fcu)
/* find selected keyframes... once pair has been found, add keyframes */
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
/* check if selected, and which end this is */
- if (BEZSELECTED(bezt)) {
+ if (BEZT_ISSEL_ANY(bezt)) {
if (start) {
/* set end */
end = bezt;
@@ -576,7 +576,7 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
/* TODO: currently, we resize array every time we add a new vert -
* this works ok as long as it is assumed only a few keys are copied */
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
- if (BEZSELECTED(bezt)) {
+ if (BEZT_ISSEL_ANY(bezt)) {
/* add to buffer */
newbuf = MEM_callocN(sizeof(BezTriple) * (aci->totvert + 1), "copybuf beztriple");
@@ -589,7 +589,7 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
*nbezt = *bezt;
/* ensure copy buffer is selected so pasted keys are selected */
- BEZ_SEL(nbezt);
+ BEZT_SEL_ALL(nbezt);
/* free old array and set the new */
if (aci->bezt) MEM_freeN(aci->bezt);
@@ -776,7 +776,7 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float
/* First de-select existing FCurve's keyframes */
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
- BEZ_DESEL(bezt);
+ BEZT_DESEL_ALL(bezt);
}
/* mix mode with existing data */
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index d583fd8..40328e0 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -1221,7 +1221,7 @@ static void pose_propagate_fcurve(wmOperator *op, Object *ob, FCurve *fcu,
}
else if (mode == POSE_PROPAGATE_SELECTED_KEYS) {
/* only allow if this keyframe is already selected - skip otherwise */
- if (BEZSELECTED(bezt) == 0)
+ if (BEZT_ISSEL_ANY(bezt) == 0)
continue;
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index d17c05a..b468ac3 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -107,58 +107,6 @@ ListBase *object_editcurve_get(Object *ob)
return NULL;
}
-/* ******************* SELECTION FUNCTIONS ********************* */
-
-int isNurbsel(Nurb *nu)
-{
- BezTriple *bezt;
- BPoint *bp;
- int a;
-
- if (nu->type == CU_BEZIER) {
- bezt = nu->bezt;
- a = nu->pntsu;
- while (a--) {
- if ( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) return 1;
- bezt++;
- }
- }
- else {
- bp = nu->bp;
- a = nu->pntsu * nu->pntsv;
- while (a--) {
- if (bp->f1 & SELECT) return 1;
- bp++;
- }
- }
- return 0;
-}
-
-static int isNurbsel_count(Curve *cu, Nurb *nu)
-{
- BezTriple *bezt;
- BPoint *bp;
- int a, sel = 0;
-
- if (nu->type == CU_BEZIER) {
- bezt = nu->bezt;
- a = nu->pntsu;
- while (a--) {
- if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) sel++;
- bezt++;
- }
- }
- else {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list