Get the mdl frames script property working

Maybe late 2.78+, blender added the ability to use any ID type in
PointerProperty, which is just what I wanted for the frames script.
This commit is contained in:
Bill Currie 2019-08-16 22:34:45 +09:00
parent 839d90981d
commit c14e5623ad
3 changed files with 7 additions and 19 deletions

View file

@ -81,11 +81,10 @@ class QFMDLSettings(bpy.types.PropertyGroup):
name="Effects",
description="Particle trail effects")
#doesn't work :(
#script = PointerProperty(
# type=bpy.types.Object,
# name="Script",
# description="Script for animating frames and skins")
script : PointerProperty(
type=bpy.types.Text,
name="Script",
description="Script for animating frames and skins")
xform : BoolProperty(
name="Auto transform",
@ -101,9 +100,6 @@ class QFMDLSettings(bpy.types.PropertyGroup):
md16 = BoolProperty(
name="16-bit",
description="16 bit vertex coordinates: QuakeForge only")
#script = StringProperty(
# name="Script",
# description="Script for animating frames and skins")
class ImportMDL6(bpy.types.Operator, ImportHelper):
'''Load a Quake MDL (v6) File'''

View file

@ -245,18 +245,10 @@ def get_properties(
if md16:
mdl.ident = "MD16"
#tomporarily disabled
#script = obj.qfmdl.script
script = None
script = obj.qfmdl.script
mdl.script = None
if script:
try:
script = bpy.data.texts[script].as_string()
except KeyError:
operator.report({'ERROR'},
"Script '%s' not found." % script)
return False
pl = pldata(script)
pl = pldata(script.as_string())
try:
mdl.script = pl.parse()
except PListError as err:

View file

@ -390,7 +390,7 @@ def set_properties(mdl):
mdl.obj.qfmdl.synctype = 'ST_SYNC'
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.script = mdl.text
mdl.obj.qfmdl.md16 = (mdl.ident == "MD16")
def import_mdl(operator, context, filepath, **opts):