Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/transform/transform.h')
-rw-r--r--source/blender/editors/transform/transform.h70
1 files changed, 53 insertions, 17 deletions
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index aab065675fe..c156e9ecec0 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -90,12 +90,16 @@ typedef struct TransSnap {
char snapNodeBorder;
ListBase points;
TransSnapPoint *selectedPoint;
- float dist; // Distance from snapPoint to snapTarget
double last;
void (*applySnap)(struct TransInfo *, float *);
void (*calcSnap)(struct TransInfo *, float *);
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)
+ *
+ * \note Return value can be anything,
+ * where the smallest absolute value defines whats closest.
+ */
float (*distance)(struct TransInfo *, const float p1[3], const float p2[3]);
} TransSnap;
@@ -225,6 +229,8 @@ typedef struct TransDataEdgeSlideVert {
typedef struct SlideOrigData {
/* flag that is set when origfaces is initialized */
bool use_origfaces;
+ int cd_loop_mdisp_offset;
+
struct GHash *origverts; /* map {BMVert: TransDataGenericSlideVert} */
struct GHash *origfaces;
struct BMesh *bm_origfaces;
@@ -252,8 +258,8 @@ typedef struct EdgeSlideData {
float perc;
- bool is_proportional;
- bool flipped_vtx;
+ bool use_even;
+ bool flipped;
int curr_sv_index;
@@ -284,8 +290,8 @@ typedef struct VertSlideData {
float perc;
- bool is_proportional;
- bool flipped_vtx;
+ bool use_even;
+ bool flipped;
int curr_sv_index;
@@ -326,17 +332,37 @@ typedef struct TransData {
} TransData;
typedef struct MouseInput {
- void (*apply)(struct TransInfo *t, struct MouseInput *mi, const int mval[2], float output[3]);
+ void (*apply)(struct TransInfo *t, struct MouseInput *mi, const double mval[2], float output[3]);
void (*post)(struct TransInfo *t, float values[3]);
int imval[2]; /* initial mouse position */
bool precision;
- int precision_mval[2]; /* mouse position when precision key was pressed */
+ float precision_factor;
float center[2];
float factor;
void *data; /* additional data, if needed by the particular function */
+
+ /**
+ * Use virtual cursor, which takes precision into account
+ * keeping track of the cursors 'virtual' location,
+ * to avoid jumping values when its toggled.
+ *
+ * This works well for scaling drag motion,
+ * but not for rotating around a point (rotaton needs its own custom accumulator)
+ */
+ bool use_virtual_mval;
+ struct {
+ double prev[2];
+ double accum[2];
+ } virtual_mval;
} MouseInput;
+typedef struct TransCustomData {
+ void *data;
+ void (*free_cb)(struct TransInfo *, struct TransCustomData *);
+ unsigned int use_free : 1;
+} TransCustomData;
+
typedef struct TransInfo {
int mode; /* current mode */
int flag; /* generic flags for special behaviors */
@@ -344,7 +370,6 @@ typedef struct TransInfo {
short state; /* current state (running, canceled,...)*/
int options; /* current context/options for transform */
float val; /* init value for some transformations (and rotation angle) */
- float fac; /* factor for distance based transform */
void (*transform)(struct TransInfo *, const int[2]);
/* transform function pointer */
eRedrawFlag (*handleEvent)(struct TransInfo *, const struct wmEvent *);
@@ -365,8 +390,6 @@ typedef struct TransInfo {
float center[3]; /* center of transformation (in local-space) */
float center_global[3]; /* center of transformation (in global-space) */
float center2d[2]; /* center in screen coordinates */
- int imval[2]; /* initial mouse position */
- short event_type; /* event->type used to invoke transform */
short idx_max; /* maximum index on the input vector */
float snap[3]; /* Snapping Gears */
float snap_spatial[3]; /* Spatial snapping gears(even when rotating, scaling... etc) */
@@ -389,8 +412,22 @@ typedef struct TransInfo {
struct Object *poseobj; /* if t->flag & T_POSE, this denotes pose object */
- void *customData; /* Per Transform custom data */
- void (*customFree)(struct TransInfo *); /* if a special free function is needed */
+ /**
+ * Rule of thumb for choosing between mode/type:
+ * - If transform mode uses the data, assign to `mode`
+ * (typically in transform.c).
+ * - If conversion uses the data as an extension to the #TransData, assign to `type`
+ * (typically in transform_conversion.c).
+ */
+ struct {
+ /* owned by the mode (grab, scale, bend... )*/
+ union {
+ TransCustomData mode, first_elem;
+ };
+ /* owned by the type (mesh, armature, nla...) */
+ TransCustomData type;
+ } custom;
+#define TRANS_CUSTOM_DATA_ELEM_MAX (sizeof(((TransInfo *)NULL)->custom) / sizeof(TransCustomData))
/*************** NEW STUFF *********************/
short launch_event; /* event type used to launch transform */
@@ -465,7 +502,6 @@ typedef struct TransInfo {
#define T_2D_EDIT (1 << 15)
#define T_CLIP_UV (1 << 16)
-#define T_FREE_CUSTOMDATA (1 << 17)
/* auto-ik is on */
#define T_AUTOIK (1 << 18)
@@ -550,7 +586,7 @@ int transformEnd(struct bContext *C, TransInfo *t);
void setTransformViewMatrices(TransInfo *t);
void setTransformViewAspect(TransInfo *t, float r_aspect[3]);
-void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy);
+void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy);
void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DProjTest flag);
void projectIntView(TransInfo *t, const float vec[3], int adr[2]);
void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], const eV3DProjTest flag);
@@ -739,11 +775,11 @@ int getTransformOrientation_ex(const struct bContext *C, float normal[3], float
int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3]);
void freeEdgeSlideTempFaces(EdgeSlideData *sld);
-void freeEdgeSlideVerts(TransInfo *t);
+void freeEdgeSlideVerts(TransInfo *t, TransCustomData *custom_data);
void projectEdgeSlideData(TransInfo *t, bool is_final);
void freeVertSlideTempFaces(VertSlideData *sld);
-void freeVertSlideVerts(TransInfo *t);
+void freeVertSlideVerts(TransInfo *t, TransCustomData *custom_data);
void projectVertSlideData(TransInfo *t, bool is_final);