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.
This commit is contained in:
parent
87e56e0655
commit
99c58cca73
|
@ -88,6 +88,9 @@ class QFMDLSettings(bpy.types.PropertyGroup):
|
||||||
script = StringProperty(
|
script = StringProperty(
|
||||||
name="Script",
|
name="Script",
|
||||||
description="Script for animating frames and skins")
|
description="Script for animating frames and skins")
|
||||||
|
md16 = BoolProperty(
|
||||||
|
name="16-bit",
|
||||||
|
description="16 bit vertex coordinates: QuakeForge only")
|
||||||
|
|
||||||
class ImportMDL6(bpy.types.Operator, ImportHelper):
|
class ImportMDL6(bpy.types.Operator, ImportHelper):
|
||||||
'''Load a Quake MDL (v6) File'''
|
'''Load a Quake MDL (v6) File'''
|
||||||
|
@ -140,6 +143,7 @@ class MDLPanel(bpy.types.Panel):
|
||||||
layout.prop(obj.qfmdl, "rotate")
|
layout.prop(obj.qfmdl, "rotate")
|
||||||
layout.prop(obj.qfmdl, "effects")
|
layout.prop(obj.qfmdl, "effects")
|
||||||
layout.prop(obj.qfmdl, "script")
|
layout.prop(obj.qfmdl, "script")
|
||||||
|
layout.prop(obj.qfmdl, "md16")
|
||||||
|
|
||||||
def menu_func_import(self, context):
|
def menu_func_import(self, context):
|
||||||
self.layout.operator(ImportMDL6.bl_idname, text="Quake MDL (.mdl)")
|
self.layout.operator(ImportMDL6.bl_idname, text="Quake MDL (.mdl)")
|
||||||
|
|
|
@ -175,6 +175,8 @@ def get_properties(operator, mdl, obj):
|
||||||
mdl.synctype = MDL.SYNCTYPE[obj.qfmdl.synctype]
|
mdl.synctype = MDL.SYNCTYPE[obj.qfmdl.synctype]
|
||||||
mdl.flags = ((obj.qfmdl.rotate and MDL.EF_ROTATE or 0)
|
mdl.flags = ((obj.qfmdl.rotate and MDL.EF_ROTATE or 0)
|
||||||
| MDL.EFFECTS[obj.qfmdl.effects])
|
| MDL.EFFECTS[obj.qfmdl.effects])
|
||||||
|
if obj.qfmdl.md16:
|
||||||
|
mdl.ident = "MD16"
|
||||||
script = obj.qfmdl.script
|
script = obj.qfmdl.script
|
||||||
mdl.script = None
|
mdl.script = None
|
||||||
if script:
|
if script:
|
||||||
|
|
|
@ -333,6 +333,7 @@ def set_properties(mdl):
|
||||||
mdl.obj.qfmdl.rotate = (mdl.flags & MDL.EF_ROTATE) and True or False
|
mdl.obj.qfmdl.rotate = (mdl.flags & MDL.EF_ROTATE) and True or False
|
||||||
mdl.obj.qfmdl.effects = parse_flags(mdl.flags)
|
mdl.obj.qfmdl.effects = parse_flags(mdl.flags)
|
||||||
mdl.obj.qfmdl.script = mdl.text.name #FIXME really want the text object
|
mdl.obj.qfmdl.script = mdl.text.name #FIXME really want the text object
|
||||||
|
mdl.obj.qfmdl.md16 = (mdl.ident == "MD16")
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -218,7 +218,7 @@ class MDL:
|
||||||
def write_verts(self, mdl):
|
def write_verts(self, mdl):
|
||||||
for vert in self.verts:
|
for vert in self.verts:
|
||||||
vert.write(mdl, True)
|
vert.write(mdl, True)
|
||||||
if mdl.ident == 'MD16' and high:
|
if mdl.ident == 'MD16':
|
||||||
for vert in self.verts:
|
for vert in self.verts:
|
||||||
vert.write(mdl, False)
|
vert.write(mdl, False)
|
||||||
|
|
||||||
|
@ -304,9 +304,9 @@ class MDL:
|
||||||
data = data.encode()
|
data = data.encode()
|
||||||
self.write_bytes(data, size)
|
self.write_bytes(data, size)
|
||||||
|
|
||||||
def __init__(self, name = "mdl"):
|
def __init__(self, name = "mdl", md16 = False):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.ident = "IDPO" #only 8 bit for now
|
self.ident = md16 and "MD16" or "IDPO"
|
||||||
self.version = 6 #write only version 6 (nothing usable uses 3)
|
self.version = 6 #write only version 6 (nothing usable uses 3)
|
||||||
self.scale = (1.0, 1.0, 1.0) #FIXME
|
self.scale = (1.0, 1.0, 1.0) #FIXME
|
||||||
self.scale_origin = (0.0, 0.0, 0.0) #FIXME
|
self.scale_origin = (0.0, 0.0, 0.0) #FIXME
|
||||||
|
|
Loading…
Reference in New Issue