[Bf-blender-cvs] [8e08e323a7c] blender2.8: Fix T59484: Particles Lattice deform fails

Philipp Oeser noreply at git.blender.org
Tue Dec 18 14:42:53 CET 2018


Commit: 8e08e323a7cf302b59e90077594caef7db725c57
Author: Philipp Oeser
Date:   Tue Dec 18 13:48:25 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB8e08e323a7cf302b59e90077594caef7db725c57

Fix T59484: Particles Lattice deform fails

this was working for object/collection display/render but lattice was
not taken into account for non object/collection display/render types
(halo, axis, cross, circle, ...)

Reviewers: sergey, brecht

Maniphest Tasks: T59484

Differential Revision: https://developer.blender.org/D4096

===================================================================

M	source/blender/draw/intern/draw_cache_impl_particles.c

===================================================================

diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index d83f8fb660b..b383fcf4b92 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -44,6 +44,7 @@
 #include "DNA_particle_types.h"
 #include "DNA_customdata_types.h"
 
+#include "BKE_lattice.h"
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
 #include "BKE_particle.h"
@@ -1303,6 +1304,7 @@ static void particle_batch_cache_ensure_pos(
 	sim.ob = object;
 	sim.psys = psys;
 	sim.psmd = psys_get_modifier(object, psys);
+	sim.psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
 
 	if (psys->part->phystype == PART_PHYS_KEYED) {
 		if (psys->flag & PSYS_KEYED) {
@@ -1332,17 +1334,17 @@ static void particle_batch_cache_ensure_pos(
 
 		float val;
 
-		GPU_vertbuf_attr_set(point_cache->pos, pos_id, curr_point, pa->state.co);
-		GPU_vertbuf_attr_set(point_cache->pos, rot_id, curr_point, pa->state.rot);
+		GPU_vertbuf_attr_set(point_cache->pos, pos_id, curr_point, state.co);
+		GPU_vertbuf_attr_set(point_cache->pos, rot_id, curr_point, state.rot);
 
 		switch (psys->part->draw_col) {
 			case PART_DRAW_COL_VEL:
-				val = len_v3(pa->state.vel) / psys->part->color_vec_max;
+				val = len_v3(state.vel) / psys->part->color_vec_max;
 				break;
 			case PART_DRAW_COL_ACC:
 				val = len_v3v3(
-				        pa->state.vel,
-				        pa->prev_state.vel) / ((pa->state.time - pa->prev_state.time) * psys->part->color_vec_max);
+				        state.vel,
+				        pa->prev_state.vel) / ((state.time - pa->prev_state.time) * psys->part->color_vec_max);
 				break;
 			default:
 				val = -1.0f;



More information about the Bf-blender-cvs mailing list