コード例 #1
0
ファイル: physics_pointcache.c プロジェクト: mgschwan/blensor
static int ptcache_bake_exec(bContext *C, wmOperator *op)
{
	bool all = STREQ(op->type->idname, "PTCACHE_OT_bake_all");

	PTCacheBaker *baker = ptcache_baker_create(C, op, all);
	BKE_ptcache_bake(baker);
	MEM_freeN(baker);

	return OPERATOR_FINISHED;
}
コード例 #2
0
static int ptcache_bake_exec(bContext *C, wmOperator *op)
{
    Main *bmain = CTX_data_main(C);
    Scene *scene = CTX_data_scene(C);
    wmWindow *win = G.background ? NULL : CTX_wm_window(C);
    PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
    Object *ob= ptr.id.data;
    PointCache *cache= ptr.data;
    PTCacheBaker baker;
    PTCacheID *pid;
    ListBase pidlist;

    BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);

    for (pid=pidlist.first; pid; pid=pid->next) {
        if (pid->cache == cache)
            break;
    }

    baker.main = bmain;
    baker.scene = scene;
    baker.pid = pid;
    baker.bake = RNA_boolean_get(op->ptr, "bake");
    baker.render = 0;
    baker.anim_init = 0;
    baker.quick_step = 1;
    baker.break_test = cache_break_test;
    baker.break_data = NULL;

    /* Disabled for now as this doesn't work properly,
     * and pointcache baking will be reimplemented with
     * the job system soon anyways. */
    if (win) {
        baker.progressbar = (void (*)(void *, int))WM_cursor_time;
        baker.progressend = (void (*)(void *))WM_cursor_modal_restore;
        baker.progresscontext = win;
    }
    else {
        printf("\n"); /* empty first line before console reports */
        baker.progressbar = bake_console_progress;
        baker.progressend = bake_console_progress_end;
        baker.progresscontext = NULL;
    }

    BKE_ptcache_bake(&baker);

    BLI_freelistN(&pidlist);

    WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
    WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);

    return OPERATOR_FINISHED;
}
コード例 #3
0
ファイル: physics_pointcache.c プロジェクト: mgschwan/blensor
static void ptcache_job_startjob(void *customdata, short *stop, short *do_update, float *progress)
{
	PointCacheJob *job = customdata;

	job->stop = stop;
	job->do_update = do_update;
	job->progress = progress;

	G.is_break = false;

	/* XXX annoying hack: needed to prevent data corruption when changing
	 * scene frame in separate threads
	 */
	G.is_rendering = true;
	BKE_spacedata_draw_locks(true);

	BKE_ptcache_bake(job->baker);

	*do_update = true;
	*stop = 0;
}
コード例 #4
0
static int ptcache_bake_all_exec(bContext *C, wmOperator *op)
{
    Main *bmain = CTX_data_main(C);
    Scene *scene= CTX_data_scene(C);
    wmWindow *win = G.background ? NULL : CTX_wm_window(C);
    PTCacheBaker baker;

    baker.main = bmain;
    baker.scene = scene;
    baker.pid = NULL;
    baker.bake = RNA_boolean_get(op->ptr, "bake");
    baker.render = 0;
    baker.anim_init = 0;
    baker.quick_step = 1;
    baker.break_test = cache_break_test;
    baker.break_data = NULL;

    /* Disabled for now as this doesn't work properly,
     * and pointcache baking will be reimplemented with
     * the job system soon anyways. */
    if (win) {
        baker.progressbar = (void (*)(void *, int))WM_cursor_time;
        baker.progressend = (void (*)(void *))WM_cursor_modal_restore;
        baker.progresscontext = win;
    }
    else {
        baker.progressbar = bake_console_progress;
        baker.progressend = bake_console_progress_end;
        baker.progresscontext = NULL;
    }

    BKE_ptcache_bake(&baker);

    WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
    WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, NULL);

    return OPERATOR_FINISHED;
}