From 4d5cd638ffba6854bfcee2ee7eb836f446b087ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Tue, 20 Dec 2016 11:01:08 +0100 Subject: String drawing function for the "simdebug" utilities. Simple string drawing API for debug drawing, in addition to basic primitives. --- source/blender/editors/space_view3d/drawsimdebug.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c index 91adc905816..9414d39467d 100644 --- a/source/blender/editors/space_view3d/drawsimdebug.c +++ b/source/blender/editors/space_view3d/drawsimdebug.c @@ -136,9 +136,23 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) glVertex3f(t[0], t[1], t[2]); } glEnd(); + + /**** strings ****/ + + for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { + SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); + if (elem->type != SIM_DEBUG_ELEM_STRING) + continue; + + unsigned char col[4]; + rgb_float_to_uchar(col, elem->color); + col[3] = 255; + view3d_cached_text_draw_add(elem->v1, elem->str, strlen(elem->str), + 0, V3D_CACHE_TEXT_GLOBALSPACE, col); + } } -void draw_sim_debug_data(Scene *UNUSED(scene), View3D *UNUSED(v3d), ARegion *ar) +void draw_sim_debug_data(Scene *UNUSED(scene), View3D *v3d, ARegion *ar) { RegionView3D *rv3d = ar->regiondata; /*Object *ob = base->object;*/ @@ -153,9 +167,11 @@ void draw_sim_debug_data(Scene *UNUSED(scene), View3D *UNUSED(v3d), ARegion *ar) // glEnable(GL_BLEND); glPushMatrix(); - glLoadMatrixf(rv3d->viewmat); + + view3d_cached_text_draw_begin(); draw_sim_debug_elements(_sim_debug_data, imat); + view3d_cached_text_draw_end(v3d, ar, false, NULL); glPopMatrix(); -- cgit v1.2.3 From b47c912f4be877bf5511117864dfc2a5b30c0dca Mon Sep 17 00:00:00 2001 From: Alexander Romanov Date: Fri, 23 Dec 2016 16:51:26 +0300 Subject: Fix (unreported) crash in 'Match movie length operator' in case of lost video texture file --- source/blender/editors/space_image/image_ops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index f5da7d57010..6a1c0e7e4bf 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1475,7 +1475,10 @@ static int image_match_len_exec(bContext *C, wmOperator *UNUSED(op)) if (!ima || !iuser || !BKE_image_has_anim(ima)) return OPERATOR_CANCELLED; - iuser->frames = IMB_anim_get_duration(((ImageAnim *) ima->anims.first)->anim, IMB_TC_RECORD_RUN); + struct ImageAnim *anim = ((ImageAnim *)ima->anims.first)->anim; + if (!anim) + return OPERATOR_CANCELLED; + iuser->frames = IMB_anim_get_duration(anim, IMB_TC_RECORD_RUN); BKE_image_user_frame_calc(iuser, scene->r.cfra, 0); return OPERATOR_FINISHED; -- cgit v1.2.3