[Bf-blender-cvs] [b4beba7f1c3] geometry-nodes-curve-support: Merge branch 'master' into geometry-nodes-curve-support

Hans Goudey noreply at git.blender.org
Fri Apr 2 20:20:07 CEST 2021


Commit: b4beba7f1c34d1a74865aa6412d653ee5286a4c0
Author: Hans Goudey
Date:   Fri Apr 2 10:41:55 2021 -0500
Branches: geometry-nodes-curve-support
https://developer.blender.org/rBb4beba7f1c34d1a74865aa6412d653ee5286a4c0

Merge branch 'master' into geometry-nodes-curve-support

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



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

diff --cc source/blender/blenkernel/intern/displist.cc
index e5f3fad7318,9022760fe34..90718d85f5b
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@@ -630,8 -629,13 +631,11 @@@ static void curve_to_filledpoly(const C
   * - first point left, last point right
   * - based on subdivided points in original curve, not on points in taper curve (still)
   */
- static float displist_calc_taper(Depsgraph *depsgraph, Scene *scene, Object *taperobj, float fac)
+ static float displist_calc_taper(Depsgraph *depsgraph,
+                                  const Scene *scene,
+                                  Object *taperobj,
+                                  float fac)
  {
 -  DispList *dl;
 -
    if (taperobj == NULL || taperobj->type != OB_CURVE) {
      return 1.0;
    }
@@@ -891,52 -892,9 +895,51 @@@ static void displist_vert_coords_apply(
    }
  }
  
 +static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md,
 +                                                   const ModifierEvalContext &mectx,
 +                                                   Curve *curve,
 +                                                   Object *ob,
 +                                                   Mesh *input_mesh,
 +                                                   GeometrySet &geometry_set)
 +{
 +  Mesh *mesh_output = nullptr;
 +  const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type);
 +  if (mti->modifyGeometrySet == nullptr) {
 +    mesh_output = BKE_modifier_modify_mesh(md, &mectx, input_mesh);
 +  }
 +  else {
 +    /* Adds a new mesh component to the geometry set based on the #input_mesh. */
 +    BLI_assert(!geometry_set.has<MeshComponent>());
 +    MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
 +    mesh_component.replace(input_mesh, GeometryOwnershipType::Editable);
 +    mesh_component.copy_vertex_group_names_from_object(*ob);
 +
 +    CurveComponent &curve_component = geometry_set.get_component_for_write<CurveComponent>();
 +    curve_component.replace(dcurve_from_dna_curve(*curve));
 +
 +    /* Let the modifier change the geometry set. */
 +    mti->modifyGeometrySet(md, &mectx, &geometry_set);
 +
 +    /* Release the mesh from the geometry set again. */
 +    if (geometry_set.has<MeshComponent>()) {
 +      MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
 +      mesh_output = mesh_component.release();
 +      geometry_set.remove<MeshComponent>();
 +    }
 +
 +    /* Return an empty mesh instead of null.  */
 +    if (mesh_output == nullptr) {
 +      mesh_output = BKE_mesh_new_nomain(0, 0, 0, 0, 0);
 +      BKE_mesh_copy_settings(mesh_output, input_mesh);
 +    }
 +  }
 +
 +  return mesh_output;
 +}
 +
  static void curve_calc_modifiers_post(Depsgraph *depsgraph,
-                                       Scene *scene,
+                                       const Scene *scene,
                                        Object *ob,
-                                       ListBase *nurb,
                                        ListBase *dispbase,
                                        Mesh **r_final,
                                        const bool for_render,
@@@ -948,7 -903,7 +951,7 @@@
    VirtualModifierData virtualModifierData;
    ModifierData *md = BKE_modifiers_get_virtual_modifierlist(ob, &virtualModifierData);
    ModifierData *pretessellatePoint;
-   Curve *cu = (Curve *)ob->data;
 -  const Curve *cu = ob->data;
++  const Curve *cu = (const Curve *)ob->data;
    int required_mode = 0, totvert = 0;
    const bool editmode = (!for_render && (cu->editnurb || cu->editfont));
    Mesh *modified = NULL, *mesh_applied;
@@@ -1283,15 -1232,8 +1286,8 @@@ void BKE_displist_make_surf(Depsgraph *
  
    if (!for_orco) {
      BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
-     curve_calc_modifiers_post(depsgraph,
-                               scene,
-                               ob,
-                               &nubase,
-                               dispbase,
-                               r_final,
-                               for_render,
-                               force_mesh_conversion,
-                               nullptr);
+     curve_calc_modifiers_post(
 -        depsgraph, scene, ob, dispbase, r_final, for_render, force_mesh_conversion);
++        depsgraph, scene, ob, dispbase, r_final, for_render, force_mesh_conversion, nullptr);
    }
  
    BKE_nurbList_free(&nubase);
@@@ -1763,15 -1707,8 +1762,14 @@@ static void do_makeDispListCurveTypes(D
        }
  
        BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
 -      curve_calc_modifiers_post(
 -          depsgraph, scene, ob, dispbase, r_final, for_render, force_mesh_conversion);
 +      curve_calc_modifiers_post(depsgraph,
 +                                scene,
 +                                ob,
-                                 &nubase,
 +                                dispbase,
 +                                r_final,
 +                                for_render,
 +                                force_mesh_conversion,
 +                                r_geometry_set);
      }
  
      if (cu->flag & CU_DEFORM_FILL && !ob->runtime.data_eval) {
@@@ -1829,14 -1760,13 +1830,14 @@@ void BKE_displist_make_curveTypes_forRe
                                              const bool for_orco)
  {
    if (ob->runtime.curve_cache == NULL) {
 -    ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
 +    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, for_orco, r_final, nullptr);
  }
  
- void BKE_displist_minmax(ListBase *dispbase, float min[3], float max[3])
+ void BKE_displist_minmax(const ListBase *dispbase, float min[3], float max[3])
  {
    const float *vert;
    int a, tot = 0;



More information about the Bf-blender-cvs mailing list