Fix #33304: missing 3D view redraw while moving camera markers.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 25 Nov 2012 16:52:42 +0000 (16:52 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 25 Nov 2012 16:52:42 +0000 (16:52 +0000)
source/blender/editors/animation/anim_markers.c

index 852f3fa5469d359b561245d90c5914dca12ce7bb..4ac7b61fccb24809c27a35db9bb0995f849fa92d 100644 (file)
@@ -706,8 +706,13 @@ static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *e
 }
 
 /* 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;
        TimeMarker *marker;
        int a, offs;
@@ -719,17 +724,27 @@ static void ed_marker_move_apply(wmOperator *op)
                        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 */
 static int ed_marker_move_cancel(bContext *C, wmOperator *op)
 {
        RNA_int_set(op->ptr, "frames", 0);
-       ed_marker_move_apply(op);
+       ed_marker_move_apply(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;
 }
@@ -789,7 +804,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
                                
                                offs = (int)fac;
                                RNA_int_set(op->ptr, "frames", offs);
-                               ed_marker_move_apply(op);
+                               ed_marker_move_apply(C, op);
                                
                                /* cruft below is for header print */
                                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);
                        }
        }
@@ -855,14 +868,11 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
                        outputNumInput(&mm->num, str_tx);
                        
                        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]);
                        // strcat(str, str_tx);
                        BLI_snprintf(str, sizeof(str), "Marker offset %s", str_tx);
                        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)
 {
        if (ed_marker_move_init(C, op)) {
-               ed_marker_move_apply(op);
+               ed_marker_move_apply(C, op);
                ed_marker_move_exit(C, op);
                return OPERATOR_FINISHED;
        }