AnimSys2: More DopeSheet Improvements (ShapeKeys...)
* Added ShapeKeys to DopeSheet * Sliders now work in the DopeSheet
This commit is contained in:
@@ -53,6 +53,7 @@ enum {
|
||||
ACTTYPE_FILLACTD,
|
||||
ACTTYPE_FILLIPOD,
|
||||
ACTTYPE_FILLCOND,
|
||||
ACTTYPE_FILLSKED,
|
||||
|
||||
ACTTYPE_ACHAN,
|
||||
ACTTYPE_CONCHAN,
|
||||
@@ -70,6 +71,7 @@ enum {
|
||||
#define EXPANDED_OBJC(ob) ((ob->nlaflag & OB_ADS_COLLAPSED)==0)
|
||||
#define FILTER_IPO_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWIPO))
|
||||
#define FILTER_CON_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWCONS))
|
||||
#define FILTER_SKE_OBJC(key) ((key->flag & KEYBLOCK_EXPAND))
|
||||
#define SEL_ACTC(actc) ((actc->flag & ACTC_SELECTED))
|
||||
#define EXPANDED_ACTC(actc) ((actc->flag & ACTC_EXPANDED))
|
||||
|
||||
|
@@ -86,6 +86,7 @@ typedef struct Key {
|
||||
|
||||
/* keyblock->flag */
|
||||
#define KEYBLOCK_MUTE 1
|
||||
#define KEYBLOCK_EXPAND 2
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -300,7 +300,7 @@ static void action_icu_buts(SpaceAction *saction)
|
||||
block= uiNewBlock (&curarea->uiblocks, str,
|
||||
UI_EMBOSS, UI_HELV, curarea->win);
|
||||
|
||||
x = NAMEWIDTH + 1;
|
||||
x = (float)NAMEWIDTH + 1;
|
||||
y = 0.0f;
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
@@ -336,8 +336,8 @@ static void action_icu_buts(SpaceAction *saction)
|
||||
bActionChannel *achan = (bActionChannel *)ale->owner;
|
||||
IpoCurve *icu = (IpoCurve *)ale->key_data;
|
||||
|
||||
/* only show if action channel is selected */
|
||||
if (SEL_ACHAN(achan)) {
|
||||
/* only show if owner is selected */
|
||||
if ((ale->ownertype == ACTTYPE_OBJECT) || SEL_ACHAN(achan)) {
|
||||
make_icu_slider(block, icu,
|
||||
(int)x, (int)y, SLIDERWIDTH-2, CHANNELHEIGHT-2,
|
||||
"Slider to control current value of Constraint Influence");
|
||||
@@ -349,8 +349,8 @@ static void action_icu_buts(SpaceAction *saction)
|
||||
bActionChannel *achan = (bActionChannel *)ale->owner;
|
||||
IpoCurve *icu = (IpoCurve *)ale->key_data;
|
||||
|
||||
/* only show if action channel is selected */
|
||||
if (SEL_ACHAN(achan)) {
|
||||
/* only show if owner is selected */
|
||||
if ((ale->ownertype == ACTTYPE_OBJECT) || SEL_ACHAN(achan)) {
|
||||
make_icu_slider(block, icu,
|
||||
(int)x, (int)y, SLIDERWIDTH-2, CHANNELHEIGHT-2,
|
||||
"Slider to control current value of IPO-Curve");
|
||||
@@ -359,7 +359,19 @@ static void action_icu_buts(SpaceAction *saction)
|
||||
break;
|
||||
case ACTTYPE_SHAPEKEY: /* shapekey channel */
|
||||
{
|
||||
// TODO...
|
||||
Object *ob= (Object *)ale->id;
|
||||
IpoCurve *icu= (IpoCurve *)ale->key_data;
|
||||
|
||||
// TODO: only show if object is active
|
||||
if (icu) {
|
||||
make_icu_slider(block, icu,
|
||||
(int)x, (int)y, SLIDERWIDTH-2, CHANNELHEIGHT-2,
|
||||
"Slider to control ShapeKey");
|
||||
}
|
||||
else if (ob && ale->index) {
|
||||
make_rvk_slider(block, ob, ale->index,
|
||||
(int)x, (int)y, SLIDERWIDTH-2, CHANNELHEIGHT-1, "Slider to control Shape Keys");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -531,6 +543,23 @@ static void draw_channel_names(void)
|
||||
sprintf(name, "IPO Curves");
|
||||
}
|
||||
break;
|
||||
case ACTTYPE_FILLSKED: /* shapekeys (dopesheet) expand widget */
|
||||
{
|
||||
Key *key= (Key *)ale->data;
|
||||
|
||||
group = 4;
|
||||
indent = 1;
|
||||
special = ICON_EDIT;
|
||||
|
||||
if (FILTER_SKE_OBJC(key))
|
||||
expand = ICON_TRIA_DOWN;
|
||||
else
|
||||
expand = ICON_TRIA_RIGHT;
|
||||
|
||||
//sel = SEL_OBJC(base);
|
||||
sprintf(name, "Shape Keys");
|
||||
}
|
||||
break;
|
||||
case ACTTYPE_FILLCOND: /* constraint channels (dopesheet) expand widget */
|
||||
{
|
||||
Object *ob = (Object *)ale->data;
|
||||
@@ -712,6 +741,8 @@ static void draw_channel_names(void)
|
||||
indent = 0;
|
||||
special = -1;
|
||||
|
||||
offset= (ale->id) ? 21 : 0;
|
||||
|
||||
if (kb->name[0] == '\0')
|
||||
sprintf(name, "Key %d", ale->index);
|
||||
else
|
||||
@@ -1490,7 +1521,7 @@ void drawactionspace(ScrArea *sa, void *spacedata)
|
||||
draw_channel_names();
|
||||
|
||||
if(sa->winx > 50 + NAMEWIDTH + SLIDERWIDTH) {
|
||||
if (act) {
|
||||
if (ELEM(G.saction->mode, SACTCONT_ACTION, SACTCONT_DOPESHEET)) {
|
||||
/* if there is an action, draw sliders for its
|
||||
* ipo-curve channels in the action window
|
||||
*/
|
||||
|
@@ -239,6 +239,16 @@ bActListElem *make_new_actlistelem (void *data, short datatype, void *owner, sho
|
||||
ale->datatype= ALE_IPO;
|
||||
}
|
||||
break;
|
||||
case ACTTYPE_FILLSKED:
|
||||
{
|
||||
Key *key= (Key *)data;
|
||||
|
||||
ale->flag = FILTER_SKE_OBJC(key);
|
||||
|
||||
ale->key_data= key->ipo;
|
||||
ale->datatype= ALE_IPO;
|
||||
}
|
||||
break;
|
||||
case ACTTYPE_FILLCOND:
|
||||
{
|
||||
Object *ob= (Object *)data;
|
||||
@@ -537,11 +547,12 @@ static void actdata_filter_action (ListBase *act_data, bAction *act, int filter_
|
||||
}
|
||||
}
|
||||
|
||||
static void actdata_filter_shapekey (ListBase *act_data, Key *key, int filter_mode)
|
||||
static void actdata_filter_shapekey (ListBase *act_data, Key *key, int filter_mode, void *owner, short ownertype)
|
||||
{
|
||||
bActListElem *ale;
|
||||
KeyBlock *kb;
|
||||
IpoCurve *icu;
|
||||
short owned= (owner && ownertype)? 1 : 0;
|
||||
int i;
|
||||
|
||||
/* are we filtering for display or editing */
|
||||
@@ -552,7 +563,7 @@ static void actdata_filter_shapekey (ListBase *act_data, Key *key, int filter_mo
|
||||
/* loop through possible shapekeys, manually creating entries */
|
||||
for (i= 1; i < key->totkey; i++) {
|
||||
ale= MEM_callocN(sizeof(bActListElem), "bActListElem");
|
||||
kb = kb->next;
|
||||
kb = kb->next; /* do this even on the first try, as the first is 'Basis' (which doesn't get included) */
|
||||
|
||||
ale->data= kb;
|
||||
ale->type= ACTTYPE_SHAPEKEY; /* 'abused' usage of this type */
|
||||
@@ -571,6 +582,8 @@ static void actdata_filter_shapekey (ListBase *act_data, Key *key, int filter_mo
|
||||
}
|
||||
}
|
||||
|
||||
if (owned) ale->id= owner;
|
||||
|
||||
BLI_addtail(act_data, ale);
|
||||
}
|
||||
}
|
||||
@@ -579,12 +592,18 @@ static void actdata_filter_shapekey (ListBase *act_data, Key *key, int filter_mo
|
||||
if (key->ipo) {
|
||||
if (filter_mode & ACTFILTER_IPOKEYS) {
|
||||
ale= make_new_actlistelem(key->ipo, ACTTYPE_IPO, key, ACTTYPE_SHAPEKEY);
|
||||
if (ale) BLI_addtail(act_data, ale);
|
||||
if (ale) {
|
||||
if (owned) ale->id= owner;
|
||||
BLI_addtail(act_data, ale);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (icu= key->ipo->curve.first; icu; icu=icu->next) {
|
||||
ale= make_new_actlistelem(icu, ACTTYPE_ICU, key, ACTTYPE_SHAPEKEY);
|
||||
if (ale) BLI_addtail(act_data, ale);
|
||||
if (ale) {
|
||||
if (owned) ale->id= owner;
|
||||
BLI_addtail(act_data, ale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -647,11 +666,12 @@ static void actdata_filter_dopesheet_ob (ListBase *act_data, bDopeSheet *ads, Ba
|
||||
bActListElem *ale=NULL;
|
||||
Scene *sce= (Scene *)ads->source;
|
||||
Object *ob= base->object;
|
||||
Key *key= ob_get_key(ob);
|
||||
|
||||
/* add this object as a channel first */
|
||||
if (!(filter_mode & ACTFILTER_ONLYICU) && !(filter_mode & ACTFILTER_IPOKEYS)) {
|
||||
/* check if filtering by selection */
|
||||
if (!(filter_mode & ACTFILTER_SEL) || ((base->flag & SELECT) || (base == sce->basact)) {
|
||||
if ( !(filter_mode & ACTFILTER_SEL) || ((base->flag & SELECT) || (base == sce->basact)) ) {
|
||||
ale= make_new_actlistelem(base, ACTTYPE_OBJECT, NULL, ACTTYPE_NONE);
|
||||
if (ale) BLI_addtail(act_data, ale);
|
||||
}
|
||||
@@ -701,6 +721,20 @@ static void actdata_filter_dopesheet_ob (ListBase *act_data, bDopeSheet *ads, Ba
|
||||
}
|
||||
}
|
||||
|
||||
/* ShapeKeys? */
|
||||
if (key) {
|
||||
/* include shapekey-expand widget? */
|
||||
if ((filter_mode & ACTFILTER_CHANNELS) && !(filter_mode & (ACTFILTER_IPOKEYS|ACTFILTER_ONLYICU))) {
|
||||
ale= make_new_actlistelem(key, ACTTYPE_FILLSKED, base, ACTTYPE_OBJECT);
|
||||
if (ale) BLI_addtail(act_data, ale);
|
||||
}
|
||||
|
||||
/* add channels */
|
||||
if (FILTER_SKE_OBJC(key) || (filter_mode & ACTFILTER_IPOKEYS) || (filter_mode & ACTFILTER_ONLYICU)) {
|
||||
actdata_filter_shapekey (act_data, key, filter_mode, ob, ACTTYPE_OBJECT);
|
||||
}
|
||||
}
|
||||
|
||||
/* Constraint Channels? */
|
||||
if (ob->constraintChannels.first) {
|
||||
bConstraintChannel *conchan;
|
||||
@@ -753,6 +787,7 @@ static void actdata_filter_dopesheet (ListBase *act_data, bDopeSheet *ads, int f
|
||||
/* check if there's an object (all the relevant checks are done in the ob-function) */
|
||||
if (base->object) {
|
||||
Object *ob= base->object;
|
||||
Key *key= ob_get_key(ob);
|
||||
|
||||
/* firstly, check if object can be included, by the following factors:
|
||||
* - if only visible, must check for layer and also viewport visibility
|
||||
@@ -767,7 +802,7 @@ static void actdata_filter_dopesheet (ListBase *act_data, bDopeSheet *ads, int f
|
||||
/* outliner restrict-flag */
|
||||
if (ob->restrictflag & OB_RESTRICT_VIEW) continue;
|
||||
}
|
||||
if (!(ob->ipo) && !(ob->action) && !(ob->constraintChannels.first)) {
|
||||
if (!(ob->ipo) && !(ob->action) && !(ob->constraintChannels.first) && !(key)) {
|
||||
/* no animation data to show... */
|
||||
continue;
|
||||
}
|
||||
@@ -796,7 +831,7 @@ void actdata_filter (ListBase *act_data, int filter_mode, void *data, short data
|
||||
actdata_filter_action(act_data, data, filter_mode, NULL, ACTTYPE_NONE);
|
||||
break;
|
||||
case ACTCONT_SHAPEKEY:
|
||||
actdata_filter_shapekey(act_data, data, filter_mode);
|
||||
actdata_filter_shapekey(act_data, data, filter_mode, NULL, ACTTYPE_NONE);
|
||||
break;
|
||||
case ACTCONT_GPENCIL:
|
||||
actdata_filter_gpencil(act_data, data, filter_mode);
|
||||
@@ -4405,6 +4440,12 @@ static void mouse_actionchannels (short mval[])
|
||||
ob->nlaflag ^= OB_ADS_SHOWCONS;
|
||||
}
|
||||
break;
|
||||
case ACTTYPE_FILLSKED:
|
||||
{
|
||||
Key *key= (Key *)act_channel;
|
||||
key->flag ^= KEYBLOCK_EXPAND;
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTTYPE_GROUP:
|
||||
{
|
||||
@@ -4575,6 +4616,9 @@ static void mouse_actionchannels (short mval[])
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTTYPE_SHAPEKEY:
|
||||
/* TODO: shapekey channels cannot be selected atm... */
|
||||
break;
|
||||
default:
|
||||
printf("Error: Invalid channel type in mouse_actionchannels \n");
|
||||
return;
|
||||
|
Reference in New Issue
Block a user