[Bf-committers] NMVert.sel problem ?

Willian Padovani Germano bf-committers@blender.org
Mon, 2 Aug 2004 09:13:43 -0300


Hi Todd,

----- Original Message -----
From: <zaz@visi.com>
To: <bf-committers@blender.org>
Sent: Sunday, August 01, 2004 11:03 PM
Subject: [Bf-committers] NMVert.sel problem ?

> The behavior I'm seeing makes me believe the NMVert.sel instance variable
> is only getting set upon leaving (maybe entering) edit mode on the mesh.

This is known, there are two meshes: the normal and the edit mode one.  When
you leave edit mode, the normal is reconstructed based on the edit mode one.
So, if a script makes changes to a mesh while it is in edit mode, those
changes will be lost when the user leaves edit mode.  It has always been
like this, so you should first leave edit mode before using NMesh to change
that mesh.  You're seeing the problem now because the Mesh->Scripts menu
only appears while in edit mode.

A new function was added to let scripts control this:
Blender.Window.EditMode(), to check, leave and enter it.  The "Mesh" scripts
under cvs have been updated already (only needed for those that actually
change the currently active mesh).

# before you GetRaw or ob.getData() a mesh:
is_editmode = Blender.Window.EditMode() # check
if is_editmode: Blender.Window.EditMode(0) # leave (also saves mesh in undo
stack)
# ... make your changes to the nmesh, then before leaving you can
if is_editmode: Blender.Window.EditMode(1) # enter again

--
Willian, wgermano@ig.com.br