Project: Blender Extensions
Tracker: Py Scripts Upload
Blender: 2.49
Category: Object
Python: 2.6
Homepage: none
Script name: Aligner
Dependencies: none
Author(s): John Solley (based on Vertex Align by Rene Sammler)
Status: Closed
Aligner v.8 (is stable -- needs testing on older versions)
This script allows you to mark a position to align to, and then move all selected vertices, objects and/or curve points to that position in the X, Y, and/or Z dimensions. Aligning in all 3 dimensions would effectively place the aligned point on top of the marked point in 3D space.
Features:
* Uses world coordinates
* Works on vertices, objects and/or curve points
* Works across objects: you can align a vertex in one object to a (for instance) curve point in another
You can also align an entire object based on an arbitrary vertex or curve point within it (instead of using the object center). This effectively aligns the vertex (or curve point) and moves the rest of the object along with it.
Since were almost at 2.5, think of the ramifications of this script on 2.5. What I like about this script is that it is "verb" based -- that is, it is an operation that works on many different types of objects within blender. In addition, it shows the users steps explicitly in the GUI -- I think this is useful when there is a definite flow involved in the task at hand. Sometimes the "flow" in a script is not that obvious at all, and putting it explicitly in the GUI just makes it easier on the user.
-------------------------------------------------------------------------------
FULL DOCUMENTATION:
This script allows you to mark a position to align to, and then move all selected vertices, objects and/or curve points to that position in the X, Y, and/or Z dimensions. Aligning in all 3 dimensions would effectively place the aligned point on top of the marked point in 3D space.
You can also align an entire object based on an arbitrary vertex or curve point within it (instead of using the object center). This effectively aligns the vertex (or curve point) and moves the rest of the object along with it.
The script has a number of interesting features:
1. UsesWorld Coordinates
The script uses world coordinates as opposed to local coordinates. Local coordinates don't take into account rotations and IPO transformations. World coordinates allow multiple objects to be involved in the alignment process.
2. Align based on X, Y and/or Z
Once you have the marked position you'd like to align to, you can align objects, vertices, or curve points to the X, Y and/or Z coordinates of the marked position. Aligning to all three dimensions would essentially place the aligned point on top of the marked point in 3D space.
3. Multiple Objects, Vertices, Curves
The script works with Objects, Mesh Vertices, and Bezier Curve points. In Object Mode, you can select mark or align the positions of objects. The object center is used as the "location" of the object (more on this below). Bezier curve knots and control points can be aligned.
4. Align Using Point Other Than Object Center (or, Align Vertex and Move Whole Parent Object)
The script contains a feature to allow you to align an object not based on the object's center, but based on a vertex or control point within the object. This is useful when, for instance, you want to align based on the perimeter of an object, or align a specific location or item within an object. Another way to think of this feature is aligning a vertex, and moving that vertex's parent object along with it.
5. Mix & Match
The script works across objects. So, you can mark a vertex in one object, go into a completely different object, and align a bunch of other vertices to the first. Moreover, you can do things such as "align a collection of objects to a vertex's X coordinate".
6. Include the Cursor
The script allows you to mark and align the cursor as you would any other object. So, you can select a vertex, hit Y coordinate, and hit "Align Cursor", and you will align the cursor to the vertex in the Y dimension. It's also a quick way to mark and restore the cursor location, if you find that useful.
Limitations
* This script does not work in Blender 2.5 (yet)
* The script does not work on Nurbs or Poly Curves -- this is apparently due to the fact that Blender's Python binding doesn't allow capturing "selected"/"unselected" Nurbs nodes.
* The script allows only one object, vertex, or curve control point location to be marked. So, there is no averaging (or centering) of marked locations. This was to keep the script straightforward and simple (this way, multiple selections will not cause a strange averaging side effect).
* If you want to align multiple objects in one pass, you must align using the object's center. Aligning based on an object's center is not always the best thing. An object's center is essentially an assigned value in Blender (it is not automatically calculated). Kind of a bummer, but if you thing about it, this can be useful. This is because the user can determine what "center" is best for an oddly shaped object. If you're unsure and getting weird results, try recalculating it by going into object mode, then selecting Object --> Transform --> Center New.
* The script is untested against groups and parented objects.