From 048c7879fa3879068a85aacc5c0304715b86353c Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Fri, 19 Jan 2007 10:05:17 +0000 Subject: =Forward cycling fix= Commit of patch #5385, to make forward cycling more user-controllable. Previously it only worked on one axis, which was auto-detected from movement. This allows forward cycling to work in more situations, such as stair stepping. --- source/blender/blenkernel/intern/action.c | 18 ++++++++++++------ source/blender/makesdna/DNA_nla_types.h | 4 +++- source/blender/src/drawnla.c | 11 ++++++++++- 3 files changed, 25 insertions(+), 8 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 23f6fa28d76..4161179a0a1 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -985,12 +985,18 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float Mat4Mul3Vecfl(bone->arm_mat, min); /* dominant motion, cyclic_offset was cleared in rest_pose */ - if( fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2])) - pose->cyclic_offset[0]= time*min[0]; - else if( fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2])) - pose->cyclic_offset[1]= time*min[1]; - else - pose->cyclic_offset[2]= time*min[2]; + if (strip->flag & (ACTSTRIP_CYCLIC_USEX | ACTSTRIP_CYCLIC_USEY | ACTSTRIP_CYCLIC_USEZ)) { + if (strip->flag & ACTSTRIP_CYCLIC_USEX) pose->cyclic_offset[0]= time*min[0]; + if (strip->flag & ACTSTRIP_CYCLIC_USEY) pose->cyclic_offset[1]= time*min[1]; + if (strip->flag & ACTSTRIP_CYCLIC_USEZ) pose->cyclic_offset[2]= time*min[2]; + } else { + if( fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2])) + pose->cyclic_offset[0]= time*min[0]; + else if( fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2])) + pose->cyclic_offset[1]= time*min[1]; + else + pose->cyclic_offset[2]= time*min[2]; + } } } } diff --git a/source/blender/makesdna/DNA_nla_types.h b/source/blender/makesdna/DNA_nla_types.h index 457e667018e..c1fce2772cd 100644 --- a/source/blender/makesdna/DNA_nla_types.h +++ b/source/blender/makesdna/DNA_nla_types.h @@ -91,7 +91,9 @@ typedef struct bActionStrip { #define ACTSTRIP_LOCK_ACTION 0x20 #define ACTSTRIP_MUTE 0x40 #define ACTSTRIP_REVERSE 0x80 - +#define ACTSTRIP_CYCLIC_USEX 0x100 +#define ACTSTRIP_CYCLIC_USEY 0x200 +#define ACTSTRIP_CYCLIC_USEZ 0x400 #endif diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c index e9710ff52ba..277e41b5f0e 100644 --- a/source/blender/src/drawnla.c +++ b/source/blender/src/drawnla.c @@ -589,10 +589,19 @@ static void nla_panel_properties(short cntrl) // NLA_HANDLER_PROPERTIES uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob); uiDefButBitS(block, TOG, ACTSTRIP_HOLDLASTFRAME, B_NLA_PANEL, "Hold", 160,60,75,19, &strip->flag, 0, 0, 0, 0, "Toggles whether to continue displaying the last frame past the end of the strip"); uiDefButS(block, TOG, B_NLA_PANEL, "Add", 235,60,75,19, &strip->mode, 0, 0, 0, 0, "Toggles additive blending mode"); + uiBlockEndAlign(block); - + uiDefButBitS(block, TOG, ACTSTRIP_USESTRIDE, B_NLA_PANEL, "Stride Path", 10, 30,140,19, &strip->flag, 0, 0, 0, 0, "Plays action based on path position & stride"); + if (strip->offs_bone[0]) { + uiBlockBeginAlign(block); + uiDefButBitS(block, TOG, ACTSTRIP_CYCLIC_USEX, B_NLA_PANEL, "Use X", 160,30,50,19, &strip->flag, 0, 0, 0, 0, "Turn off automatic single-axis cycling and use X as an offset axis. Note that you can use multiple axes at once."); + uiDefButBitS(block, TOG, ACTSTRIP_CYCLIC_USEY, B_NLA_PANEL, "Use Y", 210,30,50,19, &strip->flag, 0, 0, 0, 0, "Turn off automatic single-axis cycling and use Y as an offset axis. Note that you can use multiple axes at once."); + uiDefButBitS(block, TOG, ACTSTRIP_CYCLIC_USEZ, B_NLA_PANEL, "Use Z", 260,30,50,19, &strip->flag, 0, 0, 0, 0, "Turn off automatic single-axis cycling and use Z as an offset axis. Note that you can use multiple axes at once."); + uiBlockEndAlign(block); + } + if(ob->dup_group) uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_NLA_PANEL, "Target:", 160,30, 150, 19, &strip->object, "Target Object in this group"); -- cgit v1.2.3