forked from bartvdbraak/blender
== Action Editor ==
When the current action is the active strip in the nla editor and that strip is scaled, snapping keys to the current frame didn't work correct. Now, I've added a correction for snapping and mirroring keyframes in action editor for such cases.
This commit is contained in:
parent
a3468fd0bd
commit
d1c9de7cd6
@ -138,6 +138,8 @@ void filter_sampledata(float *data, int sfra, int efra);
|
||||
void sampledata_to_ipocurve(float *data, int sfra, int efra, struct IpoCurve *icu);
|
||||
void ipo_record(void);
|
||||
|
||||
void actstrip_map_ipo_keys(struct Object *ob, struct Ipo *ipo, short restore);
|
||||
|
||||
void sethandles_ipo_keys(struct Ipo *ipo, int code);
|
||||
void snap_ipo_keys(struct Ipo *ipo, short snaptype);
|
||||
void mirror_ipo_keys(struct Ipo *ipo, short mirror_mode);
|
||||
|
@ -2163,16 +2163,32 @@ static void set_snap_actionchannels(bAction *act, short snaptype)
|
||||
/* Loop through the channels */
|
||||
for (achan = act->chanbase.first; achan; achan= achan->next){
|
||||
if(EDITABLE_ACHAN(achan)) {
|
||||
if (achan->ipo)
|
||||
snap_ipo_keys(achan->ipo, snaptype);
|
||||
if (achan->ipo) {
|
||||
if(G.saction->pin==0 && OBACT) {
|
||||
actstrip_map_ipo_keys(OBACT, achan->ipo, 0);
|
||||
snap_ipo_keys(achan->ipo, snaptype);
|
||||
actstrip_map_ipo_keys(OBACT, achan->ipo, 1);
|
||||
}
|
||||
else {
|
||||
snap_ipo_keys(achan->ipo, snaptype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (VISIBLE_ACHAN(achan)) {
|
||||
/* constraint channels */
|
||||
for (conchan=achan->constraintChannels.first; conchan; conchan= conchan->next) {
|
||||
if (EDITABLE_CONCHAN(conchan)) {
|
||||
if (conchan->ipo)
|
||||
snap_ipo_keys(conchan->ipo, snaptype);
|
||||
if (conchan->ipo) {
|
||||
if(G.saction->pin==0 && OBACT) {
|
||||
actstrip_map_ipo_keys(OBACT, conchan->ipo, 0);
|
||||
snap_ipo_keys(conchan->ipo, snaptype);
|
||||
actstrip_map_ipo_keys(OBACT, conchan->ipo, 1);
|
||||
}
|
||||
else {
|
||||
snap_ipo_keys(conchan->ipo, snaptype);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2241,16 +2257,32 @@ static void mirror_actionchannels(bAction *act, short mirror_mode)
|
||||
/* Loop through the channels */
|
||||
for (achan = act->chanbase.first; achan; achan= achan->next){
|
||||
if(EDITABLE_ACHAN(achan)) {
|
||||
if (achan->ipo)
|
||||
mirror_ipo_keys(achan->ipo, mirror_mode);
|
||||
if (achan->ipo) {
|
||||
if(G.saction->pin==0 && OBACT) {
|
||||
actstrip_map_ipo_keys(OBACT, achan->ipo, 0);
|
||||
mirror_ipo_keys(achan->ipo, mirror_mode);
|
||||
actstrip_map_ipo_keys(OBACT, achan->ipo, 1);
|
||||
}
|
||||
else {
|
||||
mirror_ipo_keys(achan->ipo, mirror_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (VISIBLE_ACHAN(achan)) {
|
||||
/* constraint channels */
|
||||
for (conchan=achan->constraintChannels.first; conchan; conchan= conchan->next) {
|
||||
if (EDITABLE_CONCHAN(conchan)) {
|
||||
if (conchan->ipo)
|
||||
mirror_ipo_keys(conchan->ipo, mirror_mode);
|
||||
if (conchan->ipo) {
|
||||
if(G.saction->pin==0 && OBACT) {
|
||||
actstrip_map_ipo_keys(OBACT, conchan->ipo, 0);
|
||||
mirror_ipo_keys(conchan->ipo, mirror_mode);
|
||||
actstrip_map_ipo_keys(OBACT, conchan->ipo, 1);
|
||||
}
|
||||
else {
|
||||
mirror_ipo_keys(conchan->ipo, mirror_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "DNA_view3d_types.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_key.h"
|
||||
#include "BKE_utildefines.h"
|
||||
@ -617,6 +618,25 @@ void mirror_ipo_keys(Ipo *ipo, short mirror_type)
|
||||
}
|
||||
}
|
||||
|
||||
/* currently only used by some action editor tools, but may soon get used by ipo editor */
|
||||
void actstrip_map_ipo_keys(Object *ob, Ipo *ipo, short restore)
|
||||
{
|
||||
IpoCurve *icu;
|
||||
BezTriple *bezt;
|
||||
int a;
|
||||
|
||||
/* loop through all ipo curves, adjusting the times of the selected keys */
|
||||
for (icu= ipo->curve.first; icu; icu= icu->next) {
|
||||
for (a=0, bezt=icu->bezt; a<icu->totvert; a++, bezt++) {
|
||||
/* are the times being adjusted for editing, or has editing finished */
|
||||
if (restore)
|
||||
bezt->vec[1][0]= get_action_frame(ob, bezt->vec[1][0]);
|
||||
else
|
||||
bezt->vec[1][0]= get_action_frame_inv(ob, bezt->vec[1][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ipo_curves_auto_horiz(void)
|
||||
{
|
||||
EditIpo *ei;
|
||||
|
Loading…
Reference in New Issue
Block a user