diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2005-05-17 11:17:52 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2005-05-17 11:17:52 +0400 |
commit | 859959b49c8122b1e37027cf5009fecd23f5d8c8 (patch) | |
tree | 0dbe86f455743795604d88b3b9a351d0d6d1d98e /release/scripts/bpymodules | |
parent | 7f4ff24462217328a6d0d0b193621949ed5e085a (diff) |
BPython:
- fixing bug reported by Paolo Colombo: space handler slinks set for a 3d view were not set when the area got maximized;
- Blender.Object: added object.isSB() method to know if an object is a soft body (has ob->soft != NULL). Used in fixfromarmature.py.
Scripts:
- updates: batch_name_edit (Campbell), fixfromarmature (JMS);
- additions:
X3D exporter by Bart;
Envelope Suite by Jonas Petersen;
BVH 2 Armature by Jean-Baptiste Perin;
Camera Changer by Regis Montoya (3R);
Interactive Console by Campbell (ideasman).
- tiny updates in other scripts.
Diffstat (limited to 'release/scripts/bpymodules')
-rw-r--r-- | release/scripts/bpymodules/BPyNMesh.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/release/scripts/bpymodules/BPyNMesh.py b/release/scripts/bpymodules/BPyNMesh.py new file mode 100644 index 00000000000..043d8514db9 --- /dev/null +++ b/release/scripts/bpymodules/BPyNMesh.py @@ -0,0 +1,48 @@ +# $Id$ +# +# -------------------------------------------------------------------------- +# BPyNMesh.py version 0.1 +# -------------------------------------------------------------------------- +# helper functions to be used by other scripts +# -------------------------------------------------------------------------- +# ***** 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 ***** +# -------------------------------------------------------------------------- + + +# -------------------------------------------------------------------------- +# "Apply size and rotation" function by Jonas Petersen +# -------------------------------------------------------------------------- +# This function does (hopefully) exactly what the +# "Apply size and rotation" command does (CTRL-A in Object Mode). +def ApplySizeAndRotation(obj): + if obj.getType() != "Mesh": return + if obj.SizeX==1.0 and obj.SizeY==1.0 and obj.SizeZ==1.0 and obj.RotX == 0.0 and obj.RotY == 0.0 and obj.RotZ == 0.0: return + mesh = obj.getData() + matrix = obj.matrix + v = [0,0,0] + for vert in mesh.verts: + co = vert.co + v[0] = co[0]*matrix[0][0] + co[1]*matrix[1][0] + co[2]*matrix[2][0] + v[1] = co[0]*matrix[0][1] + co[1]*matrix[1][1] + co[2]*matrix[2][1] + v[2] = co[0]*matrix[0][2] + co[1]*matrix[1][2] + co[2]*matrix[2][2] + co[0], co[1], co[2] = v + obj.SizeX = obj.SizeY = obj.SizeZ = 1.0 + obj.RotX = obj.RotY = obj.RotZ = 0.0 + mesh.update() + |