Fix #106998: selection of bones in grease pencil weightpaint mode fails

Caused by 2eeec49640.

Above commit would early out when falling through the specialized
greasepencil selection operator to view3d_select_exec. But in order to
select posebones in grease pencil weightpaint mode, we still have to
continue with view3d_select_exec.

Now check this special case [with convenient
`BKE_object_pose_armature_get_with_wpaint_check`] and DONT early out in
that case.

Should go into 3.3 LTS as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/107076
This commit is contained in:
Philipp Oeser
2023-04-19 09:13:21 +02:00
committed by Philipp Oeser
parent c10e8e4166
commit b0ec4d889a
@@ -3088,12 +3088,13 @@ static int view3d_select_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
Object *obact = CTX_data_active_object(C);
if (obact && obact->type == OB_GPENCIL_LEGACY && GPENCIL_ANY_MODE((bGPdata *)obact->data)) {
/* Prevent acting on Grease Pencil (when not in object mode), it implements its own selection
* operator in other modes. We might still fall trough to here (because that operator uses
* OPERATOR_PASS_THROUGH to make tweak work) but if we don't stop here code below assumes we
* are in object mode it might falsely toggle object selection. Alternatively, this could be
* put in the poll function instead. */
if (obact && obact->type == OB_GPENCIL_LEGACY && GPENCIL_ANY_MODE((bGPdata *)obact->data) &&
(BKE_object_pose_armature_get_with_wpaint_check(obact) == nullptr)) {
/* Prevent acting on Grease Pencil (when not in object mode -- or not in weight-paint + pose
* selection), it implements its own selection operator in other modes. We might still fall
* trough to here (because that operator uses OPERATOR_PASS_THROUGH to make tweak work) but if
* we don't stop here code below assumes we are in object mode it might falsely toggle object
* selection. Alternatively, this could be put in the poll function instead. */
return OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED;
}