Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-02-04 16:06:49 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-02-04 16:09:22 +0300
commit38984b10ff7b8c61c5e1b85a971c77841de5f4e7 (patch)
tree19d7785856fd4f28cebe00606cb07a7759ef4f87 /source
parentff2dd59d4a12a118eda5dc73ad692dae39cd702c (diff)
T61148: Particle properties can not be edited after keyframing
Was happening with certain settings for hair. Need to make a copy of particle settings before modifying them via animation system.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 04bae69d60a..2b2b57b5079 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -4189,6 +4189,28 @@ static int hair_needs_recalc(ParticleSystem *psys)
return 0;
}
+static ParticleSettings *particle_settings_localize(ParticleSettings *particle_settings)
+{
+ ParticleSettings *particle_settings_local;
+ /* TODO(sergey): Consider making this a */
+ BKE_id_copy_ex(NULL,
+ (ID *)&particle_settings->id,
+ (ID **)&particle_settings_local,
+ (LIB_ID_CREATE_NO_MAIN |
+ LIB_ID_CREATE_NO_USER_REFCOUNT |
+ LIB_ID_CREATE_NO_DEG_TAG |
+ LIB_ID_COPY_CACHES),
+ false);
+ return particle_settings_local;
+}
+
+static void particle_settings_free_local(ParticleSettings *particle_settings)
+{
+ BKE_libblock_free_datablock(&particle_settings->id, 0);
+ BKE_libblock_free_data(&particle_settings->id, false);
+ MEM_freeN(particle_settings);
+}
+
/* main particle update call, checks that things are ok on the large scale and
* then advances in to actual particle calculations depending on particle type */
void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, const bool use_render_params)
@@ -4262,16 +4284,27 @@ void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *o
/* first step is negative so particles get killed and reset */
psys->cfra= 1.0f;
+ ParticleSettings *part_local = part;
+ if ((part->flag & PART_HAIR_REGROW) == 0) {
+ part_local = particle_settings_localize(part);
+ psys->part = part_local;
+ }
+
for (i=0; i<=part->hair_step; i++) {
hcfra=100.0f*(float)i/(float)psys->part->hair_step;
if ((part->flag & PART_HAIR_REGROW)==0)
- BKE_animsys_evaluate_animdata(depsgraph, scene, &part->id, part->adt, hcfra, ADT_RECALC_ANIM);
+ BKE_animsys_evaluate_animdata(depsgraph, scene, &part_local->id, part_local->adt, hcfra, ADT_RECALC_ANIM);
system_step(&sim, hcfra, use_render_params);
psys->cfra = hcfra;
psys->recalc = 0;
save_hair(&sim, hcfra);
}
+ if (part_local != part) {
+ particle_settings_free_local(part_local);
+ psys->part = part;
+ }
+
psys->flag |= PSYS_HAIR_DONE;
psys->recalc = recalc;
}