Page MenuHome

no way to know if a datablock is in editmode
Closed, ResolvedPublic

Description

--- Operating System, Graphics card ---
Windows 7, 64bit

--- Blender version with error ---
r57892

--- Short description of error ---
If object is mode=='EDIT', bm.from_edit_mesh(me) is used to wrap the bmesh, is_wrapped should therefore be True.

If it's wrapped, bmesh.update_edit_mesh(me) needs to be called to flush changes instead of bm.to_mesh().

But neither works if a mesh object, that is a linked duplicate (same mesh datablock), is in editmode!


--- Steps for others to reproduce the error (preferably based on attached .blend file) ---

Duplicate the default cube and run attached script. Enter edit mode and re-run. All fine.

Duplicate again and tick "Linked" in redo panel. Enter edit mode and re-run - it will complain about mesh being in editmode.

If you invert the condition to "if bm.is_wrapped", it will complain about mesh NOT being in editmode - so there is no way to write back changes!

It should be possible to do so without switching mode.

Event Timeline

I think the real problem is that checking ob.mode == 'EDIT' is wrong, Blender only has one object in edit mode. Problem is there doesn't seem to be a way to check this, except for running bm.from_edit_mesh and seeing if an exception is generated.

added 'is_editmode' property to meshes and other datatypes which support editmode r57980.
closing.

Campbell Barton (campbellbarton) changed the task status from Unknown Status to Resolved.Jul 4 2013, 12:58 AM