Fix #33304: missing 3D view redraw while moving camera markers.

This commit is contained in:
Brecht Van Lommel 2012-11-25 16:52:42 +00:00
parent 20b46bbf1a
commit 97b8a1f752

@ -706,8 +706,13 @@ static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *e
} }
/* note, init has to be called succesfully */ /* note, init has to be called succesfully */
static void ed_marker_move_apply(wmOperator *op) static void ed_marker_move_apply(bContext *C, wmOperator *op)
{ {
#ifdef DURIAN_CAMERA_SWITCH
bScreen *sc = CTX_wm_screen(C);
Scene *scene = CTX_data_scene(C);
Object *camera = scene->camera;
#endif
MarkerMove *mm = op->customdata; MarkerMove *mm = op->customdata;
TimeMarker *marker; TimeMarker *marker;
int a, offs; int a, offs;
@ -719,18 +724,28 @@ static void ed_marker_move_apply(wmOperator *op)
a++; a++;
} }
} }
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
#ifdef DURIAN_CAMERA_SWITCH
/* so we get view3d redraws */
BKE_scene_camera_switch_update(scene);
if(camera != scene->camera) {
BKE_screen_view3d_scene_sync(sc);
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene);
}
#endif
} }
/* only for modal */ /* only for modal */
static int ed_marker_move_cancel(bContext *C, wmOperator *op) static int ed_marker_move_cancel(bContext *C, wmOperator *op)
{ {
RNA_int_set(op->ptr, "frames", 0); RNA_int_set(op->ptr, "frames", 0);
ed_marker_move_apply(op); ed_marker_move_apply(C, op);
ed_marker_move_exit(C, op); ed_marker_move_exit(C, op);
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
@ -789,7 +804,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
offs = (int)fac; offs = (int)fac;
RNA_int_set(op->ptr, "frames", offs); RNA_int_set(op->ptr, "frames", offs);
ed_marker_move_apply(op); ed_marker_move_apply(C, op);
/* cruft below is for header print */ /* cruft below is for header print */
for (a = 0, marker = mm->markers->first; marker; marker = marker->next) { for (a = 0, marker = mm->markers->first; marker; marker = marker->next) {
@ -840,8 +855,6 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
} }
} }
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
ED_area_headerprint(CTX_wm_area(C), str); ED_area_headerprint(CTX_wm_area(C), str);
} }
} }
@ -855,14 +868,11 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
outputNumInput(&mm->num, str_tx); outputNumInput(&mm->num, str_tx);
RNA_int_set(op->ptr, "frames", vec); RNA_int_set(op->ptr, "frames", vec);
ed_marker_move_apply(op); ed_marker_move_apply(C, op);
// ed_marker_header_update(C, op, str, (int)vec[0]); // ed_marker_header_update(C, op, str, (int)vec[0]);
// strcat(str, str_tx); // strcat(str, str_tx);
BLI_snprintf(str, sizeof(str), "Marker offset %s", str_tx); BLI_snprintf(str, sizeof(str), "Marker offset %s", str_tx);
ED_area_headerprint(CTX_wm_area(C), str); ED_area_headerprint(CTX_wm_area(C), str);
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
} }
} }
@ -872,7 +882,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
static int ed_marker_move_exec(bContext *C, wmOperator *op) static int ed_marker_move_exec(bContext *C, wmOperator *op)
{ {
if (ed_marker_move_init(C, op)) { if (ed_marker_move_init(C, op)) {
ed_marker_move_apply(op); ed_marker_move_apply(C, op);
ed_marker_move_exit(C, op); ed_marker_move_exit(C, op);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }