Commit: 31e8634dacdbf05e83fa72907e592bd3e7951cf2
Author: Martin Felke
Date:   Mon Dec 10 17:28:25 2018 +0100
Branches: temp-fracture-modifier-2.8
https://developer.blender.org/rB31e8634dacdbf05e83fa72907e592bd3e7951cf2

Merge remote-tracking branch 'origin/blender2.8' into fracture_modifier-2.8

# Conflicts:
#       source/blender/modifiers/intern/MOD_boolean.c

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



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

diff --cc release/scripts/addons
index be2df524910,f89d1c9581c..0c24f02293d
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit be2df5249105015aaafb06def0d1279c559c56ff
 -Subproject commit f89d1c9581c03160485a7b4b09fa5d538331fdeb
++Subproject commit 0c24f02293da33e50cf79f125545a3089b75754f
diff --cc release/scripts/addons_contrib
index 41d528d76b9,41d528d76b9..5f6f675fc19
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@@ -1,1 -1,1 +1,1 @@@
--Subproject commit 41d528d76b99e689e09915f5dcd589480579ef3a
++Subproject commit 5f6f675fc196949ac9210dc5094bed6ab65300a7
diff --cc source/blender/blenkernel/intern/boolean.c
index 3e70de314f4,840cee6f630..f9f4de563fa
--- a/source/blender/blenkernel/intern/boolean.c
+++ b/source/blender/blenkernel/intern/boolean.c
@@@ -36,241 -64,323 +36,242 @@@
  #include "bmesh.h"
  #include "bmesh_tools.h"
  #include "tools/bmesh_intersect.h"
 +#include "BKE_cdderivedmesh.h"
  
  #ifdef DEBUG_TIME
 -#  include "PIL_time.h"
 -#  include "PIL_time_utildefines.h"
 +#include "PIL_time.h"
 +#include "PIL_time_utildefines.h"
  #endif
  
 -static void initData(ModifierData *md)
 -{
 -      BooleanModifierData *bmd = (BooleanModifierData *)md;
 -
 -      bmd->double_threshold = 1e-6f;
 -}
 +#include "DNA_material_types.h"
 +#include "DNA_mesh_types.h"
 +#include "DNA_meshdata_types.h"
 +#include "DNA_object_types.h"
 +#include "DNA_modifier_types.h"
 +#include "BLI_utildefines.h"
  
 -static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, 
