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-01-26 14:33:16 +0300
committerJoshua Leung <aligorith@gmail.com>2009-01-26 14:33:16 +0300
commita34e2e1427413b6e116c99e81a58d4535e521a2b (patch)
treee1434d0f2078982369d83a0a11139828eb942e99 /source/blender/editors/animation/anim_filter.c
parentbf05827319f07d7a7b34ff34d0556cb54f6284d9 (diff)
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers. Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least. It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated. Notes: * Fixed a few bugs in RNA User-Preferences wrapping * The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone? * Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed. * Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
Diffstat (limited to 'source/blender/editors/animation/anim_filter.c')
-rw-r--r--source/blender/editors/animation/anim_filter.c74
1 files changed, 53 insertions, 21 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index fc1a225eb77..361a384cf03 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -196,11 +196,40 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction)
/* ----------- Private Stuff - IPO Editor ------------- */
-/* Get data being edited in IPO Editor (depending on current 'mode') */
-static short ipoedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
+/* Get data being edited in Graph Editor (depending on current 'mode') */
+static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
{
- // XXX FIXME...
- return 0;
+ /* sync settings with current view status, then return appropriate data */
+ switch (sipo->mode) {
+ case SIPO_MODE_ANIMATION: /* Animation F-Curve Editor */
+ /* update scene-pointer (no need to check for pinning yet, as not implemented) */
+ sipo->ads->source= (ID *)ac->scene;
+ sipo->ads->filterflag &= ~ADS_FILTER_ONLYDRIVERS;
+
+ ac->datatype= ANIMCONT_FCURVES;
+ ac->data= sipo->ads;
+
+ ac->mode= sipo->mode;
+ return 1;
+
+ case SIPO_MODE_DRIVERS: /* Driver F-Curve Editor */
+ /* update scene-pointer (no need to check for pinning yet, as not implemented) */
+ sipo->ads->source= (ID *)ac->scene;
+ sipo->ads->filterflag |= ADS_FILTER_ONLYDRIVERS;
+
+ ac->datatype= ANIMCONT_FCURVES;
+ ac->data= sipo->ads;
+
+ ac->mode= sipo->mode;
+ return 1;
+
+ default: /* unhandled yet */
+ ac->datatype= ANIMCONT_NONE;
+ ac->data= NULL;
+
+ ac->mode= -1;
+ return 0;
+ }
}
/* ----------- Public API --------------- */
@@ -227,7 +256,7 @@ short ANIM_animdata_context_getdata (bAnimContext *ac)
case SPACE_IPO:
{
SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first;
- ok= ipoedit_get_context(ac, sipo);
+ ok= graphedit_get_context(ac, sipo);
}
break;
}
@@ -436,16 +465,19 @@ static int animdata_filter_fcurves (ListBase *anim_data, FCurve *first, bActionG
* NOTE: we need to check if the F-Curves belong to the same group, as this gets called for groups too...
*/
for (fcu= first; ((fcu) && (fcu->grp==grp)); fcu= fcu->next) {
- /* only work with this channel and its subchannels if it is editable */
- if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) {
- /* only include this curve if selected */
- if (!(filter_mode & ANIMFILTER_SEL) || (SEL_FCU(fcu))) {
- /* owner/ownertype will be either object or action-channel, depending if it was dopesheet or part of an action */
- ale= make_new_animlistelem(fcu, ANIMTYPE_FCURVE, owner, ownertype, owner_id);
-
- if (ale) {
- BLI_addtail(anim_data, ale);
- items++;
+ /* only include if visible (Graph Editor check, not channels check) */
+ if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
+ /* only work with this channel and its subchannels if it is editable */
+ if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) {
+ /* only include this curve if selected */
+ if (!(filter_mode & ANIMFILTER_SEL) || (SEL_FCU(fcu))) {
+ /* owner/ownertype will be either object or action-channel, depending if it was dopesheet or part of an action */
+ ale= make_new_animlistelem(fcu, ANIMTYPE_FCURVE, owner, ownertype, owner_id);
+
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
}
}
}
@@ -985,7 +1017,7 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
/* This function filters the active data source to leave only animation channels suitable for
* usage by the caller. It will return the length of the list
*
- * *act_data: is a pointer to a ListBase, to which the filtered animation channels
+ * *anim_data: is a pointer to a ListBase, to which the filtered animation channels
* will be placed for use.
* filter_mode: how should the data be filtered - bitmapping accessed flags
*/
@@ -1003,20 +1035,20 @@ int ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode
case ANIMCONT_ACTION:
items= animdata_filter_action(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE, (ID *)obact);
break;
+
case ANIMCONT_SHAPEKEY:
items= animdata_filter_shapekey(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE, (ID *)obact);
break;
+
case ANIMCONT_GPENCIL:
//items= animdata_filter_gpencil(anim_data, data, filter_mode);
break;
+
case ANIMCONT_DOPESHEET:
+ case ANIMCONT_FCURVES:
+ case ANIMCONT_DRIVERS:
items= animdata_filter_dopesheet(anim_data, data, filter_mode);
break;
-
- case ANIMCONT_IPO:
- // FIXME: this will be used for showing a single IPO-block (not too useful from animator perspective though!)
- //items= 0;
- break;
}
/* remove any weedy entries */