Aces High Bulletin Board
General Forums => Terrain Editor => Topic started by: Xjazz on October 17, 2006, 03:52:09 PM
-
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.py
Especial 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.
-
Originally posted by Xjazz
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.
Now, if I understand this correctly, if we use this script we no longer use "ah_opd.txt", we instead use the same format, but name it "htp.txt"?
-
Hi Denholm,
Yes, just like before, you write the hierarchy tree with needed flags to the Blenders text object editor.
Remember to rename your intent source text object as a 'htp.txt' and save the .blend file.
You don't need to restart the blender before your run the script anymore.
No, the 'htp.txt' content format is a bit different now.
Don't use any +, - , space or numbers front of the group or object names.
Please, pay very much attention to the example 'htp.txt'
----- The beginning of the htp.txt text object/file------
WORLD[,]
[tab]MODEL[,][space]property{enter)
[tab][tab]OBJECTS[,][space]property(enter)
[tab][tab][tab]STR01[,][space]property(enter)
[tab][tab][tab][tab]CIT01[,][space]property(enter)
--------- The end of the htp.txt text object/file----------
-
Alrighty, thanks for the info, now I don't need to keep up with the group numbers in the "str0" category.:D
-
Hi
The templates contains the AH material samples.
Materials 42-65 don’t look 100% same is Blender, because of the Ambient and Emission format differences between AC3D and Blender. The AC3D has separate RGB parameters while Blender has single parameter. This ONLY affect to the material presentation in Blender screen play.
AH_temp20b
http://warezhouze.1g.fi/Here/Blender3d/AH_temp20b.blend
How to select and assing the materials
http://warezhouze.1g.fi/Here/Blender3d/AH_temp_mat.jpg
Previewing
You can preview the materials by clicking objects on right screen and see the result on downright 'Preveiw' window.
Selecti and assing:
- Select te target object in 'Materials' screen.
- Click the material selection button (Yellow arrow)
- Click the Databrows botton (blue arrow) and selection menu opens
- Click the target material number
Remember, only only one material per object.
AH material presentation in Blender
(http://warezhouze.1g.fi/Here/Blender3d/AHM10.jpg)
Tags:
E- Emission
T- Transparent
D- Ambient and/or Emission format differences
The white areas without the borders are undefined materials (full transparent charracter).
-
Sorry for the bump, yet I was wondering on the "STR0" tag, the digit after the "0" defines how many categories lie underneath STR0? Cause previously we typed: +3 str0
Just checking because in your example script you only had one category underneath STR0 which would define it as "1" making me believe that's how you came up with STR01.
Confusing enough to explain, even more difficultto understand.
-
Based to the AC3D.txt file in TE folder, the STR01 is a first STRUCTURE category group. If you like to have another one, then it must be named as STR02 and next one STR03 etc.
Why it's like this? Only Hitech knows.
-
That's all I needed to know, thanks.