All pastes #79366 Raw Edit

Something

public python v1 · immutable
·published 2006-07-05 07:59 UTC
rendered paste body
#!BPY"""Name: 'SelectArea 0.10'Blender: 241Group: 'Mesh'Tooltip: 'Selects verts within the selected area.'"""__author__ = "BeBraw"__url__ = ("")__version__ = "0.10 04.07.06"__bpydoc__ = """\Selects the verts within the selected area.Usage:Select area and execute the script.Tips:"""############################################################## Code history                                              ###############################################################	version 0.10 released 04.07.06# --------------------------------------------------------------------------# ***** BEGIN GPL LICENSE BLOCK *****## Copyright (C) 2006: BeBraw## This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2# of the License, or (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software Foundation,# Inc, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.## ***** END GPL LICENCE BLOCK *****# --------------------------------------------------------------------------'''Current issues:TODO:'''import Blenderfrom Blender import NMesh, WindowinEmode = Window.EditMode()if inEmode:	Window.EditMode(0)#get edges of selected objectselectedObject = Blender.Object.GetSelected()me = selectedObject[0].getData()edges = me.edges#get selected verts and their references to neighboursvertsAndTheirReferencesToNeighbourVerts = {}for e in edges:    if e.v1.sel == 1:        if e.v1 in vertsAndTheirReferencesToNeighbourVerts:      references = vertsAndTheirReferencesToNeighbourVerts[e.v1]      references.append(e.v2)      vertsAndTheirReferencesToNeighbourVerts[e.v1] = references    else:      vertsAndTheirReferencesToNeighbourVerts[e.v1] = [e.v2]  if e.v2.sel == 1:    if e.v2 in vertsAndTheirReferencesToNeighbourVerts:      references = vertsAndTheirReferencesToNeighbourVerts[e.v2]      references.append(e.v1)      vertsAndTheirReferencesToNeighbourVerts[e.v2] = references    else:      vertsAndTheirReferencesToNeighbourVerts[e.v2] = [e.v1]    #calculate neighbour verts' references to selected vertsamountOfReferencesToSelectedVerts = {}for vert, references in vertsAndTheirReferencesToNeighbourVerts.iteritems():  for r in references:    if r in amountOfReferencesToSelectedVerts:      amountOfReferencesToSelectedVerts[r] += 1    else:      amountOfReferencesToSelectedVerts[r]  = 1#select those that have 2>= referencesspareDict = {}for vert, amountOfReferences in amountOfReferencesToSelectedVerts.iteritems():  if amountOfReferences >= 2:    spareDict[vert] = amountOfReferencesamountOfReferencesToSelectedVerts = spareDictdel spareDict#split them to groups that do not surpass selected verts by seeking paths#form selections recursively until verts can no longer can be selected#ask the user which group to select?#select vertsfor vert, amountOfRefs in amountOfReferencesToSelectedVerts.iteritems():		vert.sel = 1		me.update()if inEmode:		Window.EditMode(0)	Window.EditMode(1)Blender.Redraw()