[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12196] trunk/blender/source/blender: == TimeLine ==
Joshua Leung
aligorith at gmail.com
Wed Oct 3 05:48:05 CEST 2007
Revision: 12196
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12196
Author: aligorith
Date: 2007-10-03 05:48:04 +0200 (Wed, 03 Oct 2007)
Log Message:
-----------
== TimeLine ==
Added an option to only display keyframes of the selected action-channels and/or the active material. This is should offer some speedups on really heavy datasets. Use the (View)->(Only Selected Data Keys) option to turn this on.
In future, more filtering options could be added here too...
Modified Paths:
--------------
trunk/blender/source/blender/makesdna/DNA_space_types.h
trunk/blender/source/blender/src/drawtime.c
trunk/blender/source/blender/src/editaction.c
trunk/blender/source/blender/src/header_time.c
Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h 2007-10-03 00:05:34 UTC (rev 12195)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h 2007-10-03 03:48:04 UTC (rev 12196)
@@ -589,8 +589,12 @@
#define SNLA_DRAWTIME 4
/* time->flag */
+ /* show timing in frames instead of in seconds */
#define TIME_DRAWFRAMES 1
+ /* temporary flag set when scrubbing time */
#define TIME_CFRA_NUM 2
+ /* only keyframes from active/selected channels get shown */
+#define TIME_ONLYACTSEL 4
/* time->redraws */
#define TIME_LEFTMOST_3D_WIN 1
Modified: trunk/blender/source/blender/src/drawtime.c
===================================================================
--- trunk/blender/source/blender/src/drawtime.c 2007-10-03 00:05:34 UTC (rev 12195)
+++ trunk/blender/source/blender/src/drawtime.c 2007-10-03 03:48:04 UTC (rev 12196)
@@ -54,6 +54,7 @@
#include "BKE_utildefines.h"
#include "BKE_global.h"
+#include "BIF_editaction.h"
#include "BIF_gl.h"
#include "BIF_interface.h"
#include "BIF_interface_icons.h"
@@ -96,8 +97,9 @@
float x, y;
float xscale, yscale;
char str[32];
- /* little box with frame */
+ /* little box with frame drawn beside */
+
glFlush(); // huhh... without this glColor won't work for the text...
getmouseco_areawin(mval);
@@ -277,66 +279,84 @@
}
}
+/* This function draws keyframes that the active object has (as long as
+ * it is not in EditMode). Some filters are available to optimise the
+ * drawing efficiency.
+ */
static void draw_ob_keys()
{
- /*mostly copied from drawobject.c, draw_object() */
- Object *ob;
- bActionChannel *achan;
- bAction *act;
- ListBase elems;
+ /* mostly copied from drawobject.c, draw_object() */
+ SpaceTime *stime= curarea->spacedata.first;
+ ListBase elems= {0, 0};
+
+ Object *ob= OBACT;
+ short filter, ok;
+ char col[3];
int a;
- char col[3];
- if (OBACT) {
- ob = OBACT;
+ if (ob && ob!=G.obedit) {
+ /* Object's IPO block - show all keys */
+ if (ob->ipo) {
+ /* convert the ipo to a list of 'current frame elements' */
+ elems.first= elems.last= NULL;
+ make_cfra_list(ob->ipo, &elems);
+
+ /* draw the list of current frame elements */
+ col[0] = 0xDD; col[1] = 0xD7; col[2] = 0x00;
+ draw_key_list(elems, col);
+
+ BLI_freelistN(&elems);
+ }
- if(ob) {
- if(ob!=G.obedit) {
- if(ob->ipo) {
- /* convert the ipo to a list of 'current frame elements' */
-
+ /* Object's Action block - may be filtered in some cases */
+ if (ob->action) {
+ bAction *act = ob->action;
+ bActionChannel *achan;
+
+ /* only apply filter if action is likely to be for pose channels + filter is on */
+ filter= ((stime->flag & TIME_ONLYACTSEL) &&
+ (ob->pose) && (ob->flag & OB_POSEMODE));
+
+ /* go through each channel in the action */
+ for (achan=act->chanbase.first; achan; achan=achan->next) {
+ /* if filtering, check if this channel passes */
+ if (filter) {
+ ok= (SEL_ACHAN(achan))? 1 : 0;
+ }
+ else ok= 1;
+
+ /* convert the ipo to a list of 'current frame elements' */
+ if (achan->ipo && ok) {
elems.first= elems.last= NULL;
- make_cfra_list(ob->ipo, &elems);
+ make_cfra_list(achan->ipo, &elems);
- /* draw the list of current frame elements */
- col[0] = 0xDD; col[1] = 0xD7; col[2] = 0x00;
+ col[0] = 0x00; col[1] = 0x82; col[2] = 0x8B;
draw_key_list(elems, col);
BLI_freelistN(&elems);
}
+ }
+ }
+
+ /* Materials (only relevant for geometry objects) - some filtering might occur */
+ filter= (stime->flag & TIME_ONLYACTSEL);
+ for (a=0; a<ob->totcol; a++) {
+ Material *ma= give_current_material(ob, a+1);
+
+ /* the only filter we apply right now is only showing the active material */
+ if (filter) {
+ ok= (ob->actcol==a)? 1 : 0;
+ }
+ else ok= 1;
+
+ if (ma && ma->ipo && ok) {
+ elems.first= elems.last= NULL;
+ make_cfra_list(ma->ipo, &elems);
- if(ob->action) {
- act = ob->action;
-
- /* go through each channel in the action */
- for (achan=act->chanbase.first; achan; achan=achan->next){
- /* convert the ipo to a list of 'current frame elements' */
- if(achan->ipo) {
- elems.first= elems.last= NULL;
- make_cfra_list(achan->ipo, &elems);
-
- col[0] = 0x00; col[1] = 0x82; col[2] = 0x8B;
- draw_key_list(elems, col);
-
- BLI_freelistN(&elems);
- }
- }
- }
+ col[0] = 0xDD; col[1] = 0xA7; col[2] = 0x00;
+ draw_key_list(elems, col);
- for(a=0; a<ob->totcol; a++) {
- Material *ma= give_current_material(ob, a+1);
-
- if(ma && ma->ipo) {
- elems.first= elems.last= NULL;
- make_cfra_list(ma->ipo, &elems);
-
- col[0] = 0xDD; col[1] = 0xA7; col[2] = 0x00;
- draw_key_list(elems, col);
-
- BLI_freelistN(&elems);
- }
- }
-
+ BLI_freelistN(&elems);
}
}
}
Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c 2007-10-03 00:05:34 UTC (rev 12195)
+++ trunk/blender/source/blender/src/editaction.c 2007-10-03 03:48:04 UTC (rev 12196)
@@ -2406,12 +2406,13 @@
return;
}
- allqueue (REDRAWIPO, 0);
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWACTION, 0);
- allqueue (REDRAWNLA, 0);
- allqueue (REDRAWOOPS, 0);
- allqueue (REDRAWBUTSALL, 0);
+ allqueue(REDRAWIPO, 0);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ allqueue(REDRAWTIME, 0);
+ allqueue(REDRAWOOPS, 0);
+ allqueue(REDRAWBUTSALL, 0);
}
/* **************************************************** */
Modified: trunk/blender/source/blender/src/header_time.c
===================================================================
--- trunk/blender/source/blender/src/header_time.c 2007-10-03 00:05:34 UTC (rev 12195)
+++ trunk/blender/source/blender/src/header_time.c 2007-10-03 03:48:04 UTC (rev 12196)
@@ -241,6 +241,9 @@
if(G.v2d->flag & V2D_VIEWLOCK)
view2d_do_locks(curarea, 0);
break;
+ case 12: /* only show keyframes from selected data */
+ stime->flag ^= TIME_ONLYACTSEL;
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -265,6 +268,9 @@
else
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
+ uiDefIconTextBut(block, BUTM, 1, (stime->flag & TIME_ONLYACTSEL)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
+ "Only Selected Data Keys|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
+
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Marker|PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
More information about the Bf-blender-cvs
mailing list