[Bf-blender-cvs] [723e0a5] transform-manipulators: Don't draw helplines when using transform manipulators
Julian Eisel
noreply at git.blender.org
Thu Nov 10 23:08:14 CET 2016
Commit: 723e0a5e0174e934aa20c18adb07ab43af22d1fe
Author: Julian Eisel
Date: Thu Nov 10 22:57:52 2016 +0100
Branches: transform-manipulators
https://developer.blender.org/rB723e0a5e0174e934aa20c18adb07ab43af22d1fe
Don't draw helplines when using transform manipulators
Also removed unused transform flag.
===================================================================
M source/blender/editors/space_view3d/view3d_transform_manipulators.c
M source/blender/editors/transform/transform.c
M source/blender/editors/transform/transform.h
M source/blender/editors/transform/transform_constraints.c
M source/blender/editors/transform/transform_generics.c
M source/blender/editors/transform/transform_ops.c
===================================================================
diff --git a/source/blender/editors/space_view3d/view3d_transform_manipulators.c b/source/blender/editors/space_view3d/view3d_transform_manipulators.c
index 21c696a..b02769c 100644
--- a/source/blender/editors/space_view3d/view3d_transform_manipulators.c
+++ b/source/blender/editors/space_view3d/view3d_transform_manipulators.c
@@ -479,6 +479,7 @@ static void transform_axis_manipulator_init(TransformAxisManipulator *axis, wmMa
RNA_boolean_set_array(ptr, "constraint_axis", axis->constraint);
}
RNA_boolean_set(ptr, "release_confirm", 1);
+ RNA_boolean_set(ptr, "draw_helplines", 0);
}
static void transform_manipulatorgroup_init(const bContext *UNUSED(C), wmManipulatorGroup *mgroup)
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index febfa00..0bdc227 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1693,7 +1693,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
{
TransInfo *t = (TransInfo *)customdata;
- if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR)) {
+ if (t->helpline != HLP_NONE && (t->flag & T_DRAW_HELPLINES)) {
float vecrot[3], cent[2];
int mval[2];
@@ -3397,7 +3397,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
constraintTransLim(t, td);
}
-static void applyResize(TransInfo *t, const int mval[2])
+static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
{
TransData *td;
float mat[3][3];
@@ -3408,17 +3408,7 @@ static void applyResize(TransInfo *t, const int mval[2])
copy_v3_v3(t->values, t->auto_values);
}
else {
- float ratio;
-
- /* for manipulator, center handle, the scaling can't be done relative to center */
- if ((t->flag & T_USES_MANIPULATOR) && t->con.mode == 0) {
- ratio = 1.0f - ((t->mouse.imval[0] - mval[0]) + (t->mouse.imval[1] - mval[1])) / 100.0f;
- }
- else {
- ratio = t->values[0];
- }
-
- copy_v3_fl(t->values, ratio);
+ copy_v3_fl(t->values, t->values[0]);
snapGridIncrement(t, t->values);
@@ -5219,24 +5209,14 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3])
td->loc[1] = oldy;
}
-static void applyBoneSize(TransInfo *t, const int mval[2])
+static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2]))
{
TransData *td = t->data;
float size[3], mat[3][3];
- float ratio;
int i;
char str[UI_MAX_DRAW_STR];
- // TRANSFORM_FIX_ME MOVE TO MOUSE INPUT
- /* for manipulator, center handle, the scaling can't be done relative to center */
- if ((t->flag & T_USES_MANIPULATOR) && t->con.mode == 0) {
- ratio = 1.0f - ((t->mouse.imval[0] - mval[0]) + (t->mouse.imval[1] - mval[1])) / 100.0f;
- }
- else {
- ratio = t->values[0];
- }
-
- copy_v3_fl(size, ratio);
+ copy_v3_fl(size, t->values[0]);
snapGridIncrement(t, size);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 65cb427..d3ae852 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -493,8 +493,8 @@ typedef struct TransInfo {
#define T_CAMERA (1 << 4)
// trans on points, having no rotation/scale
#define T_POINTS (1 << 6)
- // for manipulator exceptions, like scaling using center point, drawing help lines
-#define T_USES_MANIPULATOR (1 << 7)
+ /* Draw helplines (includes constraint lines) */
+#define T_DRAW_HELPLINES (1 << 7)
/* restrictions flags */
#define T_ALL_RESTRICTIONS ((1 << 8)|(1 << 9)|(1 << 10))
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 20615e0..c4fa845 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -704,7 +704,7 @@ void drawConstraint(TransInfo *t)
return;
if (!(tc->mode & CON_APPLY))
return;
- if (t->flag & T_USES_MANIPULATOR)
+ if (!(t->flag & T_DRAW_HELPLINES))
return;
if (t->flag & T_NO_CONSTRAINT)
return;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index e0a3804..a7e0ffe 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1414,7 +1414,13 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
else { /* add not pet option to context when not available */
t->options |= CTX_NO_PET;
}
-
+
+ if (op && (prop = RNA_struct_find_property(op->ptr, "draw_helplines"))) {
+ if (RNA_property_boolean_get(op->ptr, prop)) {
+ t->flag |= T_DRAW_HELPLINES;
+ }
+ }
+
// Mirror is not supported with PET, turn it off.
#if 0
if (t->flag & T_PROP_EDIT) {
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 1c0ddd5..fed1b2f 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -570,6 +570,9 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
/*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
//RNA_def_property_flag(prop, PROP_HIDDEN);
}
+
+ prop = RNA_def_boolean(ot->srna, "draw_helplines", 1, "Draw Helplines", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN);
}
static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
More information about the Bf-blender-cvs
mailing list