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-08 17:16:53 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-05-09 11:34:45 +0300
commit9c1c6d89a11a1c85f6e29a280382e81aaff8860d (patch)
tree43b8c394f726fe838bc90f4f1e00b4a09ed03535 /source/blender/draw/intern/draw_cache_impl_particles.c
parentb150c497dc45fc014358c5df6037192fd5d74e4e (diff)
Draw manager: allow creation of hair batch cache from edit mode
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_particles.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index 8f21b19c636..964cc38e3eb 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -41,8 +41,9 @@
#include "DNA_modifier_types.h"
#include "DNA_particle_types.h"
-#include "BKE_particle.h"
#include "BKE_DerivedMesh.h"
+#include "BKE_particle.h"
+#include "BKE_pointcache.h"
#include "GPU_batch.h"
@@ -170,12 +171,19 @@ static void ensure_seg_pt_count(ParticleSystem *psys, ParticleBatchCache *cache)
cache->elems_count = 0;
cache->point_count = 0;
- if (psys->pathcache && (!psys->childcache || (psys->part->draw & PART_DRAW_PARENT))) {
- count_cache_segment_keys(psys->pathcache, psys->totpart, cache);
- }
- if (psys->childcache) {
- const int child_count = psys->totchild * psys->part->disp / 100;
- count_cache_segment_keys(psys->childcache, child_count, cache);
+ if (psys->edit != NULL) {
+ count_cache_segment_keys(
+ psys->edit->pathcache, psys->totpart, cache);
+ } else {
+ if (psys->pathcache &&
+ (!psys->childcache || (psys->part->draw & PART_DRAW_PARENT)))
+ {
+ count_cache_segment_keys(psys->pathcache, psys->totpart, cache);
+ }
+ if (psys->childcache) {
+ const int child_count = psys->totchild * psys->part->disp / 100;
+ count_cache_segment_keys(psys->childcache, child_count, cache);
+ }
}
}
}
@@ -426,21 +434,29 @@ static void particle_batch_cache_ensure_pos_and_seg(ParticleSystem *psys,
}
}
- if (psys->pathcache && (!psys->childcache || (psys->part->draw & PART_DRAW_PARENT))) {
+ if (psys->edit != NULL) {
curr_point = particle_batch_cache_fill_segments(
- psys, psmd, psys->pathcache, PARTICLE_SOURCE_PARENT,
+ psys, psmd, psys->edit->pathcache, PARTICLE_SOURCE_PARENT,
0, 0, psys->totpart,
num_uv_layers, mtfaces, uv_id, &parent_uvs,
&elb, &attr_id, cache);
}
-
- if (psys->childcache) {
- const int child_count = psys->totchild * psys->part->disp / 100;
- curr_point = particle_batch_cache_fill_segments(
- psys, psmd, psys->childcache, PARTICLE_SOURCE_CHILDREN,
- psys->totpart, curr_point, child_count,
- num_uv_layers, mtfaces, uv_id, &parent_uvs,
- &elb, &attr_id, cache);
+ else {
+ if (psys->pathcache && (!psys->childcache || (psys->part->draw & PART_DRAW_PARENT))) {
+ curr_point = particle_batch_cache_fill_segments(
+ psys, psmd, psys->pathcache, PARTICLE_SOURCE_PARENT,
+ 0, 0, psys->totpart,
+ num_uv_layers, mtfaces, uv_id, &parent_uvs,
+ &elb, &attr_id, cache);
+ }
+ if (psys->childcache) {
+ const int child_count = psys->totchild * psys->part->disp / 100;
+ curr_point = particle_batch_cache_fill_segments(
+ psys, psmd, psys->childcache, PARTICLE_SOURCE_CHILDREN,
+ psys->totpart, curr_point, child_count,
+ num_uv_layers, mtfaces, uv_id, &parent_uvs,
+ &elb, &attr_id, cache);
+ }
}
/* Cleanup. */
if (parent_uvs != NULL) {