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:
authorJoshua Leung <aligorith@gmail.com>2012-05-06 08:18:13 +0400
committerJoshua Leung <aligorith@gmail.com>2012-05-06 08:18:13 +0400
commit5d02292d3cbdc1eb8657a2e186de7ac38bc226b7 (patch)
tree0d64116b2012d56ec40412c666bd6dceb5b145c8 /source/blender/editors/space_view3d/drawanimviz.c
parent7c58e6a9f2ac2d1022fba5c8df030e5df226583b (diff)
Bugfixes for Motion Path drawing/updating in light of the recent changes:
* Added proper "update" operators in place of the abuse of the calculate operators, so now the display ranges won't get overwritten everytime (with the default values) you go to update the paths. * Display range settings in properties editor now actually work. Before, the "In Range" mode only displayed the entire paths.
Diffstat (limited to 'source/blender/editors/space_view3d/drawanimviz.c')
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index a9801012d67..f8d942b4fd1 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -88,38 +88,50 @@ void draw_motion_path_instance(Scene *scene,
//RegionView3D *rv3d= ar->regiondata;
bMotionPathVert *mpv, *mpv_start;
int i, stepsize = avs->path_step;
- int sfra, efra, len;
-
+ int sfra, efra, sind, len;
/* get frame ranges */
if (avs->path_type == MOTIONPATH_TYPE_ACFRA) {
- int sind;
-
/* With "Around Current", we only choose frames from around
- * the current frame to draw. However, this range is still
- * restricted by the limits of the original path.
+ * the current frame to draw.
*/
sfra = CFRA - avs->path_bc;
efra = CFRA + avs->path_ac;
- if (sfra < mpath->start_frame) sfra = mpath->start_frame;
- if (efra > mpath->end_frame) efra = mpath->end_frame;
-
- len = efra - sfra;
-
- sind = sfra - mpath->start_frame;
- mpv_start = (mpath->points + sind);
}
else {
+ /* Use the current display range */
+ sfra = avs->path_sf;
+ efra = avs->path_ef;
+ }
+
+ /* no matter what, we can only show what is in the cache and no more
+ * - abort if whole range is past ends of path
+ * - otherwise clamp endpoints to extents of path
+ */
+ if ((sfra > mpath->end_frame) || (efra < mpath->start_frame)) {
+ /* whole path is out of bounds */
+ return;
+ }
+
+ if (sfra < mpath->start_frame) {
+ /* start clamp */
sfra = mpath->start_frame;
- efra = sfra + mpath->length;
- len = mpath->length;
- mpv_start = mpath->points;
}
-
+ if (efra > mpath->end_frame) {
+ /* end clamp */
+ efra = mpath->end_frame;
+ }
+
+ len = efra - sfra;
+
if (len <= 0) {
return;
}
-
+
+ /* get pointers to parts of path */
+ sind = sfra - mpath->start_frame;
+ mpv_start = (mpath->points + sind);
+
/* draw curve-line of path */
glShadeModel(GL_SMOOTH);