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.