bool UNUSED(useRenderParams))
 -{
 -      BooleanModifierData *bmd = (BooleanModifierData *) md;
 +#include "BKE_boolean.h"
 +#include "BKE_mesh.h"
 +#include "BKE_library.h"
  
 -      return !bmd->object;
 -}
 +/* has no meaning for faces, do this so we can tell which face is which */
 +#define BM_FACE_TAG BM_ELEM_DRAW
  
 -static void foreachObjectLink(
 -        ModifierData *md, Object *ob,
 -        ObjectWalkFunc walk, void *userData)
 +/**
 + * Compare selected/unselected.
 + */
 +static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data))
  {
 -      BooleanModifierData *bmd = (BooleanModifierData *) md;
 -
 -      walk(userData, ob, &bmd->object, IDWALK_CB_NOP);
 +      return BM_elem_flag_test(f, BM_FACE_TAG) ? 1 : 0;
  }
  
 -static void updateDepsgraph(ModifierData *md, const 
ModifierUpdateDepsgraphContext *ctx)
 -{
 -      BooleanModifierData *bmd = (BooleanModifierData *)md;
 -      if (bmd->object != NULL) {
 -              DEG_add_object_relation(ctx->node, bmd->object, 
DEG_OB_COMP_TRANSFORM, "Boolean Modifier");
 -              DEG_add_object_relation(ctx->node, bmd->object, 
DEG_OB_COMP_GEOMETRY, "Boolean Modifier");
 -      }
 -      /* We need own transformation as well. */
 -      DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, 
"Boolean Modifier");
 -}
  
  static Mesh *get_quick_mesh(
--        Object *ob_self,  Mesh *mesh_self,
--        Object *ob_other, Mesh *mesh_other,
--        int operation)
++              Object *ob_self,  Mesh *mesh_self,
++              Object *ob_other, Mesh *mesh_other,
++              int operation)
  {
-     Mesh *result = NULL;
- 
-     if (mesh_self->totpoly == 0 || mesh_other->totpoly == 0) {
-         switch (operation) {
-             case eBooleanModifierOp_Intersect:
-                 result = BKE_mesh_new_nomain(0, 0, 0, 0, 0);
-                 break;
- 
-             case eBooleanModifierOp_Union:
-                 if (mesh_self->totpoly != 0) {
-                     result = mesh_self;
-                 }
-                 else {
-                     BKE_id_copy_ex(NULL, &mesh_other->id, (ID **)&result,
-                                    LIB_ID_CREATE_NO_MAIN |
-                                    LIB_ID_CREATE_NO_USER_REFCOUNT |
-                                    LIB_ID_CREATE_NO_DEG_TAG |
-                                    LIB_ID_COPY_NO_PREVIEW,
-                                    false);
- 
-                     float imat[4][4];
-                     float omat[4][4];
- 
-                     invert_m4_m4(imat, ob_self->obmat);
-                     mul_m4_m4m4(omat, imat, ob_other->obmat);
- 
-                     const int mverts_len = result->totvert;
-                     MVert *mv = result->mvert;
- 
-                     for (int i = 0; i < mverts_len; i++, mv++) {
-                         mul_m4_v3(omat, mv->co);
-                     }
- 
-                     result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
-                 }
- 
-                 break;
- 
-             case eBooleanModifierOp_Difference:
-                 result = mesh_self;
-                 break;
-         }
-     }
- 
-     return result;
+       Mesh *result = NULL;
+ 
+       if (mesh_self->totpoly == 0 || mesh_other->totpoly == 0) {
+               switch (operation) {
+                       case eBooleanModifierOp_Intersect:
+                               result = BKE_mesh_new_nomain(0, 0, 0, 0, 0);
+                               break;
+ 
+                       case eBooleanModifierOp_Union:
+                               if (mesh_self->totpoly != 0) {
+                                       result = mesh_self;
+                               }
+                               else {
+                                       BKE_id_copy_ex(NULL, &mesh_other->id, 
(ID **)&result,
 -                                                     LIB_ID_CREATE_NO_MAIN |
 -                                                     
LIB_ID_CREATE_NO_USER_REFCOUNT |
 -                                                     LIB_ID_CREATE_NO_DEG_TAG 
|
 -                                                     LIB_ID_COPY_NO_PREVIEW,
 -                                                     false);
++                                                                 
LIB_ID_CREATE_NO_MAIN |
++                                                                 
LIB_ID_CREATE_NO_USER_REFCOUNT |
++                                                                 
LIB_ID_CREATE_NO_DEG_TAG |
++                                                                 
LIB_ID_COPY_NO_PREVIEW,
++                                                                 false);
+ 
+                                       float imat[4][4];
+                                       float omat[4][4];
+ 
+                                       invert_m4_m4(imat, ob_self->obmat);
+                                       mul_m4_m4m4(omat, imat, 
ob_other->obmat);
+ 
+                                       const int mverts_len = result->totvert;
+                                       MVert *mv = result->mvert;
+ 
+                                       for (int i = 0; i < mverts_len; i++, 
mv++) {
+                                               mul_m4_v3(omat, mv->co);
+                                       }
+ 
+                                       result->runtime.cd_dirty_vert |= 
CD_MASK_NORMAL;
+                               }
+ 
+                               break;
+ 
+                       case eBooleanModifierOp_Difference:
+                               result = mesh_self;
+                               break;
+               }
+       }
+ 
+       return result;
  }
  
 -
 -/* has no meaning for faces, do this so we can tell which face is which */
 -#define BM_FACE_TAG BM_ELEM_DRAW
 -
 -/**
 - * Compare selected/unselected.
 - */
 -static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data))
 -{
 -      return BM_elem_flag_test(f, BM_FACE_TAG) ? 1 : 0;
 -}
 -
 -static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, 
