Commit: 9c5da22db9cdc1e509397080ab03705c279c058c
Author: Kévin Dietrich
Date:   Wed Jul 13 06:05:43 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB9c5da22db9cdc1e509397080ab03705c279c058c

Cycles motion vectors: make sure we sample the velocities at the right
frame.

===================================================================

M       intern/cycles/blender/blender_mesh.cpp

===================================================================

diff --git a/intern/cycles/blender/blender_mesh.cpp 
b/intern/cycles/blender/blender_mesh.cpp
index 23fd144..0511244 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -972,9 +972,10 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
        /* TODO(sergey): Perform preliminary check for number of verticies. */
        if(numverts) {
                /* For fluid meshes since we have change in geometry, we use 
velocities,
-                * not delta-positions, and all the work is done on the first 
frame when
-                * time_index is == 0, so the work is done. */
-               if(mesh_cache && time_index != 0) {
+                * not delta-positions, and all the work is done on the last 
frame when
+                * time_index is != 0, such that we use the velocities from the 
right
+                * frame. */
+               if(mesh_cache && time_index == 0) {
                        return;
                }
 
@@ -1000,8 +1001,6 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
 
                        int step = 0;
 
-//                     fprintf(stderr, "%s, vertices: %lu\n", __func__, 
numverts);
-
                        float3 *buffer = new float3[numverts];
 
                        
MeshSequenceCacheModifier_velocity_cache_get(&mesh_cache.ptr, &buffer[0].x);
@@ -1012,8 +1011,6 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
                                float3 *mP = attr_mP->data_float3() + 
step*numverts;
                                float3 *mN = (attr_mN) ? attr_mN->data_float3() 
+ step*numverts : NULL;
 
-//                             fprintf(stderr, "Setting velocity for relative 
time: %f\n", (double)relative_time);
-
                                for (int i = 0; i < numverts; ++i) {
                                        mP[i] = P[i] + 
buffer[i]*relative_time*shuttertime*0.5f;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to