Hi
The Blender export script developing continues a bit and I reached few targets. Small steps, you know.
AH2v18b.py
http://warezhouze.1g.fi/Here/Blender3d/AH2V18b.pyEspecial thanks for the user named ‘Basil Fawlty’ in
http://www.blenderartist.com / python & plug-ins forum, who helped me with the python tricks and give me a ‘kids count’ sample code.
One of my long term target is/was as easy as possible hierarchy tree and properties management. This script version pretty much sums it up.
I call this script as a beta, because I didn’t have a time for the actual object creation and so on for the extensive testing.
New export script features:
1.New hierarchy tree & properties data source.
The Blender internal 'htp.txt' text object replaces the previous external 'ah_opd.txt file.
It is also possible to load an external text file to the Blender and saving it as an 'htp.txt' text object.
2. New hierarchy tree & properties creation method.
User only needs to create the objects (meshes) and all groups are only in written format in text object.
The hierarchy tree structure creation with tabulators. This means in practice: you will get what you see (with in format rules).
No more manual 'kids' calculation, because the script will calculate them based to the tabulator value relations.
Create and edit the ‘htp.txt’ content with Blender text editor or in external text editor.
User can have a several ‘htp.txt’ versions saved to the blend file. The Blender automatically indexing all same named objects with running three digits number.
Just rename the intent source ‘htp.txt.xxx’ to the ‘htp.txt’ and script will export according to that.
NOTE! Only those groups and objects will be exported, which are mentioned in ‘htp.txt’ text object. All the rest are completely ignored.
This means, you can have, example, a scene objects, which are there just to help you to design the target shape itself.
3. No more ‘direct opening’ rule before the script run.
Now you open target blend file from blender as well and run the script without problem.
4. No more ‘onames.txt’ and ‘epx_ob_names.txt’ left over template files after the export.
All needed template ‘lists’ are created straight to the script parameters.
The 'htp.txt' format
NO KIDS FOR THE OBJECTS: will cause a corrupted AC3D file
NO EMPTY LINES: Will cause ‘ValueError: object ":" not found’ error
NO GROUPS WITHOUT KIDS: will cause ‘ValueError: object "xxxx" not found’ error
NO MISTYPED OBJECT NAMES OR CASES: will cause ‘ValueError: object "xxx" not found’ error
Example
------ The beginning of the htp.txt text object/file-------------------------------------
WORLD[,]
[tab]MODEL[,][space]property1{enter)
[tab][tab]OBJECTS[,][space]property1(enter)
[tab][tab][tab]STR01[,][space]property1(enter)
[tab][tab][tab][tab]CIT01[,][space]property1(enter)
--------- The end of the htp.txt text object/file-----------------------------------------
The script will skip all #-marks and also the texts, which right side of it.
This gives an option to use header, footer texts and also the notes.
There must be always the 'world,' in top-left of the hierarchy tree. The 'world,' don’t have any properties.
Use only tabulators for the hierarchy tree creation. Any spaces will cause corrupted .ac file and / or a script error.
After tabulator comes immediately the group/object name.
The object names are case sensitive. NOTE! The Blender object and mesh names must complete match.
After the group/object name comes the immediate comma and one space.
The lines must end with immediate enter.
OR
In case of the note, there must be a one space before #-mark and the note.
IMPORTANT NOTE!
You can center the several objects origins at once:
- select the target objects in OBJECT-mode
- Set the 3D-cursor to the '0,0,0' location with SHIFT+C keys.
- center the view, if needed, with C-key
- click the 'Center Cursor' button
- done
You don't need to worry about the group origins. They will be on dead center automatically every time.
Now the objects relative positions will exported correctly to the .ac file.