Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-05-15 15:38:02 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-05-15 18:20:02 +0300
commita104c41759613899e314c328e48d6b16cd634d1a (patch)
tree7c5eb42b5d51cb417264a8a4ae841cf99f202037 /source/blender/draw/intern/draw_cache_impl_particles.c
parented0901b47e1c8bdee2461643f779bffbff121894 (diff)
Particle edit: Support children particles display with copy on write
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_particles.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index f9b3735eb42..a1eb98a85e2 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -616,6 +616,7 @@ static void particle_batch_cache_ensure_pos(Object *object,
}
static void drw_particle_update_ptcache_edit(Object *object_eval,
+ ParticleSystem *psys,
PTCacheEdit *edit)
{
if (edit->psys == NULL) {
@@ -627,8 +628,9 @@ static void drw_particle_update_ptcache_edit(Object *object_eval,
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene_orig = (Scene *)DEG_get_original_id(&draw_ctx->scene->id);
Object *object_orig = DEG_get_original_object(object_eval);
- if (edit->psys->flag & PSYS_HAIR_UPDATED) {
+ if (psys->flag & PSYS_HAIR_UPDATED) {
PE_update_object(draw_ctx->depsgraph, scene_orig, object_orig, 0);
+ psys->flag &= ~PSYS_HAIR_UPDATED;
}
if (edit->pathcache == NULL) {
Depsgraph *depsgraph = draw_ctx->depsgraph;
@@ -640,7 +642,8 @@ static void drw_particle_update_ptcache_edit(Object *object_eval,
}
}
-static void drw_particle_update_ptcache(Object *object_eval)
+static void drw_particle_update_ptcache(Object *object_eval,
+ ParticleSystem *psys)
{
if ((object_eval->mode & OB_MODE_PARTICLE_EDIT) == 0) {
return;
@@ -651,7 +654,7 @@ static void drw_particle_update_ptcache(Object *object_eval)
PTCacheEdit *edit = PE_create_current(
draw_ctx->depsgraph, scene_orig, object_orig);
if (edit != NULL) {
- drw_particle_update_ptcache_edit(object_eval, edit);
+ drw_particle_update_ptcache_edit(object_eval, psys, edit);
}
}
@@ -663,7 +666,7 @@ Gwn_Batch *DRW_particles_batch_cache_get_hair(
ParticleBatchCache *cache = particle_batch_cache_get(psys);
if (cache->hair.hairs == NULL) {
- drw_particle_update_ptcache(object);
+ drw_particle_update_ptcache(object, psys);
ensure_seg_pt_count(NULL, psys, &cache->hair);
particle_batch_cache_ensure_pos_and_seg(NULL, psys, md, &cache->hair);
cache->hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP,
@@ -695,7 +698,7 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_strands(
if (cache->edit_hair.hairs != NULL) {
return cache->edit_hair.hairs;
}
- drw_particle_update_ptcache_edit(object, edit);
+ drw_particle_update_ptcache_edit(object, psys, edit);
ensure_seg_pt_count(edit, psys, &cache->edit_hair);
particle_batch_cache_ensure_pos_and_seg(edit, psys, NULL, &cache->edit_hair);
cache->edit_hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP,
@@ -779,7 +782,7 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_inner_points(
if (cache->edit_inner_points != NULL) {
return cache->edit_inner_points;
}
- drw_particle_update_ptcache_edit(object, edit);
+ drw_particle_update_ptcache_edit(object, psys, edit);
ensure_edit_inner_points_count(edit, cache);
particle_batch_cache_ensure_edit_inner_pos(edit, cache);
cache->edit_inner_points = GWN_batch_create(GWN_PRIM_POINTS,
@@ -844,7 +847,7 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_tip_points(
if (cache->edit_tip_points != NULL) {
return cache->edit_tip_points;
}
- drw_particle_update_ptcache_edit(object, edit);
+ drw_particle_update_ptcache_edit(object, psys, edit);
ensure_edit_tip_points_count(edit, cache);
particle_batch_cache_ensure_edit_tip_pos(edit, cache);
cache->edit_tip_points = GWN_batch_create(GWN_PRIM_POINTS,