forked from bartvdbraak/blender
Revert "Fix flickering when transform snapping in edit mode and cursor is"
Looks like the cleanest way to handle this is to no do bounding box collision for edit mode at all. But this is easy to enforce This reverts commit 7b5fe4f316234022a0ab761b694cd459ce98db2d. Conflicts: source/blender/editors/transform/transform_snap.c
This commit is contained in:
parent
0eb060c7b4
commit
d9de1b367e
@ -1088,7 +1088,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
|
|||||||
mval[1] = dd->mval[1];
|
mval[1] = dd->mval[1];
|
||||||
|
|
||||||
/* try to snap to closer object */
|
/* try to snap to closer object */
|
||||||
found = snapObjectsContext(C, mval, &dist_px, vec, no, SNAP_NOT_SELECTED, NULL);
|
found = snapObjectsContext(C, mval, &dist_px, vec, no, SNAP_NOT_SELECTED);
|
||||||
if (found == 1) {
|
if (found == 1) {
|
||||||
pt->type = dd->type;
|
pt->type = dd->type;
|
||||||
pt->mode = PT_SNAP;
|
pt->mode = PT_SNAP;
|
||||||
|
@ -5240,7 +5240,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||||||
const float mval[2] = {UNPACK2(event->mval)};
|
const float mval[2] = {UNPACK2(event->mval)};
|
||||||
float no_dummy[3];
|
float no_dummy[3];
|
||||||
float dist_px_dummy;
|
float dist_px_dummy;
|
||||||
snapObjectsContext(C, mval, &dist_px_dummy, location, no_dummy, SNAP_NOT_OBEDIT, NULL);
|
snapObjectsContext(C, mval, &dist_px_dummy, location, no_dummy, SNAP_NOT_OBEDIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_float_set_array(op->ptr, "location", location);
|
RNA_float_set_array(op->ptr, "location", location);
|
||||||
|
@ -110,7 +110,6 @@ struct ScrArea;
|
|||||||
struct Base;
|
struct Base;
|
||||||
struct Scene;
|
struct Scene;
|
||||||
struct Object;
|
struct Object;
|
||||||
struct BoundBox;
|
|
||||||
|
|
||||||
/* UNUSED */
|
/* UNUSED */
|
||||||
// int BIF_snappingSupported(struct Object *obedit);
|
// int BIF_snappingSupported(struct Object *obedit);
|
||||||
@ -181,15 +180,15 @@ typedef enum SnapMode {
|
|||||||
bool peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
|
bool peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
|
||||||
bool peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
|
bool peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
|
||||||
bool snapObjectsTransform(struct TransInfo *t, const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode);
|
bool snapObjectsTransform(struct TransInfo *t, const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode);
|
||||||
bool snapObjectsContext(struct bContext *C, const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode, struct BoundBox *bb_init);
|
bool snapObjectsContext(struct bContext *C, const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode);
|
||||||
/* taks args for all settings */
|
/* taks args for all settings */
|
||||||
bool snapObjectsEx(struct Scene *scene, struct Base *base_act, struct View3D *v3d, struct ARegion *ar, struct Object *obedit, short snap_mode,
|
bool snapObjectsEx(struct Scene *scene, struct Base *base_act, struct View3D *v3d, struct ARegion *ar, struct Object *obedit, short snap_mode,
|
||||||
const float mval[2], float *r_dist_px,
|
const float mval[2], float *r_dist_px,
|
||||||
float r_loc[3], float r_no[3], float *r_ray_dist, SnapMode mode, struct BoundBox *bb_init);
|
float r_loc[3], float r_no[3], float *r_ray_dist, SnapMode mode);
|
||||||
bool snapObjectsRayEx(struct Scene *scene, struct Base *base_act, struct View3D *v3d, struct ARegion *ar, struct Object *obedit, short snap_mode,
|
bool snapObjectsRayEx(struct Scene *scene, struct Base *base_act, struct View3D *v3d, struct ARegion *ar, struct Object *obedit, short snap_mode,
|
||||||
struct Object **r_ob, float r_obmat[4][4],
|
struct Object **r_ob, float r_obmat[4][4],
|
||||||
const float ray_start[3], const float ray_normal[3], float *r_ray_dist,
|
const float ray_start[3], const float ray_normal[3], float *r_ray_dist,
|
||||||
const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode, struct BoundBox *bb_init);
|
const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode);
|
||||||
|
|
||||||
bool snapNodesTransform(struct TransInfo *t, const int mval[2], float *r_dist_px, float r_loc[2], char *r_node_border, SnapMode mode);
|
bool snapNodesTransform(struct TransInfo *t, const int mval[2], float *r_dist_px, float r_loc[2], char *r_node_border, SnapMode mode);
|
||||||
bool snapNodesContext(struct bContext *C, const int mval[2], float *r_dist_px, float r_loc[2], char *r_node_border, SnapMode mode);
|
bool snapNodesContext(struct bContext *C, const int mval[2], float *r_dist_px, float r_loc[2], char *r_node_border, SnapMode mode);
|
||||||
|
@ -305,7 +305,7 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, BMEditMesh *em)
|
|||||||
float mval[2], co_proj[3], no_dummy[3];
|
float mval[2], co_proj[3], no_dummy[3];
|
||||||
float dist_px_dummy;
|
float dist_px_dummy;
|
||||||
if (ED_view3d_project_float_object(ar, eve->co, mval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
if (ED_view3d_project_float_object(ar, eve->co, mval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||||
if (snapObjectsContext(C, mval, &dist_px_dummy, co_proj, no_dummy, SNAP_NOT_OBEDIT, NULL)) {
|
if (snapObjectsContext(C, mval, &dist_px_dummy, co_proj, no_dummy, SNAP_NOT_OBEDIT)) {
|
||||||
mul_v3_m4v3(eve->co, obedit->imat, co_proj);
|
mul_v3_m4v3(eve->co, obedit->imat, co_proj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,17 +97,17 @@ static bool ED_view3d_snap_co(bContext *C, float r_co[3], float r_no[3], const f
|
|||||||
/* try snap edge, then face if it fails */
|
/* try snap edge, then face if it fails */
|
||||||
if (use_vert) {
|
if (use_vert) {
|
||||||
ret |= snapObjectsEx(scene, NULL, v3d, ar, obedit, SCE_SNAP_MODE_VERTEX,
|
ret |= snapObjectsEx(scene, NULL, v3d, ar, obedit, SCE_SNAP_MODE_VERTEX,
|
||||||
co_ss, &dist_px, r_co, r_no_ptr, &ray_dist, SNAP_ALL, NULL);
|
co_ss, &dist_px, r_co, r_no_ptr, &ray_dist, SNAP_ALL);
|
||||||
}
|
}
|
||||||
if (use_edge && (ret == false || use_depth)) {
|
if (use_edge && (ret == false || use_depth)) {
|
||||||
if (use_depth == false) ray_dist = TRANSFORM_DIST_MAX_RAY;
|
if (use_depth == false) ray_dist = TRANSFORM_DIST_MAX_RAY;
|
||||||
ret |= snapObjectsEx(scene, NULL, v3d, ar, obedit, SCE_SNAP_MODE_EDGE,
|
ret |= snapObjectsEx(scene, NULL, v3d, ar, obedit, SCE_SNAP_MODE_EDGE,
|
||||||
co_ss, &dist_px, r_co, r_no_ptr, &ray_dist, SNAP_ALL, NULL);
|
co_ss, &dist_px, r_co, r_no_ptr, &ray_dist, SNAP_ALL);
|
||||||
}
|
}
|
||||||
if (use_face && (ret == false || use_depth)) {
|
if (use_face && (ret == false || use_depth)) {
|
||||||
if (use_depth == false) ray_dist = TRANSFORM_DIST_MAX_RAY;
|
if (use_depth == false) ray_dist = TRANSFORM_DIST_MAX_RAY;
|
||||||
ret |= snapObjectsEx(scene, NULL, v3d, ar, obedit, SCE_SNAP_MODE_FACE,
|
ret |= snapObjectsEx(scene, NULL, v3d, ar, obedit, SCE_SNAP_MODE_FACE,
|
||||||
co_ss, &dist_px, r_co, r_no_ptr, &ray_dist, SNAP_ALL, NULL);
|
co_ss, &dist_px, r_co, r_no_ptr, &ray_dist, SNAP_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -130,7 +130,7 @@ static bool ED_view3d_snap_ray(bContext *C, float r_co[3],
|
|||||||
ret = snapObjectsRayEx(scene, NULL, v3d, ar, obedit, SCE_SNAP_MODE_FACE,
|
ret = snapObjectsRayEx(scene, NULL, v3d, ar, obedit, SCE_SNAP_MODE_FACE,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
ray_start, ray_normal, &ray_dist,
|
ray_start, ray_normal, &ray_dist,
|
||||||
NULL, &dist_px, r_co, r_no_dummy, SNAP_ALL, NULL);
|
NULL, &dist_px, r_co, r_no_dummy, SNAP_ALL);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ static bool walk_floor_distance_get(bContext *C, RegionView3D *rv3d, WalkInfo *w
|
|||||||
ret = snapObjectsRayEx(CTX_data_scene(C), NULL, NULL, NULL, NULL, SCE_SNAP_MODE_FACE,
|
ret = snapObjectsRayEx(CTX_data_scene(C), NULL, NULL, NULL, NULL, SCE_SNAP_MODE_FACE,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
ray_start, ray_normal, r_distance,
|
ray_start, ray_normal, r_distance,
|
||||||
NULL, &dummy_dist_px, r_location, r_normal, SNAP_ALL, NULL);
|
NULL, &dummy_dist_px, r_location, r_normal, SNAP_ALL);
|
||||||
|
|
||||||
/* artifically scale the distance to the scene size */
|
/* artifically scale the distance to the scene size */
|
||||||
*r_distance /= walk->grid;
|
*r_distance /= walk->grid;
|
||||||
@ -426,7 +426,7 @@ static bool walk_ray_cast(bContext *C, RegionView3D *rv3d, WalkInfo *walk, float
|
|||||||
ret = snapObjectsRayEx(CTX_data_scene(C), NULL, NULL, NULL, NULL, SCE_SNAP_MODE_FACE,
|
ret = snapObjectsRayEx(CTX_data_scene(C), NULL, NULL, NULL, NULL, SCE_SNAP_MODE_FACE,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
ray_start, ray_normal, ray_distance,
|
ray_start, ray_normal, ray_distance,
|
||||||
NULL, &dummy_dist_px, r_location, r_normal, SNAP_ALL, NULL);
|
NULL, &dummy_dist_px, r_location, r_normal, SNAP_ALL);
|
||||||
|
|
||||||
|
|
||||||
/* dot is positive if both rays are facing the same direction */
|
/* dot is positive if both rays are facing the same direction */
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
#include "ED_view3d.h"
|
#include "ED_view3d.h"
|
||||||
|
|
||||||
#include "DNA_listBase.h"
|
#include "DNA_listBase.h"
|
||||||
#include "DNA_object_types.h"
|
|
||||||
|
|
||||||
#include "BLI_smallhash.h"
|
#include "BLI_smallhash.h"
|
||||||
#include "BKE_editmesh.h"
|
#include "BKE_editmesh.h"
|
||||||
@ -99,7 +98,6 @@ typedef struct TransSnap {
|
|||||||
void (*targetSnap)(struct TransInfo *);
|
void (*targetSnap)(struct TransInfo *);
|
||||||
/* Get the transform distance between two points (used by Closest snap) */
|
/* Get the transform distance between two points (used by Closest snap) */
|
||||||
float (*distance)(struct TransInfo *, const float p1[3], const float p2[3]);
|
float (*distance)(struct TransInfo *, const float p1[3], const float p2[3]);
|
||||||
struct BoundBox BB_init;
|
|
||||||
} TransSnap;
|
} TransSnap;
|
||||||
|
|
||||||
typedef struct TransCon {
|
typedef struct TransCon {
|
||||||
|
@ -515,12 +515,6 @@ static void initSnappingMode(TransInfo *t)
|
|||||||
else {
|
else {
|
||||||
t->tsnap.modeSelect = t->tsnap.snap_self ? SNAP_ALL : SNAP_NOT_OBEDIT;
|
t->tsnap.modeSelect = t->tsnap.snap_self ? SNAP_ALL : SNAP_NOT_OBEDIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* store the original bounding box -
|
|
||||||
* we could slightly increase the size in screen space but leaving as TODO */
|
|
||||||
bb_init = BKE_object_boundbox_get(obedit);
|
|
||||||
if (bb_init)
|
|
||||||
t->tsnap.BB_init = *bb_init;
|
|
||||||
}
|
}
|
||||||
/* Particles edit mode*/
|
/* Particles edit mode*/
|
||||||
else if (t->tsnap.applySnap != NULL && // A snapping function actually exist
|
else if (t->tsnap.applySnap != NULL && // A snapping function actually exist
|
||||||
@ -1496,12 +1490,13 @@ static bool snapCurve(short snap_mode, ARegion *ar, Object *ob, Curve *cu, float
|
|||||||
|
|
||||||
static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, BMEditMesh *em, float obmat[4][4],
|
static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, BMEditMesh *em, float obmat[4][4],
|
||||||
const float ray_start[3], const float ray_normal[3], const float ray_origin[3],
|
const float ray_start[3], const float ray_normal[3], const float ray_origin[3],
|
||||||
const float mval[2], float r_loc[3], float r_no[3], float *r_dist_px, float *r_depth, BoundBox *bb_init)
|
const float mval[2], float r_loc[3], float r_no[3], float *r_dist_px, float *r_depth)
|
||||||
{
|
{
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
int totvert = dm->getNumVerts(dm);
|
int totvert = dm->getNumVerts(dm);
|
||||||
|
|
||||||
if (totvert > 0) {
|
if (totvert > 0) {
|
||||||
|
BoundBox *bb;
|
||||||
float imat[4][4];
|
float imat[4][4];
|
||||||
float timat[3][3]; /* transpose inverse matrix for normals */
|
float timat[3][3]; /* transpose inverse matrix for normals */
|
||||||
float ray_start_local[3], ray_normal_local[3], local_scale, len_diff = TRANSFORM_DIST_MAX_RAY;
|
float ray_start_local[3], ray_normal_local[3], local_scale, len_diff = TRANSFORM_DIST_MAX_RAY;
|
||||||
@ -1519,9 +1514,8 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
|
|||||||
/* local scale in normal direction */
|
/* local scale in normal direction */
|
||||||
local_scale = normalize_v3(ray_normal_local);
|
local_scale = normalize_v3(ray_normal_local);
|
||||||
|
|
||||||
if (!bb_init)
|
bb = BKE_object_boundbox_get(ob);
|
||||||
bb_init = BKE_object_boundbox_get(ob);
|
if (!BKE_boundbox_ray_hit_check(bb, ray_start_local, ray_normal_local, &len_diff)) {
|
||||||
if (!BKE_boundbox_ray_hit_check(bb_init, ray_start_local, ray_normal_local, &len_diff)) {
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1813,27 +1807,24 @@ static bool snapCamera(short snap_mode, ARegion *ar, Scene *scene, Object *objec
|
|||||||
static bool snapObject(Scene *scene, short snap_mode, ARegion *ar, Object *ob, float obmat[4][4], bool use_obedit,
|
static bool snapObject(Scene *scene, short snap_mode, ARegion *ar, Object *ob, float obmat[4][4], bool use_obedit,
|
||||||
Object **r_ob, float r_obmat[4][4],
|
Object **r_ob, float r_obmat[4][4],
|
||||||
const float ray_start[3], const float ray_normal[3], const float ray_origin[3],
|
const float ray_start[3], const float ray_normal[3], const float ray_origin[3],
|
||||||
const float mval[2], float r_loc[3], float r_no[3], float *r_dist_px, float *r_depth, BoundBox *bb_init)
|
const float mval[2], float r_loc[3], float r_no[3], float *r_dist_px, float *r_depth)
|
||||||
{
|
{
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
|
|
||||||
if (ob->type == OB_MESH) {
|
if (ob->type == OB_MESH) {
|
||||||
BMEditMesh *em;
|
BMEditMesh *em;
|
||||||
DerivedMesh *dm;
|
DerivedMesh *dm;
|
||||||
BoundBox *bb;
|
|
||||||
|
|
||||||
if (use_obedit) {
|
if (use_obedit) {
|
||||||
em = BKE_editmesh_from_object(ob);
|
em = BKE_editmesh_from_object(ob);
|
||||||
dm = editbmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH);
|
dm = editbmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH);
|
||||||
bb = bb_init;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
em = NULL;
|
em = NULL;
|
||||||
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
|
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
|
||||||
bb = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = snapDerivedMesh(snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_depth, bb);
|
retval = snapDerivedMesh(snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_depth);
|
||||||
|
|
||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
@ -1864,7 +1855,7 @@ static bool snapObjectsRay(Scene *scene, short snap_mode, Base *base_act, View3D
|
|||||||
Object **r_ob, float r_obmat[4][4],
|
Object **r_ob, float r_obmat[4][4],
|
||||||
const float ray_start[3], const float ray_normal[3], const float ray_origin[3],
|
const float ray_start[3], const float ray_normal[3], const float ray_origin[3],
|
||||||
float *r_ray_dist,
|
float *r_ray_dist,
|
||||||
const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode, BoundBox *bb_init)
|
const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode)
|
||||||
{
|
{
|
||||||
Base *base;
|
Base *base;
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
@ -1874,7 +1865,7 @@ static bool snapObjectsRay(Scene *scene, short snap_mode, Base *base_act, View3D
|
|||||||
|
|
||||||
retval |= snapObject(scene, snap_mode, ar, ob, ob->obmat, true,
|
retval |= snapObject(scene, snap_mode, ar, ob, ob->obmat, true,
|
||||||
r_ob, r_obmat,
|
r_ob, r_obmat,
|
||||||
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist, bb_init);
|
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Need an exception for particle edit because the base is flagged with BA_HAS_RECALC_DATA
|
/* Need an exception for particle edit because the base is flagged with BA_HAS_RECALC_DATA
|
||||||
@ -1887,7 +1878,7 @@ static bool snapObjectsRay(Scene *scene, short snap_mode, Base *base_act, View3D
|
|||||||
Object *ob = base->object;
|
Object *ob = base->object;
|
||||||
retval |= snapObject(scene, snap_mode, ar, ob, ob->obmat, false,
|
retval |= snapObject(scene, snap_mode, ar, ob, ob->obmat, false,
|
||||||
r_ob, r_obmat,
|
r_ob, r_obmat,
|
||||||
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist, NULL);
|
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (base = FIRSTBASE; base != NULL; base = base->next) {
|
for (base = FIRSTBASE; base != NULL; base = base->next) {
|
||||||
@ -1906,7 +1897,7 @@ static bool snapObjectsRay(Scene *scene, short snap_mode, Base *base_act, View3D
|
|||||||
for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next) {
|
for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next) {
|
||||||
retval |= snapObject(scene, snap_mode, ar, dupli_ob->ob, dupli_ob->mat, false,
|
retval |= snapObject(scene, snap_mode, ar, dupli_ob->ob, dupli_ob->mat, false,
|
||||||
r_ob, r_obmat,
|
r_ob, r_obmat,
|
||||||
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist, NULL);
|
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
free_object_duplilist(lb);
|
free_object_duplilist(lb);
|
||||||
@ -1914,7 +1905,7 @@ static bool snapObjectsRay(Scene *scene, short snap_mode, Base *base_act, View3D
|
|||||||
|
|
||||||
retval |= snapObject(scene, snap_mode, ar, ob, ob->obmat, false,
|
retval |= snapObject(scene, snap_mode, ar, ob, ob->obmat, false,
|
||||||
r_ob, r_obmat,
|
r_ob, r_obmat,
|
||||||
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist, NULL);
|
ray_start, ray_normal, ray_origin, mval, r_loc, r_no, r_dist_px, r_ray_dist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1922,7 +1913,7 @@ static bool snapObjectsRay(Scene *scene, short snap_mode, Base *base_act, View3D
|
|||||||
}
|
}
|
||||||
static bool snapObjects(Scene *scene, short snap_mode, Base *base_act, View3D *v3d, ARegion *ar, Object *obedit,
|
static bool snapObjects(Scene *scene, short snap_mode, Base *base_act, View3D *v3d, ARegion *ar, Object *obedit,
|
||||||
const float mval[2], float *r_dist_px,
|
const float mval[2], float *r_dist_px,
|
||||||
float r_loc[3], float r_no[3], float *r_ray_dist, SnapMode mode, BoundBox *bb_init)
|
float r_loc[3], float r_no[3], float *r_ray_dist, SnapMode mode)
|
||||||
{
|
{
|
||||||
float ray_start[3], ray_normal[3], ray_orgigin[3];
|
float ray_start[3], ray_normal[3], ray_orgigin[3];
|
||||||
|
|
||||||
@ -1933,17 +1924,17 @@ static bool snapObjects(Scene *scene, short snap_mode, Base *base_act, View3D *v
|
|||||||
return snapObjectsRay(scene, snap_mode, base_act, v3d, ar, obedit,
|
return snapObjectsRay(scene, snap_mode, base_act, v3d, ar, obedit,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
ray_start, ray_normal, ray_orgigin, r_ray_dist,
|
ray_start, ray_normal, ray_orgigin, r_ray_dist,
|
||||||
mval, r_dist_px, r_loc, r_no, mode, bb_init);
|
mval, r_dist_px, r_loc, r_no, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool snapObjectsTransform(TransInfo *t, const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode)
|
bool snapObjectsTransform(TransInfo *t, const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode)
|
||||||
{
|
{
|
||||||
float ray_dist = TRANSFORM_DIST_MAX_RAY;
|
float ray_dist = TRANSFORM_DIST_MAX_RAY;
|
||||||
return snapObjects(t->scene, t->scene->toolsettings->snap_mode, t->scene->basact, t->view, t->ar, t->obedit,
|
return snapObjects(t->scene, t->scene->toolsettings->snap_mode, t->scene->basact, t->view, t->ar, t->obedit,
|
||||||
mval, r_dist_px, r_loc, r_no, &ray_dist, mode, &t->tsnap.BB_init);
|
mval, r_dist_px, r_loc, r_no, &ray_dist, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool snapObjectsContext(bContext *C, const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode, BoundBox *bb_init)
|
bool snapObjectsContext(bContext *C, const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode)
|
||||||
{
|
{
|
||||||
ScrArea *sa = CTX_wm_area(C);
|
ScrArea *sa = CTX_wm_area(C);
|
||||||
View3D *v3d = sa->spacedata.first;
|
View3D *v3d = sa->spacedata.first;
|
||||||
@ -1953,26 +1944,26 @@ bool snapObjectsContext(bContext *C, const float mval[2], float *r_dist_px, floa
|
|||||||
float ray_dist = TRANSFORM_DIST_MAX_RAY;
|
float ray_dist = TRANSFORM_DIST_MAX_RAY;
|
||||||
|
|
||||||
return snapObjects(scene, scene->toolsettings->snap_mode, scene->basact, v3d, ar, obedit,
|
return snapObjects(scene, scene->toolsettings->snap_mode, scene->basact, v3d, ar, obedit,
|
||||||
mval, r_dist_px, r_loc, r_no, &ray_dist, mode, bb_init);
|
mval, r_dist_px, r_loc, r_no, &ray_dist, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool snapObjectsEx(Scene *scene, Base *base_act, View3D *v3d, ARegion *ar, Object *obedit, short snap_mode,
|
bool snapObjectsEx(Scene *scene, Base *base_act, View3D *v3d, ARegion *ar, Object *obedit, short snap_mode,
|
||||||
const float mval[2], float *r_dist_px,
|
const float mval[2], float *r_dist_px,
|
||||||
float r_loc[3], float r_no[3], float *r_ray_dist, SnapMode mode, struct BoundBox *bb_init)
|
float r_loc[3], float r_no[3], float *r_ray_dist, SnapMode mode)
|
||||||
{
|
{
|
||||||
return snapObjects(scene, snap_mode, base_act, v3d, ar, obedit,
|
return snapObjects(scene, snap_mode, base_act, v3d, ar, obedit,
|
||||||
mval, r_dist_px,
|
mval, r_dist_px,
|
||||||
r_loc, r_no, r_ray_dist, mode, bb_init);
|
r_loc, r_no, r_ray_dist, mode);
|
||||||
}
|
}
|
||||||
bool snapObjectsRayEx(Scene *scene, Base *base_act, View3D *v3d, ARegion *ar, Object *obedit, short snap_mode,
|
bool snapObjectsRayEx(Scene *scene, Base *base_act, View3D *v3d, ARegion *ar, Object *obedit, short snap_mode,
|
||||||
Object **r_ob, float r_obmat[4][4],
|
Object **r_ob, float r_obmat[4][4],
|
||||||
const float ray_start[3], const float ray_normal[3], float *r_ray_dist,
|
const float ray_start[3], const float ray_normal[3], float *r_ray_dist,
|
||||||
const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode, struct BoundBox *bb_init)
|
const float mval[2], float *r_dist_px, float r_loc[3], float r_no[3], SnapMode mode)
|
||||||
{
|
{
|
||||||
return snapObjectsRay(scene, snap_mode, base_act, v3d, ar, obedit,
|
return snapObjectsRay(scene, snap_mode, base_act, v3d, ar, obedit,
|
||||||
r_ob, r_obmat,
|
r_ob, r_obmat,
|
||||||
ray_start, ray_normal, ray_start, r_ray_dist,
|
ray_start, ray_normal, ray_start, r_ray_dist,
|
||||||
mval, r_dist_px, r_loc, r_no, mode, bb_init);
|
mval, r_dist_px, r_loc, r_no, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************** PEELING *********************************/
|
/******************** PEELING *********************************/
|
||||||
|
@ -126,7 +126,7 @@ static void rna_Scene_ray_cast(Scene *scene, float ray_start[3], float ray_end[3
|
|||||||
if (snapObjectsRayEx(scene, NULL, NULL, NULL, NULL, SCE_SNAP_MODE_FACE,
|
if (snapObjectsRayEx(scene, NULL, NULL, NULL, NULL, SCE_SNAP_MODE_FACE,
|
||||||
r_ob, (float(*)[4])r_obmat,
|
r_ob, (float(*)[4])r_obmat,
|
||||||
ray_start, ray_nor, &ray_dist,
|
ray_start, ray_nor, &ray_dist,
|
||||||
NULL, &dummy_dist_px, r_location, r_normal, SNAP_ALL, NULL))
|
NULL, &dummy_dist_px, r_location, r_normal, SNAP_ALL))
|
||||||
{
|
{
|
||||||
*r_success = true;
|
*r_success = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user