Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2017-06-15 16:40:24 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-06-15 16:47:16 +0300
commit880e96dd667aedea17353803bcc5721f3cc34d50 (patch)
treed1d78b999b51dc648fb5f2d95a912d3c150b7cd5 /source/blender/blenkernel/intern/mesh.c
parent9e0a253ea161634c03325b6fac16e09ba636fe8a (diff)
Fix/workaround 'convert object' messing up linked data.
'Convert To...' Object operation has very weird effect of actually working at obdata level, not object level, which means *all* objects (even unselected/hidden/in other scenes/...) using same obdata will be converted to new selected type. IMHO this is very bad behavior, but... not a bug really, so do not change this for now. But at least, do not do that when working on some linked data, else it leaves Blend file in invalid (incoherent) state until next reload. So workaround for now is to enforce the 'Keep Original' option when some linked object/obdata is affected by the operation. Also fixed somewhat broken usercount handling in Curve->Mesh part.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r--source/blender/blenkernel/intern/mesh.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 89e988782d2..171ae4485a0 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1398,9 +1398,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use
cu->mat = NULL;
cu->totcol = 0;
- if (ob->data) {
- BKE_libblock_free_us(bmain, ob->data);
- }
+ /* Do not decrement ob->data usercount here, it's done at end of func with BKE_libblock_free_us() call. */
ob->data = me;
ob->type = OB_MESH;
@@ -1410,11 +1408,14 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use
if (ob1->data == cu) {
ob1->type = OB_MESH;
+ id_us_min((ID *)ob1->data);
ob1->data = ob->data;
- id_us_plus((ID *)ob->data);
+ id_us_plus((ID *)ob1->data);
}
ob1 = ob1->id.next;
}
+
+ BKE_libblock_free_us(bmain, cu);
}
void BKE_mesh_from_nurbs(Object *ob)