Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Wed, 13 Jun 2018 14:42:56 +0000 (16:42 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Wed, 13 Jun 2018 14:42:56 +0000 (16:42 +0200)
Conflicts:
source/blender/blenloader/intern/readfile.c
source/blender/editors/mesh/editmesh_utils.c
source/blenderplayer/bad_level_call_stubs/stubs.c

19 files changed:
1  2 
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/intern/bmesh_mesh_conv.c
source/blender/collada/collada_utils.cpp
source/blender/editors/include/ED_mesh.h
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/editmesh_undo.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_relations.c
source/blender/editors/sculpt_paint/paint_image_proj.c
source/blender/makesrna/intern/rna_object.c
source/blender/modifiers/intern/MOD_edgesplit.c
source/blender/python/bmesh/bmesh_py_types.c

index b325d8d02d9336cc0413ffcd09900a0d50214477,770d482b33b2ee136bcaa4fc19e7fc88817a96c3..e83f2d92dd917f82facc067724e13d6629effb2c
@@@ -712,27 -545,6 +712,28 @@@ BMesh *BKE_mesh_to_bmesh_ex
        return bm;
  }
  
-       BM_mesh_bm_to_me(bm, mesh, params);
 +BMesh *BKE_mesh_to_bmesh(
 +        Mesh *me, Object *ob,
 +        const bool add_key_index, const struct BMeshCreateParams *params)
 +{
 +      return BKE_mesh_to_bmesh_ex(
 +              me, params,
 +              &(struct BMeshFromMeshParams){
 +                  .calc_face_normal = false,
 +                  .add_key_index = add_key_index,
 +                  .use_shapekey = true,
 +                  .active_shapekey = ob->shapenr,
 +              });
 +}
 +
 +Mesh *BKE_bmesh_to_mesh_nomain(BMesh *bm, const struct BMeshToMeshParams *params)
 +{
++      BLI_assert(params->calc_object_remap == false);
 +      Mesh *mesh = BKE_id_new_nomain(ID_ME, NULL);
++      BM_mesh_bm_to_me(NULL, bm, mesh, params);
 +      return mesh;
 +}
 +
  void BKE_mesh_make_local(Main *bmain, Mesh *me, const bool lib_local)
  {
        BKE_id_make_local_generic(bmain, &me->id, true, lib_local);
index bbc9471638d4ab509e37f79f5ac4639d58e9352a,e1303b14f0e9dbd94ec59f8c8c6d9410068e42b5..e18758a5a58ca87161aa507d437ee86174ef4982
@@@ -43,6 -43,8 +43,7 @@@
  
  #include "BKE_DerivedMesh.h"
  #include "BKE_context.h"
 -#include "BKE_depsgraph.h"
+ #include "BKE_main.h"
  #include "BKE_mesh.h"
  #include "BKE_mesh_mapping.h"
  #include "BKE_report.h"
@@@ -328,9 -324,9 +329,9 @@@ void EDBM_mesh_make(Object *ob, const i
  
  /**
   * \warning This can invalidate the #DerivedMesh cache of other objects (for linked duplicates).
 - * Most callers should run #DAG_id_tag_update on \a ob->data, see: T46738, T46913
 + * Most callers should run #DEG_id_tag_update on \a ob->data, see: T46738, T46913
   */
- void EDBM_mesh_load(Object *ob)
+ void EDBM_mesh_load(Main *bmain, Object *ob)
  {
        Mesh *me = ob->data;
        BMesh *bm = me->edit_btmesh->bm;
index d2410c7d97bbde0bb019f0b24106bb311a4ebbc3,fc74397010ccdef32c7a9a7f4627315074e39e51..46b84f328cc50e4d776491a6d984f9d703006925
@@@ -577,8 -602,10 +578,8 @@@ static int drop_named_image_invoke(bCon
        if (me->edit_btmesh == NULL)
                return OPERATOR_CANCELLED;
  
 -      ED_uvedit_assign_image(bmain, scene, obedit, ima, NULL);
 -
        if (exitmode) {
-               EDBM_mesh_load(obedit);
+               EDBM_mesh_load(bmain, obedit);
                EDBM_mesh_free(me->edit_btmesh);
                MEM_freeN(me->edit_btmesh);
                me->edit_btmesh = NULL;
index 0ce1294432159da725fb45dd9584b61495836ab0,94ec87556161ffda3e79bb765f1f16b96b016776..6a3cb9aa0979e6d5141c46d7f1cde0b7f638bad5
@@@ -318,10 -315,10 +318,10 @@@ static bool object_hook_index_array(Mai
  
                        BMEditMesh *em;
  
-                       EDBM_mesh_load(obedit);
+                       EDBM_mesh_load(bmain, obedit);
                        EDBM_mesh_make(obedit, scene->toolsettings->selectmode, true);
  
 -                      DAG_id_tag_update(obedit->data, 0);
 +                      DEG_id_tag_update(obedit->data, 0);
  
                        em = me->edit_btmesh;
  
index 84e3e63fede6ee00ad2a1b7927da3ceb8152e433,8abbb5359810424d62106f15e9647d2dea1ec0ff..a114b2cc6d547ae963df239274838796c505c1cf
@@@ -145,10 -139,10 +145,10 @@@ static int vertex_parent_set_exec(bCont
                Mesh *me = obedit->data;
                BMEditMesh *em;
  
-               EDBM_mesh_load(obedit);
+               EDBM_mesh_load(bmain, obedit);
                EDBM_mesh_make(obedit, scene->toolsettings->selectmode, true);
  
 -              DAG_id_tag_update(obedit->data, 0);
 +              DEG_id_tag_update(obedit->data, 0);
  
                em = me->edit_btmesh;
  
index f74651f35f26362a021db2657e73c81f064b97e1,87c9291af8d7744ca25e7097d64536c9d73f17b2..a9b87ea0703cb124fd1058e23c563b4af4aea2f0
@@@ -278,10 -273,10 +278,10 @@@ static void rna_Object_active_shape_upd
                /* exit/enter editmode to get new shape */
                switch (ob->type) {
                        case OB_MESH:
-                               EDBM_mesh_load(ob);
+                               EDBM_mesh_load(bmain, ob);
                                EDBM_mesh_make(ob, scene->toolsettings->selectmode, true);
  
 -                              DAG_id_tag_update(ob->data, 0);
 +                              DEG_id_tag_update(ob->data, 0);
  
                                EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_btmesh);
                                BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_btmesh);
index e8ffddbde4e1d5c4bda6a01304a869f124558922,a0d717f1c0f303f02dadcb154c54f6c4e0a2a7f3..e1806dc82830f3d12e2986ef0824f908f185fed4
@@@ -107,11 -96,10 +107,10 @@@ static Mesh *doEdgeSplit(Mesh *mesh, Ed
  
        /* BM_mesh_validate(bm); */ /* for troubleshooting */
  
-       result = BKE_id_new_nomain(ID_ME, mesh->id.name);
-       BM_mesh_bm_to_me(bm, result, &((struct BMeshToMeshParams){0}));
 -      result = CDDM_from_bmesh(bm, true);
++      result = BKE_bmesh_to_mesh_nomain(bm, &((struct BMeshToMeshParams){0}));
        BM_mesh_free(bm);
  
 -      result->dirty |= DM_DIRTY_NORMALS;
 +      result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
        return result;
  }
  
index c6a67a1b2ddf547a4d039e6e6608170dd167caf2,07c255c4abefc93ed984fa5238c647ad34b70e57..c2d159538cb05df60d92f03aac134cb92883e3a1
  #include "DNA_object_types.h"
  #include "DNA_material_types.h"
  
 -#include "BKE_depsgraph.h"
  #include "BKE_customdata.h"
  #include "BKE_DerivedMesh.h"
+ #include "BKE_global.h"
  
 +#include "DEG_depsgraph.h"
 +
  #include "bmesh.h"
  
  #include <Python.h>
@@@ -902,7 -902,11 +903,8 @@@ static PyObject *bpy_bmesh_to_mesh(BPy_
  
        bm = self->bm;
  
 -      /* python won't ensure matching uv/mtex */
 -      BM_mesh_cd_validate(bm);
 -
        BM_mesh_bm_to_me(
+               G.main,  /* XXX UGLY! */
                bm, me,
                (&(struct BMeshToMeshParams){
                    .calc_object_remap = true,