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:
parent
cee6518b5e
commit
ba85b4e45c
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue