Can a python script call functions within Blender to rotate or transform selected objects or vertices rather than calculate the transformations itself. It would be nice to have a rotate(...), move(...) and scale(...) function. These are all things that Blender already knows how to do and it does them well. Access to other features such as extrude, mirror, etc. would be pretty cool too.
Thanks,
Rick
Transforming with Python
Moderators: jesterKing, stiv
You can control an object's size, rotation and location using the size, rot and loc attributes:
The rotation gives the Euler angles (currently in radians).
You can assign tuples to these attributes, which will change the object's values. You can also access the attributes individually; for example, LocX is the x value of the location.
As far as I know, there is nothing in the BPython API to access things like mirror, extrude, etc.
Code: Select all
import Blender
for obj in Blender.Object.GetSelected():
print 'name is ',obj.name
print ' location = ',obj.loc
print ' rotation = ',obj.rot
print ' size = ',obj.size
print
You can assign tuples to these attributes, which will change the object's values. You can also access the attributes individually; for example, LocX is the x value of the location.
As far as I know, there is nothing in the BPython API to access things like mirror, extrude, etc.
Thanks khughes. If I understand correctly, size, loc and rot would be used to transform the entire object but not, for example, a set of individually selected vertices. What I had in mind was a function that could work on any number of selected objects or vertices as a set, taking delta x, y and z or scale and rotation values as arguments.
something like...
move(deltax, deltay, deltaz)
scale(factorx, factory, factorz)
rot(rotationx, rotationy, rotationz, pivot)
I suppose I could write Python functions for this, then I would have what I'm looking for. I'll need to spend a little more time with Python, though. Just being lazy, I guess.
Thanks,
Rick
something like...
move(deltax, deltay, deltaz)
scale(factorx, factory, factorz)
rot(rotationx, rotationy, rotationz, pivot)
I suppose I could write Python functions for this, then I would have what I'm looking for. I'll need to spend a little more time with Python, though. Just being lazy, I guess.
Thanks,
Rick