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>2017-08-27 17:48:43 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-08-27 17:56:08 +0300
commitddff9d0ea68b4c92be2fc515a4ec6a17b3696aa0 (patch)
tree0bf133537dac8f69339905ee364db47fa992a3e1 /source/blender/editors/manipulator_library
parentca9801bd427ce2e76a992b62d476859efcc14547 (diff)
Manipulator: support operator per-part
A single manipulator could only assign a single operator to each part. Now each part can have it's own. Also modify 2D selection callback, 2D started at 1, 3D at 0. Now use -1 for unset value, start both at 0.
Diffstat (limited to 'source/blender/editors/manipulator_library')
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c10
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c14
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c6
3 files changed, 17 insertions, 13 deletions
diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
index 67583d28668..c789e6a13b0 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
@@ -173,16 +173,20 @@ static int manipulator_arrow2d_test_select(
const float lambda_1 = line_point_factor_v2(isect_1, line_ext[0], line_ext[1]);
if (isect == 1) {
- return IN_RANGE_INCL(lambda_1, 0.0f, 1.0f);
+ if (IN_RANGE_INCL(lambda_1, 0.0f, 1.0f)) {
+ return 0;
+ }
}
else {
BLI_assert(isect == 2);
const float lambda_2 = line_point_factor_v2(isect_2, line_ext[0], line_ext[1]);
- return IN_RANGE_INCL(lambda_1, 0.0f, 1.0f) && IN_RANGE_INCL(lambda_2, 0.0f, 1.0f);
+ if (IN_RANGE_INCL(lambda_1, 0.0f, 1.0f) && IN_RANGE_INCL(lambda_2, 0.0f, 1.0f)) {
+ return 0;
+ }
}
}
- return 0;
+ return -1;
}
/* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
index 311c8acde9e..c6638511033 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
@@ -63,11 +63,11 @@
/* wmManipulator->highlight_part */
enum {
- ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE = 1,
- ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT = 2,
- ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT = 3,
- ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP = 4,
- ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN = 5,
+ ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE = 0,
+ ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT = 1,
+ ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT = 2,
+ ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP = 3,
+ ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN = 4,
};
#define MANIPULATOR_RECT_MIN_WIDTH 15.0f
@@ -367,7 +367,7 @@ static int manipulator_rect_transform_test_select(
if (manipulator_window_project_2d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false)
{
- return 0;
+ return -1;
}
const int transform_flag = RNA_enum_get(mpr->ptr, "transform");
@@ -438,7 +438,7 @@ static int manipulator_rect_transform_test_select(
return ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP;
}
- return 0;
+ return -1;
}
typedef struct RectTransformInteraction {
diff --git a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
index a5deb47a753..37ad31db642 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
@@ -316,14 +316,14 @@ static int manipulator_grab_test_select(
if (manipulator_window_project_2d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false)
{
- return 0;
+ return -1;
}
if (len_squared_v2(point_local) < SQUARE(mpr->scale_final)) {
- return true;
+ return 0;
}
- return 0;
+ return -1;
}
static void manipulator_grab_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop)