[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28549] trunk/blender/source/blender: have timeoffset use (int)floor(timeoffset+0.5f) when converting to an int to avoid problems with nagative values.

Campbell Barton ideasman42 at gmail.com
Mon May 3 17:56:44 CEST 2010


Revision: 28549
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28549
Author:   campbellbarton
Date:     2010-05-03 17:56:44 +0200 (Mon, 03 May 2010)

Log Message:
-----------
have timeoffset use (int)floor(timeoffset+0.5f) when converting to an int to avoid problems with nagative values.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/group.c
    trunk/blender/source/blender/editors/animation/anim_draw.c

Modified: trunk/blender/source/blender/blenkernel/intern/group.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/group.c	2010-05-03 15:52:15 UTC (rev 28548)
+++ trunk/blender/source/blender/blenkernel/intern/group.c	2010-05-03 15:56:44 UTC (rev 28549)
@@ -333,7 +333,7 @@
 		
 		/* switch to local time */
 		cfrao= scene->r.cfra;
-		scene->r.cfra -= (int)give_timeoffset(parent);
+		scene->r.cfra -= (int)floor(give_timeoffset(parent) + 0.5f);
 		
 		/* we need a DAG per group... */
 		for(go= group->gobject.first; go; go= go->next) {

Modified: trunk/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_draw.c	2010-05-03 15:52:15 UTC (rev 28548)
+++ trunk/blender/source/blender/editors/animation/anim_draw.c	2010-05-03 15:56:44 UTC (rev 28549)
@@ -232,20 +232,22 @@
 	/* Draw dark green line if slow-parenting/time-offset is enabled */
 	if (flag & DRAWCFRA_SHOW_TIMEOFS) {
 		Object *ob= (scene->basact) ? (scene->basact->object) : 0;
-		
-		// XXX ob->ipoflag is depreceated!
-		if ((ob) && (ob->ipoflag & OB_OFFS_OB) && (give_timeoffset(ob)!=0.0f)) {
-			vec[0]-= give_timeoffset(ob); /* could avoid calling twice */
+		if(ob) {
+			float timeoffset= give_timeoffset(ob);
+			// XXX ob->ipoflag is depreceated!
+			if ((ob->ipoflag & OB_OFFS_OB) && (timeoffset != 0.0f)) {
+				vec[0]-= timeoffset; /* could avoid calling twice */
 			
-			UI_ThemeColorShade(TH_CFRAME, -30);
+				UI_ThemeColorShade(TH_CFRAME, -30);
 			
-			glBegin(GL_LINE_STRIP);
-				/*vec[1]= v2d->cur.ymax;*/ // this is set already. this line is only included
-				glVertex2fv(vec);
+				glBegin(GL_LINE_STRIP);
+					/*vec[1]= v2d->cur.ymax;*/ // this is set already. this line is only included
+					glVertex2fv(vec);
 				
-				vec[1]= v2d->cur.ymin;
-				glVertex2fv(vec);
-			glEnd();
+					vec[1]= v2d->cur.ymin;
+					glVertex2fv(vec);
+				glEnd();
+			}
 		}
 	}
 	





More information about the Bf-blender-cvs mailing list