[Bf-blender-cvs] [34ea8058b99] master: Fix: Object.raycast: error to free treedata
Germano Cavalcante
noreply at git.blender.org
Sat Apr 15 07:24:39 CEST 2017
Commit: 34ea8058b99a3c5a392dfb1d7d8ab4bd52209a00
Author: Germano Cavalcante
Date: Sat Apr 15 02:24:04 2017 -0300
Branches: master
https://developer.blender.org/rB34ea8058b99a3c5a392dfb1d7d8ab4bd52209a00
Fix: Object.raycast: error to free treedata
===================================================================
M source/blender/makesrna/intern/rna_object_api.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 42d1b78784f..b3bc2c72d34 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -326,6 +326,8 @@ static void rna_Object_ray_cast(
return;
}
+ *r_success = false;
+
/* Test BoundBox first (efficiency) */
BoundBox *bb = BKE_object_boundbox_get(ob);
if (bb) {
@@ -333,11 +335,9 @@ static void rna_Object_ray_cast(
if (isect_ray_aabb_v3_simple(origin, direction, bb->vec[0], bb->vec[6], &distmin, &distmax)) {
float dist = distmin >= 0 ? distmin : distmax;
if (dist > distance) {
- goto finally;
}
}
else {
- goto finally;
}
}
@@ -365,20 +365,17 @@ static void rna_Object_ray_cast(
copy_v3_v3(r_location, hit.co);
copy_v3_v3(r_normal, hit.no);
*r_index = dm_looptri_to_poly_index(ob->derivedFinal, &treeData.looptri[hit.index]);
-
- goto finally;
}
}
- }
-
- *r_success = false;
- zero_v3(r_location);
- zero_v3(r_normal);
- *r_index = -1;
+ free_bvhtree_from_mesh(&treeData);
+ }
-finally:
- free_bvhtree_from_mesh(&treeData);
+ if (*r_success == false) {
+ zero_v3(r_location);
+ zero_v3(r_normal);
+ *r_index = -1;
+ }
}
static void rna_Object_closest_point_on_mesh(
More information about the Bf-blender-cvs
mailing list