Page MenuHome

Fix usercount not decrementing in `gpencil_stroke_separate_exec`
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Jul 29 2020, 12:55 PM.

Details

Summary

This is part of T79273 where separating a stroke would result in
multiuser gpencil data for the original object.
Real underlying issue seems to be that gpencil multiuser objects (also
the ones created by Alt+D duplicating) have a problem evaluating
modifiers correctly [this will need further investigation].
Not sure if this is a limitation of D5470?

This patch only corrects the usercount on separating [which already fixes
the scenario reported because singleuser gpencil modifiers work
correctly].

Note: we could have also called ED_object_add_duplicate with the
USER_DUP_GPENCIL dupflag -- that would have taken care of the usercount
--, but then the whole following logic in gpencil_stroke_separate_exec
would need to change from adding layers/frames/strokes to
removing these.

Part of T79273

Diff Detail

Repository
rB Blender

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Jul 29 2020, 12:55 PM
Philipp Oeser (lichtwerk) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Jul 29 2020, 3:29 PM
Bastien Montagne (mont29) added inline comments.
source/blender/editors/gpencil/gpencil_edit.c
4284–4285

better be explicit where we decrease user count from: id_us_min(ob_dst->data); or something like that, just before re-assigning to that pointer the new GP id (and add in comment why we do not need to increase usercount of that one as well).

This revision now requires changes to proceed.Jul 29 2020, 3:29 PM

address review by mont29

This revision is now accepted and ready to land.Jul 29 2020, 4:20 PM