mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
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
4 changed files with 10 additions and 3 deletions
|
@ -88,6 +88,9 @@ class QFMDLSettings(bpy.types.PropertyGroup):
|
|||
script = StringProperty(
|
||||
name="Script",
|
||||
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):
|
||||
'''Load a Quake MDL (v6) File'''
|
||||
|
@ -140,6 +143,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, "md16")
|
||||
|
||||
def menu_func_import(self, context):
|
||||
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.flags = ((obj.qfmdl.rotate and MDL.EF_ROTATE or 0)
|
||||
| MDL.EFFECTS[obj.qfmdl.effects])
|
||||
if obj.qfmdl.md16:
|
||||
mdl.ident = "MD16"
|
||||
script = obj.qfmdl.script
|
||||
mdl.script = None
|
||||
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.effects = parse_flags(mdl.flags)
|
||||
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):
|
||||
bpy.context.user_preferences.edit.use_global_undo = False
|
||||
|
|
|
@ -218,7 +218,7 @@ class MDL:
|
|||
def write_verts(self, mdl):
|
||||
for vert in self.verts:
|
||||
vert.write(mdl, True)
|
||||
if mdl.ident == 'MD16' and high:
|
||||
if mdl.ident == 'MD16':
|
||||
for vert in self.verts:
|
||||
vert.write(mdl, False)
|
||||
|
||||
|
@ -304,9 +304,9 @@ class MDL:
|
|||
data = data.encode()
|
||||
self.write_bytes(data, size)
|
||||
|
||||
def __init__(self, name = "mdl"):
|
||||
def __init__(self, name = "mdl", md16 = False):
|
||||
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.scale = (1.0, 1.0, 1.0) #FIXME
|
||||
self.scale_origin = (0.0, 0.0, 0.0) #FIXME
|
||||
|
|
Loading…
Reference in a new issue