[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13538] trunk/blender/source/blender: 2 Tweaks:
Joshua Leung
aligorith at gmail.com
Sun Feb 3 08:43:41 CET 2008
Revision: 13538
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13538
Author: aligorith
Date: 2008-02-03 08:43:00 +0100 (Sun, 03 Feb 2008)
Log Message:
-----------
2 Tweaks:
* Action Editor now doesn't draw channels which are out of view at all, which should help to provide (some minimal) improvements in some situations
* Typo in comment in constraints code
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_constraint.h
trunk/blender/source/blender/src/drawaction.c
Modified: trunk/blender/source/blender/blenkernel/BKE_constraint.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_constraint.h 2008-02-03 02:58:07 UTC (rev 13537)
+++ trunk/blender/source/blender/blenkernel/BKE_constraint.h 2008-02-03 07:43:00 UTC (rev 13538)
@@ -70,7 +70,7 @@
/* admin/ident */
short type; /* CONSTRAINT_TYPE_### */
short size; /* size in bytes of the struct */
- char name[32]; /* name constraint in interface */
+ char name[32]; /* name of constraint in interface */
char structName[32]; /* name of struct for SDNA */
/* data management function pointers - special handling */
Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c 2008-02-03 02:58:07 UTC (rev 13537)
+++ trunk/blender/source/blender/src/drawaction.c 2008-02-03 07:43:00 UTC (rev 13538)
@@ -430,221 +430,229 @@
/* build list of channels to draw */
filter= (ACTFILTER_FORDRAWING|ACTFILTER_VISIBLE|ACTFILTER_CHANNELS);
actdata_filter(&act_data, filter, data, datatype);
-
+
/* loop through channels, and set up drawing depending on their type */
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (ale= act_data.first; ale; ale= ale->next) {
- short indent= 0, offset= 0, sel= 0, group=0;
- int expand= -1, protect = -1, special= -1, mute = -1;
- char name[32];
+ const float yminc= y-CHANNELHEIGHT/2;
+ const float ymaxc= y+CHANNELHEIGHT/2;
- /* determine what needs to be drawn */
- switch (ale->type) {
- case ACTTYPE_GROUP: /* action group */
- {
- bActionGroup *agrp= (bActionGroup *)ale->data;
-
- group= 2;
- indent= 0;
- special= -1;
-
- if (EXPANDED_AGRP(agrp))
- expand = ICON_TRIA_DOWN;
- else
- expand = ICON_TRIA_RIGHT;
+ /* check if visible */
+ if ( IN_RANGE(yminc, G.v2d->cur.ymin, G.v2d->cur.ymax) ||
+ IN_RANGE(ymaxc, G.v2d->cur.ymin, G.v2d->cur.ymax) )
+ {
+ short indent= 0, offset= 0, sel= 0, group=0;
+ int expand= -1, protect = -1, special= -1, mute = -1;
+ char name[32];
+
+ /* determine what needs to be drawn */
+ switch (ale->type) {
+ case ACTTYPE_GROUP: /* action group */
+ {
+ bActionGroup *agrp= (bActionGroup *)ale->data;
- if (EDITABLE_AGRP(agrp))
- protect = ICON_UNLOCKED;
- else
- protect = ICON_LOCKED;
+ group= 2;
+ indent= 0;
+ special= -1;
- sel = SEL_AGRP(agrp);
- sprintf(name, agrp->name);
- }
- break;
- case ACTTYPE_ACHAN: /* action channel */
- {
- bActionChannel *achan= (bActionChannel *)ale->data;
-
- group= (ale->grp) ? 1 : 0;
- indent = 0;
- special = -1;
-
- if (EXPANDED_ACHAN(achan))
- expand = ICON_TRIA_DOWN;
- else
- expand = ICON_TRIA_RIGHT;
+ if (EXPANDED_AGRP(agrp))
+ expand = ICON_TRIA_DOWN;
+ else
+ expand = ICON_TRIA_RIGHT;
+
+ if (EDITABLE_AGRP(agrp))
+ protect = ICON_UNLOCKED;
+ else
+ protect = ICON_LOCKED;
+
+ sel = SEL_AGRP(agrp);
+ sprintf(name, agrp->name);
+ }
+ break;
+ case ACTTYPE_ACHAN: /* action channel */
+ {
+ bActionChannel *achan= (bActionChannel *)ale->data;
- if (EDITABLE_ACHAN(achan))
- protect = ICON_UNLOCKED;
- else
- protect = ICON_LOCKED;
+ group= (ale->grp) ? 1 : 0;
+ indent = 0;
+ special = -1;
- if (achan->ipo) {
- if (achan->ipo->muteipo)
- mute = ICON_MUTE_IPO_ON;
+ if (EXPANDED_ACHAN(achan))
+ expand = ICON_TRIA_DOWN;
else
- mute = ICON_MUTE_IPO_OFF;
+ expand = ICON_TRIA_RIGHT;
+
+ if (EDITABLE_ACHAN(achan))
+ protect = ICON_UNLOCKED;
+ else
+ protect = ICON_LOCKED;
+
+ if (achan->ipo) {
+ if (achan->ipo->muteipo)
+ mute = ICON_MUTE_IPO_ON;
+ else
+ mute = ICON_MUTE_IPO_OFF;
+ }
+
+ sel = SEL_ACHAN(achan);
+ sprintf(name, achan->name);
}
-
- sel = SEL_ACHAN(achan);
- sprintf(name, achan->name);
- }
- break;
- case ACTTYPE_CONCHAN: /* constraint channel */
- {
- bConstraintChannel *conchan = (bConstraintChannel *)ale->data;
-
- indent = 2;
- group= (ale->grp) ? 1 : 0;
-
- if (EDITABLE_CONCHAN(conchan))
- protect = ICON_UNLOCKED;
- else
- protect = ICON_LOCKED;
+ break;
+ case ACTTYPE_CONCHAN: /* constraint channel */
+ {
+ bConstraintChannel *conchan = (bConstraintChannel *)ale->data;
- if (conchan->ipo) {
- if (conchan->ipo->muteipo)
+ indent = 2;
+ group= (ale->grp) ? 1 : 0;
+
+ if (EDITABLE_CONCHAN(conchan))
+ protect = ICON_UNLOCKED;
+ else
+ protect = ICON_LOCKED;
+
+ if (conchan->ipo) {
+ if (conchan->ipo->muteipo)
+ mute = ICON_MUTE_IPO_ON;
+ else
+ mute = ICON_MUTE_IPO_OFF;
+ }
+
+ sel = SEL_CONCHAN(conchan);
+ sprintf(name, conchan->name);
+ }
+ break;
+ case ACTTYPE_ICU: /* ipo-curve channel */
+ {
+ IpoCurve *icu = (IpoCurve *)ale->data;
+
+ indent = 2;
+ protect = -1; // for now, until this can be supported by others
+ group= (ale->grp) ? 1 : 0;
+
+ if (icu->flag & IPO_MUTE)
mute = ICON_MUTE_IPO_ON;
+ else
+ mute = ICON_MUTE_IPO_OFF;
+
+ sel = SEL_ICU(icu);
+ if (G.saction->pin)
+ sprintf(name, getname_ipocurve(icu, NULL));
else
- mute = ICON_MUTE_IPO_OFF;
+ sprintf(name, getname_ipocurve(icu, OBACT));
}
+ break;
+ case ACTTYPE_SHAPEKEY: /* shapekey channel */
+ {
+ KeyBlock *kb = (KeyBlock *)ale->data;
+
+ indent = 0;
+ special = -1;
+
+ if (kb->name[0] == '\0')
+ sprintf(name, "Key %d", ale->index);
+ else
+ sprintf(name, kb->name);
+ }
+ break;
+ case ACTTYPE_FILLIPO: /* ipo expand widget */
+ {
+ bActionChannel *achan = (bActionChannel *)ale->data;
+
+ indent = 1;
+ special = geticon_ipo_blocktype(achan->ipo->blocktype);
+ group= (ale->grp) ? 1 : 0;
+
+ if (FILTER_IPO_ACHAN(achan))
+ expand = ICON_TRIA_DOWN;
+ else
+ expand = ICON_TRIA_RIGHT;
+
+ sel = SEL_ACHAN(achan);
+ sprintf(name, "IPO Curves");
+ }
+ break;
+ case ACTTYPE_FILLCON: /* constraint expand widget */
+ {
+ bActionChannel *achan = (bActionChannel *)ale->data;
+
+ indent = 1;
+ special = ICON_CONSTRAINT;
+ group= (ale->grp) ? 1 : 0;
+
+ if (FILTER_CON_ACHAN(achan))
+ expand = ICON_TRIA_DOWN;
+ else
+ expand = ICON_TRIA_RIGHT;
+
+ sel = SEL_ACHAN(achan);
+ sprintf(name, "Constraint");
+ }
+ break;
+ }
+
+ /* now, start drawing based on this information */
+ /* draw backing strip behind channel name */
+ if (group == 2) {
+ /* only for group-channels */
+ if (ale->flag & AGRP_ACTIVE)
+ BIF_ThemeColorShade(TH_GROUP_ACTIVE, 10);
+ else
+ BIF_ThemeColorShade(TH_GROUP, 20);
+ uiSetRoundBox((expand == ICON_TRIA_DOWN)? (1):(1|8));
+ gl_round_box(GL_POLYGON, x, yminc, (float)NAMEWIDTH, ymaxc, 8);
- sel = SEL_CONCHAN(conchan);
- sprintf(name, conchan->name);
+ offset = 0;
}
- break;
- case ACTTYPE_ICU: /* ipo-curve channel */
- {
- IpoCurve *icu = (IpoCurve *)ale->data;
-
- indent = 2;
- protect = -1; // for now, until this can be supported by others
- group= (ale->grp) ? 1 : 0;
-
- if (icu->flag & IPO_MUTE)
- mute = ICON_MUTE_IPO_ON;
- else
- mute = ICON_MUTE_IPO_OFF;
-
- sel = SEL_ICU(icu);
- if (G.saction->pin)
- sprintf(name, getname_ipocurve(icu, NULL));
- else
- sprintf(name, getname_ipocurve(icu, OBACT));
+ else {
+ /* for normal channels */
+ BIF_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40));
+ indent += group;
+ offset = 7 * indent;
+ glRectf(x+offset, yminc, (float)NAMEWIDTH, ymaxc);
}
- break;
- case ACTTYPE_SHAPEKEY: /* shapekey channel */
- {
- KeyBlock *kb = (KeyBlock *)ale->data;
-
- indent = 0;
- special = -1;
-
- if (kb->name[0] == '\0')
- sprintf(name, "Key %d", ale->index);
- else
- sprintf(name, kb->name);
+
+ /* draw expand/collapse triangle */
+ if (expand > 0) {
+ BIF_icon_draw(x+offset, yminc, expand);
+ offset += 17;
}
- break;
- case ACTTYPE_FILLIPO: /* ipo expand widget */
- {
- bActionChannel *achan = (bActionChannel *)ale->data;
-
- indent = 1;
- special = geticon_ipo_blocktype(achan->ipo->blocktype);
- group= (ale->grp) ? 1 : 0;
-
- if (FILTER_IPO_ACHAN(achan))
- expand = ICON_TRIA_DOWN;
- else
- expand = ICON_TRIA_RIGHT;
-
- sel = SEL_ACHAN(achan);
- sprintf(name, "IPO Curves");
+
+ /* draw special icon indicating type of ipo-blocktype?
+ * only for expand widgets for Ipo and Constraint Channels
+ */
+ if (special > 0) {
+ offset = (group) ? 29 : 24;
+ BIF_icon_draw(x+offset, yminc, special);
+ offset += 17;
}
- break;
- case ACTTYPE_FILLCON: /* constraint expand widget */
- {
- bActionChannel *achan = (bActionChannel *)ale->data;
- indent = 1;
- special = ICON_CONSTRAINT;
- group= (ale->grp) ? 1 : 0;
-
- if (FILTER_CON_ACHAN(achan))
- expand = ICON_TRIA_DOWN;
- else
- expand = ICON_TRIA_RIGHT;
-
- sel = SEL_ACHAN(achan);
- sprintf(name, "Constraint");
- }
- break;
- }
-
- /* now, start drawing based on this information */
- /* draw backing strip behind channel name */
- if (group == 2) {
- /* only for group-channels */
- if (ale->flag & AGRP_ACTIVE)
- BIF_ThemeColorShade(TH_GROUP_ACTIVE, 10);
+ /* draw name */
+ if (sel)
+ BIF_ThemeColor(TH_TEXT_HI);
else
- BIF_ThemeColorShade(TH_GROUP, 20);
- uiSetRoundBox((expand == ICON_TRIA_DOWN)? (1):(1|8));
- gl_round_box(GL_POLYGON, x, y-CHANNELHEIGHT/2, (float)NAMEWIDTH, y+CHANNELHEIGHT/2, 8);
+ BIF_ThemeColor(TH_TEXT);
+ offset += 3;
+ glRasterPos2f(x+offset, y-4);
+ BMF_DrawString(G.font, name);
+ /* reset offset - for RHS of panel */
offset = 0;
- }
- else {
- /* for normal channels */
- BIF_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40));
- indent += group;
- offset = 7 * indent;
- glRectf(x+offset, y-CHANNELHEIGHT/2, (float)NAMEWIDTH, y+CHANNELHEIGHT/2);
- }
-
- /* draw expand/collapse triangle */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list