diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-05 09:56:41 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-05 09:56:41 +0400 |
commit | 62087935ec92e24bce362489cadc944bc256e8cc (patch) | |
tree | b8056f1bfebd2812a5a8ed6120ba168ee79bd28f /intern/cycles | |
parent | 998b9241bedea82f4501b4c4e5453d7becb07d3e (diff) |
Fix #35209: cycles generated texture coordinates did not stick to deforming meshes.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 7 | ||||
-rw-r--r-- | intern/cycles/blender/blender_util.h | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index 10e3946dbd2..c545ad240c4 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -336,7 +336,7 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector< size_t i = 0; for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v) - generated[i++] = get_float3(v->co())*size - loc; + generated[i++] = get_float3(v->undeformed_co())*size - loc; } } @@ -435,7 +435,8 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri mesh_synced.insert(mesh); /* create derived mesh */ - BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview); + bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED); + BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed); PointerRNA cmesh = RNA_pointer_get(&b_ob_data.ptr, "cycles"); vector<Mesh::Triangle> oldtriangle = mesh->triangles; @@ -507,7 +508,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion) return; /* get derived mesh */ - BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview); + BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, false); if(b_mesh) { BL::Mesh::vertices_iterator v; diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index 747008fc7c4..1c2576d0b3b 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -39,9 +39,9 @@ float *BKE_image_get_float_pixels_for_frame(void *image, int frame); CCL_NAMESPACE_BEGIN -static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL::Scene scene, bool apply_modifiers, bool render) +static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL::Scene scene, bool apply_modifiers, bool render, bool calc_undeformed) { - return data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, true); + return data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, true, calc_undeformed); } static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size) |