Fix: UI: Transform Feedback for Invalid Trackball
Patch #132957 added helpful UI feedback when attempting to rotate or scale an object whose transforms are set to "only affect locations." But it neglected to check for invalid trackpad rotations that are affected the same way. This patch renames the original `HLP_ERROR` to `HLP_ERROR_DASH` to distinguish it from a `HLP_ERROR` transform cursor with no dashed line present, which matches trackball's normal state. Pull Request: https://projects.blender.org/blender/blender/pulls/134653
This commit is contained in:
committed by
Harley Acheson
parent
ead7a881a5
commit
f874d46589
@@ -257,6 +257,7 @@ enum eTHelpline {
|
|||||||
HLP_CARROW = 5,
|
HLP_CARROW = 5,
|
||||||
HLP_TRACKBALL = 6,
|
HLP_TRACKBALL = 6,
|
||||||
HLP_ERROR = 7,
|
HLP_ERROR = 7,
|
||||||
|
HLP_ERROR_DASH = 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eTOType {
|
enum eTOType {
|
||||||
@@ -959,6 +960,7 @@ enum MouseInputMode {
|
|||||||
INPUT_CUSTOM_RATIO,
|
INPUT_CUSTOM_RATIO,
|
||||||
INPUT_CUSTOM_RATIO_FLIP,
|
INPUT_CUSTOM_RATIO_FLIP,
|
||||||
INPUT_ERROR,
|
INPUT_ERROR,
|
||||||
|
INPUT_ERROR_DASH,
|
||||||
};
|
};
|
||||||
|
|
||||||
void initMouseInput(TransInfo *t,
|
void initMouseInput(TransInfo *t,
|
||||||
|
|||||||
@@ -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);
|
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||||
|
|
||||||
/* Dashed lines first. */
|
/* Dashed lines first. */
|
||||||
if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE, HLP_ERROR)) {
|
if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE, HLP_ERROR_DASH)) {
|
||||||
GPU_line_width(DASH_WIDTH);
|
GPU_line_width(DASH_WIDTH);
|
||||||
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
|
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
|
||||||
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
|
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
|
||||||
@@ -250,6 +250,7 @@ void transform_draw_cursor_draw(bContext *C, int x, int y, void *customdata)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HLP_ERROR:
|
case HLP_ERROR:
|
||||||
|
case HLP_ERROR_DASH:
|
||||||
case HLP_NONE:
|
case HLP_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -430,6 +430,10 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
|
|||||||
mi->apply = nullptr;
|
mi->apply = nullptr;
|
||||||
t->helpline = HLP_ERROR;
|
t->helpline = HLP_ERROR;
|
||||||
break;
|
break;
|
||||||
|
case INPUT_ERROR_DASH:
|
||||||
|
mi->apply = nullptr;
|
||||||
|
t->helpline = HLP_ERROR_DASH;
|
||||||
|
break;
|
||||||
case INPUT_NONE:
|
case INPUT_NONE:
|
||||||
default:
|
default:
|
||||||
mi->apply = nullptr;
|
mi->apply = nullptr;
|
||||||
@@ -472,6 +476,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HLP_ERROR:
|
case HLP_ERROR:
|
||||||
|
case HLP_ERROR_DASH:
|
||||||
t->flag |= T_MODAL_CURSOR_SET;
|
t->flag |= T_MODAL_CURSOR_SET;
|
||||||
WM_cursor_modal_set(win, WM_CURSOR_STOP);
|
WM_cursor_modal_set(win, WM_CURSOR_STOP);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ bool transform_mode_is_changeable(const int mode)
|
|||||||
TFM_NORMAL_ROTATION);
|
TFM_NORMAL_ROTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool transform_mode_affect_only_locations(const TransInfo *t)
|
||||||
|
{
|
||||||
|
return (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);
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Transform Locks
|
/** \name Transform Locks
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ bool transdata_check_local_center(const TransInfo *t, short around);
|
|||||||
* Informs if the mode can be switched during modal.
|
* Informs if the mode can be switched during modal.
|
||||||
*/
|
*/
|
||||||
bool transform_mode_is_changeable(int mode);
|
bool transform_mode_is_changeable(int mode);
|
||||||
|
bool transform_mode_affect_only_locations(const TransInfo *t);
|
||||||
void protectedTransBits(short protectflag, float vec[3]);
|
void protectedTransBits(short protectflag, float vec[3]);
|
||||||
void protectedSizeBits(short protectflag, float size[3]);
|
void protectedSizeBits(short protectflag, float size[3]);
|
||||||
void constraintTransLim(const TransInfo *t, const TransDataContainer *tc, TransData *td);
|
void constraintTransLim(const TransInfo *t, const TransDataContainer *tc, TransData *td);
|
||||||
|
|||||||
@@ -312,17 +312,14 @@ static void initResize(TransInfo *t, wmOperator *op)
|
|||||||
zero_v3(mouse_dir_constraint);
|
zero_v3(mouse_dir_constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool only_location = (t->flag & T_V3D_ALIGN) && (t->options & CTX_OBJECT) &&
|
const bool only_location = transform_mode_affect_only_locations(t);
|
||||||
(t->settings->transform_pivot_point != V3D_AROUND_CURSOR) &&
|
|
||||||
t->context &&
|
|
||||||
(CTX_DATA_COUNT(t->context, selected_editable_objects) == 1);
|
|
||||||
if (only_location) {
|
if (only_location) {
|
||||||
WorkspaceStatus status(t->context);
|
WorkspaceStatus status(t->context);
|
||||||
status.item(TIP_("Transform is set to only affect location"), ICON_ERROR);
|
status.item(TIP_("Transform is set to only affect location"), ICON_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_zero_v3(mouse_dir_constraint)) {
|
if (is_zero_v3(mouse_dir_constraint)) {
|
||||||
initMouseInputMode(t, &t->mouse, only_location ? INPUT_ERROR : INPUT_SPRING_FLIP);
|
initMouseInputMode(t, &t->mouse, only_location ? INPUT_ERROR_DASH : INPUT_SPRING_FLIP);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int mval_start[2], mval_end[2];
|
int mval_start[2], mval_end[2];
|
||||||
@@ -350,7 +347,7 @@ static void initResize(TransInfo *t, wmOperator *op)
|
|||||||
|
|
||||||
setCustomPoints(t, &t->mouse, mval_end, mval_start);
|
setCustomPoints(t, &t->mouse, mval_end, mval_start);
|
||||||
|
|
||||||
initMouseInputMode(t, &t->mouse, only_location ? INPUT_ERROR : INPUT_CUSTOM_RATIO);
|
initMouseInputMode(t, &t->mouse, only_location ? INPUT_ERROR_DASH : INPUT_CUSTOM_RATIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
t->num.val_flag[0] |= NUM_NULL_ONE;
|
t->num.val_flag[0] |= NUM_NULL_ONE;
|
||||||
|
|||||||
@@ -411,14 +411,10 @@ static void initRotation(TransInfo *t, wmOperator * /*op*/)
|
|||||||
|
|
||||||
t->mode = TFM_ROTATION;
|
t->mode = TFM_ROTATION;
|
||||||
|
|
||||||
const bool only_location = (t->flag & T_V3D_ALIGN) && (t->options & CTX_OBJECT) &&
|
if (transform_mode_affect_only_locations(t)) {
|
||||||
(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);
|
WorkspaceStatus status(t->context);
|
||||||
status.item(TIP_("Transform is set to only affect location"), ICON_ERROR);
|
status.item(TIP_("Transform is set to only affect location"), ICON_ERROR);
|
||||||
initMouseInputMode(t, &t->mouse, INPUT_ERROR);
|
initMouseInputMode(t, &t->mouse, INPUT_ERROR_DASH);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
|
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
|
||||||
|
|||||||
@@ -191,7 +191,14 @@ static void initTrackball(TransInfo *t, wmOperator * /*op*/)
|
|||||||
{
|
{
|
||||||
t->mode = TFM_TRACKBALL;
|
t->mode = TFM_TRACKBALL;
|
||||||
|
|
||||||
initMouseInputMode(t, &t->mouse, INPUT_TRACKBALL);
|
if (transform_mode_affect_only_locations(t)) {
|
||||||
|
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_TRACKBALL);
|
||||||
|
}
|
||||||
|
|
||||||
t->idx_max = 1;
|
t->idx_max = 1;
|
||||||
t->num.idx_max = 1;
|
t->num.idx_max = 1;
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
|||||||
/* XXX insert keys are called here, and require context. */
|
/* XXX insert keys are called here, and require context. */
|
||||||
t->context = C;
|
t->context = C;
|
||||||
|
|
||||||
if ((t->helpline != HLP_ERROR)) {
|
if (t->helpline != HLP_ERROR && t->helpline != HLP_ERROR_DASH) {
|
||||||
ED_workspace_status_text(t->context, nullptr);
|
ED_workspace_status_text(t->context, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user