Merge from Apricot Revisions 14897, 14913, 14914, 14915, 14929, 15009, 15046

---------------------------------------------------
Snappy stuff

* Align rotation with snapping target: rotate the object, aligning it with the target (object mode only - temporarily) (New icon in the header when snap is turned on)

* Snap to different mesh elements (face, edge, vertice): snapping target slide on faces and edge or use exact position of vertice. When using Align rotation with edge snapping, the normal is interpolated as you slide along.

Snaps correctly to derived mesh (sculpt, modifiers, ...) and duplis. In object and edit mode.

NOTE: The snapping code is now based on faces, so even if you're snapping to vertices or edges, it will not work on meshes without faces. This might change if needed.
This commit is contained in:
Martin Poirier
2008-06-09 18:41:16 +00:00
parent 8c68895741
commit fd1faa5542
9 changed files with 2633 additions and 2297 deletions

View File

@@ -293,7 +293,7 @@ typedef enum {
ICON_ARMATURE_DEHLT,
ICON_SNAP_GEAR,
ICON_SNAP_GEO,
ICON_BLANK41,
ICON_SNAP_NORMAL,
ICON_BLANK42,
ICON_SMOOTHCURVE,

View File

@@ -75,6 +75,8 @@ typedef struct TransSnap {
int status;
float snapPoint[3];
float snapTarget[3];
float snapNormal[3];
float snapTangent[3];
float dist; // Distance from snapPoint to snapTarget
double last;
void (*applySnap)(struct TransInfo *, float *);
@@ -457,6 +459,8 @@ void applySnapping(TransInfo *t, float *vec);
void resetSnapping(TransInfo *t);
int handleSnapping(TransInfo *t, int event);
void drawSnapping(TransInfo *t);
int usingSnappingNormal(TransInfo *t);
int validSnappingNormal(TransInfo *t);
/*********************** Generics ********************************/
@@ -487,6 +491,7 @@ void calculateCenterCursor2D(TransInfo *t);
void calculatePropRatio(TransInfo *t);
void getViewVector(float coord[3], float vec[3]);
void getViewRay(short mval[2], float p[3], float d[3]);
TransInfo * BIF_GetTransInfo(void);