Fix for #32162 psys rotation causes size issues for particle instances

- The original scaling of the object wasn't taken into account when not using the particle dupliobject rotation option.
This commit is contained in:
Janne Karhu 2012-07-22 23:07:43 +00:00
parent 7fb85e1fb7
commit 161f502485

@ -1458,12 +1458,18 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
/* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */ /* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */
if ((part->draw & PART_DRAW_ROTATE_OB) == 0) { if ((part->draw & PART_DRAW_ROTATE_OB) == 0) {
float xvec[3], q[4]; float xvec[3], q[4], size_mat[4][4], original_size[3];
mat4_to_size(original_size, obmat);
size_to_mat4(size_mat, original_size);
xvec[0] = -1.f; xvec[0] = -1.f;
xvec[1] = xvec[2] = 0; xvec[1] = xvec[2] = 0;
vec_to_quat(q, xvec, ob->trackflag, ob->upflag); vec_to_quat(q, xvec, ob->trackflag, ob->upflag);
quat_to_mat4(obmat, q); quat_to_mat4(obmat, q);
obmat[3][3] = 1.0f; obmat[3][3] = 1.0f;
mult_m4_m4m4(obmat, obmat, size_mat);
} }
/* Normal particles and cached hair live in global space so we need to /* Normal particles and cached hair live in global space so we need to