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:
authorCampbell Barton <ideasman42@gmail.com>2018-06-04 10:31:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-04 10:31:30 +0300
commit44505b38df557a5711703613685a1dec9fc2c3d9 (patch)
tree3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/space_graph
parent6654e109df952be3a3128fae2508a02c196ae593 (diff)
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c282
-rw-r--r--source/blender/editors/space_graph/graph_draw.c384
-rw-r--r--source/blender/editors/space_graph/graph_edit.c864
-rw-r--r--source/blender/editors/space_graph/graph_intern.h6
-rw-r--r--source/blender/editors/space_graph/graph_ops.c206
-rw-r--r--source/blender/editors/space_graph/graph_select.c498
-rw-r--r--source/blender/editors/space_graph/graph_utils.c64
-rw-r--r--source/blender/editors/space_graph/space_graph.c190
8 files changed, 1247 insertions, 1247 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index fce1da8b486..d5586a51a40 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -81,25 +81,25 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **
{
bAnimContext ac;
bAnimListElem *elem = NULL;
-
- /* for now, only draw if we could init the anim-context info (necessary for all animation-related tools)
+
+ /* for now, only draw if we could init the anim-context info (necessary for all animation-related tools)
* to work correctly is able to be correctly retrieved. There's no point showing empty panels?
*/
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0)
return 0;
-
+
/* try to find 'active' F-Curve */
elem = get_active_fcurve_channel(&ac);
- if (elem == NULL)
+ if (elem == NULL)
return 0;
-
+
if (fcu)
*fcu = (FCurve *)elem->data;
if (ale)
*ale = elem;
else
MEM_freeN(elem);
-
+
return 1;
}
@@ -118,7 +118,7 @@ static void graph_panel_view(const bContext *C, Panel *pa)
Scene *scene = CTX_data_scene(C);
PointerRNA spaceptr, sceneptr;
uiLayout *col, *sub, *row;
-
+
/* get RNA pointers for use when creating the UI elements */
RNA_id_pointer_create(&scene->id, &sceneptr);
RNA_pointer_create(&sc->id, &RNA_SpaceGraphEditor, sipo, &spaceptr);
@@ -126,7 +126,7 @@ static void graph_panel_view(const bContext *C, Panel *pa)
/* 2D-Cursor */
col = uiLayoutColumn(pa->layout, false);
uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NONE);
-
+
sub = uiLayoutColumn(col, true);
uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
uiItemO(sub, IFACE_("Cursor from Selection"), ICON_NONE, "GRAPH_OT_frame_jump");
@@ -139,7 +139,7 @@ static void graph_panel_view(const bContext *C, Panel *pa)
else
uiItemR(row, &sceneptr, "frame_current", 0, IFACE_("Cursor X"), ICON_NONE);
uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_CFRA);
-
+
row = uiLayoutSplit(sub, 0.7f, true);
uiItemR(row, &spaceptr, "cursor_position_y", 0, IFACE_("Cursor Y"), ICON_NONE);
uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_VALUE);
@@ -160,14 +160,14 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
if (!graph_panel_context(C, &ale, &fcu))
return;
-
+
// UNUSED
// block = uiLayoutGetBlock(layout);
// UI_block_func_handle_set(block, do_graph_region_buttons, NULL);
-
+
/* F-Curve pointer */
RNA_pointer_create(ale->id, &RNA_FCurve, fcu, &fcu_ptr);
-
+
/* user-friendly 'name' for F-Curve */
col = uiLayoutColumn(layout, false);
if (ale->type == ANIMTYPE_FCURVE) {
@@ -177,7 +177,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
else {
/* NLA Control Curve, etc. */
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
-
+
/* get name */
if (acf && acf->name) {
acf->name(ale, name);
@@ -186,26 +186,26 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
strcpy(name, IFACE_("<invalid>"));
icon = ICON_ERROR;
}
-
+
/* icon */
if (ale->type == ANIMTYPE_NLACURVE)
icon = ICON_NLA;
}
uiItemL(col, name, icon);
-
+
/* RNA-Path Editing - only really should be enabled when things aren't working */
col = uiLayoutColumn(layout, true);
uiLayoutSetEnabled(col, (fcu->flag & FCURVE_DISABLED) != 0);
uiItemR(col, &fcu_ptr, "data_path", 0, "", ICON_RNA);
uiItemR(col, &fcu_ptr, "array_index", 0, NULL, ICON_NONE);
-
+
/* color settings */
col = uiLayoutColumn(layout, true);
uiItemL(col, IFACE_("Display Color:"), ICON_NONE);
-
+
row = uiLayoutRow(col, true);
uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE);
-
+
sub = uiLayoutRow(row, true);
uiLayoutSetEnabled(sub, (fcu->color_mode == FCURVE_COLOR_CUSTOM));
uiItemR(sub, &fcu_ptr, "color", 0, "", ICON_NONE);
@@ -225,31 +225,31 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT
{
BezTriple *b;
int i;
-
+
/* zero the pointers */
*bezt = *prevbezt = NULL;
-
+
/* sanity checks */
if ((fcu->bezt == NULL) || (fcu->totvert == 0))
return 0;
-
- /* find first selected keyframe for now, and call it the active one
- * - this is a reasonable assumption, given that whenever anyone
+
+ /* find first selected keyframe for now, and call it the active one
+ * - this is a reasonable assumption, given that whenever anyone
* wants to edit numerically, there is likely to only be 1 vert selected
*/
for (i = 0, b = fcu->bezt; i < fcu->totvert; i++, b++) {
if (BEZT_ISSEL_ANY(b)) {
- /* found
+ /* found
* - 'previous' is either the one before, of the keyframe itself (which is still fine)
* XXX: we can just make this null instead if needed
*/
*prevbezt = (i > 0) ? b - 1 : b;
*bezt = b;
-
+
return 1;
}
}
-
+
/* not found */
return 0;
}
@@ -258,7 +258,7 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT
static void graphedit_activekey_update_cb(bContext *UNUSED(C), void *fcu_ptr, void *UNUSED(bezt_ptr))
{
FCurve *fcu = (FCurve *)fcu_ptr;
-
+
/* make sure F-Curve and its handles are still valid after this editing */
sort_time_fcurve(fcu);
calchandles_fcurve(fcu);
@@ -268,8 +268,8 @@ static void graphedit_activekey_update_cb(bContext *UNUSED(C), void *fcu_ptr, vo
static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bezt_ptr)
{
BezTriple *bezt = (BezTriple *)bezt_ptr;
-
- /* since editing the handles, make sure they're set to types which are receptive to editing
+
+ /* since editing the handles, make sure they're set to types which are receptive to editing
* see transform_conversions.c :: createTransGraphEditData(), last step in second loop
*/
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {
@@ -280,7 +280,7 @@ static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bez
else {
BKE_nurb_bezt_handle_test(bezt, true);
}
-
+
/* now call standard updates */
graphedit_activekey_update_cb(C, fcu_ptr, bezt_ptr);
}
@@ -310,20 +310,20 @@ static void graphedit_activekey_left_handle_coord_cb(bContext *C, void *fcu_ptr,
static void graphedit_activekey_right_handle_coord_cb(bContext *C, void *fcu_ptr, void *bezt_ptr)
{
BezTriple *bezt = (BezTriple *)bezt_ptr;
-
+
/* original state of handle selection - to be restored after performing the recalculation */
const char f1 = bezt->f1;
const char f3 = bezt->f3;
-
- /* temporarily make it so that only the right handle is selected, so that updates go correctly
+
+ /* temporarily make it so that only the right handle is selected, so that updates go correctly
* (i.e. it now acts as if we've just transforming the vert when it is selected by itself)
*/
bezt->f1 &= ~SELECT;
bezt->f3 |= SELECT;
-
+
/* perform normal updates NOW */
graphedit_activekey_handles_cb(C, fcu_ptr, bezt_ptr);
-
+
/* restore selection state so that no-one notices this hack */
bezt->f1 = f1;
bezt->f3 = f3;
@@ -334,34 +334,34 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
bAnimListElem *ale;
FCurve *fcu;
BezTriple *bezt, *prevbezt;
-
+
uiLayout *layout = pa->layout;
uiLayout *col;
uiBlock *block;
if (!graph_panel_context(C, &ale, &fcu))
return;
-
+
block = uiLayoutGetBlock(layout);
/* UI_block_func_handle_set(block, do_graph_region_buttons, NULL); */
-
+
/* only show this info if there are keyframes to edit */
if (get_active_fcurve_keyframe_edit(fcu, &bezt, &prevbezt)) {
PointerRNA bezt_ptr, id_ptr, fcu_prop_ptr;
PropertyRNA *fcu_prop = NULL;
uiBut *but;
int unit = B_UNIT_NONE;
-
+
/* RNA pointer to keyframe, to allow editing */
RNA_pointer_create(ale->id, &RNA_Keyframe, bezt, &bezt_ptr);
-
+
/* get property that F-Curve affects, for some unit-conversion magic */
RNA_id_pointer_create(ale->id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &fcu_prop_ptr, &fcu_prop)) {
/* determine the unit for this property */
unit = RNA_SUBTYPE_UNIT(RNA_property_subtype(fcu_prop));
}
-
+
/* interpolation */
col = uiLayoutColumn(layout, false);
if (fcu->flag & FCURVE_DISCRETE_VALUES) {
@@ -372,7 +372,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
else {
uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NONE);
}
-
+
/* easing type */
if (bezt->ipo > BEZT_IPO_BEZ)
uiItemR(col, &bezt_ptr, "easing", 0, NULL, 0);
@@ -391,8 +391,8 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
default:
break;
}
-
- /* numerical coordinate editing
+
+ /* numerical coordinate editing
* - we use the button-versions of the calls so that we can attach special update handlers
* and unit conversion magic that cannot be achieved using a purely RNA-approach
*/
@@ -400,50 +400,50 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
/* keyframe itself */
{
uiItemL(col, IFACE_("Key:"), ICON_NONE);
-
+
but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, IFACE_("Frame:"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "co", 0, 0, 0, -1, -1, NULL);
UI_but_func_set(but, graphedit_activekey_update_cb, fcu, bezt);
-
+
but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, IFACE_("Value:"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "co", 1, 0, 0, -1, -1, NULL);
UI_but_func_set(but, graphedit_activekey_update_cb, fcu, bezt);
UI_but_unit_type_set(but, unit);
}
-
+
/* previous handle - only if previous was Bezier interpolation */
if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) {
uiItemL(col, IFACE_("Left Handle:"), ICON_NONE);
-
+
but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "X:", 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "handle_left", 0, 0, 0, -1, -1, NULL);
UI_but_func_set(but, graphedit_activekey_left_handle_coord_cb, fcu, bezt);
-
+
but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "Y:", 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "handle_left", 1, 0, 0, -1, -1, NULL);
UI_but_func_set(but, graphedit_activekey_left_handle_coord_cb, fcu, bezt);
UI_but_unit_type_set(but, unit);
-
+
/* XXX: with label? */
but = uiDefButR(block, UI_BTYPE_MENU, B_REDR, NULL, 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "handle_left_type", 0, 0, 0, -1, -1, "Type of left handle");
UI_but_func_set(but, graphedit_activekey_handles_cb, fcu, bezt);
}
-
+
/* next handle - only if current is Bezier interpolation */
if (bezt->ipo == BEZT_IPO_BEZ) {
/* NOTE: special update callbacks are needed on the coords here due to T39911 */
uiItemL(col, IFACE_("Right Handle:"), ICON_NONE);
-
+
but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "X:", 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "handle_right", 0, 0, 0, -1, -1, NULL);
UI_but_func_set(but, graphedit_activekey_right_handle_coord_cb, fcu, bezt);
-
+
but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "Y:", 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "handle_right", 1, 0, 0, -1, -1, NULL);
UI_but_func_set(but, graphedit_activekey_right_handle_coord_cb, fcu, bezt);
UI_but_unit_type_set(but, unit);
-
+
/* XXX: with label? */
but = uiDefButR(block, UI_BTYPE_MENU, B_REDR, NULL, 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "handle_right_type", 0, 0, 0, -1, -1, "Type of right handle");
@@ -464,7 +464,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
else
uiItemL(layout, IFACE_("No active keyframe on F-Curve"), ICON_NONE);
}
-
+
MEM_freeN(ale);
}
@@ -476,7 +476,7 @@ static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int e
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
-
+
switch (event) {
case B_IPO_DEPCHANGE:
{
@@ -485,7 +485,7 @@ static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int e
break;
}
}
-
+
/* default for now */
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); // XXX could use better notifier
}
@@ -497,11 +497,11 @@ static void driver_remove_cb(bContext *C, void *ale_v, void *UNUSED(arg))
ID *id = ale->id;
FCurve *fcu = ale->data;
ReportList *reports = CTX_wm_reports(C);
-
+
/* try to get F-Curve that driver lives on, and ID block which has this AnimData */
if (ELEM(NULL, id, fcu))
return;
-
+
/* call API method to remove this driver */
ANIM_remove_driver(reports, id, fcu->rna_path, fcu->array_index, 0);
ED_undo_push(C, "Remove Driver");
@@ -511,7 +511,7 @@ static void driver_remove_cb(bContext *C, void *ale_v, void *UNUSED(arg))
static void driver_add_var_cb(bContext *C, void *driver_v, void *UNUSED(arg))
{
ChannelDriver *driver = (ChannelDriver *)driver_v;
-
+
/* add a new variable */
driver_add_new_variable(driver);
ED_undo_push(C, "Add Driver Variable");
@@ -522,7 +522,7 @@ static void driver_delete_var_cb(bContext *C, void *driver_v, void *dvar_v)
{
ChannelDriver *driver = (ChannelDriver *)driver_v;
DriverVar *dvar = (DriverVar *)dvar_v;
-
+
/* remove the active variable */
driver_free_variable_ex(driver, dvar);
ED_undo_push(C, "Delete Driver Variable");
@@ -533,9 +533,9 @@ static void driver_dvar_invalid_name_query_cb(bContext *C, void *dvar_v, void *U
{
uiPopupMenu *pup = UI_popup_menu_begin(C, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Invalid Variable Name"), ICON_NONE);
uiLayout *layout = UI_popup_menu_layout(pup);
-
+
DriverVar *dvar = (DriverVar *)dvar_v;
-
+
if (dvar->flag & DVAR_FLAG_INVALID_EMPTY) {
uiItemL(layout, "It cannot be left blank", ICON_ERROR);
}
@@ -543,7 +543,7 @@ static void driver_dvar_invalid_name_query_cb(bContext *C, void *dvar_v, void *U
uiItemL(layout, "It cannot start with a number", ICON_ERROR);
}
if (dvar->flag & DVAR_FLAG_INVALID_START_CHAR) {
- uiItemL(layout,
+ uiItemL(layout,
"It cannot start with a special character,"
" including '$', '@', '!', '~', '+', '-', '_', '.', or ' '",
ICON_NONE);
@@ -560,7 +560,7 @@ static void driver_dvar_invalid_name_query_cb(bContext *C, void *dvar_v, void *U
if (dvar->flag & DVAR_FLAG_INVALID_PY_KEYWORD) {
uiItemL(layout, "It cannot be a reserved keyword in Python", ICON_INFO);
}
-
+
UI_popup_menu_end(C, pup);
}
@@ -569,7 +569,7 @@ static void driver_update_flags_cb(bContext *UNUSED(C), void *fcu_v, void *UNUSE
{
FCurve *fcu = (FCurve *)fcu_v;
ChannelDriver *driver = fcu->driver;
-
+
/* clear invalid flags */
fcu->flag &= ~FCURVE_DISABLED;
driver->flag &= ~DRIVER_FLAG_INVALID;
@@ -592,22 +592,22 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa
DriverTarget *dtar = &dvar->targets[0];
PointerRNA dtar_ptr;
uiLayout *row, *col;
-
+
/* initialize RNA pointer to the target */
- RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
-
+ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
+
/* Target ID */
row = uiLayoutRow(layout, false);
uiLayoutSetRedAlert(row, ((dtar->flag & DTAR_FLAG_INVALID) && !dtar->id));
uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
-
+
/* Target Property */
if (dtar->id) {
PointerRNA root_ptr;
-
+
/* get pointer for resolving the property selected */
RNA_id_pointer_create(dtar->id, &root_ptr);
-
+
/* rna path */
col = uiLayoutColumn(layout, true);
uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID));
@@ -664,23 +664,23 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
Object *ob2 = (Object *)dtar2->id;
PointerRNA dtar_ptr, dtar2_ptr;
uiLayout *col;
-
+
/* initialize RNA pointer to the target */
- RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
- RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr);
+ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
+ RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr);
/* Object 1 */
col = uiLayoutColumn(layout, true);
uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
uiItemR(col, &dtar_ptr, "id", 0, IFACE_("Object 1"), ICON_NONE);
-
+
if (dtar->id && GS(dtar->id->name) == ID_OB && ob1->pose) {
PointerRNA tar_ptr;
-
+
RNA_pointer_create(dtar->id, &RNA_Pose, ob1->pose, &tar_ptr);
uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA);
}
-
+
uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
@@ -688,14 +688,14 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
col = uiLayoutColumn(layout, true);
uiLayoutSetRedAlert(col, (dtar2->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
uiItemR(col, &dtar2_ptr, "id", 0, IFACE_("Object 2"), ICON_NONE);
-
+
if (dtar2->id && GS(dtar2->id->name) == ID_OB && ob2->pose) {
PointerRNA tar_ptr;
-
+
RNA_pointer_create(dtar2->id, &RNA_Pose, ob2->pose, &tar_ptr);
uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA);
}
-
+
uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE);
}
@@ -707,22 +707,22 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
Object *ob = (Object *)dtar->id;
PointerRNA dtar_ptr;
uiLayout *col, *sub;
-
+
/* initialize RNA pointer to the target */
- RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
-
+ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
+
/* properties */
col = uiLayoutColumn(layout, true);
uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
uiItemR(col, &dtar_ptr, "id", 0, IFACE_("Object"), ICON_NONE);
-
+
if (dtar->id && GS(dtar->id->name) == ID_OB && ob->pose) {
PointerRNA tar_ptr;
-
+
RNA_pointer_create(dtar->id, &RNA_Pose, ob->pose, &tar_ptr);
uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA);
}
-
+
sub = uiLayoutColumn(layout, true);
uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE);
@@ -735,21 +735,21 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
FCurve *fcu;
ChannelDriver *driver;
DriverVar *dvar;
-
+
PointerRNA driver_ptr;
uiLayout *col;
uiBlock *block;
uiBut *but;
-
+
/* Get settings from context */
if (!graph_panel_context(C, &ale, &fcu))
return;
driver = fcu->driver;
-
+
/* set event handler for panel */
block = uiLayoutGetBlock(pa->layout); // xxx?
UI_block_func_handle_set(block, do_graph_region_driver_buttons, NULL);
-
+
/* general actions - management */
col = uiLayoutColumn(pa->layout, false);
block = uiLayoutGetBlock(col);
@@ -764,10 +764,10 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
NULL, 0.0, 0.0, 0, 0,
TIP_("Remove this driver"));
UI_but_funcN_set(but, driver_remove_cb, MEM_dupallocN(ale), NULL);
-
+
/* driver-level settings - type, expressions, and errors */
RNA_pointer_create(ale->id, &RNA_Driver, driver, &driver_ptr);
-
+
col = uiLayoutColumn(pa->layout, true);
block = uiLayoutGetBlock(col);
uiItemR(col, &driver_ptr, "type", 0, NULL, ICON_NONE);
@@ -776,10 +776,10 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
if (driver->type == DRIVER_TYPE_PYTHON) {
bool bpy_data_expr_error = (strstr(driver->expression, "bpy.data.") != NULL);
bool bpy_ctx_expr_error = (strstr(driver->expression, "bpy.context.") != NULL);
-
+
/* expression */
uiItemR(col, &driver_ptr, "expression", 0, IFACE_("Expr"), ICON_NONE);
-
+
/* errors? */
if ((G.f & G_SCRIPT_AUTOEXEC) == 0) {
uiItemL(col, IFACE_("ERROR: Python auto-execution disabled"), ICON_CANCEL);
@@ -787,12 +787,12 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
else if (driver->flag & DRIVER_FLAG_INVALID) {
uiItemL(col, IFACE_("ERROR: Invalid Python expression"), ICON_CANCEL);
}
-
+
/* Explicit bpy-references are evil. Warn about these to prevent errors */
/* TODO: put these in a box? */
if (bpy_data_expr_error || bpy_ctx_expr_error) {
uiItemL(col, IFACE_("WARNING: Driver expression may not work correctly"), ICON_HELP);
-
+
if (bpy_data_expr_error) {
uiItemL(col, IFACE_("TIP: Use variables instead of bpy.data paths (see below)"), ICON_ERROR);
}
@@ -805,7 +805,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* errors? */
if (driver->flag & DRIVER_FLAG_INVALID)
uiItemL(col, IFACE_("ERROR: Invalid target channel(s)"), ICON_ERROR);
-
+
/* Warnings about a lack of variables
* NOTE: The lack of variables is generally a bad thing, since it indicates
* that the driver doesn't work at all. This particular scenario arises
@@ -814,14 +814,14 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
*/
if (BLI_listbase_is_empty(&driver->variables)) {
uiItemL(col, IFACE_("ERROR: Driver is useless without any inputs"), ICON_ERROR);
-
+
if (!BLI_listbase_is_empty(&fcu->modifiers)) {
uiItemL(col, IFACE_("TIP: Use F-Curves for procedural animation instead"), ICON_INFO);
uiItemL(col, IFACE_("F-Modifiers can generate curves for those too"), ICON_INFO);
}
}
}
-
+
col = uiLayoutColumn(pa->layout, true);
if (driver->type == DRIVER_TYPE_PYTHON) {
@@ -830,22 +830,22 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* debug setting */
uiItemR(col, &driver_ptr, "show_debug_info", 0, NULL, ICON_NONE);
-
+
/* value of driver */
if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
uiLayout *row = uiLayoutRow(col, true);
char valBuf[32];
-
+
uiItemL(row, IFACE_("Driver Value:"), ICON_NONE);
-
+
BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", driver->curval);
uiItemL(row, valBuf, ICON_NONE);
}
-
+
/* add/copy/paste driver variables */
{
uiLayout *row;
-
+
/* add driver variable */
row = uiLayoutRow(pa->layout, false);
block = uiLayoutGetBlock(row);
@@ -854,62 +854,62 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
NULL, 0.0, 0.0, 0, 0,
TIP_("Driver variables ensure that all dependencies will be accounted for and that drivers will update correctly"));
UI_but_func_set(but, driver_add_var_cb, driver, NULL);
-
+
/* copy/paste (as sub-row) */
row = uiLayoutRow(row, true);
block = uiLayoutGetBlock(row);
-
+
uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_driver_variables_copy");
uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_driver_variables_paste");
}
-
+
/* loop over targets, drawing them */
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
PointerRNA dvar_ptr;
uiLayout *box, *row;
uiLayout *subrow, *sub;
-
+
/* sub-layout column for this variable's settings */
col = uiLayoutColumn(pa->layout, true);
-
+
/* 1) header panel */
box = uiLayoutBox(col);
RNA_pointer_create(ale->id, &RNA_DriverVariable, dvar, &dvar_ptr);
-
+
row = uiLayoutRow(box, false);
block = uiLayoutGetBlock(row);
-
+
/* 1.1) variable type and name */
subrow = uiLayoutRow(row, true);
-
+
/* 1.1.1) variable type */
sub = uiLayoutRow(subrow, true); /* HACK: special group just for the enum, otherwise we */
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */
-
+
uiItemR(sub, &dvar_ptr, "type", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-
+
/* 1.1.2) variable name */
sub = uiLayoutRow(subrow, true); /* HACK: special group to counteract the effects of the previous */
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */
-
+
uiItemR(sub, &dvar_ptr, "name", 0, "", ICON_NONE);
-
+
/* 1.2) invalid name? */
UI_block_emboss_set(block, UI_EMBOSS_NONE);
-
+
if (dvar->flag & DVAR_FLAG_INVALID_NAME) {
but = uiDefIconBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_ERROR, 290, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, IFACE_("Invalid variable name, click here for details"));
UI_but_func_set(but, driver_dvar_invalid_name_query_cb, dvar, NULL); // XXX: reports?
}
-
+
/* 1.3) remove button */
but = uiDefIconBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, IFACE_("Delete target variable"));
UI_but_func_set(but, driver_delete_var_cb, driver, dvar);
UI_block_emboss_set(block, UI_EMBOSS);
-
-
+
+
/* 2) variable type settings */
box = uiLayoutBox(col);
/* controls to draw depends on the type of variable */
@@ -927,15 +927,15 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
graph_panel_driverVar__transChan(box, ale->id, dvar);
break;
}
-
+
/* 3) value of variable */
if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
char valBuf[32];
-
+
box = uiLayoutBox(col);
row = uiLayoutRow(box, true);
uiItemL(row, IFACE_("Value:"), ICON_NONE);
-
+
if ((dvar->type == DVAR_TYPE_ROT_DIFF) ||
(dvar->type == DVAR_TYPE_TRANSFORM_CHAN &&
dvar->targets[0].transChan >= DTAR_TRANSCHAN_ROTX &&
@@ -946,11 +946,11 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
else {
BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
}
-
+
uiItemL(row, valBuf, ICON_NONE);
}
}
-
+
/* cleanup */
MEM_freeN(ale);
}
@@ -969,7 +969,7 @@ static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int
}
}
-static void graph_panel_modifiers(const bContext *C, Panel *pa)
+static void graph_panel_modifiers(const bContext *C, Panel *pa)
{
bAnimListElem *ale;
FCurve *fcu;
@@ -977,37 +977,37 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
uiLayout *col, *row;
uiBlock *block;
bool active;
-
+
if (!graph_panel_context(C, &ale, &fcu))
return;
-
+
block = uiLayoutGetBlock(pa->layout);
UI_block_func_handle_set(block, do_graph_region_modifier_buttons, NULL);
-
+
/* 'add modifier' button at top of panel */
{
row = uiLayoutRow(pa->layout, false);
-
- /* this is an operator button which calls a 'add modifier' operator...
+
+ /* this is an operator button which calls a 'add modifier' operator...
* a menu might be nicer but would be tricky as we need some custom filtering
*/
uiItemMenuEnumO(row, (bContext *)C, "GRAPH_OT_fmodifier_add", "type", IFACE_("Add Modifier"), ICON_NONE);
-
+
/* copy/paste (as sub-row) */
row = uiLayoutRow(row, true);
uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_fmodifier_copy");
uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_fmodifier_paste");
}
-
+
active = !(fcu->flag & FCURVE_MOD_OFF);
/* draw each modifier */
for (fcm = fcu->modifiers.first; fcm; fcm = fcm->next) {
col = uiLayoutColumn(pa->layout, true);
uiLayoutSetActive(col, active);
-
+
ANIM_uiTemplate_fmodifier_draw(col, ale->id, &fcu->modifiers, fcm);
}
-
+
MEM_freeN(ale);
}
@@ -1025,7 +1025,7 @@ void graph_buttons_register(ARegionType *art)
pt->draw = graph_panel_properties;
pt->poll = graph_panel_poll;
BLI_addtail(&art->paneltypes, pt);
-
+
pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
strcpy(pt->idname, "GRAPH_PT_key_properties");
strcpy(pt->label, N_("Active Keyframe"));
@@ -1053,7 +1053,7 @@ void graph_buttons_register(ARegionType *art)
pt->draw = graph_panel_modifiers;
pt->poll = graph_panel_poll;
BLI_addtail(&art->paneltypes, pt);
-
+
pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel view");
strcpy(pt->idname, "GRAPH_PT_view");
strcpy(pt->label, N_("View Properties"));
@@ -1067,7 +1067,7 @@ static int graph_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = graph_has_buttons_region(sa);
-
+
if (ar)
ED_region_toggle_hidden(C, ar);
@@ -1079,7 +1079,7 @@ void GRAPH_OT_properties(wmOperatorType *ot)
ot->name = "Properties";
ot->idname = "GRAPH_OT_properties";
ot->description = "Toggle the properties region visibility";
-
+
ot->exec = graph_properties_toggle_exec;
ot->poll = ED_operator_graphedit_active;
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index f6e182e02ec..9a94bb9072b 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -61,7 +61,7 @@
/* *************************** */
/* Utility Drawing Defines */
-/* determine the alpha value that should be used when
+/* determine the alpha value that should be used when
* drawing components for some F-Curve (fcu)
* - selected F-Curves should be more visible than partially visible ones
*/
@@ -82,27 +82,27 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
FCM_EnvelopeData *fed;
const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur);
int i;
-
+
/* draw two black lines showing the standard reference levels */
glColor3f(0.0f, 0.0f, 0.0f);
glLineWidth(1);
setlinestyle(5);
-
+
glBegin(GL_LINES);
glVertex2f(v2d->cur.xmin, env->midval + env->min);
glVertex2f(v2d->cur.xmax, env->midval + env->min);
-
+
glVertex2f(v2d->cur.xmin, env->midval + env->max);
glVertex2f(v2d->cur.xmax, env->midval + env->max);
glEnd();
setlinestyle(0);
-
+
/* set size of vertices (non-adjustable for now) */
glPointSize(2.0f);
-
+
/* for now, point color is fixed, and is white */
glColor3f(1.0f, 1.0f, 1.0f);
-
+
glBegin(GL_POINTS);
for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
/* only draw if visible
@@ -127,18 +127,18 @@ static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo),
BezTriple *bezt = fcu->bezt;
const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur);
int i;
-
+
glBegin(GL_POINTS);
-
+
for (i = 0; i < fcu->totvert; i++, bezt++) {
- /* as an optimization step, only draw those in view
+ /* as an optimization step, only draw those in view
* - we apply a correction factor to ensure that points don't pop in/out due to slight twitches of view size
*/
if (IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
if (edit) {
/* 'Keyframe' vertex only, as handle lines and handles have already been drawn
* - only draw those with correct selection state for the current drawing color
- * -
+ * -
*/
if ((bezt->f2 & SELECT) == sel)
glVertex3fv(bezt->vec[1]);
@@ -150,41 +150,41 @@ static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo),
}
}
}
-
+
glEnd();
}
-/* helper func - draw handle vertex for an F-Curve as a round unfilled circle
+/* helper func - draw handle vertex for an F-Curve as a round unfilled circle
* NOTE: the caller MUST HAVE GL_LINE_SMOOTH & GL_BLEND ENABLED, otherwise, the controls don't
* have a consistent appearance (due to off-pixel alignments)...
*/
static void draw_fcurve_handle_control(float x, float y, float xscale, float yscale, float hsize)
{
static GLuint displist = 0;
-
+
/* initialize round circle shape */
if (displist == 0) {
GLUquadricObj *qobj;
-
+
displist = glGenLists(1);
glNewList(displist, GL_COMPILE);
-
+
qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+ gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
gluDisk(qobj, 0, 0.7, 8, 1);
- gluDeleteQuadric(qobj);
-
+ gluDeleteQuadric(qobj);
+
glEndList();
}
-
+
/* adjust view transform before starting */
glTranslatef(x, y, 0.0f);
glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f);
-
+
/* draw! */
glCallList(displist);
-
+
/* restore view transform */
glScalef(xscale / hsize, yscale / hsize, 1.0);
glTranslatef(-x, -y, 0.0f);
@@ -197,24 +197,24 @@ static void draw_fcurve_vertices_handles(FCurve *fcu, SpaceIpo *sipo, View2D *v2
BezTriple *prevbezt = NULL;
float hsize, xscale, yscale;
int i;
-
+
/* get view settings */
hsize = UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE) * U.pixelsize;
UI_view2d_scale_get(v2d, &xscale, &yscale);
/* Compensate OGL scale sued for unit mapping, so circle will be circle, not ellipse */
yscale *= units_scale;
-
+
/* set handle color */
if (sel) UI_ThemeColor(TH_HANDLE_VERTEX_SELECT);
else UI_ThemeColor(TH_HANDLE_VERTEX);
-
+
/* anti-aliased lines for more consistent appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
-
+
for (i = 0; i < fcu->totvert; i++, prevbezt = bezt, bezt++) {
- /* Draw the editmode handles for a bezier curve (others don't have handles)
+ /* Draw the editmode handles for a bezier curve (others don't have handles)
* if their selection status matches the selection status we're drawing for
* - first handle only if previous beztriple was bezier-mode
* - second handle only if current beztriple is bezier-mode
@@ -227,14 +227,14 @@ static void draw_fcurve_vertices_handles(FCurve *fcu, SpaceIpo *sipo, View2D *v2
if ((bezt->f1 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/
draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize);
}
-
+
if (bezt->ipo == BEZT_IPO_BEZ) {
if ((bezt->f3 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax)*/
draw_fcurve_handle_control(bezt->vec[2][0], bezt->vec[2][1], xscale, yscale, hsize);
}
}
}
-
+
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -244,11 +244,11 @@ static void set_fcurve_vertex_color(FCurve *fcu, short sel)
{
/* Fade the 'intensity' of the vertices based on the selection of the curves too */
int alphaOffset = (int)((fcurve_display_alpha(fcu) - 1.0f) * 255);
-
+
/* Set color of curve vertex based on state of curve (i.e. 'Edit' Mode) */
if ((fcu->flag & FCURVE_PROTECTED) == 0) {
/* Curve's points ARE BEING edited */
- if (sel) UI_ThemeColorShadeAlpha(TH_VERTEX_SELECT, 0, alphaOffset);
+ if (sel) UI_ThemeColorShadeAlpha(TH_VERTEX_SELECT, 0, alphaOffset);
else UI_ThemeColorShadeAlpha(TH_VERTEX, 0, alphaOffset);
}
else {
@@ -262,29 +262,29 @@ static void set_fcurve_vertex_color(FCurve *fcu, short sel)
static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only, float units_scale)
{
View2D *v2d = &ar->v2d;
-
- /* only draw points if curve is visible
+
+ /* only draw points if curve is visible
* - draw unselected points before selected points as separate passes to minimize color-changing overhead
- * (XXX dunno if this is faster than drawing all in one pass though)
+ * (XXX dunno if this is faster than drawing all in one pass though)
* and also to make sure in the case of overlapping points that the selected is always visible
* - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users)
*/
-
+
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
-
+
/* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
if (do_handles) {
set_fcurve_vertex_color(fcu, 0);
draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only, units_scale);
-
+
set_fcurve_vertex_color(fcu, 1);
draw_fcurve_vertices_handles(fcu, sipo, v2d, 1, sel_handle_only, units_scale);
}
-
+
/* draw keyframes over the handles */
set_fcurve_vertex_color(fcu, 0);
draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
-
+
set_fcurve_vertex_color(fcu, 1);
draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
}
@@ -315,14 +315,14 @@ static bool draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
{
int sel, b;
-
+
/* a single call to GL_LINES here around these calls should be sufficient to still
* get separate line segments, but which aren't wrapped with GL_LINE_STRIP every time we
* want a single line
*/
glBegin(GL_LINES);
-
- /* slightly hacky, but we want to draw unselected points before selected ones
+
+ /* slightly hacky, but we want to draw unselected points before selected ones
* so that selected points are clearly visible
*/
for (sel = 0; sel < 2; sel++) {
@@ -330,35 +330,35 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
int basecol = (sel) ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
const float *fp;
unsigned char col[4];
-
+
for (b = 0; b < fcu->totvert; b++, prevbezt = bezt, bezt++) {
- /* if only selected keyframes can get their handles shown,
+ /* if only selected keyframes can get their handles shown,
* check that keyframe is selected
*/
if (sipo->flag & SIPO_SELVHANDLESONLY) {
if (BEZT_ISSEL_ANY(bezt) == 0)
continue;
}
-
+
/* draw handle with appropriate set of colors if selection is ok */
if ((bezt->f2 & SELECT) == sel) {
fp = bezt->vec[0];
-
+
/* only draw first handle if previous segment had handles */
if ((!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) {
UI_GetThemeColor3ubv(basecol + bezt->h1, col);
col[3] = fcurve_display_alpha(fcu) * 255;
glColor4ubv((GLubyte *)col);
-
+
glVertex2fv(fp); glVertex2fv(fp + 3);
}
-
+
/* only draw second handle if this segment is bezier */
if (bezt->ipo == BEZT_IPO_BEZ) {
UI_GetThemeColor3ubv(basecol + bezt->h2, col);
col[3] = fcurve_display_alpha(fcu) * 255;
glColor4ubv((GLubyte *)col);
-
+
glVertex2fv(fp + 3); glVertex2fv(fp + 6);
}
}
@@ -371,10 +371,10 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
UI_GetThemeColor3ubv(basecol + bezt->h1, col);
col[3] = fcurve_display_alpha(fcu) * 255;
glColor4ubv((GLubyte *)col);
-
+
glVertex2fv(fp); glVertex2fv(fp + 3);
}
-
+
/* only draw second handle if this segment is bezier, and selection is ok */
if (((bezt->f3 & SELECT) == sel) &&
(bezt->ipo == BEZT_IPO_BEZ))
@@ -383,49 +383,49 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
UI_GetThemeColor3ubv(basecol + bezt->h2, col);
col[3] = fcurve_display_alpha(fcu) * 255;
glColor4ubv((GLubyte *)col);
-
+
glVertex2fv(fp); glVertex2fv(fp + 3);
}
}
}
}
-
+
glEnd(); /* GL_LINES */
}
/* Samples ---------------- */
-/* helper func - draw sample-range marker for an F-Curve as a cross
+/* helper func - draw sample-range marker for an F-Curve as a cross
* NOTE: the caller MUST HAVE GL_LINE_SMOOTH & GL_BLEND ENABLED, otherwise, the controls don't
* have a consistent appearance (due to off-pixel alignments)...
*/
static void draw_fcurve_sample_control(float x, float y, float xscale, float yscale, float hsize)
{
static GLuint displist = 0;
-
+
/* initialize X shape */
if (displist == 0) {
displist = glGenLists(1);
glNewList(displist, GL_COMPILE);
-
+
glBegin(GL_LINES);
glVertex2f(-0.7f, -0.7f);
glVertex2f(+0.7f, +0.7f);
-
+
glVertex2f(-0.7f, +0.7f);
glVertex2f(+0.7f, -0.7f);
glEnd(); /* GL_LINES */
-
+
glEndList();
}
-
+
/* adjust view transform before starting */
glTranslatef(x, y, 0.0f);
glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f);
-
+
/* draw! */
glCallList(displist);
-
+
/* restore view transform */
glScalef(xscale / hsize, yscale / hsize, 1.0);
glTranslatef(-x, -y, 0.0f);
@@ -436,28 +436,28 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
-
+
/* get view settings */
hsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
UI_view2d_scale_get(&ar->v2d, &xscale, &yscale);
-
+
/* set vertex color */
if (fcu->flag & (FCURVE_ACTIVE | FCURVE_SELECTED)) UI_ThemeColor(TH_TEXT_HI);
else UI_ThemeColor(TH_TEXT);
-
+
/* get verts */
first = fcu->fpt;
last = (first) ? (first + (fcu->totvert - 1)) : (NULL);
-
+
/* draw */
if (first && last) {
/* anti-aliased lines for more consistent appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
-
+
draw_fcurve_sample_control(first->vec[0], first->vec[1], xscale, yscale, hsize);
draw_fcurve_sample_control(last->vec[0], last->vec[1], xscale, yscale, hsize);
-
+
glDisable(GL_BLEND);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
}
@@ -487,10 +487,10 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
/* disable any drivers temporarily */
driver = fcu->driver;
fcu->driver = NULL;
-
+
/* compute unit correction factor */
unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
-
+
/* Note about sampling frequency:
* Ideally, this is chosen such that we have 1-2 pixels = 1 segment
* which means that our curves can be as smooth as possible. However,
@@ -506,10 +506,10 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
/* grid->dx represents the number of 'frames' between gridlines, but we divide by U.v2d_min_gridsize to get pixels-steps */
/* TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted? */
samplefreq = dx / (U.v2d_min_gridsize * U.pixelsize);
-
+
if (sipo->flag & SIPO_BEAUTYDRAW_OFF) {
/* Low Precision = coarse lower-bound clamping
- *
+ *
* Although the "Beauty Draw" flag was originally for AA'd
* line drawing, the sampling rate here has a much greater
* impact on performance (e.g. for T40372)!
@@ -525,27 +525,27 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
if (samplefreq < 0.00001f)
samplefreq = 0.00001f;
}
-
-
+
+
/* the start/end times are simply the horizontal extents of the 'cur' rect */
stime = v2d->cur.xmin;
etime = v2d->cur.xmax + samplefreq; /* + samplefreq here so that last item gets included... */
-
-
- /* at each sampling interval, add a new vertex
- * - apply the unit correction factor to the calculated values so that
+
+
+ /* at each sampling interval, add a new vertex
+ * - apply the unit correction factor to the calculated values so that
* the displayed values appear correctly in the viewport
*/
glBegin(GL_LINE_STRIP);
-
+
n = (etime - stime) / samplefreq + 0.5f;
for (i = 0; i <= n; i++) {
float ctime = stime + i * samplefreq;
glVertex2f(ctime, (evaluate_fcurve(fcu, ctime) + offset) * unitFac);
}
-
+
glEnd();
-
+
/* restore driver */
fcu->driver = driver;
}
@@ -567,11 +567,11 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
glTranslatef(0.0f, offset, 0.0f);
glBegin(GL_LINE_STRIP);
-
+
/* extrapolate to left? - left-side of view comes before first keyframe? */
if (prevfpt->vec[0] > v2d->cur.xmin) {
v[0] = v2d->cur.xmin;
-
+
/* y-value depends on the interpolation */
if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) {
/* just extend across the first keyframe's value */
@@ -583,33 +583,33 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
if (fac) fac = 1.0f / fac;
v[1] = prevfpt->vec[1] - fac * (prevfpt->vec[1] - fpt->vec[1]);
}
-
+
glVertex2fv(v);
}
-
+
/* if only one sample, add it now */
if (fcu->totvert == 1)
glVertex2fv(prevfpt->vec);
-
+
/* loop over samples, drawing segments */
/* draw curve between first and last keyframe (if there are enough to do so) */
while (b--) {
/* Linear interpolation: just add one point (which should add a new line segment) */
glVertex2fv(prevfpt->vec);
-
+
/* get next pointers */
prevfpt = fpt;
fpt++;
-
+
/* last point? */
if (b == 0)
glVertex2fv(prevfpt->vec);
}
-
+
/* extrapolate to right? (see code for left-extrapolation above too) */
if (prevfpt->vec[0] < v2d->cur.xmax) {
v[0] = v2d->cur.xmax;
-
+
/* y-value depends on the interpolation */
if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) {
/* based on last keyframe's value */
@@ -622,28 +622,28 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
if (fac) fac = 1.0f / fac;
v[1] = prevfpt->vec[1] - fac * (prevfpt->vec[1] - fpt->vec[1]);
}
-
+
glVertex2fv(v);
}
-
+
glEnd();
glPopMatrix();
}
-/* helper func - check if the F-Curve only contains easily drawable segments
+/* helper func - check if the F-Curve only contains easily drawable segments
* (i.e. no easing equation interpolations)
*/
static bool fcurve_can_use_simple_bezt_drawing(FCurve *fcu)
{
BezTriple *bezt;
int i;
-
+
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (ELEM(bezt->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN, BEZT_IPO_BEZ) == false) {
return false;
}
}
-
+
return true;
}
@@ -659,7 +659,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
int resol;
float unit_scale, offset;
short mapping_flag = ANIM_get_normalization_flags(ac);
-
+
/* apply unit mapping */
glPushMatrix();
unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
@@ -667,12 +667,12 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
glTranslatef(0.0f, offset, 0.0f);
glBegin(GL_LINE_STRIP);
-
+
/* extrapolate to left? */
if (prevbezt->vec[1][0] > v2d->cur.xmin) {
/* left-side of view comes before first keyframe, so need to extend as not cyclic */
v1[0] = v2d->cur.xmin;
-
+
/* y-value depends on the interpolation */
if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (prevbezt->ipo == BEZT_IPO_CONST) || (fcu->totvert == 1)) {
/* just extend across the first keyframe's value */
@@ -690,17 +690,17 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
if (fac) fac = 1.0f / fac;
v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[0][1] - prevbezt->vec[1][1]);
}
-
+
glVertex2fv(v1);
}
-
+
/* if only one keyframe, add it now */
if (fcu->totvert == 1) {
v1[0] = prevbezt->vec[1][0];
v1[1] = prevbezt->vec[1][1];
glVertex2fv(v1);
}
-
+
/* draw curve between first and last keyframe (if there are enough to do so) */
/* TODO: optimize this to not have to calc stuff out of view too? */
while (b--) {
@@ -709,7 +709,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
v1[0] = prevbezt->vec[1][0];
v1[1] = prevbezt->vec[1][1];
glVertex2fv(v1);
-
+
v1[0] = bezt->vec[1][0];
v1[1] = prevbezt->vec[1][1];
glVertex2fv(v1);
@@ -721,10 +721,10 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
glVertex2fv(v1);
}
else if (prevbezt->ipo == BEZT_IPO_BEZ) {
- /* Bezier-Interpolation: draw curve as series of segments between keyframes
+ /* Bezier-Interpolation: draw curve as series of segments between keyframes
* - resol determines number of points to sample in between keyframes
*/
-
+
/* resol depends on distance between points (not just horizontal) OR is a fixed high res */
/* TODO: view scale should factor into this someday too... */
if (fcu->driver) {
@@ -733,7 +733,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
else {
resol = (int)(5.0f * len_v2v2(bezt->vec[1], prevbezt->vec[1]));
}
-
+
if (resol < 2) {
/* only draw one */
v1[0] = prevbezt->vec[1][0];
@@ -744,31 +744,31 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
/* clamp resolution to max of 32 */
/* NOTE: higher values will crash */
if (resol > 32) resol = 32;
-
+
v1[0] = prevbezt->vec[1][0];
v1[1] = prevbezt->vec[1][1];
v2[0] = prevbezt->vec[2][0];
v2[1] = prevbezt->vec[2][1];
-
+
v3[0] = bezt->vec[0][0];
v3[1] = bezt->vec[0][1];
v4[0] = bezt->vec[1][0];
v4[1] = bezt->vec[1][1];
-
+
correct_bezpart(v1, v2, v3, v4);
-
+
BKE_curve_forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float) * 3);
BKE_curve_forward_diff_bezier(v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float) * 3);
-
+
for (fp = data; resol; resol--, fp += 3)
glVertex2fv(fp);
}
}
-
+
/* get next pointers */
prevbezt = bezt;
bezt++;
-
+
/* last point? */
if (b == 0) {
v1[0] = prevbezt->vec[1][0];
@@ -776,11 +776,11 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
glVertex2fv(v1);
}
}
-
+
/* extrapolate to right? (see code for left-extrapolation above too) */
if (prevbezt->vec[1][0] < v2d->cur.xmax) {
v1[0] = v2d->cur.xmax;
-
+
/* y-value depends on the interpolation */
if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (prevbezt->ipo == BEZT_IPO_CONST) || (fcu->totvert == 1)) {
/* based on last keyframe's value */
@@ -799,17 +799,17 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
if (fac) fac = 1.0f / fac;
v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[2][1] - prevbezt->vec[1][1]);
}
-
+
glVertex2fv(v1);
}
-
+
glEnd();
glPopMatrix();
}
/* Debugging -------------------------------- */
-/* Draw indicators which show the value calculated from the driver,
+/* Draw indicators which show the value calculated from the driver,
* and how this is mapped to the value that comes out of it. This
* is handy for helping users better understand how to interpret
* the graphs, and also facilitates debugging.
@@ -821,93 +821,93 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
short mapping_flag = ANIM_get_normalization_flags(ac);
float offset;
float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
-
+
/* for now, only show when debugging driver... */
//if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0)
// return;
-
+
/* No curve to modify/visualize the result?
- * => We still want to show the 1-1 default...
+ * => We still want to show the 1-1 default...
*/
if ((fcu->totvert == 0) && BLI_listbase_is_empty(&fcu->modifiers)) {
float t;
-
+
/* draw with thin dotted lines in style of what curve would have been */
glColor3fv(fcu->color);
-
+
setlinestyle(20);
glLineWidth(2.0f);
-
- /* draw 1-1 line, stretching just past the screen limits
+
+ /* draw 1-1 line, stretching just past the screen limits
* NOTE: we need to scale the y-values to be valid for the units
*/
glBegin(GL_LINES);
{
t = v2d->cur.xmin;
glVertex2f(t, (t + offset) * unitfac);
-
+
t = v2d->cur.xmax;
glVertex2f(t, (t + offset) * unitfac);
}
glEnd();
-
+
/* cleanup line drawing */
setlinestyle(0);
}
-
+
/* draw driver only if actually functional */
if ((driver->flag & DRIVER_FLAG_INVALID) == 0) {
/* grab "coordinates" for driver outputs */
float x = driver->curval;
float y = fcu->curval * unitfac;
-
+
/* only draw indicators if the point is in range*/
if (x >= v2d->cur.xmin) {
float co[2];
-
+
/* draw dotted lines leading towards this point from both axes ....... */
glColor3f(0.9f, 0.9f, 0.9f);
setlinestyle(5);
-
+
glBegin(GL_LINES);
{
/* x-axis lookup */
co[0] = x;
-
+
if (y >= v2d->cur.ymin) {
co[1] = v2d->cur.ymin - 1.0f;
glVertex2fv(co);
-
+
co[1] = y;
glVertex2fv(co);
}
-
+
/* y-axis lookup */
co[1] = y;
-
+
co[0] = v2d->cur.xmin - 1.0f;
glVertex2fv(co);
-
+
co[0] = x;
glVertex2fv(co);
}
glEnd();
-
+
setlinestyle(0);
-
+
/* x marks the spot .................................................... */
/* -> outer frame */
glColor3f(0.9f, 0.9f, 0.9f);
glPointSize(7.0);
-
+
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
-
+
/* inner frame */
glColor3f(0.9f, 0.0f, 0.0f);
glPointSize(3.0);
-
+
glBegin(GL_POINTS);
glVertex2f(x, y);
glEnd();
@@ -917,36 +917,36 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
/* Public Curve-Drawing API ---------------- */
-/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
+/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
* NOTE: unit mapping has already been applied to the values, so do not try and apply again
*/
void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
{
FCurve *fcu;
-
+
/* draw with thick dotted lines */
setlinestyle(10);
glLineWidth(3.0f);
-
+
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
-
+
/* the ghost curves are simply sampled F-Curves stored in sipo->ghostCurves */
for (fcu = sipo->ghostCurves.first; fcu; fcu = fcu->next) {
- /* set whatever color the curve has set
+ /* set whatever color the curve has set
* - this is set by the function which creates these
* - draw with a fixed opacity of 2
*/
glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], 0.5f);
-
+
/* simply draw the stored samples */
draw_fcurve_curve_samples(ac, NULL, fcu, &ar->v2d);
}
-
+
/* restore settings */
setlinestyle(0);
-
+
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -959,32 +959,32 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* build list of curves to draw */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE);
filter |= ((sel) ? (ANIMFILTER_SEL) : (ANIMFILTER_UNSEL));
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* for each curve:
- * draw curve, then handle-lines, and finally vertices in this order so that
+ * draw curve, then handle-lines, and finally vertices in this order so that
* the data will be layered correctly
*/
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
FModifier *fcm = find_active_fmodifier(&fcu->modifiers);
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
+
/* map keyframes for drawing if scaled F-Curve */
if (adt)
- ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
-
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
+
/* draw curve:
* - curve line may be result of one or more destructive modifiers or just the raw data,
* so we need to check which method should be used
* - controls from active modifier take precedence over keyframes
* (XXX! editing tools need to take this into account!)
*/
-
+
/* 1) draw curve line */
{
/* set color/drawing style for curve itself */
@@ -998,12 +998,12 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
UI_ThemeColorShade(TH_HEADER, 50);
}
else {
- /* set whatever color the curve has set
+ /* set whatever color the curve has set
* - unselected curves draw less opaque to help distinguish the selected ones
*/
glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], fcurve_display_alpha(fcu));
}
-
+
/* draw active F-Curve thicker than the rest to make it stand out */
if (fcu->flag & FCURVE_ACTIVE) {
glLineWidth(2.0);
@@ -1011,15 +1011,15 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
else {
glLineWidth(1.0);
}
-
+
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
-
+
/* draw F-Curve */
if ((fcu->modifiers.first) || (fcu->flag & FCURVE_INT_VALUES)) {
- /* draw a curve affected by modifiers or only allowed to have integer values
- * by sampling it at various small-intervals over the visible region
+ /* draw a curve affected by modifiers or only allowed to have integer values
+ * by sampling it at various small-intervals over the visible region
*/
draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid);
}
@@ -1035,15 +1035,15 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d);
}
}
-
+
/* restore settings */
setlinestyle(0);
-
+
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
-
- /* 2) draw handles and vertices as appropriate based on active
+
+ /* 2) draw handles and vertices as appropriate based on active
* - if the option to only show controls if the F-Curve is selected is enabled, we must obey this
*/
if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
@@ -1061,46 +1061,46 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
short mapping_flag = ANIM_get_normalization_flags(ac);
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag, &offset);
-
+
/* apply unit-scaling to all values via OpenGL */
glPushMatrix();
glScalef(1.0f, unit_scale, 1.0f);
glTranslatef(0.0f, offset, 0.0f);
-
+
/* set this once and for all - all handles and handle-verts should use the same thickness */
glLineWidth(1.0);
-
+
if (fcu->bezt) {
bool do_handles = draw_fcurve_handles_check(sipo, fcu);
-
+
if (do_handles) {
/* only draw handles/vertices on keyframes */
glEnable(GL_BLEND);
draw_fcurve_handles(sipo, fcu);
glDisable(GL_BLEND);
}
-
+
draw_fcurve_vertices(sipo, ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY), unit_scale);
}
else {
/* samples: only draw two indicators at either end as indicators */
draw_fcurve_samples(sipo, ar, fcu);
}
-
+
glPopMatrix();
}
}
-
+
/* 3) draw driver debugging stuff */
if ((ac->datatype == ANIMCONT_DRIVERS) && (fcu->flag & FCURVE_ACTIVE)) {
graph_draw_driver_debug(ac, ale->id, fcu);
}
-
+
/* undo mapping of keyframes for drawing if scaled F-Curve */
if (adt)
- ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
}
-
+
/* free list of curves */
ANIM_animdata_freelist(&anim_data);
}
@@ -1109,40 +1109,40 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
/* Channel List */
/* left hand part */
-void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
+void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
View2D *v2d = &ar->v2d;
float y = 0.0f, height;
size_t items;
int i = 0;
-
+
/* build list of channels to draw */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* Update max-extent of channels here (taking into account scrollers):
* - this is done to allow the channel list to be scrollable, but must be done here
* to avoid regenerating the list again and/or also because channels list is drawn first
- * - offset of ACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for
+ * - offset of ACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for
* start of list offset, and the second is as a correction for the scrollers.
*/
height = (float)((items * ACHANNEL_STEP(ac)) + (ACHANNEL_HEIGHT(ac) * 2));
UI_view2d_totRect_set(v2d, BLI_rcti_size_x(&ar->v2d.mask), height);
-
+
/* loop through channels, and set up drawing depending on their type */
{ /* first pass: just the standard GL-drawing for backdrop + text */
size_t channel_index = 0;
-
+
y = (float)ACHANNEL_FIRST(ac);
-
+
for (ale = anim_data.first, i = 0; ale; ale = ale->next, i++) {
const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF(ac));
-
+
/* check if visible */
if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
@@ -1150,7 +1150,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
/* draw all channels using standard channel-drawing API */
ANIM_channel_draw(ac, ale, yminc, ymaxc, channel_index);
}
-
+
/* adjust y-position for next one */
y -= ACHANNEL_STEP(ac);
channel_index++;
@@ -1159,17 +1159,17 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
{ /* second pass: widgets */
uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
size_t channel_index = 0;
-
+
y = (float)ACHANNEL_FIRST(ac);
-
+
/* set blending again, as may not be set in previous step */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
-
+
for (ale = anim_data.first, i = 0; ale; ale = ale->next, i++) {
const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF(ac));
-
+
/* check if visible */
if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
@@ -1177,18 +1177,18 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
/* draw all channels using standard channel-drawing API */
ANIM_channel_draw_widgets(C, ac, ale, block, yminc, ymaxc, channel_index);
}
-
+
/* adjust y-position for next one */
y -= ACHANNEL_STEP(ac);
channel_index++;
}
-
+
UI_block_end(C, block);
UI_block_draw(C, block);
-
+
glDisable(GL_BLEND);
}
-
+
/* free tempolary channels */
ANIM_animdata_freelist(&anim_data);
}
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 12d24502ad6..0370a9149bf 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -82,36 +82,36 @@
/* Get the min/max keyframes*/
/* note: it should return total boundbox, filter for selection only can be argument... */
-void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax,
+void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax,
const bool do_sel_only, const bool include_handles)
{
Scene *scene = ac->scene;
-
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* get data to filter, from Dopesheet */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* set large values initial values that will be easy to override */
if (xmin) *xmin = 999999999.0f;
if (xmax) *xmax = -999999999.0f;
if (ymin) *ymin = 999999999.0f;
if (ymax) *ymax = -999999999.0f;
-
+
/* check if any channels to set range with */
if (anim_data.first) {
bool foundBounds = false;
-
+
/* go through channels, finding max extents */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
float txmin, txmax, tymin, tymax;
float unitFac, offset;
-
+
/* get range */
if (calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax, do_sel_only, include_handles)) {
short mapping_flag = ANIM_get_normalization_flags(ac);
@@ -121,24 +121,24 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
txmin = BKE_nla_tweakedit_remap(adt, txmin, NLATIME_CONVERT_MAP);
txmax = BKE_nla_tweakedit_remap(adt, txmax, NLATIME_CONVERT_MAP);
}
-
+
/* apply unit corrections */
unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag, &offset);
tymin += offset;
tymax += offset;
tymin *= unitFac;
tymax *= unitFac;
-
+
/* try to set cur using these values, if they're more extreme than previously set values */
if ((xmin) && (txmin < *xmin)) *xmin = txmin;
if ((xmax) && (txmax > *xmax)) *xmax = txmax;
if ((ymin) && (tymin < *ymin)) *ymin = tymin;
if ((ymax) && (tymax > *ymax)) *ymax = tymax;
-
+
foundBounds = true;
}
}
-
+
/* ensure that the extents are not too extreme that view implodes...*/
if (foundBounds) {
if ((xmin && xmax) && (fabsf(*xmax - *xmin) < 0.001f)) {
@@ -156,7 +156,7 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
if (ymin) *ymin = -5;
if (ymax) *ymax = 5;
}
-
+
/* free memory */
ANIM_animdata_freelist(&anim_data);
}
@@ -170,7 +170,7 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
if (xmin) *xmin = -5;
if (xmax) *xmax = 100;
}
-
+
if (ymin) *ymin = -5;
if (ymax) *ymax = 5;
}
@@ -183,7 +183,7 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
bAnimContext ac;
Scene *scene;
float min, max;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
@@ -191,31 +191,31 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
else
scene = ac.scene;
-
+
/* set the range directly */
get_graph_keyframe_extents(&ac, &min, &max, NULL, NULL, false, false);
scene->r.flag |= SCER_PRV_RANGE;
scene->r.psfra = round_fl_to_int(min);
scene->r.pefra = round_fl_to_int(max);
-
+
/* set notifier that things have changed */
// XXX err... there's nothing for frame ranges yet, but this should do fine too
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, ac.scene);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_previewrange_set(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Auto-Set Preview Range";
ot->idname = "GRAPH_OT_previewrange_set";
ot->description = "Automatically set Preview Range based on range of keyframes";
-
+
/* api callbacks */
ot->exec = graphkeys_previewrange_exec;
ot->poll = ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -227,11 +227,11 @@ static int graphkeys_viewall(bContext *C, const bool do_sel_only, const bool inc
{
bAnimContext ac;
rctf cur_new;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
get_graph_keyframe_extents(&ac,
&cur_new.xmin, &cur_new.xmax,
@@ -239,9 +239,9 @@ static int graphkeys_viewall(bContext *C, const bool do_sel_only, const bool inc
do_sel_only, include_handles);
BLI_rctf_scale(&cur_new, 1.1f);
-
+
UI_view2d_smooth_view(C, ac.ar, &cur_new, smooth_viewtx);
-
+
return OPERATOR_FINISHED;
}
@@ -251,16 +251,16 @@ static int graphkeys_viewall_exec(bContext *C, wmOperator *op)
{
const bool include_handles = RNA_boolean_get(op->ptr, "include_handles");
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
-
+
/* whole range */
return graphkeys_viewall(C, false, include_handles, smooth_viewtx);
}
-
+
static int graphkeys_view_selected_exec(bContext *C, wmOperator *op)
{
const bool include_handles = RNA_boolean_get(op->ptr, "include_handles");
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
-
+
/* only selected */
return graphkeys_viewall(C, true, include_handles, smooth_viewtx);
}
@@ -273,16 +273,16 @@ void GRAPH_OT_view_all(wmOperatorType *ot)
ot->name = "View All";
ot->idname = "GRAPH_OT_view_all";
ot->description = "Reset viewable area to show full keyframe range";
-
+
/* api callbacks */
ot->exec = graphkeys_viewall_exec;
ot->poll = ED_operator_graphedit_active; /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
- ot->prop = RNA_def_boolean(ot->srna, "include_handles", true, "Include Handles",
+ ot->prop = RNA_def_boolean(ot->srna, "include_handles", true, "Include Handles",
"Include handles of keyframes when calculating extents");
}
@@ -299,9 +299,9 @@ void GRAPH_OT_view_selected(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
- ot->prop = RNA_def_boolean(ot->srna, "include_handles", true, "Include Handles",
+ ot->prop = RNA_def_boolean(ot->srna, "include_handles", true, "Include Handles",
"Include handles of keyframes when calculating extents");
}
@@ -320,11 +320,11 @@ void GRAPH_OT_view_frame(wmOperatorType *ot)
ot->name = "View Frame";
ot->idname = "GRAPH_OT_view_frame";
ot->description = "Reset viewable area to show range around current frame";
-
+
/* api callbacks */
ot->exec = graphkeys_view_frame_exec;
ot->poll = ED_operator_graphedit_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -336,25 +336,25 @@ void GRAPH_OT_view_frame(wmOperatorType *ot)
/* Bake each F-Curve into a set of samples, and store as a ghost curve */
static void create_ghost_curves(bAnimContext *ac, int start, int end)
-{
+{
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* free existing ghost curves */
free_fcurves(&sipo->ghostCurves);
-
+
/* sanity check */
if (start >= end) {
printf("Error: Frame range for Ghost F-Curve creation is inappropriate\n");
return;
}
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* loop through filtered data and add keys between selected keyframes on every frame */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
@@ -365,41 +365,41 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end)
float unitFac, offset;
int cfra;
short mapping_flag = ANIM_get_normalization_flags(ac);
-
+
/* disable driver so that it don't muck up the sampling process */
fcu->driver = NULL;
-
+
/* calculate unit-mapping factor */
unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag, &offset);
-
- /* create samples, but store them in a new curve
- * - we cannot use fcurve_store_samples() as that will only overwrite the original curve
+
+ /* create samples, but store them in a new curve
+ * - we cannot use fcurve_store_samples() as that will only overwrite the original curve
*/
gcu->fpt = fpt = MEM_callocN(sizeof(FPoint) * (end - start + 1), "Ghost FPoint Samples");
gcu->totvert = end - start + 1;
-
+
/* use the sampling callback at 1-frame intervals from start to end frames */
for (cfra = start; cfra <= end; cfra++, fpt++) {
float cfrae = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
-
+
fpt->vec[0] = cfrae;
fpt->vec[1] = (fcurve_samplingcb_evalcurve(fcu, NULL, cfrae) + offset) * unitFac;
}
-
- /* set color of ghost curve
+
+ /* set color of ghost curve
* - make the color slightly darker
*/
gcu->color[0] = fcu->color[0] - 0.07f;
gcu->color[1] = fcu->color[1] - 0.07f;
gcu->color[2] = fcu->color[2] - 0.07f;
-
+
/* store new ghost curve */
BLI_addtail(&sipo->ghostCurves, gcu);
-
+
/* restore driver */
fcu->driver = driver;
}
-
+
/* admin and redraws */
ANIM_animdata_freelist(&anim_data);
}
@@ -411,39 +411,39 @@ static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)
bAnimContext ac;
View2D *v2d;
int start, end;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* ghost curves are snapshots of the visible portions of the curves, so set range to be the visible range */
v2d = &ac.ar->v2d;
start = (int)v2d->cur.xmin;
end = (int)v2d->cur.xmax;
-
+
/* bake selected curves into a ghost curve */
create_ghost_curves(&ac, start, end);
-
+
/* update this editor only */
ED_area_tag_redraw(CTX_wm_area(C));
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_ghost_curves_create(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Create Ghost Curves";
ot->idname = "GRAPH_OT_ghost_curves_create";
ot->description = "Create snapshot (Ghosts) of selected F-Curves as background aid for active Graph Editor";
-
+
/* api callbacks */
ot->exec = graphkeys_create_ghostcurves_exec;
ot->poll = graphop_visible_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
// todo: add props for start/end frames
}
@@ -454,36 +454,36 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
SpaceIpo *sipo;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
sipo = (SpaceIpo *)ac.sl;
-
+
/* if no ghost curves, don't do anything */
if (BLI_listbase_is_empty(&sipo->ghostCurves))
return OPERATOR_CANCELLED;
-
+
/* free ghost curves */
free_fcurves(&sipo->ghostCurves);
-
+
/* update this editor only */
ED_area_tag_redraw(CTX_wm_area(C));
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_ghost_curves_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Ghost Curves";
ot->idname = "GRAPH_OT_ghost_curves_clear";
ot->description = "Clear F-Curve snapshots (Ghosts) for active Graph Editor";
-
+
/* api callbacks */
ot->exec = graphkeys_clear_ghostcurves_exec;
ot->poll = ED_operator_graphedit_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -516,26 +516,26 @@ static const EnumPropertyItem prop_graphkeys_insertkey_types[] = {
};
/* this function is responsible for snapping keyframes to frame-times */
-static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
+static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
size_t num_items;
-
+
ReportList *reports = ac->reports;
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
Scene *scene = ac->scene;
ToolSettings *ts = scene->toolsettings;
short flag = 0;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
if (mode & GRAPHKEYS_INSERTKEY_SEL)
filter |= ANIMFILTER_SEL;
else if (mode & GRAPHKEYS_INSERTKEY_ACTIVE)
filter |= ANIMFILTER_ACTIVE;
-
+
num_items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
if (num_items == 0) {
if (mode & GRAPHKEYS_INSERTKEY_ACTIVE)
@@ -544,26 +544,26 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
BKE_report(reports, RPT_ERROR, "No selected F-Curves to add keyframes to");
else
BKE_report(reports, RPT_ERROR, "No channels to add keyframes to");
-
+
return;
}
-
+
/* init keyframing flag */
flag = ANIM_get_keyframing_flags(scene, 1);
-
+
/* insert keyframes */
if (mode & GRAPHKEYS_INSERTKEY_CURSOR) {
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
-
+
short mapping_flag = ANIM_get_normalization_flags(ac);
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, ale->key_data, mapping_flag, &offset);
-
+
float x, y;
-
-
+
+
/* perform time remapping for x-coordinate (if necessary) */
if ((sipo) && (sipo->mode == SIPO_MODE_DRIVERS))
x = sipo->cursorTime;
@@ -571,16 +571,16 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
x = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
else
x = (float)CFRA;
-
+
/* normalise units of cursor's value */
if (sipo)
y = (sipo->cursorVal / unit_scale) - offset;
else
y = 0.0f;
-
+
/* insert keyframe directly into the F-Curve */
insert_vert_fcurve(fcu, x, y, ts->keyframe_type, 0);
-
+
ale->update |= ANIM_UPDATE_DEFAULT;
}
}
@@ -589,15 +589,15 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
float cfra;
-
+
/* adjust current frame for NLA-mapping */
if ((sipo) && (sipo->mode == SIPO_MODE_DRIVERS))
cfra = sipo->cursorTime;
else if (adt)
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
- else
+ else
cfra = (float)CFRA;
-
+
/* read value from property the F-Curve represents, or from the curve only?
* - ale->id != NULL: Typically, this means that we have enough info to try resolving the path
* - ale->owner != NULL: If this is set, then the path may not be resolvable from the ID alone,
@@ -613,11 +613,11 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
const float curval = evaluate_fcurve(fcu, cfra);
insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0);
}
-
+
ale->update |= ANIM_UPDATE_DEFAULT;
}
}
-
+
ANIM_animdata_update(ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
}
@@ -628,20 +628,20 @@ static int graphkeys_insertkey_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
eGraphKeys_InsertKey_Types mode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* which channels to affect? */
mode = RNA_enum_get(op->ptr, "type");
-
+
/* insert keyframes */
insert_graph_keys(&ac, mode);
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -651,15 +651,15 @@ void GRAPH_OT_keyframe_insert(wmOperatorType *ot)
ot->name = "Insert Keyframes";
ot->idname = "GRAPH_OT_keyframe_insert";
ot->description = "Insert keyframes for the specified channels";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = graphkeys_insertkey_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_insertkey_types, 0, "Type", "");
}
@@ -673,11 +673,11 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
AnimData *adt;
FCurve *fcu;
float frame, val;
-
+
/* get animation context */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get active F-Curve 'anim-list-element' */
ale = get_active_fcurve_channel(&ac);
if (ELEM(NULL, ale, ale->data)) {
@@ -685,17 +685,17 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
fcu = ale->data;
-
+
/* when there are F-Modifiers on the curve, only allow adding
* keyframes if these will be visible after doing so...
*/
if (fcurve_is_keyframable(fcu)) {
ListBase anim_data;
ToolSettings *ts = ac.scene->toolsettings;
-
+
short mapping_flag = ANIM_get_normalization_flags(&ac);
float scale, offset;
-
+
/* preserve selection? */
if (RNA_boolean_get(op->ptr, "extend") == false) {
/* deselect all keyframes first, so that we can immediately start manipulating the newly added one(s)
@@ -703,28 +703,28 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
*/
deselect_graph_keys(&ac, false, SELECT_SUBTRACT, false);
}
-
+
/* get frame and value from props */
frame = RNA_float_get(op->ptr, "frame");
val = RNA_float_get(op->ptr, "value");
-
+
/* apply inverse NLA-mapping to frame to get correct time in un-scaled action */
adt = ANIM_nla_mapping_get(&ac, ale);
frame = BKE_nla_tweakedit_remap(adt, frame, NLATIME_CONVERT_UNMAP);
-
+
/* apply inverse unit-mapping to value to get correct value for F-Curves */
scale = ANIM_unit_mapping_get_factor(ac.scene, ale->id, fcu, mapping_flag | ANIM_UNITCONV_RESTORE, &offset);
-
+
val = val * scale - offset;
-
+
/* insert keyframe on the specified frame + value */
insert_vert_fcurve(fcu, frame, val, ts->keyframe_type, 0);
-
+
ale->update |= ANIM_UPDATE_DEPS;
-
+
BLI_listbase_clear(&anim_data);
BLI_addtail(&anim_data, ale);
-
+
ANIM_animdata_update(&ac, &anim_data);
}
else {
@@ -736,13 +736,13 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
else
BKE_report(op->reports, RPT_ERROR, "Remove F-Modifiers from F-Curve to add keyframes");
}
-
+
/* free temp data */
MEM_freeN(ale);
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
/* done */
return OPERATOR_FINISHED;
}
@@ -754,23 +754,23 @@ static int graphkeys_click_insert_invoke(bContext *C, wmOperator *op, const wmEv
View2D *v2d;
int mval[2];
float x, y;
-
+
/* get animation context */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* store mouse coordinates in View2D space, into the operator's properties */
ar = ac.ar;
v2d = &ar->v2d;
-
+
mval[0] = (event->x - ar->winrct.xmin);
mval[1] = (event->y - ar->winrct.ymin);
-
+
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
-
+
RNA_float_set(op->ptr, "frame", x);
RNA_float_set(op->ptr, "value", y);
-
+
/* run exec now */
return graphkeys_click_insert_exec(C, op);
}
@@ -781,19 +781,19 @@ void GRAPH_OT_click_insert(wmOperatorType *ot)
ot->name = "Click-Insert Keyframes";
ot->idname = "GRAPH_OT_click_insert";
ot->description = "Insert new keyframe at the cursor position for the active F-Curve";
-
+
/* api callbacks */
ot->invoke = graphkeys_click_insert_invoke;
ot->exec = graphkeys_click_insert_exec;
ot->poll = graphop_active_fcurve_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
RNA_def_float(ot->srna, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame Number", "Frame to insert keyframe on", 0, 100);
RNA_def_float(ot->srna, "value", 1.0f, -FLT_MAX, FLT_MAX, "Value", "Value for keyframe on", 0, 100);
-
+
RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first");
}
@@ -801,20 +801,20 @@ void GRAPH_OT_click_insert(wmOperatorType *ot)
/* NOTE: the backend code for this is shared with the dopesheet editor */
static short copy_graph_keys(bAnimContext *ac)
-{
+{
ListBase anim_data = {NULL, NULL};
int filter, ok = 0;
-
+
/* clear buffer first */
ANIM_fcurves_copybuf_free();
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* copy keyframes */
ok = copy_animedit_keys(ac, &anim_data);
-
+
/* clean up */
ANIM_animdata_freelist(&anim_data);
@@ -823,21 +823,21 @@ static short copy_graph_keys(bAnimContext *ac)
static short paste_graph_keys(bAnimContext *ac,
const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode, bool flip)
-{
+{
ListBase anim_data = {NULL, NULL};
int filter, ok = 0;
-
- /* filter data
- * - First time we try to filter more strictly, allowing only selected channels
+
+ /* filter data
+ * - First time we try to filter more strictly, allowing only selected channels
* to allow copying animation between channels
* - Second time, we loosen things up if nothing was found the first time, allowing
* users to just paste keyframes back into the original curve again [#31670]
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
-
+
if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0)
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* paste keyframes */
ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode, flip);
@@ -852,32 +852,32 @@ static short paste_graph_keys(bAnimContext *ac,
static int graphkeys_copy_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* copy keyframes */
if (copy_graph_keys(&ac)) {
BKE_report(op->reports, RPT_ERROR, "No keyframes copied to keyframes copy/paste buffer");
return OPERATOR_CANCELLED;
}
-
+
/* just return - no operator needed here (no changes) */
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Keyframes";
ot->idname = "GRAPH_OT_copy";
ot->description = "Copy selected keyframes to the copy/paste buffer";
-
+
/* api callbacks */
ot->exec = graphkeys_copy_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -891,11 +891,11 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
const eKeyPasteOffset offset_mode = RNA_enum_get(op->ptr, "offset");
const eKeyMergeMode merge_mode = RNA_enum_get(op->ptr, "merge");
const bool flipped = RNA_boolean_get(op->ptr, "flipped");
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* ac.reports by default will be the global reports list, which won't show warnings */
ac.reports = op->reports;
@@ -903,30 +903,30 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
if (paste_graph_keys(&ac, offset_mode, merge_mode, flipped)) {
return OPERATOR_CANCELLED;
}
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_paste(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Paste Keyframes";
ot->idname = "GRAPH_OT_paste";
ot->description = "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
-
+
/* api callbacks */
// ot->invoke = WM_operator_props_popup; // better wait for graph redo panel
ot->exec = graphkeys_paste_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
RNA_def_enum(ot->srna, "offset", rna_enum_keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
RNA_def_enum(ot->srna, "merge", rna_enum_keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
@@ -941,11 +941,11 @@ static void duplicate_graph_keys(bAnimContext *ac)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
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) {
duplicate_fcurve_keys((FCurve *)ale->key_data);
@@ -962,17 +962,17 @@ static void duplicate_graph_keys(bAnimContext *ac)
static int graphkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* duplicate keyframes */
duplicate_graph_keys(&ac);
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -982,14 +982,14 @@ void GRAPH_OT_duplicate(wmOperatorType *ot)
ot->name = "Duplicate Keyframes";
ot->idname = "GRAPH_OT_duplicate";
ot->description = "Make a copy of all selected keyframes";
-
+
/* api callbacks */
ot->exec = graphkeys_duplicate_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* to give to transform */
RNA_def_enum(ot->srna, "mode", rna_enum_transform_mode_types, TFM_TRANSLATION, "Mode", "");
}
@@ -1002,17 +1002,17 @@ static bool delete_graph_keys(bAnimContext *ac)
bAnimListElem *ale;
int filter;
bool changed_final = false;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
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) {
FCurve *fcu = (FCurve *)ale->key_data;
AnimData *adt = ale->adt;
bool changed;
-
+
/* delete selected keyframes only */
changed = delete_fcurve_keys(fcu);
@@ -1020,7 +1020,7 @@ static bool delete_graph_keys(bAnimContext *ac)
ale->update |= ANIM_UPDATE_DEFAULT;
changed_final = true;
}
-
+
/* Only delete curve too if it won't be doing anything anymore */
if ((fcu->totvert == 0) &&
(list_has_suitable_fmodifier(&fcu->modifiers, 0, FMI_TYPE_GENERATE_CURVE) == 0) &&
@@ -1042,33 +1042,33 @@ static bool delete_graph_keys(bAnimContext *ac)
static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* delete keyframes */
if (!delete_graph_keys(&ac))
return OPERATOR_CANCELLED;
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframes";
ot->idname = "GRAPH_OT_delete";
ot->description = "Remove all selected keyframes";
-
+
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = graphkeys_delete_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1076,15 +1076,15 @@ void GRAPH_OT_delete(wmOperatorType *ot)
/* ******************** Clean Keyframes Operator ************************* */
static void clean_graph_keys(bAnimContext *ac, float thresh, bool clean_chan)
-{
+{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* loop through filtered data and clean curves */
for (ale = anim_data.first; ale; ale = ale->next) {
clean_fcurve(ac, ale, thresh, clean_chan);
@@ -1103,38 +1103,38 @@ static int graphkeys_clean_exec(bContext *C, wmOperator *op)
bAnimContext ac;
float thresh;
bool clean_chan;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get cleaning threshold */
thresh = RNA_float_get(op->ptr, "threshold");
clean_chan = RNA_boolean_get(op->ptr, "channels");
/* clean keyframes */
clean_graph_keys(&ac, thresh, clean_chan);
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_clean(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clean Keyframes";
ot->idname = "GRAPH_OT_clean";
ot->description = "Simplify F-Curves by removing closely spaced keyframes";
-
+
/* api callbacks */
- //ot->invoke = // XXX we need that number popup for this!
+ //ot->invoke = // XXX we need that number popup for this!
ot->exec = graphkeys_clean_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
ot->prop = RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
RNA_def_boolean(ot->srna, "channels", false, "Channels", "");
@@ -1145,26 +1145,26 @@ void GRAPH_OT_clean(wmOperatorType *ot)
/* Bake each F-Curve into a set of samples */
static void bake_graph_curves(bAnimContext *ac, int start, int end)
-{
+{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* loop through filtered data and add keys between selected keyframes on every frame */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
ChannelDriver *driver = fcu->driver;
-
+
/* disable driver so that it don't muck up the sampling process */
fcu->driver = NULL;
-
+
/* create samples */
fcurve_store_samples(fcu, NULL, start, end, fcurve_samplingcb_evalcurve);
-
+
/* restore driver */
fcu->driver = driver;
@@ -1182,42 +1182,42 @@ static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op))
bAnimContext ac;
Scene *scene = NULL;
int start, end;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* for now, init start/end from preview-range extents */
- // TODO: add properties for this
+ // TODO: add properties for this
scene = ac.scene;
start = PSFRA;
end = PEFRA;
-
+
/* bake keyframes */
bake_graph_curves(&ac, start, end);
-
+
/* set notifier that keyframes have changed */
// NOTE: some distinction between order/number of keyframes and type should be made?
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_bake(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Bake Curve";
ot->idname = "GRAPH_OT_bake";
ot->description = "Bake selected F-Curves to a set of sampled points defining a similar curve";
-
+
/* api callbacks */
ot->invoke = WM_operator_confirm; // FIXME...
ot->exec = graphkeys_bake_exec;
- ot->poll = graphop_selected_fcurve_poll;
-
+ ot->poll = graphop_selected_fcurve_poll;
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
// todo: add props for start/end frames
}
@@ -1310,7 +1310,7 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
/* loop through all selected F-Curves, replacing its data with the sound samples */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
-
+
/* sample the sound */
fcurve_store_samples(fcu, &sbi, start, end, fcurve_samplingcb_sound);
@@ -1401,15 +1401,15 @@ void GRAPH_OT_sound_bake(wmOperatorType *ot)
/* Evaluates the curves between each selected keyframe on each frame, and keys the value */
static void sample_graph_keys(bAnimContext *ac)
-{
+{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* loop through filtered data and add keys between selected keyframes on every frame */
for (ale = anim_data.first; ale; ale = ale->next) {
sample_fcurve((FCurve *)ale->key_data);
@@ -1426,31 +1426,31 @@ static void sample_graph_keys(bAnimContext *ac)
static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* sample keyframes */
sample_graph_keys(&ac);
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_sample(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sample Keyframes";
ot->idname = "GRAPH_OT_sample";
ot->description = "Add keyframes on every frame between the selected keyframes";
-
+
/* api callbacks */
ot->exec = graphkeys_sample_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1469,27 +1469,27 @@ void GRAPH_OT_sample(wmOperatorType *ot)
static const EnumPropertyItem prop_graphkeys_expo_types[] = {
{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant Extrapolation", "Values on endpoint keyframes are held"},
{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear Extrapolation", "Straight-line slope of end segments are extended past the endpoint keyframes"},
-
+
{MAKE_CYCLIC_EXPO, "MAKE_CYCLIC", 0, "Make Cyclic (F-Modifier)", "Add Cycles F-Modifier if one doesn't exist already"},
{CLEAR_CYCLIC_EXPO, "CLEAR_CYCLIC", 0, "Clear Cyclic (F-Modifier)", "Remove Cycles F-Modifier if not needed anymore"},
{0, NULL, 0, NULL, NULL}
};
/* this function is responsible for setting extrapolation mode for keyframes */
-static void setexpo_graph_keys(bAnimContext *ac, short mode)
+static void setexpo_graph_keys(bAnimContext *ac, short mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* loop through setting mode per F-Curve */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->data;
-
+
if (mode >= 0) {
/* just set mode setting */
fcu->extend = mode;
@@ -1497,7 +1497,7 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode)
ale->update |= ANIM_UPDATE_HANDLES;
}
else {
- /* shortcuts for managing Cycles F-Modifiers to make it easier to toggle cyclic animation
+ /* shortcuts for managing Cycles F-Modifiers to make it easier to toggle cyclic animation
* without having to go through FModifier UI in Graph Editor to do so
*/
if (mode == MAKE_CYCLIC_EXPO) {
@@ -1510,10 +1510,10 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode)
else if (mode == CLEAR_CYCLIC_EXPO) {
/* remove all the modifiers fitting this description */
FModifier *fcm, *fcn = NULL;
-
+
for (fcm = fcu->modifiers.first; fcm; fcm = fcn) {
fcn = fcm->next;
-
+
if (fcm->type == FMODIFIER_TYPE_CYCLES)
remove_fmodifier(&fcu->modifiers, fcm);
}
@@ -1533,38 +1533,38 @@ static int graphkeys_expo_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short mode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get handle setting mode */
mode = RNA_enum_get(op->ptr, "type");
-
+
/* set handle type */
setexpo_graph_keys(&ac, mode);
-
+
/* set notifier that keyframe properties have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_extrapolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Extrapolation";
ot->idname = "GRAPH_OT_extrapolation_type";
ot->description = "Set extrapolation mode for selected F-Curves";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = graphkeys_expo_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_expo_types, 0, "Type", "");
}
@@ -1572,17 +1572,17 @@ void GRAPH_OT_extrapolation_type(wmOperatorType *ot)
/* ******************** Set Interpolation-Type Operator *********************** */
/* this function is responsible for setting interpolation mode for keyframes */
-static void setipo_graph_keys(bAnimContext *ac, short mode)
+static void setipo_graph_keys(bAnimContext *ac, short mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
KeyframeEditFunc set_cb = ANIM_editkeyframes_ipo(mode);
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* loop through setting BezTriple interpolation
* Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here...
*/
@@ -1602,38 +1602,38 @@ static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short mode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get handle setting mode */
mode = RNA_enum_get(op->ptr, "type");
-
+
/* set handle type */
setipo_graph_keys(&ac, mode);
-
+
/* set notifier that keyframe properties have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_interpolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Interpolation";
ot->idname = "GRAPH_OT_interpolation_type";
ot->description = "Set interpolation mode for the F-Curve segments starting from the selected keyframes";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = graphkeys_ipo_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_beztriple_interpolation_mode_items, 0, "Type", "");
}
@@ -1646,11 +1646,11 @@ static void seteasing_graph_keys(bAnimContext *ac, short mode)
bAnimListElem *ale;
int filter;
KeyframeEditFunc set_cb = ANIM_editkeyframes_easing(mode);
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* loop through setting BezTriple easing
* Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here...
*/
@@ -1668,20 +1668,20 @@ static int graphkeys_easing_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short mode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get handle setting mode */
mode = RNA_enum_get(op->ptr, "type");
-
+
/* set handle type */
seteasing_graph_keys(&ac, mode);
-
+
/* set notifier that keyframe properties have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1691,15 +1691,15 @@ void GRAPH_OT_easing_type(wmOperatorType *ot)
ot->name = "Set Keyframe Easing Type";
ot->idname = "GRAPH_OT_easing_type";
ot->description = "Set easing type for the F-Curve segments starting from the selected keyframes";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = graphkeys_easing_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_beztriple_interpolation_easing_items, 0, "Type", "");
}
@@ -1707,25 +1707,25 @@ void GRAPH_OT_easing_type(wmOperatorType *ot)
/* ******************** Set Handle-Type Operator *********************** */
/* this function is responsible for setting handle-type of selected keyframes */
-static void sethandles_graph_keys(bAnimContext *ac, short mode)
+static void sethandles_graph_keys(bAnimContext *ac, short mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
KeyframeEditFunc edit_cb = ANIM_editkeyframes_handles(mode);
KeyframeEditFunc sel_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
- /* loop through setting flags for handles
+
+ /* loop through setting flags for handles
* Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here...
*/
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
-
+
/* any selected keyframes for editing? */
if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) {
/* change type of selected handles */
@@ -1744,38 +1744,38 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short mode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get handle setting mode */
mode = RNA_enum_get(op->ptr, "type");
-
+
/* set handle type */
sethandles_graph_keys(&ac, mode);
-
+
/* set notifier that keyframe properties have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_handle_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Handle Type";
ot->idname = "GRAPH_OT_handle_type";
ot->description = "Set type of handle for selected keyframes";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = graphkeys_handletype_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_keyframe_handle_type_items, 0, "Type", "");
}
@@ -1793,43 +1793,43 @@ void GRAPH_OT_handle_type(wmOperatorType *ot)
/* set of three euler-rotation F-Curves */
typedef struct tEulerFilter {
struct tEulerFilter *next, *prev;
-
+
ID *id; /* ID-block which owns the channels */
FCurve *(fcurves[3]); /* 3 Pointers to F-Curves */
const char *rna_path; /* Pointer to one of the RNA Path's used by one of the F-Curves */
} tEulerFilter;
-
+
static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
-
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
ListBase eulers = {NULL, NULL};
tEulerFilter *euf = NULL;
int groups = 0, failed = 0;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* The process is done in two passes:
* 1) Sets of three related rotation curves are identified from the selected channels,
* and are stored as a single 'operation unit' for the next step
* 2) Each set of three F-Curves is processed for each keyframe, with the values being
* processed as necessary
*/
-
+
/* step 1: extract only the rotation f-curves */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->data;
-
- /* check if this is an appropriate F-Curve
+
+ /* check if this is an appropriate F-Curve
* - only rotation curves
* - for pchan curves, make sure we're only using the euler curves
*/
@@ -1841,9 +1841,9 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
(ale->id) ? ale->id->name : TIP_("<No ID>"), fcu->rna_path, fcu->array_index);
continue;
}
-
+
/* optimization: assume that xyz curves will always be stored consecutively,
- * so if the paths or the ID's don't match up, then a curve needs to be added
+ * so if the paths or the ID's don't match up, then a curve needs to be added
* to a new group
*/
if ((euf) && (euf->id == ale->id) && (STREQ(euf->rna_path, fcu->rna_path))) {
@@ -1855,7 +1855,7 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
euf = MEM_callocN(sizeof(tEulerFilter), "tEulerFilter");
BLI_addtail(&eulers, euf);
groups++;
-
+
euf->id = ale->id;
euf->rna_path = fcu->rna_path; /* this should be safe, since we're only using it for a short time */
euf->fcurves[fcu->array_index] = fcu;
@@ -1869,13 +1869,13 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "No Euler Rotation F-Curves to fix up");
return OPERATOR_CANCELLED;
}
-
- /* step 2: go through each set of curves, processing the values at each keyframe
+
+ /* step 2: go through each set of curves, processing the values at each keyframe
* - it is assumed that there must be a full set of keyframes at each keyframe position
*/
for (euf = eulers.first; euf; euf = euf->next) {
int f;
-
+
/* sanity check: ensure that there are enough F-Curves to work on in this group */
/* TODO: also enforce assumption that there be a full set of keyframes at each position by ensuring that totvert counts are same? */
if (ELEM(NULL, euf->fcurves[0], euf->fcurves[1], euf->fcurves[2])) {
@@ -1886,7 +1886,7 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
(euf->fcurves[1] == NULL) ? "Y" : "",
(euf->fcurves[2] == NULL) ? "Z" : "",
euf->id->name, euf->rna_path);
-
+
/* keep track of number of failed sets, and carry on to next group */
failed++;
continue;
@@ -1898,21 +1898,21 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
FCurve *fcu = euf->fcurves[f];
BezTriple *bezt, *prev;
unsigned int i;
-
+
/* skip if not enough vets to do a decent analysis of... */
if (fcu->totvert <= 2)
continue;
-
+
/* prev follows bezt, bezt = "current" point to be fixed */
/* our method depends on determining a "difference" from the previous vert */
for (i = 1, prev = fcu->bezt, bezt = fcu->bezt + 1; i < fcu->totvert; i++, prev = bezt++) {
const float sign = (prev->vec[1][1] > bezt->vec[1][1]) ? 1.0f : -1.0f;
-
+
/* > 180 degree flip? */
if ((sign * (prev->vec[1][1] - bezt->vec[1][1])) >= (float)M_PI) {
/* 360 degrees to add/subtract frame value until difference is acceptably small that there's no more flip */
const float fac = sign * 2.0f * (float)M_PI;
-
+
while ((sign * (prev->vec[1][1] - bezt->vec[1][1])) >= (float)M_PI) {
bezt->vec[0][1] += fac;
bezt->vec[1][1] += fac;
@@ -1923,13 +1923,13 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
}
}
BLI_freelistN(&eulers);
-
+
ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
/* updates + finishing warnings */
if (failed == groups) {
- BKE_report(op->reports, RPT_ERROR,
+ BKE_report(op->reports, RPT_ERROR,
"No Euler Rotations could be corrected, ensure each rotation has keys for all components, "
"and that F-Curves for these are in consecutive XYZ order and selected");
return OPERATOR_CANCELLED;
@@ -1941,15 +1941,15 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
"ensure each rotation has keys for all components, and that F-Curves for these are in "
"consecutive XYZ order and selected");
}
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
/* done at last */
return OPERATOR_FINISHED;
}
}
-
+
void GRAPH_OT_euler_filter(wmOperatorType *ot)
{
/* identifiers */
@@ -1958,11 +1958,11 @@ void GRAPH_OT_euler_filter(wmOperatorType *ot)
ot->description = "Fix large jumps and flips in the selected "
"Euler Rotation F-Curves arising from rotation "
"values being clipped when baking physics";
-
+
/* api callbacks */
ot->exec = graphkeys_euler_filter_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1986,18 +1986,18 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
bAnimListElem *ale;
int filter;
KeyframeEditData ked;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* init edit data */
memset(&ked, 0, sizeof(KeyframeEditData));
-
+
/* loop over action data, averaging values */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
short mapping_flag = ANIM_get_normalization_flags(&ac);
@@ -2008,9 +2008,9 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
memset(&current_ked, 0, sizeof(current_ked));
if (adt) {
- ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
ANIM_fcurve_keyframes_loop(&current_ked, ale->key_data, NULL, bezt_calc_average, NULL);
- ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
}
else
ANIM_fcurve_keyframes_loop(&current_ked, ale->key_data, NULL, bezt_calc_average, NULL);
@@ -2020,14 +2020,14 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
ked.f2 += (current_ked.f2 + offset) * unit_scale;
ked.i2 += current_ked.i2;
}
-
+
ANIM_animdata_freelist(&anim_data);
-
+
/* set the new current frame and cursor values, based on the average time and value */
if (ked.i1) {
SpaceIpo *sipo = (SpaceIpo *)ac.sl;
Scene *scene = ac.scene;
-
+
/* take the average values, rounding to the nearest int as necessary for int results */
if (sipo->mode == SIPO_MODE_DRIVERS) {
/* Drivers Mode - Affects cursor (float) */
@@ -2041,10 +2041,10 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
sipo->cursorVal = ked.f2 / (float)ked.i1;
}
}
-
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, ac.scene);
-
+
return OPERATOR_FINISHED;
}
@@ -2054,11 +2054,11 @@ void GRAPH_OT_frame_jump(wmOperatorType *ot)
ot->name = "Jump to Keyframes";
ot->idname = "GRAPH_OT_frame_jump";
ot->description = "Place the cursor on the midpoint of selected keyframes";
-
+
/* api callbacks */
ot->exec = graphkeys_framejump_exec;
ot->poll = graphkeys_framejump_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -2083,23 +2083,23 @@ static const EnumPropertyItem prop_graphkeys_snap_types[] = {
};
/* this function is responsible for snapping keyframes to frame-times */
-static void snap_graph_keys(bAnimContext *ac, short mode)
+static void snap_graph_keys(bAnimContext *ac, short mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc edit_cb;
float cursor_value = 0.0f;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* init custom data for iterating over keyframes */
- memset(&ked, 0, sizeof(KeyframeEditData));
+ memset(&ked, 0, sizeof(KeyframeEditData));
ked.scene = ac->scene;
if (mode == GRAPHKEYS_SNAP_NEAREST_MARKER) {
ked.list.first = (ac->markers) ? ac->markers->first : NULL;
@@ -2117,32 +2117,32 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
mode = SNAP_KEYS_TIME;
}
}
-
+
/* get beztriple editing callbacks */
edit_cb = ANIM_editkeyframes_snap(mode);
-
+
/* snap keyframes */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
+
/* normalise cursor value (for normalised F-Curves display) */
if (mode == GRAPHKEYS_SNAP_VALUE) {
short mapping_flag = ANIM_get_normalization_flags(ac);
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, ale->key_data, mapping_flag, &offset);
-
+
ked.f1 = (cursor_value / unit_scale) - offset;
}
-
+
/* perform snapping */
if (adt) {
- ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
}
- else
+ else
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
-
+
ale->update |= ANIM_UPDATE_DEFAULT;
}
@@ -2156,38 +2156,38 @@ static int graphkeys_snap_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short mode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get snapping mode */
mode = RNA_enum_get(op->ptr, "type");
-
+
/* snap keyframes */
snap_graph_keys(&ac, mode);
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_snap(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Snap Keys";
ot->idname = "GRAPH_OT_snap";
ot->description = "Snap selected keyframes to the chosen times/values";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = graphkeys_snap_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_snap_types, 0, "Type", "");
}
@@ -2210,28 +2210,28 @@ static const EnumPropertyItem prop_graphkeys_mirror_types[] = {
};
/* this function is responsible for mirroring keyframes */
-static void mirror_graph_keys(bAnimContext *ac, short mode)
+static void mirror_graph_keys(bAnimContext *ac, short mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc edit_cb;
float cursor_value = 0.0f;
/* init custom data for looping over keyframes */
- memset(&ked, 0, sizeof(KeyframeEditData));
+ memset(&ked, 0, sizeof(KeyframeEditData));
ked.scene = ac->scene;
-
+
/* store mode-specific custom data... */
if (mode == GRAPHKEYS_MIRROR_MARKER) {
TimeMarker *marker = NULL;
-
+
/* find first selected marker */
marker = ED_markers_get_first_selected(ac->markers);
-
+
/* store marker's time (if available) */
if (marker)
ked.f1 = (float)marker->frame;
@@ -2250,36 +2250,36 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
mode = MIRROR_KEYS_TIME;
}
}
-
+
/* get beztriple editing callbacks */
edit_cb = ANIM_editkeyframes_mirror(mode);
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* mirror keyframes */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
+
/* apply unit corrections */
if (mode == GRAPHKEYS_MIRROR_VALUE) {
short mapping_flag = ANIM_get_normalization_flags(ac);
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, ale->key_data, mapping_flag | ANIM_UNITCONV_ONLYKEYS, &offset);
-
+
ked.f1 = (cursor_value + offset) * unit_scale;
}
-
+
/* perform actual mirroring */
if (adt) {
- ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
}
- else
+ else
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
-
+
ale->update |= ANIM_UPDATE_DEFAULT;
}
@@ -2293,38 +2293,38 @@ static int graphkeys_mirror_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short mode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get mirroring mode */
mode = RNA_enum_get(op->ptr, "type");
-
+
/* mirror keyframes */
mirror_graph_keys(&ac, mode);
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_mirror(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mirror Keys";
ot->idname = "GRAPH_OT_mirror";
ot->description = "Flip selected keyframes over the selected mirror line";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = graphkeys_mirror_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_mirror_types, 0, "Type", "");
}
@@ -2337,15 +2337,15 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* smooth keyframes */
for (ale = anim_data.first; ale; ale = ale->next) {
/* For now, we can only smooth by flattening handles AND smoothing curve values.
@@ -2359,24 +2359,24 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_smooth(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Smooth Keys";
ot->idname = "GRAPH_OT_smooth";
ot->description = "Apply weighted moving means to make selected F-Curves less bumpy";
-
+
/* api callbacks */
ot->exec = graphkeys_smooth_exec;
ot->poll = graphop_editable_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -2391,29 +2391,29 @@ static const EnumPropertyItem *graph_fmodifier_itemf(bContext *C, PointerRNA *UN
EnumPropertyItem *item = NULL;
int totitem = 0;
int i = 0;
-
+
if (C == NULL) {
return rna_enum_fmodifier_type_items;
}
-
+
/* start from 1 to skip the 'Invalid' modifier type */
for (i = 1; i < FMODIFIER_NUM_TYPES; i++) {
const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(i);
int index;
-
+
/* check if modifier is valid for this context */
if (fmi == NULL)
continue;
-
+
index = RNA_enum_from_value(rna_enum_fmodifier_type_items, fmi->type);
if (index != -1) { /* Not all types are implemented yet... */
RNA_enum_item_add(&item, &totitem, &rna_enum_fmodifier_type_items[index]);
}
}
-
+
RNA_enum_item_end(&item, &totitem);
*r_free = true;
-
+
return item;
}
@@ -2424,14 +2424,14 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
bAnimListElem *ale;
int filter;
short type;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get type of modifier to add */
type = RNA_enum_get(op->ptr, "type");
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
if (RNA_boolean_get(op->ptr, "only_active"))
@@ -2439,12 +2439,12 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
else
filter |= (ANIMFILTER_SEL | ANIMFILTER_CURVE_VISIBLE);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* add f-modifier to each curve */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->data;
FModifier *fcm;
-
+
/* add F-Modifier of specified type to active F-Curve, and make it the active one */
fcm = add_fmodifier(&fcu->modifiers, type, fcu);
if (fcm) {
@@ -2454,41 +2454,41 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Modifier could not be added (see console for details)");
break;
}
-
+
ale->update |= ANIM_UPDATE_DEPS;
}
-
+
ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
-
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_fmodifier_add(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Add F-Curve Modifier";
ot->idname = "GRAPH_OT_fmodifier_add";
ot->description = "Add F-Modifier to the active/selected F-Curves";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = graph_fmodifier_add_exec;
- ot->poll = graphop_selected_fcurve_poll;
-
+ ot->poll = graphop_selected_fcurve_poll;
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
prop = RNA_def_enum(ot->srna, "type", rna_enum_fmodifier_type_items, 0, "Type", "");
RNA_def_enum_funcs(prop, graph_fmodifier_itemf);
ot->prop = prop;
-
+
RNA_def_boolean(ot->srna, "only_active", 1, "Only Active", "Only add F-Modifier to active F-Curve");
}
@@ -2499,28 +2499,28 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
bAnimContext ac;
bAnimListElem *ale;
bool ok = false;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* clear buffer first */
ANIM_fmodifiers_copybuf_free();
-
+
/* get the active F-Curve */
ale = get_active_fcurve_channel(&ac);
-
+
/* if this exists, call the copy F-Modifiers API function */
if (ale && ale->data) {
FCurve *fcu = (FCurve *)ale->data;
-
+
/* TODO: when 'active' vs 'all' boolean is added, change last param! */
ok = ANIM_fmodifiers_copy_to_buf(&fcu->modifiers, 0);
-
+
/* free temp data now */
MEM_freeN(ale);
}
-
+
/* successful or not? */
if (ok == 0) {
BKE_report(op->reports, RPT_ERROR, "No F-Modifiers available to be copied");
@@ -2529,21 +2529,21 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
else
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_fmodifier_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy F-Modifiers";
ot->idname = "GRAPH_OT_fmodifier_copy";
ot->description = "Copy the F-Modifier(s) of the active F-Curve";
-
+
/* api callbacks */
ot->exec = graph_fmodifier_copy_exec;
- ot->poll = graphop_active_fcurve_poll;
-
+ ot->poll = graphop_active_fcurve_poll;
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
//ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All F-Modifiers", "Copy all the F-Modifiers, instead of just the active one");
}
@@ -2553,18 +2553,18 @@ void GRAPH_OT_fmodifier_copy(wmOperatorType *ot)
static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
-
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
const bool replace = RNA_boolean_get(op->ptr, "replace");
bool ok = false;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* filter data */
if (RNA_boolean_get(op->ptr, "only_active")) {
/* This should be the default (for buttons) - Just paste to the active FCurve */
@@ -2574,32 +2574,32 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
/* This is only if the operator gets called from a hotkey or search - Paste to all visible curves */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
}
-
+
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* paste modifiers */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->data;
int tot;
-
+
tot = ANIM_fmodifiers_paste_from_buf(&fcu->modifiers, replace, fcu);
-
+
if (tot) {
ale->update |= ANIM_UPDATE_DEPS;
ok = true;
}
}
-
+
if (ok) {
ANIM_animdata_update(&ac, &anim_data);
}
ANIM_animdata_freelist(&anim_data);
-
+
/* successful or not? */
if (ok) {
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
else {
@@ -2607,24 +2607,24 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
}
-
+
void GRAPH_OT_fmodifier_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste F-Modifiers";
ot->idname = "GRAPH_OT_fmodifier_paste";
ot->description = "Add copied F-Modifiers to the selected F-Curves";
-
+
/* api callbacks */
ot->exec = graph_fmodifier_paste_exec;
ot->poll = graphop_active_fcurve_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
RNA_def_boolean(ot->srna, "only_active", true, "Only Active", "Only paste F-Modifiers on active F-Curve");
- RNA_def_boolean(ot->srna, "replace", false, "Replace Existing",
+ RNA_def_boolean(ot->srna, "replace", false, "Replace Existing",
"Replace existing F-Modifiers, instead of just appending to the end of the existing list");
}
@@ -2638,45 +2638,45 @@ static int graph_driver_vars_copy_exec(bContext *C, wmOperator *op)
bAnimContext ac;
bAnimListElem *ale;
bool ok = false;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* clear buffer first */
ANIM_driver_vars_copybuf_free();
-
+
/* get the active F-Curve */
ale = get_active_fcurve_channel(&ac);
-
+
/* if this exists, call the copy driver vars API function */
if (ale && ale->data) {
FCurve *fcu = (FCurve *)ale->data;
-
+
ok = ANIM_driver_vars_copy(op->reports, fcu);
-
+
/* free temp data now */
MEM_freeN(ale);
}
-
+
/* successful or not? */
if (ok)
return OPERATOR_FINISHED;
else
return OPERATOR_CANCELLED;
}
-
+
void GRAPH_OT_driver_variables_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Driver Variables";
ot->idname = "GRAPH_OT_driver_variables_copy";
ot->description = "Copy the driver variables of the active F-Curve";
-
+
/* api callbacks */
ot->exec = graph_driver_vars_copy_exec;
- ot->poll = graphop_active_fcurve_poll;
-
+ ot->poll = graphop_active_fcurve_poll;
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -2686,62 +2686,62 @@ void GRAPH_OT_driver_variables_copy(wmOperatorType *ot)
static int graph_driver_vars_paste_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
-
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
const bool replace = RNA_boolean_get(op->ptr, "replace");
bool ok = false;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* paste variables */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->data;
ok |= ANIM_driver_vars_paste(op->reports, fcu, replace);
}
-
+
/* cleanup */
ANIM_animdata_freelist(&anim_data);
-
+
/* successful or not? */
if (ok) {
/* rebuild depsgraph, now that there are extra deps here */
DAG_relations_tag_update(CTX_data_main(C));
-
+
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, CTX_data_scene(C));
-
+
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
-
+
void GRAPH_OT_driver_variables_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste Driver Variables";
ot->idname = "GRAPH_OT_driver_variables_paste";
ot->description = "Add copied driver variables to the active driver";
-
+
/* api callbacks */
ot->exec = graph_driver_vars_paste_exec;
ot->poll = graphop_active_fcurve_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
- RNA_def_boolean(ot->srna, "replace", false, "Replace Existing",
+ RNA_def_boolean(ot->srna, "replace", false, "Replace Existing",
"Replace existing driver variables, instead of just appending to the end of the existing list");
}
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index d0241f09f04..da352d4ea06 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -87,7 +87,7 @@ enum eGraphKeys_ColumnSelect_Mode {
/* ***************************************** */
/* graph_edit.c */
-void get_graph_keyframe_extents(struct bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax,
+void get_graph_keyframe_extents(struct bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax,
const bool do_selected, const bool include_handles);
void GRAPH_OT_previewrange_set(struct wmOperatorType *ot);
@@ -119,7 +119,7 @@ void GRAPH_OT_frame_jump(struct wmOperatorType *ot);
void GRAPH_OT_snap(struct wmOperatorType *ot);
void GRAPH_OT_mirror(struct wmOperatorType *ot);
-/* defines for snap keyframes
+/* defines for snap keyframes
* NOTE: keep in sync with eEditKeyframes_Snap (in ED_keyframes_edit.h)
*/
enum eGraphKeys_Snap_Mode {
@@ -131,7 +131,7 @@ enum eGraphKeys_Snap_Mode {
GRAPHKEYS_SNAP_VALUE,
};
-/* defines for mirror keyframes
+/* defines for mirror keyframes
* NOTE: keep in sync with eEditKeyframes_Mirror (in ED_keyframes_edit.h)
*/
enum eGraphKeys_Mirror_Mode {
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 48d4e9ff8eb..b90fdd9ac67 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -83,19 +83,19 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
SpaceIpo *sipo = CTX_wm_space_graph(C);
float frame = RNA_float_get(op->ptr, "frame"); /* this isn't technically "frame", but it'll do... */
-
+
/* adjust the frame or the cursor x-value */
if (sipo->mode == SIPO_MODE_DRIVERS) {
/* adjust cursor x-value */
sipo->cursorTime = frame;
}
else {
- /* adjust the frame
+ /* adjust the frame
* NOTE: sync this part of the code with ANIM_OT_change_frame
*/
/* 1) frame is rounded to the nearest int, since frames are ints */
CFRA = round_fl_to_int(frame);
-
+
if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) {
/* Clip to preview range
* NOTE: Preview range won't go into negative values,
@@ -107,14 +107,14 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op)
/* Prevent negative frames */
FRAMENUMBER_MIN_CLAMP(CFRA);
}
-
+
SUBFRA = 0.0f;
BKE_sound_seek_scene(bmain, scene);
}
-
+
/* set the cursor value */
sipo->cursorVal = RNA_float_get(op->ptr, "value");
-
+
/* send notifiers - notifiers for frame should force an update for both vars ok... */
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
}
@@ -135,14 +135,14 @@ static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent
{
ARegion *ar = CTX_wm_region(C);
float viewx, viewy;
-
+
/* abort if not active region (should not really be possible) */
if (ar == NULL)
return;
-
+
/* convert from region coordinates to View2D 'tot' space */
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
-
+
/* store the values in the operator properties */
/* NOTE: we don't clamp frame here, as it might be used for the drivers cursor */
RNA_float_set(op->ptr, "frame", viewx);
@@ -153,18 +153,18 @@ static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent
static int graphview_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
bScreen *screen = CTX_wm_screen(C);
-
+
/* Change to frame that mouse is over before adding modal handler,
* as user could click on a single frame (jump to frame) as well as
* click-dragging over a range (modal scrubbing). Apply this change.
*/
graphview_cursor_setprops(C, op, event);
graphview_cursor_apply(C, op);
-
+
/* Signal that a scrubbing operating is starting */
if (screen)
screen->scrubbing = true;
-
+
/* add temp handler */
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -175,32 +175,32 @@ static int graphview_cursor_modal(bContext *C, wmOperator *op, const wmEvent *ev
{
bScreen *screen = CTX_wm_screen(C);
Scene *scene = CTX_data_scene(C);
-
+
/* execute the events */
switch (event->type) {
case ESCKEY:
if (screen)
screen->scrubbing = false;
-
+
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
return OPERATOR_FINISHED;
-
+
case MOUSEMOVE:
/* set the new values */
graphview_cursor_setprops(C, op, event);
graphview_cursor_apply(C, op);
break;
-
- case LEFTMOUSE:
+
+ case LEFTMOUSE:
case RIGHTMOUSE:
case MIDDLEMOUSE:
- /* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init
+ /* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init
* the modal op) doesn't work for some reason
*/
if (event->val == KM_RELEASE) {
if (screen)
screen->scrubbing = false;
-
+
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
return OPERATOR_FINISHED;
}
@@ -216,13 +216,13 @@ static void GRAPH_OT_cursor_set(wmOperatorType *ot)
ot->name = "Set Cursor";
ot->idname = "GRAPH_OT_cursor_set";
ot->description = "Interactively set the current frame and value cursor";
-
+
/* api callbacks */
ot->exec = graphview_cursor_exec;
ot->invoke = graphview_cursor_invoke;
ot->modal = graphview_cursor_modal;
ot->poll = graphview_cursor_poll;
-
+
/* flags */
ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;
@@ -241,39 +241,39 @@ static int graphview_curves_hide_exec(bContext *C, wmOperator *op)
bAnimListElem *ale;
int filter;
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
- /* get list of all channels that selection may need to be flushed to
+
+ /* get list of all channels that selection may need to be flushed to
* - hierarchy must not affect what we have access to here...
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype);
-
+
/* filter data
- * - of the remaining visible curves, we want to hide the ones that are
- * selected/unselected (depending on "unselected" prop)
+ * - of the remaining visible curves, we want to hide the ones that are
+ * selected/unselected (depending on "unselected" prop)
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
if (unselected)
filter |= ANIMFILTER_UNSEL;
else
filter |= ANIMFILTER_SEL;
-
+
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
-
+
/* change the hide setting, and unselect it... */
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_CLEAR);
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_SELECT, ACHANNEL_SETFLAG_CLEAR);
-
+
/* now, also flush selection status up/down as appropriate */
ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_CLEAR);
}
@@ -281,7 +281,7 @@ static int graphview_curves_hide_exec(bContext *C, wmOperator *op)
/* cleanup */
ANIM_animdata_freelist(&anim_data);
BLI_freelistN(&all_data);
-
+
/* unhide selected */
if (unselected) {
/* turn off requirement for visible */
@@ -295,21 +295,21 @@ static int graphview_curves_hide_exec(bContext *C, wmOperator *op)
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
-
+
/* change the hide setting, and unselect it... */
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_SELECT, ACHANNEL_SETFLAG_ADD);
-
+
/* now, also flush selection status up/down as appropriate */
ANIM_flush_setting_anim_channels(&ac, &anim_data, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
}
- ANIM_animdata_freelist(&anim_data);
+ ANIM_animdata_freelist(&anim_data);
}
-
-
+
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -319,14 +319,14 @@ static void GRAPH_OT_hide(wmOperatorType *ot)
ot->name = "Hide Curves";
ot->idname = "GRAPH_OT_hide";
ot->description = "Hide selected curves from Graph Editor view";
-
+
/* api callbacks */
ot->exec = graphview_curves_hide_exec;
ot->poll = ED_operator_graphedit_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected curves");
}
@@ -341,50 +341,50 @@ static int graphview_curves_reveal_exec(bContext *C, wmOperator *op)
bAnimListElem *ale;
int filter;
const bool select = RNA_boolean_get(op->ptr, "select");
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
- /* get list of all channels that selection may need to be flushed to
+
+ /* get list of all channels that selection may need to be flushed to
* - hierarchy must not affect what we have access to here...
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype);
-
+
/* filter data
* - just go through all visible channels, ensuring that everything is set to be curve-visible
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
-
+
/* select if it is not visible */
if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE) == 0) {
ANIM_channel_setting_set(
&ac, ale, ACHANNEL_SETTING_SELECT,
select ? ACHANNEL_SETFLAG_ADD : ACHANNEL_SETFLAG_CLEAR);
}
-
+
/* change the visibility setting */
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
-
+
/* now, also flush selection status up/down as appropriate */
ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, true);
}
-
+
/* cleanup */
ANIM_animdata_freelist(&anim_data);
BLI_freelistN(&all_data);
-
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -394,11 +394,11 @@ static void GRAPH_OT_reveal(wmOperatorType *ot)
ot->name = "Reveal Curves";
ot->idname = "GRAPH_OT_reveal";
ot->description = "Make previously hidden curves visible again in Graph Editor view";
-
+
/* api callbacks */
ot->exec = graphview_curves_reveal_exec;
ot->poll = ED_operator_graphedit_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -411,19 +411,19 @@ void graphedit_operatortypes(void)
{
/* view */
WM_operatortype_append(GRAPH_OT_cursor_set);
-
+
WM_operatortype_append(GRAPH_OT_previewrange_set);
WM_operatortype_append(GRAPH_OT_view_all);
WM_operatortype_append(GRAPH_OT_view_selected);
WM_operatortype_append(GRAPH_OT_properties);
WM_operatortype_append(GRAPH_OT_view_frame);
-
+
WM_operatortype_append(GRAPH_OT_ghost_curves_create);
WM_operatortype_append(GRAPH_OT_ghost_curves_clear);
-
+
WM_operatortype_append(GRAPH_OT_hide);
WM_operatortype_append(GRAPH_OT_reveal);
-
+
/* keyframes */
/* selection */
WM_operatortype_append(GRAPH_OT_clickselect);
@@ -436,7 +436,7 @@ void graphedit_operatortypes(void)
WM_operatortype_append(GRAPH_OT_select_more);
WM_operatortype_append(GRAPH_OT_select_less);
WM_operatortype_append(GRAPH_OT_select_leftright);
-
+
/* editing */
WM_operatortype_append(GRAPH_OT_snap);
WM_operatortype_append(GRAPH_OT_mirror);
@@ -453,18 +453,18 @@ void graphedit_operatortypes(void)
WM_operatortype_append(GRAPH_OT_euler_filter);
WM_operatortype_append(GRAPH_OT_delete);
WM_operatortype_append(GRAPH_OT_duplicate);
-
+
WM_operatortype_append(GRAPH_OT_copy);
WM_operatortype_append(GRAPH_OT_paste);
-
+
WM_operatortype_append(GRAPH_OT_keyframe_insert);
WM_operatortype_append(GRAPH_OT_click_insert);
-
+
/* F-Curve Modifiers */
WM_operatortype_append(GRAPH_OT_fmodifier_add);
WM_operatortype_append(GRAPH_OT_fmodifier_copy);
WM_operatortype_append(GRAPH_OT_fmodifier_paste);
-
+
/* Drivers */
WM_operatortype_append(GRAPH_OT_driver_variables_copy);
WM_operatortype_append(GRAPH_OT_driver_variables_paste);
@@ -475,7 +475,7 @@ void ED_operatormacros_graph(void)
{
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
-
+
ot = WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate",
"Make a copy of all selected keyframes and move them",
OPTYPE_UNDO | OPTYPE_REGISTER);
@@ -491,7 +491,7 @@ void ED_operatormacros_graph(void)
static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
{
wmKeyMapItem *kmi;
-
+
/* view */
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.show_handles");
@@ -500,8 +500,8 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
* This keymap is supposed to override ANIM_OT_change_frame, which does the same except it doesn't do y-values
*/
WM_keymap_add_item(keymap, "GRAPH_OT_cursor_set", ACTIONMOUSE, KM_PRESS, 0, 0);
-
-
+
+
/* graph_select.c - selection tools */
/* click-select: keyframe (replace) */
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
@@ -533,7 +533,7 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
RNA_boolean_set(kmi->ptr, "extend", true);
RNA_boolean_set(kmi->ptr, "curves", true);
RNA_boolean_set(kmi->ptr, "column", false);
-
+
/* click-select left/right */
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", false);
@@ -541,20 +541,20 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", true);
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_TEST);
-
+
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", false);
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_LEFT);
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", false);
RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
-
+
/* deselect all */
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "invert", false);
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "invert", true);
-
+
/* borderselect */
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "axis_range", false);
@@ -562,68 +562,68 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "axis_range", true);
RNA_boolean_set(kmi->ptr, "include_handles", false);
-
+
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "axis_range", false);
RNA_boolean_set(kmi->ptr, "include_handles", true);
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "axis_range", true);
RNA_boolean_set(kmi->ptr, "include_handles", true);
-
+
/* region select */
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "deselect", false);
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "deselect", true);
-
+
WM_keymap_add_item(keymap, "GRAPH_OT_select_circle", CKEY, KM_PRESS, 0, 0);
-
+
/* column select */
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_select_column", KKEY, KM_PRESS, 0, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_KEYS);
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_select_column", KKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_CFRA);
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_select_column", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN);
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPH_OT_select_column", KKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN);
-
+
/* select more/less */
WM_keymap_add_item(keymap, "GRAPH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
-
+
/* select linked */
WM_keymap_add_item(keymap, "GRAPH_OT_select_linked", LKEY, KM_PRESS, 0, 0);
-
-
+
+
/* graph_edit.c */
/* jump to selected keyframes */
WM_keymap_add_item(keymap, "GRAPH_OT_frame_jump", GKEY, KM_PRESS, KM_CTRL, 0);
-
+
/* menu + single-step transform */
WM_keymap_add_item(keymap, "GRAPH_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_mirror", MKEY, KM_PRESS, KM_SHIFT, 0);
-
+
WM_keymap_add_item(keymap, "GRAPH_OT_handle_type", VKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_interpolation_type", TKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_easing_type", EKEY, KM_PRESS, KM_CTRL, 0);
-
+
/* destructive */
WM_keymap_add_item(keymap, "GRAPH_OT_smooth", OKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_sample", OKEY, KM_PRESS, KM_SHIFT, 0);
-
+
WM_keymap_add_item(keymap, "GRAPH_OT_bake", CKEY, KM_PRESS, KM_ALT, 0);
-
+
WM_keymap_add_menu(keymap, "GRAPH_MT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "GRAPH_MT_delete", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
-
+
/* insertkey */
WM_keymap_add_item(keymap, "GRAPH_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0);
-
+
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", false);
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", ACTIONMOUSE, KM_CLICK, KM_CTRL | KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", true);
-
+
/* copy/paste */
WM_keymap_add_item(keymap, "GRAPH_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
@@ -648,16 +648,16 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
/* F-Modifiers */
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "only_active", false);
-
+
/* animation module */
/* channels list
* NOTE: these operators were originally for the channels list, but are added here too for convenience...
*/
WM_keymap_add_item(keymap, "ANIM_OT_channels_editable_toggle", TABKEY, KM_PRESS, 0, 0);
-
+
/* transform system */
transform_keymap_for_space(keyconf, keymap, SPACE_IPO);
-
+
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_proportional_fcurve");
@@ -665,15 +665,15 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
RNA_string_set(kmi->ptr, "value", "BOUNDING_BOX_CENTER");
-
+
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
RNA_string_set(kmi->ptr, "value", "CURSOR");
-
+
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_CTRL, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
RNA_string_set(kmi->ptr, "value", "INDIVIDUAL_ORIGINS");
-
+
/* special markers hotkeys for anim editors: see note in definition of this function */
ED_marker_keymap_animedit_conflictfree(keymap);
}
@@ -684,33 +684,33 @@ void graphedit_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
wmKeyMapItem *kmi;
-
+
/* keymap for all regions */
keymap = WM_keymap_find(keyconf, "Graph Editor Generic", SPACE_IPO, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_properties", NKEY, KM_PRESS, 0, 0);
-
+
/* extrapolation works on channels, not keys */
WM_keymap_add_item(keymap, "GRAPH_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
-
+
/* find (i.e. a shortcut for setting the name filter) */
WM_keymap_add_item(keymap, "ANIM_OT_channels_find", FKEY, KM_PRESS, KM_CTRL, 0);
-
+
/* hide/reveal selected curves */
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_hide", HKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "unselected", false);
-
+
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "unselected", true);
-
+
WM_keymap_add_item(keymap, "GRAPH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
-
-
+
+
/* channels */
- /* Channels are not directly handled by the Graph Editor module, but are inherited from the Animation module.
+ /* Channels are not directly handled by the Graph Editor module, but are inherited from the Animation module.
* All the relevant operations, keymaps, drawing, etc. can therefore all be found in that module instead, as these
* are all used for the Graph Editor too.
*/
-
+
/* keyframes */
keymap = WM_keymap_find(keyconf, "Graph Editor", SPACE_IPO, 0);
graphedit_keymap_keyframes(keyconf, keymap);
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 98cd847b427..ed9bed19d20 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -88,20 +88,20 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
KeyframeEditData ked = {{NULL}};
KeyframeEditFunc test_cb, sel_cb;
-
+
/* determine type-based settings */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
-
+
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* init BezTriple looping data */
test_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
-
+
/* See if we should be selecting or deselecting */
if (test) {
for (ale = anim_data.first; ale; ale = ale->next) {
@@ -111,17 +111,17 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
}
}
}
-
+
/* convert sel to selectmode, and use that to get editor */
sel_cb = ANIM_editkeyframes_select(sel);
-
+
/* Now set the flags */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
-
+
/* Keyframes First */
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, sel_cb, NULL);
-
+
/* affect channel selection status? */
if (do_channels) {
/* only change selection of channel when the visibility of keyframes doesn't depend on this */
@@ -129,17 +129,17 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
/* deactivate the F-Curve, and deselect if deselecting keyframes.
* otherwise select the F-Curve too since we've selected all the keyframes
*/
- if (sel == SELECT_SUBTRACT)
+ if (sel == SELECT_SUBTRACT)
fcu->flag &= ~FCURVE_SELECTED;
else
fcu->flag |= FCURVE_SELECTED;
}
-
+
/* always deactivate all F-Curves if we perform batch ops for selection */
fcu->flag &= ~FCURVE_ACTIVE;
}
}
-
+
/* Cleanup */
ANIM_animdata_freelist(&anim_data);
}
@@ -150,56 +150,56 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
bAnimListElem *ale_active = NULL;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
- /* find active F-Curve, and preserve this for later
+
+ /* find active F-Curve, and preserve this for later
* or else it becomes annoying with the current active
* curve keeps fading out even while you're editing it
*/
ale_active = get_active_fcurve_channel(&ac);
-
+
/* 'standard' behavior - check if selected, then apply relevant selection */
if (RNA_boolean_get(op->ptr, "invert"))
deselect_graph_keys(&ac, 0, SELECT_INVERT, true);
else
deselect_graph_keys(&ac, 1, SELECT_ADD, true);
-
+
/* restore active F-Curve... */
if (ale_active) {
FCurve *fcu = (FCurve *)ale_active->data;
-
- /* all others should not be disabled, so we should be able to just set this directly...
+
+ /* all others should not be disabled, so we should be able to just set this directly...
* - selection needs to be set too, or else this won't work...
*/
fcu->flag |= (FCURVE_SELECTED | FCURVE_ACTIVE);
-
+
MEM_freeN(ale_active);
ale_active = NULL;
}
-
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
ot->idname = "GRAPH_OT_select_all_toggle";
ot->description = "Toggle selection of all keyframes";
-
+
/* api callbacks */
ot->exec = graphkeys_deselectall_exec;
ot->poll = graphop_visible_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
}
@@ -226,24 +226,24 @@ static void borderselect_graphkeys(
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter, mapping_flag;
-
+
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc ok_cb, select_cb;
View2D *v2d = &ac->ar->v2d;
rctf rectf, scaled_rectf;
-
+
/* convert mouse coordinates to frame ranges and channel coordinates corrected for view pan/zoom */
UI_view2d_region_to_view_rctf(v2d, rectf_view, &rectf);
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* get beztriple editing/validation funcs */
select_cb = ANIM_editkeyframes_select(selectmode);
ok_cb = ANIM_editkeyframes_ok(mode);
-
+
/* init editing data */
memset(&ked, 0, sizeof(KeyframeEditData));
if (mode == BEZT_OK_REGION_LASSO) {
@@ -259,7 +259,7 @@ static void borderselect_graphkeys(
else {
ked.data = &scaled_rectf;
}
-
+
/* treat handles separately? */
if (incl_handles) {
ked.iterflags |= KEYFRAME_ITER_INCL_HANDLES;
@@ -267,29 +267,29 @@ static void borderselect_graphkeys(
}
else
mapping_flag = ANIM_UNITCONV_ONLYKEYS;
-
+
mapping_flag |= ANIM_get_normalization_flags(ac);
-
+
/* loop over data, doing border select */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag, &offset);
-
+
/* apply NLA mapping to all the keyframes, since it's easier than trying to
* guess when a callback might use something different
*/
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, incl_handles == 0);
-
+
scaled_rectf.xmin = rectf.xmin;
scaled_rectf.xmax = rectf.xmax;
scaled_rectf.ymin = rectf.ymin / unit_scale - offset;
scaled_rectf.ymax = rectf.ymax / unit_scale - offset;
-
- /* set horizontal range (if applicable)
- * NOTE: these values are only used for x-range and y-range but not region
+
+ /* set horizontal range (if applicable)
+ * NOTE: these values are only used for x-range and y-range but not region
* (which uses ked.data, i.e. rectf)
*/
if (mode != BEZT_OK_VALUERANGE) {
@@ -300,12 +300,12 @@ static void borderselect_graphkeys(
ked.f1 = rectf.ymin;
ked.f2 = rectf.ymax;
}
-
+
/* firstly, check if any keyframes will be hit by this */
if (ANIM_fcurve_keyframes_loop(&ked, fcu, NULL, ok_cb, NULL)) {
/* select keyframes that are in the appropriate places */
ANIM_fcurve_keyframes_loop(&ked, fcu, ok_cb, select_cb, NULL);
-
+
/* only change selection of channel when the visibility of keyframes doesn't depend on this */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
/* select the curve too now that curve will be touched */
@@ -313,12 +313,12 @@ static void borderselect_graphkeys(
fcu->flag |= FCURVE_SELECTED;
}
}
-
+
/* un-apply NLA mapping from all the keyframes */
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, incl_handles == 0);
}
-
+
/* cleanup */
ANIM_animdata_freelist(&anim_data);
}
@@ -334,7 +334,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
bool incl_handles;
const bool select = !RNA_boolean_get(op->ptr, "deselect");
const bool extend = RNA_boolean_get(op->ptr, "extend");
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
@@ -344,7 +344,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
if (!extend)
deselect_graph_keys(&ac, 1, SELECT_SUBTRACT, true);
- /* get select mode
+ /* get select mode
* - 'include_handles' from the operator specifies whether to include handles in the selection
*/
if (select) {
@@ -353,15 +353,15 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
else {
selectmode = SELECT_SUBTRACT;
}
-
+
incl_handles = RNA_boolean_get(op->ptr, "include_handles");
-
+
/* get settings from operator */
WM_operator_properties_border_to_rcti(op, &rect);
-
+
/* selection 'mode' depends on whether borderselect region only matters on one axis */
if (RNA_boolean_get(op->ptr, "axis_range")) {
- /* mode depends on which axis of the range is larger to determine which axis to use
+ /* mode depends on which axis of the range is larger to determine which axis to use
* - checking this in region-space is fine, as it's fundamentally still going to be a different rect size
* - the frame-range select option is favored over the channel one (x over y), as frame-range one is often
* used for tweaking timing when "blocking", while channels is not that useful...
@@ -371,19 +371,19 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
else
mode = BEZT_OK_VALUERANGE;
}
- else
+ else
mode = BEZT_OK_REGION;
BLI_rctf_rcti_copy(&rect_fl, &rect);
/* apply borderselect action */
borderselect_graphkeys(&ac, &rect_fl, mode, selectmode, incl_handles, NULL);
-
+
/* send notifier that keyframe selection has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
-}
+}
void GRAPH_OT_select_border(wmOperatorType *ot)
{
@@ -391,21 +391,21 @@ void GRAPH_OT_select_border(wmOperatorType *ot)
ot->name = "Border Select";
ot->idname = "GRAPH_OT_select_border";
ot->description = "Select all keyframes within the specified region";
-
+
/* api callbacks */
ot->invoke = WM_gesture_border_invoke;
ot->exec = graphkeys_borderselect_exec;
ot->modal = WM_gesture_border_modal;
ot->cancel = WM_gesture_border_cancel;
-
+
ot->poll = graphop_visible_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* rna */
WM_operator_properties_gesture_border_select(ot);
-
+
ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
RNA_def_boolean(ot->srna, "include_handles", 0, "Include Handles", "Are handles tested individually against the selection criteria");
}
@@ -416,34 +416,34 @@ void GRAPH_OT_select_border(wmOperatorType *ot)
static int graphkeys_lassoselect_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
-
+
KeyframeEdit_LassoData data_lasso = {0};
rcti rect;
rctf rect_fl;
-
+
short selectmode;
bool incl_handles;
bool extend;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
data_lasso.rectf_view = &rect_fl;
data_lasso.mcords = WM_gesture_lasso_path_to_array(C, op, &data_lasso.mcords_tot);
if (data_lasso.mcords == NULL)
return OPERATOR_CANCELLED;
-
+
/* clear all selection if not extending selection */
extend = RNA_boolean_get(op->ptr, "extend");
if (!extend)
deselect_graph_keys(&ac, 1, SELECT_SUBTRACT, true);
-
+
if (!RNA_boolean_get(op->ptr, "deselect"))
selectmode = SELECT_ADD;
else
selectmode = SELECT_SUBTRACT;
-
+
{
SpaceIpo *sipo = (SpaceIpo *)ac.sl;
if (selectmode == SELECT_ADD) {
@@ -454,19 +454,19 @@ static int graphkeys_lassoselect_exec(bContext *C, wmOperator *op)
incl_handles = (sipo->flag & SIPO_NOHANDLES) == 0;
}
}
-
+
/* get settings from operator */
BLI_lasso_boundbox(&rect, data_lasso.mcords, data_lasso.mcords_tot);
BLI_rctf_rcti_copy(&rect_fl, &rect);
-
+
/* apply borderselect action */
borderselect_graphkeys(&ac, &rect_fl, BEZT_OK_REGION_LASSO, selectmode, incl_handles, &data_lasso);
-
+
MEM_freeN((void *)data_lasso.mcords);
-
+
/* send notifier that keyframe selection has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -476,17 +476,17 @@ void GRAPH_OT_select_lasso(wmOperatorType *ot)
ot->name = "Lasso Select";
ot->description = "Select keyframe points using lasso selection";
ot->idname = "GRAPH_OT_select_lasso";
-
+
/* api callbacks */
ot->invoke = WM_gesture_lasso_invoke;
ot->modal = WM_gesture_lasso_modal;
ot->exec = graphkeys_lassoselect_exec;
ot->poll = graphop_visible_keyframes_poll;
ot->cancel = WM_gesture_lasso_cancel;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
-
+
/* properties */
WM_operator_properties_gesture_lasso_select(ot);
}
@@ -499,10 +499,10 @@ static int graph_circle_select_exec(bContext *C, wmOperator *op)
const bool select = !RNA_boolean_get(op->ptr, "deselect");
const short selectmode = select ? SELECT_ADD : SELECT_SUBTRACT;
bool incl_handles = false;
-
+
KeyframeEdit_CircleData data = {0};
rctf rect_fl;
-
+
float x = RNA_int_get(op->ptr, "x");
float y = RNA_int_get(op->ptr, "y");
float radius = RNA_int_get(op->ptr, "radius");
@@ -510,17 +510,17 @@ static int graph_circle_select_exec(bContext *C, wmOperator *op)
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
data.mval[0] = x;
data.mval[1] = y;
data.radius_squared = radius * radius;
data.rectf_view = &rect_fl;
-
+
rect_fl.xmin = x - radius;
rect_fl.xmax = x + radius;
rect_fl.ymin = y - radius;
rect_fl.ymax = y + radius;
-
+
{
SpaceIpo *sipo = (SpaceIpo *)ac.sl;
if (selectmode == SELECT_ADD) {
@@ -531,13 +531,13 @@ static int graph_circle_select_exec(bContext *C, wmOperator *op)
incl_handles = (sipo->flag & SIPO_NOHANDLES) == 0;
}
}
-
+
/* apply borderselect action */
borderselect_graphkeys(&ac, &rect_fl, BEZT_OK_REGION_CIRCLE, selectmode, incl_handles, &data);
-
+
/* send notifier that keyframe selection has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -546,13 +546,13 @@ void GRAPH_OT_select_circle(wmOperatorType *ot)
ot->name = "Circle Select";
ot->description = "Select keyframe points using circle selection";
ot->idname = "GRAPH_OT_select_circle";
-
+
ot->invoke = WM_gesture_circle_invoke;
ot->modal = WM_gesture_circle_modal;
ot->exec = graph_circle_select_exec;
ot->poll = graphop_visible_keyframes_poll;
ot->cancel = WM_gesture_circle_cancel;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
@@ -577,7 +577,7 @@ static const EnumPropertyItem prop_column_select_types[] = {
{0, NULL, 0, NULL, NULL}
};
-/* ------------------- */
+/* ------------------- */
/* Selects all visible keyframes between the specified markers */
/* TODO, this is almost an _exact_ duplicate of a function of the same name in action_select.c
@@ -587,27 +587,27 @@ static void markers_selectkeys_between(bAnimContext *ac)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
KeyframeEditFunc ok_cb, select_cb;
KeyframeEditData ked = {{NULL}};
float min, max;
-
+
/* get extreme markers */
ED_markers_get_minmax(ac->markers, 1, &min, &max);
min -= 0.5f;
max += 0.5f;
-
+
/* get editing funcs + data */
ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
select_cb = ANIM_editkeyframes_select(SELECT_ADD);
ked.f1 = min;
ked.f2 = max;
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | 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);
@@ -621,7 +621,7 @@ static void markers_selectkeys_between(bAnimContext *ac)
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
}
}
-
+
/* Cleanup */
ANIM_animdata_freelist(&anim_data);
}
@@ -633,56 +633,56 @@ static void columnselect_graph_keys(bAnimContext *ac, short mode)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
Scene *scene = ac->scene;
CfraElem *ce;
KeyframeEditFunc select_cb, ok_cb;
KeyframeEditData ked;
-
+
/* initialize keyframe editing data */
memset(&ked, 0, sizeof(KeyframeEditData));
-
+
/* build list of columns */
switch (mode) {
case GRAPHKEYS_COLUMNSEL_KEYS: /* list of selected keys */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next)
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_to_cfraelem, NULL);
-
+
ANIM_animdata_freelist(&anim_data);
break;
-
+
case GRAPHKEYS_COLUMNSEL_CFRA: /* current frame */
/* make a single CfraElem for storing this */
ce = MEM_callocN(sizeof(CfraElem), "cfraElem");
BLI_addtail(&ked.list, ce);
-
+
ce->cfra = (float)CFRA;
break;
-
+
case GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN: /* list of selected markers */
ED_markers_make_cfra_list(ac->markers, &ked.list, SELECT);
break;
-
+
default: /* invalid option */
return;
}
-
+
/* set up BezTriple edit callbacks */
select_cb = ANIM_editkeyframes_select(SELECT_ADD);
ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME);
-
+
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
+
/* loop over cfraelems (stored in the KeyframeEditData->list)
* - we need to do this here, as we can apply fewer NLA-mapping conversions
*/
@@ -694,7 +694,7 @@ static void columnselect_graph_keys(bAnimContext *ac, short mode)
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
}
}
-
+
/* free elements */
BLI_freelistN(&ked.list);
ANIM_animdata_freelist(&anim_data);
@@ -706,39 +706,39 @@ static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short mode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* action to take depends on the mode */
mode = RNA_enum_get(op->ptr, "mode");
-
+
if (mode == GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN)
markers_selectkeys_between(&ac);
else
columnselect_graph_keys(&ac, mode);
-
+
/* set notifier that keyframe selection has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void GRAPH_OT_select_column(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
ot->idname = "GRAPH_OT_select_column";
ot->description = "Select all keyframes on the specified frame(s)";
-
+
/* api callbacks */
ot->exec = graphkeys_columnselect_exec;
ot->poll = graphop_visible_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
ot->prop = RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
}
@@ -748,38 +748,38 @@ void GRAPH_OT_select_column(wmOperatorType *ot)
static int graphkeys_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
-
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
KeyframeEditFunc ok_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
KeyframeEditFunc sel_cb = ANIM_editkeyframes_select(SELECT_ADD);
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* loop through all of the keys and select additional keyframes based on these */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
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;
-
+
/* check if anything selected? */
if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, ok_cb, NULL)) {
/* select every keyframe in this curve then */
ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL);
}
}
-
+
/* Cleanup */
ANIM_animdata_freelist(&anim_data);
-
+
/* set notifier that keyframe selection has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -789,11 +789,11 @@ void GRAPH_OT_select_linked(wmOperatorType *ot)
ot->name = "Select Linked";
ot->idname = "GRAPH_OT_select_linked";
ot->description = "Select keyframes occurring in the same F-Curves as selected ones";
-
+
/* api callbacks */
ot->exec = graphkeys_select_linked_exec;
ot->poll = graphop_visible_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -806,38 +806,38 @@ static void select_moreless_graph_keys(bAnimContext *ac, short mode)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
KeyframeEditData ked;
KeyframeEditFunc build_cb;
-
-
+
+
/* init selmap building data */
build_cb = ANIM_editkeyframes_buildselmap(mode);
- memset(&ked, 0, sizeof(KeyframeEditData));
-
+ memset(&ked, 0, sizeof(KeyframeEditData));
+
/* loop through all of the keys and select additional keyframes based on these */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
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;
-
+
/* only continue if F-Curve has keyframes */
if (fcu->bezt == NULL)
continue;
-
+
/* build up map of whether F-Curve's keyframes should be selected or not */
ked.data = MEM_callocN(fcu->totvert, "selmap graphEdit");
ANIM_fcurve_keyframes_loop(&ked, fcu, NULL, build_cb, NULL);
-
+
/* based on this map, adjust the selection status of the keyframes */
ANIM_fcurve_keyframes_loop(&ked, fcu, NULL, bezt_selmap_flush, NULL);
-
+
/* free the selmap used here */
MEM_freeN(ked.data);
ked.data = NULL;
}
-
+
/* Cleanup */
ANIM_animdata_freelist(&anim_data);
}
@@ -847,17 +847,17 @@ static void select_moreless_graph_keys(bAnimContext *ac, short mode)
static int graphkeys_select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* perform select changes */
select_moreless_graph_keys(&ac, SELMAP_MORE);
-
+
/* set notifier that keyframe selection has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -867,11 +867,11 @@ void GRAPH_OT_select_more(wmOperatorType *ot)
ot->name = "Select More";
ot->idname = "GRAPH_OT_select_more";
ot->description = "Select keyframes beside already selected ones";
-
+
/* api callbacks */
ot->exec = graphkeys_select_more_exec;
ot->poll = graphop_visible_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -881,17 +881,17 @@ void GRAPH_OT_select_more(wmOperatorType *ot)
static int graphkeys_select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* perform select changes */
select_moreless_graph_keys(&ac, SELMAP_LESS);
-
+
/* set notifier that keyframe selection has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -901,11 +901,11 @@ void GRAPH_OT_select_less(wmOperatorType *ot)
ot->name = "Select Less";
ot->idname = "GRAPH_OT_select_less";
ot->description = "Deselect keyframes on ends of selection islands";
-
+
/* api callbacks */
ot->exec = graphkeys_select_less_exec;
ot->poll = graphop_visible_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -928,25 +928,25 @@ static void graphkeys_select_leftright(bAnimContext *ac, short leftright, short
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
KeyframeEditFunc ok_cb, select_cb;
KeyframeEditData ked = {{NULL}};
Scene *scene = ac->scene;
-
+
/* if select mode is replace, deselect all keyframes (and channels) first */
if (select_mode == SELECT_REPLACE) {
select_mode = SELECT_ADD;
-
+
/* - deselect all other keyframes, so that just the newly selected remain
* - channels aren't deselected, since we don't re-select any as a consequence
*/
deselect_graph_keys(ac, 0, SELECT_SUBTRACT, false);
}
-
+
/* set callbacks and editing data */
ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
select_cb = ANIM_editkeyframes_select(select_mode);
-
+
if (leftright == GRAPHKEYS_LRSEL_LEFT) {
ked.f1 = MINAFRAMEF;
ked.f2 = (float)(CFRA + 0.1f);
@@ -955,15 +955,15 @@ static void graphkeys_select_leftright(bAnimContext *ac, short leftright, short
ked.f1 = (float)(CFRA - 0.1f);
ked.f2 = MAXFRAMEF;
}
-
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* select keys */
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);
@@ -984,28 +984,28 @@ static int graphkeys_select_leftright_exec(bContext *C, wmOperator *op)
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
short selectmode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode = SELECT_INVERT;
else
selectmode = SELECT_REPLACE;
-
+
/* if "test" mode is set, we don't have any info to set this with */
if (leftright == GRAPHKEYS_LRSEL_TEST)
return OPERATOR_CANCELLED;
-
+
/* do the selecting now */
graphkeys_select_leftright(&ac, leftright, selectmode);
-
+
/* set notifier that keyframe selection (and channels too) have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1013,11 +1013,11 @@ static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, const
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* handle mode-based testing */
if (leftright == GRAPHKEYS_LRSEL_TEST) {
Scene *scene = ac.scene;
@@ -1032,7 +1032,7 @@ static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, const
else
RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
}
-
+
/* perform selection */
return graphkeys_select_leftright_exec(C, op);
}
@@ -1040,24 +1040,24 @@ static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, const
void GRAPH_OT_select_leftright(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Select Left/Right";
ot->idname = "GRAPH_OT_select_leftright";
ot->description = "Select keyframes to the left or the right of the current frame";
-
+
/* api callbacks */
ot->invoke = graphkeys_select_leftright_invoke;
ot->exec = graphkeys_select_leftright_exec;
ot->poll = graphop_visible_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "mode", prop_graphkeys_leftright_select_types, GRAPHKEYS_LRSEL_TEST, "Mode", "");
RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
-
+
prop = RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
@@ -1075,18 +1075,18 @@ void GRAPH_OT_select_leftright(wmOperatorType *ot)
/* temp info for caching handle vertices close */
typedef struct tNearestVertInfo {
struct tNearestVertInfo *next, *prev;
-
+
FCurve *fcu; /* F-Curve that keyframe comes from */
-
+
BezTriple *bezt; /* keyframe to consider */
FPoint *fpt; /* sample point to consider */
-
+
short hpoint; /* the handle index that we hit (eHandleIndex) */
short sel; /* whether the handle is selected or not */
int dist; /* distance from mouse to vert */
-
+
eAnim_ChannelType ctype; /* type of animation channel this FCurve comes from */
-
+
float frame; /* frame that point was on when it matched (global time) */
} tNearestVertInfo;
@@ -1095,7 +1095,7 @@ typedef enum eGraphVertIndex {
NEAREST_HANDLE_LEFT = -1,
NEAREST_HANDLE_KEY,
NEAREST_HANDLE_RIGHT
-} eGraphVertIndex;
+} eGraphVertIndex;
/* Tolerance for absolute radius (in pixels) of the vert from the cursor to use */
// TODO: perhaps this should depend a bit on the size that the user set the vertices to be?
@@ -1121,9 +1121,9 @@ static void nearest_fcurve_vert_store(
/* Keyframes or Samples? */
if (bezt) {
int screen_co[2], dist;
-
- /* convert from data-space to screen coordinates
- * NOTE: hpoint+1 gives us 0,1,2 respectively for each handle,
+
+ /* convert from data-space to screen coordinates
+ * NOTE: hpoint+1 gives us 0,1,2 respectively for each handle,
* needed to access the relevant vertex coordinates in the 3x3
* 'vec' matrix
*/
@@ -1135,7 +1135,7 @@ static void nearest_fcurve_vert_store(
{
tNearestVertInfo *nvi = (tNearestVertInfo *)matches->last;
bool replace = false;
-
+
/* if there is already a point for the F-Curve, check if this point is closer than that was */
if ((nvi) && (nvi->fcu == fcu)) {
/* replace if we are closer, or if equal and that one wasn't selected but we are... */
@@ -1145,19 +1145,19 @@ static void nearest_fcurve_vert_store(
/* add new if not replacing... */
if (replace == 0)
nvi = MEM_callocN(sizeof(tNearestVertInfo), "Nearest Graph Vert Info - Bezt");
-
+
/* store values */
nvi->fcu = fcu;
nvi->ctype = ctype;
-
+
nvi->bezt = bezt;
nvi->hpoint = hpoint;
nvi->dist = dist;
-
+
nvi->frame = bezt->vec[1][0]; /* currently in global time... */
-
+
nvi->sel = BEZT_ISSEL_ANY(bezt); // XXX... should this use the individual verts instead?
-
+
/* add to list of matches if appropriate... */
if (replace == 0)
BLI_addtail(matches, nvi);
@@ -1174,12 +1174,12 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
View2D *v2d = &ac->ar->v2d;
short mapping_flag = 0;
-
- /* get curves to search through
+
+ /* get curves to search through
* - if the option to only show keyframes that belong to selected F-Curves is enabled,
* include the 'only selected' flag...
*/
@@ -1188,32 +1188,32 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
filter |= ANIMFILTER_SEL;
mapping_flag |= ANIM_get_normalization_flags(ac);
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;
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag, &offset);
-
+
/* apply NLA mapping to all the keyframes */
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
-
+
if (fcu->bezt) {
BezTriple *bezt1 = fcu->bezt, *prevbezt = NULL;
int i;
-
+
for (i = 0; i < fcu->totvert; i++, prevbezt = bezt1, bezt1++) {
/* keyframe */
nearest_fcurve_vert_store(matches, v2d, fcu, ale->type, bezt1, NULL, NEAREST_HANDLE_KEY, mval, unit_scale, offset);
-
+
/* handles - only do them if they're visible */
if (fcurve_handle_sel_check(sipo, bezt1) && (fcu->totvert > 1)) {
/* first handle only visible if previous segment had handles */
if ((!prevbezt && (bezt1->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) {
nearest_fcurve_vert_store(matches, v2d, fcu, ale->type, bezt1, NULL, NEAREST_HANDLE_LEFT, mval, unit_scale, offset);
}
-
+
/* second handle only visible if this segment is bezier */
if (bezt1->ipo == BEZT_IPO_BEZ) {
nearest_fcurve_vert_store(matches, v2d, fcu, ale->type, bezt1, NULL, NEAREST_HANDLE_RIGHT, mval, unit_scale, offset);
@@ -1223,14 +1223,14 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
}
else if (fcu->fpt) {
// TODO; do this for samples too
-
+
}
-
+
/* un-apply NLA mapping from all the keyframes */
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
}
-
+
/* free channels */
ANIM_animdata_freelist(&anim_data);
}
@@ -1240,22 +1240,22 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches)
{
tNearestVertInfo *nvi = NULL;
short found = 0;
-
+
/* abort if list is empty */
if (BLI_listbase_is_empty(matches))
return NULL;
-
+
/* if list only has 1 item, remove it from the list and return */
if (BLI_listbase_is_single(matches)) {
/* need to remove from the list, otherwise it gets freed and then we can't return it */
return BLI_pophead(matches);
}
-
+
/* try to find the first selected F-Curve vert, then take the one after it */
for (nvi = matches->first; nvi; nvi = nvi->next) {
/* which mode of search are we in: find first selected, or find vert? */
if (found) {
- /* just take this vert now that we've found the selected one
+ /* just take this vert now that we've found the selected one
* - we'll need to remove this from the list so that it can be returned to the original caller
*/
BLI_remlink(matches, nvi);
@@ -1267,29 +1267,29 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches)
found = 1;
}
}
-
+
/* if we're still here, this means that we failed to find anything appropriate in the first pass,
* so just take the first item now...
*/
return BLI_pophead(matches);
}
-/* Find the nearest vertices (either a handle or the keyframe) that are nearest to the mouse cursor (in area coordinates)
+/* Find the nearest vertices (either a handle or the keyframe) that are nearest to the mouse cursor (in area coordinates)
* NOTE: the match info found must still be freed
*/
static tNearestVertInfo *find_nearest_fcurve_vert(bAnimContext *ac, const int mval[2])
{
ListBase matches = {NULL, NULL};
tNearestVertInfo *nvi;
-
+
/* step 1: get the nearest verts */
get_nearest_fcurve_verts_list(ac, mval, &matches);
-
+
/* step 2: find the best vert */
nvi = get_best_nearest_fcurve_vert(&matches);
-
+
BLI_freelistN(&matches);
-
+
/* return the best vert found */
return nvi;
}
@@ -1302,30 +1302,30 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
tNearestVertInfo *nvi;
BezTriple *bezt = NULL;
-
+
/* find the beztriple that we're selecting, and the handle that was clicked on */
nvi = find_nearest_fcurve_vert(ac, mval);
-
+
/* check if anything to select */
if (nvi == NULL)
return;
-
+
/* deselect all other curves? */
if (select_mode == SELECT_REPLACE) {
/* reset selection mode */
select_mode = SELECT_ADD;
-
+
/* deselect all other keyframes (+ F-Curves too) */
deselect_graph_keys(ac, 0, SELECT_SUBTRACT, true);
-
- /* deselect other channels too, but only only do this if
- * selection of channel when the visibility of keyframes
- * doesn't depend on this
+
+ /* deselect other channels too, but only only do this if
+ * selection of channel when the visibility of keyframes
+ * doesn't depend on this
*/
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
}
-
+
/* if points can be selected on this F-Curve */
// TODO: what about those with no keyframes?
if ((curves_only == 0) && ((nvi->fcu->flag & FCURVE_PROTECTED) == 0)) {
@@ -1343,7 +1343,7 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m
BEZT_SEL_ALL(bezt);
}
}
-
+
/* handles - toggle selection of relevant handle */
else if (nvi->hpoint == NEAREST_HANDLE_LEFT) {
/* toggle selection */
@@ -1360,9 +1360,9 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m
BEZT_SEL_ALL(bezt);
}
/* otherwise, select the handle that applied */
- else if (nvi->hpoint == NEAREST_HANDLE_LEFT)
+ else if (nvi->hpoint == NEAREST_HANDLE_LEFT)
bezt->f1 |= SELECT;
- else
+ else
bezt->f3 |= SELECT;
}
}
@@ -1373,22 +1373,22 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m
else {
KeyframeEditFunc select_cb;
KeyframeEditData ked;
-
+
/* initialize keyframe editing data */
memset(&ked, 0, sizeof(KeyframeEditData));
-
+
/* set up BezTriple edit callbacks */
select_cb = ANIM_editkeyframes_select(select_mode);
-
+
/* select all keyframes */
ANIM_fcurve_keyframes_loop(&ked, nvi->fcu, NULL, select_cb, NULL);
}
-
+
/* only change selection of channel when the visibility of keyframes doesn't depend on this */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
/* select or deselect curve? */
if (bezt) {
- /* take selection status from item that got hit, to prevent flip/flop on channel
+ /* take selection status from item that got hit, to prevent flip/flop on channel
* selection status when shift-selecting (i.e. "SELECT_INVERT") points
*/
if (BEZT_ISSEL_ANY(bezt))
@@ -1425,66 +1425,66 @@ static void graphkeys_mselect_column(bAnimContext *ac, const int mval[2], short
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
KeyframeEditFunc select_cb, ok_cb;
KeyframeEditData ked;
tNearestVertInfo *nvi;
float selx = (float)ac->scene->r.cfra;
-
+
/* find the beztriple that we're selecting, and the handle that was clicked on */
nvi = find_nearest_fcurve_vert(ac, mval);
-
+
/* check if anything to select */
if (nvi == NULL)
return;
-
+
/* get frame number on which elements should be selected */
// TODO: should we restrict to integer frames only?
selx = nvi->frame;
-
+
/* if select mode is replace, deselect all keyframes first */
if (select_mode == SELECT_REPLACE) {
/* reset selection mode to add to selection */
select_mode = SELECT_ADD;
-
+
/* - deselect all other keyframes, so that just the newly selected remain
* - channels aren't deselected, since we don't re-select any as a consequence
*/
deselect_graph_keys(ac, 0, SELECT_SUBTRACT, false);
}
-
+
/* initialize keyframe editing data */
memset(&ked, 0, sizeof(KeyframeEditData));
-
+
/* set up BezTriple edit callbacks */
select_cb = ANIM_editkeyframes_select(select_mode);
ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME);
-
+
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
+
/* set frame for validation callback to refer to */
if (adt)
ked.f1 = BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP);
else
ked.f1 = selx;
-
+
/* select elements with frame number matching cfra */
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
}
-
+
/* free elements */
MEM_freeN(nvi);
BLI_freelistN(&ked.list);
ANIM_animdata_freelist(&anim_data);
}
-
+
/* ------------------- */
/* handle clicking */
@@ -1502,7 +1502,7 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, const wmEve
selectmode = SELECT_INVERT;
else
selectmode = SELECT_REPLACE;
-
+
/* figure out action to take */
if (RNA_boolean_get(op->ptr, "column")) {
/* select all keyframes in the same frame as the one that was under the mouse */
@@ -1516,41 +1516,41 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, const wmEve
/* select keyframe under mouse */
mouse_graph_keys(&ac, event->mval, selectmode, 0);
}
-
+
/* set notifier that keyframe selection (and also channel selection in some cases) has changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL);
-
+
/* for tweak grab to work */
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
-
+
void GRAPH_OT_clickselect(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Mouse Select Keys";
ot->idname = "GRAPH_OT_clickselect";
ot->description = "Select keyframes by clicking on them";
-
+
/* callbacks */
ot->invoke = graphkeys_clickselect_invoke;
ot->poll = graphop_visible_keyframes_poll;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
-
+
/* properties */
prop = RNA_def_boolean(ot->srna, "extend", 0, "Extend Select",
"Toggle keyframe selection instead of leaving newly selected keyframes only"); // SHIFTKEY
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-
- prop = RNA_def_boolean(ot->srna, "column", 0, "Column Select",
+
+ prop = RNA_def_boolean(ot->srna, "column", 0, "Column Select",
"Select all keyframes that occur on the same frame as the one under the mouse"); // ALTKEY
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-
- prop = RNA_def_boolean(ot->srna, "curves", 0, "Only Curves",
+
+ prop = RNA_def_boolean(ot->srna, "curves", 0, "Only Curves",
"Select all the keyframes in the curve"); // CTRLKEY + ALTKEY
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index fc20a62c3d6..f55a5511e2d 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -57,7 +57,7 @@
/* ************************************************************** */
/* Active F-Curve */
-/* Find 'active' F-Curve. It must be editable, since that's the purpose of these buttons (subject to change).
+/* Find 'active' F-Curve. It must be editable, since that's the purpose of these buttons (subject to change).
* We return the 'wrapper' since it contains valuable context info (about hierarchy), which will need to be freed
* when the caller is done with it.
*
@@ -68,20 +68,20 @@ bAnimListElem *get_active_fcurve_channel(bAnimContext *ac)
ListBase anim_data = {NULL, NULL};
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ACTIVE);
size_t items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* We take the first F-Curve only, since some other ones may have had 'active' flag set
* if they were from linked data.
*/
if (items) {
bAnimListElem *ale = (bAnimListElem *)anim_data.first;
-
+
/* remove first item from list, then free the rest of the list and return the stored one */
BLI_remlink(&anim_data, ale);
ANIM_animdata_freelist(&anim_data);
-
+
return ale;
}
-
+
/* no active F-Curve */
return NULL;
}
@@ -99,30 +99,30 @@ int graphop_visible_keyframes_poll(bContext *C)
size_t items;
int filter;
short found = 0;
-
+
/* firstly, check if in Graph Editor */
// TODO: also check for region?
if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
return 0;
-
+
/* try to init Anim-Context stuff ourselves and check */
if (ANIM_animdata_get_context(C, &ac) == 0)
return 0;
-
+
/* loop over the visible (selection doesn't matter) F-Curves, and see if they're suitable
* stopping on the first successful match
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
- if (items == 0)
+ if (items == 0)
return 0;
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->data;
-
+
/* visible curves for selection must fulfill the following criteria:
* - it has bezier keyframes
- * - F-Curve modifiers do not interfere with the result too much
+ * - F-Curve modifiers do not interfere with the result too much
* (i.e. the modifier-control drawing check returns false)
*/
if (fcu->bezt == NULL)
@@ -132,7 +132,7 @@ int graphop_visible_keyframes_poll(bContext *C)
break;
}
}
-
+
/* cleanup and return findings */
ANIM_animdata_freelist(&anim_data);
return found;
@@ -148,27 +148,27 @@ int graphop_editable_keyframes_poll(bContext *C)
size_t items;
int filter;
short found = 0;
-
+
/* firstly, check if in Graph Editor */
// TODO: also check for region?
if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
return 0;
-
+
/* try to init Anim-Context stuff ourselves and check */
if (ANIM_animdata_get_context(C, &ac) == 0)
return 0;
-
+
/* loop over the editable F-Curves, and see if they're suitable
* stopping on the first successful match
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
- if (items == 0)
+ if (items == 0)
return 0;
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->data;
-
+
/* editable curves must fulfill the following criteria:
* - it has bezier keyframes
* - it must not be protected from editing (this is already checked for with the edit flag
@@ -182,7 +182,7 @@ int graphop_editable_keyframes_poll(bContext *C)
break;
}
}
-
+
/* cleanup and return findings */
ANIM_animdata_freelist(&anim_data);
return found;
@@ -195,21 +195,21 @@ int graphop_active_fcurve_poll(bContext *C)
bAnimListElem *ale;
ScrArea *sa = CTX_wm_area(C);
bool has_fcurve = 0;
-
+
/* firstly, check if in Graph Editor */
// TODO: also check for region?
if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
return 0;
-
+
/* try to init Anim-Context stuff ourselves and check */
if (ANIM_animdata_get_context(C, &ac) == 0)
return 0;
-
+
/* try to get the Active F-Curve */
ale = get_active_fcurve_channel(&ac);
if (ale == NULL)
return 0;
-
+
/* do we have a suitable F-Curves?
* - For most cases, NLA Control Curves are sufficiently similar to NLA curves to serve this role too.
* Under the hood, they are F-Curves too. The only problems which will arise here are if these need to be
@@ -220,10 +220,10 @@ int graphop_active_fcurve_poll(bContext *C)
FCurve *fcu = (FCurve *)ale->data;
has_fcurve = (fcu->flag & FCURVE_VISIBLE) != 0;
}
-
+
/* free temp data... */
MEM_freeN(ale);
-
+
/* return success */
return has_fcurve;
}
@@ -236,24 +236,24 @@ int graphop_selected_fcurve_poll(bContext *C)
ScrArea *sa = CTX_wm_area(C);
size_t items;
int filter;
-
+
/* firstly, check if in Graph Editor */
// TODO: also check for region?
if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
return 0;
-
+
/* try to init Anim-Context stuff ourselves and check */
if (ANIM_animdata_get_context(C, &ac) == 0)
return 0;
-
- /* get the editable + selected F-Curves, and as long as we got some, we can return
+
+ /* get the editable + selected F-Curves, and as long as we got some, we can return
* NOTE: curve-visible flag isn't included, otherwise selecting a curve via list to edit is too cumbersome
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
- if (items == 0)
+ if (items == 0)
return 0;
-
+
/* cleanup and return findings */
ANIM_animdata_freelist(&anim_data);
return 1;
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 2193a027f99..383c2b5b220 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -68,7 +68,7 @@
ARegion *graph_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
+
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
if (ar) return ar;
@@ -77,15 +77,15 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
/* is error! */
if (ar == NULL) return NULL;
-
+
arnew = MEM_callocN(sizeof(ARegion), "buttons for graph");
-
+
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
arnew->regiontype = RGN_TYPE_UI;
arnew->alignment = RGN_ALIGN_RIGHT;
-
+
arnew->flag = RGN_FLAG_HIDDEN;
-
+
return arnew;
}
@@ -97,82 +97,82 @@ static SpaceLink *graph_new(const bContext *C)
Scene *scene = CTX_data_scene(C);
ARegion *ar;
SpaceIpo *sipo;
-
+
/* Graph Editor - general stuff */
sipo = MEM_callocN(sizeof(SpaceIpo), "init graphedit");
sipo->spacetype = SPACE_IPO;
-
+
sipo->autosnap = SACTSNAP_FRAME;
-
+
/* allocate DopeSheet data for Graph Editor */
sipo->ads = MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
sipo->ads->source = (ID *)scene;
-
+
/* settings for making it easier by default to just see what you're interested in tweaking */
sipo->ads->filterflag |= ADS_FILTER_ONLYSEL;
sipo->flag |= SIPO_SELVHANDLESONLY;
-
+
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for graphedit");
-
+
BLI_addtail(&sipo->regionbase, ar);
ar->regiontype = RGN_TYPE_HEADER;
ar->alignment = RGN_ALIGN_BOTTOM;
-
+
/* channels */
ar = MEM_callocN(sizeof(ARegion), "channels region for graphedit");
-
+
BLI_addtail(&sipo->regionbase, ar);
ar->regiontype = RGN_TYPE_CHANNELS;
ar->alignment = RGN_ALIGN_LEFT;
-
+
ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
-
+
/* ui buttons */
ar = MEM_callocN(sizeof(ARegion), "buttons region for graphedit");
-
+
BLI_addtail(&sipo->regionbase, ar);
ar->regiontype = RGN_TYPE_UI;
ar->alignment = RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
-
+
/* main region */
ar = MEM_callocN(sizeof(ARegion), "main region for graphedit");
-
+
BLI_addtail(&sipo->regionbase, ar);
ar->regiontype = RGN_TYPE_WINDOW;
-
+
ar->v2d.tot.xmin = 0.0f;
ar->v2d.tot.ymin = (float)scene->r.sfra - 10.0f;
ar->v2d.tot.xmax = (float)scene->r.efra;
ar->v2d.tot.ymax = 10.0f;
-
+
ar->v2d.cur = ar->v2d.tot;
-
+
ar->v2d.min[0] = FLT_MIN;
ar->v2d.min[1] = FLT_MIN;
ar->v2d.max[0] = MAXFRAMEF;
ar->v2d.max[1] = FLT_MAX;
-
+
ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
-
+
ar->v2d.keeptot = 0;
-
+
return (SpaceLink *)sipo;
}
/* not spacelink itself */
static void graph_free(SpaceLink *sl)
-{
+{
SpaceIpo *si = (SpaceIpo *)sl;
-
+
if (si->ads) {
BLI_freelistN(&si->ads->chanbase);
MEM_freeN(si->ads);
}
-
+
if (si->ghostCurves.first)
free_fcurves(&si->ghostCurves);
}
@@ -182,13 +182,13 @@ static void graph_free(SpaceLink *sl)
static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
-
+
/* init dopesheet data if non-existent (i.e. for old files) */
if (sipo->ads == NULL) {
sipo->ads = MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
sipo->ads->source = (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now...
}
-
+
/* force immediate init of any invalid F-Curve colors */
/* XXX: but, don't do SIPO_TEMP_NEEDCHANSYNC (i.e. channel select state sync)
* as this is run on each region resize; setting this here will cause selection
@@ -200,11 +200,11 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
static SpaceLink *graph_duplicate(SpaceLink *sl)
{
SpaceIpo *sipon = MEM_dupallocN(sl);
-
+
/* clear or remove stuff from old */
BLI_duplicatelist(&sipon->ghostCurves, &((SpaceIpo *)sl)->ghostCurves);
sipon->ads = MEM_dupallocN(sipon->ads);
-
+
return (SpaceLink *)sipon;
}
@@ -212,9 +212,9 @@ static SpaceLink *graph_duplicate(SpaceLink *sl)
static void graph_main_region_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
-
+
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
-
+
/* own keymap */
keymap = WM_keymap_find(wm->defaultconf, "Graph Editor", SPACE_IPO, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
@@ -232,45 +232,45 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
View2DScrollers *scrollers;
float col[3];
short unitx = 0, unity = V2D_UNIT_VALUES, flag = 0;
-
+
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
-
+
UI_view2d_view_ortho(v2d);
-
+
/* grid */
unitx = ((sipo->mode == SIPO_MODE_ANIMATION) && (sipo->flag & SIPO_DRAWTIME)) ? V2D_UNIT_SECONDS : V2D_UNIT_FRAMESCALE;
grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy);
UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL);
-
+
ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
/* draw data */
if (ANIM_animdata_get_context(C, &ac)) {
/* draw ghost curves */
graph_draw_ghost_curves(&ac, sipo, ar);
-
+
/* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */
graph_draw_curves(&ac, sipo, ar, grid, 0);
graph_draw_curves(&ac, sipo, ar, grid, 1);
-
+
/* XXX the slow way to set tot rect... but for nice sliders needed (ton) */
get_graph_keyframe_extents(&ac, &v2d->tot.xmin, &v2d->tot.xmax, &v2d->tot.ymin, &v2d->tot.ymax, false, true);
/* extra offset so that these items are visible */
v2d->tot.xmin -= 10.0f;
v2d->tot.xmax += 10.0f;
}
-
+
/* only free grid after drawing data, as we need to use it to determine sampling rate */
UI_view2d_grid_free(grid);
-
+
/* horizontal component of value-cursor (value line before the current frame line) */
if ((sipo->flag & SIPO_NODRAWCURSOR) == 0) {
float y = sipo->cursorVal;
-
+
/* Draw a green line to indicate the cursor value */
UI_ThemeColorShadeAlpha(TH_CFRAME, -10, -50);
glEnable(GL_BLEND);
@@ -283,17 +283,17 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
glDisable(GL_BLEND);
}
-
+
/* current frame or vertical component of vertical component of the cursor */
if (sipo->mode == SIPO_MODE_DRIVERS) {
/* cursor x-value */
float x = sipo->cursorTime;
-
+
/* to help differentiate this from the current frame, draw slightly darker like the horizontal one */
UI_ThemeColorShadeAlpha(TH_CFRAME, -40, -50);
glEnable(GL_BLEND);
glLineWidth(2.0);
-
+
glBegin(GL_LINES);
glVertex2f(x, v2d->cur.ymin);
glVertex2f(x, v2d->cur.ymax);
@@ -307,22 +307,22 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
if ((sipo->flag & SIPO_NODRAWCFRANUM) == 0) flag |= DRAWCFRA_SHOW_NUMBOX;
ANIM_draw_cfra(C, v2d, flag);
}
-
+
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
ED_markers_draw(C, DRAW_MARKERS_MARGIN);
-
+
/* preview range */
UI_view2d_view_ortho(v2d);
ANIM_draw_previewrange(C, v2d, 0);
-
+
/* callback */
UI_view2d_view_ortho(v2d);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
/* reset view matrix */
UI_view2d_view_restore(C);
-
+
/* scrollers */
// FIXME: args for scrollers depend on the type of data being shown...
scrollers = UI_view2d_scrollers_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP);
@@ -333,15 +333,15 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
static void graph_channel_region_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
-
+
/* make sure we keep the hide flags */
ar->v2d.scroll |= V2D_SCROLL_RIGHT;
ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM); /* prevent any noise of past */
ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
ar->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE;
-
+
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
-
+
/* own keymap */
keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
@@ -355,22 +355,22 @@ static void graph_channel_region_draw(const bContext *C, ARegion *ar)
View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
float col[3];
-
+
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
-
+
UI_view2d_view_ortho(v2d);
-
+
/* draw channels */
if (ANIM_animdata_get_context(C, &ac)) {
graph_draw_channel_names((bContext *)C, &ac, ar);
}
-
+
/* reset view matrix */
UI_view2d_view_restore(C);
-
+
/* scrollers */
scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
@@ -392,7 +392,7 @@ static void graph_header_region_draw(const bContext *C, ARegion *ar)
static void graph_buttons_region_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
-
+
ED_region_panels_init(wm, ar);
keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
@@ -454,7 +454,7 @@ static void graph_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), AReg
if (wmn->data == ND_KEYS)
ED_region_tag_redraw(ar);
break;
-
+
}
}
@@ -462,7 +462,7 @@ static void graph_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), AReg
static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
{
SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
-
+
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
@@ -479,7 +479,7 @@ static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
sipo->flag |= SIPO_TEMP_NEEDCHANSYNC;
ED_area_tag_refresh(sa);
break;
-
+
default: /* just redrawing the view will do */
ED_area_tag_redraw(sa);
break;
@@ -494,7 +494,7 @@ static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
break;
case ND_TRANSFORM:
break; /*do nothing*/
-
+
default: /* just redrawing the view will do */
ED_area_tag_redraw(sa);
break;
@@ -517,7 +517,7 @@ static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
ED_area_tag_refresh(sa);
}
break;
-
+
// XXX: restore the case below if not enough updates occur...
//default:
// if (wmn->data == ND_KEYS)
@@ -529,29 +529,29 @@ static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
static void graph_refresh_fcurve_colors(const bContext *C)
{
bAnimContext ac;
-
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
size_t items;
int filter;
int i;
-
+
if (ANIM_animdata_get_context(C, &ac) == false)
return;
-
+
UI_SetTheme(SPACE_IPO, RGN_TYPE_WINDOW);
-
+
/* build list of F-Curves which will be visible as channels in channel-region
* - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a
* mismatch between channel-colors and the drawn curves
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* loop over F-Curves, assigning colors */
for (ale = anim_data.first, i = 0; ale; ale = ale->next, i++) {
FCurve *fcu = (FCurve *)ale->data;
-
+
/* set color of curve here */
switch (fcu->color_mode) {
case FCURVE_COLOR_CUSTOM:
@@ -563,11 +563,11 @@ static void graph_refresh_fcurve_colors(const bContext *C)
}
case FCURVE_COLOR_AUTO_RGB:
{
- /* F-Curve's array index is automatically mapped to RGB values. This works best of 3-value vectors.
+ /* F-Curve's array index is automatically mapped to RGB values. This works best of 3-value vectors.
* TODO: find a way to module the hue so that not all curves have same color...
*/
float *col = fcu->color;
-
+
switch (fcu->array_index) {
case 0:
UI_GetThemeColor3fv(TH_AXIS_X, col);
@@ -589,7 +589,7 @@ static void graph_refresh_fcurve_colors(const bContext *C)
{
/* Like FCURVE_COLOR_AUTO_RGB, except this is for quaternions... */
float *col = fcu->color;
-
+
switch (fcu->array_index) {
case 1:
UI_GetThemeColor3fv(TH_AXIS_X, col);
@@ -600,29 +600,29 @@ static void graph_refresh_fcurve_colors(const bContext *C)
case 3:
UI_GetThemeColor3fv(TH_AXIS_Z, col);
break;
-
+
case 0:
{
/* Special Case: "W" channel should be yellowish, so blend X and Y channel colors... */
float c1[3], c2[3];
float h1[3], h2[3];
float hresult[3];
-
+
/* - get colors (rgb) */
UI_GetThemeColor3fv(TH_AXIS_X, c1);
UI_GetThemeColor3fv(TH_AXIS_Y, c2);
-
+
/* - perform blending in HSV space (to keep brightness similar) */
rgb_to_hsv_v(c1, h1);
rgb_to_hsv_v(c2, h2);
-
+
interp_v3_v3v3(hresult, h1, h2, 0.5f);
-
+
/* - convert back to RGB for display */
hsv_to_rgb_v(hresult, col);
break;
}
-
+
default:
/* 'unknown' color - bluish so as to not conflict with handles */
col[0] = 0.3f; col[1] = 0.8f; col[2] = 1.0f;
@@ -641,7 +641,7 @@ static void graph_refresh_fcurve_colors(const bContext *C)
}
}
}
-
+
/* free temp list */
ANIM_animdata_freelist(&anim_data);
}
@@ -649,24 +649,24 @@ static void graph_refresh_fcurve_colors(const bContext *C)
static void graph_refresh(const bContext *C, ScrArea *sa)
{
SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
-
+
/* updates to data needed depends on Graph Editor mode... */
switch (sipo->mode) {
case SIPO_MODE_ANIMATION: /* all animation */
{
break;
}
-
+
case SIPO_MODE_DRIVERS: /* drivers only */
{
break;
}
}
-
+
/* region updates? */
// XXX re-sizing y-extents of tot should go here?
-
- /* update the state of the animchannels in response to changes from the data they represent
+
+ /* update the state of the animchannels in response to changes from the data they represent
* NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled
*/
if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) {
@@ -674,7 +674,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
sipo->flag &= ~SIPO_TEMP_NEEDCHANSYNC;
ED_area_tag_redraw(sa);
}
-
+
/* init/adjust F-Curve colors */
graph_refresh_fcurve_colors(C);
}
@@ -682,7 +682,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
static void graph_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
{
SpaceIpo *sgraph = (SpaceIpo *)slink;
-
+
if (sgraph->ads) {
if ((ID *)sgraph->ads->filter_grp == old_id) {
sgraph->ads->filter_grp = (Group *)new_id;
@@ -698,10 +698,10 @@ void ED_spacetype_ipo(void)
{
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype ipo");
ARegionType *art;
-
+
st->spaceid = SPACE_IPO;
strncpy(st->name, "Graph", BKE_ST_MAXNAME);
-
+
st->new = graph_new;
st->free = graph_free;
st->init = graph_init;
@@ -721,7 +721,7 @@ void ED_spacetype_ipo(void)
art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_MARKERS | ED_KEYMAP_ANIMATION | ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
-
+
/* regions: header */
art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_HEADER;
@@ -730,9 +730,9 @@ void ED_spacetype_ipo(void)
art->listener = graph_region_listener;
art->init = graph_header_region_init;
art->draw = graph_header_region_draw;
-
+
BLI_addhead(&st->regiontypes, art);
-
+
/* regions: channels */
art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_CHANNELS;
@@ -741,9 +741,9 @@ void ED_spacetype_ipo(void)
art->listener = graph_region_listener;
art->init = graph_channel_region_init;
art->draw = graph_channel_region_draw;
-
+
BLI_addhead(&st->regiontypes, art);
-
+
/* regions: UI buttons */
art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_UI;
@@ -752,11 +752,11 @@ void ED_spacetype_ipo(void)
art->listener = graph_region_listener;
art->init = graph_buttons_region_init;
art->draw = graph_buttons_region_draw;
-
+
BLI_addhead(&st->regiontypes, art);
graph_buttons_register(art);
-
+
BKE_spacetype_register(st);
}