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
|
||||
|
||||
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
|
||||
|
||||
- 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)
|
||||
|
||||
## steps: number of repetitions (how many times the move distance fit in the lenght of the curve)
|
||||
steps = length / move_val
|
||||
|
||||
## frame_duration: number of frame for the move multiplied by the step
|
||||
frame_duration = int(steps * move_frame)
|
||||
|
||||
|
||||
const = root.constraints.get("Follow Path")
|
||||
if not const:
|
||||
return 'ERROR', f'No "Follow Path" constraint on bone "{root.name}"'
|
||||
|
@ -333,29 +334,30 @@ def anim_path_from_translate():
|
|||
if fcu:
|
||||
ob.animation_data.action.fcurves.remove(fcu)
|
||||
|
||||
|
||||
## add eval time animation on curve
|
||||
anim_frame = settings.start_frame
|
||||
curve.data.path_duration = frame_duration
|
||||
|
||||
# curve.data.eval_time = 0
|
||||
# curve.data.keyframe_insert('eval_time', frame=anim_frame) # , options={'INSERTKEY_AVAILABLE'}
|
||||
|
||||
const.offset = 0
|
||||
const.keyframe_insert('offset', frame=anim_frame)
|
||||
# curve.data.path_duration = frame_duration # set only 100
|
||||
curve.data.path_duration = 100
|
||||
|
||||
# curve.data.eval_time = frame_duration
|
||||
# curve.data.keyframe_insert('eval_time', frame=anim_frame + frame_duration)
|
||||
const.offset = 0
|
||||
const.keyframe_insert('offset', frame=anim_frame) # , options={'INSERTKEY_AVAILABLE'}
|
||||
|
||||
const.offset = -frame_duration # negative (offset time rewinding so character move forward)
|
||||
## 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)
|
||||
|
||||
## 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)
|
||||
if fcu:
|
||||
for k in fcu.keyframe_points:
|
||||
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
|
||||
# for k in t_fcu.keyframe_points:
|
||||
# k.interpolation = 'CONSTANT'
|
||||
|
|
|
@ -60,7 +60,7 @@ class UAC_OT_create_a_b_step(bpy.types.Operator):
|
|||
|
||||
a = markers[0].location
|
||||
b = markers[1].location - a # remove a postion to get position in curve object space
|
||||
|
||||
|
||||
# Set the curve and constraint
|
||||
curve = fn.generate_curve(location=a, direction=b, name='curve_path', context=context)
|
||||
settings = context.scene.anim_cycle_settings
|
||||
|
|
|
@ -4,7 +4,7 @@ bl_info = {
|
|||
"name": "Unfold Anim Cycle",
|
||||
"description": "Anim tools to develop walk/run cycles along a curve",
|
||||
"author": "Samuel Bernou",
|
||||
"version": (1, 1, 0),
|
||||
"version": (1, 2, 0),
|
||||
"blender": (3, 0, 0),
|
||||
"location": "View3D",
|
||||
"warning": "",
|
||||
|
|
Loading…
Reference in New Issue