/* Repeat operator */ static int poselib_preview_exec (bContext *C, wmOperator *op) { tPoseLib_PreviewData *pld; /* check if everything is ok, and init settings for modal operator */ poselib_preview_init_data(C, op); pld= (tPoseLib_PreviewData *)op->customdata; if (pld->state == PL_PREVIEW_ERROR) { /* an error occurred, so free temp mem used */ poselib_preview_cleanup(C, op); return OPERATOR_CANCELLED; } /* the exec() callback is effectively a 'run-once' scenario, so set the state to that * so that everything draws correctly */ pld->state = PL_PREVIEW_RUNONCE; /* apply the active pose */ poselib_preview_apply(C, op); /* now, set the status to exit */ pld->state = PL_PREVIEW_CONFIRM; /* cleanup */ return poselib_preview_exit(C, op); }
/* main modal status check */ static int poselib_preview_modal (bContext *C, wmOperator *op, wmEvent *event) { tPoseLib_PreviewData *pld= op->customdata; int ret; /* 1) check state to see if we're still running */ if (pld->state != PL_PREVIEW_RUNNING) return poselib_preview_exit(C, op); /* 2) handle events */ ret= poselib_preview_handle_event(C, op, event); /* 3) apply changes and redraw, otherwise, confirming goes wrong */ if (pld->redraw) poselib_preview_apply(C, op); return ret; }
/* Cancel previewing operation (called when exiting Blender) */ static int poselib_preview_cancel (bContext *C, wmOperator *op) { poselib_preview_exit(C, op); return OPERATOR_CANCELLED; }
/* Cancel previewing operation (called when exiting Blender) */ static void poselib_preview_cancel(bContext *C, wmOperator *op) { poselib_preview_exit(C, op); }