diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-07-10 04:15:57 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-07-10 04:15:57 +0400 |
commit | 496a9c1a95c4d7f4219f713c274edf29d9d5d41d (patch) | |
tree | dbe0eb6b0007ffbf92b7548a9bccb984b0c3149f /source/blender/src | |
parent | b915ba5e970b1dd594e81318828321c5fb8c38f7 (diff) |
Apricot Request:
When changing the active action in the NLA editor with NLA-override off, armatures now have their restpose applied before the new action is evaluated.
I've commented the code here to make it clearer what is going on.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/editnla.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index d758f34949a..dbc0deecb2c 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -501,26 +501,47 @@ static void set_active_strip(Object *ob, bActionStrip *act) { bActionStrip *strip; + /* make sure all other strips are not active */ for (strip = ob->nlastrips.first; strip; strip=strip->next) strip->flag &= ~ACTSTRIP_ACTIVE; - if(act) { + /* act is new active strip */ + if (act) { + /* set active flag for this strip */ act->flag |= ACTSTRIP_ACTIVE; - - if(ob->action!=act->act) { - if(ob->action) ob->action->id.us--; - if(act->act->id.lib) { + + /* check if active action will still be the same one */ + if (ob->action != act->act) { + /* clear object's links with its current action (if present) */ + if (ob->action) { + ob->action->id.us--; + } + + /* only set object's action to active strip's action if possible */ + if (act->act->id.lib) { ob->action= NULL; } else { ob->action= act->act; id_us_plus(&ob->action->id); - } + } + + /* request redrawing in relevant spaces */ allqueue(REDRAWIPO, 0); allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWACTION, 0); allqueue(REDRAWNLA, 0); - ob->ctime= -1234567.0f; // eveil! + + /* when only showing action (i.e. nla-override off), + * reset pose to restpose for armatures + */ + if ((ob->nlaflag & OB_NLA_OVERRIDE)==0) { + if (ob->type == OB_ARMATURE) + rest_pose(ob->pose); + } + + /* flush depsgraph */ + ob->ctime= -1234567.0f; // evil! DAG_object_flush_update(G.scene, ob, OB_RECALC_OB|OB_RECALC_DATA); } } |