mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 10:50:58 +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:
|
||||
make_skin(operator, mdl, mesh)
|
||||
if not mdl.frames:
|
||||
curframe = context.scene.frame_current
|
||||
for fno in range(context.scene.frame_start, context.scene.frame_end + 1):
|
||||
context.scene.frame_set(fno)
|
||||
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.mesh.shape_keys.name = mdl.name
|
||||
mdl.obj.active_shape_key_index = 0
|
||||
bpy.context.scene.frame_end = 0
|
||||
for i, frame in enumerate(mdl.frames):
|
||||
frame = mdl.frames[i]
|
||||
if frame.type:
|
||||
for j in range(len(frame.frames)):
|
||||
make_shape_key(mdl, i, j)
|
||||
bpy.context.scene.frame_end += 1
|
||||
else:
|
||||
make_shape_key(mdl, i)
|
||||
bpy.context.scene.frame_end += 1
|
||||
|
||||
def set_keys(act, data):
|
||||
for d in data:
|
||||
|
@ -395,6 +398,9 @@ def import_mdl(operator, context, filepath, **opts):
|
|||
mdl.obj.select_set(True)
|
||||
bpy.context.view_layer.objects.active = mdl.obj
|
||||
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:
|
||||
build_shape_keys(mdl)
|
||||
merge_frames(mdl)
|
||||
|
|
Loading…
Reference in a new issue