Page MenuHome

Addon: Bolt Factory: Corrected resource leak when adding in EDIT mode
ClosedPublic

Authored by Robert Meerman (meermanr) on Jan 7 2021, 6:39 PM.

Details

Summary

Addon: Bolt Factory: Corrected resource leak when adding in EDIT mode

Adding a bolt while in edit mode would *replace* the current object's mesh data block with a new one, and then fail to remove the original mesh data block.

Now the original mesh is updated in-place, preserving its name and avoiding orphan data blocks.

Diff Detail

Event Timeline

Robert Meerman (meermanr) requested review of this revision.Jan 7 2021, 6:39 PM
Robert Meerman (meermanr) created this revision.

Video showing how the original mesh data block becomes orphaned by adding a Bolt in edit mode, and how the object's mesh is replaced with one with an unexpected name.

Vladimir Spivak (cwolf3d) added a comment.EditedJan 8 2021, 11:35 AM

Thanks for your work!
A very good patch. Unfortunately, the ability to set coordinates and rotation is lost when adding in edit mode.

@Vladimir Spivak (cwolf3d) I'm not sure if you meant the same, but you should commit on their behalf so they get the credit (see the wiki for instructions).

This revision is now accepted and ready to land.Jan 8 2021, 12:03 PM

This patch has an approved status yet it was not committed yet. So I'm assuming the other reviewers are blocking. Updating the reviewers list to reflect that. This way the patch show as pending still.

This revision now requires review to proceed.Mar 26 2021, 5:23 PM

I'm getting an error testing this on Blender 3.0

It maybe an API change since this patch was made

bmesh.update_edit_mesh(obj.data, True, True) # Flush changes (update edit mode's view)
TypeError: update_edit_mesh() takes at most 1 positional argument (3 given)

OK the fix is this

bmesh.update_edit_mesh(obj.data) # Flush changes (update edit mode's view)

This revision is now accepted and ready to land.Feb 14 2022, 4:17 AM

Thanks for the Patch

Sorry the commit is late

201b8271b907