Merge branch 'blender-v4.4-release'

This commit is contained in:
Harley Acheson
2025-02-28 12:38:10 -08:00
9 changed files with 31 additions and 15 deletions

View File

@@ -260,6 +260,7 @@ enum eTHelpline {
HLP_CARROW = 5,
HLP_TRACKBALL = 6,
HLP_ERROR = 7,
HLP_ERROR_DASH = 8,
};
enum eTOType {
@@ -962,6 +963,7 @@ enum MouseInputMode {
INPUT_CUSTOM_RATIO,
INPUT_CUSTOM_RATIO_FLIP,
INPUT_ERROR,
INPUT_ERROR_DASH,
};
void initMouseInput(

View File

@@ -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, HLP_ERROR)) {
if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE, HLP_ERROR_DASH)) {
GPU_line_width(DASH_WIDTH);
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
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;
}
case HLP_ERROR:
case HLP_ERROR_DASH:
case HLP_NONE:
break;
}

View File

@@ -430,6 +430,10 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
mi->apply = nullptr;
t->helpline = HLP_ERROR;
break;
case INPUT_ERROR_DASH:
mi->apply = nullptr;
t->helpline = HLP_ERROR_DASH;
break;
case INPUT_NONE:
default:
mi->apply = nullptr;
@@ -472,6 +476,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
}
break;
case HLP_ERROR:
case HLP_ERROR_DASH:
t->flag |= T_MODAL_CURSOR_SET;
WM_cursor_modal_set(win, WM_CURSOR_STOP);
break;

View File

@@ -81,6 +81,13 @@ bool transform_mode_is_changeable(const int mode)
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
* \{ */

View File

@@ -70,6 +70,7 @@ bool transdata_check_local_center(const TransInfo *t, short around);
* Informs if the mode can be switched during modal.
*/
bool transform_mode_is_changeable(int mode);
bool transform_mode_affect_only_locations(const TransInfo *t);
void protectedTransBits(short protectflag, float vec[3]);
void protectedSizeBits(short protectflag, float size[3]);
void constraintTransLim(const TransInfo *t, const TransDataContainer *tc, TransData *td);

View File

@@ -312,17 +312,14 @@ 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);
const bool only_location = transform_mode_affect_only_locations(t);
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, only_location ? INPUT_ERROR : INPUT_SPRING_FLIP);
initMouseInputMode(t, &t->mouse, only_location ? INPUT_ERROR_DASH : INPUT_SPRING_FLIP);
}
else {
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);
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;

View File

@@ -413,14 +413,10 @@ static void initRotation(TransInfo *t, wmOperator * /*op*/)
t->mode = TFM_ROTATION;
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) {
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);
initMouseInputMode(t, &t->mouse, INPUT_ERROR_DASH);
}
else {
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);

View File

@@ -193,7 +193,14 @@ static void initTrackball(TransInfo *t, wmOperator * /*op*/)
{
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->num.idx_max = 1;

View File

@@ -440,7 +440,7 @@ 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) {
if (t->helpline != HLP_ERROR && t->helpline != HLP_ERROR_DASH) {
ED_workspace_status_text(t->context, nullptr);
}