Mesh *mesh)
 +Mesh *BKE_boolean_operation(Mesh *mesh, struct Object *ob,
-                                  Mesh *mesh_other, struct Object *ob_other, 
int op_type,
-                                  float double_threshold, struct 
BooleanModifierData *bmd)
++                                                               Mesh 
*mesh_other, struct Object *ob_other, int op_type,
++                                                               float 
double_threshold, struct BooleanModifierData *bmd)
  {
-     Mesh *result = mesh;
 -      BooleanModifierData *bmd = (BooleanModifierData *) md;
+       Mesh *result = mesh;
  
-     if (mesh_other) {
-         Object *object = ob;
-         Object *other = ob_other;
 -      Mesh *mesh_other;
 -      bool mesh_other_free;
 -
 -      if (bmd->object == NULL) {
 -              return result;
 -      }
 -
 -      Object *other = DEG_get_evaluated_object(ctx->depsgraph, bmd->object);
 -      mesh_other = 
BKE_modifier_get_evaluated_mesh_from_evaluated_object(other, &mesh_other_free);
+       if (mesh_other) {
 -              Object *object = ctx->object;
++              Object *object = ob;
++              Object *other = ob_other;
  
-         /* when one of objects is empty (has got no faces) we could speed up
-          * calculation a bit returning one of objects' derived meshes (or 
empty one)
-          * Returning mesh is depended on modifiers operation (sergey) */
-         result = get_quick_mesh(object, mesh, other, mesh_other, op_type);
+               /* when one of objects is empty (has got no faces) we could 
speed up
+                * calculation a bit returning one of objects' derived meshes 
(or empty one)
+                * Returning mesh is depended on modifiers operation (sergey) */
 -              result = get_quick_mesh(object, mesh, other, mesh_other, 
bmd->operation);
++              result = get_quick_mesh(object, mesh, other, mesh_other, 
op_type);
  
-         if (result == NULL) {
-             const bool is_flip = (is_negative_m4(object->obmat) != 
is_negative_m4(other->obmat));
+               if (result == NULL) {
+                       const bool is_flip = (is_negative_m4(object->obmat) != 
is_negative_m4(other->obmat));
  
-             BMesh *bm;
-             const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(mesh, 
mesh_other);
+                       BMesh *bm;
+                       const BMAllocTemplate allocsize = 
BMALLOC_TEMPLATE_FROM_ME(mesh, mesh_other);
  
  #ifdef DEBUG_TIME
-             TIMEIT_START(boolean_bmesh);
+                       TIMEIT_START(boolean_bmesh);
  #endif
-             bm = BM_mesh_create(
-                      &allocsize,
-                      &((struct BMeshCreateParams){.use_toolflags = false,}));
- 
-             BM_mesh_bm_from_me(bm, mesh_other, &((struct 
BMeshFromMeshParams){.calc_face_normal = true,}));
- 
-             if (UNLIKELY(is_flip)) {
-                 const int cd_loop_mdisp_offset = 
CustomData_get_offset(&bm->ldata, CD_MDISPS);
-                 BMIter iter;
-                 BMFace *efa;
-                 BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
-                     BM_face_normal_flip_ex(bm, efa, cd_loop_mdisp_offset, 
true);
-                 }
-             }
- 
-             BM_mesh_bm_from_me(bm, mesh, &((struct 
BMeshFromMeshParams){.calc_face_normal = true,}));
- 
-             /* main bmesh intersection setup */
-             {
-                 /* create tessface & intersect */
-                 const int looptris_tot = poly_to_tri_count(bm->totface, 
bm->totloop);
-                 int tottri;
-                 BMLoop *(*looptris)[3];
- 
-                 looptris = MEM_malloc_arrayN(looptris_tot, sizeof(*looptris), 
__func__);
- 
-                 BM_mesh_calc_tessellation_beauty(bm, looptris, &tottri);
- 
-                 /* postpone this until after tessellating
-                  * so we can use the original normals before the vertex are 
moved */
-                 {
-                     BMIter iter;
-                     int i;
-                     const int i_verts_end = mesh_other->totvert;
-                     const int i_faces_end = mesh_other->totpoly;
- 
-                     float imat[4][4];
-  

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to