mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 09:02:08 +00:00
Adjust playback range on import, to fit mdl's animation length
This commit is contained in:
parent
66fe862a87
commit
17e76149a1
2 changed files with 6 additions and 1 deletions
|
@ -346,7 +346,6 @@ def export_mdl(
|
||||||
if not mdl.skins:
|
if not mdl.skins:
|
||||||
make_skin(operator, mdl, mesh)
|
make_skin(operator, mdl, mesh)
|
||||||
if not mdl.frames:
|
if not mdl.frames:
|
||||||
curframe = context.scene.frame_current
|
|
||||||
for fno in range(context.scene.frame_start, context.scene.frame_end + 1):
|
for fno in range(context.scene.frame_start, context.scene.frame_end + 1):
|
||||||
context.scene.frame_set(fno)
|
context.scene.frame_set(fno)
|
||||||
mesh = obj.to_mesh(context.depsgraph, True, calc_undeformed=False) #wysiwyg?
|
mesh = obj.to_mesh(context.depsgraph, True, calc_undeformed=False) #wysiwyg?
|
||||||
|
|
|
@ -184,13 +184,16 @@ def build_shape_keys(mdl):
|
||||||
mdl.obj.shape_key_add(name="Basis",from_mix=False)
|
mdl.obj.shape_key_add(name="Basis",from_mix=False)
|
||||||
mdl.mesh.shape_keys.name = mdl.name
|
mdl.mesh.shape_keys.name = mdl.name
|
||||||
mdl.obj.active_shape_key_index = 0
|
mdl.obj.active_shape_key_index = 0
|
||||||
|
bpy.context.scene.frame_end = 0
|
||||||
for i, frame in enumerate(mdl.frames):
|
for i, frame in enumerate(mdl.frames):
|
||||||
frame = mdl.frames[i]
|
frame = mdl.frames[i]
|
||||||
if frame.type:
|
if frame.type:
|
||||||
for j in range(len(frame.frames)):
|
for j in range(len(frame.frames)):
|
||||||
make_shape_key(mdl, i, j)
|
make_shape_key(mdl, i, j)
|
||||||
|
bpy.context.scene.frame_end += 1
|
||||||
else:
|
else:
|
||||||
make_shape_key(mdl, i)
|
make_shape_key(mdl, i)
|
||||||
|
bpy.context.scene.frame_end += 1
|
||||||
|
|
||||||
def set_keys(act, data):
|
def set_keys(act, data):
|
||||||
for d in data:
|
for d in data:
|
||||||
|
@ -395,6 +398,9 @@ def import_mdl(operator, context, filepath, **opts):
|
||||||
mdl.obj.select_set(True)
|
mdl.obj.select_set(True)
|
||||||
bpy.context.view_layer.objects.active = mdl.obj
|
bpy.context.view_layer.objects.active = mdl.obj
|
||||||
setup_skins(mdl, uvs)
|
setup_skins(mdl, uvs)
|
||||||
|
|
||||||
|
bpy.context.scene.frame_start = 1
|
||||||
|
bpy.context.scene.frame_end = 1
|
||||||
if len(mdl.frames) > 1 or mdl.frames[0].type:
|
if len(mdl.frames) > 1 or mdl.frames[0].type:
|
||||||
build_shape_keys(mdl)
|
build_shape_keys(mdl)
|
||||||
merge_frames(mdl)
|
merge_frames(mdl)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue