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-07-28 10:50:30 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-28 10:50:30 +0400
commit61178b19eabdc3e3833c167cdc8128db8994f9ca (patch)
tree3f1e666d11155d74b83fa427d6233f63dd22db24 /source/blender/editors/animation
parent9cbdf73cf0ce53bdf256b1b28efbb066a71e43b9 (diff)
2.5 - Anim Editor cleanups + Graph Editor Clutter Reduction
* Cleaned up some parts of the code that were unused/could be done a bit nicer * Added a new option for only showing the keyframes of the selected F-Curves in the Graph Editor, as another way of reducing the clutter.
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_channels.c4
-rw-r--r--source/blender/editors/animation/anim_draw.c38
-rw-r--r--source/blender/editors/animation/anim_filter.c42
3 files changed, 35 insertions, 49 deletions
diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c
index 6b31fbe25a9..f518b5b0a2e 100644
--- a/source/blender/editors/animation/anim_channels.c
+++ b/source/blender/editors/animation/anim_channels.c
@@ -722,7 +722,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *op)
/* only groups - don't check other types yet, since they may no-longer exist */
if (ale->type == ANIMTYPE_GROUP) {
bActionGroup *agrp= (bActionGroup *)ale->data;
- AnimData *adt= BKE_animdata_from_id(ale->id);
+ AnimData *adt= ale->adt;
FCurve *fcu, *fcn;
/* skip this group if no AnimData available, as we can't safely remove the F-Curves */
@@ -760,7 +760,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *op)
for (ale= anim_data.first; ale; ale= ale->next) {
/* only F-Curves, and only if we can identify its parent */
if (ale->type == ANIMTYPE_FCURVE) {
- AnimData *adt= BKE_animdata_from_id(ale->id);
+ AnimData *adt= ale->adt;
FCurve *fcu= (FCurve *)ale->data;
/* if no AnimData, we've got nowhere to remove the F-Curve from */
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 6c39e670f5c..6388106fdb5 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -242,40 +242,10 @@ AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale)
return NULL;
/* handling depends on the type of animation-context we've got */
- if (ale && ale->id)
- return BKE_animdata_from_id(ale->id);
-
- /* no appropriate object found */
- return NULL;
-}
-
-/* Set/clear temporary mapping of coordinates from 'local-action' time to 'global-nla-scaled' time
- * - the old mapping is stored in a static var, but that shouldn't be too bad as UI drawing
- * (where this is called) is single-threaded anyway
- */
-// XXX was called: map_active_strip()
-// TODO: should this be depreceated?
-void ANIM_nla_mapping_draw(gla2DDrawInfo *di, AnimData *adt, short restore)
-{
- static rctf stored;
-
- if (restore) {
- /* restore un-mapped coordinates */
- gla2DSetMap(di, &stored);
- }
- else {
- /* set mapped coordinates */
- rctf map;
-
- gla2DGetMap(di, &stored);
- map= stored;
-
- map.xmin= BKE_nla_tweakedit_remap(adt, map.xmin, NLATIME_CONVERT_MAP);
- map.xmax= BKE_nla_tweakedit_remap(adt, map.xmax, NLATIME_CONVERT_MAP);
-
- if (map.xmin == map.xmax) map.xmax += 1.0f;
- gla2DSetMap(di, &map);
- }
+ if (ale)
+ return ale->adt;
+ else
+ return NULL;
}
/* ------------------- */
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 5676fee5bac..2e755a360fa 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -17,11 +17,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * The Original Code is Copyright (C) 2008 Blender Foundation, Joshua Leung
* All rights reserved.
*
*
- * Contributor(s): Joshua Leung
+ * Contributor(s): Joshua Leung (original author)
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -33,15 +33,16 @@
* for cases to ignore.
*
* While this is primarily used for the Action/Dopesheet Editor (and its accessory modes),
- * the IPO Editor also uses this for it's channel list and for determining which curves
- * are being edited.
+ * the Graph Editor also uses this for its channel list and for determining which curves
+ * are being edited. Likewise, the NLA Editor also uses this for its channel list and in
+ * its operators.
*
* Note: much of the original system this was based on was built before the creation of the RNA
* system. In future, it would be interesting to replace some parts of this code with RNA queries,
* however, RNA does not eliminate some of the boiler-plate reduction benefits presented by this
* system, so if any such work does occur, it should only be used for the internals used here...
*
- * -- Joshua Leung, Dec 2008
+ * -- Joshua Leung, Dec 2008 (Last revision July 2009)
*/
#include <string.h>
@@ -73,6 +74,7 @@
#include "BLI_blenlib.h"
+#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_key.h"
@@ -205,6 +207,12 @@ static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
if (sipo->ads == NULL)
sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
+ /* set settings for Graph Editor - "Selected = Editable" */
+ if (sipo->flag & SIPO_SELCUVERTSONLY)
+ sipo->ads->filterflag |= ADS_FILTER_SELEDIT;
+ else
+ sipo->ads->filterflag &= ~ADS_FILTER_SELEDIT;
+
/* sync settings with current view status, then return appropriate data */
switch (sipo->mode) {
case SIPO_MODE_ANIMATION: /* Animation F-Curve Editor */
@@ -403,11 +411,20 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
-/* quick macro to test if a anim-channel (F-Curve, Group, etc.) is selected in an acceptable way */
+/* quick macro to test if an anim-channel (F-Curve, Group, etc.) is selected in an acceptable way */
#define ANIMCHANNEL_SELOK(test_func) \
( !(filter_mode & (ANIMFILTER_SEL|ANIMFILTER_UNSEL)) || \
((filter_mode & ANIMFILTER_SEL) && test_func) || \
((filter_mode & ANIMFILTER_UNSEL) && test_func==0) )
+
+/* quick macro to test if an anim-channel (F-Curve) is selected ok for editing purposes
+ * - _SELEDIT means that only selected curves will have visible+editable keyframes
+ */
+// FIXME: this doesn't work cleanly yet...
+#define ANIMCHANNEL_SELEDITOK(test_func) \
+ ( !(filter_mode & ANIMFILTER_SELEDIT) || \
+ (filter_mode & ANIMFILTER_CHANNELS) || \
+ (test_func) )
/* ----------- 'Private' Stuff --------------- */
@@ -430,6 +447,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
ale->ownertype= ownertype;
ale->id= owner_id;
+ ale->adt= BKE_animdata_from_id(owner_id);
/* do specifics */
switch (datatype) {
@@ -649,7 +667,7 @@ static int animdata_filter_fcurves (ListBase *anim_data, FCurve *first, bActionG
/* 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 in a way consistent with the filtering requirements */
- if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) ) {
+ if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu)) ) {
/* only include if this curve is active */
if (!(filter_mode & ANIMFILTER_ACTIVE) || (fcu->flag & FCURVE_ACTIVE)) {
ale= make_new_animlistelem(fcu, ANIMTYPE_FCURVE, owner, ownertype, owner_id);
@@ -1628,10 +1646,10 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
dataOk= 0;
break;
}
-
+
/* particles */
partOk = 0;
- if(!(ads->filterflag & ADS_FILTER_NOPART) && ob->particlesystem.first) {
+ if (!(ads->filterflag & ADS_FILTER_NOPART) && ob->particlesystem.first) {
ParticleSystem *psys = ob->particlesystem.first;
for(; psys; psys=psys->next) {
if (psys->part) {
@@ -1653,7 +1671,6 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
break;
}
}
-
/* check if all bad (i.e. nothing to show) */
if (!actOk && !keyOk && !dataOk && !matOk && !partOk)
@@ -1705,17 +1722,16 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int
dataOk= 0;
break;
}
-
+
/* particles */
partOk = 0;
- if(ob->particlesystem.first) {
+ if (ob->particlesystem.first) {
ParticleSystem *psys = ob->particlesystem.first;
for(; psys; psys=psys->next) {
if(psys->part && ANIMDATA_HAS_KEYS(psys->part)) {
partOk = 1;
break;
}
-
}
}