Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-09-27 08:22:04 +0400
committerJoshua Leung <aligorith@gmail.com>2009-09-27 08:22:04 +0400
commitfbfa8d2f812095eef100b1fdd67ce766bf884844 (patch)
tree10addf45adc73c262fbb2b5e2c2f3096a6fcf8ff /source/blender/editors/space_graph
parent69995bb1b32a081dab987926e0c9f3b94cd63209 (diff)
2.5 - Assorted Animation UI/Editing Tweaks
Main Feature: * It is now possible to choose which AnimData block is the 'active' one for editing, and/or select them too. AnimData blocks are generally the dark blue and lighter-blue expanders (i.e. Scene, Object, Camera, Lamp, Curve, Armature, etc.) * Objects are no longer selected/deselected when AKEY is used to toggle selection of channels. This was getting a bit annoying. * Following on from selection of AnimData blocks, it is now possible to select/make active an AnimData block in the animation editors, and change the active action for that block via the 'Animation Data' panel in NLA Editor's properties region. --> Be aware that user-counts are not totally handled correctly there yet, so some funky behaviour might be seen... --> It is possible to assign a new action, or to assign an existing one, allowing to switch between actions as in the past with Actions/IPO Editors... Other tweaks: * Some code tweaks towards making the 'Euler Filter' feature for Graph Editor working sometime soon * Added some backend code for snapping the values of keyframes to a single value. Still need to work out some UI for it though. * Shuffled the code for ACT_OT_new() around, and removed the poll() callback so that it worked in NLA too. * Fixed some more notifier bugs with deleting bones and a few other editmode operations for Armatures.
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r--source/blender/editors/space_graph/graph_draw.c11
-rw-r--r--source/blender/editors/space_graph/graph_edit.c25
-rw-r--r--source/blender/editors/space_graph/graph_intern.h1
-rw-r--r--source/blender/editors/space_graph/graph_utils.c30
4 files changed, 55 insertions, 12 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 38430045bef..57e2208f089 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -858,9 +858,6 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
* - if the option to only show controls if the F-Curve is selected is enabled, we must obey this
*/
if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
- /* enable blending to allow fading of curves */
- glEnable(GL_BLEND);
-
if (fcurve_needs_draw_fmodifier_controls(fcu, fcm)) {
/* only draw controls if this is the active modifier */
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
@@ -874,7 +871,10 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) {
if (fcu->bezt) {
/* only draw handles/vertices on keyframes */
- draw_fcurve_handles(sipo, ar, fcu);
+ glEnable(GL_BLEND);
+ draw_fcurve_handles(sipo, ar, fcu);
+ glDisable(GL_BLEND);
+
draw_fcurve_vertices(sipo, ar, fcu);
}
else {
@@ -882,9 +882,6 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
draw_fcurve_samples(sipo, ar, fcu);
}
}
-
- /* restore settings */
- glDisable(GL_BLEND);
}
/* undo mapping of keyframes for drawing if scaled F-Curve */
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 9e0d574ffa3..9814f16de16 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -1296,8 +1296,7 @@ void GRAPH_OT_handle_type (wmOperatorType *ot)
/* set of three euler-rotation F-Curves */
typedef struct tEulerFilter {
ID *id; /* ID-block which owns the channels */
- FCurve *fcu1, *fcu2, *fcu3; /* x,y,z rotation curves */
- int i1, i2, i3; /* current index for each curve */
+ FCurve (*fcurves)[3]; /* 3 Pointers to F-Curves */
} tEulerFilter;
static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
@@ -1347,10 +1346,26 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
if ((euf) && (ale->id != euf->id)) {
}
+ else {
+ /* just add to a new block */
+ euf= MEM_callocN(sizeof(tEulerFilter), "tEulerFilter");
+ BLI_addtail(&eulers, euf);
+
+ euf->id= ale->id;
+ euf->fcurves[fcu->array_index]= fcu;
+ }
}
+ BLI_freelistN(&anim_data);
- // XXX for now
- return OPERATOR_CANCELLED;
+ /* step 2: go through each set of curves, processing the values at each keyframe
+ * - it is assumed that there must be a full set of keyframes at each keyframe position
+ */
+ for (euf= eulers.first; euf; euf= euf->next) {
+
+ }
+ BLI_freelistN(&eulers);
+
+ return OPERATOR_FINISHED;
}
void GRAPH_OT_euler_filter (wmOperatorType *ot)
@@ -1789,7 +1804,7 @@ void GRAPH_OT_fmodifier_add (wmOperatorType *ot)
/* api callbacks */
ot->invoke= graph_fmodifier_add_invoke;
ot->exec= graph_fmodifier_add_exec;
- ot->poll= graphop_active_fcurve_poll;
+ ot->poll= graphop_selected_fcurve_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index 2e8d0655d2d..83a565e485f 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -155,6 +155,7 @@ short fcurve_needs_draw_fmodifier_controls(struct FCurve *fcu, struct FModifier
int graphop_visible_keyframes_poll(struct bContext *C);
int graphop_editable_keyframes_poll(struct bContext *C);
int graphop_active_fcurve_poll(struct bContext *C);
+int graphop_selected_fcurve_poll(struct bContext *C);
/* ***************************************** */
/* graph_ops.c */
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index f00e7845549..19cffb5cde1 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -285,4 +285,34 @@ int graphop_active_fcurve_poll (bContext *C)
return has_fcurve;
}
+/* has selected F-Curve that's editable */
+int graphop_selected_fcurve_poll (bContext *C)
+{
+ bAnimContext ac;
+ bAnimListElem *ale;
+ ListBase anim_data = {NULL, NULL};
+ ScrArea *sa= CTX_wm_area(C);
+ int filter, items;
+ short found = 0;
+
+ /* firstly, check if in Graph Editor */
+ // TODO: also check for region?
+ if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ return 0;
+
+ /* try to init Anim-Context stuff ourselves and check */
+ if (ANIM_animdata_get_context(C, &ac) == 0)
+ return 0;
+
+ /* get the editable + selected F-Curves, and as long as we got some, we can return */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+ if (items == 0)
+ return 0;
+
+ /* cleanup and return findings */
+ BLI_freelistN(&anim_data);
+ return found;
+}
+
/* ************************************************************** */