new offset anim method
1.2.0 - changed: curve offset on base 100 (allow multiple action with same curve path animation range) - changed: offset animation extrapolated by default (for potential motion blur at start and continue after curves end)master
parent
f07d395289
commit
a7a3c5a96a
|
@ -1,5 +1,10 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
1.2.0
|
||||||
|
|
||||||
|
- changed: curve offset on base 100 (allow multiple action with same curve path animation range)
|
||||||
|
- changed: offset animation extrapolated by default (for potential motion blur at start and continue after curves end)
|
||||||
|
|
||||||
1.1.0
|
1.1.0
|
||||||
|
|
||||||
- added: another method to add curve placing character in two position
|
- added: another method to add curve placing character in two position
|
||||||
|
|
|
@ -318,11 +318,12 @@ def anim_path_from_translate():
|
||||||
|
|
||||||
length = fn.get_curve_length(curve)
|
length = fn.get_curve_length(curve)
|
||||||
|
|
||||||
|
## steps: number of repetitions (how many times the move distance fit in the lenght of the curve)
|
||||||
steps = length / move_val
|
steps = length / move_val
|
||||||
|
|
||||||
|
## frame_duration: number of frame for the move multiplied by the step
|
||||||
frame_duration = int(steps * move_frame)
|
frame_duration = int(steps * move_frame)
|
||||||
|
|
||||||
|
|
||||||
const = root.constraints.get("Follow Path")
|
const = root.constraints.get("Follow Path")
|
||||||
if not const:
|
if not const:
|
||||||
return 'ERROR', f'No "Follow Path" constraint on bone "{root.name}"'
|
return 'ERROR', f'No "Follow Path" constraint on bone "{root.name}"'
|
||||||
|
@ -333,29 +334,30 @@ def anim_path_from_translate():
|
||||||
if fcu:
|
if fcu:
|
||||||
ob.animation_data.action.fcurves.remove(fcu)
|
ob.animation_data.action.fcurves.remove(fcu)
|
||||||
|
|
||||||
|
|
||||||
## add eval time animation on curve
|
|
||||||
anim_frame = settings.start_frame
|
anim_frame = settings.start_frame
|
||||||
curve.data.path_duration = frame_duration
|
# curve.data.path_duration = frame_duration # set only 100
|
||||||
|
curve.data.path_duration = 100
|
||||||
# curve.data.eval_time = 0
|
|
||||||
# curve.data.keyframe_insert('eval_time', frame=anim_frame) # , options={'INSERTKEY_AVAILABLE'}
|
|
||||||
|
|
||||||
const.offset = 0
|
const.offset = 0
|
||||||
const.keyframe_insert('offset', frame=anim_frame)
|
const.keyframe_insert('offset', frame=anim_frame) # , options={'INSERTKEY_AVAILABLE'}
|
||||||
|
|
||||||
# curve.data.eval_time = frame_duration
|
## negative (offset time rewinding so character move forward)
|
||||||
# curve.data.keyframe_insert('eval_time', frame=anim_frame + frame_duration)
|
|
||||||
|
|
||||||
const.offset = -frame_duration # negative (offset time rewinding so character move forward)
|
# const.offset = -frame_duration # Valid when duration is set same as curve's path_duration
|
||||||
|
# const.offset = -(((move_frame * 100) / frame_duration) * steps) # works and slightly more precise but super convoluted
|
||||||
|
const.offset = -100
|
||||||
const.keyframe_insert('offset', frame=anim_frame + frame_duration)
|
const.keyframe_insert('offset', frame=anim_frame + frame_duration)
|
||||||
|
|
||||||
## all to linear (will be set to CONSTANT at the moment of sampling)
|
## All to linear (will be set to CONSTANT at the moment of sampling)
|
||||||
fcu = ob.animation_data.action.fcurves.find(offset_data_path)
|
fcu = ob.animation_data.action.fcurves.find(offset_data_path)
|
||||||
if fcu:
|
if fcu:
|
||||||
for k in fcu.keyframe_points:
|
for k in fcu.keyframe_points:
|
||||||
k.interpolation = 'LINEAR'
|
k.interpolation = 'LINEAR'
|
||||||
|
|
||||||
|
# Set extrapolation to linear to avoid a stop # TODO: maybe expose choice ?
|
||||||
|
fcu.extrapolation = 'LINEAR' # default is 'CONSTANT'
|
||||||
|
# defaut to linear (avoid mothion blur problem if start is set exactly on scene.frame_start)
|
||||||
|
|
||||||
## set all to constant
|
## set all to constant
|
||||||
# for k in t_fcu.keyframe_points:
|
# for k in t_fcu.keyframe_points:
|
||||||
# k.interpolation = 'CONSTANT'
|
# k.interpolation = 'CONSTANT'
|
||||||
|
|
|
@ -4,7 +4,7 @@ bl_info = {
|
||||||
"name": "Unfold Anim Cycle",
|
"name": "Unfold Anim Cycle",
|
||||||
"description": "Anim tools to develop walk/run cycles along a curve",
|
"description": "Anim tools to develop walk/run cycles along a curve",
|
||||||
"author": "Samuel Bernou",
|
"author": "Samuel Bernou",
|
||||||
"version": (1, 1, 0),
|
"version": (1, 2, 0),
|
||||||
"blender": (3, 0, 0),
|
"blender": (3, 0, 0),
|
||||||
"location": "View3D",
|
"location": "View3D",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
|
Loading…
Reference in New Issue