AH2 export script

Hi
The Blender to ‘Aces High 2’ (AC3D .ac) export script modifying / developing continues a bit and I reached few targets.
AH2v18b.py
http://warezhouze.1g.fi/Here/Blender3d/AH2V18b.py

Special thanks for the ‘Basil Fawlty’ who give me a ‘kids count’ sample code. It works great.
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.

Known issues:

  • no support for the FGON to NGON (sigh)
  • no support the polylines / polywires
  • lots of unnecessary code lines
  • and probably many amateur coder mistakes

The script is far from ready but your feed back is very much welcome.

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.
  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.
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.

  1. 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.
  2. 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----------
[#] optional header text
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)
[#] optional footer text
--------- 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.

NOTE!
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
    Now the objects relative positions will exported correctly to the .ac file