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
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-10-31 00:48:25 +0300
committerTon Roosendaal <ton@blender.org>2005-10-31 00:48:25 +0300
commite96495467936372261479ea7d3c48246bb30ae9b (patch)
tree984ad3fccfd28a4f8a55599cbe54ffe9155f31de
parent41c5328dd4efdb8d75843b118c79a165831a4762 (diff)
Fix for HOME key in Action Window. Didn't check for mapped NLA time yet.
-rw-r--r--source/blender/blenkernel/BKE_action.h2
-rw-r--r--source/blender/blenkernel/intern/action.c23
-rw-r--r--source/blender/src/header_action.c5
3 files changed, 26 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index 29b492e51e6..996b033f3e9 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -138,6 +138,8 @@ void extract_pose_from_pose(struct bPose *pose, const struct bPose *src);
/* map global time (frame nr) to strip converted time, doesn't clip */
float get_action_frame(struct Object *ob, float cframe);
+/* map strip time to global time (frame nr) */
+float get_action_frame_inv(struct Object *ob, float cframe);
#ifdef __cplusplus
};
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 499d9604609..d062b6c5c71 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -648,7 +648,7 @@ static bActionStrip *get_active_strip(Object *ob)
}
/* non clipped mapping of strip */
-static float get_actionstrip_frame(bActionStrip *strip, float cframe)
+static float get_actionstrip_frame(bActionStrip *strip, float cframe, int invert)
{
float length, actlength, repeat;
@@ -661,8 +661,13 @@ static float get_actionstrip_frame(bActionStrip *strip, float cframe)
if(length==0.0f)
length= 1.0f;
actlength = strip->actend-strip->actstart;
+
+
- return repeat*actlength*(cframe - strip->start)/length + strip->actstart;
+ if(invert)
+ return length*(cframe - strip->actstart)/(repeat*actlength) + strip->start;
+ else
+ return repeat*actlength*(cframe - strip->start)/length + strip->actstart;
}
/* if the conditions match, it converts current time to strip time */
@@ -671,10 +676,22 @@ float get_action_frame(Object *ob, float cframe)
bActionStrip *strip= get_active_strip(ob);
if(strip)
- return get_actionstrip_frame(strip, cframe);
+ return get_actionstrip_frame(strip, cframe, 0);
+ return cframe;
+}
+
+/* inverted, strip time to current time */
+float get_action_frame_inv(Object *ob, float cframe)
+{
+ bActionStrip *strip= get_active_strip(ob);
+
+ if(strip)
+ return get_actionstrip_frame(strip, cframe, 1);
return cframe;
}
+
+
/* this now only used for repeating cycles, to enable fields and blur. */
/* the whole time control in blender needs serious thinking... */
static float nla_time(float cfra, float unit)
diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c
index cd3628ef857..b091e0a2940 100644
--- a/source/blender/src/header_action.c
+++ b/source/blender/src/header_action.c
@@ -140,10 +140,13 @@ void do_action_buttons(unsigned short event)
float extra;
calc_action_range(G.saction->action, &G.v2d->cur.xmin, &G.v2d->cur.xmax);
+ G.v2d->cur.xmin= get_action_frame_inv(ob, G.v2d->cur.xmin);
+ G.v2d->cur.xmax= get_action_frame_inv(ob, G.v2d->cur.xmax);
+
extra= 0.05*(G.v2d->cur.xmax - G.v2d->cur.xmin);
G.v2d->cur.xmin-= extra;
G.v2d->cur.xmax+= extra;
-
+
if(G.v2d->cur.xmin==G.v2d->cur.xmax) {
G.v2d->cur.xmax= -5;
G.v2d->cur.xmax= 100;