diff --git a/source/blender/editors/transform/transform.hh b/source/blender/editors/transform/transform.hh index 70cac4e91f8..d08c71e2d3c 100644 --- a/source/blender/editors/transform/transform.hh +++ b/source/blender/editors/transform/transform.hh @@ -256,6 +256,7 @@ enum eTHelpline { HLP_VARROW = 4, HLP_CARROW = 5, HLP_TRACKBALL = 6, + HLP_ERROR = 7, }; enum eTOType { @@ -957,6 +958,7 @@ enum MouseInputMode { INPUT_VERTICAL_ABSOLUTE, INPUT_CUSTOM_RATIO, INPUT_CUSTOM_RATIO_FLIP, + INPUT_ERROR, }; void initMouseInput(TransInfo *t, diff --git a/source/blender/editors/transform/transform_draw_cursors.cc b/source/blender/editors/transform/transform_draw_cursors.cc index adb05d54325..85727726b69 100644 --- a/source/blender/editors/transform/transform_draw_cursors.cc +++ b/source/blender/editors/transform/transform_draw_cursors.cc @@ -128,7 +128,7 @@ void transform_draw_cursor_draw(bContext *C, int x, int y, void *customdata) immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); /* Dashed lines first. */ - if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE)) { + if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE, HLP_ERROR)) { GPU_line_width(DASH_WIDTH); immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); @@ -249,6 +249,7 @@ void transform_draw_cursor_draw(bContext *C, int x, int y, void *customdata) drawArrow(pos_id, DOWN); break; } + case HLP_ERROR: case HLP_NONE: break; } diff --git a/source/blender/editors/transform/transform_input.cc b/source/blender/editors/transform/transform_input.cc index e3efbd1efa1..7360ec25b7b 100644 --- a/source/blender/editors/transform/transform_input.cc +++ b/source/blender/editors/transform/transform_input.cc @@ -426,6 +426,10 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) mi->apply = InputCustomRatioFlip; t->helpline = HLP_CARROW; break; + case INPUT_ERROR: + mi->apply = nullptr; + t->helpline = HLP_ERROR; + break; case INPUT_NONE: default: mi->apply = nullptr; @@ -467,6 +471,10 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) WM_cursor_modal_set(win, WM_CURSOR_NONE); } break; + case HLP_ERROR: + t->flag |= T_MODAL_CURSOR_SET; + WM_cursor_modal_set(win, WM_CURSOR_STOP); + break; default: break; } diff --git a/source/blender/editors/transform/transform_mode_resize.cc b/source/blender/editors/transform/transform_mode_resize.cc index 9dabe919fd1..626a19ef071 100644 --- a/source/blender/editors/transform/transform_mode_resize.cc +++ b/source/blender/editors/transform/transform_mode_resize.cc @@ -14,9 +14,13 @@ #include "BLI_math_vector.h" #include "BLI_task.h" +#include "BKE_context.hh" + #include "BKE_image.hh" #include "BKE_unit.hh" +#include "BLT_translation.hh" + #include "ED_screen.hh" #include "RNA_access.hh" @@ -311,8 +315,17 @@ static void initResize(TransInfo *t, wmOperator *op) zero_v3(mouse_dir_constraint); } + const bool only_location = (t->flag & T_V3D_ALIGN) && (t->options & CTX_OBJECT) && + (t->settings->transform_pivot_point != V3D_AROUND_CURSOR) && + t->context && + (CTX_DATA_COUNT(t->context, selected_editable_objects) == 1); + if (only_location) { + WorkspaceStatus status(t->context); + status.item(TIP_("Transform is set to only affect location"), ICON_ERROR); + } + if (is_zero_v3(mouse_dir_constraint)) { - initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP); + initMouseInputMode(t, &t->mouse, only_location ? INPUT_ERROR : INPUT_SPRING_FLIP); } else { int mval_start[2], mval_end[2]; @@ -340,7 +353,7 @@ static void initResize(TransInfo *t, wmOperator *op) setCustomPoints(t, &t->mouse, mval_end, mval_start); - initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO); + initMouseInputMode(t, &t->mouse, only_location ? INPUT_ERROR : INPUT_CUSTOM_RATIO); } t->num.val_flag[0] |= NUM_NULL_ONE; diff --git a/source/blender/editors/transform/transform_mode_rotate.cc b/source/blender/editors/transform/transform_mode_rotate.cc index 33197572de9..b359730319e 100644 --- a/source/blender/editors/transform/transform_mode_rotate.cc +++ b/source/blender/editors/transform/transform_mode_rotate.cc @@ -13,9 +13,12 @@ #include "BLI_math_vector.h" #include "BLI_task.h" +#include "BKE_context.hh" #include "BKE_report.hh" #include "BKE_unit.hh" +#include "BLT_translation.hh" + #include "ED_screen.hh" #include "UI_interface.hh" @@ -408,7 +411,18 @@ static void initRotation(TransInfo *t, wmOperator * /*op*/) t->mode = TFM_ROTATION; - initMouseInputMode(t, &t->mouse, INPUT_ANGLE); + const bool only_location = (t->flag & T_V3D_ALIGN) && (t->options & CTX_OBJECT) && + (t->settings->transform_pivot_point != V3D_AROUND_CURSOR) && + t->context && + (CTX_DATA_COUNT(t->context, selected_editable_objects) == 1); + if (only_location) { + WorkspaceStatus status(t->context); + status.item(TIP_("Transform is set to only affect location"), ICON_ERROR); + initMouseInputMode(t, &t->mouse, INPUT_ERROR); + } + else { + initMouseInputMode(t, &t->mouse, INPUT_ANGLE); + } t->idx_max = 0; t->num.idx_max = 0; diff --git a/source/blender/editors/transform/transform_ops.cc b/source/blender/editors/transform/transform_ops.cc index 13438cc3e6e..bb6dbb11e1a 100644 --- a/source/blender/editors/transform/transform_ops.cc +++ b/source/blender/editors/transform/transform_ops.cc @@ -419,6 +419,11 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event) /* XXX insert keys are called here, and require context. */ t->context = C; + + if ((t->helpline != HLP_ERROR)) { + ED_workspace_status_text(t->context, nullptr); + } + exit_code = transformEvent(t, op, event); t->context = nullptr;