Applying scale and rotation from a script?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
revans
Posts: 0
Joined: Tue May 08, 2007 10:09 pm

Applying scale and rotation from a script?

Post by revans » Wed May 09, 2007 12:47 am

Is there an exposed function that will allow me to apply scale and rotation to a scene from python? (The equivalent of hitting Ctrl-A in non-edit mode)

Thanks!
Ryan

reD_Fox
Posts: 0
Joined: Sat Mar 12, 2005 2:56 pm
Location: Abilene, KS

Post by reD_Fox » Thu May 10, 2007 3:58 am

Hello, Ryan. There doesn't appear to be a function already in place to do what you want. However, it's fairly straightforward to accomplish yourself.

Code: Select all

def applyTransform(obj):
	mat = obj.getMatrix()
	me = obj.getData(mesh=True)
	for v in me.verts:
		v.co = v.co*mat
	mat.identity()
There may be a better way to accomplish this, but it's the best I can come up with. Also, you might try the BlenderArtists.org forum:
http://blenderartists.org/forum/forumdisplay.php?f=11
It is a bit more frequented, and you may get more and/or better help there.

Levi
A three-legged stool never wobbles.

Post Reply