Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2007-04-28 13:35:16 +0400
committerJoshua Leung <aligorith@gmail.com>2007-04-28 13:35:16 +0400
commit6bb16e0c86c553697f6cade8c6e1cd166f993d2c (patch)
tree43774cd31992ce005b975327e558443f8d5cedb1 /source
parent705671ebaac3648f67ebc3c12b441e0a2b09df2d (diff)
== IPO Editor - Scaled Curves for NLA-Strip Curves ==
This commit resolves an issue dating back a few releases. When the IPO block being displayed in the IPO editor came from an Action being used as an Action Strip in the NLA editor, the keyframes in the IPO editor were not displayed in 'NLA-time'. There are however a number of things that still need work on so that they will play nicely with these changes. Having said that, the IPO editor is still generally stable for use (or should be). In case anything plays up, 'pin' the IPO view you're using to turn off these changes. This resolves Todo #4335. Known Issues: * When 'K' (show keys) mode is on, it doesn't work too too well yet. The display in such situations will be a bit confusing. * Pressing IKEY in the IPO editor (for inserting a keyframe on the current frame) also doesn't work too well yet. It will insert a keyframe on the wrong frame. * Transforms don't get any correction for scaling yet. This is only an issue when snapping transforms to the grid, or relying on the delta numbers printed in the header.
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BSE_editipo.h2
-rw-r--r--source/blender/src/drawipo.c14
-rw-r--r--source/blender/src/editaction.c24
-rw-r--r--source/blender/src/editipo.c50
-rw-r--r--source/blender/src/editipo_mods.c36
5 files changed, 110 insertions, 16 deletions
diff --git a/source/blender/include/BSE_editipo.h b/source/blender/include/BSE_editipo.h
index 6ec0420a95f..01f985018ed 100644
--- a/source/blender/include/BSE_editipo.h
+++ b/source/blender/include/BSE_editipo.h
@@ -141,7 +141,7 @@ 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 actstrip_map_ipo_keys(struct Object *ob, struct Ipo *ipo, short restore, short only_keys);
void sethandles_ipo_keys(struct Ipo *ipo, int code);
void snap_ipo_keys(struct Ipo *ipo, short snaptype);
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index 36cf21d3114..336ac281f5d 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -2155,6 +2155,13 @@ void drawipospace(ScrArea *sa, void *spacedata)
ei= sipo->editipo;
draw_key(sipo, ei->flag & IPO_VISIBLE);
}
+
+ /* map ipo-points for drawing if scaled ipo */
+ if (OBACT && OBACT->action && sipo->pin==0) {
+ if (sipo->actname || sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, sipo->ipo, 0, 0);
+ }
+ }
/* draw deselect */
draw_ipocurves(0);
@@ -2166,6 +2173,13 @@ void drawipospace(ScrArea *sa, void *spacedata)
draw_ipohandles(1);
draw_ipovertices(1);
+ /* undo mapping of ipo-points for drawing if scaled ipo */
+ if (OBACT && OBACT->action && sipo->pin==0) {
+ if (sipo->actname || sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, sipo->ipo, 1, 0);
+ }
+ }
+
/* Draw 'curtains' for preview */
draw_anim_preview_timespace();
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index d3e32c541f7..83e341af8fa 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -2484,9 +2484,9 @@ static void set_snap_actionchannels(bAction *act, short snaptype)
if(EDITABLE_ACHAN(achan)) {
if (achan->ipo) {
if(G.saction->pin==0 && OBACT) {
- actstrip_map_ipo_keys(OBACT, achan->ipo, 0);
+ actstrip_map_ipo_keys(OBACT, achan->ipo, 0, 1);
snap_ipo_keys(achan->ipo, snaptype);
- actstrip_map_ipo_keys(OBACT, achan->ipo, 1);
+ actstrip_map_ipo_keys(OBACT, achan->ipo, 1, 1);
}
else {
snap_ipo_keys(achan->ipo, snaptype);
@@ -2501,9 +2501,9 @@ static void set_snap_actionchannels(bAction *act, short snaptype)
if (EDITABLE_CONCHAN(conchan)) {
if (conchan->ipo) {
if(G.saction->pin==0 && OBACT) {
- actstrip_map_ipo_keys(OBACT, conchan->ipo, 0);
+ actstrip_map_ipo_keys(OBACT, conchan->ipo, 0, 1);
snap_ipo_keys(conchan->ipo, snaptype);
- actstrip_map_ipo_keys(OBACT, conchan->ipo, 1);
+ actstrip_map_ipo_keys(OBACT, conchan->ipo, 1, 1);
}
else {
snap_ipo_keys(conchan->ipo, snaptype);
@@ -2584,9 +2584,9 @@ static void mirror_actionchannels(bAction *act, short mirror_mode)
if (EDITABLE_ACHAN(achan)) {
if (achan->ipo) {
if (G.saction->pin==0 && OBACT) {
- actstrip_map_ipo_keys(OBACT, achan->ipo, 0);
+ actstrip_map_ipo_keys(OBACT, achan->ipo, 0, 1);
mirror_ipo_keys(achan->ipo, mirror_mode);
- actstrip_map_ipo_keys(OBACT, achan->ipo, 1);
+ actstrip_map_ipo_keys(OBACT, achan->ipo, 1, 1);
}
else {
mirror_ipo_keys(achan->ipo, mirror_mode);
@@ -2601,9 +2601,9 @@ static void mirror_actionchannels(bAction *act, short mirror_mode)
if (EDITABLE_CONCHAN(conchan)) {
if (conchan->ipo) {
if(G.saction->pin==0 && OBACT) {
- actstrip_map_ipo_keys(OBACT, conchan->ipo, 0);
+ actstrip_map_ipo_keys(OBACT, conchan->ipo, 0, 1);
mirror_ipo_keys(conchan->ipo, mirror_mode);
- actstrip_map_ipo_keys(OBACT, conchan->ipo, 1);
+ actstrip_map_ipo_keys(OBACT, conchan->ipo, 1, 1);
}
else {
mirror_ipo_keys(conchan->ipo, mirror_mode);
@@ -3725,9 +3725,9 @@ void markers_selectkeys_between(void)
for (achan= act->chanbase.first; achan; achan= achan->next) {
if (achan->ipo) {
if(G.saction->pin==0 && OBACT) {
- actstrip_map_ipo_keys(OBACT, achan->ipo, 0);
+ actstrip_map_ipo_keys(OBACT, achan->ipo, 0, 1);
borderselect_ipo_key(achan->ipo, min, max, SELECT_ADD);
- actstrip_map_ipo_keys(OBACT, achan->ipo, 1);
+ actstrip_map_ipo_keys(OBACT, achan->ipo, 1, 1);
}
else {
borderselect_ipo_key(achan->ipo, min, max, SELECT_ADD);
@@ -3740,9 +3740,9 @@ void markers_selectkeys_between(void)
for (conchan= achan->constraintChannels.first; conchan; conchan= conchan->next) {
if (conchan->ipo) {
if(G.saction->pin==0 && OBACT) {
- actstrip_map_ipo_keys(OBACT, conchan->ipo, 0);
+ actstrip_map_ipo_keys(OBACT, conchan->ipo, 0, 1);
borderselect_ipo_key(conchan->ipo, min, max, SELECT_ADD);
- actstrip_map_ipo_keys(OBACT, conchan->ipo, 1);
+ actstrip_map_ipo_keys(OBACT, conchan->ipo, 1, 1);
}
else {
borderselect_ipo_key(conchan->ipo, min, max, SELECT_ADD);
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 63e2466f4f9..44079fbd65c 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -1371,6 +1371,13 @@ void mouse_select_ipo(void)
get_status_editipo();
marker=find_nearest_marker(1);
+ /* map ipo-points for editing if scaled ipo */
+ if (OBACT && OBACT->action && G.sipo->pin==0) {
+ if (G.sipo->actname || G.sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
+ }
+ }
+
if(G.sipo->showkey) {
getmouseco_areawin(mval);
@@ -1529,6 +1536,13 @@ void mouse_select_ipo(void)
}
}
+ /* undo mapping of ipo-points for editing if scaled ipo */
+ if (OBACT && OBACT->action && G.sipo->pin==0) {
+ if (G.sipo->actname || G.sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
+ }
+ }
+
update_editipo_flags();
force_draw(0);
@@ -1979,6 +1993,13 @@ void add_vert_ipo(void)
areamouseco_to_ipoco(G.v2d, mval, &x, &y);
+ /* convert click-time to ipo-time */
+ if (OBACT && OBACT->action && G.sipo->pin==0) {
+ if (G.sipo->actname || G.sipo->constname) {
+ x= get_action_frame(OBACT, x);
+ }
+ }
+
if(ei->icu==NULL) {
if(G.sipo->from) {
ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, ei->adrcode);
@@ -3475,6 +3496,13 @@ void ipo_snap(short event)
*/
get_status_editipo();
+
+ /* map ipo-points for editing if scaled ipo */
+ if (OBACT && OBACT->action && G.sipo->pin==0) {
+ if (G.sipo->actname || G.sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
+ }
+ }
ei= G.sipo->editipo;
for(b=0; b<G.sipo->totipo; b++, ei++) {
@@ -3543,6 +3571,14 @@ void ipo_snap(short event)
}
}
}
+
+ /* undo mapping of ipo-points for editing if scaled ipo */
+ if (OBACT && OBACT->action && G.sipo->pin==0) {
+ if (G.sipo->actname || G.sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
+ }
+ }
+
editipo_changed(G.sipo, 1);
BIF_undo_push("Snap Ipo");
}
@@ -3573,6 +3609,13 @@ void ipo_mirror(short mode)
ei= G.sipo->editipo;
if (!ei) return;
+ /* map ipo-points for editing if scaled ipo */
+ if (OBACT && OBACT->action && G.sipo->pin==0) {
+ if (G.sipo->actname || G.sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
+ }
+ }
+
/* look throught ipo curves */
for(b=0; b<G.sipo->totipo; b++, ei++) {
if (ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt)) {
@@ -3627,6 +3670,13 @@ void ipo_mirror(short mode)
}
}
+ /* undo mapping of ipo-points for editing if scaled ipo */
+ if (OBACT && OBACT->action && G.sipo->pin==0) {
+ if (G.sipo->actname || G.sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
+ }
+ }
+
/* cleanup and undo push */
editipo_changed(G.sipo, 1);
BIF_undo_push("Mirror Ipo");
diff --git a/source/blender/src/editipo_mods.c b/source/blender/src/editipo_mods.c
index 4555853cc62..af635aa5368 100644
--- a/source/blender/src/editipo_mods.c
+++ b/source/blender/src/editipo_mods.c
@@ -695,20 +695,35 @@ 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)
+/* restore = whether to map points back to ipo-time
+ * only_keys = whether to only adjust the location of the center point of beztriples
+ */
+void actstrip_map_ipo_keys(Object *ob, Ipo *ipo, short restore, short only_keys)
{
IpoCurve *icu;
BezTriple *bezt;
int a;
+ if (ipo==NULL) return;
+
/* 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)
+ if (restore) {
+ if (only_keys == 0) {
+ bezt->vec[0][0]= get_action_frame(ob, bezt->vec[0][0]);
+ bezt->vec[2][0]= get_action_frame(ob, bezt->vec[2][0]);
+ }
bezt->vec[1][0]= get_action_frame(ob, bezt->vec[1][0]);
- else
+ }
+ else {
+ if (only_keys == 0) {
+ bezt->vec[0][0]= get_action_frame_inv(ob, bezt->vec[0][0]);
+ bezt->vec[2][0]= get_action_frame_inv(ob, bezt->vec[2][0]);
+ }
bezt->vec[1][0]= get_action_frame_inv(ob, bezt->vec[1][0]);
+ }
}
}
}
@@ -894,6 +909,13 @@ void borderselect_ipo(void)
val= get_border(&rect, 3);
if(val) {
+ /* map ipo-points for editing if scaled ipo */
+ if (OBACT && OBACT->action && G.sipo->pin==0) {
+ if (G.sipo->actname || G.sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
+ }
+ }
+
mval[0]= rect.xmin;
mval[1]= rect.ymin;
areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin);
@@ -940,6 +962,14 @@ void borderselect_ipo(void)
}
}
}
+
+ /* undo mapping of ipo-points for drawing if scaled ipo */
+ if (OBACT && OBACT->action && G.sipo->pin==0) {
+ if (G.sipo->actname || G.sipo->constname) {
+ actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
+ }
+ }
+
BIF_undo_push("Border select Ipo");
allqueue(REDRAWIPO, 0);
allqueue(REDRAWACTION, 0);