#!BPY """ Name: 'Blend Vertices' Blender: 248.1 Group: 'Mesh' Tooltip: 'Copy selected vertex positions from one object to another' """ __author__ = "Ivo Grigull" __url__ = ["www.ivogrigull.com"] __version__ = "0.1" __bpydoc__ = """\ Blend Vertices - Copy selected vertex positions from one object to another -------------------------------------------------------------------- Menu: Mesh->Scripts->Blend Vertices This script copies vertex positions between two objects. Both objects need to have the same topology (i.e. created as a copy of the other). This script is useful for modelling shapes (if you do them as seperate obejcts) to revert changes to the original mesh. Usage: In Object.Mode first Select the source obejct, then the target object. Enter Edit-Mode and select some vertices on the target mesh. Execute the script. In the popup menu you can set a blend factor if you want to blend only a little bit. # -------------------------------------------------------------------------- # ***** BEGIN GPL LICENSE BLOCK ***** # # 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 ***** # """ import Blender from Blender import Window def blend( fact ): in_editmode = Window.EditMode() if in_editmode: Window.EditMode(0) sel = Blender.Object.GetSelected() target = sel[0].getData(mesh=1) source = sel[1].getData(mesh=1) print 'Target: %s Source %s' % (sel[0].name, sel[1].name ) verts = target.verts verts_sel= [f for f in verts if f.sel] for n in verts_sel: v1 = target.verts[ n.index ].co v2 = source.verts[ n.index ].co v1 -= v2 v1 *= 1-fact v1 += v2 target.verts[ n.index ].co = v1 target.update() Blender.Redraw() if in_editmode: Window.EditMode(1) def main(): sel = Blender.Object.GetSelected() if len(sel) < 2: print 'First select two objects please' return fac = Blender.Draw.Create( 1.0 ) block = [] block.append("Amount") block.append(("Value: ", fac, 0.0, 1.0)) retval = Blender.Draw.PupBlock("Blend vertices", block) blend( fac.val ) main()