How can I deselect a face/poly. The 2.62 way no longer works

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

karljj1
Posts: 5
Joined: Wed May 25, 2011 9:32 pm

How can I deselect a face/poly. The 2.62 way no longer works

Postby karljj1 » Sat Sep 29, 2012 5:53 pm

Hi,

I have a script i am porting over from 2.62 to 2.63. In my script i go through an objects faces and select/deselect based on some criteria. However i have found that deselecting a face/polygon does not work as i expect.

E.G

myFace.select = False

When I examine the face in blender I can see that the face appears to not be selected however it has a yellow outline as if the edges are selected. When I perform an operation on the mesh it treats the face as selected. If I set a face to selected = True it works as 2.62 however the de selection seems to have changed and I cant figure out how to do it. I have tried deselecting the verts and edges but it has no effect.

So how can I deselect a polygon in blender 2.63?

Thanks

Karl

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Mon Oct 01, 2012 3:53 pm

switch to object mode, set polygons[n].select = False, switch back to edit mode

or: use bmesh api

Code: Select all

import bmesh
ob = bpy.context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)
bm.faces[n].select_set(False) # you may use select = False, but make sure you flush selection (see docs)
I'm sitting, waiting, wishing, building Blender in superstition...


Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest