They are written as normal string items, so anything using the plist later
on will need to know the context, but at least now there's no need to first
convert int or float data to strings before writing a plist.
One common use for a mesh having multiple UV maps is when combining several
mesh objects into one: the base UV map is the result of joining the meshes
(and will be a right mess of overlapping UV islands), but an additional UV
map is then setup as a copy of the first but with the islands re-packed so
nothing overlaps. The export script now searches for the active UV map and
uses that for both UV coordinates and the skin texture (when none is
specified).
If there's no export script, or the export script has no frame information,
animation data will be collected by running through blender frames 1 to the
current frame (inclusive). Each frame will be exported as a single frame
rather than as members of a frame group.
I'd forgotten I hadn't implemented exporting vertex normals. While I've
modified things for making better use of blender's tools and avoiding the
unnecessary use of objects, the code is taken from the ajmdl blender 2.4
export script.
Not sure if it actually works as the clients don't render the result
properly (can't see anything where the model should be), but the output
model does import back into blender properly.
Since qf does linear interpolation of verts, this seems to be reasonable.
Certaintly better than the rose-thorns I got because I haven't figured out
how to kick the auto-clamp.
I've decided to use property lists to define mdl control scripts. Some
names will probably get changed, and I still need to write code for writing
a plist, but the hard part is pretty much done :)
Note that this is the data block that holds the list of actual shape-keys,
rather than the shape-keys themselves. I'm not sure what it's correct name
is (it's just "Key" in RNA).
I really dislike this method of setting the name, but the use of "Key" as
the datablock name is actually hard-coded into blender's C code :/
Without fakeuser set, blender will toss out the actions on save and reload.
Converting to an nla strip might take care of that, but I haven't figured
out how to do that yet, so avoid any nasty surprised for the user.
Eye position, auto rotation, sync type and particle effects can now all be
edited in blender: both import and export do the right thing. The settings
can be found in the "QF MDL" panel of the "Object" tab of the properties
view.
The params are eye position, flags and synctype. Provision is made for
reading them from a text block on export, but nothing is done other than
retrieving the text block.
The biggest part of the speedup is reading from blender's image only once
(it seems that every read does so from GL rather than memory: ouch). Also,
cache the results for each color.
The size is actually the average area in quake units of the mesh's
triangles. Again, my results are slightly smaller (0.025).
With this, all calculable fields are set. Only eye position, flags and
synctype remain.
The calculated radius is a smidge (0.05) smaller than the original
(invisibl.mdl), but I think that's due to the difference in source data: id
used the original models, I'm using their output.
Blender must have an active shape key before shape key animation will work.
This fixes the models being locked to the first frame until a shape key is
selected via the UI.
I /did/ see the warning about vertex index 0 in the obj importer script,
but I didn't take it seriously enough. This fixes both the twisted texture
on a couple of faces, and the truly mangled tris when exporting (using
invisibl.mdl for testing).
There seems to be some problems with the UVs, only one frame is exported,
and various model params don't get set (eye position, size, bounding
radius, synctype, flags), but the size and shape look right in qf :).
Except for the normal index in the frame bounds (and potentially frame
names with junk after the terminating nul), the output is identical to the
input for:
mdl=MDL().read("invisibl.mdl")
mdl.write("test.mdl")