diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-01-20 22:58:05 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-01-20 22:58:05 +0300 |
commit | 228c0c760f58079cb8febc4d41ca821414f8a6f5 (patch) | |
tree | a6691834feff50ea5c4b89ddb974ae938d1982f7 /source/blender/editors/transform/transform_snap.c | |
parent | d9a0a477a465b3882284b8690f2cdc6f66b4bb93 (diff) |
2.5
EditMesh snap still had stubs instead of proper editmesh calls
Misc correction for 2D edit with NDOF (not testable without ndof support)
Diffstat (limited to 'source/blender/editors/transform/transform_snap.c')
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 7e27fb32044..023b97058d3 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -65,6 +65,7 @@ #include "BKE_context.h" #include "ED_view3d.h" +#include "ED_mesh.h" #include "WM_types.h" @@ -76,12 +77,6 @@ //#include "blendef.h" /* for selection modes */ -static EditVert *EM_get_vert_for_index(int x) {return 0;} // XXX -static EditEdge *EM_get_edge_for_index(int x) {return 0;} // XXX -static EditFace *EM_get_face_for_index(int x) {return 0;} // XXX -static void EM_init_index_arrays(int x, int y, int z) {} // XXX -static void EM_free_index_arrays(void) {} // XXX - /********************* PROTOTYPES ***********************/ void setSnappingCallback(TransInfo *t); @@ -516,7 +511,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec) int found = 0; int dist = 40; // Use a user defined value here - found = snapObjects(t, &dist, vec, no, t->mode); + found = snapObjects(t, &dist, vec, no, t->tsnap.mode); if (found == 1) { float tangent[3]; @@ -550,7 +545,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec) int found = 0; int dist = 40; // Use a user defined value here - found = snapObjects(t, &dist, vec, no, t->mode); + found = snapObjects(t, &dist, vec, no, t->tsnap.mode); if (found == 1) { VECCOPY(t->tsnap.snapPoint, vec); @@ -764,7 +759,7 @@ void TargetSnapClosest(TransInfo *t) } /*================================================================*/ -int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], short mval[2], float *loc, float *no, int *dist, float *depth, short EditMesh) +int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, EditMesh *em, float obmat[][4], float ray_start[3], float ray_normal[3], short mval[2], float *loc, float *no, int *dist, float *depth) { int retval = 0; int totvert = dm->getNumVerts(dm); @@ -808,10 +803,10 @@ int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], int index = 0; int i; - if (EditMesh) + if (em != NULL) { index_array = dm->getFaceDataArray(dm, CD_ORIGINDEX); - EM_init_index_arrays(0, 0, 1); + EM_init_index_arrays(em, 0, 0, 1); } for( i = 0; i < totface; i++) { @@ -822,7 +817,7 @@ int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], test = 1; /* reset for every face */ - if (EditMesh) + if (em != NULL) { if (index_array) { @@ -940,7 +935,7 @@ int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], } } - if (EditMesh) + if (em != NULL) { EM_free_index_arrays(); } @@ -953,10 +948,10 @@ int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], int index = 0; int i; - if (EditMesh) + if (em != NULL) { index_array = dm->getVertDataArray(dm, CD_ORIGINDEX); - EM_init_index_arrays(1, 0, 0); + EM_init_index_arrays(em, 1, 0, 0); } for( i = 0; i < totvert; i++) { @@ -965,7 +960,7 @@ int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], test = 1; /* reset for every vert */ - if (EditMesh) + if (em != NULL) { if (index_array) { @@ -1031,7 +1026,7 @@ int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], } } - if (EditMesh) + if (em != NULL) { EM_free_index_arrays(); } @@ -1046,10 +1041,10 @@ int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], int index = 0; int i; - if (EditMesh) + if (em != NULL) { index_array = dm->getEdgeDataArray(dm, CD_ORIGINDEX); - EM_init_index_arrays(0, 1, 0); + EM_init_index_arrays(em, 0, 1, 0); } for( i = 0; i < totedge; i++) { @@ -1058,7 +1053,7 @@ int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], test = 1; /* reset for every vert */ - if (EditMesh) + if (em != NULL) { if (index_array) { @@ -1163,7 +1158,7 @@ int snapDerivedMesh(TransInfo *t, Object *ob, DerivedMesh *dm, float obmat[][4], } } - if (EditMesh) + if (em != NULL) { EM_free_index_arrays(); } @@ -1194,7 +1189,7 @@ int snapObjects(TransInfo *t, int *dist, float *loc, float *no, int mode) { dm = editmesh_get_derived_cage(t->scene, t->obedit, em, CD_MASK_BAREMESH); - retval = snapDerivedMesh(t, ob, dm, ob->obmat, ray_start, ray_normal, t->mval, loc, no, dist, &depth, 1); + retval = snapDerivedMesh(t, ob, dm, em, ob->obmat, ray_start, ray_normal, t->mval, loc, no, dist, &depth); dm->release(dm); } @@ -1220,7 +1215,7 @@ int snapObjects(TransInfo *t, int *dist, float *loc, float *no, int mode) { DerivedMesh *dm = mesh_get_derived_final(t->scene, ob, CD_MASK_BAREMESH); int val; - val = snapDerivedMesh(t, ob, dm, dupli_ob->mat, ray_start, ray_normal, t->mval, loc, no, dist, &depth, 0); + val = snapDerivedMesh(t, ob, dm, NULL, dupli_ob->mat, ray_start, ray_normal, t->mval, loc, no, dist, &depth); retval = retval || val; @@ -1235,7 +1230,7 @@ int snapObjects(TransInfo *t, int *dist, float *loc, float *no, int mode) { DerivedMesh *dm = mesh_get_derived_final(t->scene, ob, CD_MASK_BAREMESH); int val; - val = snapDerivedMesh(t, ob, dm, ob->obmat, ray_start, ray_normal, t->mval, loc, no, dist, &depth, 0); + val = snapDerivedMesh(t, ob, dm, NULL, ob->obmat, ray_start, ray_normal, t->mval, loc, no, dist, &depth); retval = retval || val; |