Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjy Cook <benjycook@hotmail.com>2011-08-15 14:17:04 +0400
committerBenjy Cook <benjycook@hotmail.com>2011-08-15 14:17:04 +0400
commit3237f39243ab431fbdf736e3b8648a0c19400564 (patch)
treea1ef9a970744d4b6c38a3bfa2a3f0564f2a81cc6 /release/scripts
parentcc3b9aa467bd9a43a28eccf990e00fddd5ed9564 (diff)
Small fix to autoloop due to changes in utility function by animation stitching
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/modules/mocap_tools.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/release/scripts/modules/mocap_tools.py b/release/scripts/modules/mocap_tools.py
index f4b6a93f531..e5d4dcb6554 100644
--- a/release/scripts/modules/mocap_tools.py
+++ b/release/scripts/modules/mocap_tools.py
@@ -169,20 +169,24 @@ def crossCorrelationMatch(curvesA, curvesB, margin):
def autoloop_anim():
context = bpy.context
obj = context.active_object
- fcurves = [x for x in obj.animation_data.action.fcurves if x.select]
+
+ def locCurve(x):
+ x.data_path == "location"
+
+ fcurves = [x for x in obj.animation_data.action.fcurves if not locCurve(x)]
margin = 10
flm, s, data = crossCorrelationMatch(fcurves, fcurves, margin)
- loop = data[s:s + flm + margin]
+ loop = data[s:s + flm]
#find *all* loops, s:s+flm, s+flm:s+2flm, etc...
#and interpolate between all
# to find "the perfect loop".
#Maybe before finding s? interp(i,i+flm,i+2flm)....
- for i in range(1, margin + 1):
- w1 = sqrt(float(i) / margin)
- loop[-i] = (loop[-i] * w1) + (loop[0] * (1 - w1))
+ #~ for i in range(1, margin + 1):
+ #~ w1 = sqrt(float(i) / margin)
+ #~ loop[-i] = (loop[-i] * w1) + (loop[0] * (1 - w1))
for curve in fcurves:
pts = curve.keyframe_points
@@ -192,9 +196,9 @@ def autoloop_anim():
for c, curve in enumerate(fcurves):
pts = curve.keyframe_points
for i in range(len(loop)):
- pts.insert(i + 1, loop[i][c])
+ pts.insert(i + 2, loop[i][c])
- context.scene.frame_end = flm + 1
+ context.scene.frame_end = flm
def simplifyCurves(curveGroup, error, reparaError, maxIterations, group_mode):