Fix: create shallow copy of CustomData before writing

CustomData_blend_write_prepare might modify the `CustomData`
instance, making it invalid afterwards. It is not necessary to do this
in other cases explicitly, because when writing shallow copies of
ID data blocks are made.
This commit is contained in:
Jacques Lucke 2020-09-16 10:38:51 +02:00
parent cee6518b5e
commit ba85b4e45c
1 changed files with 3 additions and 2 deletions

View File

@ -172,13 +172,14 @@ static void simulation_blend_write(BlendWriter *writer, ID *id, const void *id_a
ParticleSimulationState *particle_state = (ParticleSimulationState *)state;
CustomDataLayer *players = NULL, players_buff[CD_TEMP_CHUNK_SIZE];
CustomData attributes_shallow_copy = particle_state->attributes;
CustomData_blend_write_prepare(
&particle_state->attributes, &players, players_buff, ARRAY_SIZE(players_buff));
&attributes_shallow_copy, &players, players_buff, ARRAY_SIZE(players_buff));
BLO_write_struct(writer, ParticleSimulationState, particle_state);
CustomData_blend_write(writer,
&particle_state->attributes,
&attributes_shallow_copy,
players,
particle_state->tot_particles,
CD_MASK_ALL,