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:
authorJoshua Leung <aligorith@gmail.com>2011-03-25 06:58:21 +0300
committerJoshua Leung <aligorith@gmail.com>2011-03-25 06:58:21 +0300
commit16e736b7db3ef3597e22f55e7b26416ee562a418 (patch)
tree7b4d0980e6c33c35aea5b375718add6f84dbb74e /release/scripts
parent0c03fa78c10f04283512f2a5a4557d86c72d6f29 (diff)
Graph Editor: Euler Filter ported from Py to C
Ported joeedh's Euler Filter code from Python to C so that this is more in line with the other Graph Editor tools - i.e. joeedh's version only worked on the active bone's curves, while standard tools could work with multiple bones/objects at the same time. To use this new version of this operator: 1) Select all the F-Curves for all 3 of the components (XYZ) for the euler rotations you wish to clean up. In the Graph Editor, they must be one after the other (i.e. you can't have "RotX, RotY, something else, RotZ") 2) Activate the operator from the Key menu in the Graph Editor In an old test file I have floating around, this method did not appear to be good enough to fix a very clear discontinuity in the middle of the action, so I'll test some additional methods too
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/startup/bl_operators/__init__.py1
-rw-r--r--release/scripts/startup/bl_operators/fcurve_euler_filter.py78
2 files changed, 0 insertions, 79 deletions
diff --git a/release/scripts/startup/bl_operators/__init__.py b/release/scripts/startup/bl_operators/__init__.py
index 599cd6c1889..2a42cfbacb8 100644
--- a/release/scripts/startup/bl_operators/__init__.py
+++ b/release/scripts/startup/bl_operators/__init__.py
@@ -25,7 +25,6 @@ if "bpy" in locals():
_modules = (
"add_mesh_torus",
"animsys_update",
- "fcurve_euler_filter",
"image",
"mesh",
"nla",
diff --git a/release/scripts/startup/bl_operators/fcurve_euler_filter.py b/release/scripts/startup/bl_operators/fcurve_euler_filter.py
deleted file mode 100644
index c7b249a1d0c..00000000000
--- a/release/scripts/startup/bl_operators/fcurve_euler_filter.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-import bpy
-
-
-def main(context):
- from math import pi
-
- def cleanupEulCurve(fcv):
- keys = []
-
- for k in fcv.keyframe_points:
- keys.append([k.handle_left.copy(), k.co.copy(), k.handle_right.copy()])
-
- for i in range(len(keys)):
- cur = keys[i]
- prev = keys[i - 1] if i > 0 else None
- next = keys[i + 1] if i < len(keys) - 1 else None
-
- if prev is None:
- continue
-
- th = pi
- if abs(prev[1][1] - cur[1][1]) >= th: # more than 180 degree jump
- fac = pi * 2.0
- if prev[1][1] > cur[1][1]:
- while abs(cur[1][1] - prev[1][1]) >= th: # < prev[1][1]:
- cur[0][1] += fac
- cur[1][1] += fac
- cur[2][1] += fac
- elif prev[1][1] < cur[1][1]:
- while abs(cur[1][1] - prev[1][1]) >= th:
- cur[0][1] -= fac
- cur[1][1] -= fac
- cur[2][1] -= fac
-
- for i in range(len(keys)):
- for x in range(2):
- fcv.keyframe_points[i].handle_left[x] = keys[i][0][x]
- fcv.keyframe_points[i].co[x] = keys[i][1][x]
- fcv.keyframe_points[i].handle_right[x] = keys[i][2][x]
-
- flist = bpy.context.active_object.animation_data.action.fcurves
- for f in flist:
- if f.select and f.data_path.endswith("rotation_euler"):
- cleanupEulCurve(f)
-
-
-class DiscontFilterOp(bpy.types.Operator):
- """Fixes the most common causes of gimbal lock in the fcurves of the active bone"""
- bl_idname = "graph.euler_filter"
- bl_label = "Filter out discontinuities in the active fcurves"
-
- @classmethod
- def poll(cls, context):
- return context.active_object != None
-
- def execute(self, context):
- main(context)
- return {'FINISHED'}