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

@@@ -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);
@@@ -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;
@@@ -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;
@@@ -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;
  
@@@ -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;
  
@@@ -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);
@@@ -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;
  }
  
  #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,