From 7f0dc54f61cc5b443e2aba09d0d8c06b0c6a718c Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 9 Nov 2006 08:43:27 +0000 Subject: This commit adds two of my recent animation editing related patches: #5061 - Ipo/Action 'Cleaning' #5071 - 'Only Needed' Keyframing Option ==================== * IPO/Action 'Cleaning': It removes un-necessary keyframes from individual ipo curves. - In both editors, the hotkey is currently the OKEY. Also accesable from menus of each editor. - There is currently a 'threshold' popup. This sets the value that the cleaner uses to determine if two keys have same time/value There are a few improvements that could still be made, such as: - There are a few cases that it still doesn't handle yet, such as when un-needed keyframes lie on a linear line (and similiar cases). This shall be improved soon. - Also, for some reason, after running cleaning while in ipo editor editmode, all but the active curve are hidden. ==================== * 'Only Needed' Keyframing Option: This patch adds a new keyframing option for objects and bones. It only adds keyframes where they are needed, judging from the surrounding points on that curve. Notes about this keyframing option: - Works like the existing 'Avail' option, except it checks if the keyframe is needed. - Currently uses hardcoded threshold for determining if same value. [quote] /* Cases where keyframes should not be added: * 1. Keyframe to be added bewteen two keyframes with similar values * 2. Keyframe to be added between two keyframes with similar times * 3. Keyframe lies at point that intersects the linear line between two keyframes */ [/unquote] --- source/blender/src/header_action.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/src/header_action.c') diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index 5ab3d4d3657..de4cafbe3ec 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -93,6 +93,7 @@ #define ACTMENU_KEY_DELETE 1 #define ACTMENU_KEY_BAKE 2 #define ACTMENU_KEY_SNAP 3 +#define ACTMENU_KEY_CLEAN 4 #define ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_UP 0 #define ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_DOWN 1 @@ -780,6 +781,12 @@ static void do_action_keymenu(void *arg, int event) case ACTMENU_KEY_SNAP: snap_keys_to_frame(); break; + case ACTMENU_KEY_CLEAN: + if (key) + clean_shapekeys(key); + else if (act) + clean_actionchannels(act); + break; } } @@ -815,6 +822,11 @@ static uiBlock *action_keymenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Clean Action|O", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_CLEAN, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bake Action to Ipo Keys", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, -- cgit v1.2.3