[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13279] trunk/blender/source/blender: == Action Editor - Groups for Action Channels (Peach Request) ==
Joshua Leung
aligorith at gmail.com
Fri Jan 18 00:02:11 CET 2008
Revision: 13279
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13279
Author: aligorith
Date: 2008-01-18 00:02:11 +0100 (Fri, 18 Jan 2008)
Log Message:
-----------
== Action Editor - Groups for Action Channels (Peach Request) ==
Now, you can assign Action Channels to named (folder-like) groups, which help to organise the channels (important for more complex rigs). These are collapsible, can be "protected", and show a "summary" of the keyframes in the channels the Group contains. They are drawn as bright-green (active) or a darker shade of green (not active) channels.
* Each Action has its own set of Groups.
* An Action-Channel can only occur in one Group at a time. It can also not occur in any group.
* Action-Channels can be moved between Groups
* Groups + grouped-channels always occur BEFORE un-grouped channels
Important Hotkeys:
* Shift-G : Adds the selected Action-Channels to the Active Group. This will create a new group if need be
* Ctrl-Shift-G : Always adds a new group, and adds the selected Action-Channels to it
* Alt-G : Removes selected Action-Channels from their groups
* Ctrl-Shift-Alt-G : (Note: this will be removed soon) This is a simple debugging-hotkey I added, which just prints a list of the groups, channels, and their addresses...
* NKey / Ctrl-LMB: While hovering over the name of a group, this shows a popup like for other channels, which allows the editing of the channel's name, etc.
Assorted Notes:
* Some tools may not work yet with this (Ctrl Numpad+/- for example)
* Fixed some bugs in various places in Action Editor code
* Added theme colours for group channels
* The nomenclature of these tools may change in future when a better alternative is found
* The ability to auto-assign action-channels to groups when they are keyframed will be coming up shortly
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_blender.h
trunk/blender/source/blender/blenkernel/intern/action.c
trunk/blender/source/blender/blenloader/intern/readfile.c
trunk/blender/source/blender/blenloader/intern/writefile.c
trunk/blender/source/blender/include/BDR_drawaction.h
trunk/blender/source/blender/include/BIF_editaction.h
trunk/blender/source/blender/include/BSE_editaction_types.h
trunk/blender/source/blender/makesdna/DNA_action_types.h
trunk/blender/source/blender/src/drawaction.c
trunk/blender/source/blender/src/editaction.c
trunk/blender/source/blender/src/header_action.c
trunk/blender/source/blender/src/resources.c
trunk/blender/source/blender/src/usiblender.c
Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h 2008-01-17 22:57:00 UTC (rev 13278)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h 2008-01-17 23:02:11 UTC (rev 13279)
@@ -44,7 +44,7 @@
struct MemFile;
#define BLENDER_VERSION 245
-#define BLENDER_SUBVERSION 12
+#define BLENDER_SUBVERSION 13
#define BLENDER_MINVERSION 240
#define BLENDER_MINSUBVERSION 0
Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c 2008-01-17 22:57:00 UTC (rev 13278)
+++ trunk/blender/source/blender/blenkernel/intern/action.c 2008-01-17 23:02:11 UTC (rev 13279)
@@ -178,7 +178,11 @@
if (act->chanbase.first)
BLI_freelistN(&act->chanbase);
- /* Free pose-references */
+ /* Free groups */
+ if (act->groups.first)
+ BLI_freelistN(&act->groups);
+
+ /* Free pose-references (aka local markers) */
if (act->markers.first)
BLI_freelistN(&act->markers);
}
@@ -187,19 +191,37 @@
{
bAction *dst = NULL;
bActionChannel *dchan, *schan;
+ bActionGroup *dgrp, *sgrp;
if (!src) return NULL;
dst= copy_libblock(src);
+
duplicatelist(&(dst->chanbase), &(src->chanbase));
+ duplicatelist(&(dst->groups), &(src->groups));
duplicatelist(&(dst->markers), &(src->markers));
- for (dchan=dst->chanbase.first, schan=src->chanbase.first; dchan; dchan=dchan->next, schan=schan->next){
+ for (dchan=dst->chanbase.first, schan=src->chanbase.first; dchan; dchan=dchan->next, schan=schan->next) {
+ for (dgrp=dst->groups.first, sgrp=src->groups.first; dgrp && sgrp; dgrp=dgrp->next, sgrp=sgrp->next) {
+ if (dchan->grp == sgrp) {
+ dchan->grp= dgrp;
+
+ if (dgrp->channels.first == schan)
+ dgrp->channels.first= dchan;
+ if (dgrp->channels.last == schan)
+ dgrp->channels.last= dchan;
+
+ break;
+ }
+ }
+
dchan->ipo = copy_ipo(dchan->ipo);
copy_constraint_channels(&dchan->constraintChannels, &schan->constraintChannels);
}
+
dst->id.flag |= LIB_FAKEUSER;
dst->id.us++;
+
return dst;
}
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2008-01-17 22:57:00 UTC (rev 13278)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2008-01-17 23:02:11 UTC (rev 13279)
@@ -1859,12 +1859,24 @@
static void direct_link_action(FileData *fd, bAction *act)
{
bActionChannel *achan;
+ bActionGroup *agrp;
link_list(fd, &act->chanbase);
+ link_list(fd, &act->groups);
link_list(fd, &act->markers);
- for (achan = act->chanbase.first; achan; achan=achan->next)
+ for (achan = act->chanbase.first; achan; achan=achan->next) {
+ achan->grp= newdataadr(fd, achan->grp);
+
link_list(fd, &achan->constraintChannels);
+ }
+
+ for (agrp = act->groups.first; agrp; agrp= agrp->next) {
+ if (agrp->channels.first) {
+ agrp->channels.first= newdataadr(fd, agrp->channels.first);
+ agrp->channels.last= newdataadr(fd, agrp->channels.last);
+ }
+ }
}
static void direct_link_armature(FileData *fd, bArmature *arm)
Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c 2008-01-17 22:57:00 UTC (rev 13278)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c 2008-01-17 23:02:11 UTC (rev 13279)
@@ -1750,6 +1750,7 @@
{
bAction *act;
bActionChannel *chan;
+ bActionGroup *grp;
TimeMarker *marker;
for(act=idbase->first; act; act= act->id.next) {
@@ -1762,6 +1763,10 @@
write_constraint_channels(wd, &chan->constraintChannels);
}
+ for (grp=act->groups.first; grp; grp=grp->next) {
+ writestruct(wd, DATA, "bActionGroup", 1, grp);
+ }
+
for (marker=act->markers.first; marker; marker=marker->next) {
writestruct(wd, DATA, "TimeMarker", 1, marker);
}
Modified: trunk/blender/source/blender/include/BDR_drawaction.h
===================================================================
--- trunk/blender/source/blender/include/BDR_drawaction.h 2008-01-17 22:57:00 UTC (rev 13278)
+++ trunk/blender/source/blender/include/BDR_drawaction.h 2008-01-17 23:02:11 UTC (rev 13279)
@@ -38,6 +38,7 @@
struct IpoCurve;
struct gla2DDrawInfo;
struct bAction;
+struct bActionGroup;
struct Object;
struct ListBase;
@@ -75,14 +76,16 @@
/* Channel Drawing */
void draw_icu_channel(struct gla2DDrawInfo *di, struct IpoCurve *icu, float ypos);
void draw_ipo_channel(struct gla2DDrawInfo *di, struct Ipo *ipo, float ypos);
-void draw_action_channel(struct gla2DDrawInfo *di, bAction *act, float ypos);
-void draw_object_channel(struct gla2DDrawInfo *di, Object *ob, float ypos);
+void draw_agroup_channel(struct gla2DDrawInfo *di, struct bActionGroup *agrp, float ypos);
+void draw_action_channel(struct gla2DDrawInfo *di, struct bAction *act, float ypos);
+void draw_object_channel(struct gla2DDrawInfo *di, struct Object *ob, float ypos);
/* Keydata Generation */
void icu_to_keylist(struct IpoCurve *icu, ListBase *keys, ListBase *blocks);
void ipo_to_keylist(struct Ipo *ipo, ListBase *keys, ListBase *blocks);
-void action_to_keylist(bAction *act, ListBase *keys, ListBase *blocks);
-void ob_to_keylist(Object *ob, ListBase *keys, ListBase *blocks);
+void agroup_to_keylist(struct bActionGroup *agrp, ListBase *keys, ListBase *blocks);
+void action_to_keylist(struct bAction *act, ListBase *keys, ListBase *blocks);
+void ob_to_keylist(struct Object *ob, ListBase *keys, ListBase *blocks);
#endif /* BDR_DRAWACTION_H */
Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h 2008-01-17 22:57:00 UTC (rev 13278)
+++ trunk/blender/source/blender/include/BIF_editaction.h 2008-01-17 23:02:11 UTC (rev 13279)
@@ -43,6 +43,7 @@
/* Some types for easier type-testing */
enum {
ACTTYPE_NONE= 0,
+ ACTTYPE_GROUP,
ACTTYPE_ACHAN,
ACTTYPE_CONCHAN,
ACTTYPE_ICU,
@@ -53,6 +54,10 @@
};
/* Macros for easier/more consistant state testing */
+#define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0)
+#define EXPANDED_AGRP(agrp) (agrp->flag & AGRP_EXPANDED)
+#define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))
+
#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0)
#define EDITABLE_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && ((achan->flag & ACHAN_PROTECTED)==0))
#define EXPANDED_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && (achan->flag & ACHAN_EXPANDED))
@@ -81,7 +86,6 @@
/* constants for setting ipo-extrapolation type */
enum {
-
SET_EXTEND_MENU = 9,
SET_EXTEND_POPUP = 10,
@@ -91,9 +95,19 @@
SET_EXTEND_CYCLICEXTRAPOLATION
};
+/* constants for channel rearranging */
+/* WARNING: don't change exising ones without modifying rearrange func accordingly */
+enum {
+ REARRANGE_ACTCHAN_TOP= -2,
+ REARRANGE_ACTCHAN_UP= -1,
+ REARRANGE_ACTCHAN_DOWN= 1,
+ REARRANGE_ACTCHAN_BOTTOM= 2
+};
+
struct bAction;
struct bActionChannel;
+struct bActionGroup;
struct bPoseChannel;
struct Object;
struct Ipo;
@@ -125,12 +139,15 @@
void copy_actdata(void);
void paste_actdata(void);
-/* Channel/strip operations */
-void up_sel_action(void);
-void down_sel_action(void);
-void top_sel_action(void);
-void bottom_sel_action(void);
+/* Group/Channel Operations */
+struct bActionGroup *get_active_actiongroup(struct bAction *act);
+void set_active_actiongroup(struct bAction *act, struct bActionGroup *agrp, short select);
+void action_groups_group(short add_group);
+void action_groups_ungroup(void);
+/* Channel/Strip Operations */
+void rearrange_action_channels(short mode);
+
void expand_all_action(void);
void openclose_level_action(short mode);
Modified: trunk/blender/source/blender/include/BSE_editaction_types.h
===================================================================
--- trunk/blender/source/blender/include/BSE_editaction_types.h 2008-01-17 22:57:00 UTC (rev 13278)
+++ trunk/blender/source/blender/include/BSE_editaction_types.h 2008-01-17 23:02:11 UTC (rev 13279)
@@ -37,9 +37,12 @@
/* FILTERED ACTION DATA - TYPES */
/* types of keyframe data in ActListElem */
-#define ALE_NONE 0
-#define ALE_IPO 1
-#define ALE_ICU 2
+typedef enum ALE_KEYTYPE {
+ ALE_NONE = 0,
+ ALE_IPO,
+ ALE_ICU,
+ ALE_GROUP
+} ALE_KEYTYPE;
/* This struct defines a structure used for quick access */
typedef struct bActListElem {
@@ -53,6 +56,8 @@
void *key_data; /* motion data - ipo or ipo-curve */
short datatype; /* type of motion data to expect */
+ struct bActionGroup *grp; /* action group that owns the channel */
+
void *owner; /* will either be an action channel or fake ipo-channel (for keys) */
short ownertype; /* type of owner */
} bActListElem;
@@ -61,17 +66,21 @@
/* FILTER ACTION DATA - METHODS/TYPES */
/* filtering flags - under what circumstances should a channel be added */
-#define ACTFILTER_VISIBLE 0x001 /* should channels be visible */
-#define ACTFILTER_SEL 0x002 /* should channels be selected */
-#define ACTFILTER_FOREDIT 0x004 /* does editable status matter */
-#define ACTFILTER_CHANNELS 0x008 /* do we only care that it is a channel */
-#define ACTFILTER_IPOKEYS 0x010 /* only channels referencing ipo's */
-#define ACTFILTER_ONLYICU 0x020 /* only reference ipo-curves */
-#define ACTFILTER_FORDRAWING 0x040 /* make list for interface drawing */
+typedef enum ACTFILTER_FLAGS {
+ ACTFILTER_VISIBLE = (1<<0), /* should channels be visible */
+ ACTFILTER_SEL = (1<<1), /* should channels be selected */
+ ACTFILTER_FOREDIT = (1<<2), /* does editable status matter */
+ ACTFILTER_CHANNELS = (1<<3), /* do we only care that it is a channel */
+ ACTFILTER_IPOKEYS = (1<<4), /* only channels referencing ipo's */
+ ACTFILTER_ONLYICU = (1<<5), /* only reference ipo-curves */
+ ACTFILTER_FORDRAWING = (1<<6) /* make list for interface drawing */
+} ACTFILTER_FLAGS;
/* Action Editor - Main Data types */
-#define ACTCONT_NONE 0
-#define ACTCONT_ACTION 1
-#define ACTCONT_SHAPEKEY 2
+typedef enum ACTCONT_TYPES {
+ ACTCONT_NONE = 0,
+ ACTCONT_ACTION,
+ ACTCONT_SHAPEKEY
+} ACTCONT_TYPES;
#endif
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list