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

Merged
Philipp Oeser merged 1 commits from lichtwerk/blender:106998 into main 2023-04-19 09:13:34 +02:00
1 changed files with 7 additions and 6 deletions

View File

@ -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;
}