[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17977] branches/blender2.5/blender/source /blender: 2.5 - Animation Editors - common drawing stuff
Joshua Leung
aligorith at gmail.com
Sun Dec 21 04:14:03 CET 2008
Revision: 17977
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17977
Author: aligorith
Date: 2008-12-21 04:14:01 +0100 (Sun, 21 Dec 2008)
Log Message:
-----------
2.5 - Animation Editors - common drawing stuff
* Fixed current frame number drawing in Animation Editors, so that the little frame number indicator box gets shown (animsys2 feature).
* Made all Animation Editors draw markers and preview range
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c
branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
branches/blender2.5/blender/source/blender/editors/animation/anim_markers.c
branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
branches/blender2.5/blender/source/blender/editors/space_action/space_action.c
branches/blender2.5/blender/source/blender/editors/space_ipo/space_ipo.c
Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2008-12-21 03:11:32 UTC (rev 17976)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2008-12-21 03:14:01 UTC (rev 17977)
@@ -5078,7 +5078,7 @@
ar->v2d.keepofs = V2D_LOCKOFS_Y;
ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y;
-
+ ar->v2d.flag = (V2D_PIXELOFS_X|V2D_PIXELOFS_Y);
}
/* 2.50 patch */
Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c 2008-12-21 03:11:32 UTC (rev 17976)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c 2008-12-21 03:14:01 UTC (rev 17977)
@@ -44,6 +44,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_object.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
@@ -58,17 +59,21 @@
#include "UI_interface.h"
#include "UI_resources.h"
+#include "UI_text.h"
#include "UI_view2d.h"
+/* XXX */
+extern void ui_rasterpos_safe(float x, float y, float aspect);
+
/* *************************************************** */
/* CURRENT FRAME DRAWING */
/* Draw current frame number in a little green box beside the current frame indicator */
static void draw_cfra_number (View2D *v2d, float cfra, short time)
{
- float xscale, yscale, yspace, ypixels, x;
+ float xscale, yscale, x, y;
+ char str[32];
short slen;
- char str[32];
/* because the frame number text is subject to the same scaling as the contents of the view */
UI_view2d_getscale(v2d, &xscale, &yscale);
@@ -78,23 +83,23 @@
sprintf(str, " %.2f", FRA2TIME(CFRA));
else
sprintf(str, " %d", CFRA);
- slen= UI_GetStringWidth(G.font, str, 0);
+ slen= UI_GetStringWidth(G.font, str, 0) - 1;
/* get starting coordinates for drawing */
x= cfra * xscale;
+ y= 18;
/* draw green box around/behind text */
- UI_ThemeColor(TH_CFRAME);
UI_ThemeColorShadeAlpha(TH_CFRAME, 0, -100);
- glRectf(x, 0, x+slen, 15);
+ glRectf(x, y, x+slen, y+15);
/* draw current frame number - black text */
UI_ThemeColor(TH_TEXT);
- ui_rasterpos_safe(x-5, 17, 1.0);
- UI_DrawString(G.fonts, str, 0);
+ ui_rasterpos_safe(x-5, y+3, 1.0);
+ UI_DrawString(G.fonts, str, 0); // XXX may need to be updated for font stuff
/* restore view transform */
- glScalef(xscale, yscale, 1.0);
+ glScalef(xscale, 1.0, 1.0);
}
/* General call for drawing current frame indicator in a */
Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c 2008-12-21 03:11:32 UTC (rev 17976)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c 2008-12-21 03:14:01 UTC (rev 17977)
@@ -170,10 +170,17 @@
/* ----------- Private Stuff - IPO Editor ------------- */
+/* Get data being edited in IPO Editor (depending on current 'mode') */
+static void *ipoedit_get_context (const bContext *C, SpaceIpo *sipo, short *datatype)
+{
+ // XXX FIXME...
+ return NULL;
+}
+
/* ----------- Public API --------------- */
/* Obtain current anim-data context from Blender Context info */
-void *animdata_get_context (const bContext *C, short *datatype)
+void *ANIM_animdata_get_context (const bContext *C, short *datatype)
{
ScrArea *sa= CTX_wm_area(C);
@@ -194,7 +201,7 @@
case SPACE_IPO:
{
SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C);
- // ...
+ return ipoedit_get_context(C, sipo, datatype);
}
break;
}
@@ -204,5 +211,57 @@
}
/* ************************************************************ */
+/* Blender Data <-- Filter --> Channels to be operated on */
+/* ----------- 'Private' Stuff --------------- */
+
+
+/* ----------- Public API --------------- */
+
+/* This function filters the active data source to leave only the desired
+ * data types. 'Public' api call.
+ * *act_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
+ */
+void ANIM_animdata_filter (ListBase *anim_data, int filter_mode, void *data, short datatype)
+{
+ /* only filter data if there's somewhere to put it */
+ if (data && anim_data) {
+ bAnimListElem *ale, *next;
+
+ /* firstly filter the data */
+ switch (datatype) {
+ case ANIMCONT_ACTION:
+ //animdata_filter_action(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE);
+ break;
+ case ANIMCONT_SHAPEKEY:
+ //animdata_filter_shapekey(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE);
+ break;
+ case ANIMCONT_GPENCIL:
+ //animdata_filter_gpencil(anim_data, data, filter_mode);
+ break;
+ case ANIMCONT_DOPESHEET:
+ //animdata_filter_dopesheet(anim_data, data, filter_mode);
+ break;
+ }
+
+ /* remove any weedy entries */
+ // XXX this is weedy code!
+ for (ale= anim_data->first; ale; ale= next) {
+ next= ale->next;
+
+ if (ale->type == ANIMTYPE_NONE)
+ BLI_freelinkN(anim_data, ale);
+
+ if (filter_mode & ALEFILTER_IPOKEYS) {
+ if (ale->datatype != ALE_IPO)
+ BLI_freelinkN(anim_data, ale);
+ else if (ale->key_data == NULL)
+ BLI_freelinkN(anim_data, ale);
+ }
+ }
+ }
+}
+
/* ************************************************************ */
Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_markers.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_markers.c 2008-12-21 03:11:32 UTC (rev 17976)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_markers.c 2008-12-21 03:14:01 UTC (rev 17977)
@@ -95,8 +95,8 @@
int icon_id= 0;
xpos = marker->frame;
+
/* no time correction for framelen! space is drawn with old values */
-
ypixels= v2d->mask.ymax-v2d->mask.ymin;
UI_view2d_getscale(v2d, &xscale, &yscale);
@@ -105,18 +105,20 @@
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- /* vertical line */
+ /* vertical line - dotted */
if (flag & DRAW_MARKERS_LINES) {
setlinestyle(3);
- if(marker->flag & SELECT)
- glColor4ub(255,255,255, 96);
+
+ if (marker->flag & SELECT)
+ glColor4ub(255, 255, 255, 96);
else
- glColor4ub(0,0,0, 96);
+ glColor4ub(0, 0, 0, 96);
glBegin(GL_LINES);
- glVertex2f((xpos*xscale)+0.5, 12);
- glVertex2f((xpos*xscale)+0.5, 34*yscale); /* a bit lazy but we know it cant be greater then 34 strips high*/
+ glVertex2f((xpos*xscale)+0.5, 12);
+ glVertex2f((xpos*xscale)+0.5, 34*yscale); /* a bit lazy but we know it cant be greater then 34 strips high*/
glEnd();
+
setlinestyle(0);
}
@@ -137,7 +139,7 @@
glDisable(GL_BLEND);
/* and the marker name too, shifted slightly to the top-right */
- if(marker->name && marker->name[0]) {
+ if (marker->name && marker->name[0]) {
if(marker->flag & SELECT) {
UI_ThemeColor(TH_TEXT_HI);
ui_rasterpos_safe(xpos*xscale+4.0, (ypixels<=39.0)?(ypixels-10.0):29.0, 1.0);
Modified: branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h 2008-12-21 03:11:32 UTC (rev 17976)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h 2008-12-21 03:14:01 UTC (rev 17977)
@@ -62,7 +62,8 @@
} bAnimListElem;
-/* Some types for easier type-testing */
+/* Some types for easier type-testing */
+// XXX was ACTTYPE_*
typedef enum eAnim_ChannelType {
ANIMTYPE_NONE= 0,
ANIMTYPE_SPECIALDATA,
@@ -109,6 +110,7 @@
} eAnim_KeyType;
/* Main Data container types */
+// XXX was ACTCONT_*
typedef enum eAnimCont_Types {
ANIMCONT_NONE = 0, /* invalid or no data */
ANIMCONT_ACTION, /* action (bAction) */
@@ -118,6 +120,7 @@
} eAnimCont_Types;
/* filtering flags - under what circumstances should a channel be added */
+// XXX was ACTFILTER_*
typedef enum eAnimFilter_Flags {
ALEFILTER_VISIBLE = (1<<0), /* should channels be visible */
ALEFILTER_SEL = (1<<1), /* should channels be selected */
@@ -133,10 +136,10 @@
/* ---------------- API -------------------- */
/* Obtain list of filtered Animation channels to operate on */
-void animdata_filter(struct ListBase *act_data, int filter_mode, void *data, short datatype);
+void ANIM_animdata_filter(struct ListBase *anim_data, int filter_mode, void *data, short datatype);
/* Obtain current anim-data context from Blender Context info */
-void *animdata_get_context(const struct bContext *C, short *datatype);
+void *ANIM_animdata_get_context(const struct bContext *C, short *datatype);
/* ************************************************ */
/* DRAWING API */
Modified: branches/blender2.5/blender/source/blender/editors/space_action/space_action.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/space_action.c 2008-12-21 03:11:32 UTC (rev 17976)
+++ branches/blender2.5/blender/source/blender/editors/space_action/space_action.c 2008-12-21 03:14:01 UTC (rev 17977)
@@ -97,9 +97,9 @@
BLI_addtail(&saction->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin= -5.0f;
+ ar->v2d.tot.xmin= -2.0f;
ar->v2d.tot.ymin= -2000.0f;
- ar->v2d.tot.xmax= 1000.0f; // xxx - use end frame instead?
+ ar->v2d.tot.xmax= 100.0f;
ar->v2d.tot.ymax= 0.0f;
ar->v2d.cur.xmin= -2.0f;
@@ -190,7 +190,12 @@
if ((saction->flag & SACTION_NODRAWCFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX;
ANIM_draw_cfra(C, v2d, flag);
+ /* markers */
+ UI_view2d_view_orthoSpecial(C, v2d, 1);
+ draw_markers_time(C, 0);
+
/* preview range */
+ UI_view2d_view_ortho(C, v2d);
ANIM_draw_previewrange(C, v2d);
/* reset view matrix */
Modified: branches/blender2.5/blender/source/blender/editors/space_ipo/space_ipo.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_ipo/space_ipo.c 2008-12-21 03:11:32 UTC (rev 17976)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list