Fix #155723: Pasting pose not working with packed assets

When using a rig, that was imported from the asset browser using the
"Packed" method, pasting a pose would fail.
In that case copying the pose would store the objects of all custom
bone shapes too. That means during pasting `BLI_listbase_is_single`
is no longer true. The fix is to iterate all objects and check the
`ID_FLAG_CLIPBOARD_MARK` flag. This will only be set on the one object
that was actually directly copied, and not on its dependencies.

Co-authored-by: blender <blender@MacBook-Pro-von-Thomas.local>
Pull Request: https://projects.blender.org/blender/blender/pulls/155752
This commit is contained in:
Christoph Lendenfeld 2026-03-17 13:19:15 +01:00 • committed by Christoph Lendenfeld
parent bcdf4fbde3
commit dab88d61eb

View file

@ -878,13 +878,22 @@ static wmOperatorStatus pose_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
/* Make sure data from this file is usable for pose paste. */
if (!BLI_listbase_is_single(&temp_bmain->objects)) {
BKE_report(op->reports, RPT_ERROR, "Internal clipboard is not from pose mode");
BKE_main_free(temp_bmain);
return OPERATOR_CANCELLED;
Object *object_from = nullptr;
for (Object &obj : temp_bmain->objects) {
if (!(obj.id.flag & ID_FLAG_CLIPBOARD_MARK)) {
continue;
}
if (object_from != nullptr) {
/* There can only be one object in the clipboard to read the pose from. However there may be
* more than 1 object in total when dealing with packed assets and library overrides.
* See #155723. */
BKE_report(op->reports, RPT_ERROR, "Internal clipboard is not from pose mode");
BKE_main_free(temp_bmain);
return OPERATOR_CANCELLED;
}
object_from = &obj;
}
Object *object_from = static_cast<Object *>(temp_bmain->objects.first);
bPose *pose_from = object_from->pose;
if (pose_from == nullptr) {
BKE_report(op->reports, RPT_ERROR, "Internal clipboard has no pose");