Fix T47615: crash trying to use point density with lamp object.

This commit is contained in:
Brecht Van Lommel 2016-02-28 22:56:18 +01:00
parent 87c8ff0164
commit 42fe1ba844
Notes: blender-bot 2023-02-14 08:45:09 +01:00
Referenced by issue #47615, Point density crash
1 changed files with 12 additions and 6 deletions

View File

@ -764,12 +764,18 @@ void RE_point_density_minmax(
else {
float radius[3] = {pd->radius, pd->radius, pd->radius};
float *loc, *size;
BKE_object_obdata_texspace_get(pd->object, NULL, &loc, &size, NULL);
sub_v3_v3v3(r_min, loc, size);
add_v3_v3v3(r_max, loc, size);
/* Adjust texture space to include density points on the boundaries. */
sub_v3_v3(r_min, radius);
add_v3_v3(r_max, radius);
if (BKE_object_obdata_texspace_get(pd->object, NULL, &loc, &size, NULL)) {
sub_v3_v3v3(r_min, loc, size);
add_v3_v3v3(r_max, loc, size);
/* Adjust texture space to include density points on the boundaries. */
sub_v3_v3(r_min, radius);
add_v3_v3(r_max, radius);
}
else {
zero_v3(r_min);
zero_v3(r_max);
}
}
}