NEW: Aligner/Displacer/Randomizer Script

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
RobertT
Posts: 0
Joined: Fri Oct 03, 2003 3:52 pm
Contact:

NEW: Aligner/Displacer/Randomizer Script

Post by RobertT »

I just posted this over at Elysiun.com, but I figured I should post this here too. It's my very first Python script with a GUI, and it's called Object Aligner/Displacer:

:arrow: Click here to download the .zip file

Contents (3 files): README.TXT, aligndisplacerscript.py, sample.blend

This script can do several things:

- Align selected objects by LocX, LocY, or LocZ, or all Loc XYZ to the last selected object.

- Resize objects according to the SizeX, SizeY, or SizeZ, or all Size XYZ of the last selected object.

- Rotate objects according to the RotX, RotY, RotZ, or all Rot XYZ of the last selected object.

- Randomly relocate 1 or more selected objects by LocX, LocY, or LocZ, or all Loc XYZ (reloacte all selected objects)

- Randomly resize 1 or more selected objects by SizeX, SizeY, or SizeY, or all Size XYZ (resize all selected objects)

- Randomly rotate 1 or more selected objects by RotX, RotY, or RotZ, or all Rot XYZ (rerotate all selected objects)

- Randomization ranges for all transformations can be controlled through a slider

- Relocate 1 or more selected objects to 0,0,0 coordinates (center of Blender universe)

- Resize 1 or more selected objects to default primitive size (SizeX/Y/Z=1)

- Zero X/Y/Z rotation for 1 or more selected objects

A full Python install is assumed. This was designed and tested in Blender 2.31 for Windows. It may not work in other versions. Be sure to read the README.TXT file before using it.

What can this be used for? If you've ever wanted to conveniently align a bunch of objects along the x y or z axis of another object you can do that with this. If you've ever needed to scatter a bunch of objects or orient objects in the same direction of another object, this script lets you do that. If you've ever wanted to make several objects the same size as another, you can also do that. Conversely, if you've ever wanted to introduce randomness to a bunch of similar objects you can now do that as well for location, size, and rotation.

Check out the sample.blend file included in the .zip to try out the script safely before attempting to use elsewhere. The script only modifies active data, not the .blend file itself, so unless you like what the script has done don't save the changes. Reload the file and try again.

A history of object transformations is printed in the Blender console window with each new change introduced. If you're attempting to change dozens of objects at once there may be a delay as the active object data gets updated and the objects themselves get redrawn in the 3D View.

Well, I wrote this mostly to learn about Python, but I thought it might be useful to someone out there, so here it is :)

If you get a chance to try it let me know what you think. Thanks!

RobertT

Post Reply