transform_snap_object: Fix snap to curves.

Use `BKE_curve_texspace_get` instead `BKE_curve_boundbox_get`.
The snap to curve, even out of edit mode, is not done on the displist. So test a boundbox that covers the points seens in edit mode.
This commit is contained in:
Germano Cavalcante 2018-11-21 13:06:29 -02:00
parent cec83e92e6
commit 96e39af948
3 changed files with 5 additions and 3 deletions

View File

@ -89,7 +89,7 @@ void BKE_curve_curve_dimension_update(struct Curve *cu);
void BKE_curve_boundbox_calc(struct Curve *cu, float r_loc[3], float r_size[3]);
struct BoundBox *BKE_curve_boundbox_get(struct Object *ob);
void BKE_curve_texspace_calc(struct Curve *cu);
void BKE_curve_texspace_get(struct Curve *cu, float r_loc[3], float r_rot[3], float r_size[3]);
struct BoundBox *BKE_curve_texspace_get(struct Curve *cu, float r_loc[3], float r_rot[3], float r_size[3]);
bool BKE_curve_minmax(struct Curve *cu, bool use_radius, float min[3], float max[3]);
bool BKE_curve_center_median(struct Curve *cu, float cent[3]);

View File

@ -357,7 +357,7 @@ void BKE_curve_texspace_calc(Curve *cu)
}
}
void BKE_curve_texspace_get(Curve *cu, float r_loc[3], float r_rot[3], float r_size[3])
BoundBox *BKE_curve_texspace_get(Curve *cu, float r_loc[3], float r_rot[3], float r_size[3])
{
if (cu->bb == NULL || (cu->bb->flag & BOUNDBOX_DIRTY)) {
BKE_curve_texspace_calc(cu);
@ -366,6 +366,8 @@ void BKE_curve_texspace_get(Curve *cu, float r_loc[3], float r_rot[3], float r_s
if (r_loc) copy_v3_v3(r_loc, cu->loc);
if (r_rot) copy_v3_v3(r_rot, cu->rot);
if (r_size) copy_v3_v3(r_size, cu->size);
return cu->bb;
}
bool BKE_nurbList_index_get_co(ListBase *nurb, const int index, float r_co[3])

View File

@ -1556,7 +1556,7 @@ static short snapCurve(
if (use_obedit == false) {
/* Test BoundBox */
BoundBox *bb = BKE_curve_boundbox_get(ob);
BoundBox *bb = BKE_curve_texspace_get(cu, NULL, NULL, NULL);
if (bb) {
bool dummy[3];
/* In vertex and edges you need to get the pixel distance from ray to BoundBox, see: T46099, T46816 */