Blender Git Commit Log

Git Commits -> Revision c2e6969

Revision c2e6969 by Bastien Montagne (master)
January 19, 2021, 17:58 (GMT)
Refactor modifier copying code.

Things like pointers to particle systems, or softbody data being stored
outside of its modifier, make it impossible for internal modifier copy
data code to be self-contained currently. It requires extra processing.

In existing code this was handled in several different places, in
several ways, and alltogether fairly inconsistently. Some cases were
even not properly handled, causing e.g. crashes as in T82945.

This commit addresses those issues by:
* Adding comments about the hackish/unsafe parts `psys` implies when
copying some modifier data (since we need to ensure particle system
copying and remapping of those pointers separately).
* Adding as-best-as-possible handling of those cases to
`BKE_object_copy_modifier` (note that it remains fragile, but is
expected to behave 'good enough' in any practical usecase).
* Remove special handling for specific editor code
(`copy_or_reuse_particle_system`). This should never have been
accepted in ED code area, and is now handled by
`BKE_object_copy_modifier`.
* Factorize copying of the whole modifier stack into new
`BKE_object_modifier_stack_copy`, now used by both `object_copy_data`
and `BKE_object_link_modifiers`.

Note that this implies that `BKE_object_copy_modifier` and
`BKE_object_copy_gpencil_modifier` are now to be used exclusively to
copy single modifiers. Full modifier stack copy should always use
`BKE_object_modifier_stack_copy` instead.

Fix T82945: Crash when dragging modifiers in Outliner.

Maniphest Tasks: T82945

Differential Revision: https://developer.blender.org/D10148

Commit Details:

Full Hash: c2e6969c56ef08bf1e7d831a9bfafcd36078eb3f
Parent Commit: c371d69
Lines Changed: +231, -148

8 Modified Paths:

/source/blender/blenkernel/BKE_object.h (+7, -1) (Diff)
/source/blender/blenkernel/intern/dynamicpaint.c (+4, -0) (Diff)
/source/blender/blenkernel/intern/fluid.c (+3, -0) (Diff)
/source/blender/blenkernel/intern/object.c (+196, -62) (Diff)
/source/blender/editors/object/object_modifier.c (+7, -85) (Diff)
/source/blender/makesdna/DNA_dynamicpaint_types.h (+5, -0) (Diff)
/source/blender/makesdna/DNA_modifier_types.h (+4, -0) (Diff)
/source/blender/modifiers/intern/MOD_particlesystem.c (+5, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021