diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-11-21 07:49:13 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-11-21 07:49:13 +0300 |
commit | 00762be141fcbb1fca046a33f9045440167c0c1e (patch) | |
tree | 92f94512bd9f7c9cb88a4d689c21444181a89b25 /source/blender/blenkernel/intern | |
parent | b276050a08a93ea61e4fe085278e8c1feff399d2 (diff) |
Patch #7779: Make the 'Hold' option work with NLA action modifiers
Patch by: Matt Ebb (broken)
Currently in Blender, NLA action modifiers can work in very wacky and mysterious ways.
If an action is being modified with a path deform, when it reaches the end of that strip, it will snap back to the original un-modified location, regardless of whether the strip 'Hold' option is on. It's very frustrating to work with, and causes all sorts of problems - if you use a path to make a character walk from point A to point B, you generally want him to stay at point B, and not jump somewhere completely different, just because the strip ended.
This patch fixes this behaviour, and makes it much more sensible and predictable. There is a chance that this will break old files that were reliant on the old broken behaviour though, but I think it's definitely worthwhile to fix this problem.
Check the demo file in Blender 2.45 vs one with this patch applied - you can see the difference in behaviour.
Demo File Link (attachment in original tracker post):
https://projects.blender.org/tracker/download.php/9/127/7779/4856/wheelsetup2.zip
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 9450e32806f..59786afd999 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1888,12 +1888,42 @@ static void where_is_ik_bone(bPoseChannel *pchan, float ik_mat[][3]) // nr = t static void do_strip_modifiers(Object *armob, Bone *bone, bPoseChannel *pchan) { bActionModifier *amod; - bActionStrip *strip; + bActionStrip *strip, *strip2; float scene_cfra= G.scene->r.cfra; + int do_modif; for (strip=armob->nlastrips.first; strip; strip=strip->next) { - if(scene_cfra>=strip->start && scene_cfra<=strip->end) { + do_modif=0; + + if (scene_cfra>=strip->start && scene_cfra<=strip->end) + do_modif=1; + + if ((scene_cfra > strip->end) && (strip->flag & ACTSTRIP_HOLDLASTFRAME)) { + do_modif=1; + + /* if there are any other strips active, ignore modifiers for this strip - + * 'hold' option should only hold action modifiers if there are + * no other active strips */ + for (strip2=strip->next; strip2; strip2=strip2->next) { + if (strip2 == strip) continue; + + if (scene_cfra>=strip2->start && scene_cfra<=strip2->end) { + if (!(strip2->flag & ACTSTRIP_MUTE)) + do_modif=0; + } + } + /* if there are any later, activated, strips with 'hold' set, they take precedence, + * so ignore modifiers for this strip */ + for (strip2=strip->next; strip2; strip2=strip2->next) { + if (scene_cfra < strip2->start) continue; + if ((strip2->flag & ACTSTRIP_HOLDLASTFRAME) && !(strip2->flag & ACTSTRIP_MUTE)) { + do_modif=0; + } + } + } + + if (do_modif) { /* temporal solution to prevent 2 strips accumulating */ if(scene_cfra==strip->end && strip->next && strip->next->start==scene_cfra) continue; |