Commit: fc5eab357009f10fe68bb19a5d48f3ff7ab8825a
Author: Sybren A. Stüvel
Date:   Tue Aug 18 12:58:48 2020 +0200
Branches: master
https://developer.blender.org/rBfc5eab357009f10fe68bb19a5d48f3ff7ab8825a

Mesh: merge `mesh_create_eval_final_{view,render}` functions

Functions `mesh_create_eval_final_view()` and
`mesh_create_eval_final_render()` were doing the exact same thing,
except for a hack introduced in d3eb9dddd6b4 (2012-10-08, Better fix for
T32846: dupligroup messes up particle instancing on rendering) that
appears to be no longer necessary. Besides that, these functions had
confusing names. Their functionality changed over time, and whether to
do for-render or for-viewport evaluation is now actually determined by
the depsgraph evaluation mode. This means that the `..._render` function
could evaluate a mesh with viewport settings, and vice versa.

The functions are now merged into `mesh_create_eval_final()`, and the
hack has been removed. The `OB_NO_PSYS_UPDATE` flag has been removed
entirely (instead of keeping it around as deprecated flag), because it
was always only temporarily set on objects during mesh evaluation and
thus not saved to the blend file.

No expected functional changes as far as users are concerned.

===================================================================

M       source/blender/blenkernel/BKE_mesh_runtime.h
M       source/blender/blenkernel/intern/DerivedMesh.c
M       source/blender/blenkernel/intern/mesh_convert.c
M       source/blender/editors/object/object_modifier.c
M       source/blender/editors/sculpt_paint/paint_image_proj.c
M       source/blender/makesdna/DNA_object_types.h
M       source/blender/modifiers/intern/MOD_particlesystem.c
M       source/blender/python/bmesh/bmesh_py_types.c
M       source/blender/python/mathutils/mathutils_bvhtree.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_mesh_runtime.h 
b/source/blender/blenkernel/BKE_mesh_runtime.h
index adb7c357049..267be4f44fd 100644
--- a/source/blender/blenkernel/BKE_mesh_runtime.h
+++ b/source/blender/blenkernel/BKE_mesh_runtime.h
@@ -71,7 +71,7 @@ struct Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph,
                                   struct Object *ob,
                                   const struct CustomData_MeshMasks *dataMask);
 
