Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/particle_distribute.c
| Show First 20 Lines • Show All 1,331 Lines • ▼ Show 20 Lines | static void distribute_particles_on_dm(ParticleSimulationData *sim, int from) | ||||
| int i, totpart, numtasks; | int i, totpart, numtasks; | ||||
| /* create a task pool for distribution tasks */ | /* create a task pool for distribution tasks */ | ||||
| if (!psys_thread_context_init_distribute(&ctx, sim, from)) { | if (!psys_thread_context_init_distribute(&ctx, sim, from)) { | ||||
| return; | return; | ||||
| } | } | ||||
| task_scheduler = BLI_task_scheduler_get(); | task_scheduler = BLI_task_scheduler_get(); | ||||
| task_pool = BLI_task_pool_create(task_scheduler, &ctx); | task_pool = BLI_task_pool_create(task_scheduler, &ctx, TASK_PRIORITY_LOW); | ||||
| totpart = (from == PART_FROM_CHILD ? sim->psys->totchild : sim->psys->totpart); | totpart = (from == PART_FROM_CHILD ? sim->psys->totchild : sim->psys->totpart); | ||||
| psys_tasks_create(&ctx, 0, totpart, &tasks, &numtasks); | psys_tasks_create(&ctx, 0, totpart, &tasks, &numtasks); | ||||
| for (i = 0; i < numtasks; i++) { | for (i = 0; i < numtasks; i++) { | ||||
| ParticleTask *task = &tasks[i]; | ParticleTask *task = &tasks[i]; | ||||
| psys_task_init_distribute(task, sim); | psys_task_init_distribute(task, sim); | ||||
| if (from == PART_FROM_CHILD) { | if (from == PART_FROM_CHILD) { | ||||
| BLI_task_pool_push(task_pool, exec_distribute_child, task, false, TASK_PRIORITY_LOW); | BLI_task_pool_push(task_pool, exec_distribute_child, task, false, NULL); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_task_pool_push(task_pool, exec_distribute_parent, task, false, TASK_PRIORITY_LOW); | BLI_task_pool_push(task_pool, exec_distribute_parent, task, false, NULL); | ||||
| } | } | ||||
| } | } | ||||
| BLI_task_pool_work_and_wait(task_pool); | BLI_task_pool_work_and_wait(task_pool); | ||||
| BLI_task_pool_free(task_pool); | BLI_task_pool_free(task_pool); | ||||
| psys_calc_dmcache(sim->ob, final_mesh, sim->psmd->mesh_original, sim->psys); | psys_calc_dmcache(sim->ob, final_mesh, sim->psmd->mesh_original, sim->psys); | ||||
| Show All 40 Lines | |||||