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.
This commit is contained in:
Bill Currie 2012-08-07 13:23:19 +09:00
parent 39b2e80207
commit a3c8209bdf
2 changed files with 14 additions and 7 deletions

View File

@ -289,9 +289,13 @@ def export_mdl(operator, context, filepath):
if not mdl.skins:
make_skin(mdl, mesh)
if not mdl.frames:
if mdl.obj.qfmdl.xform:
mesh.transform (mdl.obj.matrix_world)
mdl.frames.append(make_frame(mesh, vertmap))
curframe = context.scene.frame_current
for fno in range(1, curframe + 1):
context.scene.frame_set(fno)
mesh = obj.to_mesh(context.scene, True, 'PREVIEW') #wysiwyg?
if mdl.obj.qfmdl.xform:
mesh.transform(mdl.obj.matrix_world)
mdl.frames.append(make_frame(mesh, vertmap))
convert_stverts (mdl, mdl.stverts)
mdl.size = calc_average_area(mdl)
scale_verts(mdl)

View File

@ -240,16 +240,19 @@ def write_text(mdl):
header="""
/* This script represents the animation data within the model file. It
is generated automatically on import, and is optional when exporting.
If no script is used when exporting, only a single frame and single
skin will be exported.
If no script is used when exporting, frames will be exported one per
blender frame from frame 1 to the current frame (inclusive), and only
one skin will be exported.
The fundamental format of the script is documented at
http://quakeforge.net/doxygen/property-list.html
The expected layout is a top-level dictionary with two expected
entries:
frames array of frame entries
skins array of skin entries
frames array of frame entries. If missing, frames will be handled
as if there were no script.
skins array of skin entries. If missing, skins will be handled
as if there were no script.
A frame entry is a dictionary with the following fields:
name The name of the frame to be written to the mdl file. In a