diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 3077b25cc73..e1fc934ee3e 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -296,7 +296,7 @@ void wm_event_do_notifiers(bContext *C) /* XXX make lock in future, or separated derivedmesh users in scene */ if(!G.rendering) /* depsgraph & animation: update tagged datablocks */ - scene_update_tagged(win->screen->scene); + scene_update_tagged(CTX_data_main(C), win->screen->scene); } CTX_wm_window_set(C, NULL); @@ -425,6 +425,14 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int pop } } +/* this function is mainly to check that the rules for freeing + * an operator are kept in sync. + */ +static int wm_operator_register_check(wmWindowManager *wm, wmOperatorType *ot) +{ + return (wm->op_undo_depth == 0) && (ot->flag & OPTYPE_REGISTER); +} + static void wm_operator_finished(bContext *C, wmOperator *op, int repeat) { wmWindowManager *wm= CTX_wm_manager(C); @@ -445,7 +453,7 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat) MEM_freeN(buf); } - if((wm->op_undo_depth == 0) && (op->type->flag & OPTYPE_REGISTER)) + if(wm_operator_register_check(wm, op->type)) wm_operator_register(C, op); else WM_operator_free(op); @@ -801,17 +809,17 @@ int WM_operator_name_call(bContext *C, const char *opstring, int context, Pointe } /* Similar to WM_operator_name_call called with WM_OP_EXEC_DEFAULT context. - - wmOperatorType is used instead of operator name since python alredy has the operator type + - wmOperatorType is used instead of operator name since python already has the operator type - poll() must be called by python before this runs. - reports can be passed to this function (so python can report them as exceptions) */ int WM_operator_call_py(bContext *C, wmOperatorType *ot, int context, PointerRNA *properties, ReportList *reports) { + wmWindowManager *wm= CTX_wm_manager(C); int retval= OPERATOR_CANCELLED; #if 0 wmOperator *op; - wmWindowManager *wm= CTX_wm_manager(C); op= wm_operator_create(wm, ot, properties, reports); if (op->type->exec) { @@ -830,9 +838,9 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, int context, PointerRNA retval= wm_operator_call_internal(C, ot, context, properties, reports); /* keep the reports around if needed later */ - if (retval & OPERATOR_RUNNING_MODAL || ot->flag & OPTYPE_REGISTER) + if (retval & OPERATOR_RUNNING_MODAL || wm_operator_register_check(wm, ot)) { - reports->flag |= RPT_FREE; + reports->flag |= RPT_FREE; /* let blender manage freeing */ } return retval; @@ -1598,7 +1606,7 @@ void wm_event_do_handlers(bContext *C) } if(playing == 0) { - int ncfra = round(sound_sync_scene(scene) * FPS); + int ncfra = sound_sync_scene(scene) * FPS + 0.5; if(ncfra != scene->r.cfra) { scene->r.cfra = ncfra; ED_update_for_newframe(C, 1); |