Forums

Full Version: Blender25 support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For the brave to try:
https://github.com/VDrift/blender-script.../blender25

The script is considered alpha quality, only joe export is functional atm.
Nice. Have tested properly yet, but I don't get any fatal errors.
JOE import is functional, tested with XS/body.joe. Unfortunately there is no texture selection. The blender guys rewrote the complete python api for 25 and I have no idea how to reimplement it. I've asked for help at blenderartists.org and #blenderpython. No or no constructive response so far...
I've just run into an interesting issue with the scripts. Blender only supports one normal per vertex. We are storing three normals per face. To deal with this issue, keep mesh edges sharp(same vertex but different normals) we are duplicating the vertices on import.

Now to the problem. The vertices, texture coordinates and normals are checked for duplicates(rounding to the fifth decimal) on export. It looks like the internal processing has changed in blender25(maybe due to python3 or blender itself) and we are getting more unique normals on export. This also means more edges on successive import.

Fortunately it is stable. Successive imports and exports wont change the normal count. But I am still not sure how to deal with the difference between 24 and 25. One could play with the rounding. But I doubt we will find the setting to get the same number of normals. Any opinions?
One idea would be to check the normals of vertex duplicates separately, define a minimum angle for an edge.
The mesh in blender is not affected by this extra normals. The vertex, edge count doesn't change. Need to investigate what happens with the extra normals.
JPK import/export is available. It needs needs testing and misses a few track object properties. Will fix asap.
Except the joe texture selection and a few extra normals(they don't affect the actual mesh) we should be on par with the blender24 script now.
Nice work Smile
To apply a texture to an imported JOE one has to switch into edit mode select the UV/Image editor and open the texture.

To simplify this I've added an import texture function. The question is, do we really need it? The process to load a texture as described above is not particularly complicated.
NaN Wrote:Blender only supports one normal per vertex. We are storing three normals per face.

In the JOE03 format, we are storing three normal indices per face, and three position indices per face (and three texcoord indices per face, by the way). The normal and position arrays are indexed separately (and have duplicates removed). You are saying that Blender only supports one vertex index per face, and that vertex contains both a position and normal, correct? If so, that's fine. OpenGL is the same way, and at runtime we convert to that arrangement (the VERT_ENTRY stuff at the end of ReadData in model_joe03.cpp). The MODEL class supports reading and writing a format that matches the final runtime format better (ReadFromFile and WriteToFile in model.cpp), although I'm not sure if it's faster since it goes through the serialization code instead of doing a bulk read into memory.
Quote:vertex contains both a position and normal
Yep. I was just concerned if it would affect the mesh. It doesn't. We will get a bit larger files on export, but that's all.
how do i use this?

i tried putting the vdrift.py from the blender25 in every folder i could think of. with and without export-joe.py.

the old vdrift.py works fine in these locations on blender 2.49. is there somewhere in blender 2.5 to enable external scripts?
Put vdrift.py into /scripts/addons. Start blender, go to File/User preferences/Add-Ons/Import-Export and enable Import-Export: VDrift JOE/JPK format.