当前位置: 首页>>代码示例>>C++>>正文


C++ PIL_check_seconds_timer函数代码示例

本文整理汇总了C++中PIL_check_seconds_timer函数的典型用法代码示例。如果您正苦于以下问题:C++ PIL_check_seconds_timer函数的具体用法?C++ PIL_check_seconds_timer怎么用?C++ PIL_check_seconds_timer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PIL_check_seconds_timer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的PIL_check_seconds_timer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。