[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17453] branches/animsys2/source/blender/ src: AnimSys2: More DopeSheet/Action-Editor code tidy-ups
Joshua Leung
aligorith at gmail.com
Fri Nov 14 05:07:48 CET 2008
Revision: 17453
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17453
Author: aligorith
Date: 2008-11-14 05:07:47 +0100 (Fri, 14 Nov 2008)
Log Message:
-----------
AnimSys2: More DopeSheet/Action-Editor code tidy-ups
* Moved the context-checks to a centralised place.
* Disabled a few menus which will not work with the dopesheet
Modified Paths:
--------------
branches/animsys2/source/blender/src/drawaction.c
branches/animsys2/source/blender/src/editaction.c
branches/animsys2/source/blender/src/header_action.c
Modified: branches/animsys2/source/blender/src/drawaction.c
===================================================================
--- branches/animsys2/source/blender/src/drawaction.c 2008-11-14 03:52:04 UTC (rev 17452)
+++ branches/animsys2/source/blender/src/drawaction.c 2008-11-14 04:07:47 UTC (rev 17453)
@@ -1472,30 +1472,6 @@
/* warning: blocks need to be freed each time, handlers dont remove */
uiFreeBlocksWin(&sa->uiblocks, sa->win);
-
- /* only try to refresh action that's displayed if not pinned */
- // TODO: should this be moved into get_action_context instead???
- if (G.saction->pin==0) {
- /* depends on mode */
- switch (G.saction->mode) {
- case SACTCONT_ACTION:
- {
- if (OBACT)
- G.saction->action = OBACT->action;
- else
- G.saction->action= NULL;
- }
- break;
- case SACTCONT_DOPESHEET:
- {
- /* update scene-pointer */
- G.saction->ads.source= (ID *)G.scene;
-
- // TODO: later, we may need to set flags?
- }
- break;
- }
- }
/* get data */
data = get_action_context(&datatype);
@@ -1589,7 +1565,7 @@
}
/* Draw Left-Hand Panel if enough space in window */
- if (G.v2d->mask.xmin!=0) {
+ if (G.v2d->mask.xmin != 0) {
/* Draw channel names */
draw_channel_names();
Modified: branches/animsys2/source/blender/src/editaction.c
===================================================================
--- branches/animsys2/source/blender/src/editaction.c 2008-11-14 03:52:04 UTC (rev 17452)
+++ branches/animsys2/source/blender/src/editaction.c 2008-11-14 04:07:47 UTC (rev 17453)
@@ -1182,59 +1182,48 @@
}
void *get_action_context (short *datatype)
-{
- bDopeSheet *ads;
- bAction *act;
- Key *key;
-
- /* get pointers to active action/shapekey blocks */
- // TODO: should the checks for updating types really be here?
- act = (G.saction)? G.saction->action: NULL;
- ads = (G.saction)? &G.saction->ads: NULL;
- key = get_action_mesh_key();
-
+{
/* check mode selector */
if (G.saction) {
+ /* sync settings with current view status, then return appropriate data */
switch (G.saction->mode) {
- case SACTCONT_ACTION:
+ case SACTCONT_ACTION:
+ /* if not pinned, sync with active object */
+ if (G.saction->pin == 0) {
+ if (OBACT)
+ G.saction->action = OBACT->action;
+ else
+ G.saction->action= NULL;
+ }
+
*datatype= ACTCONT_ACTION;
- return act;
+ return G.saction->action;
case SACTCONT_SHAPEKEY:
*datatype= ACTCONT_SHAPEKEY;
- return key;
+ return get_action_mesh_key();
case SACTCONT_GPENCIL:
*datatype= ACTCONT_GPENCIL;
return G.curscreen; // FIXME: add that dopesheet type thing here!
+ break;
case SACTCONT_DOPESHEET:
+ /* update scene-pointer (no need to check for pinning yet, as not implemented) */
+ G.saction->ads.source= (ID *)G.scene;
+
*datatype= ACTCONT_DOPESHEET;
- return ads;
+ return &G.saction->ads;
- default: /* includes SACTCONT_DOPESHEET for now */
+ default: /* unhandled yet */
*datatype= ACTCONT_NONE;
return NULL;
}
}
else {
- /* resort to guessing based on what is available */
- if (act) {
- *datatype= ACTCONT_ACTION;
- return act;
- }
- else if (key) {
- *datatype= ACTCONT_SHAPEKEY;
- return key;
- }
- else if (ads) {
- *datatype= ACTCONT_DOPESHEET;
- return ads;
- }
- else {
- *datatype= ACTCONT_NONE;
- return NULL;
- }
+ /* nothing should be available... */
+ *datatype= ACTCONT_NONE;
+ return NULL;
}
}
Modified: branches/animsys2/source/blender/src/header_action.c
===================================================================
--- branches/animsys2/source/blender/src/header_action.c 2008-11-14 03:52:04 UTC (rev 17452)
+++ branches/animsys2/source/blender/src/header_action.c 2008-11-14 04:07:47 UTC (rev 17453)
@@ -72,6 +72,7 @@
#include "BDR_drawaction.h"
#include "BSE_drawipo.h"
#include "BSE_headerbuttons.h"
+#include "BSE_editaction_types.h"
#include "BSE_time.h"
#include "nla.h"
@@ -980,11 +981,13 @@
uiDefIconTextBlockBut(block, action_channelmenu_groupmenu,
NULL, ICON_RIGHTARROW_THIN,
"Grouping", 0, yco-=20, 120, 20, "");
-
- uiDefIconTextBlockBut(block, action_channelmenu_posmenu,
- NULL, ICON_RIGHTARROW_THIN,
- "Ordering", 0, yco-=20, 120, 20, "");
+ if (G.saction->mode == SACTCONT_ACTION) {
+ uiDefIconTextBlockBut(block, action_channelmenu_posmenu,
+ NULL, ICON_RIGHTARROW_THIN,
+ "Ordering", 0, yco-=20, 120, 20, "");
+ }
+
uiDefIconTextBlockBut(block, action_channelmenu_settingsmenu,
NULL, ICON_RIGHTARROW_THIN,
"Settings", 0, yco-=20, 120, 20, "");
@@ -1002,12 +1005,14 @@
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Toggle Show Hierachy|~", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_EXPANDALL, "");
+
+ if (G.saction->mode == SACTCONT_ACTION) {
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
+ "Show Group-Hidden Channels|Shift ~", 0, yco-=20,
+ menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_SHOWACHANS, "");
+ }
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Show Group-Hidden Channels|Shift ~", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_SHOWACHANS, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Expand One Level|Ctrl NumPad+", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_OPENLEVELS, "");
@@ -1478,7 +1483,7 @@
"Interpolation Mode", 0, yco-=20, 120, 20, "");
- if(curarea->headertype==HEADERTOP) {
+ if (curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1626,24 +1631,16 @@
void action_buttons(void)
{
+ void *data;
+ short datatype;
+
uiBlock *block;
short xco, xmax;
char name[256];
Object *ob;
ID *from;
-
- if (G.saction == NULL)
- return;
-
- /* copied from drawactionspace.... */
- // FIXME: do for gpencil too?
- if (!G.saction->pin) {
- if (OBACT)
- G.saction->action = OBACT->action;
- else
- G.saction->action= NULL;
- }
-
+
+ /* draw SPACETYPE SELECTOR */
sprintf(name, "header %d", curarea->headwin);
block= uiNewBlock(&curarea->uiblocks, name,
UI_EMBOSS, UI_HELV, curarea->headwin);
@@ -1664,6 +1661,7 @@
"Click for menu of available types.");
xco += XIC + 14;
+
uiBlockSetEmboss(block, UI_EMBOSSN);
if (curarea->flag & HEADER_NO_PULLDOWN) {
@@ -1682,6 +1680,11 @@
}
uiBlockSetEmboss(block, UI_EMBOSS);
xco+=XIC;
+
+ /* get context... (also syncs data) */
+ data= get_action_context(&datatype);
+ if (datatype == ACTCONT_NONE) return;
+
if ((curarea->flag & HEADER_NO_PULLDOWN)==0) {
/* pull down menus */
More information about the Bf-blender-cvs
mailing list