Fix #128519: Pasting pose from liboverride armature creates warning.

In Pose copy/paste case, (almost) all dependencies of the armature
object are cleared during the copy phase (only its obdata Armature is
kept). This would also clear ID pointers from the liboverride data if
the source object is a liboverride.

While manual handling of such cases is possible, it's simpler here to
simply make the data in the pastebuffer fully local, since only the Pose
part of it is used anyway.
This commit is contained in:
Bastien Montagne
2024-10-16 15:01:09 +02:00
parent 631876e1e8
commit 9405bd25d6

View File

@@ -792,13 +792,16 @@ static int pose_copy_exec(bContext *C, wmOperator *op)
copybuffer.id_add(
&ob->id,
PartialWriteContext::IDAddOptions{PartialWriteContext::IDAddOperations(
PartialWriteContext::IDAddOperations::MAKE_LOCAL |
PartialWriteContext::IDAddOperations::SET_FAKE_USER |
PartialWriteContext::IDAddOperations::SET_CLIPBOARD_MARK)},
[ob](LibraryIDLinkCallbackData *cb_data,
PartialWriteContext::IDAddOptions /*options*/) -> PartialWriteContext::IDAddOperations {
/* Only include `ob->data` (i.e. the Armature) dependency. */
if (*(cb_data->id_pointer) == ob->data) {
return PartialWriteContext::IDAddOperations::ADD_DEPENDENCIES;
return PartialWriteContext::IDAddOperations(
PartialWriteContext::IDAddOperations::MAKE_LOCAL |
PartialWriteContext::IDAddOperations::ADD_DEPENDENCIES);
}
return PartialWriteContext::IDAddOperations::CLEAR_DEPENDENCIES;
});