[Bf-blender-cvs] [21ed3b32588] master: Fix T101025: Cycles motion blur crash with changing point cloud size
Hans Goudey
noreply at git.blender.org
Wed Sep 14 16:52:02 CEST 2022
Commit: 21ed3b3258887e202a3f66094e95696b1014c799
Author: Hans Goudey
Date: Wed Sep 14 09:51:27 2022 -0500
Branches: master
https://developer.blender.org/rB21ed3b3258887e202a3f66094e95696b1014c799
Fix T101025: Cycles motion blur crash with changing point cloud size
Caused by 410a6efb747f188da30c which didn't properly use the
smallest size between the Cycles and Blender point clouds.
===================================================================
M intern/cycles/blender/pointcloud.cpp
===================================================================
diff --git a/intern/cycles/blender/pointcloud.cpp b/intern/cycles/blender/pointcloud.cpp
index b4e90859877..35be2916e43 100644
--- a/intern/cycles/blender/pointcloud.cpp
+++ b/intern/cycles/blender/pointcloud.cpp
@@ -224,27 +224,24 @@ static void export_pointcloud_motion(PointCloud *pointcloud,
const int num_points = pointcloud->num_points();
float3 *mP = attr_mP->data_float3() + motion_step * num_points;
bool have_motion = false;
- int num_motion_points = 0;
const array<float3> &pointcloud_points = pointcloud->get_points();
+ const int b_points_num = b_pointcloud.points.length();
BL::FloatVectorAttribute b_attr_position = find_position_attribute(b_pointcloud);
std::optional<BL::FloatAttribute> b_attr_radius = find_radius_attribute(b_pointcloud);
- for (int i = 0; i < num_points; i++) {
- if (num_motion_points < num_points) {
- const float3 co = get_float3(b_attr_position.data[i].vector());
- const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.0f;
- float3 P = co;
- P.w = radius;
- mP[num_motion_points] = P;
- have_motion = have_motion || (P != pointcloud_points[num_motion_points]);
- num_motion_points++;
- }
+ for (int i = 0; i < std::min(num_points, b_points_num); i++) {
+ const float3 co = get_float3(b_attr_position.data[i].vector());
+ const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.0f;
+ float3 P = co;
+ P.w = radius;
+ mP[i] = P;
+ have_motion = have_motion || (P != pointcloud_points[i]);
}
/* In case of new attribute, we verify if there really was any motion. */
if (new_attribute) {
- if (num_motion_points != num_points || !have_motion) {
+ if (b_points_num != num_points || !have_motion) {
pointcloud->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
}
else if (motion_step > 0) {
More information about the Bf-blender-cvs
mailing list