Merge branch 'blender-v5.2-release'

This commit is contained in:
Pablo Vazquez 2026-06-18 11:41:49 +02:00
commit b921240158
6 changed files with 68 additions and 19 deletions

View file

@ -231,7 +231,7 @@ const bTheme U_theme_default = {
},
.link = RGBA(0x6FA9E6ff),
.wcol_state = {
.error = RGBA(0xb30000ff),
.error = RGBA(0x991616ff),
.warning = RGBA(0xac8737ff),
.info = RGBA(0x28487dff),
.success = RGBA(0x188625ff),

View file

@ -347,7 +347,7 @@
</wcol_list_item>
<wcol_state>
<ThemeWidgetStateColors
error="#D40000ff"
error="#991616ff"
warning="#ac8737ff"
info="#28487dff"
success="#188625ff"

View file

@ -95,7 +95,7 @@ def playback_controls(layout, context):
row.operator("screen.animation_play", text="", icon='PLAY')
else:
row.scale_x = 2
row.operator("screen.animation_play", text="", icon='PAUSE')
row.operator("screen.animation_pause", text="", icon='PAUSE')
row.scale_x = 1
row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True

View file

@ -3148,20 +3148,13 @@ static void widget_state(WidgetType *wt, const WidgetStateInfo *state, EmbossTyp
if (state->but_flag & BUT_REDALERT) {
if (wt->draw && emboss != EmbossType::None) {
uchar red[4];
theme::get_color_3ubv(TH_REDALERT, red);
/* Outline uses a mix to emphasize it a bit. */
color_blend_v3_v3(wt->wcol.outline, red, 0.6f);
/* Darken the alert for the inner color. */
color_mul_hsl_v3(red, 1.0f, 1.0f, 0.6f);
copy_v3_v3_uchar(wt->wcol.inner, red);
theme::get_color_3ubv(TH_REDALERT, wt->wcol.inner);
}
else {
uchar red[4];
theme::get_color_3ubv(TH_REDALERT, red);
color_mul_hsl_v3(red, 1.0f, 1.5f, 1.5f);
color_blend_v3_v3(wt->wcol.text, red, 0.6f);
color_blend_v3_v3(wt->wcol.text, red, 0.5f);
}
}
@ -5016,7 +5009,7 @@ static void widget_state_label(WidgetType *wt, const WidgetStateInfo *state, Emb
uchar red[4];
theme::get_color_3ubv(TH_REDALERT, red);
color_mul_hsl_v3(red, 1.0f, 1.5f, 1.5f);
color_blend_v3_v3(wt->wcol.text, red, 0.6f);
color_blend_v3_v3(wt->wcol.text, red, 0.5f);
}
}

View file

@ -6782,6 +6782,11 @@ static void stop_playback(bContext *C)
ED_scene_fps_average_clear(scene);
BKE_callback_exec_id_depsgraph(bmain, &scene->id, depsgraph, BKE_CB_EVT_ANIMATION_PLAYBACK_POST);
/* Send a fake mouse-move event so that the active button (the one the mouse hovers over) is
* updated for the change in playback buttons (Pause button disappearing, Reverse/Normal playback
* buttons appearing). */
WM_event_add_mousemove(CTX_wm_window(C));
/* Triggers redraw of sequencer preview so that it does not show to fps anymore after stopping
* playback. */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_SEQUENCER, scene);
@ -6841,6 +6846,11 @@ static wmOperatorStatus start_playback(bContext *C, int sync, int mode)
sad->region = CTX_wm_region(C);
}
/* Send a fake mouse-move event so that the active button (the one the mouse hovers over) is
* updated for the change in playback buttons (Pause button appearing, Reverse/Normal playback
* buttons disappearing). */
WM_event_add_mousemove(CTX_wm_window(C));
return OPERATOR_FINISHED;
}
@ -6899,6 +6909,49 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Animation Pause Operator
*
* This operator exists because of a UI quirk in Blender. The active button under the mouse is
* stored & restored between redraws, so that the correct button is kept highlighted (among other
* things). This storing & restoring is done based on the operator's idname.
*
* Since during playback the "Pause" button takes the place of the "Reverse Playback" and "Normal
* Playback" buttons, and historically these were all three the same operator, Blender would get
* confused. Under certain conditions it would activate the "Normal Playback" button when the mouse
* was over the "Reverse Playback" button. This is resolved by making the 'Pause' button its own
* operator with its own idname.
*
* Additionally, a fake mouse event is sent to force Blender to reevaluate which button is being
* hovered. This only works when there's a difference in the hovered operator's idname though.
* \{ */
static wmOperatorStatus screen_animation_pause_exec(bContext *C, wmOperator * /*op*/)
{
bScreen *screen = ED_screen_animation_playing(CTX_wm_manager(C));
if (!screen) {
return OPERATOR_CANCELLED;
}
stop_playback(C);
return OPERATOR_FINISHED;
}
static void SCREEN_OT_animation_pause(wmOperatorType *ot)
{
/* Identifiers. */
ot->name = "Pause Animation";
ot->description = "Pause animation, stopping at the current frame";
ot->idname = "SCREEN_OT_animation_pause";
/* API callbacks. */
ot->exec = screen_animation_pause_exec;
ot->poll = ED_operator_screenactive;
ot->flag = OPTYPE_UNDO_GROUPED;
ot->undo_group = "Frame Change";
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Animation Cancel Operator
* \{ */
@ -7746,6 +7799,7 @@ void ED_operatortypes_screen()
WM_operatortype_append(SCREEN_OT_animation_step);
WM_operatortype_append(SCREEN_OT_animation_play);
WM_operatortype_append(SCREEN_OT_animation_pause);
WM_operatortype_append(SCREEN_OT_animation_cancel);
/* New/delete. */

View file

@ -1145,14 +1145,16 @@ static void wm_drop_redalert_draw(const StringRef redalert_str, int x, int y)
const bTheme *btheme = ui::theme::theme_get();
const uiWidgetColors *wcol = &btheme->tui.wcol_tooltip;
float col_fg[4], col_bg[4];
float col_fg[4], col_bg[4], col_alert[4];
rgba_uchar_to_float(col_bg, wcol->inner);
rgba_uchar_to_float(col_fg, wcol->text);
ui::theme::get_color_4fv(TH_REDALERT, col_alert);
ui::theme::get_color_4fv(TH_REDALERT, col_fg);
/* Lighten the alert color a bit for the text. */
col_fg[0] = std::min(col_fg[0] + 0.2f, 1.0f);
col_fg[1] = std::min(col_fg[1] + 0.2f, 1.0f);
col_fg[2] = std::min(col_fg[2] + 0.2f, 1.0f);
/* Blend between the original text color and alert.
* This ensures the text be always readable, lighter or darker depending on the theme. */
col_fg[0] = (1.0f - 0.66f) * col_fg[0] + (0.66f * col_alert[0]);
col_fg[1] = (1.0f - 0.66f) * col_fg[1] + (0.66f * col_alert[1]);
col_fg[2] = (1.0f - 0.66f) * col_fg[2] + (0.66f * col_alert[2]);
ui::fontstyle_draw_simple_backdrop(fstyle, x, y, redalert_str, col_fg, col_bg);
}