Fix #137825: Grease Pencil: Orbit around selection fails in paint mode

Wrong origin was calculated when inside paint mode. Use
`BKE_paint_stroke_get_average` for correct pivot point in grease pencil
modes.

Pull Request: https://projects.blender.org/blender/blender/pulls/137831
This commit is contained in:
Pratik Borhade
2025-04-22 11:20:52 +02:00
committed by Falk David
parent b69a4380b6
commit bf7c53bd57

View File

@@ -822,7 +822,13 @@ bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
BKE_paint_stroke_get_average(scene, ob_act_eval, lastofs);
is_set = true;
}
else if (ob_act && (ob_act->mode & OB_MODE_SCULPT_CURVES)) {
else if (ob_act && ELEM(ob_act->mode,
OB_MODE_SCULPT_CURVES,
OB_MODE_PAINT_GREASE_PENCIL,
OB_MODE_SCULPT_GREASE_PENCIL,
OB_MODE_VERTEX_GREASE_PENCIL,
OB_MODE_WEIGHT_GREASE_PENCIL))
{
BKE_paint_stroke_get_average(scene, ob_act_eval, lastofs);
is_set = true;
}