diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-04-02 18:13:24 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-04-02 18:13:45 +0300 |
commit | 43101289a6696c176ee9d1c5e19b9919d5495455 (patch) | |
tree | 6d19b92245531265179d5a3f21037f1902173d58 /source/blender/blenkernel | |
parent | 018dc3aeda4ae637a134b043ced15d2c037ddc41 (diff) |
Fix T44183 particles in linked group offset from object
A nice bug combining all the broken features of blender:
Particles, duplis and multiple scene dependencies.
Fortunately this was solvable: Basically, we need to
make sure derivedmesh for dupli instance is generated before
obmat is overriden. This also makes sense, since no instance
has "true" obmat apart from original. Lazy initialization of
derivedmesh just does not work here (or it -does- work but first
use should be before instance drawing).
Fingers crossed nothing else breaks after this...
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_anim.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.c | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index e2b9c66780b..584f0da323a 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -80,7 +80,7 @@ typedef struct DupliApplyData { DupliExtraData *extra; } DupliApplyData; -DupliApplyData *duplilist_apply(struct Object *ob, struct ListBase *duplilist); +DupliApplyData *duplilist_apply(struct Object *ob, struct Scene *scene, struct ListBase *duplilist); void duplilist_restore(struct ListBase *duplilist, DupliApplyData *apply_data); void duplilist_free_apply_data(DupliApplyData *apply_data); diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index c77f65f69e1..8abe4bdbb97 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -1237,7 +1237,7 @@ int count_duplilist(Object *ob) return 1; } -DupliApplyData *duplilist_apply(Object *ob, ListBase *duplilist) +DupliApplyData *duplilist_apply(Object *ob, Scene *scene, ListBase *duplilist) { DupliApplyData *apply_data = NULL; int num_objects = BLI_listbase_count(duplilist); @@ -1253,6 +1253,13 @@ DupliApplyData *duplilist_apply(Object *ob, ListBase *duplilist) for (dob = duplilist->first, i = 0; dob; dob = dob->next, ++i) { /* copy obmat from duplis */ copy_m4_m4(apply_data->extra[i].obmat, dob->ob->obmat); + + /* make sure derivedmesh is calculated once, before drawing */ + if (scene && !(dob->ob->transflag & OB_DUPLICALCDERIVED) && dob->ob->type == OB_MESH) { + mesh_get_derived_final(scene, dob->ob, scene->customdata_mask); + dob->ob->transflag |= OB_DUPLICALCDERIVED; + } + copy_m4_m4(dob->ob->obmat, dob->mat); /* copy layers from the main duplicator object */ @@ -1273,6 +1280,7 @@ void duplilist_restore(ListBase *duplilist, DupliApplyData *apply_data) */ for (dob = duplilist->last, i = apply_data->num_objects - 1; dob; dob = dob->prev, --i) { copy_m4_m4(dob->ob->obmat, apply_data->extra[i].obmat); + dob->ob->transflag &= ~OB_DUPLICALCDERIVED; dob->ob->lay = apply_data->extra[i].lay; } |