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:
authorCampbell Barton <ideasman42@gmail.com>2015-10-30 09:31:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-10-30 10:24:02 +0300
commite6abc3ad5751a272930841757e588bc25ce0bde7 (patch)
tree307cfecbbe3604050b65dbd5ff0e4ace345672eb /source/blender/editors/transform/transform.h
parentd2af1401510200bcc5d1841d5ef186e7cb545133 (diff)
Transform: Support storing virtual cursor location
Grabbing now doesn't 'jump' when shift is released (matching rotation modes). This simplifies most logic for transform input, where mouse input callbacks can choose to use the 'virtual' cursor, which accounts for precision when shift is held.
Diffstat (limited to 'source/blender/editors/transform/transform.h')
-rw-r--r--source/blender/editors/transform/transform.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index d4e1b3fc71c..bd5d043e3bb 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -326,15 +326,29 @@ 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 precission 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 TransInfo {
@@ -549,7 +563,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);