diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2017-02-05 00:17:15 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2017-02-05 00:17:15 +0300 |
commit | 47caf343c0ac597cc37048dc40d24a31b94fb238 (patch) | |
tree | 978895c0e67ea9898899859b20e9f187a3bac4c0 /source/blender/editors/transform | |
parent | a2c469edc2ddb70a844aea3060dd45b9f3efffee (diff) |
fix T50592: Scene.raycast not working
Ray_start and ray_normal values were being ignored
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform_snap_object.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 1a5cabd1da8..0e4ec12e18f 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -1827,6 +1827,9 @@ SnapObjectContext *ED_transform_snap_object_context_create( sctx->bmain = bmain; sctx->scene = scene; + sctx->cache.object_map = BLI_ghash_ptr_new(__func__); + sctx->cache.mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); + return sctx; } @@ -1841,9 +1844,6 @@ SnapObjectContext *ED_transform_snap_object_context_create_view3d( sctx->v3d_data.ar = ar; sctx->v3d_data.v3d = v3d; - sctx->cache.object_map = BLI_ghash_ptr_new(__func__); - sctx->cache.mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); - return sctx; } @@ -1875,12 +1875,8 @@ static void snap_object_data_free(void *sod_v) void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx) { - if (sctx->cache.object_map) { - BLI_ghash_free(sctx->cache.object_map, NULL, snap_object_data_free); - } - if (sctx->cache.mem_arena) { - BLI_memarena_free(sctx->cache.mem_arena); - } + BLI_ghash_free(sctx->cache.object_map, NULL, snap_object_data_free); + BLI_memarena_free(sctx->cache.mem_arena); MEM_freeN(sctx); } @@ -1903,7 +1899,7 @@ bool ED_transform_snap_object_project_ray_ex( SnapObjectContext *sctx, const unsigned short snap_to, const struct SnapObjectParams *params, - const float UNUSED(ray_start[3]), const float UNUSED(ray_normal[3]), + const float ray_start[3], const float ray_normal[3], float *ray_depth, float r_loc[3], float r_no[3], int *r_index, Object **r_ob, float r_obmat[4][4]) @@ -1911,7 +1907,9 @@ bool ED_transform_snap_object_project_ray_ex( const float depth_range[2] = {0.0f, FLT_MAX}; SnapData snapdata; - snap_data_set(&snapdata, sctx->v3d_data.ar, snap_to, VIEW_PROJ_NONE, NULL, r_loc, r_loc, r_no, depth_range); + snap_data_set( + &snapdata, sctx->v3d_data.ar, snap_to, VIEW_PROJ_NONE, + NULL, ray_start, ray_start, ray_normal, depth_range); return snapObjectsRay( sctx, &snapdata, |