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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2014-05-05 18:35:20 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-05-05 19:15:48 +0400
commit7a2ece3c19708b3633b743d2545560d76fd5d9b4 (patch)
tree0766e4f6a24ca6e9aa281b1739659901c14e341d /intern/cycles/blender
parentef1e511bb6caaca940f603fa41e1801f842f150b (diff)
Fix T40031: cycles deformation motion blur wrong render on last frame of animation.
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r--intern/cycles/blender/blender_mesh.cpp50
1 files changed, 42 insertions, 8 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index fb343a74bd5..c49086d83a7 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -648,20 +648,53 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Object *object, float motion
return;
}
- /* skip objects without deforming modifiers. this is not totally reliable,
- * would need a more extensive check to see which objects are animated */
+ /* skip empty meshes */
size_t numverts = mesh->verts.size();
size_t numkeys = mesh->curve_keys.size();
- if((!numverts && !numkeys) || !ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview))
+ if(!numverts && !numkeys)
return;
- /* get derived mesh */
- BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, false);
+ /* skip objects without deforming modifiers. this is not totally reliable,
+ * would need a more extensive check to see which objects are animated */
+ BL::Mesh b_mesh(PointerRNA_NULL);
+
+ if(ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
+ /* get derived mesh */
+ b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, false);
+ }
+
+ if(!b_mesh) {
+ /* if we have no motion blur on this frame, but on other frames, copy */
+ if(numverts) {
+ /* triangles */
+ Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
+
+ if(attr_mP) {
+ Attribute *attr_mN = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_NORMAL);
+ Attribute *attr_N = mesh->attributes.find(ATTR_STD_VERTEX_NORMAL);
+ float3 *P = &mesh->verts[0];
+ float3 *N = (attr_N)? attr_N->data_float3(): NULL;
+
+ memcpy(attr_mP->data_float3() + time_index*numverts, P, sizeof(float3)*numverts);
+ if(attr_mN)
+ memcpy(attr_mN->data_float3() + time_index*numverts, N, sizeof(float3)*numverts);
+ }
+ }
+
+ if(numkeys) {
+ /* curves */
+ Attribute *attr_mP = mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
+
+ if(attr_mP) {
+ float4 *keys = &mesh->curve_keys[0];
+ memcpy(attr_mP->data_float4() + time_index*numkeys, keys, sizeof(float4)*numkeys);
+ }
+ }
- if(!b_mesh)
return;
-
+ }
+
if(numverts) {
/* find attributes */
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
@@ -707,7 +740,8 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Object *object, float motion
for(int step = 0; step < time_index; step++) {
memcpy(attr_mP->data_float3() + step*numverts, P, sizeof(float3)*numverts);
- memcpy(attr_mN->data_float3() + step*numverts, N, sizeof(float3)*numverts);
+ if(attr_mN)
+ memcpy(attr_mN->data_float3() + step*numverts, N, sizeof(float3)*numverts);
}
}
}