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:
authorGermano Cavalcante <germano.costa@ig.com.br>2017-04-15 08:24:04 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2017-04-15 08:24:04 +0300
commit34ea8058b99a3c5a392dfb1d7d8ab4bd52209a00 (patch)
treea7c553898297aaf95684412225c56873e927eea3
parent97d2f63bfe6d166eca12f7dec0e6525806990f49 (diff)
Fix: Object.raycast: error to free treedata
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c21
1 files changed, 9 insertions, 12 deletions
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(