Commit Graph

52 Commits

Author SHA1 Message Date
Bill Currie c08fd08025 Write empty array and dictionary items on one line.
Makes for slightly tidier plist text.
2012-08-31 16:14:49 +09:00
Bill Currie 43abf8e3df Support writing int and float items to a plist.
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.
2012-08-31 16:10:30 +09:00
Bill Currie af0db29981 Add support for meshes with multiple UV maps.
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).
2012-08-12 13:38:12 +09:00
Bill Currie 971e689d3d Fix a slew of whitespace issues. 2012-08-07 13:25:44 +09:00
Bill Currie a3c8209bdf Handle missing frame information a little more usefully.
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.
2012-08-07 13:23:19 +09:00
Bill Currie 39b2e80207 Optionally apply the object's transform to the mesh.
The default is to apply.
2012-08-07 11:49:08 +09:00
Bill Currie 634b3b043d Export non-triangular faces as triangle clusters.
It turns out this behavior is preferable (by at least one artist, anyway).
2012-08-07 10:49:32 +09:00
Bill Currie a4da11cdb5 Correctly handle multiple vertices sharing a UV coordinate.
Need to use both UV coordinate and vertex index to find unique
combinations. This should fix leileilol's broken meshes.
2012-08-07 10:26:35 +09:00
Bill Currie 78bfd30648 Export vertex normals.
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.
2012-08-07 09:52:47 +09:00
Bill Currie 5661e738ac Actually return the skin in null_skin()
Oops.
2012-08-07 09:50:38 +09:00
Bill Currie ff4c2cfb63 Add a todo list for the mdl addon. 2012-08-06 22:34:19 +09:00
Bill Currie 3788a1a3b7 Correct the output of 16-bit vertex data.
The order is high (unscaled) low (scaled by 1/256) rather than low
(unscaled) high (scaled by 256).
2012-04-24 14:13:29 +09:00
Bill Currie c2712e6373 Track recent api change in svn blender.
Bah, I'm looking forward to the bmesh api stabilizing.
2012-04-24 11:04:45 +09:00
Bill Currie 99c58cca73 Make exporting md16 files possible.
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.
2012-04-23 08:54:19 +09:00
Bill Currie 7317aaf109 Fix an out-by-one error when expanding intervals. 2012-04-21 20:16:28 +09:00
Bill Currie 965680f5dd Fix the bogus rotation flag when exporting the torch. 2012-04-21 11:42:38 +09:00
Bill Currie 4e435654c0 Implement multiple skin and frame exporting. 2012-04-21 11:31:33 +09:00
Bill Currie 1242247ac2 Write the number of subskins in a skin group. 2012-04-21 11:30:43 +09:00
Bill Currie cdc57a0473 Set the skin images' fakeuser flag.
Until I figure out how to do animated skins in blender...
2012-04-19 22:16:30 +09:00
Bill Currie 6bae99d66c Create an animation script for imported models.
The animation script is just a plist of relevant frame and skin
information. Documentation is included in the generated script.
2012-04-19 22:06:43 +09:00
Bill Currie ff05074e70 Set the fcurve interpolation to linear.
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.
2012-04-19 18:49:53 +09:00
Bill Currie 274848b720 Use exceptions for error reporting.
Much cleaner, should have done it this way in the first place.
2012-04-19 14:30:40 +09:00
Bill Currie d500940983 Add support for writing plists.
For now, only dictionariess, lists/tuples, bytes and strings are
supported.
2012-04-17 22:05:50 +09:00
Bill Currie 68bf0108fb Create a python version of qfplist.
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 :)
2012-04-17 21:29:27 +09:00
Bill Currie 196f2da585 Remove the fallback for missing image pack support.
It's been in blender since 2.59 or so.
2012-04-17 13:10:21 +09:00
Bill Currie e25024c131 Build a single NLA track with strips for all actions.
This removes the need for fakeuser :).

Anyway, with this, the model's animations can be viewed all in sequence
just by hitting alt-a.
2012-04-16 15:42:49 +09:00
Bill Currie 4b29510bfd Set the name of the shape-key datablock to the model name.
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 :/
2012-04-16 13:33:45 +09:00
Bill Currie 0952e918dd Set fakeuser on actions.
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.
2012-04-16 13:30:58 +09:00
Bill Currie 70f500a087 Use custom properties for model flags etc.
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.
2012-04-15 21:55:23 +09:00
Bill Currie 92c08fb957 Update required blender version. 2012-04-15 13:47:59 +09:00
Bill Currie fd9b8f7b4a Fix import and export for blender 2.63
Blender 2.63 should be out in a few days. Nice to get this ready ahead of
time.
2012-04-15 09:34:53 +09:00
Bill Currie d3af0b2357 Correct the MD16 writing code.
Forgot to test it :P
2012-04-15 09:34:16 +09:00
Bill Currie ab4aec47a7 Correct vertex scaling for blender 2.62+
This also abandons support for older versions of blender.
2012-04-14 18:10:25 +09:00
Bill Currie 1f3eaaf2e0 Fix the importer for blender 2.61.
The use_image field of faces disappeared somewhere between 2.59 and 2.61.
2012-01-23 23:10:25 +09:00
Bill Currie 91cb875115 Add vertex loading/writing for MD16. 2012-01-05 16:49:42 +09:00
Bill Currie 3b8ab404a0 Add the ability to save the extra model parameters.
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.
2011-09-28 07:41:20 +09:00
Bill Currie 521f482806 Fix an off-by-one error that caused uvs to wrap. 2011-09-25 20:52:28 +09:00
Bill Currie 1277c17cd9 Give the 24-8 bit converter a massive speedup.
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.
2011-09-25 20:50:32 +09:00
Bill Currie 50795b8239 Calculate the model "size".
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.
2011-09-24 13:18:23 +09:00
Bill Currie 07b5db64c6 Calculate the bounding radius.
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.
2011-09-24 13:03:18 +09:00
Bill Currie 3b33d8dade Make the basis shape key active on import.
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.
2011-09-24 11:43:06 +09:00
Bill Currie bd840726c2 Fix the mangled faces.
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).
2011-09-24 09:00:14 +09:00
Bill Currie a1d9e752cd Fix the messed up UVs.
I had forgotten to invert the t axis.
2011-09-23 19:58:26 +09:00
Bill Currie a80eef8bc4 Get the exporter mostly working.
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 :).
2011-09-23 19:01:31 +09:00
Bill Currie 8ccb07d959 Make the MDL classes a little more usable.
This really eased the writing of the exporter :)
2011-09-23 19:00:39 +09:00
Bill Currie 8bec9cb203 Clean up export_mdl() a little. 2011-09-23 13:00:46 +09:00
Bill Currie 4a3731652e Fix the exported skin conversion.
I must remember to test language features in python 3 :P
2011-09-22 14:08:10 +09:00
Bill Currie 40f46f2ea3 Complete mdl writing.
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")
2011-09-22 11:44:08 +09:00
Bill Currie e35dd29a2d Don't use Vector in mdl.py
This will make testing of the MDL class a little easier (independent of
Blender).
2011-09-22 11:43:57 +09:00
Bill Currie a58f9582b0 Try to write out the skin.
Something's not working as all I get is a black texture, but the basics
(MDL writing) seem to be ok.
2011-09-22 00:58:57 +09:00