Page Menu
Home
Search
Configure Global Search
Log In
Files
F12436
frame-select-left-right.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Torsten Rupp (rupp)
Nov 13 2013, 2:34 PM
Size
5 KB
Subscribers
None
frame-select-left-right.patch
View Options
Index: release/scripts/ui/space_dopesheet.py
===================================================================
--- release/scripts/ui/space_dopesheet.py (revision 31785)
+++ release/scripts/ui/space_dopesheet.py (working copy)
@@ -169,6 +169,10 @@
layout.operator("action.select_column", text="Between Selected Markers").mode = 'MARKERS_BETWEEN'
layout.separator()
+ layout.operator("action.select_column", text="Columns Left to Current Frame").mode = 'LEFT'
+ layout.operator("action.select_column", text="Columns Right to Current Frame").mode = 'RIGHT'
+
+ layout.separator()
layout.operator("action.select_more")
layout.operator("action.select_less")
Index: source/blender/editors/space_action/action_ops.c
===================================================================
--- source/blender/editors/space_action/action_ops.c (revision 31785)
+++ source/blender/editors/space_action/action_ops.c (working copy)
@@ -113,6 +113,10 @@
RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_MARKERS_COLUMN);
RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_MARKERS_BETWEEN);
+ /* column select left/right to current frame */
+ RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", RIGHTBRACKETKEY, KM_PRESS, 0, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_LEFT);
+ RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", LEFTBRACKETKEY, KM_PRESS, 0, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_RIGHT);
+
/* select more/less */
WM_keymap_add_item(keymap, "ACTION_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ACTION_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
Index: source/blender/editors/space_action/action_intern.h
===================================================================
--- source/blender/editors/space_action/action_intern.h (revision 31785)
+++ source/blender/editors/space_action/action_intern.h (working copy)
@@ -73,6 +73,8 @@
enum {
ACTKEYS_COLUMNSEL_KEYS = 0,
ACTKEYS_COLUMNSEL_CFRA,
+ ACTKEYS_COLUMNSEL_LEFT,
+ ACTKEYS_COLUMNSEL_RIGHT,
ACTKEYS_COLUMNSEL_MARKERS_COLUMN,
ACTKEYS_COLUMNSEL_MARKERS_BETWEEN,
} eActKeys_ColumnSelect_Mode;
Index: source/blender/editors/space_action/action_select.c
===================================================================
--- source/blender/editors/space_action/action_select.c (revision 31785)
+++ source/blender/editors/space_action/action_select.c (working copy)
@@ -53,6 +53,7 @@
#include "ED_keyframes_edit.h"
#include "ED_markers.h"
#include "ED_screen.h"
+#include "ED_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -352,6 +353,8 @@
static EnumPropertyItem prop_column_select_types[] = {
{ACTKEYS_COLUMNSEL_KEYS, "KEYS", 0, "On Selected Keyframes", ""},
{ACTKEYS_COLUMNSEL_CFRA, "CFRA", 0, "On Current Frame", ""},
+ {ACTKEYS_COLUMNSEL_LEFT, "LEFT", 0, "Left to Current Frame", ""},
+ {ACTKEYS_COLUMNSEL_RIGHT, "RIGHT", 0, "Right to Current Frame", ""},
{ACTKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", 0, "On Selected Markers", ""},
{ACTKEYS_COLUMNSEL_MARKERS_BETWEEN, "MARKERS_BETWEEN", 0, "Between Min/Max Selected Markers", ""},
{0, NULL, 0, NULL, NULL}
@@ -406,6 +409,52 @@
}
+/* Selects all visible keyframes left/right to current frame */
+static void columnselect_action_left_right (bAnimContext *ac, short mode)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ Scene *scene= ac->scene;
+ KeyframeEditFunc ok_cb, select_cb;
+ KeyframeEditData ked;
+
+ /* get editing funcs + data */
+ ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
+ select_cb= ANIM_editkeyframes_select(SELECT_ADD);
+
+ memset(&ked, 0, sizeof(KeyframeEditData));
+ if (mode == ACTKEYS_COLUMNSEL_LEFT) {
+ ked.f1= MINFLOAT;
+ ked.f2= (float)CFRA + 0.5f;
+ } else {
+ ked.f1= (float)CFRA - 0.5f;
+ ked.f2= MAXFLOAT;
+ }
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* select keys in-between */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ AnimData *adt= ANIM_nla_mapping_get(ac, ale);
+
+ if (adt) {
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
+ ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
+ }
+ else {
+ ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
+ }
+ }
+
+ /* Cleanup */
+ BLI_freelistN(&anim_data);
+}
+
/* Selects all visible keyframes in the same frames as the specified elements */
static void columnselect_action_keys (bAnimContext *ac, short mode)
{
@@ -522,6 +571,10 @@
if (mode == ACTKEYS_COLUMNSEL_MARKERS_BETWEEN)
markers_selectkeys_between(&ac);
+ else if (mode == ACTKEYS_COLUMNSEL_LEFT)
+ columnselect_action_left_right(&ac, mode);
+ else if (mode == ACTKEYS_COLUMNSEL_RIGHT)
+ columnselect_action_left_right(&ac, mode);
else
columnselect_action_keys(&ac, mode);
Index: source/blender/editors/include/ED_types.h
===================================================================
--- source/blender/editors/include/ED_types.h (revision 31785)
+++ source/blender/editors/include/ED_types.h (working copy)
@@ -36,6 +36,9 @@
#define ACTIVE 2
/* nonstandard define, sometimes in math.h */
+#ifndef MINFLOAT
+#define MINFLOAT ((float)1.40129846e-45)
+#endif
#ifndef MAXFLOAT
#define MAXFLOAT ((float)3.40282347e+38)
#endif
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
30/51/122b2c6fdfed31d5034ce2df95dd
Event Timeline
Log In to Comment