Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 15 Jun 2017 13:54:11 +0000 (15:54 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 15 Jun 2017 13:54:11 +0000 (15:54 +0200)
Conflicts:
source/blender/collada/MeshImporter.cpp
source/blender/editors/object/object_add.c
source/blender/editors/screen/screen_edit.c

1  2 
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenloader/intern/versioning_defaults.c
source/blender/collada/DocumentImporter.cpp
source/blender/collada/MeshImporter.cpp
source/blender/editors/object/object_add.c
source/blender/editors/object/object_group.c
source/blender/editors/space_outliner/outliner_tools.c

index 616c254a6eaf7edb3cc683dafc6fb7a53e94e90e,6ca53c64299e75f89f98ed295b3b96a79792c261..9c95d4de6951a909d172372ff396e5b2b06c97d9
@@@ -1156,8 -1173,13 +1156,9 @@@ Object *MeshImporter::create_mesh_objec
        BKE_mesh_assign_object(ob, new_mesh);
        BKE_mesh_calc_normals(new_mesh);
  
-       if (old_mesh->id.us == 0) BKE_libblock_free(G.main, old_mesh);
-       
+       id_us_plus(&old_mesh->id);  /* Because BKE_mesh_assign_object would have already decreased it... */
+       BKE_libblock_free_us(G.main, old_mesh);
 -      char layername[100];
 -      layername[0] = '\0';
 -      MTFace *texture_face = NULL;
 -      
        COLLADAFW::MaterialBindingArray& mat_array =
            geom->getMaterialBindings();
        
index 33af8f94d048771ddf0a24075aa39743659f699e,a901560079aebb63f946f0ad5ab4ee1c15602126..e8343dce384e6e07068b9cbd87db49f3f4797ae0
@@@ -1738,8 -1677,21 +1738,21 @@@ static int convert_exec(bContext *C, wm
         * on other objects data masks too, see: T50950. */
        {
                for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
--                      Base *base = link->ptr.data;
++                      BaseLegacy *base = link->ptr.data;
+                       ob = base->object;
+                       /* The way object type conversion works currently (enforcing conversion of *all* objetcs using converted
+                        * obdata, even some un-selected/hidden/inother scene ones, sounds totally bad to me.
+                        * However, changing this is more design than bugfix, not to mention convoluted code below,
+                        * so that will be for later.
+                        * But at the very least, do not do that with linked IDs! */
+                       if ((ID_IS_LINKED_DATABLOCK(ob) || ID_IS_LINKED_DATABLOCK(ob->data)) && !keep_original) {
+                               keep_original = true;
+                               BKE_reportf(op->reports, RPT_INFO,
+                                           "Converting some linked object/object data, enforcing 'Keep Original' option to True");
+                       }
 -                      DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
 +                      DEG_id_tag_update(&base->object->id, OB_RECALC_DATA);
                }
  
                uint64_t customdata_mask_prev = scene->customdata_mask;
        }
  
        for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
--              Base *base = link->ptr.data;
++              BaseLegacy *base = link->ptr.data;
                ob = base->object;
  
                if (ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {