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>2018-09-13 17:06:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-13 17:10:59 +0300
commit1e3d6ae09b89cb6ab6c357d506af7d0c635aa50e (patch)
tree1eac9c8eb3805c798378ef036105c0fb330fb675 /source/blender/editors/gizmo_library
parent3e6f37b936cc6f8e95bd66b68c7c2be822e1db7a (diff)
Gizmo: only use mousemove for generic gizmos
This caused slow performance for spin/bisect for eg.
Diffstat (limited to 'source/blender/editors/gizmo_library')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c3
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c3
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c3
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c4
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c11
5 files changed, 22 insertions, 2 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
index eff05a74ea5..97f45bd53fd 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
@@ -234,6 +234,9 @@ static int gizmo_arrow_modal(
bContext *C, wmGizmo *gz, const wmEvent *event,
eWM_GizmoFlagTweak tweak_flag)
{
+ if (event->type != MOUSEMOVE) {
+ return OPERATOR_RUNNING_MODAL;
+ }
ArrowGizmo3D *arrow = (ArrowGizmo3D *)gz;
GizmoInteraction *inter = gz->interaction_data;
View3D *v3d = CTX_wm_view3d(C);
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index 00902588408..1cff5b82484 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@ -849,6 +849,9 @@ static int gizmo_cage2d_modal(
bContext *C, wmGizmo *gz, const wmEvent *event,
eWM_GizmoFlagTweak UNUSED(tweak_flag))
{
+ if (event->type != MOUSEMOVE) {
+ return OPERATOR_RUNNING_MODAL;
+ }
/* For transform logic to be managable we operate in -0.5..0.5 2D space,
* no matter the size of the rectangle, mouse coorts are scaled to unit space.
* The mouse coords have been projected into the matrix so we don't need to worry about axis alignment.
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
index ae9a57205df..3b74311b800 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
@@ -477,6 +477,9 @@ static int gizmo_cage3d_modal(
bContext *C, wmGizmo *gz, const wmEvent *event,
eWM_GizmoFlagTweak UNUSED(tweak_flag))
{
+ if (event->type != MOUSEMOVE) {
+ return OPERATOR_RUNNING_MODAL;
+ }
/* For transform logic to be managable we operate in -0.5..0.5 2D space,
* no matter the size of the rectangle, mouse coorts are scaled to unit space.
* The mouse coords have been projected into the matrix so we don't need to worry about axis alignment.
diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
index 2432e2da3d2..f6108134cd9 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
@@ -396,6 +396,10 @@ static int gizmo_dial_modal(
bContext *C, wmGizmo *gz, const wmEvent *event,
eWM_GizmoFlagTweak UNUSED(tweak_flag))
{
+ if (event->type != MOUSEMOVE) {
+ return OPERATOR_RUNNING_MODAL;
+ }
+
const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f}; /* coordinate at which the arc drawing will be started */
float angle_ofs, angle_delta;
diff --git a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
index c6090250db7..0f83e9a3514 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
@@ -65,6 +65,7 @@ typedef struct ValueInteraction {
} init;
struct {
float prop_value;
+ eWM_GizmoFlagTweak tweak_flag;
} prev;
float range[2];
} ValueInteraction;
@@ -78,8 +79,11 @@ static int gizmo_value_modal(
bContext *C, wmGizmo *gz, const wmEvent *event,
eWM_GizmoFlagTweak tweak_flag)
{
- ARegion *ar = CTX_wm_region(C);
ValueInteraction *inter = gz->interaction_data;
+ if ((event->type != MOUSEMOVE) && (inter->prev.tweak_flag == tweak_flag)) {
+ return OPERATOR_RUNNING_MODAL;
+ }
+ ARegion *ar = CTX_wm_region(C);
const float value_scale = 4.0f; /* Could be option. */
const float value_range = inter->range[1] - inter->range[0];
float value_delta = (
@@ -108,8 +112,11 @@ static int gizmo_value_modal(
SNPRINTF(str, "%.4f", value_final);
ED_area_status_text(sa, str);
}
- inter->prev.prop_value = value_final;
}
+
+ inter->prev.prop_value = value_final;
+ inter->prev.tweak_flag = tweak_flag;
+
return OPERATOR_RUNNING_MODAL;
}