Optionally apply the object's transform to the mesh.

The default is to apply.
This commit is contained in:
Bill Currie 2012-08-07 11:49:08 +09:00
parent 634b3b043d
commit 39b2e80207
2 changed files with 9 additions and 0 deletions

View file

@ -88,6 +88,10 @@ class QFMDLSettings(bpy.types.PropertyGroup):
script = StringProperty(
name="Script",
description="Script for animating frames and skins")
xform = BoolProperty(
name="Auto transform",
description="Auto-apply location/rotation/scale when exporting",
default=True)
md16 = BoolProperty(
name="16-bit",
description="16 bit vertex coordinates: QuakeForge only")
@ -143,6 +147,7 @@ class MDLPanel(bpy.types.Panel):
layout.prop(obj.qfmdl, "rotate")
layout.prop(obj.qfmdl, "effects")
layout.prop(obj.qfmdl, "script")
layout.prop(obj.qfmdl, "xform")
layout.prop(obj.qfmdl, "md16")
def menu_func_import(self, context):

View file

@ -260,6 +260,8 @@ def process_frame(mdl, scene, frame, vertmap, ingroup = False,
return fr.frames[-1]
scene.frame_set (int(frameno), frameno - int(frameno))
mesh = mdl.obj.to_mesh (scene, True, 'PREVIEW') #wysiwyg?
if mdl.obj.qfmdl.xform:
mesh.transform (mdl.obj.matrix_world)
fr = make_frame(mesh, vertmap)
fr.name = name
return fr
@ -287,6 +289,8 @@ 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))
convert_stverts (mdl, mdl.stverts)
mdl.size = calc_average_area(mdl)