forked from bartvdbraak/blender
Assorted tweaks for animation editors:
* Changing to the ShapeKey editor now automatically enables the value sliders * Filtering code for ShapeKey editor can now do AnimData block filtering too (internal details...) * Silenced console warnings when inserting keyframes on F-Curves with no keyframes already (for Animation Editor sliders) * Made the update code for keyframe transforms send more general depsgraph updates. Unfortuately, this still doesn't resolve the update problems with shapekeys
This commit is contained in:
parent
474e97e6d2
commit
53624a53d9
@ -2236,6 +2236,17 @@ void DAG_id_flush_update(ID *id, short flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set flags based on ShapeKey */
|
||||||
|
if(idtype == ID_KE) {
|
||||||
|
for(obt=bmain->object.first; obt; obt= obt->id.next) {
|
||||||
|
Key *key= ob_get_key(obt);
|
||||||
|
if(!(ob && obt == ob) && ((ID *)key == id)) {
|
||||||
|
obt->flag |= (OB_RECALC|OB_RECALC_DATA);
|
||||||
|
BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* set flags based on particle settings */
|
/* set flags based on particle settings */
|
||||||
if(idtype == ID_PA) {
|
if(idtype == ID_PA) {
|
||||||
ParticleSystem *psys;
|
ParticleSystem *psys;
|
||||||
|
@ -926,11 +926,11 @@ static int animdata_filter_nla (ListBase *anim_data, bDopeSheet *ads, AnimData *
|
|||||||
/* Include ShapeKey Data for ShapeKey Editor */
|
/* Include ShapeKey Data for ShapeKey Editor */
|
||||||
static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_mode)
|
static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_mode)
|
||||||
{
|
{
|
||||||
|
bAnimListElem *ale;
|
||||||
int items = 0;
|
int items = 0;
|
||||||
|
|
||||||
/* check if channels or only F-Curves */
|
/* check if channels or only F-Curves */
|
||||||
if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
|
if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
|
||||||
bAnimListElem *ale;
|
|
||||||
KeyBlock *kb;
|
KeyBlock *kb;
|
||||||
|
|
||||||
/* loop through the channels adding ShapeKeys as appropriate */
|
/* loop through the channels adding ShapeKeys as appropriate */
|
||||||
@ -959,9 +959,13 @@ static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_m
|
|||||||
else {
|
else {
|
||||||
/* just use the action associated with the shapekey */
|
/* just use the action associated with the shapekey */
|
||||||
// FIXME: is owner-id and having no owner/dopesheet really fine?
|
// FIXME: is owner-id and having no owner/dopesheet really fine?
|
||||||
if (key->adt && key->adt->action)
|
if (key->adt) {
|
||||||
|
if (filter_mode & ANIMFILTER_ANIMDATA)
|
||||||
|
ANIMDATA_ADD_ANIMDATA(key)
|
||||||
|
else if (key->adt->action)
|
||||||
items= animdata_filter_action(anim_data, NULL, key->adt->action, filter_mode, NULL, ANIMTYPE_NONE, (ID *)key);
|
items= animdata_filter_action(anim_data, NULL, key->adt->action, filter_mode, NULL, ANIMTYPE_NONE, (ID *)key);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* return the number of items added to the list */
|
/* return the number of items added to the list */
|
||||||
return items;
|
return items;
|
||||||
|
@ -1430,7 +1430,7 @@ int autokeyframe_cfra_can_key(Scene *scene, ID *id)
|
|||||||
short fcurve_frame_has_keyframe (FCurve *fcu, float frame, short filter)
|
short fcurve_frame_has_keyframe (FCurve *fcu, float frame, short filter)
|
||||||
{
|
{
|
||||||
/* quick sanity check */
|
/* quick sanity check */
|
||||||
if (fcu == NULL)
|
if (ELEM(NULL, fcu, fcu->bezt))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* we either include all regardless of muting, or only non-muted */
|
/* we either include all regardless of muting, or only non-muted */
|
||||||
|
@ -258,7 +258,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
|
|||||||
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT))
|
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT))
|
||||||
sel= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT);
|
sel= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT);
|
||||||
|
|
||||||
if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET)) {
|
if (ELEM3(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) {
|
||||||
switch (ale->type) {
|
switch (ale->type) {
|
||||||
case ANIMTYPE_SUMMARY:
|
case ANIMTYPE_SUMMARY:
|
||||||
{
|
{
|
||||||
@ -307,17 +307,6 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
|
|||||||
if (ac->datatype == ANIMCONT_ACTION)
|
if (ac->datatype == ANIMCONT_ACTION)
|
||||||
glRectf(act_start, (float)y-ACHANNEL_HEIGHT_HALF, act_end, (float)y+ACHANNEL_HEIGHT_HALF);
|
glRectf(act_start, (float)y-ACHANNEL_HEIGHT_HALF, act_end, (float)y+ACHANNEL_HEIGHT_HALF);
|
||||||
}
|
}
|
||||||
else if (ac->datatype == ANIMCONT_SHAPEKEY) {
|
|
||||||
/* all frames that have a frame number less than one
|
|
||||||
* get a desaturated orange background
|
|
||||||
*/
|
|
||||||
glColor4ub(col2[0], col2[1], col2[2], 0x22);
|
|
||||||
glRectf(0.0f, (float)y-ACHANNEL_HEIGHT_HALF, 1.0f, (float)y+ACHANNEL_HEIGHT_HALF);
|
|
||||||
|
|
||||||
/* frames one and higher get a saturated orange background */
|
|
||||||
glColor4ub(col2[0], col2[1], col2[2], 0x44);
|
|
||||||
glRectf(1.0f, (float)y-ACHANNEL_HEIGHT_HALF, v2d->cur.xmax+EXTRA_SCROLL_PAD, (float)y+ACHANNEL_HEIGHT_HALF);
|
|
||||||
}
|
|
||||||
else if (ac->datatype == ANIMCONT_GPENCIL) {
|
else if (ac->datatype == ANIMCONT_GPENCIL) {
|
||||||
/* frames less than one get less saturated background */
|
/* frames less than one get less saturated background */
|
||||||
if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
|
if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
B_REDR= 1,
|
B_REDR= 1,
|
||||||
|
B_MODECHANGE,
|
||||||
} eActHeader_Events;
|
} eActHeader_Events;
|
||||||
|
|
||||||
/* ********************************************************* */
|
/* ********************************************************* */
|
||||||
@ -254,6 +255,15 @@ static void act_editmenu(bContext *C, uiLayout *layout, void *arg_unused)
|
|||||||
|
|
||||||
static void do_action_buttons(bContext *C, void *arg, int event)
|
static void do_action_buttons(bContext *C, void *arg, int event)
|
||||||
{
|
{
|
||||||
|
/* special exception for mode changing - enable custom settings? */
|
||||||
|
if (event == B_MODECHANGE) {
|
||||||
|
SpaceAction *saction= CTX_wm_space_action(C);
|
||||||
|
|
||||||
|
/* if the new mode is ShapeKeys editor, enable sliders */
|
||||||
|
if (saction->mode == SACTCONT_SHAPEKEY)
|
||||||
|
saction->flag |= SACTION_SLIDERS;
|
||||||
|
}
|
||||||
|
|
||||||
ED_area_tag_refresh(CTX_wm_area(C));
|
ED_area_tag_refresh(CTX_wm_area(C));
|
||||||
ED_area_tag_redraw(CTX_wm_area(C));
|
ED_area_tag_redraw(CTX_wm_area(C));
|
||||||
}
|
}
|
||||||
@ -318,7 +328,7 @@ void action_header_buttons(const bContext *C, ARegion *ar)
|
|||||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||||
|
|
||||||
/* MODE SELECTOR */
|
/* MODE SELECTOR */
|
||||||
uiDefButC(block, MENU, B_REDR,
|
uiDefButC(block, MENU, B_MODECHANGE,
|
||||||
"Editor Mode %t|DopeSheet %x3|Action Editor %x0|ShapeKey Editor %x1|Grease Pencil %x2",
|
"Editor Mode %t|DopeSheet %x3|Action Editor %x0|ShapeKey Editor %x1|Grease Pencil %x2",
|
||||||
xco,yco,90,YIC, &saction->mode, 0, 1, 0, 0,
|
xco,yco,90,YIC, &saction->mode, 0, 1, 0, 0,
|
||||||
"Editing modes for this editor");
|
"Editing modes for this editor");
|
||||||
|
@ -284,15 +284,8 @@ static void animedit_refresh_id_tags (Scene *scene, ID *id)
|
|||||||
if (adt)
|
if (adt)
|
||||||
adt->recalc |= ADT_RECALC_ANIM;
|
adt->recalc |= ADT_RECALC_ANIM;
|
||||||
|
|
||||||
/* if ID-block is Object, set recalc flags */
|
/* set recalc flags */
|
||||||
switch (GS(id->name)) {
|
DAG_id_flush_update(id, OB_RECALC); // XXX or do we want something more restrictive?
|
||||||
case ID_OB:
|
|
||||||
{
|
|
||||||
Object *ob= (Object *)id;
|
|
||||||
DAG_id_flush_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user