Skip to content

Commit

Permalink
fix motion path calculation for the 3.2 API update
Browse files Browse the repository at this point in the history
  • Loading branch information
tingjoybits committed Jun 27, 2022
1 parent 9ae9afa commit d806c00
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Mesh_Onion_Skins.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
bl_info = {
'name': "Mesh Onion Skins",
'author': "TingJoyBits",
'version': (1, 1, 2),
'version': (1, 1, 3),
'blender': (2, 80, 0),
'location': "View3D > Animation > Mesh Onion Skins",
'description': "Mesh Onion Skins for Blender Animations",
Expand Down Expand Up @@ -1798,6 +1798,13 @@ def run_filter_active_bone(obj, fcurve):
return skip


def calculate_motion_path(mode, display_type):
if bpy.app.version < (3, 2, 0):
exec(f"bpy.ops.{mode}.paths_calculate()")
else:
exec(f"bpy.ops.{mode}.paths_calculate(display_type=display_type)")


def create_update_motion_path(context, mode, obj, fs, fe, kfbefore, kfafter):
sc = context.scene.onion_skins_scene_props
curframe = context.scene.frame_current
Expand Down Expand Up @@ -1850,14 +1857,13 @@ def create_update_motion_path(context, mode, obj, fs, fe, kfbefore, kfafter):
if mode == 'POSE':
if mp.has_motion_paths is True:
bpy.ops.pose.paths_clear(only_selected=False)
bpy.ops.pose.paths_calculate(start_frame=fs, end_frame=fe+1)
elif mode == 'OBJECT':
if mp.has_motion_paths is True:
if sc.os_draw_mode == 'MESH':
bpy.ops.object.paths_clear(only_selected=False)
else:
bpy.ops.object.paths_clear(only_selected=True)
bpy.ops.object.paths_calculate(start_frame=fs, end_frame=fe + 1)
calculate_motion_path(mode.lower(), mp.type)
bpy.ops.object.mode_set(mode=mode)


Expand Down

0 comments on commit d806c00

Please sign in to comment.