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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-05 16:18:09 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-05 16:18:09 +0400
commiteb46c080a2d3b71beb626517e30ae2b5f2e60425 (patch)
tree0c4934a6a6321bef7d68995b2f959e2dac8f18f4
parentcd19fd6c28bb976fd1ea7448fcde45fc217e004a (diff)
Fix #32734: Object.to_mesh() gave wrong user count for curves/surface/text objects.
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index b0b76c9e38f..879a77527cd 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -177,6 +177,8 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
return NULL; /* only do basis metaball */
tmpmesh = BKE_mesh_add("Mesh");
+ /* BKE_mesh_add gives us a user count we don't need */
+ tmpmesh->id.us--;
if (render) {
ListBase disp = {NULL, NULL};
@@ -186,6 +188,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
}
else
BKE_mesh_from_metaball(&ob->disp, tmpmesh);
+
break;
}
@@ -214,6 +217,9 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
dm->release(dm);
}
+ /* BKE_mesh_add/copy gives us a user count we don't need */
+ tmpmesh->id.us--;
+
break;
default:
BKE_report(reports, RPT_ERROR, "Object does not have geometry data");
@@ -283,9 +289,6 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
/* cycles and exporters rely on this still */
BKE_mesh_tessface_ensure(tmpmesh);
- /* we don't assign it to anything */
- tmpmesh->id.us--;
-
/* make sure materials get updated in objects */
test_object_materials(&tmpmesh->id);