also key rotation at curve follow path creation

1.5.1

- fixed: also key rotation when creating curve
master
Pullusb 2022-04-27 15:07:34 +02:00
parent c98bb520b8
commit a9fb804a22
5 changed files with 13 additions and 5 deletions

View File

@ -1,5 +1,9 @@
# Changelog
1.5.1
- fixed: also key rotation when creating curve
1.5.0
- changed: no need to have a cycle on fcurve to bake keys anymore

View File

@ -35,13 +35,15 @@ def has_extremes(b, act=None):
return False
for fcu in act.fcurves:
if not '"' in fcu.data_path:
continue
if fcu.data_path.split('"')[1] == b.name: # name of the bone
if [k for k in fcu.keyframe_points if k.type == 'EXTREME']:
return True
return False
def get_extreme_range(ob, act, b):
b_fcurves = [fcu for fcu in act.fcurves if fcu.data_path.split('"')[1] == b.bone.name]
b_fcurves = [fcu for fcu in act.fcurves if '"' in fcu.data_path and fcu.data_path.split('"')[1] == b.bone.name]
# for f in b_fcurves:
# print('fc:', f.data_path, f.array_index)
curves = []
@ -208,7 +210,7 @@ def anim_path_from_translate():
# axis : fcu.array_index (to get axis letter : {0:'X', 1:'Y', 2:'Z'}[fcu.array_index])
## get only fcurves relative to selected bone
b_fcurves = [fcu for fcu in act.fcurves if fcu.data_path.split('"')[1] == b.bone.name]
b_fcurves = [fcu for fcu in act.fcurves if '"' in fcu.data_path and fcu.data_path.split('"')[1] == b.bone.name]
print('b_fcurves: ', len(b_fcurves))
# find best fcurve

View File

@ -73,6 +73,8 @@ class AW_OT_create_a_b_step(bpy.types.Operator):
# reset location to remove offset
root.location = (0,0,0)
root.keyframe_insert('location', frame=a_frame)
root.rotation_euler = (0,0,0)
root.keyframe_insert('rotation_euler', frame=a_frame)
# refresh evaluation so constraint shows up correctly
bpy.context.scene.frame_set(bpy.context.scene.frame_current)

View File

@ -42,8 +42,8 @@ class AW_OT_create_curve_path(bpy.types.Operator):
# reset location to remove offset
root.location = (0,0,0)
root.keyframe_insert('location')
#root.rotation_euler = (0,0,0)
# root.keyframe_insert('rotation_euler')
root.rotation_euler = (0,0,0)
root.keyframe_insert('rotation_euler')
# refresh evaluation so constraint shows up correctly
bpy.context.scene.frame_set(bpy.context.scene.frame_current)

View File

@ -4,7 +4,7 @@ bl_info = {
"name": "Auto Walk",
"description": "Develop a walk/run cycles along a curve and pin feets",
"author": "Samuel Bernou",
"version": (1, 5, 0),
"version": (1, 5, 1),
"blender": (3, 0, 0),
"location": "View3D",
"warning": "",