3
""" Registration info for Blender menus: <- these words are ignored
4
Name: 'Fix From Everything'
7
Tip: 'Fix armature/lattice/RVK/curve deform and taper/soft body deformation (without bake)'
10
__author__ = "Jean-Michel Soler (jms)"
11
__url__ = ("blender", "elysiun",
12
"Script's homepage, http://jmsoler.free.fr/util/blenderfile/py/fixfromarmature.py",
13
"Communicate problems and errors, http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender")
14
__version__ = "06/2005"
17
This script creates a copy of the active mesh with deformations fixed.
21
Select the deformed mesh and run this script. A fixed copy of it will be created.
24
# $Id: fixfromarmature.py,v 1.8 2005/06/11 05:30:13 ianwill Exp $
26
#----------------------------------------------
27
# jm soler 05/2004-->04/2005 : 'FixfromArmature'
28
#----------------------------------------------
30
# http://jmsoler.free.fr/util/blenderfile/py/fixfromarmature.py
31
# Communicate problems and errors on:
32
# http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender
33
#---------------------------------------------
35
# http://jmsoler.free.fr/util/blenderfile/py/fixfromarmature.py
36
# Communiquer les problemes et erreurs sur:
37
# http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender
38
#---------------------------------------------
39
# ce script est propos� sous licence GPL pour etre associe
40
# a la distribution de Blender 2.33 et suivant
41
# --------------------------------------------------------------------------
42
# this script is released under GPL licence
43
# for the Blender 2.33 scripts package
44
# --------------------------------------------------------------------------
45
# ***** BEGIN GPL LICENSE BLOCK *****
47
# Script copyright (C) 2003, 2004: Jean-Michel Soler
49
# This program is free software; you can redistribute it and/or
50
# modify it under the terms of the GNU General Public License
51
# as published by the Free Software Foundation; either version 2
52
# of the License, or (at your option) any later version.
54
# This program is distributed in the hope that it will be useful,
55
# but WITHOUT ANY WARRANTY; without even the implied warranty of
56
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57
# GNU General Public License for more details.
59
# You should have received a copy of the GNU General Public License
60
# along with this program; if not, write to the Free Software Foundation,
61
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
63
# ***** END GPL LICENCE BLOCK *****
64
# --------------------------------------------------------------------------
68
def fix_mesh(nomdelobjet):
69
Mesh=Blender.NMesh.GetRawFromObject(nomdelobjet)
70
Obis = Blender.Object.New ('Mesh')
72
Obis.setMatrix(Ozero.getMatrix())
73
scene = Blender.Scene.getCurrent()
78
if len(Mesh2.verts)==len(Mesh1.verts):
79
for VertGroupName in Mesh1.getVertGroupNames():
80
VertexList = Mesh1.getVertsFromGroup(VertGroupName, True)
81
Mesh2.addVertGroup(VertGroupName)
82
for Vertex in VertexList:
83
Mesh2.assignVertsToGroup(VertGroupName, [Vertex[0]], Vertex[1], 'add')
85
for vgroupname in Mesh1.getVertGroupNames():
86
Mesh2.addVertGroup(vgroupname)
89
print "mesh has no vertex group "
91
Ozero=Blender.Object.GetSelected()[0]
96
errormsg = "no mesh object selected"
97
elif Ozero.getType() != "Mesh":
98
errormsg = "selected (active) object must be a mesh"
101
Blender.Draw.PupMenu("ERROR: %s" % errormsg)
105
curframe = Blender.Get('curframe')
106
if Ozero.isSB() and curframe != 1:
107
softbodies=Blender.Draw.PupMenu("Soft Body: play anim up to the current frame to fix it?%t|Yes%x1|No %x2|Cancel %x3")
111
for f in range(1, curframe + 1):
112
Blender.Set('curframe',f)
113
Blender.Window.RedrawAll()
114
if fix: fix_mesh(Ozero.getName())