Exemple #1
0
/* General call for drawing current frame indicator in animation editor */
void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
{
	Scene *scene = CTX_data_scene(C);
	float vec[2];
	
	/* Draw a light green line to indicate current frame */
	vec[0] = (float)(scene->r.cfra * scene->r.framelen);
	
	UI_ThemeColor(TH_CFRAME);
	if (flag & DRAWCFRA_WIDE)
		glLineWidth(3.0);
	else
		glLineWidth(2.0);
	
	glBegin(GL_LINE_STRIP);
	vec[1] = v2d->cur.ymin - 500.0f;    /* XXX arbitrary... want it go to bottom */
	glVertex2fv(vec);
		
	vec[1] = v2d->cur.ymax;
	glVertex2fv(vec);
	glEnd();
	
	glLineWidth(1.0);
	
	/* Draw current frame number in a little box */
	if (flag & DRAWCFRA_SHOW_NUMBOX) {
		UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1);
		draw_cfra_number(scene, v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS) != 0);
	}
}
Exemple #2
0
/* General call for drawing current frame indicator in animation editor */
void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
{
	Scene *scene= CTX_data_scene(C);
	float vec[2];
	
	/* Draw a light green line to indicate current frame */
	vec[0]= (float)(scene->r.cfra * scene->r.framelen);
	
	UI_ThemeColor(TH_CFRAME);
	glLineWidth(2.0);
	
	glBegin(GL_LINE_STRIP);
		vec[1]= v2d->cur.ymin-500.0f;	/* XXX arbitrary... want it go to bottom */
		glVertex2fv(vec);
		
		vec[1]= v2d->cur.ymax;
		glVertex2fv(vec);
	glEnd();
	
	/* Draw dark green line if slow-parenting/time-offset is enabled */
	if (flag & DRAWCFRA_SHOW_TIMEOFS) {
		Object *ob= OBACT;
		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);
			
				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();
			}
		}
	}
	
	glLineWidth(1.0);
	
	/* Draw current frame number in a little box */
	if (flag & DRAWCFRA_SHOW_NUMBOX) {
		UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1);
		draw_cfra_number(scene, v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS));
	}
}
Exemple #3
0
/* General call for drawing current frame indicator in animation editor */
void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
{
	Scene *scene = CTX_data_scene(C);

	/* Draw a light green line to indicate current frame */
	UI_ThemeColor(TH_CFRAME);

	const float time = scene->r.cfra + scene->r.subframe;
	const float x = (float)(time * scene->r.framelen);

	glLineWidth((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0);

	glBegin(GL_LINES);
	glVertex2f(x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */
	glVertex2f(x, v2d->cur.ymax);
	glEnd();

	/* Draw current frame number in a little box */
	if (flag & DRAWCFRA_SHOW_NUMBOX) {
		UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1);
		draw_cfra_number(scene, v2d, x, (flag & DRAWCFRA_UNIT_SECONDS) != 0);
	}
}