Merge branch 'master' into blender2.8
[blender.git] / source / blender / blenkernel / intern / particle.c
index 416d63cfefb7aeaf448c711a9fc1a73df57e5caf..a8253b9dc3cf0ad36662f6370509255116b3d0d2 100644 (file)
@@ -78,7 +78,6 @@
 #include "BKE_library.h"
 #include "BKE_library_query.h"
 #include "BKE_library_remap.h"
-#include "BKE_depsgraph.h"
 #include "BKE_modifier.h"
 #include "BKE_mesh.h"
 #include "BKE_cdderivedmesh.h"
@@ -86,6 +85,9 @@
 #include "BKE_scene.h"
 #include "BKE_deform.h"
 
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
+
 #include "RE_render_ext.h"
 
 unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT];
@@ -606,6 +608,8 @@ void psys_free(Object *ob, ParticleSystem *psys)
                        MEM_freeN(psys->pdd);
                }
 
+               BKE_particle_batch_cache_free(psys);
+
                MEM_freeN(psys);
        }
 }
@@ -3158,8 +3162,8 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
        psys->flag = PSYS_CURRENT;
        psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1);
 
-       DAG_relations_tag_update(G.main);
-       DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+       DEG_relations_tag_update(G.main);
+       DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
 
        return md;
 }
@@ -3204,8 +3208,8 @@ void object_remove_particle_system(Scene *UNUSED(scene), Object *ob)
        else
                ob->mode &= ~OB_MODE_PARTICLE_EDIT;
 
-       DAG_relations_tag_update(G.main);
-       DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+       DEG_relations_tag_update(G.main);
+       DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
 }
 
 static void default_particle_settings(ParticleSettings *part)
@@ -3290,6 +3294,7 @@ static void default_particle_settings(ParticleSettings *part)
 
        part->omat = 1;
        part->use_modifier_stack = false;
+       part->draw_size = 0.1f;
 }
 
 
@@ -4336,3 +4341,22 @@ void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys)
                psys->flag |= PSYS_EDITED;
        }
 }
+
+
+
+/* Draw Engine */
+void (*BKE_particle_batch_cache_dirty_cb)(ParticleSystem *psys, int mode) = NULL;
+void (*BKE_particle_batch_cache_free_cb)(ParticleSystem *psys) = NULL;
+
+void BKE_particle_batch_cache_dirty(ParticleSystem *psys, int mode)
+{
+       if (psys->batch_cache) {
+               BKE_particle_batch_cache_dirty_cb(psys, mode);
+       }
+}
+void BKE_particle_batch_cache_free(ParticleSystem *psys)
+{
+       if (psys->batch_cache) {
+               BKE_particle_batch_cache_free_cb(psys);
+       }
+}