mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
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.
This commit is contained in:
parent
a356ce6572
commit
3b8ab404a0
2 changed files with 16 additions and 0 deletions
|
@ -168,6 +168,10 @@ def export_mdl(operator, context, filepath):
|
||||||
"Mesh has faces with more than 3 vertices.")
|
"Mesh has faces with more than 3 vertices.")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
mdl = MDL(obj.name)
|
mdl = MDL(obj.name)
|
||||||
|
#FIXME this should be configurable
|
||||||
|
#FIXME use it
|
||||||
|
if mdl.name in bpy.data.texts:
|
||||||
|
mdl.script = bpy.data.texts[mdl.name].as_string()
|
||||||
make_skin(mdl, mesh)
|
make_skin(mdl, mesh)
|
||||||
mdl.tris, mdl.stverts, vertmap = build_tris(mesh)
|
mdl.tris, mdl.stverts, vertmap = build_tris(mesh)
|
||||||
convert_stverts (mdl, mdl.stverts)
|
convert_stverts (mdl, mdl.stverts)
|
||||||
|
|
|
@ -231,6 +231,15 @@ def merge_frames(mdl):
|
||||||
mdl.frames[i:j] = [f]
|
mdl.frames[i:j] = [f]
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
def write_text(mdl):
|
||||||
|
string = "$eyeposition %g %g %g\n" % mdl.eyeposition
|
||||||
|
string += "$flags %d\n" % mdl.flags
|
||||||
|
if mdl.synctype:
|
||||||
|
string += "$sync\n"
|
||||||
|
txt = bpy.data.texts.new(mdl.name)
|
||||||
|
txt.from_string(string)
|
||||||
|
return txt.name
|
||||||
|
|
||||||
def import_mdl(operator, context, filepath):
|
def import_mdl(operator, context, filepath):
|
||||||
bpy.context.user_preferences.edit.use_global_undo = False
|
bpy.context.user_preferences.edit.use_global_undo = False
|
||||||
|
|
||||||
|
@ -260,6 +269,9 @@ def import_mdl(operator, context, filepath):
|
||||||
merge_frames(mdl)
|
merge_frames(mdl)
|
||||||
build_actions(mdl)
|
build_actions(mdl)
|
||||||
|
|
||||||
|
operator.report({'INFO'},
|
||||||
|
"Extra settings saved in the %s text block." % write_text(mdl))
|
||||||
|
|
||||||
mdl.mesh.update()
|
mdl.mesh.update()
|
||||||
|
|
||||||
bpy.context.user_preferences.edit.use_global_undo = True
|
bpy.context.user_preferences.edit.use_global_undo = True
|
||||||
|
|
Loading…
Reference in a new issue