-struct Mesh *mesh_create_eval_final_render(struct Depsgraph *depsgraph,
+struct Mesh *mesh_create_eval_final(struct Depsgraph *depsgraph,
                                            struct Scene *scene,
                                            struct Object *ob,
                                            const struct CustomData_MeshMasks 
*dataMask);
@@ -82,11 +82,6 @@ struct Mesh *mesh_create_eval_final_index_render(struct 
Depsgraph *depsgraph,
                                                  const struct 
CustomData_MeshMasks *dataMask,
                                                  int index);
 
-struct Mesh *mesh_create_eval_final_view(struct Depsgraph *depsgraph,
-                                         struct Scene *scene,
-                                         struct Object *ob,
-                                         const struct CustomData_MeshMasks 
*dataMask);
-
 struct Mesh *mesh_create_eval_no_deform(struct Depsgraph *depsgraph,
                                         struct Scene *scene,
                                         struct Object *ob,
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index 0dc85dfaa18..248e7958723 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1991,7 +1991,7 @@ Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph,
   return ob->runtime.mesh_deform_eval;
 }
 
-Mesh *mesh_create_eval_final_render(Depsgraph *depsgraph,
+Mesh *mesh_create_eval_final(Depsgraph *depsgraph,
                                     Scene *scene,
                                     Object *ob,
                                     const CustomData_MeshMasks *dataMask)
@@ -2016,26 +2016,6 @@ Mesh *mesh_create_eval_final_index_render(Depsgraph 
*depsgraph,
   return final;
 }
 
-Mesh *mesh_create_eval_final_view(Depsgraph *depsgraph,
-                                  Scene *scene,
-                                  Object *ob,
-                                  const CustomData_MeshMasks *dataMask)
-{
-  Mesh *final;
-
-  /* XXX hack
-   * psys modifier updates particle state when called during dupli-list 
generation,
-   * which can lead to wrong transforms. This disables particle system 
modifier execution.
-   */
-  ob->transflag |= OB_NO_PSYS_UPDATE;
-
-  mesh_calc_modifiers(depsgraph, scene, ob, 1, false, dataMask, -1, false, 
false, NULL, &final);
-
-  ob->transflag &= ~OB_NO_PSYS_UPDATE;
-
-  return final;
-}
-
 Mesh *mesh_create_eval_no_deform(Depsgraph *depsgraph,
                                  Scene *scene,
                                  Object *ob,
diff --git a/source/blender/blenkernel/intern/mesh_convert.c 
b/source/blender/blenkernel/intern/mesh_convert.c
index 76a6d23bc8f..9426d09885e 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -1111,15 +1111,7 @@ static Mesh 
*mesh_new_from_mesh_object_with_layers(Depsgraph *depsgraph, Object
 
   Scene *scene = DEG_get_evaluated_scene(depsgraph);
   CustomData_MeshMasks mask = CD_MASK_MESH;
-  Mesh *result;
-
-  if (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER) {
-    result = mesh_create_eval_final_render(depsgraph, scene, &object_for_eval, 
&mask);
-  }
-  else {
-    result = mesh_create_eval_final_view(depsgraph, scene, &object_for_eval, 
&mask);
-  }
-
+  Mesh *result = mesh_create_eval_final(depsgraph, scene, &object_for_eval, 
&mask);
   return result;
 }
 
diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index ceb6553bdf6..14882ab8ffc 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -107,7 +107,7 @@ static void object_force_modifier_update_for_bind(Depsgraph 
*depsgraph, Object *
   Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
   BKE_object_eval_reset(ob_eval);
   if (ob->type == OB_MESH) {
-    Mesh *me_eval = mesh_create_eval_final_view(depsgraph, scene_eval, 
ob_eval, &CD_MASK_BAREMESH);
+    Mesh *me_eval = mesh_create_eval_final(depsgraph, scene_eval, ob_eval, 
&CD_MASK_BAREMESH);
     BKE_mesh_eval_delete(me_eval);
   }
   else if (ob->type == OB_LATTICE) {
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c 
b/source/blender/editors/sculpt_paint/paint_image_proj.c
index db7de01bee5..1b340f532c2 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4037,7 +4037,7 @@ static bool proj_paint_state_mesh_eval_init(const 
bContext *C, ProjPaintState *p
   /* Workaround for subsurf selection, try the display mesh first */
   if (ps->source == PROJ_SRC_IMAGE_CAM) {
     /* using render mesh, assume only camera was rendered from */
-    ps->me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, 
ob_eval, &cddata_masks);
+    ps->me_eval = mesh_create_eval_final(depsgraph, scene_eval, ob_eval, 
&cddata_masks);
     ps->me_eval_free = true;
   }
   else {
diff --git a/source/blender/makesdna/DNA_object_types.h 
b/source/blender/makesdna/DNA_object_types.h
index 6568281a8d4..62c072831b4 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -537,8 +537,6 @@ enum {
   OB_TRANSFLAG_UNUSED_12 = 1 << 12, /* cleared */
   /* runtime constraints disable */
   OB_NO_CONSTRAINTS = 1 << 13,
-  /* hack to work around particle issue */
-  OB_NO_PSYS_UPDATE = 1 << 14,
 
   OB_DUPLI = OB_DUPLIVERTS | OB_DUPLICOLLECTION | OB_DUPLIFACES | 
OB_DUPLIPARTS,
 };
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c 
b/source/blender/modifiers/intern/MOD_particlesystem.c
index ea0c63da1b0..4ef1b19dc64 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -219,7 +219,7 @@ static void deformVerts(ModifierData *md,
   psmd->totdmedge = psmd->mesh_final->totedge;
   psmd->totdmface = psmd->mesh_final->totface;
 
-  if (!(ctx->object->transflag & OB_NO_PSYS_UPDATE)) {
+  {
     struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
     psmd->flag &= ~eParticleSystemFlag_psys_updated;
     particle_system_update(
diff --git a/source/blender/python/bmesh/bmesh_py_types.c 
b/source/blender/python/bmesh/bmesh_py_types.c
index e39b5faf3c4..04bceb17c20 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -1134,7 +1134,7 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, 
PyObject *args, PyObject
         return NULL;
       }
 
-      me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob_eval, 
&data_masks);
+      me_eval = mesh_create_eval_final(depsgraph, scene_eval, ob_eval, 
&data_masks);
     }
     else {
       if (use_cage) {
diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c 
b/source/blender/python/mathutils/mathutils_bvhtree.c
index 9d76f07e4fb..16ea05771d0 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -1053,7 +1053,7 @@ static Mesh *bvh_get_mesh(const char *funcname,
       }
 
       *r_free_mesh = true;
-      return mesh_create_eval_final_render(depsgraph, scene, ob, &data_masks);
+      return mesh_create_eval_final(depsgraph, scene, ob, &data_masks);
     }
     if (ob_eval != NULL) {
       if (use_cage) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to