diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-16 14:15:50 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-16 14:15:50 +0300 |
commit | 92598a6e229c718f53553a76f9eb03c198298ab5 (patch) | |
tree | df25b5af3608addefb02052a42518b2b6694ab7f /source/blender/editors/space_view3d | |
parent | e3a07367167a20fea5c90e0edc9597bdbcef59ff (diff) |
Mesh overrides for duplis from cached Alembic data.
If a duplicator has cached data it will now replace the derivedFinal
mesh of objects with the cached version for drawing.
This is a compromise atm: It would be better to actually draw derived
meshes directly, so that we don't have to modify objects. Then we could
also have multiple different instances of the same orignal object
(in whatever way these might be defined). DNA Objects would then be
totally separate from duplis, but at this point the drawing and render
code makes this unfeasible.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 58ef9184dd0..6bc5e173c53 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -55,6 +55,7 @@ #include "BKE_camera.h" #include "BKE_context.h" #include "BKE_customdata.h" +#include "BKE_DerivedMesh.h" #include "BKE_image.h" #include "BKE_key.h" #include "BKE_main.h" @@ -2050,7 +2051,10 @@ static void draw_dupli_objects_color( if (dob) dob_next = dupli_step(dob->next); for (; dob; dob_prev = dob, dob = dob_next, dob_next = dob_next ? dupli_step(dob_next->next) : NULL) { + DerivedMesh *final_dm; /* for restoring after override */ + tbase.object = dob->ob; + final_dm = dob->ob->derivedFinal; /* Make sure lod is updated from dupli's position */ @@ -2087,6 +2091,13 @@ static void draw_dupli_objects_color( glColor3ubv(color_rgb); } + /* override final DM */ + if (base->object->dup_cache) { + DupliObjectData *dob_data = BKE_dupli_cache_find_data(base->object->dup_cache, tbase.object); + if (dob_data->cache_dm) + tbase.object->derivedFinal = dob_data->cache_dm; + } + /* generate displist, test for new object */ if (dob_prev && dob_prev->ob != dob->ob) { if (use_displist == true) @@ -2156,6 +2167,7 @@ static void draw_dupli_objects_color( tbase.object->dtx = dtx; tbase.object->transflag = transflag; tbase.object->currentlod = savedlod; + tbase.object->derivedFinal = final_dm; } if (apply_data) { |