static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event) { int exit_code; bool do_draw = false; FlyInfo *fly = op->customdata; RegionView3D *rv3d = fly->rv3d; Object *fly_object = ED_view3d_cameracontrol_object_get(fly->v3d_camera_control); fly->redraw = 0; flyEvent(C, op, fly, event); #ifdef WITH_INPUT_NDOF if (fly->ndof) { /* 3D mouse overrules [2D mouse + timer] */ if (event->type == NDOF_MOTION) { flyApply_ndof(C, fly); } } else #endif /* WITH_INPUT_NDOF */ if (event->type == TIMER && event->customdata == fly->timer) { flyApply(C, fly); } do_draw |= fly->redraw; exit_code = flyEnd(C, fly); if (exit_code != OPERATOR_RUNNING_MODAL) do_draw = true; if (do_draw) { if (rv3d->persp == RV3D_CAMOB) { WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, fly_object); } // puts("redraw!"); // too frequent, commented with NDOF_FLY_DRAW_TOOMUCH for now ED_region_tag_redraw(CTX_wm_region(C)); } if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED)) ED_area_headerprint(CTX_wm_area(C), NULL); return exit_code; }
static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event) { int exit_code; bool do_draw = false; FlyInfo *fly = op->customdata; RegionView3D *rv3d = fly->rv3d; Object *fly_object = fly->root_parent ? fly->root_parent : fly->v3d->camera; fly->redraw = 0; flyEvent(fly, event); if (fly->ndof) { /* 3D mouse overrules [2D mouse + timer] */ if (event->type == NDOF_MOTION) { flyApply_ndof(C, fly); } } else if (event->type == TIMER && event->customdata == fly->timer) { flyApply(C, fly); } do_draw |= fly->redraw; exit_code = flyEnd(C, fly); if (exit_code != OPERATOR_RUNNING_MODAL) do_draw = true; if (do_draw) { if (rv3d->persp == RV3D_CAMOB) { WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, fly_object); } // puts("redraw!"); // too frequent, commented with NDOF_FLY_DRAW_TOOMUCH for now ED_region_tag_redraw(CTX_wm_region(C)); } return exit_code; }