have timeoffset use (int)floor(timeoffset+0.5f) when converting to an int to avoid...
[blender.git] / source / blender / editors / animation / anim_draw.c
index 62f421de71c6068e23f9895b05272c460bc08945..f5f50e10bcb81bfc3b95154e7c080b2470108cdc 100644 (file)
@@ -232,20 +232,22 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
        /* 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();
+                       }
                }
        }