Graph Editor - Selection Tools
* Mouse-Select and DeSelect All work again * Added access to constraint 'influence' value
This commit is contained in:
@@ -183,8 +183,8 @@ short animsys_remap_path (AnimMapper *remap, char *path, char **dst)
|
||||
}
|
||||
|
||||
|
||||
/* Write the given value to a setting using RNA */
|
||||
static void animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value)
|
||||
/* Write the given value to a setting using RNA, and return success */
|
||||
static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
PointerRNA new_ptr;
|
||||
@@ -222,6 +222,15 @@ static void animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_in
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* successful */
|
||||
// XXX should the unhandled case also be successful?
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
/* failed to get path */
|
||||
printf("Animato: Invalid path '%s[%d]' \n", path, array_index);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -250,6 +250,21 @@ static char *pchan_adrcodes_to_paths (int adrcode, int *array_index)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Constraint types */
|
||||
static char *constraint_adrcodes_to_paths (int adrcode, int *array_index)
|
||||
{
|
||||
/* set array index like this in-case nothing sets it correctly */
|
||||
*array_index= 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case CO_ENFORCE:
|
||||
return "influence";
|
||||
case CO_HEADTAIL: // XXX this needs to be wrapped in RNA.. probably then this path will be invalid
|
||||
return "data.head_tail";
|
||||
}
|
||||
}
|
||||
|
||||
/* ShapeKey types
|
||||
* NOTE: as we don't have access to the keyblock where the data comes from (for now),
|
||||
* we'll just use numerical indicies for now...
|
||||
|
||||
@@ -521,7 +521,7 @@ void ACT_OT_keyframes_borderselect(wmOperatorType *ot)
|
||||
*/
|
||||
|
||||
/* defines for column-select mode */
|
||||
EnumPropertyItem prop_column_select_types[] = {
|
||||
static EnumPropertyItem prop_column_select_types[] = {
|
||||
{ACTKEYS_COLUMNSEL_KEYS, "KEYS", "On Selected Keyframes", ""},
|
||||
{ACTKEYS_COLUMNSEL_CFRA, "CFRA", "On Current Frame", ""},
|
||||
{ACTKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", "On Selected Markers", ""},
|
||||
@@ -750,7 +750,7 @@ void ACT_OT_keyframes_columnselect (wmOperatorType *ot)
|
||||
*/
|
||||
|
||||
/* defines for left-right select tool */
|
||||
EnumPropertyItem prop_leftright_select_types[] = {
|
||||
static EnumPropertyItem prop_leftright_select_types[] = {
|
||||
{ACTKEYS_LRSEL_TEST, "CHECK", "Check if Select Left or Right", ""},
|
||||
{ACTKEYS_LRSEL_NONE, "OFF", "Don't select", ""},
|
||||
{ACTKEYS_LRSEL_LEFT, "LEFT", "Before current frame", ""},
|
||||
@@ -978,12 +978,13 @@ static void mouse_columnselect_action_keys (bAnimContext *ac, float selx)
|
||||
Object *nob= ANIM_nla_mapping_get(ac, ale);
|
||||
|
||||
/* set frame for validation callback to refer to */
|
||||
// XXX have a more sensitive range?
|
||||
if (nob)
|
||||
bed.f1= get_action_frame(nob, selx);
|
||||
else
|
||||
bed.f1= selx;
|
||||
|
||||
/* select elements with frame number matching cfraelem */
|
||||
/* select elements with frame number matching cfra */
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
|
||||
|
||||
#if 0 // XXX reenable when Grease Pencil stuff is back
|
||||
|
||||
@@ -125,16 +125,15 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys
|
||||
static GLuint displist=0;
|
||||
|
||||
/* initialise round circle shape */
|
||||
// FIXME: sometimes, this will draw incorrectly (i.e. a scaled copy shows up at the origin)
|
||||
if (displist == 0) {
|
||||
GLUquadricObj *qobj;
|
||||
|
||||
displist= glGenLists(1);
|
||||
glNewList(displist, GL_COMPILE_AND_EXECUTE);
|
||||
glNewList(displist, GL_COMPILE);
|
||||
|
||||
qobj = gluNewQuadric();
|
||||
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
|
||||
gluDisk(qobj, 0.07, 0.6, 8, 1);
|
||||
gluDisk(qobj, 0, 0.7, 8, 1);
|
||||
gluDeleteQuadric(qobj);
|
||||
|
||||
glEndList();
|
||||
|
||||
@@ -507,14 +507,9 @@ static int graphkeys_copy_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* copy keyframes */
|
||||
if (ac.datatype == ANIMCONT_GPENCIL) {
|
||||
// FIXME...
|
||||
}
|
||||
else {
|
||||
if (copy_graph_keys(&ac)) {
|
||||
// XXX errors - need a way to inform the user
|
||||
printf("Action Copy: No keyframes copied to copy-paste buffer\n");
|
||||
}
|
||||
if (copy_graph_keys(&ac)) {
|
||||
// XXX errors - need a way to inform the user
|
||||
printf("Action Copy: No keyframes copied to copy-paste buffer\n");
|
||||
}
|
||||
|
||||
/* set notifier tha things have changed */
|
||||
@@ -548,14 +543,9 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* paste keyframes */
|
||||
if (ac.datatype == ANIMCONT_GPENCIL) {
|
||||
// FIXME...
|
||||
}
|
||||
else {
|
||||
if (paste_graph_keys(&ac)) {
|
||||
// XXX errors - need a way to inform the user
|
||||
printf("Action Paste: Nothing to paste, as Copy-Paste buffer was empty.\n");
|
||||
}
|
||||
if (paste_graph_keys(&ac)) {
|
||||
// XXX errors - need a way to inform the user
|
||||
printf("Action Paste: Nothing to paste, as Copy-Paste buffer was empty.\n");
|
||||
}
|
||||
|
||||
/* validate keyframes after editing */
|
||||
@@ -590,18 +580,12 @@ static void delete_graph_keys (bAnimContext *ac)
|
||||
int filter;
|
||||
|
||||
/* filter data */
|
||||
if (ac->datatype == ANIMCONT_GPENCIL)
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT);
|
||||
else
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* loop through filtered data and delete selected keys */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
//if (ale->type == ANIMTYPE_GPLAYER)
|
||||
// delete_gplayer_frames((bGPDlayer *)ale->data);
|
||||
//else
|
||||
delete_fcurve_keys((FCurve *)ale->key_data); // XXX... this doesn't delete empty curves anymore
|
||||
delete_fcurve_keys((FCurve *)ale->key_data); // XXX... this doesn't delete empty curves anymore
|
||||
}
|
||||
|
||||
/* free filtered list */
|
||||
@@ -674,8 +658,6 @@ static int graphkeys_clean_exec(bContext *C, wmOperator *op)
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
if (ac.datatype == ANIMCONT_GPENCIL)
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
|
||||
/* get cleaning threshold */
|
||||
thresh= RNA_float_get(op->ptr, "threshold");
|
||||
@@ -801,8 +783,6 @@ static int graphkeys_sample_exec(bContext *C, wmOperator *op)
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
if (ac.datatype == ANIMCONT_GPENCIL)
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
|
||||
/* sample keyframes */
|
||||
sample_graph_keys(&ac);
|
||||
@@ -875,8 +855,6 @@ static int graphkeys_expo_exec(bContext *C, wmOperator *op)
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
if (ac.datatype == ANIMCONT_GPENCIL)
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
|
||||
/* get handle setting mode */
|
||||
mode= RNA_enum_get(op->ptr, "type");
|
||||
@@ -953,8 +931,6 @@ static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
if (ac.datatype == ANIMCONT_GPENCIL)
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
|
||||
/* get handle setting mode */
|
||||
mode= RNA_enum_get(op->ptr, "type");
|
||||
@@ -1051,8 +1027,6 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
if (ac.datatype == ANIMCONT_GPENCIL)
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
|
||||
/* get handle setting mode */
|
||||
mode= RNA_enum_get(op->ptr, "type");
|
||||
@@ -1181,10 +1155,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
|
||||
BeztEditFunc edit_cb;
|
||||
|
||||
/* filter data */
|
||||
if (ac->datatype == ANIMCONT_GPENCIL)
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT);
|
||||
else
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* get beztriple editing callbacks */
|
||||
@@ -1202,8 +1173,6 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
|
||||
ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
|
||||
}
|
||||
//else if (ale->type == ACTTYPE_GPLAYER)
|
||||
// snap_gplayer_frames(ale->data, mode);
|
||||
else
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
|
||||
}
|
||||
@@ -1302,10 +1271,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
|
||||
}
|
||||
|
||||
/* filter data */
|
||||
if (ac->datatype == ANIMCONT_GPENCIL)
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT);
|
||||
else
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* mirror keyframes */
|
||||
@@ -1317,8 +1283,6 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
|
||||
ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
|
||||
}
|
||||
//else if (ale->type == ACTTYPE_GPLAYER)
|
||||
// snap_gplayer_frames(ale->data, mode);
|
||||
else
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve);
|
||||
}
|
||||
|
||||
@@ -36,13 +36,43 @@ struct ARegion;
|
||||
|
||||
/* internal exports only */
|
||||
|
||||
/* ***************************************** */
|
||||
/* ipo_draw.c */
|
||||
void graph_draw_channel_names(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
|
||||
void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
|
||||
|
||||
/* ***************************************** */
|
||||
/* ipo_header.c */
|
||||
void graph_header_buttons(const bContext *C, struct ARegion *ar);
|
||||
|
||||
/* ***************************************** */
|
||||
/* ipo_select.c */
|
||||
|
||||
void GRAPHEDIT_OT_keyframes_deselectall(struct wmOperatorType *ot);
|
||||
void GRAPHEDIT_OT_keyframes_borderselect(struct wmOperatorType *ot);
|
||||
void GRAPHEDIT_OT_keyframes_columnselect(struct wmOperatorType *ot);
|
||||
void GRAPHEDIT_OT_keyframes_clickselect(struct wmOperatorType *ot);
|
||||
|
||||
/* defines for left-right select tool */
|
||||
enum {
|
||||
GRAPHKEYS_LRSEL_TEST = -1,
|
||||
GRAPHKEYS_LRSEL_NONE,
|
||||
GRAPHKEYS_LRSEL_LEFT,
|
||||
GRAPHKEYS_LRSEL_RIGHT,
|
||||
} eGraphKeys_LeftRightSelect_Mode;
|
||||
|
||||
/* defines for column-select mode */
|
||||
enum {
|
||||
GRAPHKEYS_COLUMNSEL_KEYS = 0,
|
||||
GRAPHKEYS_COLUMNSEL_CFRA,
|
||||
GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN,
|
||||
GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN,
|
||||
} eGraphKeys_ColumnSelect_Mode;
|
||||
|
||||
/* ***************************************** */
|
||||
/* ipo_edit.c */
|
||||
|
||||
/* ***************************************** */
|
||||
/* ipo_ops.c */
|
||||
void graphedit_keymap(struct wmWindowManager *wm);
|
||||
void graphedit_operatortypes(void);
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
|
||||
void graphedit_operatortypes(void)
|
||||
{
|
||||
#if 0 // XXX code to be sanitied for new system
|
||||
/* keyframes */
|
||||
/* selection */
|
||||
WM_operatortype_append(GRAPHEDIT_OT_keyframes_clickselect);
|
||||
@@ -69,6 +68,7 @@ void graphedit_operatortypes(void)
|
||||
WM_operatortype_append(GRAPHEDIT_OT_keyframes_borderselect);
|
||||
WM_operatortype_append(GRAPHEDIT_OT_keyframes_columnselect);
|
||||
|
||||
#if 0 // XXX code to be sanitied for new system
|
||||
/* editing */
|
||||
WM_operatortype_append(GRAPHEDIT_OT_keyframes_snap);
|
||||
WM_operatortype_append(GRAPHEDIT_OT_keyframes_mirror);
|
||||
@@ -91,14 +91,13 @@ void graphedit_operatortypes(void)
|
||||
|
||||
static void graphedit_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
|
||||
{
|
||||
#if 0 // XXX code to be sanitied for new system
|
||||
/* action_select.c - selection tools */
|
||||
/* iposelect.c - selection tools */
|
||||
/* click-select */
|
||||
// TODO: column to alt, left-right to ctrl (for select-linked consistency)
|
||||
WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "column_select", 1);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend_select", 1);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "left_right", ACTKEYS_LRSEL_TEST);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "left_right", GRAPHKEYS_LRSEL_TEST);
|
||||
|
||||
/* deselect all */
|
||||
WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_deselectall", AKEY, KM_PRESS, 0, 0);
|
||||
@@ -109,12 +108,13 @@ static void graphedit_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_borderselect", BKEY, KM_PRESS, KM_ALT, 0)->ptr, "axis_range", 1);
|
||||
|
||||
/* column select */
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, 0, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_KEYS);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_CFRA);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_MARKERS_COLUMN);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_MARKERS_BETWEEN);
|
||||
|
||||
/* action_edit.c */
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, 0, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_KEYS);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_CFRA);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_columnselect", KKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN);
|
||||
|
||||
#if 0 // XXX code to be sanitied for new system
|
||||
/* ipo_edit.c */
|
||||
/* snap - current frame to selected keys */
|
||||
WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_cfrasnap", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
||||
|
||||
@@ -141,10 +141,10 @@ static void graphedit_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
|
||||
/* auto-set range */
|
||||
WM_keymap_add_item(keymap, "GRAPHEDIT_OT_set_previewrange", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "GRAPHEDIT_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
|
||||
#endif // XXX code to be sanitied for new system
|
||||
|
||||
/* transform system */
|
||||
transform_keymap_for_space(wm, keymap, SPACE_ACTION);
|
||||
#endif // XXX code to be sanitied for new system
|
||||
transform_keymap_for_space(wm, keymap, SPACE_IPO);
|
||||
}
|
||||
|
||||
/* --------------- */
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
|
||||
#include "ipo_intern.h"
|
||||
|
||||
#if 0 // XXX code to be sanitied for new system
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* KEYFRAMES STUFF */
|
||||
@@ -112,10 +111,7 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
|
||||
BeztEditFunc test_cb, sel_cb;
|
||||
|
||||
/* determine type-based settings */
|
||||
if (ac->datatype == ANIMCONT_GPENCIL)
|
||||
filter= (ANIMFILTER_VISIBLE);
|
||||
else
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
|
||||
|
||||
/* filter data */
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
@@ -125,19 +121,12 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
|
||||
test_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
|
||||
|
||||
/* See if we should be selecting or deselecting */
|
||||
// xxx check for curves too
|
||||
if (test) {
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
if (ale->type == ANIMTYPE_GPLAYER) {
|
||||
//if (is_gplayer_frame_selected(ale->data)) {
|
||||
// sel= 0;
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
else {
|
||||
if (ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, test_cb, NULL)) {
|
||||
sel= SELECT_SUBTRACT;
|
||||
break;
|
||||
}
|
||||
if (ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, test_cb, NULL)) {
|
||||
sel= SELECT_SUBTRACT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,12 +135,9 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
|
||||
sel_cb= ANIM_editkeyframes_select(sel);
|
||||
|
||||
/* Now set the flags */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
//if (ale->type == ACTTYPE_GPLAYER)
|
||||
// set_gplayer_frame_selection(ale->data, sel);
|
||||
//else
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, sel_cb, NULL);
|
||||
}
|
||||
// xxx check for curves too
|
||||
for (ale= anim_data.first; ale; ale= ale->next)
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, sel_cb, NULL);
|
||||
|
||||
/* Cleanup */
|
||||
BLI_freelistN(&anim_data);
|
||||
@@ -198,17 +184,17 @@ void GRAPHEDIT_OT_keyframes_deselectall (wmOperatorType *ot)
|
||||
|
||||
/* ******************** Border Select Operator **************************** */
|
||||
/* This operator currently works in one of three ways:
|
||||
* -> BKEY - 1) all keyframes within region are selected (graphkeys_BORDERSEL_ALLKEYS)
|
||||
* -> BKEY - 1) all keyframes within region are selected (GRAPHKEYS_BORDERSEL_ALLKEYS)
|
||||
* -> ALT-BKEY - depending on which axis of the region was larger...
|
||||
* -> 2) x-axis, so select all frames within frame range (graphkeys_BORDERSEL_FRAMERANGE)
|
||||
* -> 3) y-axis, so select all frames within channels that region included (graphkeys_BORDERSEL_CHANNELS)
|
||||
* -> 2) x-axis, so select all frames within frame range (GRAPHKEYS_BORDERSEL_FRAMERANGE)
|
||||
* -> 3) y-axis, so select all frames within channels that region included (GRAPHKEYS_BORDERSEL_CHANNELS)
|
||||
*/
|
||||
|
||||
/* defines for borderselect mode */
|
||||
enum {
|
||||
graphkeys_BORDERSEL_ALLKEYS = 0,
|
||||
graphkeys_BORDERSEL_FRAMERANGE,
|
||||
graphkeys_BORDERSEL_CHANNELS,
|
||||
GRAPHKEYS_BORDERSEL_ALLKEYS = 0,
|
||||
GRAPHKEYS_BORDERSEL_FRAMERANGE,
|
||||
GRAPHKEYS_BORDERSEL_CHANNELS,
|
||||
} egraphkeys_BorderSelect_Mode;
|
||||
|
||||
|
||||
@@ -222,20 +208,19 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short
|
||||
BeztEditFunc ok_cb, select_cb;
|
||||
View2D *v2d= &ac->ar->v2d;
|
||||
rctf rectf;
|
||||
float ymin=0, ymax=(float)(-ACHANNEL_HEIGHT);
|
||||
|
||||
/* convert mouse coordinates to frame ranges and channel coordinates corrected for view pan/zoom */
|
||||
UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin+2, &rectf.xmin, &rectf.ymin);
|
||||
UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax-2, &rectf.xmax, &rectf.ymax);
|
||||
|
||||
/* filter data */
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS);
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* get beztriple editing/validation funcs */
|
||||
select_cb= ANIM_editkeyframes_select(selectmode);
|
||||
|
||||
if (ELEM(mode, graphkeys_BORDERSEL_FRAMERANGE, graphkeys_BORDERSEL_ALLKEYS))
|
||||
if (ELEM(mode, GRAPHKEYS_BORDERSEL_FRAMERANGE, GRAPHKEYS_BORDERSEL_ALLKEYS))
|
||||
ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
|
||||
else
|
||||
ok_cb= NULL;
|
||||
@@ -247,11 +232,8 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
Object *nob= ANIM_nla_mapping_get(ac, ale);
|
||||
|
||||
/* get new vertical minimum extent of channel */
|
||||
ymin= ymax - ACHANNEL_STEP;
|
||||
|
||||
/* set horizontal range (if applicable) */
|
||||
if (ELEM(mode, graphkeys_BORDERSEL_FRAMERANGE, graphkeys_BORDERSEL_ALLKEYS)) {
|
||||
if (ELEM(mode, GRAPHKEYS_BORDERSEL_FRAMERANGE, GRAPHKEYS_BORDERSEL_ALLKEYS)) {
|
||||
/* if channel is mapped in NLA, apply correction */
|
||||
if (nob) {
|
||||
bed.f1= get_action_frame(nob, rectf.xmin);
|
||||
@@ -263,29 +245,7 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short
|
||||
}
|
||||
}
|
||||
|
||||
/* perform vertical suitability check (if applicable) */
|
||||
if ( (mode == graphkeys_BORDERSEL_FRAMERANGE) ||
|
||||
!((ymax < rectf.ymin) || (ymin > rectf.ymax)) )
|
||||
{
|
||||
/* loop over data selecting */
|
||||
if (ale->key_data) {
|
||||
if (ale->datatype == ALE_FCURVE)
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
|
||||
}
|
||||
else if (ale->type == ANIMTYPE_GROUP) {
|
||||
bActionGroup *agrp= ale->data;
|
||||
FCurve *fcu;
|
||||
|
||||
for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next)
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, fcu, ok_cb, select_cb, NULL);
|
||||
}
|
||||
//else if (ale->type == ANIMTYPE_GPLAYER) {
|
||||
// borderselect_gplayer_frames(ale->data, rectf.xmin, rectf.xmax, selectmode);
|
||||
//}
|
||||
}
|
||||
|
||||
/* set minimum extent to be the maximum of the next channel */
|
||||
ymax=ymin;
|
||||
// xxx... select code...
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
@@ -325,12 +285,12 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
|
||||
* used for tweaking timing when "blocking", while channels is not that useful...
|
||||
*/
|
||||
if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
|
||||
mode= graphkeys_BORDERSEL_FRAMERANGE;
|
||||
else
|
||||
mode= graphkeys_BORDERSEL_CHANNELS;
|
||||
mode= GRAPHKEYS_BORDERSEL_FRAMERANGE;
|
||||
//else
|
||||
// mode= GRAPHKEYS_BORDERSEL_CHANNELS;
|
||||
}
|
||||
else
|
||||
mode= graphkeys_BORDERSEL_ALLKEYS;
|
||||
mode= GRAPHKEYS_BORDERSEL_ALLKEYS;
|
||||
|
||||
/* apply borderselect action */
|
||||
borderselect_action(&ac, rect, mode, selectmode);
|
||||
@@ -373,11 +333,11 @@ void GRAPHEDIT_OT_keyframes_borderselect(wmOperatorType *ot)
|
||||
*/
|
||||
|
||||
/* defines for column-select mode */
|
||||
EnumPropertyItem prop_column_select_types[] = {
|
||||
{graphkeys_COLUMNSEL_KEYS, "KEYS", "On Selected Keyframes", ""},
|
||||
{graphkeys_COLUMNSEL_CFRA, "CFRA", "On Current Frame", ""},
|
||||
{graphkeys_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", "On Selected Markers", ""},
|
||||
{graphkeys_COLUMNSEL_MARKERS_BETWEEN, "MARKERS_BETWEEN", "Between Min/Max Selected Markers", ""},
|
||||
static EnumPropertyItem prop_column_select_types[] = {
|
||||
{GRAPHKEYS_COLUMNSEL_KEYS, "KEYS", "On Selected Keyframes", ""},
|
||||
{GRAPHKEYS_COLUMNSEL_CFRA, "CFRA", "On Current Frame", ""},
|
||||
{GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", "On Selected Markers", ""},
|
||||
{GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN, "MARKERS_BETWEEN", "Between Min/Max Selected Markers", ""},
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -410,7 +370,7 @@ static void markers_selectkeys_between (bAnimContext *ac)
|
||||
bed.f2= max;
|
||||
|
||||
/* filter data */
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* select keys in-between */
|
||||
@@ -464,25 +424,17 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
|
||||
|
||||
/* build list of columns */
|
||||
switch (mode) {
|
||||
case graphkeys_COLUMNSEL_KEYS: /* list of selected keys */
|
||||
if (ac->datatype == ANIMCONT_GPENCIL) {
|
||||
filter= (ANIMFILTER_VISIBLE);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
//for (ale= anim_data.first; ale; ale= ale->next)
|
||||
// gplayer_make_cfra_list(ale->data, &elems, 1);
|
||||
}
|
||||
else {
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
for (ale= anim_data.first; ale; ale= ale->next)
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_to_cfraelem, NULL);
|
||||
}
|
||||
case GRAPHKEYS_COLUMNSEL_KEYS: /* list of selected keys */
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
for (ale= anim_data.first; ale; ale= ale->next)
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_to_cfraelem, NULL);
|
||||
|
||||
BLI_freelistN(&anim_data);
|
||||
break;
|
||||
|
||||
case graphkeys_COLUMNSEL_CFRA: /* current frame */
|
||||
case GRAPHKEYS_COLUMNSEL_CFRA: /* current frame */
|
||||
/* make a single CfraElem for storing this */
|
||||
ce= MEM_callocN(sizeof(CfraElem), "cfraElem");
|
||||
BLI_addtail(&bed.list, ce);
|
||||
@@ -490,7 +442,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
|
||||
ce->cfra= (float)CFRA;
|
||||
break;
|
||||
|
||||
case graphkeys_COLUMNSEL_MARKERS_COLUMN: /* list of selected markers */
|
||||
case GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN: /* list of selected markers */
|
||||
// FIXME: markers api needs to be improved for this first!
|
||||
//make_marker_cfra_list(&elems, 1);
|
||||
return; // XXX currently, this does nothing!
|
||||
@@ -507,10 +459,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
|
||||
/* loop through all of the keys and select additional keyframes
|
||||
* based on the keys found to be selected above
|
||||
*/
|
||||
if (ac->datatype == ANIMCONT_GPENCIL)
|
||||
filter= (ANIMFILTER_VISIBLE);
|
||||
else
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
@@ -528,19 +477,6 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
|
||||
|
||||
/* select elements with frame number matching cfraelem */
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
|
||||
|
||||
#if 0 // XXX reenable when Grease Pencil stuff is back
|
||||
if (ale->type == ANIMTYPE_GPLAYER) {
|
||||
bGPDlayer *gpl= (bGPDlayer *)ale->data;
|
||||
bGPDframe *gpf;
|
||||
|
||||
for (gpf= gpl->frames.first; gpf; gpf= gpf->next) {
|
||||
if (ecfra == gpf->framenum)
|
||||
gpf->flag |= GP_FRAME_SELECT;
|
||||
}
|
||||
}
|
||||
//else...
|
||||
#endif // XXX reenable when Grease Pencil stuff is back
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +499,7 @@ static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
|
||||
/* action to take depends on the mode */
|
||||
mode= RNA_enum_get(op->ptr, "mode");
|
||||
|
||||
if (mode == graphkeys_COLUMNSEL_MARKERS_BETWEEN)
|
||||
if (mode == GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN)
|
||||
markers_selectkeys_between(&ac);
|
||||
else
|
||||
columnselect_graph_keys(&ac, mode);
|
||||
@@ -602,24 +538,187 @@ void GRAPHEDIT_OT_keyframes_columnselect (wmOperatorType *ot)
|
||||
*/
|
||||
|
||||
/* defines for left-right select tool */
|
||||
EnumPropertyItem prop_leftright_select_types[] = {
|
||||
{graphkeys_LRSEL_TEST, "CHECK", "Check if Select Left or Right", ""},
|
||||
{graphkeys_LRSEL_NONE, "OFF", "Don't select", ""},
|
||||
{graphkeys_LRSEL_LEFT, "LEFT", "Before current frame", ""},
|
||||
{graphkeys_LRSEL_RIGHT, "RIGHT", "After current frame", ""},
|
||||
static EnumPropertyItem prop_leftright_select_types[] = {
|
||||
{GRAPHKEYS_LRSEL_TEST, "CHECK", "Check if Select Left or Right", ""},
|
||||
{GRAPHKEYS_LRSEL_NONE, "OFF", "Don't select", ""},
|
||||
{GRAPHKEYS_LRSEL_LEFT, "LEFT", "Before current frame", ""},
|
||||
{GRAPHKEYS_LRSEL_RIGHT, "RIGHT", "After current frame", ""},
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* ------------------- */
|
||||
|
||||
enum {
|
||||
NEAREST_HANDLE_LEFT = 0,
|
||||
NEAREST_HANDLE_KEY,
|
||||
NEAREST_HANDLE_RIGHT
|
||||
} eHandleIndex;
|
||||
|
||||
/* Find the vertex (either handle (0/2) or the keyframe (1)) that is nearest to the mouse cursor (in area coordinates)
|
||||
* Selected verts get a disadvantage, to make it easier to select handles behind.
|
||||
* Returns eHandleIndex
|
||||
*/
|
||||
static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fcurve, BezTriple **bezt)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
|
||||
SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
|
||||
View2D *v2d= &ac->ar->v2d;
|
||||
int hpoint=0, sco[3][2];
|
||||
int dist= 100, temp, i;
|
||||
|
||||
/* clear pointers first */
|
||||
*fcurve= 0;
|
||||
*bezt= 0;
|
||||
|
||||
/* get curves to search through */
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
FCurve *fcu= (FCurve *)ale->key_data;
|
||||
|
||||
/* try to progressively get closer to the right point... */
|
||||
// XXX keyframe visibility isn't checked for...
|
||||
if (fcu->bezt) {
|
||||
BezTriple *bezt1=fcu->bezt, *prevbezt=NULL;
|
||||
|
||||
for (i=0; i < fcu->totvert; i++, prevbezt=bezt1, bezt1++) {
|
||||
/* convert beztriple points to screen-space */
|
||||
UI_view2d_to_region_no_clip(v2d, bezt1->vec[0][0], bezt1->vec[0][1], &sco[0][0], &sco[0][1]);
|
||||
UI_view2d_to_region_no_clip(v2d, bezt1->vec[1][0], bezt1->vec[1][1], &sco[1][0], &sco[1][1]);
|
||||
UI_view2d_to_region_no_clip(v2d, bezt1->vec[2][0], bezt1->vec[2][1], &sco[2][0], &sco[2][1]);
|
||||
|
||||
/* keyframe - do select? */
|
||||
temp= abs(mval[0] - sco[1][0]) + abs(mval[1] - sco[1][1]);
|
||||
|
||||
if (bezt1->f2 & SELECT)
|
||||
temp += 5;
|
||||
|
||||
if (temp < dist) {
|
||||
hpoint= NEAREST_HANDLE_KEY;
|
||||
*bezt= bezt1;
|
||||
dist= temp;
|
||||
*fcurve= fcu;
|
||||
}
|
||||
|
||||
/* handles - only do them if they're visible */
|
||||
if ((sipo->flag & SIPO_NOHANDLES)==0) {
|
||||
/* first handle only visible if previous segment had handles */
|
||||
if ( (!prevbezt && (bezt1->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) )
|
||||
{
|
||||
temp= -3 + abs(mval[0] - sco[0][0]) + abs(mval[1] - sco[0][1]);
|
||||
if (bezt1->f1 & SELECT)
|
||||
temp += 5;
|
||||
|
||||
if (temp < dist) {
|
||||
hpoint= NEAREST_HANDLE_LEFT;
|
||||
*bezt= bezt1;
|
||||
dist= temp;
|
||||
*fcurve= fcu;
|
||||
}
|
||||
}
|
||||
|
||||
/* second handle only visible if this segment is bezier */
|
||||
if (bezt1->ipo == BEZT_IPO_BEZ)
|
||||
{
|
||||
temp= abs(mval[0] - sco[2][0]) + abs(mval[1] - sco[2][1]);
|
||||
if (bezt1->f3 & SELECT)
|
||||
temp += 5;
|
||||
|
||||
if (temp < dist) {
|
||||
hpoint= NEAREST_HANDLE_RIGHT;
|
||||
*bezt=bezt1;
|
||||
dist= temp;
|
||||
*fcurve= fcu;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* free channels */
|
||||
BLI_freelistN(&anim_data);
|
||||
|
||||
/* return handle */
|
||||
return hpoint;
|
||||
}
|
||||
|
||||
/* option 1) select keyframe directly under mouse */
|
||||
static void mouse_graph_keys (bAnimContext *ac, int mval[2], short selectmode)
|
||||
static void mouse_graph_keys (bAnimContext *ac, int mval[], short selectmode)
|
||||
{
|
||||
// XXX port this...
|
||||
FCurve *fcu;
|
||||
BezTriple *bezt;
|
||||
short handle;
|
||||
|
||||
/* find the beztriple that we're selecting, and the handle that was clicked on */
|
||||
handle= findnearest_fcurve_vert(ac, mval, &fcu, &bezt);
|
||||
|
||||
/* check if anything to select */
|
||||
if (fcu == NULL)
|
||||
return;
|
||||
|
||||
/* deselect all other curves? */
|
||||
if (selectmode == SELECT_REPLACE) {
|
||||
deselect_graph_keys(ac, 0, SELECT_SUBTRACT); // XXX this should be curves, not keys
|
||||
selectmode= SELECT_ADD;
|
||||
}
|
||||
|
||||
/* select or deselect? */
|
||||
if (selectmode == SELECT_ADD)
|
||||
fcu->flag |= (FCURVE_ACTIVE|FCURVE_SELECTED);
|
||||
else if (selectmode == SELECT_INVERT)
|
||||
fcu->flag ^= (FCURVE_ACTIVE|FCURVE_SELECTED);
|
||||
|
||||
/* if we're selecting points too */
|
||||
if ( ((fcu->flag & FCURVE_PROTECTED)==0) /*|| (curvesonly == 0) */) {
|
||||
/* only if there's keyframe */
|
||||
if (bezt) {
|
||||
/* depends on selection mode */
|
||||
if (selectmode == SELECT_INVERT) {
|
||||
/* keyframe - invert select of all */
|
||||
if (handle == NEAREST_HANDLE_KEY) {
|
||||
if (BEZSELECTED(bezt)) {
|
||||
BEZ_DESEL(bezt);
|
||||
}
|
||||
else {
|
||||
BEZ_SEL(bezt);
|
||||
}
|
||||
}
|
||||
|
||||
/* handles - toggle selection of relevant handle */
|
||||
else if (handle == NEAREST_HANDLE_LEFT) {
|
||||
/* toggle selection */
|
||||
bezt->f1 ^= SELECT;
|
||||
}
|
||||
else {
|
||||
/* toggle selection */
|
||||
bezt->f3 ^= SELECT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* deselect all other keyframes? */
|
||||
deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
|
||||
|
||||
/* if the keyframe was clicked on, select all verts of given beztriple */
|
||||
if (handle == NEAREST_HANDLE_KEY) {
|
||||
BEZ_SEL(bezt);
|
||||
}
|
||||
/* otherwise, select the handle that applied */
|
||||
else if (handle == NEAREST_HANDLE_LEFT)
|
||||
bezt->f1 |= SELECT;
|
||||
else
|
||||
bezt->f3 |= SELECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
|
||||
static void selectkeys_leftright (bAnimContext *ac, short leftright, short select_mode)
|
||||
static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short select_mode)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
bAnimListElem *ale;
|
||||
@@ -640,7 +739,7 @@ static void selectkeys_leftright (bAnimContext *ac, short leftright, short selec
|
||||
select_cb= ANIM_editkeyframes_select(select_mode);
|
||||
|
||||
memset(&bed, 0, sizeof(BeztEditFunc));
|
||||
if (leftright == graphkeys_LRSEL_LEFT) {
|
||||
if (leftright == GRAPHKEYS_LRSEL_LEFT) {
|
||||
bed.f1 = -MAXFRAMEF;
|
||||
bed.f2 = (float)(CFRA + 0.1f);
|
||||
}
|
||||
@@ -650,10 +749,7 @@ static void selectkeys_leftright (bAnimContext *ac, short leftright, short selec
|
||||
}
|
||||
|
||||
/* filter data */
|
||||
if (ac->datatype == ANIMCONT_GPENCIL)
|
||||
filter= (ANIMFILTER_VISIBLE);
|
||||
else
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* select keys on the side where most data occurs */
|
||||
@@ -665,8 +761,6 @@ static void selectkeys_leftright (bAnimContext *ac, short leftright, short selec
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
|
||||
ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1);
|
||||
}
|
||||
//else if (ale->type == ANIMTYPE_GPLAYER)
|
||||
// borderselect_gplayer_frames(ale->data, min, max, SELECT_ADD);
|
||||
else
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
|
||||
}
|
||||
@@ -695,36 +789,21 @@ static void mouse_columnselect_graph_keys (bAnimContext *ac, float selx)
|
||||
/* loop through all of the keys and select additional keyframes
|
||||
* based on the keys found to be selected above
|
||||
*/
|
||||
if (ac->datatype == ANIMCONT_GPENCIL)
|
||||
filter= (ANIMFILTER_VISIBLE);
|
||||
else
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
Object *nob= ANIM_nla_mapping_get(ac, ale);
|
||||
|
||||
/* set frame for validation callback to refer to */
|
||||
// XXX have a more sensitive range?
|
||||
if (nob)
|
||||
bed.f1= get_action_frame(nob, selx);
|
||||
else
|
||||
bed.f1= selx;
|
||||
|
||||
/* select elements with frame number matching cfraelem */
|
||||
/* select elements with frame number matching cfra */
|
||||
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
|
||||
|
||||
#if 0 // XXX reenable when Grease Pencil stuff is back
|
||||
if (ale->type == ANIMTYPE_GPLAYER) {
|
||||
bGPDlayer *gpl= (bGPDlayer *)ale->data;
|
||||
bGPDframe *gpf;
|
||||
|
||||
for (gpf= gpl->frames.first; gpf; gpf= gpf->next) {
|
||||
if (ecfra == gpf->framenum)
|
||||
gpf->flag |= GP_FRAME_SELECT;
|
||||
}
|
||||
}
|
||||
//else...
|
||||
#endif // XXX reenable when Grease Pencil stuff is back
|
||||
}
|
||||
|
||||
/* free elements */
|
||||
@@ -747,7 +826,7 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
|
||||
/* get useful pointers from animation context data */
|
||||
scene= ac.scene;
|
||||
ar= ac.ar;
|
||||
@@ -771,11 +850,11 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
|
||||
|
||||
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, NULL);
|
||||
if (x < CFRA)
|
||||
RNA_int_set(op->ptr, "left_right", graphkeys_LRSEL_LEFT);
|
||||
RNA_int_set(op->ptr, "left_right", GRAPHKEYS_LRSEL_LEFT);
|
||||
else
|
||||
RNA_int_set(op->ptr, "left_right", graphkeys_LRSEL_RIGHT);
|
||||
RNA_int_set(op->ptr, "left_right", GRAPHKEYS_LRSEL_RIGHT);
|
||||
|
||||
selectkeys_leftright(&ac, RNA_enum_get(op->ptr, "left_right"), selectmode);
|
||||
graphkeys_select_leftright(&ac, RNA_enum_get(op->ptr, "left_right"), selectmode);
|
||||
}
|
||||
else if (RNA_boolean_get(op->ptr, "column_select")) {
|
||||
/* select all the keyframes that occur on the same frame as where the mouse clicked */
|
||||
@@ -787,7 +866,7 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
|
||||
}
|
||||
else {
|
||||
/* select keyframe under mouse */
|
||||
mouse_graph_keys(&ac, mval, selectmode);
|
||||
mouse_graph_keys(&ac, mval, selectmode); // xxx curves only should become an arg
|
||||
// XXX activate transform...
|
||||
}
|
||||
|
||||
@@ -815,4 +894,3 @@ void GRAPHEDIT_OT_keyframes_clickselect (wmOperatorType *ot)
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
#endif // XXX code to be sanitied for new system
|
||||
|
||||
@@ -1209,18 +1209,17 @@ void RNA_def_constraint(BlenderRNA *brna)
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ACTIVE);
|
||||
RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited ");
|
||||
|
||||
prop= RNA_def_property(srna, "own_ipo", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OWN_IPO);
|
||||
RNA_def_property_ui_text(prop, "Local IPO", "Constraint has its own IPO data.");
|
||||
|
||||
prop= RNA_def_property(srna, "proxy_local", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL);
|
||||
RNA_def_property_ui_text(prop, "Proxy Local", "Constraint was added in this proxy instance (i.e. did not belong to source Armature).");
|
||||
|
||||
/* values */
|
||||
prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "enforce");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Influence", "Amount of influence constraint will have on the final solution.");
|
||||
|
||||
/* pointers */
|
||||
prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop, "IPO", "Local IPO data.");
|
||||
|
||||
rna_def_constrainttarget(brna);
|
||||
|
||||
rna_def_constraint_childof(brna);
|
||||
|
||||
Reference in New Issue
Block a user