[Bf-blender-cvs] [7705166438a] sculpt-dev: Merge branch 'master' into sculpt-dev

Joseph Eagar noreply at git.blender.org
Mon Jan 31 18:39:40 CET 2022


Commit: 7705166438a5425b1b388ec87970e21346b647e5
Author: Joseph Eagar
Date:   Sat Jan 29 14:07:16 2022 -0800
Branches: sculpt-dev
https://developer.blender.org/rB7705166438a5425b1b388ec87970e21346b647e5

Merge branch 'master' into sculpt-dev

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



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

diff --cc CMakeLists.txt
index 16ec8a5c47e,f73149adc04..f805bfb38f3
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -712,12 -709,13 +716,15 @@@ if(UNIX AND NOT APPLE
    mark_as_advanced(WITH_CXX11_ABI)
  endif()
  
 +option(WITH_INSTANT_MESHES, "Instant Meshes Quadrangulator" ON)
 +
  # Installation process.
- option(POSTINSTALL_SCRIPT "Run given CMake script after installation process" OFF)
+ set(POSTINSTALL_SCRIPT "" CACHE FILEPATH "Run given CMake script after installation process")
  mark_as_advanced(POSTINSTALL_SCRIPT)
  
+ set(POSTCONFIGURE_SCRIPT "" CACHE FILEPATH "Run given CMake script as the last step of CMake configuration")
+ mark_as_advanced(POSTCONFIGURE_SCRIPT)
+ 
  # end option(...)
  
  
diff --cc release/datafiles/locale
index 68f8874599d,620b85f16d0..93612eddc7c
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit 68f8874599d7fbac10fa332535450d8a78fafda2
 -Subproject commit 620b85f16d03a6aadd7cae56969c9c29b06b992d
++Subproject commit 93612eddc7cdfa82d1e7c31c362df0988388629b
diff --cc release/scripts/addons
index b825c2d31ad,67f1fbca148..9207696bbfa
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit b825c2d31ad39218fe39c99037d31bc2479211bd
 -Subproject commit 67f1fbca1482d9d9362a4001332e785c3fd5d230
++Subproject commit 9207696bbfac648c299f29f031ab5f18d8fa0077
diff --cc source/blender/blenkernel/intern/brush.c
index 83153ddc619,c86d4658cc9..a63a9fd0f2c
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@@ -165,20 -149,9 +165,19 @@@ static void brush_make_local(Main *bmai
  
    Brush *brush = (Brush *)id;
    const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0;
-   bool force_local = (flags & LIB_ID_MAKELOCAL_FORCE_LOCAL) != 0;
-   bool force_copy = (flags & LIB_ID_MAKELOCAL_FORCE_COPY) != 0;
-   BLI_assert(force_copy == false || force_copy != force_local);
  
 +  bool is_local = false, is_lib = false;
 +
 +  if (brush->channels) {
 +    brush->channels = BKE_brush_channelset_copy(brush->channels);
 +  }
 +
 +  /* - only lib users: do nothing (unless force_local is set)
 +   * - only local users: set flag
 +   * - mixed: make copy
 +   */
+   bool force_local, force_copy;
+   BKE_lib_id_make_local_generic_action_define(bmain, id, flags, &force_local, &force_copy);
  
    if (brush->clone.image) {
      /* Special case: ima always local immediately. Clone image should only have one user anyway. */
diff --cc source/blender/blenkernel/intern/mesh_merge.c
index fb27ca96380,3c01d5a4a50..500fc26dcb9
--- a/source/blender/blenkernel/intern/mesh_merge.c
+++ b/source/blender/blenkernel/intern/mesh_merge.c
@@@ -347,18 -348,12 +348,20 @@@ Mesh *BKE_mesh_merge_verts(Mesh *mesh
  
      /* Can we optimize by reusing an old `pmap`? How do we know an old `pmap` is stale? */
      /* When called by `MOD_array.c` the `cddm` has just been created, so it has no valid `pmap`. */
 -    BKE_mesh_vert_poly_map_create(
 -        &poly_map, &poly_map_mem, mesh->mpoly, mesh->mloop, totvert, totpoly, totloop);
 +    BKE_mesh_vert_poly_map_create(&poly_map,
 +                                  &poly_map_mem,
 +                                  mesh->mvert,
 +                                  mesh->medge,
 +                                  mesh->mpoly,
 +                                  mesh->mloop,
 +                                  totvert,
 +                                  totpoly,
 +                                  totloop,
 +                                  false);
    } /* done preparing for fast poly compare */
  
+   BLI_bitmap *vert_tag = BLI_BITMAP_NEW(mesh->totvert, __func__);
+ 
    mp = mesh->mpoly;
    mv = mesh->mvert;
    for (i = 0; i < totpoly; i++, mp++) {
diff --cc source/blender/bmesh/intern/bmesh_mesh_convert.cc
index 2f7b2f50dd3,d6c642ff80b..b9e2b0fe74d
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@@ -79,9 -79,11 +79,12 @@@
  #include "MEM_guardedalloc.h"
  
  #include "BLI_alloca.h"
 +#include "BLI_array.h"
+ #include "BLI_array.hh"
+ #include "BLI_index_range.hh"
  #include "BLI_listbase.h"
  #include "BLI_math_vector.h"
+ #include "BLI_span.hh"
  
  #include "BKE_customdata.h"
  #include "BKE_mesh.h"
@@@ -95,69 -97,11 +98,73 @@@
  
  #include "bmesh.h"
  #include "intern/bmesh_private.h" /* For element checking. */
 +#include "range_tree.h"
 +
 +static void bm_free_cd_pools(BMesh *bm)
 +{
 +  if (bm->vdata.pool) {
 +    BLI_mempool_destroy(bm->vdata.pool);
 +  }
 +  if (bm->edata.pool) {
 +    BLI_mempool_destroy(bm->edata.pool);
 +  }
 +  if (bm->ldata.pool) {
 +    BLI_mempool_destroy(bm->ldata.pool);
 +  }
 +  if (bm->pdata.pool) {
 +    BLI_mempool_destroy(bm->pdata.pool);
 +  }
 +}
 +
 +//#define bm_assign_id(a, b, c, d)
 +//#define bm_alloc_id(a, b)
 +
 +static void bm_unmark_temp_cdlayers(BMesh *bm)
 +{
 +  CustomData_unmark_temporary_nocopy(&bm->vdata);
 +  CustomData_unmark_temporary_nocopy(&bm->edata);
 +  CustomData_unmark_temporary_nocopy(&bm->ldata);
 +  CustomData_unmark_temporary_nocopy(&bm->pdata);
 +}
 +
 +static void bm_mark_temp_cdlayers(BMesh *bm)
 +{
 +  CustomData_mark_temporary_nocopy(&bm->vdata);
 +  CustomData_mark_temporary_nocopy(&bm->edata);
 +  CustomData_mark_temporary_nocopy(&bm->ldata);
 +  CustomData_mark_temporary_nocopy(&bm->pdata);
 +}
 +
 +#if 0
 +#  define CustomData_to_bmesh_block(srcdata, destdata, i, block, set_default) \
 +    { \
 +      CustomDataLayer *cl = (srcdata)->layers, *cl2 = (destdata)->layers; \
 +      int size = 0; \
 +      if (!*block) { \
 +        *block = BLI_mempool_alloc((destdata)->pool); \
 +      } \
 +      for (int j = 0; j < (srcdata)->totlayer; j++, cl++) { \
 +        if ((destdata)->typemap[cl->type] < 0) { \
 +          continue; \
 +        } \
 +        while (cl2->type != cl->type) { \
 +          cl2++; \
 +        } \
 +        char *ptr = (char *)cl->data; \
 +        size = cl2 != (destdata)->layers ? cl2->offset - (cl2 - 1)->offset : cl2->offset; \
 +        ptr += size * i; \
 +        char *ptr2 = (char *)*block; \
 +        ptr2 += cl2->offset; \
 +        memcpy(ptr2, ptr, size); \
 +        cl2++; \
 +      } \
 +    }
 +#endif
  
+ using blender::Array;
+ using blender::IndexRange;
+ using blender::Span;
+ 
  void BM_mesh_cd_flag_ensure(BMesh *bm, Mesh *mesh, const char cd_flag)
  {
    const char cd_flag_all = BM_mesh_cd_flag_from_bmesh(bm) | cd_flag;
@@@ -239,77 -182,28 +246,70 @@@ char BM_mesh_cd_flag_from_bmesh(BMesh *
  }
  
  /* Static function for alloc (duplicate in modifiers_bmesh.c) */
- static BMFace *bm_face_create_from_mpoly(
-     MPoly *mp, MLoop *ml, BMesh *bm, BMVert **vtable, BMEdge **etable)
+ static BMFace *bm_face_create_from_mpoly(BMesh &bm,
+                                          Span<MLoop> loops,
+                                          Span<BMVert *> vtable,
+                                          Span<BMEdge *> etable)
  {
-   BMVert **verts = (BMVert **)BLI_array_alloca(verts, mp->totloop);
-   BMEdge **edges = (BMEdge **)BLI_array_alloca(edges, mp->totloop);
-   int j;
+   Array<BMVert *, BM_DEFAULT_NGON_STACK_SIZE> verts(loops.size());
+   Array<BMEdge *, BM_DEFAULT_NGON_STACK_SIZE> edges(loops.size());
  
-   for (j = 0; j < mp->totloop; j++, ml++) {
-     verts[j] = vtable[ml->v];
-     edges[j] = etable[ml->e];
+   for (const int i : loops.index_range()) {
+     verts[i] = vtable[loops[i].v];
+     edges[i] = etable[loops[i].e];
    }
  
-   return BM_face_create(
-       bm, verts, edges, mp->totloop, nullptr, (eBMCreateFlag)(BM_CREATE_SKIP_CD | BM_CREATE_SKIP_ID));
+   return BM_face_create(&bm, verts.data(), edges.data(), loops.size(), nullptr, BM_CREATE_SKIP_CD);
  }
  
 -void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshParams *params)
 +void BM_enter_multires_space(Object *ob, BMesh *bm, int space)
 +{
 +  if (!bm->haveMultiResSettings && ob) {
 +    MultiresModifierData *mmd = get_multires_modifier(nullptr, ob, true);
 +    if (mmd) {
 +      bm->multires = *mmd;
 +      bm->haveMultiResSettings = true;
 +      bm->multiresSpace = MULTIRES_SPACE_TANGENT;
 +    }
 +  }
 +
 +  if (!bm->haveMultiResSettings || !CustomData_has_layer(&bm->ldata, CD_MDISPS) ||
 +      space == bm->multiresSpace) {
 +    return;
 +  }
 +
 +  BKE_multires_bmesh_space_set(ob, bm, space);
 +  bm->multiresSpace = space;
 +}
 +
 +#include "BLI_compiler_attrs.h"
 +
 +/**
 + * \brief Mesh -> BMesh
 + * \param ob: object that owns bm, may be nullptr (which will disable multires space change)
 + * \param bm: The mesh to write into, while this is typically a newly created BMesh,
 + * merging into existing data is supported.
 + * Note the custom-data layout isn't used.
 + * If more comprehensive merging is needed we should move this into a separate function
 + * since this should be kept fast for edit-mode switching and storing undo steps.
 + *
 + * \warning This function doesn't calculate face normals.
 + *
 + * Mesh IDs will be imported unless requested.  If the bmesh was created
 + * with id map enabled then IDs will be checked for uniqueness, otherwise
 + * they are imported as is.
 + */
 +
 +void BM_mesh_bm_from_me(Object *ob,
 +                        BMesh *bm,
 +                        const Mesh *me,
 +                        const struct BMeshFromMeshParams *params)
  {
    const bool is_new = !(bm->totvert || (bm->vdata.totlayer || bm->edata.totlayer ||
                                          bm->pdata.totlayer || bm->ldata.totlayer));
-   MVert *mvert;
-   MEdge *medge;
-   MLoop *mloop;
-   MPoly *mp;
    KeyBlock *actkey;
-   BMVert *v, **vtable = nullptr;
-   BMEdge *e, **etable = nullptr;
-   BMFace *f, **ftable = nullptr;
    float(*keyco)[3] = nullptr;
-   int totloops, i;
++
    CustomData_MeshMasks mask = CD_MASK_BMESH;
    CustomData_MeshMasks_update(&mask, &params->cd_mask_extra);
  
@@@ -484,106 -314,49 +484,118 @@@
        }
      }
  
+     int i;
++
      KeyBlock *block;
      for (i = 0, block = static_cast<KeyBlock *>(me->key->block.first); i < tot_shape_keys;
           block = block->next, i++) {
        if (is_new) {
          CustomData_add_l

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list