Particle mode: Support children drawing
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 7 Jun 2018 09:25:13 +0000 (11:25 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 7 Jun 2018 09:31:56 +0000 (11:31 +0200)
The issue is that children drawing is done by object mode,
which operates with data from evaluated context. But that
data needs edit mode's cache to be properly updated first.

source/blender/blenkernel/intern/particle_system.c
source/blender/makesrna/intern/rna_sculpt_paint.c

index a2d9891ec2d51aed55e0794360bdf4476e6bba0f..8d6991ff9f46ad88a7f478cb1690954c2f3e9cb2 100644 (file)
@@ -4217,6 +4217,18 @@ void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *o
        if (!psys_check_enabled(ob, psys, use_render_params))
                return;
 
+       if (DEG_is_active(depsgraph)) {
+               if (psys->orig_psys != NULL && psys->orig_psys->edit != NULL) {
+                       psys_cache_edit_paths(
+                               depsgraph,
+                               (Scene *)DEG_get_original_id(&scene->id),
+                               DEG_get_original_object(ob),
+                               psys->orig_psys->edit,
+                               DEG_get_ctime(depsgraph),
+                               DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
+               }
+       }
+
        cfra = DEG_get_ctime(depsgraph);
 
        sim.depsgraph = depsgraph;
index 12b080a92848edcb80a5dbffb9572e83bb1a7e83..a26aceda3b925256fe21535c8f49073d50140100 100644 (file)
@@ -162,6 +162,8 @@ static void rna_ParticleEdit_redo(bContext *C, PointerRNA *UNUSED(ptr))
        if (!edit)
                return;
 
+       if (ob) DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+
        BKE_particle_batch_cache_dirty(edit->psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
        psys_free_path_cache(edit->psys, edit);
        DEG_id_tag_update(&CTX_data_scene(C)->id, DEG_TAG_COPY_ON_WRITE);