[Bf-blender-cvs] [d2e473a2dd4] master: Cleanup: Remove unused "for_orco" argument to curve evaluation

Hans Goudey noreply at git.blender.org
Mon Jun 28 22:14:52 CEST 2021


Commit: d2e473a2dd488934c064c18f682750cac27c106f
Author: Hans Goudey
Date:   Mon Jun 28 15:14:43 2021 -0500
Branches: master
https://developer.blender.org/rBd2e473a2dd488934c064c18f682750cac27c106f

Cleanup: Remove unused "for_orco" argument to curve evaluation

`BKE_displist_make_curveTypes` had a `for_orco` argument that was
always false in calls to the function. Removing it allows the curve
displist and modifier evaluation code to become simpler. There are
some related cleanups in rBdf4299465279 and rB93aecd2b8107.

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

M	source/blender/blenkernel/BKE_displist.h
M	source/blender/blenkernel/intern/displist.cc
M	source/blender/blenkernel/intern/effect.c
M	source/blender/blenkernel/intern/mesh_convert.c
M	source/blender/blenkernel/intern/object_update.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/object/object_relations.c

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

diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index de2a746dc3e..0f37ba6c4ce 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -87,13 +87,11 @@ bool BKE_displist_has_faces(const struct ListBase *lb);
 void BKE_displist_make_curveTypes(struct Depsgraph *depsgraph,
                                   const struct Scene *scene,
                                   struct Object *ob,
-                                  const bool for_render,
-                                  const bool for_orco);
+                                  const bool for_render);
 void BKE_displist_make_curveTypes_forRender(struct Depsgraph *depsgraph,
                                             const struct Scene *scene,
                                             struct Object *ob,
                                             struct ListBase *dispbase,
-                                            const bool for_orco,
                                             struct Mesh **r_final);
 void BKE_displist_make_mball(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
 void BKE_displist_make_mball_forRender(struct Depsgraph *depsgraph,
diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc
index 65251ac1807..6a57c5ad5a2 100644
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@ -630,7 +630,7 @@ static float displist_calc_taper(Depsgraph *depsgraph,
                      (DispList *)taperobj->runtime.curve_cache->disp.first :
                      nullptr;
   if (dl == nullptr) {
-    BKE_displist_make_curveTypes(depsgraph, scene, taperobj, false, false);
+    BKE_displist_make_curveTypes(depsgraph, scene, taperobj, false);
     dl = (DispList *)taperobj->runtime.curve_cache->disp.first;
   }
   if (dl) {
@@ -1097,8 +1097,7 @@ static void displist_make_surf(Depsgraph *depsgraph,
                                Object *ob,
                                ListBase *dispbase,
                                Mesh **r_final,
-                               const bool for_render,
-                               const bool for_orco)
+                               const bool for_render)
 {
   ListBase nubase = {nullptr, nullptr};
   const Curve *cu = (const Curve *)ob->data;
@@ -1110,11 +1109,8 @@ static void displist_make_surf(Depsgraph *depsgraph,
     BKE_nurbList_duplicate(&nubase, &cu->nurb);
   }
 
-  bool force_mesh_conversion = false;
-  if (!for_orco) {
-    force_mesh_conversion = BKE_curve_calc_modifiers_pre(
-        depsgraph, scene, ob, &nubase, &nubase, for_render);
-  }
+  bool force_mesh_conversion = BKE_curve_calc_modifiers_pre(
+      depsgraph, scene, ob, &nubase, &nubase, for_render);
 
   LISTBASE_FOREACH (Nurb *, nu, &nubase) {
     if (!(for_render || nu->hide == 0) || !BKE_nurb_check_valid_uv(nu)) {
@@ -1177,11 +1173,9 @@ static void displist_make_surf(Depsgraph *depsgraph,
     }
   }
 
-  if (!for_orco) {
-    BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
-    curve_calc_modifiers_post(
-        depsgraph, scene, ob, dispbase, for_render, force_mesh_conversion, r_final);
-  }
+  BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
+  curve_calc_modifiers_post(
+      depsgraph, scene, ob, dispbase, for_render, force_mesh_conversion, r_final);
 
   BKE_nurbList_free(&nubase);
 }
@@ -1408,7 +1402,6 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
                                       Object *ob,
                                       ListBase *dispbase,
                                       const bool for_render,
-                                      const bool for_orco,
                                       Mesh **r_final)
 {
   const Curve *cu = (const Curve *)ob->data;
@@ -1419,24 +1412,18 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
   }
 
   if (ob->type == OB_SURF) {
-    displist_make_surf(depsgraph, scene, ob, dispbase, r_final, for_render, for_orco);
+    displist_make_surf(depsgraph, scene, ob, dispbase, r_final, for_render);
     return;
   }
 
   ListBase nubase = {nullptr, nullptr};
-  bool force_mesh_conversion = false;
 
   BKE_curve_bevelList_free(&ob->runtime.curve_cache->bev);
 
-  /* We only re-evaluate path if evaluation is not happening for orco.
-   * If the calculation happens for orco, we should never free data which
-   * was needed before and only not needed for orco calculation. */
-  if (!for_orco) {
-    if (ob->runtime.curve_cache->anim_path_accum_length) {
-      MEM_freeN((void *)ob->runtime.curve_cache->anim_path_accum_length);
-    }
-    ob->runtime.curve_cache->anim_path_accum_length = nullptr;
+  if (ob->runtime.curve_cache->anim_path_accum_length) {
+    MEM_freeN((void *)ob->runtime.curve_cache->anim_path_accum_length);
   }
+  ob->runtime.curve_cache->anim_path_accum_length = nullptr;
 
   if (ob->type == OB_FONT) {
     BKE_vfont_to_curve_nubase(ob, FO_EDIT, &nubase);
@@ -1445,10 +1432,8 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
     BKE_nurbList_duplicate(&nubase, BKE_curve_nurbs_get(const_cast<Curve *>(cu)));
   }
 
-  if (!for_orco) {
-    force_mesh_conversion = BKE_curve_calc_modifiers_pre(
-        depsgraph, scene, ob, &nubase, &nubase, for_render);
-  }
+  bool force_mesh_conversion = BKE_curve_calc_modifiers_pre(
+      depsgraph, scene, ob, &nubase, &nubase, for_render);
 
   BKE_curve_bevelList_make(ob, &nubase, for_render);
 
@@ -1635,17 +1620,15 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
     curve_to_filledpoly(cu, dispbase);
   }
 
-  if (!for_orco) {
-    if ((cu->flag & CU_PATH) ||
-        DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) {
-      BKE_anim_path_calc_data(ob);
-    }
-
-    BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
-    curve_calc_modifiers_post(
-        depsgraph, scene, ob, dispbase, for_render, force_mesh_conversion, r_final);
+  if ((cu->flag & CU_PATH) ||
+      DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) {
+    BKE_anim_path_calc_data(ob);
   }
 
+  BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
+  curve_calc_modifiers_post(
+      depsgraph, scene, ob, dispbase, for_render, force_mesh_conversion, r_final);
+
   if (cu->flag & CU_DEFORM_FILL && !ob->runtime.data_eval) {
     curve_to_filledpoly(cu, dispbase);
   }
@@ -1656,8 +1639,7 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
 void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
                                   const Scene *scene,
                                   Object *ob,
-                                  const bool for_render,
-                                  const bool for_orco)
+                                  const bool for_render)
 {
   /* The same check for duplis as in do_makeDispListCurveTypes.
    * Happens when curve used for constraint/bevel was converted to mesh.
@@ -1676,7 +1658,7 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
   ListBase *dispbase = &(ob->runtime.curve_cache->disp);
 
   Mesh *mesh_eval = nullptr;
-  do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, for_render, for_orco, &mesh_eval);
+  do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, for_render, &mesh_eval);
 
   if (mesh_eval != nullptr) {
     BKE_object_eval_assign_data(ob, &mesh_eval->id, true);
@@ -1685,19 +1667,15 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
   boundbox_displist_object(ob);
 }
 
-void BKE_displist_make_curveTypes_forRender(Depsgraph *depsgraph,
-                                            const Scene *scene,
-                                            Object *ob,
-                                            ListBase *dispbase,
-                                            const bool for_orco,
-                                            Mesh **r_final)
+void BKE_displist_make_curveTypes_forRender(
+    Depsgraph *depsgraph, const Scene *scene, Object *ob, ListBase *dispbase, Mesh **r_final)
 {
   if (ob->runtime.curve_cache == nullptr) {
     ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache),
                                                         "CurveCache for Curve");
   }
 
-  do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, true, for_orco, r_final);
+  do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, true, r_final);
 }
 
 void BKE_displist_minmax(const ListBase *dispbase, float min[3], float max[3])
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index ff0fc4754e3..97aba5e787d 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -163,7 +163,7 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef
     if (cu->flag & CU_PATH) {
       if (eff->ob->runtime.curve_cache == NULL ||
           eff->ob->runtime.curve_cache->anim_path_accum_length == NULL) {
-        BKE_displist_make_curveTypes(depsgraph, eff->scene, eff->ob, false, false);
+        BKE_displist_make_curveTypes(depsgraph, eff->scene, eff->ob, false);
       }
 
       if (eff->ob->runtime.curve_cache->anim_path_accum_length) {
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index 1b938855291..825963a2210 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -1107,7 +1107,7 @@ static void curve_to_mesh_eval_ensure(Object *object)
    * Brecht says hold off with that. */
   Mesh *mesh_eval = NULL;
   BKE_displist_make_curveTypes_forRender(
-      NULL, NULL, &remapped_object, &remapped_object.runtime.curve_cache->disp, false, &mesh_eval);
+      NULL, NULL, &remapped_object, &remapped_object.runtime.curve_cache->disp, &mesh_eval);
 
   /* Note: this is to be consistent with `BKE_displist_make_curveTypes()`, however that is not a
    * real issue currently, code here is broken in more than one way, fix(es) will be done
diff --git a/

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list