I need to create a convex hull over my objects, render an image and then delete that hull again. My idea was to store the object, the object data or the mesh itself then create the hull and render the image and then just replace the object/data/mesh with the stored data.

For example first i´d do

self.backup[obj.name] = obj.data

and then after full & rendering i´d like to do something like

orig_data= self.backup[obj.name]
obj.data = orig_data

But this is not restoring the previous data, the hull remains. I´m guessing right now I just store links instead of real data but I don´t know how to fix this because I don´t really know much about different blender data types etc.

After trying to replace the objects mesh, data and the object itself and none of it worked I sort of ran out of ideas. I´d be glad about any input =)

PS: I´m using 2.8. in case that makes any difference.


Make a copy

simple answer is `

self.backup[obj.name] = obj.data.copy()

without making a copy you had a reference to the same mesh. If you are using bpy.ops.mesh.convex_hull suggest instead using bmesh see

Is there any way to make multiple objects convex hulls?

Convex Hull as Mesh

The data is already stored for us in the blend file data,

me = context.object.data

which without any renaming of meshes inbetween is still


Hence could simply keep the name, make a new mesh with another name for convex hull and swap using meshes retrieved via names.

If after creating a convex hull mesh and want to have it available permanently An approach to consider would be giving a mesh object a pointer property to the mesh of its convex hull.

bpy.props.Object.convex_hull_mesh = PointerProperty(type=bpy.types.Mesh)

create convex hull mesh and assign it to this property to save it. Another boolean property could be used as a flag to swap between original and convex hull mesh.

  • $\begingroup$ That´s exactly what I´ve been searching for, thank you! And thanks for the additional info as well, I didn´t know property pointers exist and it looks like a way better approach! =) $\endgroup$ – ItsMeTheBee Oct 9 '20 at 12:18
  • $\begingroup$ Have been doing this very thing with both convex hulls and bounding boxes. 8*) $\endgroup$ – batFINGER Oct 9 '20 at 12:23
  • $\begingroup$ Oh did you generate training data for neural nets as well? Cause that´s what I´m doing right now :D $\endgroup$ – ItsMeTheBee Oct 9 '20 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.