本文整理汇总了C++中PIL_check_seconds_timer函数的典型用法代码示例。如果您正苦于以下问题:C++ PIL_check_seconds_timer函数的具体用法?C++ PIL_check_seconds_timer怎么用?C++ PIL_check_seconds_timer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PIL_check_seconds_timer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: draw_image_buffer_repeated
static void draw_image_buffer_repeated(const bContext *C, SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float zoomx, float zoomy)
{
const double time_current = PIL_check_seconds_timer();
const int xmax = ceil(ar->v2d.cur.xmax);
const int ymax = ceil(ar->v2d.cur.ymax);
const int xmin = floor(ar->v2d.cur.xmin);
const int ymin = floor(ar->v2d.cur.ymin);
int x;
for (x = xmin; x < xmax; x++) {
int y;
for (y = ymin; y < ymax; y++) {
if (ima && (ima->tpageflag & IMA_TILES))
draw_image_buffer_tiled(sima, ar, scene, ima, ibuf, x, y, zoomx, zoomy);
else
draw_image_buffer(C, sima, ar, scene, ibuf, x, y, zoomx, zoomy);
/* only draw until running out of time */
if ((PIL_check_seconds_timer() - time_current) > 0.25)
return;
}
}
}
开发者ID:mcgrathd,项目名称:blender,代码行数:25,代码来源:image_draw.c
示例2: dynamicPaint_initBake
/*
* Bake Dynamic Paint image sequence surface
*/
static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
{
DynamicPaintModifierData *pmd = NULL;
DynamicPaintCanvasSettings *canvas;
Object *ob = ED_object_context(C);
int status = 0;
double timer = PIL_check_seconds_timer();
DynamicPaintSurface *surface;
/*
* Get modifier data
*/
pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
if (!pmd) {
BKE_report(op->reports, RPT_ERROR, "Bake failed: no Dynamic Paint modifier found");
return 0;
}
/* Make sure we're dealing with a canvas */
canvas = pmd->canvas;
if (!canvas) {
BKE_report(op->reports, RPT_ERROR, "Bake failed: invalid canvas");
return 0;
}
surface = get_activeSurface(canvas);
/* Set state to baking and init surface */
canvas->error[0] = '\0';
canvas->flags |= MOD_DPAINT_BAKING;
G.is_break = FALSE; /* reset blender_test_break*/
/* Bake Dynamic Paint */
status = dynamicPaint_bakeImageSequence(C, surface, ob);
/* Clear bake */
canvas->flags &= ~MOD_DPAINT_BAKING;
WM_cursor_restore(CTX_wm_window(C));
dynamicPaint_freeSurfaceData(surface);
/* Bake was successful:
* Report for ended bake and how long it took */
if (status) {
/* Format time string */
char time_str[30];
double time = PIL_check_seconds_timer() - timer;
BLI_timestr(time, time_str);
/* Show bake info */
BKE_reportf(op->reports, RPT_INFO, "Bake complete! (%s)", time_str);
}
else {
if (strlen(canvas->error)) { /* If an error occurred */
BKE_reportf(op->reports, RPT_ERROR, "Bake failed: %s", canvas->error);
}
else { /* User canceled the bake */
BKE_report(op->reports, RPT_WARNING, "Baking canceled!");
}
}
return status;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:63,代码来源:dynamicpaint_ops.c
示例3: PIL_check_seconds_timer
void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms)
{
double t;
void *work = NULL;
struct timespec timeout;
t = PIL_check_seconds_timer();
wait_timeout(&timeout, ms);
/* wait until there is work */
pthread_mutex_lock(&queue->mutex);
while (BLI_gsqueue_is_empty(queue->queue) && !queue->nowait) {
if (pthread_cond_timedwait(&queue->push_cond, &queue->mutex, &timeout) == ETIMEDOUT)
break;
else if (PIL_check_seconds_timer() - t >= ms * 0.001)
break;
}
/* if we have something, pop it */
if (!BLI_gsqueue_is_empty(queue->queue)) {
BLI_gsqueue_pop(queue->queue, &work);
if (BLI_gsqueue_is_empty(queue->queue))
pthread_cond_broadcast(&queue->finish_cond);
}
pthread_mutex_unlock(&queue->mutex);
return work;
}
开发者ID:mcgrathd,项目名称:blender,代码行数:30,代码来源:threads.c
示例4: scene_update_objects
static void scene_update_objects(EvaluationContext *eval_ctx, Scene *scene, Scene *scene_parent)
{
TaskScheduler *task_scheduler = BLI_task_scheduler_get();
TaskPool *task_pool;
ThreadedObjectUpdateState state;
state.eval_ctx = eval_ctx;
state.scene = scene;
state.scene_parent = scene_parent;
memset(state.statistics, 0, sizeof(state.statistics));
state.has_updated_objects = false;
state.base_time = PIL_check_seconds_timer();
#ifdef MBALL_SINGLETHREAD_HACK
state.has_mballs = false;
#endif
task_pool = BLI_task_pool_create(task_scheduler, &state);
DAG_threaded_update_begin(scene, scene_update_object_add_task, task_pool);
BLI_task_pool_work_and_wait(task_pool);
BLI_task_pool_free(task_pool);
if (G.debug & G_DEBUG) {
print_threads_statistics(&state);
}
#ifdef MBALL_SINGLETHREAD_HACK
if (state.has_mballs) {
scene_update_all_bases(eval_ctx, scene, scene_parent);
}
#endif
}
开发者ID:silkentrance,项目名称:blender,代码行数:32,代码来源:scene.c
示例5: dpaint_bake_endjob
static void dpaint_bake_endjob(void *customdata)
{
DynamicPaintBakeJob *job = customdata;
DynamicPaintCanvasSettings *canvas = job->canvas;
canvas->flags &= ~MOD_DPAINT_BAKING;
dynamicPaint_freeSurfaceData(job->surface);
G.is_rendering = false;
BKE_spacedata_draw_locks(false);
WM_set_locked_interface(G.main->wm.first, false);
/* Bake was successful:
* Report for ended bake and how long it took */
if (job->success) {
/* Show bake info */
WM_reportf(RPT_INFO, "DynamicPaint: Bake complete! (%.2f)", PIL_check_seconds_timer() - job->start);
}
else {
if (strlen(canvas->error)) { /* If an error occurred */
WM_reportf(RPT_ERROR, "DynamicPaint: Bake failed: %s", canvas->error);
}
else { /* User canceled the bake */
WM_report(RPT_WARNING, "Baking canceled!");
}
}
}
开发者ID:mgschwan,项目名称:blensor,代码行数:29,代码来源:dynamicpaint_ops.c
示例6: MEM_callocN
PartDeflect *object_add_collision_fields(int type)
{
PartDeflect *pd;
pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
pd->forcefield = type;
pd->pdef_sbdamp = 0.1f;
pd->pdef_sbift = 0.2f;
pd->pdef_sboft = 0.02f;
pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128;
pd->f_strength = 1.0f;
pd->f_damp = 1.0f;
/* set sensible defaults based on type */
switch (type) {
case PFIELD_VORTEX:
pd->shape = PFIELD_SHAPE_PLANE;
break;
case PFIELD_WIND:
pd->shape = PFIELD_SHAPE_PLANE;
pd->f_flow = 1.0f; /* realistic wind behavior */
break;
case PFIELD_TEXTURE:
pd->f_size = 1.0f;
break;
case PFIELD_SMOKEFLOW:
pd->f_flow = 1.0f;
break;
}
pd->flag = PFIELD_DO_LOCATION|PFIELD_DO_ROTATION;
return pd;
}
开发者ID:Rojuinex,项目名称:Blender,代码行数:34,代码来源:effect.c
示例7: applySnapping
void applySnapping(TransInfo *t, float *vec)
{
/* project is not applied this way */
if (t->tsnap.project)
return;
if (t->tsnap.status & SNAP_FORCED) {
t->tsnap.targetSnap(t);
t->tsnap.applySnap(t, vec);
}
else if (!ELEM(t->tsnap.mode, SCE_SNAP_MODE_INCREMENT, SCE_SNAP_MODE_GRID) && activeSnap(t)) {
double current = PIL_check_seconds_timer();
// Time base quirky code to go around findnearest slowness
/* !TODO! add exception for object mode, no need to slow it down then */
if (current - t->tsnap.last >= 0.01) {
t->tsnap.calcSnap(t, vec);
t->tsnap.targetSnap(t);
t->tsnap.last = current;
}
if (validSnap(t)) {
t->tsnap.applySnap(t, vec);
}
}
}
开发者ID:diekev,项目名称:blender,代码行数:27,代码来源:transform_snap.c
示例8: PIL_check_seconds_timer
void KX_LibLoadStatus::Finish()
{
m_finished = true;
m_progress = 1.f;
m_endtime = PIL_check_seconds_timer();
RunFinishCallback();
RunProgressCallback();
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:9,代码来源:KX_LibLoadStatus.cpp
示例9: pupdate_time
static int pupdate_time(void)
{
static double ltime;
double time;
time = PIL_check_seconds_timer();
ptottime += (time - ltime);
ltime = time;
return (ptottime < 0);
}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:11,代码来源:wm_playanim.c
示例10: BPY_python_end
void BPY_python_end(void)
{
// fprintf(stderr, "Ending Python!\n");
PyGILState_STATE gilstate;
/* finalizing, no need to grab the state, except when we are a module */
gilstate = PyGILState_Ensure();
/* free other python data. */
pyrna_free_types();
/* clear all python data from structs */
bpy_intern_string_exit();
/* bpy.app modules that need cleanup */
BPY_app_translations_end();
/* Release copy of clear sys modules dictionary */
BPy_end_modules();
#ifndef WITH_PYTHON_MODULE
BPY_atexit_unregister(); /* without this we get recursive calls to WM_exit */
Py_Finalize();
(void)gilstate;
#else
PyGILState_Release(gilstate);
#endif
#ifdef TIME_PY_RUN
/* measure time since py started */
bpy_timer = PIL_check_seconds_timer() - bpy_timer;
printf("*bpy stats* - ");
printf("tot exec: %d, ", bpy_timer_count);
printf("tot run: %.4fsec, ", bpy_timer_run_tot);
if (bpy_timer_count > 0)
printf("average run: %.6fsec, ", (bpy_timer_run_tot / bpy_timer_count));
if (bpy_timer > 0.0)
printf("tot usage %.4f%%", (bpy_timer_run_tot / bpy_timer) * 100.0);
printf("\n");
// fprintf(stderr, "Ending Python Done!\n");
#endif
}
开发者ID:UPBGE,项目名称:blender,代码行数:51,代码来源:bpy_interface.c
示例11: PIL_check_seconds_timer
// set actual position
void VideoFFmpeg::setPositions (void)
{
// set video start time
m_startTime = PIL_check_seconds_timer();
// if file is played and actual position is before end position
if (!m_eof && m_lastFrame >= 0 && (!m_isFile || m_lastFrame < m_range[1] * actFrameRate()))
// continue from actual position
m_startTime -= double(m_lastFrame) / actFrameRate();
else {
m_startTime -= m_range[0];
// start from beginning, stop cache just in case
stopCache();
}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:15,代码来源:VideoFFmpeg.cpp
示例12: MEM_callocN
wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
{
wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
wt->event_type = event_type;
wt->ltime = PIL_check_seconds_timer();
wt->ntime = wt->ltime + timestep;
wt->stime = wt->ltime;
wt->timestep = timestep;
wt->win = win;
BLI_addtail(&wm->timers, wt);
return wt;
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:15,代码来源:wm_window.c
示例13: MEM_callocN
wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, unsigned int type, double timestep)
{
wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
wt->event_type = TIMERNOTIFIER;
wt->ltime = PIL_check_seconds_timer();
wt->ntime = wt->ltime + timestep;
wt->stime = wt->ltime;
wt->timestep = timestep;
wt->win = win;
wt->customdata = SET_UINT_IN_POINTER(type);
BLI_addtail(&wm->timers, wt);
return wt;
}
开发者ID:JasonWilkins,项目名称:blender-viewport_fx,代码行数:16,代码来源:wm_window.c
示例14: while
void MovieDistortionOperation::deinitExecution()
{
this->m_inputOperation = NULL;
this->m_movieClip = NULL;
while (s_cache.size() > COM_DISTORTIONCACHE_MAXSIZE) {
double minTime = PIL_check_seconds_timer();
vector<DistortionCache*>::iterator minTimeIterator = s_cache.begin();
for (vector<DistortionCache*>::iterator it = s_cache.begin(); it < s_cache.end(); it ++) {
DistortionCache * cache = *it;
if (cache->getTimeLastUsage() < minTime) {
minTime = cache->getTimeLastUsage();
minTimeIterator = it;
}
}
s_cache.erase(minTimeIterator);
}
}
开发者ID:scorpion81,项目名称:blender-voro,代码行数:17,代码来源:COM_MovieDistortionOperation.cpp
示例15: wm_window_testbreak
/* exported as handle callback to bke blender.c */
void wm_window_testbreak(void)
{
static double ltime = 0;
double curtime = PIL_check_seconds_timer();
/* only check for breaks every 50 milliseconds
* if we get called more often.
*/
if ((curtime - ltime) > 0.05) {
int hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
if (hasevent)
GHOST_DispatchEvents(g_system);
ltime = curtime;
}
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:18,代码来源:wm_window.c
示例16: UI_pie_menu_end
void UI_pie_menu_end(bContext *C, uiPieMenu *pie)
{
wmWindow *window = CTX_wm_window(C);
uiPopupBlockHandle *menu;
menu = ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_PIE, pie);
menu->popup = true;
menu->towardstime = PIL_check_seconds_timer();
UI_popup_handlers_add(
C, &window->modalhandlers,
menu, WM_HANDLER_ACCEPT_DBL_CLICK);
WM_event_add_mousemove(C);
menu->can_refresh = false;
MEM_freeN(pie);
}
开发者ID:wisaac407,项目名称:blender,代码行数:17,代码来源:interface_region_menu_pie.c
示例17: WM_jobs_start
/* if different owner starts existing startjob, it suspends itself */
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
{
if (wm_job->running) {
/* signal job to end and restart */
wm_job->stop = TRUE;
// printf("job started a running job, ending... %s\n", wm_job->name);
}
else {
if (wm_job->customdata && wm_job->startjob) {
wm_jobs_test_suspend_stop(wm, wm_job);
if (wm_job->suspended == FALSE) {
/* copy to ensure proper free in end */
wm_job->run_customdata = wm_job->customdata;
wm_job->run_free = wm_job->free;
wm_job->free = NULL;
wm_job->customdata = NULL;
wm_job->running = TRUE;
if (wm_job->initjob)
wm_job->initjob(wm_job->run_customdata);
wm_job->stop = FALSE;
wm_job->ready = FALSE;
wm_job->progress = 0.0;
// printf("job started: %s\n", wm_job->name);
BLI_init_threads(&wm_job->threads, do_job_thread, 1);
BLI_insert_thread(&wm_job->threads, wm_job);
}
/* restarted job has timer already */
if (wm_job->wt == NULL)
wm_job->wt = WM_event_add_timer(wm, wm_job->win, TIMERJOBS, wm_job->timestep);
if (G.debug & G_DEBUG_JOBS)
wm_job->start_time = PIL_check_seconds_timer();
}
else {
printf("job fails, not initialized\n");
}
}
}
开发者ID:244xiao,项目名称:blender,代码行数:47,代码来源:wm_jobs.c
示例18: wm_window_timer
/**
* This timer system only gives maximum 1 timer event per redraw cycle,
* to prevent queues to get overloaded.
* Timer handlers should check for delta to decide if they just update, or follow real time.
* Timer handlers can also set duration to match frames passed
*/
static int wm_window_timer(const bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmTimer *wt, *wtnext;
wmWindow *win;
double time = PIL_check_seconds_timer();
int retval = 0;
for (wt = wm->timers.first; wt; wt = wtnext) {
wtnext = wt->next; /* in case timer gets removed */
win = wt->win;
if (wt->sleep == 0) {
if (time > wt->ntime) {
wt->delta = time - wt->ltime;
wt->duration += wt->delta;
wt->ltime = time;
wt->ntime = wt->stime + wt->timestep * ceil(wt->duration / wt->timestep);
if (wt->event_type == TIMERJOBS)
wm_jobs_timer(C, wm, wt);
else if (wt->event_type == TIMERAUTOSAVE)
wm_autosave_timer(C, wm, wt);
else if (wt->event_type == TIMERNOTIFIER)
WM_main_add_notifier(GET_UINT_FROM_POINTER(wt->customdata), NULL);
else if (win) {
wmEvent event;
wm_event_init_from_window(win, &event);
event.type = wt->event_type;
event.val = KM_NOTHING;
event.keymodifier = 0;
event.custom = EVT_DATA_TIMER;
event.customdata = wt;
wm_event_add(win, &event);
retval = 1;
}
}
}
}
return retval;
}
开发者ID:JasonWilkins,项目名称:blender-viewport_fx,代码行数:49,代码来源:wm_window.c
示例19: m_converter
KX_LibLoadStatus::KX_LibLoadStatus(class KX_BlenderSceneConverter* kx_converter,
class KX_KetsjiEngine* kx_engine,
class KX_Scene* merge_scene,
const char *path) :
m_converter(kx_converter),
m_engine(kx_engine),
m_mergescene(merge_scene),
m_data(NULL),
m_libname(path),
m_progress(0.0f),
m_finished(false)
#ifdef WITH_PYTHON
,
m_finish_cb(NULL),
m_progress_cb(NULL)
#endif
{
m_endtime = m_starttime = PIL_check_seconds_timer();
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:19,代码来源:KX_LibLoadStatus.cpp
示例20: view_zoom_apply
static void view_zoom_apply(bContext *C,
ViewZoomData *vpd,
wmOperator *op,
const wmEvent *event)
{
float factor;
if (U.viewzoom == USER_ZOOM_CONT) {
SpaceClip *sclip = CTX_wm_space_clip(C);
double time = PIL_check_seconds_timer();
float time_step = (float)(time - vpd->timer_lastdraw);
float fac;
float zfac;
if (U.uiflag & USER_ZOOM_HORIZ) {
fac = (float)(event->x - vpd->x);
}
else {
fac = (float)(event->y - vpd->y);
}
if (U.uiflag & USER_ZOOM_INVERT) {
fac = -fac;
}
zfac = 1.0f + ((fac / 20.0f) * time_step);
vpd->timer_lastdraw = time;
factor = (sclip->zoom * zfac) / vpd->zoom;
}
else {
float delta = event->x - vpd->x + event->y - vpd->y;
if (U.uiflag & USER_ZOOM_INVERT) {
delta *= -1;
}
factor = 1.0f + delta / 300.0f;
}
RNA_float_set(op->ptr, "factor", factor);
sclip_zoom_set(C, vpd->zoom * factor, vpd->location);
ED_region_tag_redraw(CTX_wm_region(C));
}
开发者ID:pawkoz,项目名称:dyplom,代码行数:43,代码来源:clip_ops.c
注:本文中的PIL_check_seconds_timer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论