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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-09-19 05:21:34 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-09-19 05:21:34 +0400
commit16c31832f9e9e455d3a194549e0f2837b49c8b1e (patch)
tree54c9bf70f9b083ecc35824b074ae6795119d17ca /source
parent4dd7d4110a06422b5a86a609b7cc7687bd570fef (diff)
fix [#36625] Particle Instances ignores Group offsets
in fact this failed for all nested dupli types except for dupli-groups, (which ignore the 'par_space_mat' object_duplilist_recursive()).
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/anim.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 49c9a8e9083..5c3f67d8959 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -751,14 +751,24 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int persiste
DupliObject *dob;
Group *group;
GroupObject *go;
- float mat[4][4], tmat[4][4], id;
-
+ float mat[4][4], ob_obmat_ofs[4][4], id;
+
if (ob->dup_group == NULL) return;
group = ob->dup_group;
/* simple preventing of too deep nested groups */
if (level > MAX_DUPLI_RECUR) return;
+ /* don't access 'ob->obmat' from now on. */
+ copy_m4_m4(ob_obmat_ofs, ob->obmat);
+
+ if (!is_zero_v3(group->dupli_ofs)) {
+ float tvec[3];
+ copy_v3_v3(tvec, group->dupli_ofs);
+ mul_mat3_m4_v3(ob_obmat_ofs, tvec);
+ sub_v3_v3(ob_obmat_ofs[3], tvec);
+ }
+
/* handles animated groups, and */
/* we need to check update for objects that are not in scene... */
@@ -776,14 +786,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int persiste
if (go->ob != ob) {
/* group dupli offset, should apply after everything else */
- if (!is_zero_v3(group->dupli_ofs)) {
- copy_m4_m4(tmat, go->ob->obmat);
- sub_v3_v3v3(tmat[3], tmat[3], group->dupli_ofs);
- mul_m4_m4m4(mat, ob->obmat, tmat);
- }
- else {
- mul_m4_m4m4(mat, ob->obmat, go->ob->obmat);
- }
+ mul_m4_m4m4(mat, ob_obmat_ofs, go->ob->obmat);
dob = new_dupli_object(lb, go->ob, mat, ob->lay, persistent_id, level, id, OB_DUPLIGROUP, flag);
@@ -797,7 +800,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int persiste
if (go->ob->transflag & OB_DUPLI) {
copy_m4_m4(dob->ob->obmat, dob->mat);
- object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, persistent_id, level + 1, id, flag);
+ object_duplilist_recursive(&group->id, scene, go->ob, lb, ob_obmat_ofs, persistent_id, level + 1, id, flag);
copy_m4_m4(dob->ob->obmat, dob->omat);
}
}