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
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-06-27 12:34:45 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-28 12:06:31 +0300
commit0bf33a1e33805580e77fe9c13a15f8c67c909906 (patch)
tree8a09b0533d1dbbe954f61cbc5bdb272c5baea8c4 /source/blender/editors/physics
parentd125e777b330921067ac06d14d8cf271f2f00def (diff)
Cleanup: Nuke DM out of particle edit code.
Note that this commit also fixes serious memory leaks, temp Mesh generated out of Main from the DM were never freed here!
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/particle_edit.c17
-rw-r--r--source/blender/editors/physics/particle_object.c10
2 files changed, 10 insertions, 17 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index d2ca8471d82..6e3f90588bc 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -53,7 +53,6 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_library.h"
@@ -3532,7 +3531,7 @@ static void intersect_dm_quad_weights(const float v1[3], const float v2[3], cons
interp_weights_poly_v3(w, vert, 4, co);
}
-/* check intersection with a derivedmesh */
+/** Check intersection with an evaluated mesh. */
static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *scene, Object *ob, Mesh *mesh,
float *vert_cos,
const float co1[3], const float co2[3],
@@ -3549,18 +3548,16 @@ static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *scene, Object *o
if (mesh == NULL) {
psys_disable_all(ob);
- /* TODO(Sybren): port to Mesh when we have decided how to handle derivedFinal and derivedDeform */
- DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, 0);
- if (dm == NULL)
- dm = mesh_get_derived_deform(depsgraph, scene, ob, 0);
+ mesh = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ if (mesh == NULL) {
+ mesh = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ }
psys_enable_all(ob);
- if (dm == NULL)
+ if (mesh == NULL) {
return 0;
-
- mesh = BKE_id_new_nomain(ID_ME, NULL);
- DM_to_mesh(dm, mesh, ob, CD_MASK_EVERYTHING, false);
+ }
}
/* BMESH_ONLY, deform dm may not have tessface */
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 8a9eb369e66..e531836d744 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -43,9 +43,8 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
+#include "BKE_bvhutils.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
@@ -1046,11 +1045,8 @@ static bool copy_particle_systems_to_object(const bContext *C,
*/
psys_start = totpsys > 0 ? tmp_psys[0] : NULL;
- /* get the DM (psys and their modifiers have not been appended yet) */
- /* TODO(Sybren): use mesh_eval instead */
- DerivedMesh *final_dm = mesh_get_derived_final(depsgraph, scene, ob_to, cdmask);
- final_mesh = BKE_id_new_nomain(ID_ME, NULL);
- DM_to_mesh(final_dm, final_mesh, ob_to, CD_MASK_EVERYTHING, false);
+ /* Get the evaluated mesh (psys and their modifiers have not been appended yet) */
+ final_mesh = mesh_get_eval_final(depsgraph, scene, ob_to, cdmask);
/* now append psys to the object and make modifiers */
for (i = 0, psys_from = PSYS_FROM_FIRST;