Add "Flags" export field for custom effect flags

This commit is contained in:
blubs 2023-10-13 00:45:34 -07:00
parent 9b8f9b8077
commit aefe4d56d5
2 changed files with 23 additions and 0 deletions

View file

@ -179,6 +179,11 @@ class QFMDLSettings(bpy.types.PropertyGroup):
items=EFFECTS, items=EFFECTS,
name="Effects", name="Effects",
description="Particle trail effects") description="Particle trail effects")
custom_flags : StringProperty(
name="Flags",
description="Int representing effect bitflags to write. If specified, Effects / Rotate flag values are ignored.",
default=""
)
#doesn't work :( #doesn't work :(
#script = PointerProperty( #script = PointerProperty(
@ -283,6 +288,11 @@ class ExportMDL6(bpy.types.Operator, ExportHelper):
items=EFFECTS, items=EFFECTS,
name="Effects", name="Effects",
description="Particle trail effects") description="Particle trail effects")
custom_flags : StringProperty(
name="Flags",
description="Int representing effect bitflags to write. If specified, Effects / Rotate flag values are ignored.",
default=""
)
xform : BoolProperty( xform : BoolProperty(
name="Auto transform", name="Auto transform",
description="Auto-apply location/rotation/scale when exporting", description="Auto-apply location/rotation/scale when exporting",
@ -362,6 +372,7 @@ class OBJECT_PT_MDLPanel(bpy.types.Panel):
layout.prop(obj.qfmdl, "synctype") layout.prop(obj.qfmdl, "synctype")
layout.prop(obj.qfmdl, "rotate") layout.prop(obj.qfmdl, "rotate")
layout.prop(obj.qfmdl, "effects") layout.prop(obj.qfmdl, "effects")
layout.prop(obj.qfmdl, "custom_flags")
# layout.prop(obj.qfmdl, "script") # layout.prop(obj.qfmdl, "script")
layout.prop(obj.qfmdl, "xform") layout.prop(obj.qfmdl, "xform")
layout.prop(obj.qfmdl, "md16") layout.prop(obj.qfmdl, "md16")

View file

@ -245,6 +245,7 @@ def get_properties(
synctype, synctype,
rotate, rotate,
effects, effects,
custom_flags,
xform, xform,
md16, md16,
mdl_first_frame, mdl_first_frame,
@ -257,6 +258,15 @@ def get_properties(
mdl.synctype = MDL.SYNCTYPE[synctype] mdl.synctype = MDL.SYNCTYPE[synctype]
mdl.flags = ((rotate and MDL.EF_ROTATE or 0) mdl.flags = ((rotate and MDL.EF_ROTATE or 0)
| MDL.EFFECTS[effects]) | MDL.EFFECTS[effects])
# If custom_flags specified, try parsing as int
# If int is successfully parsed, replace flags / effects with it.
try:
custom_flags = int(custom_flags)
mdl.flags = custom_flags
except:
pass
if md16: if md16:
mdl.ident = "MD16" mdl.ident = "MD16"
@ -358,6 +368,7 @@ def export_mdl(
synctype = SYNCTYPE[1], synctype = SYNCTYPE[1],
rotate = False, rotate = False,
effects = EFFECTS[1], effects = EFFECTS[1],
custom_flags='',
xform = True, xform = True,
md16 = False, md16 = False,
mdl_first_frame=0, mdl_first_frame=0,
@ -386,6 +397,7 @@ def export_mdl(
synctype, synctype,
rotate, rotate,
effects, effects,
custom_flags,
xform, xform,
md16, md16,
mdl_first_frame, mdl_first_frame,