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>2012-05-09 00:18:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-09 00:18:33 +0400
commitf6abd6ee401fb19a3005c0f0b604674b026eb270 (patch)
tree4212a9a9c886034e60d84681d3b9b6dc46b931a2 /source/blender/editors/space_graph
parentd9a70ceeb14fa7e723ce226f36eba12aea2373df (diff)
style cleanup: graph & armature
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c550
-rw-r--r--source/blender/editors/space_graph/graph_draw.c412
-rw-r--r--source/blender/editors/space_graph/graph_edit.c552
-rw-r--r--source/blender/editors/space_graph/graph_intern.h7
-rw-r--r--source/blender/editors/space_graph/graph_ops.c162
-rw-r--r--source/blender/editors/space_graph/graph_select.c340
-rw-r--r--source/blender/editors/space_graph/graph_utils.c40
-rw-r--r--source/blender/editors/space_graph/space_graph.c164
8 files changed, 1113 insertions, 1114 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 8bc2eda7e33..ddcd46ba817 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -67,12 +67,12 @@
#include "UI_interface.h"
#include "UI_resources.h"
-#include "graph_intern.h" // own include
+#include "graph_intern.h" // own include
/* XXX */
/* temporary definition for limits of float number buttons (FLT_MAX tends to infinity with old system) */
-#define UI_FLT_MAX 10000.0f
+#define UI_FLT_MAX 10000.0f
/* ******************* graph editor space & buttons ************** */
@@ -98,7 +98,7 @@ static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int
static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **fcu)
{
bAnimContext ac;
- bAnimListElem *elem= NULL;
+ bAnimListElem *elem = NULL;
/* 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?
@@ -107,14 +107,14 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **
return 0;
/* try to find 'active' F-Curve */
- elem= get_active_fcurve_channel(&ac);
+ elem = get_active_fcurve_channel(&ac);
if (elem == NULL)
return 0;
if (fcu)
- *fcu= (FCurve*)elem->data;
+ *fcu = (FCurve *)elem->data;
if (ale)
- *ale= elem;
+ *ale = elem;
else
MEM_freeN(elem);
@@ -131,9 +131,9 @@ static int graph_panel_poll(const bContext *C, PanelType *UNUSED(pt))
/* Graph Editor View Settings */
static void graph_panel_view(const bContext *C, Panel *pa)
{
- bScreen *sc= CTX_wm_screen(C);
- SpaceIpo *sipo= CTX_wm_space_graph(C);
- Scene *scene= CTX_data_scene(C);
+ bScreen *sc = CTX_wm_screen(C);
+ SpaceIpo *sipo = CTX_wm_space_graph(C);
+ Scene *scene = CTX_data_scene(C);
PointerRNA spaceptr, sceneptr;
uiLayout *col, *sub, *row;
@@ -142,21 +142,21 @@ static void graph_panel_view(const bContext *C, Panel *pa)
RNA_pointer_create(&sc->id, &RNA_SpaceGraphEditor, sipo, &spaceptr);
/* 2D-Cursor */
- col= uiLayoutColumn(pa->layout, 0);
- uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(pa->layout, 0);
+ uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NONE);
- sub= uiLayoutColumn(col, 1);
- uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
- uiItemO(sub, IFACE_("Cursor from Selection"), ICON_NONE, "GRAPH_OT_frame_jump");
-
- sub= uiLayoutColumn(col, 1);
- uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
- row= uiLayoutSplit(sub, 0.7, 1);
- 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.7, 1);
- 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);
+ sub = uiLayoutColumn(col, 1);
+ uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
+ uiItemO(sub, IFACE_("Cursor from Selection"), ICON_NONE, "GRAPH_OT_frame_jump");
+
+ sub = uiLayoutColumn(col, 1);
+ uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
+ row = uiLayoutSplit(sub, 0.7, 1);
+ 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.7, 1);
+ 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);
}
/* ******************* active F-Curve ************** */
@@ -175,7 +175,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
if (!graph_panel_context(C, &ale, &fcu))
return;
- block= uiLayoutGetBlock(layout);
+ block = uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL);
/* F-Curve pointer */
@@ -183,26 +183,26 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
/* user-friendly 'name' for F-Curve */
/* TODO: only show the path if this is invalid? */
- col= uiLayoutColumn(layout, 0);
- icon= getname_anim_fcurve(name, ale->id, fcu);
- uiItemL(col, name, icon);
+ col = uiLayoutColumn(layout, 0);
+ icon = getname_anim_fcurve(name, ale->id, fcu);
+ uiItemL(col, name, icon);
/* RNA-Path Editing - only really should be enabled when things aren't working */
- col= uiLayoutColumn(layout, 1);
- 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);
+ col = uiLayoutColumn(layout, 1);
+ 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, 1);
- uiItemL(col, IFACE_("Display Color:"), ICON_NONE);
+ col = uiLayoutColumn(layout, 1);
+ uiItemL(col, IFACE_("Display Color:"), ICON_NONE);
- row= uiLayoutRow(col, 1);
- uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE);
+ row = uiLayoutRow(col, 1);
+ uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE);
- sub= uiLayoutRow(row, 1);
- uiLayoutSetEnabled(sub, (fcu->color_mode==FCURVE_COLOR_CUSTOM));
- uiItemR(sub, &fcu_ptr, "color", 0, "", ICON_NONE);
+ sub = uiLayoutRow(row, 1);
+ uiLayoutSetEnabled(sub, (fcu->color_mode == FCURVE_COLOR_CUSTOM));
+ uiItemR(sub, &fcu_ptr, "color", 0, "", ICON_NONE);
MEM_freeN(ale);
}
@@ -226,13 +226,13 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT
* - 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++) {
+ for (i = 0, b = fcu->bezt; i < fcu->totvert; i++, b++) {
if (BEZSELECTED(b)) {
/* 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;
+ *prevbezt = (i > 0) ? b - 1 : b;
*bezt = b;
return 1;
@@ -246,7 +246,7 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT
/* update callback for active keyframe properties - base updates stuff */
static void graphedit_activekey_update_cb(bContext *C, void *fcu_ptr, void *UNUSED(bezt_ptr))
{
- SpaceIpo *sipo= CTX_wm_space_graph(C);
+ SpaceIpo *sipo = CTX_wm_space_graph(C);
const short use_handle = !(sipo->flag & SIPO_NOHANDLES);
FCurve *fcu = (FCurve *)fcu_ptr;
@@ -265,8 +265,8 @@ static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bez
*/
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {
/* by changing to aligned handles, these can now be moved... */
- bezt->h1= HD_ALIGN;
- bezt->h2= HD_ALIGN;
+ bezt->h1 = HD_ALIGN;
+ bezt->h2 = HD_ALIGN;
}
/* now call standard updates */
@@ -307,56 +307,56 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
}
/* interpolation */
- col= uiLayoutColumn(layout, 0);
- uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, 0);
+ uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NONE);
/* 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
+ * - 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
*/
// XXX:
- col= uiLayoutColumn(layout, 1);
- /* keyframe itself */
- {
- uiItemL(col, IFACE_("Key:"), ICON_NONE);
-
- but = uiDefButR(block, NUM, B_REDR, IFACE_("Frame"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
- &bezt_ptr, "co", 0, 0, 0, -1, -1, NULL);
- uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt);
-
- but = uiDefButR(block, NUM, B_REDR, IFACE_("Value"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
- &bezt_ptr, "co", 1, 0, 0, -1, -1, NULL);
- uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt);
- uiButSetUnitType(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, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y,
- &bezt_ptr, "handle_left", 0, 0, 0, -1, -1, NULL);
- uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
-
- but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y,
- &bezt_ptr, "handle_left", 1, 0, 0, -1, -1, NULL);
- uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
- uiButSetUnitType(but, unit);
- }
-
- /* next handle - only if current is Bezier interpolation */
- if (bezt->ipo == BEZT_IPO_BEZ) {
- uiItemL(col, IFACE_("Right Handle:"), ICON_NONE);
-
- but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y,
- &bezt_ptr, "handle_right", 0, 0, 0, -1, -1, NULL);
- uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
-
- but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y,
- &bezt_ptr, "handle_right", 1, 0, 0, -1, -1, NULL);
- uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
- uiButSetUnitType(but, unit);
- }
+ col = uiLayoutColumn(layout, 1);
+ /* keyframe itself */
+ {
+ uiItemL(col, IFACE_("Key:"), ICON_NONE);
+
+ but = uiDefButR(block, NUM, B_REDR, IFACE_("Frame"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ &bezt_ptr, "co", 0, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt);
+
+ but = uiDefButR(block, NUM, B_REDR, IFACE_("Value"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ &bezt_ptr, "co", 1, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt);
+ uiButSetUnitType(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, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ &bezt_ptr, "handle_left", 0, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
+
+ but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ &bezt_ptr, "handle_left", 1, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
+ uiButSetUnitType(but, unit);
+ }
+
+ /* next handle - only if current is Bezier interpolation */
+ if (bezt->ipo == BEZT_IPO_BEZ) {
+ uiItemL(col, IFACE_("Right Handle:"), ICON_NONE);
+
+ but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ &bezt_ptr, "handle_right", 0, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
+
+ but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ &bezt_ptr, "handle_right", 1, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt);
+ uiButSetUnitType(but, unit);
+ }
}
else {
if ((fcu->bezt == NULL) && (fcu->modifiers.first)) {
@@ -378,12 +378,12 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
/* ******************* drivers ******************************** */
-#define B_IPO_DEPCHANGE 10
+#define B_IPO_DEPCHANGE 10
static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int event)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
switch (event) {
case B_IPO_DEPCHANGE:
@@ -394,19 +394,19 @@ static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int e
/* force an update of depsgraph */
DAG_ids_flush_update(bmain, 0);
}
- break;
+ break;
}
/* default for now */
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); // XXX could use better notifier
+ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); // XXX could use better notifier
}
/* callback to remove the active driver */
-static void driver_remove_cb (bContext *C, void *ale_v, void *UNUSED(arg))
+static void driver_remove_cb(bContext *C, void *ale_v, void *UNUSED(arg))
{
- bAnimListElem *ale= (bAnimListElem *)ale_v;
- ID *id= ale->id;
- FCurve *fcu= ale->data;
+ bAnimListElem *ale = (bAnimListElem *)ale_v;
+ 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 */
@@ -418,29 +418,29 @@ static void driver_remove_cb (bContext *C, void *ale_v, void *UNUSED(arg))
}
/* callback to add a target variable to the active driver */
-static void driver_add_var_cb (bContext *UNUSED(C), void *driver_v, void *UNUSED(arg))
+static void driver_add_var_cb(bContext *UNUSED(C), void *driver_v, void *UNUSED(arg))
{
- ChannelDriver *driver= (ChannelDriver *)driver_v;
+ ChannelDriver *driver = (ChannelDriver *)driver_v;
/* add a new variable */
driver_add_new_variable(driver);
}
/* callback to remove target variable from active driver */
-static void driver_delete_var_cb (bContext *UNUSED(C), void *driver_v, void *dvar_v)
+static void driver_delete_var_cb(bContext *UNUSED(C), void *driver_v, void *dvar_v)
{
- ChannelDriver *driver= (ChannelDriver *)driver_v;
- DriverVar *dvar= (DriverVar *)dvar_v;
+ ChannelDriver *driver = (ChannelDriver *)driver_v;
+ DriverVar *dvar = (DriverVar *)dvar_v;
/* remove the active variable */
driver_free_variable(driver, dvar);
}
/* callback to reset the driver's flags */
-static void driver_update_flags_cb (bContext *UNUSED(C), void *fcu_v, void *UNUSED(arg))
+static void driver_update_flags_cb(bContext *UNUSED(C), void *fcu_v, void *UNUSED(arg))
{
- FCurve *fcu= (FCurve *)fcu_v;
- ChannelDriver *driver= fcu->driver;
+ FCurve *fcu = (FCurve *)fcu_v;
+ ChannelDriver *driver = fcu->driver;
/* clear invalid flags */
fcu->flag &= ~FCURVE_DISABLED; // XXX?
@@ -450,7 +450,7 @@ static void driver_update_flags_cb (bContext *UNUSED(C), void *fcu_v, void *UNUS
/* drivers panel poll */
static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
{
- SpaceIpo *sipo= CTX_wm_space_graph(C);
+ SpaceIpo *sipo = CTX_wm_space_graph(C);
if (sipo->mode != SIPO_MODE_DRIVERS)
return 0;
@@ -461,7 +461,7 @@ static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
/* settings for 'single property' driver variable type */
static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVar *dvar)
{
- DriverTarget *dtar= &dvar->targets[0];
+ DriverTarget *dtar = &dvar->targets[0];
PointerRNA dtar_ptr;
uiLayout *row, *col;
@@ -469,8 +469,8 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa
RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
/* Target ID */
- row= uiLayoutRow(layout, 0);
- uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
+ row = uiLayoutRow(layout, 0);
+ uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
/* Target Property */
// TODO: make this less technical...
@@ -480,7 +480,7 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa
/* get pointer for resolving the property selected */
RNA_id_pointer_create(dtar->id, &root_ptr);
- col= uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, 1);
/* rna path */
uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, IFACE_("Path"));
}
@@ -489,8 +489,8 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa
/* settings for 'rotation difference' driver variable type */
static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *dvar)
{
- DriverTarget *dtar= &dvar->targets[0];
- DriverTarget *dtar2= &dvar->targets[1];
+ DriverTarget *dtar = &dvar->targets[0];
+ DriverTarget *dtar2 = &dvar->targets[1];
Object *ob1 = (Object *)dtar->id;
Object *ob2 = (Object *)dtar2->id;
PointerRNA dtar_ptr, dtar2_ptr;
@@ -501,32 +501,32 @@ static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *
RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr);
/* Bone 1 */
- col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Bone 1:"));
+ col = uiLayoutColumn(layout, 1);
+ uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Bone 1:"));
- if (dtar->id && ob1->pose) {
- PointerRNA tar_ptr;
+ if (dtar->id && 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", "", ICON_BONE_DATA);
- }
+ RNA_pointer_create(dtar->id, &RNA_Pose, ob1->pose, &tar_ptr);
+ uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
+ }
- col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Bone 2:"));
+ col = uiLayoutColumn(layout, 1);
+ uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Bone 2:"));
- if (dtar2->id && ob2->pose) {
- PointerRNA tar_ptr;
+ if (dtar2->id && 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", "", ICON_BONE_DATA);
- }
+ RNA_pointer_create(dtar2->id, &RNA_Pose, ob2->pose, &tar_ptr);
+ uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
+ }
}
/* settings for 'location difference' driver variable type */
static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *dvar)
{
- DriverTarget *dtar= &dvar->targets[0];
- DriverTarget *dtar2= &dvar->targets[1];
+ DriverTarget *dtar = &dvar->targets[0];
+ DriverTarget *dtar2 = &dvar->targets[1];
Object *ob1 = (Object *)dtar->id;
Object *ob2 = (Object *)dtar2->id;
PointerRNA dtar_ptr, dtar2_ptr;
@@ -537,35 +537,35 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr);
/* Bone 1 */
- col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone 1:"));
+ col = uiLayoutColumn(layout, 1);
+ uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone 1:"));
- if (dtar->id && ob1->pose) {
- PointerRNA tar_ptr;
+ if (dtar->id && 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", "", ICON_BONE_DATA);
- }
+ RNA_pointer_create(dtar->id, &RNA_Pose, ob1->pose, &tar_ptr);
+ uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
+ }
- uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
+ uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
- col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Ob/Bone 2:"));
+ col = uiLayoutColumn(layout, 1);
+ uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Ob/Bone 2:"));
- if (dtar2->id && ob2->pose) {
- PointerRNA tar_ptr;
+ if (dtar2->id && 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", "", ICON_BONE_DATA);
- }
+ RNA_pointer_create(dtar2->id, &RNA_Pose, ob2->pose, &tar_ptr);
+ uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
+ }
- uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE);
+ uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE);
}
/* settings for 'transform channel' driver variable type */
static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar *dvar)
{
- DriverTarget *dtar= &dvar->targets[0];
+ DriverTarget *dtar = &dvar->targets[0];
Object *ob = (Object *)dtar->id;
PointerRNA dtar_ptr;
uiLayout *col, *sub;
@@ -574,19 +574,19 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
/* properties */
- col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone:"));
+ col = uiLayoutColumn(layout, 1);
+ uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone:"));
- if (dtar->id && ob->pose) {
- PointerRNA tar_ptr;
+ if (dtar->id && 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", "", ICON_BONE_DATA);
- }
+ RNA_pointer_create(dtar->id, &RNA_Pose, ob->pose, &tar_ptr);
+ uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
+ }
- sub= uiLayoutColumn(layout, 1);
- uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
- uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE);
+ sub = uiLayoutColumn(layout, 1);
+ uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
+ uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE);
}
/* driver settings for active F-Curve (only for 'Drivers' mode) */
@@ -605,125 +605,125 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* Get settings from context */
if (!graph_panel_context(C, &ale, &fcu))
return;
- driver= fcu->driver;
+ driver = fcu->driver;
/* set event handler for panel */
- block= uiLayoutGetBlock(pa->layout); // xxx?
+ block = uiLayoutGetBlock(pa->layout); // xxx?
uiBlockSetHandleFunc(block, do_graph_region_driver_buttons, NULL);
/* general actions - management */
- col= uiLayoutColumn(pa->layout, 0);
- block= uiLayoutGetBlock(col);
- but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Update Dependencies"), 0, 0, 10*UI_UNIT_X, 22,
- NULL, 0.0, 0.0, 0, 0, TIP_("Force updates of dependencies"));
- uiButSetFunc(but, driver_update_flags_cb, fcu, NULL);
-
- but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Remove Driver"), 0, 0, 10*UI_UNIT_X, 18,
- NULL, 0.0, 0.0, 0, 0, TIP_("Remove this driver"));
- uiButSetNFunc(but, driver_remove_cb, MEM_dupallocN(ale), NULL);
+ col = uiLayoutColumn(pa->layout, 0);
+ block = uiLayoutGetBlock(col);
+ but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Update Dependencies"), 0, 0, 10 * UI_UNIT_X, 22,
+ NULL, 0.0, 0.0, 0, 0, TIP_("Force updates of dependencies"));
+ uiButSetFunc(but, driver_update_flags_cb, fcu, NULL);
+
+ but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Remove Driver"), 0, 0, 10 * UI_UNIT_X, 18,
+ NULL, 0.0, 0.0, 0, 0, TIP_("Remove this driver"));
+ uiButSetNFunc(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, 1);
- block= uiLayoutGetBlock(col);
- uiItemR(col, &driver_ptr, "type", 0, NULL, ICON_NONE);
-
- /* show expression box if doing scripted drivers, and/or error messages when invalid drivers exist */
- if (driver->type == DRIVER_TYPE_PYTHON) {
- /* expression */
- uiItemR(col, &driver_ptr, "expression", 0, IFACE_("Expr"), ICON_NONE);
-
- /* errors? */
- if (driver->flag & DRIVER_FLAG_INVALID)
- uiItemL(col, IFACE_("ERROR: invalid Python expression"), ICON_ERROR);
- }
- else {
- /* errors? */
- if (driver->flag & DRIVER_FLAG_INVALID)
- uiItemL(col, IFACE_("ERROR: invalid target channel(s)"), ICON_ERROR);
- }
+ col = uiLayoutColumn(pa->layout, 1);
+ block = uiLayoutGetBlock(col);
+ uiItemR(col, &driver_ptr, "type", 0, NULL, ICON_NONE);
+
+ /* show expression box if doing scripted drivers, and/or error messages when invalid drivers exist */
+ if (driver->type == DRIVER_TYPE_PYTHON) {
+ /* expression */
+ uiItemR(col, &driver_ptr, "expression", 0, IFACE_("Expr"), ICON_NONE);
+
+ /* errors? */
+ if (driver->flag & DRIVER_FLAG_INVALID)
+ uiItemL(col, IFACE_("ERROR: invalid Python expression"), ICON_ERROR);
+ }
+ else {
+ /* errors? */
+ if (driver->flag & DRIVER_FLAG_INVALID)
+ uiItemL(col, IFACE_("ERROR: invalid target channel(s)"), ICON_ERROR);
+ }
- col= uiLayoutColumn(pa->layout, 1);
- /* debug setting */
- uiItemR(col, &driver_ptr, "show_debug_info", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(pa->layout, 1);
+ /* 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, 1);
- char valBuf[32];
+ /* value of driver */
+ if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
+ uiLayout *row = uiLayoutRow(col, 1);
+ char valBuf[32];
- uiItemL(row, IFACE_("Driver Value:"), ICON_NONE);
+ uiItemL(row, IFACE_("Driver Value:"), ICON_NONE);
- BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", driver->curval);
- uiItemL(row, valBuf, ICON_NONE);
- }
+ BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", driver->curval);
+ uiItemL(row, valBuf, ICON_NONE);
+ }
/* add driver variables */
- col= uiLayoutColumn(pa->layout, 0);
- block= uiLayoutGetBlock(col);
- but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Add Variable"), 0, 0, 10*UI_UNIT_X, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0, 0, TIP_("Add a new target variable for this Driver"));
- uiButSetFunc(but, driver_add_var_cb, driver, NULL);
+ col = uiLayoutColumn(pa->layout, 0);
+ block = uiLayoutGetBlock(col);
+ but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Add Variable"), 0, 0, 10 * UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0, 0, TIP_("Add a new target variable for this Driver"));
+ uiButSetFunc(but, driver_add_var_cb, driver, NULL);
/* loop over targets, drawing them */
- for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
+ for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
PointerRNA dvar_ptr;
uiLayout *box, *row;
/* sub-layout column for this variable's settings */
- col= uiLayoutColumn(pa->layout, 1);
+ col = uiLayoutColumn(pa->layout, 1);
/* header panel */
- box= uiLayoutBox(col);
- /* first row context info for driver */
- RNA_pointer_create(ale->id, &RNA_DriverVariable, dvar, &dvar_ptr);
-
- row= uiLayoutRow(box, 0);
- block= uiLayoutGetBlock(row);
- /* variable name */
- uiItemR(row, &dvar_ptr, "name", 0, "", ICON_NONE);
-
- /* remove button */
- uiBlockSetEmboss(block, UI_EMBOSSN);
- but = uiDefIconBut(block, 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"));
- uiButSetFunc(but, driver_delete_var_cb, driver, dvar);
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- /* variable type */
- row= uiLayoutRow(box, 0);
- uiItemR(row, &dvar_ptr, "type", 0, "", ICON_NONE);
+ box = uiLayoutBox(col);
+ /* first row context info for driver */
+ RNA_pointer_create(ale->id, &RNA_DriverVariable, dvar, &dvar_ptr);
+
+ row = uiLayoutRow(box, 0);
+ block = uiLayoutGetBlock(row);
+ /* variable name */
+ uiItemR(row, &dvar_ptr, "name", 0, "", ICON_NONE);
+
+ /* remove button */
+ uiBlockSetEmboss(block, UI_EMBOSSN);
+ but = uiDefIconBut(block, 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"));
+ uiButSetFunc(but, driver_delete_var_cb, driver, dvar);
+ uiBlockSetEmboss(block, UI_EMBOSS);
+
+ /* variable type */
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, &dvar_ptr, "type", 0, "", ICON_NONE);
/* variable type settings */
- box= uiLayoutBox(col);
- /* controls to draw depends on the type of variable */
- switch (dvar->type) {
- case DVAR_TYPE_SINGLE_PROP: /* single property */
- graph_panel_driverVar__singleProp(box, ale->id, dvar);
- break;
- case DVAR_TYPE_ROT_DIFF: /* rotational difference */
- graph_panel_driverVar__rotDiff(box, ale->id, dvar);
- break;
- case DVAR_TYPE_LOC_DIFF: /* location difference */
- graph_panel_driverVar__locDiff(box, ale->id, dvar);
- break;
- case DVAR_TYPE_TRANSFORM_CHAN: /* transform channel */
- graph_panel_driverVar__transChan(box, ale->id, dvar);
- break;
- }
-
- /* value of variable */
- if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
- char valBuf[32];
-
- box= uiLayoutBox(col);
- row= uiLayoutRow(box, 1);
- uiItemL(row, IFACE_("Value:"), ICON_NONE);
-
- BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
- uiItemL(row, valBuf, ICON_NONE);
- }
+ box = uiLayoutBox(col);
+ /* controls to draw depends on the type of variable */
+ switch (dvar->type) {
+ case DVAR_TYPE_SINGLE_PROP: /* single property */
+ graph_panel_driverVar__singleProp(box, ale->id, dvar);
+ break;
+ case DVAR_TYPE_ROT_DIFF: /* rotational difference */
+ graph_panel_driverVar__rotDiff(box, ale->id, dvar);
+ break;
+ case DVAR_TYPE_LOC_DIFF: /* location difference */
+ graph_panel_driverVar__locDiff(box, ale->id, dvar);
+ break;
+ case DVAR_TYPE_TRANSFORM_CHAN: /* transform channel */
+ graph_panel_driverVar__transChan(box, ale->id, dvar);
+ break;
+ }
+
+ /* value of variable */
+ if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
+ char valBuf[32];
+
+ box = uiLayoutBox(col);
+ row = uiLayoutRow(box, 1);
+ uiItemL(row, IFACE_("Value:"), ICON_NONE);
+
+ BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
+ uiItemL(row, valBuf, ICON_NONE);
+ }
}
/* cleanup */
@@ -733,7 +733,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* ******************* f-modifiers ******************************** */
/* all the drawing code is in editors/animation/fmodifier_ui.c */
-#define B_FMODIFIER_REDRAW 20
+#define B_FMODIFIER_REDRAW 20
static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int event)
{
@@ -755,27 +755,27 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
if (!graph_panel_context(C, &ale, &fcu))
return;
- block= uiLayoutGetBlock(pa->layout);
+ block = uiLayoutGetBlock(pa->layout);
uiBlockSetHandleFunc(block, do_graph_region_modifier_buttons, NULL);
/* 'add modifier' button at top of panel */
{
- row= uiLayoutRow(pa->layout, 0);
- block= uiLayoutGetBlock(row);
+ row = uiLayoutRow(pa->layout, 0);
+ block = uiLayoutGetBlock(row);
// XXX for now, this will be a operator button which calls a 'add modifier' operator
uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"),
10, 0, 150, 20, TIP_("Adds a new F-Curve Modifier for the active F-Curve"));
/* copy/paste (as sub-row)*/
- row= uiLayoutRow(row, 1);
- uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_fmodifier_copy");
- uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_fmodifier_paste");
+ row = uiLayoutRow(row, 1);
+ uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_fmodifier_copy");
+ uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_fmodifier_paste");
}
/* draw each modifier */
- for (fcm= fcu->modifiers.first; fcm; fcm= fcm->next) {
- col= uiLayoutColumn(pa->layout, 1);
+ for (fcm = fcu->modifiers.first; fcm; fcm = fcm->next) {
+ col = uiLayoutColumn(pa->layout, 1);
ANIM_uiTemplate_fmodifier_draw(col, ale->id, &fcu->modifiers, fcm);
}
@@ -789,47 +789,47 @@ void graph_buttons_register(ARegionType *art)
{
PanelType *pt;
- pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel view");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel view");
strcpy(pt->idname, "GRAPH_PT_view");
strcpy(pt->label, N_("View Properties"));
- pt->draw= graph_panel_view;
+ pt->draw = graph_panel_view;
pt->flag |= PNL_DEFAULT_CLOSED;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
strcpy(pt->idname, "GRAPH_PT_properties");
strcpy(pt->label, N_("Active F-Curve"));
- pt->draw= graph_panel_properties;
- pt->poll= graph_panel_poll;
+ pt->draw = graph_panel_properties;
+ pt->poll = graph_panel_poll;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
strcpy(pt->idname, "GRAPH_PT_key_properties");
strcpy(pt->label, N_("Active Keyframe"));
- pt->draw= graph_panel_key_properties;
- pt->poll= graph_panel_poll;
+ pt->draw = graph_panel_key_properties;
+ pt->poll = graph_panel_poll;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers");
strcpy(pt->idname, "GRAPH_PT_drivers");
strcpy(pt->label, N_("Drivers"));
- pt->draw= graph_panel_drivers;
- pt->poll= graph_panel_drivers_poll;
+ pt->draw = graph_panel_drivers;
+ pt->poll = graph_panel_drivers_poll;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel modifiers");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel modifiers");
strcpy(pt->idname, "GRAPH_PT_modifiers");
strcpy(pt->label, N_("Modifiers"));
- pt->draw= graph_panel_modifiers;
- pt->poll= graph_panel_poll;
+ pt->draw = graph_panel_modifiers;
+ pt->poll = graph_panel_poll;
BLI_addtail(&art->paneltypes, pt);
}
static int graph_properties(bContext *C, wmOperator *UNUSED(op))
{
- ScrArea *sa= CTX_wm_area(C);
- ARegion *ar= graph_has_buttons_region(sa);
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = graph_has_buttons_region(sa);
if (ar)
ED_region_toggle_hidden(C, ar);
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index e772e2856c1..ddca0030cf5 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -84,11 +84,11 @@ static float fcurve_display_alpha(FCurve *fcu)
/* Envelope -------------- */
// TODO: draw a shaded poly showing the region of influence too!!!
-static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d)
+static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
{
- FMod_Envelope *env= (FMod_Envelope *)fcm->data;
+ FMod_Envelope *env = (FMod_Envelope *)fcm->data;
FCM_EnvelopeData *fed;
- const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
+ const float fac = 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
int i;
/* draw two black lines showing the standard reference levels */
@@ -96,11 +96,11 @@ static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d)
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->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);
+ glVertex2f(v2d->cur.xmin, env->midval + env->max);
+ glVertex2f(v2d->cur.xmax, env->midval + env->max);
glEnd(); // GL_LINES
setlinestyle(0);
@@ -114,7 +114,7 @@ static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d)
* drawing bugs that some drivers have (probably legacy ones only though)
*/
bglBegin(GL_POINTS);
- for (i=0, fed=env->data; i < env->totvert; i++, fed++) {
+ for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
/* only draw if visible
* - min/max here are fixed, not relative
*/
@@ -134,10 +134,10 @@ static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d)
/* Points ---------------- */
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_vertices_keyframes (FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel)
+static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel)
{
- BezTriple *bezt= fcu->bezt;
- const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
+ BezTriple *bezt = fcu->bezt;
+ const float fac = 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
int i;
/* we use bgl points not standard gl points, to workaround vertex
@@ -174,18 +174,18 @@ static void draw_fcurve_vertices_keyframes (FCurve *fcu, SpaceIpo *UNUSED(sipo),
* 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 void draw_fcurve_handle_control(float x, float y, float xscale, float yscale, float hsize)
{
- static GLuint displist=0;
+ static GLuint displist = 0;
/* initialize round circle shape */
if (displist == 0) {
GLUquadricObj *qobj;
- displist= glGenLists(1);
+ displist = glGenLists(1);
glNewList(displist, GL_COMPILE);
- qobj = gluNewQuadric();
+ qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
gluDisk(qobj, 0, 0.7, 8, 1);
gluDeleteQuadric(qobj);
@@ -195,26 +195,26 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys
/* adjust view transform before starting */
glTranslatef(x, y, 0.0f);
- glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.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);
+ glScalef(xscale / hsize, yscale / hsize, 1.0);
glTranslatef(-x, -y, 0.0f);
}
/* helper func - draw handle vertices only for an F-Curve (if it is not protected) */
-static void draw_fcurve_vertices_handles (FCurve *fcu, SpaceIpo *sipo, View2D *v2d, short sel, short sel_handle_only)
+static void draw_fcurve_vertices_handles(FCurve *fcu, SpaceIpo *sipo, View2D *v2d, short sel, short sel_handle_only)
{
- BezTriple *bezt= fcu->bezt;
+ BezTriple *bezt = fcu->bezt;
BezTriple *prevbezt = NULL;
float hsize, xscale, yscale;
int i;
/* get view settings */
- hsize= UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE);
+ hsize = UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE);
UI_view2d_getscale(v2d, &xscale, &yscale);
/* set handle color */
@@ -222,10 +222,10 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, SpaceIpo *sipo, View2D *v
else UI_ThemeColor(TH_HANDLE_VERTEX);
/* anti-aliased lines for more consistent appearance */
- if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
- for (i=0; i < fcu->totvert; i++, prevbezt=bezt, bezt++) {
+ for (i = 0; i < fcu->totvert; i++, prevbezt = bezt, bezt++) {
/* 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
@@ -234,31 +234,31 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, SpaceIpo *sipo, View2D *v
* Also, need to take into account whether the keyframe was selected
* if a Graph Editor option to only show handles of selected keys is on.
*/
- if ( !sel_handle_only || BEZSELECTED(bezt) ) {
- if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) {
- if ((bezt->f1 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/
+ if (!sel_handle_only || BEZSELECTED(bezt) ) {
+ if ( (!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ)) ) {
+ 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)*/
+ 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);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
/* helper func - set color to draw F-Curve data with */
-static void set_fcurve_vertex_color (FCurve *fcu, short sel)
+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);
+ 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) {
+ if ((fcu->flag & FCURVE_PROTECTED) == 0) {
/* Curve's points ARE BEING edited */
if (sel) UI_ThemeColorShadeAlpha(TH_VERTEX_SELECT, 0, alphaOffset);
else UI_ThemeColorShadeAlpha(TH_VERTEX, 0, alphaOffset);
@@ -271,14 +271,14 @@ 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)
+static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only)
{
- View2D *v2d= &ar->v2d;
+ View2D *v2d = &ar->v2d;
/* only draw points if curve is visible
- * - draw unselected points before selected points as separate passes to minimise color-changing overhead
+ * - draw unselected points before selected points as separate passes to minimise color-changing overhead
* (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
+ * 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)
*/
@@ -308,14 +308,14 @@ static void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu, shor
static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
{
/* don't draw handle lines if handles are not to be shown */
- if ( (sipo->flag & SIPO_NOHANDLES) || /* handles shouldn't be shown anywhere */
- (fcu->flag & FCURVE_PROTECTED) || /* keyframes aren't editable */
-#if 0 /* handles can still be selected and handle types set, better draw - campbell */
- (fcu->flag & FCURVE_INT_VALUES) || /* editing the handles here will cause weird/incorrect interpolation issues */
+ if ( (sipo->flag & SIPO_NOHANDLES) || /* handles shouldn't be shown anywhere */
+ (fcu->flag & FCURVE_PROTECTED) || /* keyframes aren't editable */
+#if 0 /* handles can still be selected and handle types set, better draw - campbell */
+ (fcu->flag & FCURVE_INT_VALUES) || /* editing the handles here will cause weird/incorrect interpolation issues */
#endif
- ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) || /* group that curve belongs to is not editable */
- (fcu->totvert <= 1) /* do not show handles if there is only 1 keyframe, otherwise they all clump together in an ugly ball */
- )
+ ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) || /* group that curve belongs to is not editable */
+ (fcu->totvert <= 1) /* do not show handles if there is only 1 keyframe, otherwise they all clump together in an ugly ball */
+ )
{
return 0;
}
@@ -326,7 +326,7 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
/* draw lines for F-Curve handles only (this is only done in EditMode)
* note: draw_fcurve_handles_check must be checked before running this. */
-static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
+static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
{
int sel, b;
@@ -339,13 +339,13 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
/* 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++) {
- BezTriple *bezt=fcu->bezt, *prevbezt=NULL;
- int basecol= (sel)? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
+ for (sel = 0; sel < 2; sel++) {
+ BezTriple *bezt = fcu->bezt, *prevbezt = NULL;
+ int basecol = (sel) ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
float *fp;
unsigned char col[4];
- for (b= 0; b < fcu->totvert; b++, prevbezt=bezt, bezt++) {
+ for (b = 0; b < fcu->totvert; b++, prevbezt = bezt, bezt++) {
/* if only selected keyframes can get their handles shown,
* check that keyframe is selected
*/
@@ -355,50 +355,50 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
}
/* draw handle with appropriate set of colors if selection is ok */
- if ((bezt->f2 & SELECT)==sel) {
- fp= bezt->vec[0];
+ 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))) {
+ 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;
+ col[3] = fcurve_display_alpha(fcu) * 255;
glColor4ubv((GLubyte *)col);
- glVertex2fv(fp); glVertex2fv(fp+3);
+ 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;
+ col[3] = fcurve_display_alpha(fcu) * 255;
glColor4ubv((GLubyte *)col);
- glVertex2fv(fp+3); glVertex2fv(fp+6);
+ glVertex2fv(fp + 3); glVertex2fv(fp + 6);
}
}
else {
/* only draw first handle if previous segment was had handles, and selection is ok */
- if ( ((bezt->f1 & SELECT)==sel) &&
- ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) )
+ if ( ((bezt->f1 & SELECT) == sel) &&
+ ( (!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ)) ) )
{
- fp= bezt->vec[0];
+ fp = bezt->vec[0];
UI_GetThemeColor3ubv(basecol + bezt->h1, col);
- col[3]= fcurve_display_alpha(fcu) * 255;
+ col[3] = fcurve_display_alpha(fcu) * 255;
glColor4ubv((GLubyte *)col);
- glVertex2fv(fp); glVertex2fv(fp+3);
+ 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) )
+ if ( ((bezt->f3 & SELECT) == sel) &&
+ (bezt->ipo == BEZT_IPO_BEZ) )
{
- fp= bezt->vec[1];
+ fp = bezt->vec[1];
UI_GetThemeColor3ubv(basecol + bezt->h2, col);
- col[3]= fcurve_display_alpha(fcu) * 255;
+ col[3] = fcurve_display_alpha(fcu) * 255;
glColor4ubv((GLubyte *)col);
- glVertex2fv(fp); glVertex2fv(fp+3);
+ glVertex2fv(fp); glVertex2fv(fp + 3);
}
}
}
@@ -413,21 +413,21 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
* 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 void draw_fcurve_sample_control(float x, float y, float xscale, float yscale, float hsize)
{
- static GLuint displist=0;
+ static GLuint displist = 0;
/* initialize X shape */
if (displist == 0) {
- displist= glGenLists(1);
+ 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);
- glVertex2f(-0.7f, +0.7f);
- glVertex2f(+0.7f, -0.7f);
+ glVertex2f(-0.7f, +0.7f);
+ glVertex2f(+0.7f, -0.7f);
glEnd(); // GL_LINES
glEndList();
@@ -435,52 +435,52 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys
/* adjust view transform before starting */
glTranslatef(x, y, 0.0f);
- glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.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);
+ glScalef(xscale / hsize, yscale / hsize, 1.0);
glTranslatef(-x, -y, 0.0f);
}
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_samples (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
+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);
+ hsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
UI_view2d_getscale(&ar->v2d, &xscale, &yscale);
/* set vertex color */
- if (fcu->flag & (FCURVE_ACTIVE|FCURVE_SELECTED)) UI_ThemeColor(TH_TEXT_HI);
+ 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);
+ 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);
+ 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);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
}
}
/* Curve ---------------- */
/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */
-static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid)
+static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid)
{
ChannelDriver *driver;
float samplefreq, ctime;
@@ -496,33 +496,33 @@ static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2
/* disable any drivers temporarily */
- driver= fcu->driver;
- fcu->driver= NULL;
+ driver = fcu->driver;
+ fcu->driver = NULL;
/* compute unit correction factor */
- unitFac= ANIM_unit_mapping_get_factor(ac->scene, id, fcu, 0);
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, 0);
/* Note about sampling frequency:
- * Ideally, this is chosen such that we have 1-2 pixels = 1 segment
+ * 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,
- * this does mean that curves may not be fully accurate (i.e. if they have
- * sudden spikes which happen at the sampling point, we may have problems).
- * Also, this may introduce lower performance on less densely detailed curves,'
+ * this does mean that curves may not be fully accurate (i.e. if they have
+ * sudden spikes which happen at the sampling point, we may have problems).
+ * Also, this may introduce lower performance on less densely detailed curves,'
* though it is impossible to predict this from the modifiers!
*
* If the automatically determined sampling frequency is likely to cause an infinite
* loop (i.e. too close to 0), then clamp it to a determined "safe" value. The value
- * chosen here is just the coarsest value which still looks reasonable...
+ * chosen here is just the coarsest value which still looks reasonable...
*/
- /* 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;
- if (samplefreq < 0.00001f) samplefreq= 0.00001f;
+ /* 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;
+ 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... */
+ 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
@@ -531,22 +531,22 @@ static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2
*/
glBegin(GL_LINE_STRIP);
- for (ctime= stime; ctime <= etime; ctime += samplefreq)
+ for (ctime = stime; ctime <= etime; ctime += samplefreq)
glVertex2f(ctime, evaluate_fcurve(fcu, ctime) * unitFac);
glEnd();
/* restore driver */
- fcu->driver= driver;
+ fcu->driver = driver;
}
/* helper func - draw a samples-based F-Curve */
-static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d)
+static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d)
{
- FPoint *prevfpt= fcu->fpt;
- FPoint *fpt= prevfpt + 1;
+ FPoint *prevfpt = fcu->fpt;
+ FPoint *fpt = prevfpt + 1;
float fac, v[2];
- int b= fcu->totvert-1;
+ int b = fcu->totvert - 1;
glBegin(GL_LINE_STRIP);
@@ -555,18 +555,18 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi
/* extrapolate to left? - left-side of view comes before first keyframe? */
if (prevfpt->vec[0] > v2d->cur.xmin) {
- v[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)) {
+ if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) {
/* just extend across the first keyframe's value */
- v[1]= prevfpt->vec[1];
+ v[1] = prevfpt->vec[1];
}
else {
/* extrapolate linear dosnt use the handle, use the next points center instead */
- fac= (prevfpt->vec[0]-fpt->vec[0])/(prevfpt->vec[0]-v[0]);
- if (fac) fac= 1.0f/fac;
- v[1]= prevfpt->vec[1]-fac*(prevfpt->vec[1]-fpt->vec[1]);
+ fac = (prevfpt->vec[0] - fpt->vec[0]) / (prevfpt->vec[0] - v[0]);
+ if (fac) fac = 1.0f / fac;
+ v[1] = prevfpt->vec[1] - fac * (prevfpt->vec[1] - fpt->vec[1]);
}
glVertex2fv(v);
@@ -583,7 +583,7 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi
glVertex2fv(prevfpt->vec);
/* get next pointers */
- prevfpt= fpt;
+ prevfpt = fpt;
fpt++;
/* last point? */
@@ -593,19 +593,19 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi
/* extrapolate to right? (see code for left-extrapolation above too) */
if (prevfpt->vec[0] < v2d->cur.xmax) {
- v[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)) {
+ if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) {
/* based on last keyframe's value */
- v[1]= prevfpt->vec[1];
+ v[1] = prevfpt->vec[1];
}
else {
/* extrapolate linear dosnt use the handle, use the previous points center instead */
- fpt = prevfpt-1;
- fac= (prevfpt->vec[0]-fpt->vec[0])/(prevfpt->vec[0]-v[0]);
- if (fac) fac= 1.0f/fac;
- v[1]= prevfpt->vec[1]-fac*(prevfpt->vec[1]-fpt->vec[1]);
+ fpt = prevfpt - 1;
+ fac = (prevfpt->vec[0] - fpt->vec[0]) / (prevfpt->vec[0] - v[0]);
+ if (fac) fac = 1.0f / fac;
+ v[1] = prevfpt->vec[1] - fac * (prevfpt->vec[1] - fpt->vec[1]);
}
glVertex2fv(v);
@@ -618,14 +618,14 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi
}
/* helper func - draw one repeat of an F-Curve */
-static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d)
+static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d)
{
- BezTriple *prevbezt= fcu->bezt;
- BezTriple *bezt= prevbezt+1;
+ BezTriple *prevbezt = fcu->bezt;
+ BezTriple *bezt = prevbezt + 1;
float v1[2], v2[2], v3[2], v4[2];
float *fp, data[120];
- float fac= 0.0f;
- int b= fcu->totvert-1;
+ float fac = 0.0f;
+ int b = fcu->totvert - 1;
int resol;
glBegin(GL_LINE_STRIP);
@@ -636,24 +636,24 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
/* 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;
+ 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)) {
+ if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (prevbezt->ipo == BEZT_IPO_CONST) || (fcu->totvert == 1)) {
/* just extend across the first keyframe's value */
- v1[1]= prevbezt->vec[1][1];
+ v1[1] = prevbezt->vec[1][1];
}
- else if (prevbezt->ipo==BEZT_IPO_LIN) {
+ else if (prevbezt->ipo == BEZT_IPO_LIN) {
/* extrapolate linear dosnt use the handle, use the next points center instead */
- fac= (prevbezt->vec[1][0]-bezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
- if (fac) fac= 1.0f/fac;
- v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[1][1]-bezt->vec[1][1]);
+ fac = (prevbezt->vec[1][0] - bezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
+ if (fac) fac = 1.0f / fac;
+ v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[1][1] - bezt->vec[1][1]);
}
else {
/* based on angle of handle 1 (relative to keyframe) */
- fac= (prevbezt->vec[0][0]-prevbezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
- if (fac) fac= 1.0f/fac;
- v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[0][1]-prevbezt->vec[1][1]);
+ fac = (prevbezt->vec[0][0] - prevbezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
+ if (fac) fac = 1.0f / fac;
+ v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[0][1] - prevbezt->vec[1][1]);
}
glVertex2fv(v1);
@@ -661,28 +661,28 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
/* if only one keyframe, add it now */
if (fcu->totvert == 1) {
- v1[0]= prevbezt->vec[1][0];
- v1[1]= prevbezt->vec[1][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--) {
- if (prevbezt->ipo==BEZT_IPO_CONST) {
+ if (prevbezt->ipo == BEZT_IPO_CONST) {
/* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */
- v1[0]= prevbezt->vec[1][0];
- v1[1]= prevbezt->vec[1][1];
+ 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];
+ v1[0] = bezt->vec[1][0];
+ v1[1] = prevbezt->vec[1][1];
glVertex2fv(v1);
}
- else if (prevbezt->ipo==BEZT_IPO_LIN) {
+ else if (prevbezt->ipo == BEZT_IPO_LIN) {
/* Linear interpolation: just add one point (which should add a new line segment) */
- v1[0]= prevbezt->vec[1][0];
- v1[1]= prevbezt->vec[1][1];
+ v1[0] = prevbezt->vec[1][0];
+ v1[1] = prevbezt->vec[1][1];
glVertex2fv(v1);
}
else {
@@ -693,74 +693,74 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
/* 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)
- resol= 32;
+ resol = 32;
else
- resol= (int)(5.0f*len_v2v2(bezt->vec[1], prevbezt->vec[1]));
+ resol = (int)(5.0f * len_v2v2(bezt->vec[1], prevbezt->vec[1]));
if (resol < 2) {
/* only draw one */
- v1[0]= prevbezt->vec[1][0];
- v1[1]= prevbezt->vec[1][1];
+ v1[0] = prevbezt->vec[1][0];
+ v1[1] = prevbezt->vec[1][1];
glVertex2fv(v1);
}
else {
/* clamp resolution to max of 32 */
// NOTE: higher values will crash
- if (resol > 32) resol= 32;
+ 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];
+ 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);
+ 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)
+ for (fp = data; resol; resol--, fp += 3)
glVertex2fv(fp);
}
}
/* get next pointers */
- prevbezt= bezt;
+ prevbezt = bezt;
bezt++;
/* last point? */
if (b == 0) {
- v1[0]= prevbezt->vec[1][0];
- v1[1]= prevbezt->vec[1][1];
+ v1[0] = prevbezt->vec[1][0];
+ v1[1] = prevbezt->vec[1][1];
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;
+ 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)) {
+ 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 */
- v1[1]= prevbezt->vec[1][1];
+ v1[1] = prevbezt->vec[1][1];
}
- else if (prevbezt->ipo==BEZT_IPO_LIN) {
+ else if (prevbezt->ipo == BEZT_IPO_LIN) {
/* extrapolate linear dosnt use the handle, use the previous points center instead */
- bezt = prevbezt-1;
- fac= (prevbezt->vec[1][0]-bezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
- if (fac) fac= 1.0f/fac;
- v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[1][1]-bezt->vec[1][1]);
+ bezt = prevbezt - 1;
+ fac = (prevbezt->vec[1][0] - bezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
+ if (fac) fac = 1.0f / fac;
+ v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[1][1] - bezt->vec[1][1]);
}
else {
/* based on angle of handle 1 (relative to keyframe) */
- fac= (prevbezt->vec[2][0]-prevbezt->vec[1][0])/(prevbezt->vec[1][0]-v1[0]);
- if (fac) fac= 1.0f/fac;
- v1[1]= prevbezt->vec[1][1]-fac*(prevbezt->vec[2][1]-prevbezt->vec[1][1]);
+ fac = (prevbezt->vec[2][0] - prevbezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
+ if (fac) fac = 1.0f / fac;
+ v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[2][1] - prevbezt->vec[1][1]);
}
glVertex2fv(v1);
@@ -786,13 +786,13 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
glLineWidth(3.0f);
/* anti-aliased lines for less jagged appearance */
- if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
+ 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) {
+ for (fcu = sipo->ghostCurves.first; fcu; fcu = fcu->next) {
/* set whatever color the curve has set
- * - this is set by the function which creates these
+ * - 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);
@@ -805,7 +805,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
setlinestyle(0);
glLineWidth(1.0f);
- if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -819,18 +819,18 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
int filter;
/* build list of curves to draw */
- filter= (ANIMFILTER_DATA_VISIBLE|ANIMFILTER_CURVE_VISIBLE);
+ 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
- * the data will be layered correctly
+ * 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);
+ 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)
@@ -868,7 +868,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
}
/* anti-aliased lines for less jagged appearance */
- if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
/* draw F-Curve */
@@ -890,7 +890,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
setlinestyle(0);
glLineWidth(1.0);
- if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -953,35 +953,35 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
bAnimListElem *ale;
int filter;
- View2D *v2d= &ar->v2d;
- float y= 0.0f, height;
+ View2D *v2d = &ar->v2d;
+ float y = 0.0f, height;
size_t items;
- int i=0;
+ 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);
+ 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
+ * - 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
* start of list offset, and the second is as a correction for the scrollers.
*/
- height= (float)((items*ACHANNEL_STEP) + (ACHANNEL_HEIGHT*2));
+ height = (float)((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2));
UI_view2d_totRect_set(v2d, ar->winx, height);
/* loop through channels, and set up drawing depending on their type */
- { /* first pass: just the standard GL-drawing for backdrop + text */
- y= (float)ACHANNEL_FIRST;
+ { /* first pass: just the standard GL-drawing for backdrop + text */
+ y = (float)ACHANNEL_FIRST;
- for (ale= anim_data.first, i=0; ale; ale= ale->next, i++) {
- const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF);
- const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF);
+ for (ale = anim_data.first, i = 0; ale; ale = ale->next, i++) {
+ const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF);
+ const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF);
/* check if visible */
- if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
- IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
+ if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
+ IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
{
/* draw all channels using standard channel-drawing API */
ANIM_channel_draw(ac, ale, yminc, ymaxc);
@@ -991,23 +991,23 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
y -= ACHANNEL_STEP;
}
}
- { /* second pass: widgets */
- uiBlock *block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
+ { /* second pass: widgets */
+ uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
size_t channel_index = 0;
- y= (float)ACHANNEL_FIRST;
+ y = (float)ACHANNEL_FIRST;
/* 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);
- const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF);
+ for (ale = anim_data.first, i = 0; ale; ale = ale->next, i++) {
+ const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF);
+ const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF);
/* check if visible */
- if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
- IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
+ if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
+ IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
{
/* draw all channels using standard channel-drawing API */
ANIM_channel_draw_widgets(C, ac, ale, block, yminc, ymaxc, channel_index);
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 5f8281fda5b..7371202b4fb 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -90,21 +90,21 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
int filter;
/* get data to filter, from Dopesheet */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* set large values to try to override */
- if (xmin) *xmin= 999999999.0f;
- if (xmax) *xmax= -999999999.0f;
- if (ymin) *ymin= 999999999.0f;
- if (ymax) *ymax= -999999999.0f;
+ 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) {
/* 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;
+ 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;
@@ -113,20 +113,20 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
/* apply NLA scaling */
if (adt) {
- txmin= BKE_nla_tweakedit_remap(adt, txmin, NLATIME_CONVERT_MAP);
- txmax= BKE_nla_tweakedit_remap(adt, txmax, NLATIME_CONVERT_MAP);
+ 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, 0);
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0);
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;
+ if ((xmin) && (txmin < *xmin)) *xmin = txmin;
+ if ((xmax) && (txmax > *xmax)) *xmax = txmax;
+ if ((ymin) && (tymin < *ymin)) *ymin = tymin;
+ if ((ymax) && (tymax > *ymax)) *ymax = tymax;
}
/* ensure that the extents are not too extreme that view implodes...*/
@@ -139,16 +139,16 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
else {
/* set default range */
if (ac->scene) {
- if (xmin) *xmin= (float)ac->scene->r.sfra;
- if (xmax) *xmax= (float)ac->scene->r.efra;
+ if (xmin) *xmin = (float)ac->scene->r.sfra;
+ if (xmax) *xmax = (float)ac->scene->r.efra;
}
else {
- if (xmin) *xmin= -5;
- if (xmax) *xmax= 100;
+ if (xmin) *xmin = -5;
+ if (xmax) *xmax = 100;
}
- if (ymin) *ymin= -5;
- if (ymax) *ymax= 5;
+ if (ymin) *ymin = -5;
+ if (ymax) *ymax = 5;
}
}
@@ -166,17 +166,17 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
if (ac.scene == NULL)
return OPERATOR_CANCELLED;
else
- scene= ac.scene;
+ scene = ac.scene;
/* set the range directly */
get_graph_keyframe_extents(&ac, &min, &max, NULL, NULL, FALSE);
scene->r.flag |= SCER_PRV_RANGE;
- scene->r.psfra= (int)floor(min + 0.5f);
- scene->r.pefra= (int)floor(max + 0.5f);
+ scene->r.psfra = (int)floor(min + 0.5f);
+ scene->r.pefra = (int)floor(max + 0.5f);
/* 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);
+ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, ac.scene);
return OPERATOR_FINISHED;
}
@@ -193,7 +193,7 @@ void GRAPH_OT_previewrange_set(wmOperatorType *ot)
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;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** View-All Operator ****************** */
@@ -207,16 +207,16 @@ static int graphkeys_viewall(bContext *C, const short selOnly)
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- v2d= &ac.ar->v2d;
+ v2d = &ac.ar->v2d;
/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
get_graph_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, &v2d->cur.ymin, &v2d->cur.ymax, selOnly);
- extra= 0.1f * (v2d->cur.xmax - v2d->cur.xmin);
+ extra = 0.1f * (v2d->cur.xmax - v2d->cur.xmin);
v2d->cur.xmin -= extra;
v2d->cur.xmax += extra;
- extra= 0.1f * (v2d->cur.ymax - v2d->cur.ymin);
+ extra = 0.1f * (v2d->cur.ymax - v2d->cur.ymin);
v2d->cur.ymin -= extra;
v2d->cur.ymax += extra;
@@ -255,7 +255,7 @@ void GRAPH_OT_view_all(wmOperatorType *ot)
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;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
void GRAPH_OT_view_selected(wmOperatorType *ot)
@@ -270,7 +270,7 @@ void GRAPH_OT_view_selected(wmOperatorType *ot)
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;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Create Ghost-Curves Operator *********************** */
@@ -279,9 +279,9 @@ void GRAPH_OT_view_selected(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)
+static void create_ghost_curves(bAnimContext *ac, int start, int end)
{
- SpaceIpo *sipo= (SpaceIpo *)ac->sl;
+ SpaceIpo *sipo = (SpaceIpo *)ac->sl;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
@@ -296,51 +296,51 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end)
}
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
+ 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;
- FCurve *gcu= MEM_callocN(sizeof(FCurve), "Ghost FCurve");
- AnimData *adt= ANIM_nla_mapping_get(ac, ale);
- ChannelDriver *driver= fcu->driver;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ FCurve *fcu = (FCurve *)ale->key_data;
+ FCurve *gcu = MEM_callocN(sizeof(FCurve), "Ghost FCurve");
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
+ ChannelDriver *driver = fcu->driver;
FPoint *fpt;
float unitFac;
int cfra;
/* disable driver so that it don't muck up the sampling process */
- fcu->driver= NULL;
+ fcu->driver = NULL;
/* calculate unit-mapping factor */
- unitFac= ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0);
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0);
/* 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;
+ 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);
+ 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) * unitFac;
+ fpt->vec[0] = cfrae;
+ fpt->vec[1] = fcurve_samplingcb_evalcurve(fcu, NULL, cfrae) * unitFac;
}
/* 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;
+ 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;
+ fcu->driver = driver;
}
/* admin and redraws */
@@ -360,9 +360,9 @@ static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)
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;
+ 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);
@@ -385,7 +385,7 @@ void GRAPH_OT_ghost_curves_create(wmOperatorType *ot)
ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
// todo: add props for start/end frames
}
@@ -401,7 +401,7 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- sipo= (SpaceIpo *)ac.sl;
+ sipo = (SpaceIpo *)ac.sl;
/* if no ghost curves, don't do anything */
if (sipo->ghostCurves.first == NULL)
@@ -428,7 +428,7 @@ void GRAPH_OT_ghost_curves_clear(wmOperatorType *ot)
ot->poll = ED_operator_graphedit_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************************************************************** */
@@ -451,11 +451,11 @@ static void insert_graph_keys(bAnimContext *ac, short mode)
int filter;
ReportList *reports = ac->reports;
- Scene *scene= ac->scene;
+ Scene *scene = ac->scene;
short flag = 0;
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
if (mode == 2) filter |= ANIMFILTER_SEL;
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -464,20 +464,20 @@ static void insert_graph_keys(bAnimContext *ac, short mode)
flag = ANIM_get_keyframing_flags(scene, 1);
/* insert keyframes */
- for (ale= anim_data.first; ale; ale= ale->next) {
- AnimData *adt= ANIM_nla_mapping_get(ac, ale);
- FCurve *fcu= (FCurve *)ale->key_data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
+ FCurve *fcu = (FCurve *)ale->key_data;
float cfra;
/* adjust current frame for NLA-mapping */
if (adt)
- cfra= BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
+ cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
else
- cfra= (float)CFRA;
+ cfra = (float)CFRA;
/* if there's an id */
if (ale->id)
- insert_keyframe(reports, ale->id, NULL, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
+ insert_keyframe(reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
else
insert_vert_fcurve(fcu, cfra, fcu->curval, 0);
}
@@ -497,7 +497,7 @@ static int graphkeys_insertkey_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* which channels to affect? */
- mode= RNA_enum_get(op->ptr, "type");
+ mode = RNA_enum_get(op->ptr, "type");
/* insert keyframes */
insert_graph_keys(&ac, mode);
@@ -506,7 +506,7 @@ static int graphkeys_insertkey_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -524,7 +524,7 @@ void GRAPH_OT_keyframe_insert(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_insertkey_types, 0, "Type", "");
@@ -532,7 +532,7 @@ void GRAPH_OT_keyframe_insert(wmOperatorType *ot)
/* ******************** Click-Insert Keyframes Operator ************************* */
-static int graphkeys_click_insert_exec (bContext *C, wmOperator *op)
+static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -545,7 +545,7 @@ static int graphkeys_click_insert_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get active F-Curve 'anim-list-element' */
- ale= get_active_fcurve_channel(&ac);
+ ale = get_active_fcurve_channel(&ac);
if (ELEM(NULL, ale, ale->data)) {
if (ale) MEM_freeN(ale);
return OPERATOR_CANCELLED;
@@ -557,12 +557,12 @@ static int graphkeys_click_insert_exec (bContext *C, wmOperator *op)
*/
if (fcurve_is_keyframable(fcu)) {
/* get frame and value from props */
- frame= RNA_float_get(op->ptr, "frame");
- val= RNA_float_get(op->ptr, "value");
+ 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);
+ 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 */
val *= ANIM_unit_mapping_get_factor(ac.scene, ale->id, fcu, 1);
@@ -584,13 +584,13 @@ static int graphkeys_click_insert_exec (bContext *C, wmOperator *op)
MEM_freeN(ale);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
}
-static int graphkeys_click_insert_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int graphkeys_click_insert_invoke(bContext *C, wmOperator *op, wmEvent *evt)
{
bAnimContext ac;
ARegion *ar;
@@ -603,11 +603,11 @@ static int graphkeys_click_insert_invoke (bContext *C, wmOperator *op, wmEvent *
return OPERATOR_CANCELLED;
/* store mouse coordinates in View2D space, into the operator's properties */
- ar= ac.ar;
- v2d= &ar->v2d;
+ ar = ac.ar;
+ v2d = &ar->v2d;
- mval[0]= (evt->x - ar->winrct.xmin);
- mval[1]= (evt->y - ar->winrct.ymin);
+ mval[0] = (evt->x - ar->winrct.xmin);
+ mval[1] = (evt->y - ar->winrct.ymin);
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
@@ -631,7 +631,7 @@ void GRAPH_OT_click_insert(wmOperatorType *ot)
ot->poll = graphop_active_fcurve_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ 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);
@@ -641,20 +641,20 @@ void GRAPH_OT_click_insert(wmOperatorType *ot)
/* ******************** Copy/Paste Keyframes Operator ************************* */
/* NOTE: the backend code for this is shared with the dopesheet editor */
-static short copy_graph_keys (bAnimContext *ac)
+static short copy_graph_keys(bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
- int filter, ok=0;
+ int filter, ok = 0;
/* clear buffer first */
free_anim_copybuf();
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
+ 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);
+ ok = copy_animedit_keys(ac, &anim_data);
/* clean up */
BLI_freelistN(&anim_data);
@@ -662,18 +662,18 @@ static short copy_graph_keys (bAnimContext *ac)
return ok;
}
-static short paste_graph_keys (bAnimContext *ac,
- const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode)
+static short paste_graph_keys(bAnimContext *ac,
+ const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode)
{
ListBase anim_data = {NULL, NULL};
- int filter, ok=0;
+ int filter, ok = 0;
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ 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 keyframes */
- ok= paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode);
+ ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode);
/* clean up */
BLI_freelistN(&anim_data);
@@ -713,7 +713,7 @@ void GRAPH_OT_copy(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -722,15 +722,15 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
- const eKeyPasteOffset offset_mode= RNA_enum_get(op->ptr, "offset");
- const eKeyMergeMode merge_mode= RNA_enum_get(op->ptr, "merge");
+ const eKeyPasteOffset offset_mode = RNA_enum_get(op->ptr, "offset");
+ const eKeyMergeMode merge_mode = RNA_enum_get(op->ptr, "merge");
/* 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;
+ ac.reports = op->reports;
/* paste keyframes - non-zero return means an error occurred while trying to paste */
if (paste_graph_keys(&ac, offset_mode, merge_mode)) {
@@ -741,7 +741,7 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -759,7 +759,7 @@ void GRAPH_OT_paste(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
@@ -767,18 +767,18 @@ void GRAPH_OT_paste(wmOperatorType *ot)
/* ******************** Duplicate Keyframes Operator ************************* */
-static void duplicate_graph_keys (bAnimContext *ac)
+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);
+ 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) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
duplicate_fcurve_keys((FCurve *)ale->key_data);
}
@@ -803,7 +803,7 @@ static int graphkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -828,7 +828,7 @@ void GRAPH_OT_duplicate(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* to give to transform */
RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -836,20 +836,20 @@ void GRAPH_OT_duplicate(wmOperatorType *ot)
/* ******************** Delete Keyframes Operator ************************* */
-static void delete_graph_keys (bAnimContext *ac)
+static void delete_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);
+ 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;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ FCurve *fcu = (FCurve *)ale->key_data;
+ AnimData *adt = ale->adt;
/* delete selected keyframes only */
delete_fcurve_keys(fcu);
@@ -880,7 +880,7 @@ static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -898,23 +898,23 @@ void GRAPH_OT_delete(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Clean Keyframes Operator ************************* */
-static void clean_graph_keys (bAnimContext *ac, float thresh)
+static void clean_graph_keys(bAnimContext *ac, float thresh)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
+ 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)
+ for (ale = anim_data.first; ale; ale = ale->next)
clean_fcurve((FCurve *)ale->key_data, thresh);
/* free temp data */
@@ -933,7 +933,7 @@ static int graphkeys_clean_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get cleaning threshold */
- thresh= RNA_float_get(op->ptr, "threshold");
+ thresh = RNA_float_get(op->ptr, "threshold");
/* clean keyframes */
clean_graph_keys(&ac, thresh);
@@ -942,7 +942,7 @@ static int graphkeys_clean_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -960,7 +960,7 @@ void GRAPH_OT_clean(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ 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);
@@ -970,29 +970,29 @@ void GRAPH_OT_clean(wmOperatorType *ot)
/* This operator bakes the data of the selected F-Curves to F-Points */
/* Bake each F-Curve into a set of samples */
-static void bake_graph_curves (bAnimContext *ac, int start, int end)
+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);
+ 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;
+ 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;
+ fcu->driver = NULL;
/* create samples */
fcurve_store_samples(fcu, NULL, start, end, fcurve_samplingcb_evalcurve);
/* restore driver */
- fcu->driver= driver;
+ fcu->driver = driver;
}
/* admin and redraws */
@@ -1004,7 +1004,7 @@ static void bake_graph_curves (bAnimContext *ac, int start, int end)
static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
- Scene *scene= NULL;
+ Scene *scene = NULL;
int start, end;
/* get editor data */
@@ -1013,9 +1013,9 @@ static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op))
/* for now, init start/end from preview-range extents */
// TODO: add properties for this
- scene= ac.scene;
- start= PSFRA;
- end= PEFRA;
+ scene = ac.scene;
+ start = PSFRA;
+ end = PEFRA;
/* bake keyframes */
bake_graph_curves(&ac, start, end);
@@ -1025,7 +1025,7 @@ static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op))
/* 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);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -1043,7 +1043,7 @@ void GRAPH_OT_bake(wmOperatorType *ot)
ot->poll = graphop_selected_fcurve_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
// todo: add props for start/end frames
}
@@ -1069,9 +1069,9 @@ typedef struct tSoundBakeInfo {
/* Sampling callback used to determine the value from the sound to
* save in the F-Curve at the specified frame
*/
-static float fcurve_samplingcb_sound (FCurve *UNUSED(fcu), void *data, float evaltime)
+static float fcurve_samplingcb_sound(FCurve *UNUSED(fcu), void *data, float evaltime)
{
- tSoundBakeInfo *sbi= (tSoundBakeInfo *)data;
+ tSoundBakeInfo *sbi = (tSoundBakeInfo *)data;
int position = evaltime - sbi->cfra;
if ((position < 0) || (position >= sbi->length))
@@ -1090,7 +1090,7 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
int filter;
tSoundBakeInfo sbi;
- Scene *scene= NULL;
+ Scene *scene = NULL;
int start, end;
char path[FILE_MAX];
@@ -1101,20 +1101,20 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
- scene= ac.scene; /* current scene */
+ scene = ac.scene; /* current scene */
/* store necessary data for the baking steps */
sbi.samples = AUD_readSoundBuffer(path,
- RNA_float_get(op->ptr, "low"),
- RNA_float_get(op->ptr, "high"),
- RNA_float_get(op->ptr, "attack"),
- RNA_float_get(op->ptr, "release"),
- RNA_float_get(op->ptr, "threshold"),
- RNA_boolean_get(op->ptr, "accumulate"),
- RNA_boolean_get(op->ptr, "use_additive"),
- RNA_boolean_get(op->ptr, "square"),
- RNA_float_get(op->ptr, "sthreshold"),
- FPS, &sbi.length);
+ RNA_float_get(op->ptr, "low"),
+ RNA_float_get(op->ptr, "high"),
+ RNA_float_get(op->ptr, "attack"),
+ RNA_float_get(op->ptr, "release"),
+ RNA_float_get(op->ptr, "threshold"),
+ RNA_boolean_get(op->ptr, "accumulate"),
+ RNA_boolean_get(op->ptr, "use_additive"),
+ RNA_boolean_get(op->ptr, "square"),
+ RNA_float_get(op->ptr, "sthreshold"),
+ FPS, &sbi.length);
if (sbi.samples == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
@@ -1126,12 +1126,12 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
end = CFRA + sbi.length - 1;
/* filter anim channels */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ 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 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;
+ 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);
@@ -1147,7 +1147,7 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that 'keyframes' have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -1163,7 +1163,7 @@ static int graphkeys_sound_bake_exec(bContext *UNUSED(C), wmOperator *op)
#endif //WITH_AUDASPACE
-static int graphkeys_sound_bake_invoke (bContext *C, wmOperator *op, wmEvent *event)
+static int graphkeys_sound_bake_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
bAnimContext ac;
@@ -1187,10 +1187,10 @@ void GRAPH_OT_sound_bake(wmOperatorType *ot)
ot->poll = graphop_selected_fcurve_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+ WM_operator_properties_filesel(ot, FOLDERFILE | SOUNDFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency", "", 0.1, 1000.00);
RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency", "", 0.1, 1000.00);
RNA_def_float(ot->srna, "attack", 0.005, 0.0, 2.0, "Attack time", "", 0.01, 0.1);
@@ -1208,18 +1208,18 @@ 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)
+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);
+ 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)
+ for (ale = anim_data.first; ale; ale = ale->next)
sample_fcurve((FCurve *)ale->key_data);
/* admin and redraws */
@@ -1243,7 +1243,7 @@ static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -1260,7 +1260,7 @@ void GRAPH_OT_sample(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1270,8 +1270,8 @@ void GRAPH_OT_sample(wmOperatorType *ot)
/* ******************** Set Extrapolation-Type Operator *********************** */
/* defines for make/clear cyclic extrapolation tools */
-#define MAKE_CYCLIC_EXPO -1
-#define CLEAR_CYCLIC_EXPO -2
+#define MAKE_CYCLIC_EXPO -1
+#define CLEAR_CYCLIC_EXPO -2
/* defines for set extrapolation-type for selected keyframes tool */
static EnumPropertyItem prop_graphkeys_expo_types[] = {
@@ -1291,16 +1291,16 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode)
int filter;
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ 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;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ FCurve *fcu = (FCurve *)ale->data;
if (mode >= 0) {
/* just set mode setting */
- fcu->extend= mode;
+ fcu->extend = mode;
}
else {
/* shortcuts for managing Cycles F-Modifiers to make it easier to toggle cyclic animation
@@ -1315,7 +1315,7 @@ 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;
+ FModifier *fcm, *fcn = NULL;
for (fcm = fcu->modifiers.first; fcm; fcm = fcn) {
fcn = fcm->next;
@@ -1343,7 +1343,7 @@ static int graphkeys_expo_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get handle setting mode */
- mode= RNA_enum_get(op->ptr, "type");
+ mode = RNA_enum_get(op->ptr, "type");
/* set handle type */
setexpo_graph_keys(&ac, mode);
@@ -1352,7 +1352,7 @@ static int graphkeys_expo_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframe properties have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
return OPERATOR_FINISHED;
}
@@ -1370,7 +1370,7 @@ void GRAPH_OT_extrapolation_type(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_expo_types, 0, "Type", "");
@@ -1384,16 +1384,16 @@ 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);
+ KeyframeEditFunc set_cb = ANIM_editkeyframes_ipo(mode);
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ 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...
*/
- for (ale= anim_data.first; ale; ale= ale->next)
+ for (ale = anim_data.first; ale; ale = ale->next)
ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve);
/* cleanup */
@@ -1412,7 +1412,7 @@ static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get handle setting mode */
- mode= RNA_enum_get(op->ptr, "type");
+ mode = RNA_enum_get(op->ptr, "type");
/* set handle type */
setipo_graph_keys(&ac, mode);
@@ -1421,7 +1421,7 @@ static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframe properties have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
return OPERATOR_FINISHED;
}
@@ -1439,7 +1439,7 @@ void GRAPH_OT_interpolation_type(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
@@ -1454,18 +1454,18 @@ static void sethandles_graph_keys(bAnimContext *ac, short mode)
bAnimListElem *ale;
int filter;
- KeyframeEditFunc edit_cb= ANIM_editkeyframes_handles(mode);
- KeyframeEditFunc sel_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
+ 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);
+ 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
* 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;
+ 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)) {
@@ -1489,7 +1489,7 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get handle setting mode */
- mode= RNA_enum_get(op->ptr, "type");
+ mode = RNA_enum_get(op->ptr, "type");
/* set handle type */
sethandles_graph_keys(&ac, mode);
@@ -1498,12 +1498,12 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframe properties have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
return OPERATOR_FINISHED;
}
- void GRAPH_OT_handle_type (wmOperatorType *ot)
+void GRAPH_OT_handle_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Handle Type";
@@ -1516,7 +1516,7 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
@@ -1536,39 +1536,39 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
typedef struct tEulerFilter {
struct tEulerFilter *next, *prev;
- ID *id; /* ID-block which owns the channels */
- FCurve *(fcurves[3]); /* 3 Pointers to F-Curves */
- char *rna_path; /* Pointer to one of the RNA Path's used by one of the F-Curves */
+ ID *id; /* ID-block which owns the channels */
+ FCurve *(fcurves[3]); /* 3 Pointers to F-Curves */
+ 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)
+static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
ListBase eulers = {NULL, NULL};
- tEulerFilter *euf= NULL;
- int groups=0, failed=0;
+ 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,
+ * 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
+ * processed as necessary
*/
/* step 1: extract only the rotation f-curves */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ 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) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->data;
/* check if this is an appropriate F-Curve
@@ -1579,8 +1579,8 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
continue;
else if (ELEM3(fcu->array_index, 0, 1, 2) == 0) {
BKE_reportf(op->reports, RPT_WARNING,
- "Euler Rotation F-Curve has invalid index (ID='%s', Path='%s', Index=%d)",
- (ale->id)? ale->id->name:"<No ID>", fcu->rna_path, fcu->array_index);
+ "Euler Rotation F-Curve has invalid index (ID='%s', Path='%s', Index=%d)",
+ (ale->id) ? ale->id->name : "<No ID>", fcu->rna_path, fcu->array_index);
continue;
}
@@ -1588,19 +1588,19 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
* 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) && (strcmp(euf->rna_path, fcu->rna_path)==0)) {
+ if ((euf) && (euf->id == ale->id) && (strcmp(euf->rna_path, fcu->rna_path) == 0)) {
/* this should be fine to add to the existing group then */
- euf->fcurves[fcu->array_index]= fcu;
+ euf->fcurves[fcu->array_index] = fcu;
}
else {
/* just add to a new block */
- euf= MEM_callocN(sizeof(tEulerFilter), "tEulerFilter");
+ euf = MEM_callocN(sizeof(tEulerFilter), "tEulerFilter");
BLI_addtail(&eulers, euf);
groups++;
- euf->id= ale->id;
+ 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;
+ euf->fcurves[fcu->array_index] = fcu;
}
}
BLI_freelistN(&anim_data);
@@ -1613,7 +1613,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
/* 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) {
+ 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 */
@@ -1621,11 +1621,11 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
if (ELEM3(NULL, euf->fcurves[0], euf->fcurves[1], euf->fcurves[2])) {
/* report which components are missing */
BKE_reportf(op->reports, RPT_WARNING,
- "Missing %s%s%s component(s) of euler rotation for ID='%s' and RNA-Path='%s'",
- (euf->fcurves[0]==NULL)? "X":"",
- (euf->fcurves[1]==NULL)? "Y":"",
- (euf->fcurves[2]==NULL)? "Z":"",
- euf->id->name, euf->rna_path);
+ "Missing %s%s%s component(s) of euler rotation for ID='%s' and RNA-Path='%s'",
+ (euf->fcurves[0] == NULL) ? "X" : "",
+ (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++;
@@ -1636,7 +1636,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
// FIXME: there are more complicated methods that will be needed to fix more cases than just some
for (f = 0; f < 3; f++) {
FCurve *fcu = euf->fcurves[f];
- BezTriple *bezt, *prev=NULL;
+ BezTriple *bezt, *prev = NULL;
unsigned int i;
/* skip if not enough vets to do a decent analysis of... */
@@ -1644,7 +1644,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
continue;
/* prev follows bezt, bezt = "current" point to be fixed */
- for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, prev=bezt, bezt++) {
+ for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, prev = bezt, bezt++) {
/* our method depends on determining a "difference" from the previous vert */
if (prev == NULL)
continue;
@@ -1661,7 +1661,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
bezt->vec[2][1] += fac;
}
}
- else /* if (prev->vec[1][1] < bezt->vec[1][1]) */ {
+ else { /* if (prev->vec[1][1] < bezt->vec[1][1]) */
while (fabsf(bezt->vec[1][1] - prev->vec[1][1]) >= (float)M_PI) {
bezt->vec[0][1] -= fac;
bezt->vec[1][1] -= fac;
@@ -1677,20 +1677,20 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
/* updates + finishing warnings */
if (failed == groups) {
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");
+ "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;
}
else {
if (failed) {
BKE_report(op->reports, RPT_ERROR,
- "Some Euler Rotations couldn't be corrected due to missing/unselected/out-of-order F-Curves, ensure each rotation has keys for all components, and that F-Curves for these are in consecutive XYZ order and selected");
+ "Some Euler Rotations couldn't be corrected due to missing/unselected/out-of-order F-Curves, ensure each rotation has keys for all components, and that F-Curves for these are in consecutive XYZ order and selected");
}
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
/* done at last */
return OPERATOR_FINISHED;
@@ -1709,7 +1709,7 @@ void GRAPH_OT_euler_filter(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ***************** Jump to Selected Frames Operator *********************** */
@@ -1718,7 +1718,7 @@ void GRAPH_OT_euler_filter(wmOperatorType *ot)
static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
KeyframeEditData ked;
@@ -1731,11 +1731,11 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
memset(&ked, 0, sizeof(KeyframeEditData));
/* loop over action data, averaging values */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
+ 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);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
/* apply unit corrections */
ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS);
@@ -1749,24 +1749,24 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_calc_average, NULL);
/* unapply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE|ANIM_UNITCONV_ONLYKEYS);
+ ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE | ANIM_UNITCONV_ONLYKEYS);
}
BLI_freelistN(&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;
+ SpaceIpo *sipo = (SpaceIpo *)ac.sl;
+ Scene *scene = ac.scene;
/* take the average values, rounding to the nearest int for the current frame */
- CFRA= (int)floor((ked.f1 / ked.i1) + 0.5f);
- SUBFRA= 0.f;
- sipo->cursorVal= ked.f2 / (float)ked.i1;
+ CFRA = (int)floor((ked.f1 / ked.i1) + 0.5f);
+ SUBFRA = 0.f;
+ sipo->cursorVal = ked.f2 / (float)ked.i1;
}
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, ac.scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, ac.scene);
return OPERATOR_FINISHED;
}
@@ -1783,7 +1783,7 @@ void GRAPH_OT_frame_jump(wmOperatorType *ot)
ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Snap Keyframes Operator *********************** */
@@ -1810,26 +1810,26 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
KeyframeEditFunc edit_cb;
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing callbacks */
- edit_cb= ANIM_editkeyframes_snap(mode);
+ edit_cb = ANIM_editkeyframes_snap(mode);
memset(&ked, 0, sizeof(KeyframeEditData));
- ked.scene= ac->scene;
+ ked.scene = ac->scene;
if (mode == GRAPHKEYS_SNAP_NEAREST_MARKER) {
- ked.list.first= (ac->markers) ? ac->markers->first : NULL;
- ked.list.last= (ac->markers) ? ac->markers->last : NULL;
+ ked.list.first = (ac->markers) ? ac->markers->first : NULL;
+ ked.list.last = (ac->markers) ? ac->markers->last : NULL;
}
else if (mode == GRAPHKEYS_SNAP_VALUE) {
- SpaceIpo *sipo= (SpaceIpo *)ac->sl;
- ked.f1= (sipo) ? sipo->cursorVal : 0.0f;
+ SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ ked.f1 = (sipo) ? sipo->cursorVal : 0.0f;
}
/* snap keyframes */
- for (ale= anim_data.first; ale; ale= ale->next) {
- AnimData *adt= ANIM_nla_mapping_get(ac, ale);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
/* apply unit corrections */
ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0);
@@ -1861,7 +1861,7 @@ static int graphkeys_snap_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get snapping mode */
- mode= RNA_enum_get(op->ptr, "type");
+ mode = RNA_enum_get(op->ptr, "type");
/* snap keyframes */
snap_graph_keys(&ac, mode);
@@ -1870,7 +1870,7 @@ static int graphkeys_snap_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -1888,7 +1888,7 @@ void GRAPH_OT_snap(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_snap_types, 0, "Type", "");
@@ -1917,37 +1917,37 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
KeyframeEditFunc edit_cb;
/* get beztriple editing callbacks */
- edit_cb= ANIM_editkeyframes_mirror(mode);
+ edit_cb = ANIM_editkeyframes_mirror(mode);
memset(&ked, 0, sizeof(KeyframeEditData));
- ked.scene= ac->scene;
+ ked.scene = ac->scene;
/* for 'first selected marker' mode, need to find first selected marker first! */
// XXX should this be made into a helper func in the API?
if (mode == GRAPHKEYS_MIRROR_MARKER) {
- TimeMarker *marker= NULL;
+ TimeMarker *marker = NULL;
/* find first selected marker */
- marker= ED_markers_get_first_selected(ac->markers);
+ marker = ED_markers_get_first_selected(ac->markers);
/* store marker's time (if available) */
if (marker)
- ked.f1= (float)marker->frame;
+ ked.f1 = (float)marker->frame;
else
return;
}
else if (mode == GRAPHKEYS_MIRROR_VALUE) {
- SpaceIpo *sipo= (SpaceIpo *)ac->sl;
- ked.f1= (sipo) ? sipo->cursorVal : 0.0f;
+ SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ ked.f1 = (sipo) ? sipo->cursorVal : 0.0f;
}
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ 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);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
/* apply unit corrections */
ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS);
@@ -1961,7 +1961,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
/* unapply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS|ANIM_UNITCONV_RESTORE);
+ ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS | ANIM_UNITCONV_RESTORE);
}
BLI_freelistN(&anim_data);
@@ -1979,7 +1979,7 @@ static int graphkeys_mirror_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get mirroring mode */
- mode= RNA_enum_get(op->ptr, "type");
+ mode = RNA_enum_get(op->ptr, "type");
/* mirror keyframes */
mirror_graph_keys(&ac, mode);
@@ -1988,7 +1988,7 @@ static int graphkeys_mirror_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -2006,7 +2006,7 @@ void GRAPH_OT_mirror(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_mirror_types, 0, "Type", "");
@@ -2026,11 +2026,11 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ 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 (ale = anim_data.first; ale; ale = ale->next) {
/* For now, we can only smooth by flattening handles AND smoothing curve values.
* Perhaps the mode argument could be removed, as that functionality is offerred through
* Snap->Flatten Handles anyway.
@@ -2043,7 +2043,7 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -2060,7 +2060,7 @@ void GRAPH_OT_smooth(wmOperatorType *ot)
ot->poll = graphop_editable_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************************************************************** */
@@ -2069,19 +2069,19 @@ void GRAPH_OT_smooth(wmOperatorType *ot)
/* ******************** Add F-Modifier Operator *********************** */
/* present a special customised popup menu for this, with some filtering */
-static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int graph_fmodifier_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
wmOperatorType *ot = WM_operatortype_find("GRAPH_OT_fmodifier_add", 1);
uiPopupMenu *pup;
uiLayout *layout;
int i;
- pup= uiPupMenuBegin(C, IFACE_("Add F-Curve Modifier"), ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, IFACE_("Add F-Curve Modifier"), ICON_NONE);
+ layout = uiPupMenuLayout(pup);
/* start from 1 to skip the 'Invalid' modifier type */
for (i = 1; i < FMODIFIER_NUM_TYPES; i++) {
- FModifierTypeInfo *fmi= get_fmodifier_typeinfo(i);
+ FModifierTypeInfo *fmi = get_fmodifier_typeinfo(i);
PointerRNA props_ptr;
/* check if modifier is valid for this context */
@@ -2089,11 +2089,11 @@ static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNU
continue;
/* create operator menu item with relevant properties filled in */
- props_ptr= uiItemFullO_ptr(layout, ot, IFACE_(fmi->name), ICON_NONE,
- NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
- /* the only thing that gets set from the menu is the type of F-Modifier to add */
+ props_ptr = uiItemFullO_ptr(layout, ot, IFACE_(fmi->name), ICON_NONE,
+ NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
+ /* the only thing that gets set from the menu is the type of F-Modifier to add */
RNA_enum_set(&props_ptr, "type", i);
- /* the following properties are just repeats of existing ones... */
+ /* the following properties are just repeats of existing ones... */
RNA_boolean_set(&props_ptr, "only_active", RNA_boolean_get(op->ptr, "only_active"));
}
uiItemS(layout);
@@ -2116,23 +2116,23 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get type of modifier to add */
- type= RNA_enum_get(op->ptr, "type");
+ type = RNA_enum_get(op->ptr, "type");
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
if (RNA_boolean_get(op->ptr, "only_active"))
- filter |= ANIMFILTER_ACTIVE; // FIXME: enforce in this case only a single channel to get handled?
+ filter |= ANIMFILTER_ACTIVE; // FIXME: enforce in this case only a single channel to get handled?
else
- filter |= (ANIMFILTER_SEL|ANIMFILTER_CURVE_VISIBLE);
+ 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;
+ 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);
+ fcm = add_fmodifier(&fcu->modifiers, type);
if (fcm)
set_active_fmodifier(&fcu->modifiers, fcm);
else {
@@ -2165,7 +2165,7 @@ void GRAPH_OT_fmodifier_add(wmOperatorType *ot)
ot->poll = graphop_selected_fcurve_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
@@ -2188,14 +2188,14 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
free_fmodifiers_copybuf();
/* get the active F-Curve */
- ale= get_active_fcurve_channel(&ac);
+ 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;
+ 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);
+ ok = ANIM_fmodifiers_copy_to_buf(&fcu->modifiers, 0);
/* free temp data now */
MEM_freeN(ale);
@@ -2222,7 +2222,7 @@ void GRAPH_OT_fmodifier_copy(wmOperatorType *ot)
ot->poll = graphop_active_fcurve_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ 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");
@@ -2235,19 +2235,19 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- int filter, ok=0;
+ int filter, ok = 0;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
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;
+ FCurve *fcu = (FCurve *)ale->data;
// TODO: do we want to replace existing modifiers? add user pref for that!
ok += ANIM_fmodifiers_paste_from_buf(&fcu->modifiers, 0);
@@ -2262,7 +2262,7 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -2284,7 +2284,7 @@ void GRAPH_OT_fmodifier_paste(wmOperatorType *ot)
ot->poll = graphop_active_fcurve_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************************************************************** */
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index d7274b07985..47b55ae90ab 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -70,14 +70,14 @@ void GRAPH_OT_clickselect(struct wmOperatorType *ot);
/* defines for left-right select tool */
enum {
- GRAPHKEYS_LRSEL_TEST = 0,
+ GRAPHKEYS_LRSEL_TEST = 0,
GRAPHKEYS_LRSEL_LEFT,
GRAPHKEYS_LRSEL_RIGHT
} eGraphKeys_LeftRightSelect_Mode;
/* defines for column-select mode */
enum {
- GRAPHKEYS_COLUMNSEL_KEYS = 0,
+ GRAPHKEYS_COLUMNSEL_KEYS = 0,
GRAPHKEYS_COLUMNSEL_CFRA,
GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN,
GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN,
@@ -86,7 +86,7 @@ enum {
/* ***************************************** */
/* graph_edit.c */
-void get_graph_keyframe_extents (struct bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, const short do_selected);
+void get_graph_keyframe_extents(struct bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, const short do_selected);
void GRAPH_OT_previewrange_set(struct wmOperatorType *ot);
void GRAPH_OT_view_all(struct wmOperatorType *ot);
@@ -172,4 +172,3 @@ void graphedit_operatortypes(void);
#endif /* __GRAPH_INTERN_H__ */
-
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 49c56ec75e4..62aebcb4edc 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -69,22 +69,22 @@
/* Set the new frame number */
static void graphview_cursor_apply(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- SpaceIpo *sipo= CTX_wm_space_graph(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ SpaceIpo *sipo = CTX_wm_space_graph(C);
/* adjust the frame
* NOTE: sync this part of the code with ANIM_OT_change_frame
*/
- CFRA= RNA_int_get(op->ptr, "frame");
- SUBFRA=0.f;
+ CFRA = RNA_int_get(op->ptr, "frame");
+ SUBFRA = 0.f;
sound_seek_scene(bmain, scene);
/* set the cursor value */
- sipo->cursorVal= RNA_float_get(op->ptr, "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);
+ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
}
/* ... */
@@ -101,7 +101,7 @@ static int graphview_cursor_exec(bContext *C, wmOperator *op)
/* set the operator properties from the initial event */
static void graphview_cursor_setprops(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
+ ARegion *ar = CTX_wm_region(C);
float viewx, viewy;
/* abort if not active region (should not really be possible) */
@@ -112,8 +112,8 @@ static void graphview_cursor_setprops(bContext *C, wmOperator *op, wmEvent *even
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
/* store the values in the operator properties */
- /* frame is rounded to the nearest int, since frames are ints */
- RNA_int_set(op->ptr, "frame", (int)floor(viewx+0.5f));
+ /* frame is rounded to the nearest int, since frames are ints */
+ RNA_int_set(op->ptr, "frame", (int)floor(viewx + 0.5f));
RNA_float_set(op->ptr, "value", viewy);
}
@@ -153,7 +153,7 @@ static int graphview_cursor_modal(bContext *C, wmOperator *op, wmEvent *event)
/* 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 (event->val == KM_RELEASE)
return OPERATOR_FINISHED;
break;
}
@@ -175,7 +175,7 @@ static void GRAPH_OT_cursor_set(wmOperatorType *ot)
ot->poll = ED_operator_graphedit_active;
/* flags */
- ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO;
+ ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;
/* rna */
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
@@ -198,7 +198,7 @@ void graphedit_operatortypes(void)
WM_operatortype_append(GRAPH_OT_ghost_curves_clear);
/* keyframes */
- /* selection */
+ /* selection */
WM_operatortype_append(GRAPH_OT_clickselect);
WM_operatortype_append(GRAPH_OT_select_all_toggle);
WM_operatortype_append(GRAPH_OT_select_border);
@@ -208,7 +208,7 @@ void graphedit_operatortypes(void)
WM_operatortype_append(GRAPH_OT_select_less);
WM_operatortype_append(GRAPH_OT_select_leftright);
- /* editing */
+ /* editing */
WM_operatortype_append(GRAPH_OT_snap);
WM_operatortype_append(GRAPH_OT_mirror);
WM_operatortype_append(GRAPH_OT_frame_jump);
@@ -243,7 +243,7 @@ void ED_operatormacros_graph(void)
ot = WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate",
"Make a copy of all selected keyframes and move them",
- OPTYPE_UNDO|OPTYPE_REGISTER);
+ OPTYPE_UNDO | OPTYPE_REGISTER);
if (ot) {
WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
@@ -254,7 +254,7 @@ void ED_operatormacros_graph(void)
/* ************************** registration - keymaps **********************************/
-static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
+static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
{
wmKeyMapItem *kmi;
@@ -262,95 +262,95 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
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");
- /* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons
- * This keymap is supposed to override ANIM_OT_change_frame, which does the same except it doesn't do y-values
- */
+ /* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons
+ * 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 */
+ /* click-select */
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_boolean_set(kmi->ptr, "curves", FALSE);
- RNA_boolean_set(kmi->ptr, "column", FALSE);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_boolean_set(kmi->ptr, "curves", FALSE);
+ RNA_boolean_set(kmi->ptr, "column", FALSE);
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_boolean_set(kmi->ptr, "curves", FALSE);
- RNA_boolean_set(kmi->ptr, "column", TRUE);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_boolean_set(kmi->ptr, "curves", FALSE);
+ RNA_boolean_set(kmi->ptr, "column", TRUE);
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "extend", TRUE);
- RNA_boolean_set(kmi->ptr, "curves", FALSE);
- RNA_boolean_set(kmi->ptr, "column", FALSE);
- kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "extend", TRUE);
- RNA_boolean_set(kmi->ptr, "curves", FALSE);
- RNA_boolean_set(kmi->ptr, "column", TRUE);
- kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_boolean_set(kmi->ptr, "curves", TRUE);
- RNA_boolean_set(kmi->ptr, "column", FALSE);
- kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT|KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "extend", TRUE);
- RNA_boolean_set(kmi->ptr, "curves", TRUE);
- RNA_boolean_set(kmi->ptr, "column", FALSE);
+ RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ RNA_boolean_set(kmi->ptr, "curves", FALSE);
+ RNA_boolean_set(kmi->ptr, "column", FALSE);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT | KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ RNA_boolean_set(kmi->ptr, "curves", FALSE);
+ RNA_boolean_set(kmi->ptr, "column", TRUE);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_boolean_set(kmi->ptr, "curves", TRUE);
+ RNA_boolean_set(kmi->ptr, "column", FALSE);
+ kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT | KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ RNA_boolean_set(kmi->ptr, "curves", TRUE);
+ RNA_boolean_set(kmi->ptr, "column", FALSE);
/* 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);
- RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_TEST);
- 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);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_TEST);
+ 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);
+ 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);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
- /* deselect all */
+ /* 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);
+ 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);
+ RNA_boolean_set(kmi->ptr, "invert", TRUE);
- /* borderselect */
+ /* borderselect */
kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "axis_range", FALSE);
- RNA_boolean_set(kmi->ptr, "include_handles", FALSE);
+ RNA_boolean_set(kmi->ptr, "axis_range", FALSE);
+ RNA_boolean_set(kmi->ptr, "include_handles", FALSE);
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);
+ 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);
+ 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);
- /* column select */
+ /* 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 */
+ /* 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 */
+ /* select linked */
WM_keymap_add_item(keymap, "GRAPH_OT_select_linked", LKEY, KM_PRESS, 0, 0);
/* graph_edit.c */
- /* snap - current frame to selected keys */
- // TODO: maybe since this is called jump, we're better to have it on <something>-J?
- WM_keymap_add_item(keymap, "GRAPH_OT_frame_jump", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ /* snap - current frame to selected keys */
+ // TODO: maybe since this is called jump, we're better to have it on <something>-J?
+ WM_keymap_add_item(keymap, "GRAPH_OT_frame_jump", SKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
- /* menu + single-step transform */
+ /* 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);
@@ -358,7 +358,7 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
WM_keymap_add_item(keymap, "GRAPH_OT_interpolation_type", TKEY, KM_PRESS, 0, 0);
- /* destructive */
+ /* destructive */
WM_keymap_add_item(keymap, "GRAPH_OT_clean", OKEY, KM_PRESS, 0, 0);
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);
@@ -370,27 +370,27 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
WM_keymap_add_item(keymap, "GRAPH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
- /* insertkey */
+ /* insertkey */
WM_keymap_add_item(keymap, "GRAPH_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
- /* copy/paste */
+ /* 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);
- /* auto-set range */
- WM_keymap_add_item(keymap, "GRAPH_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ /* auto-set range */
+ WM_keymap_add_item(keymap, "GRAPH_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "GRAPH_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
- /* F-Modifiers */
- kmi = WM_keymap_add_item(keymap, "GRAPH_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ /* 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...
- */
+ /* 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 */
@@ -409,7 +409,7 @@ void graphedit_keymap(wmKeyConfig *keyconf)
/* 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 */
+ /* extrapolation works on channels, not keys */
WM_keymap_add_item(keymap, "GRAPH_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
/* channels */
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 7c72fa0834d..33e32363cf5 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -76,48 +76,48 @@
/* Deselects keyframes in the Graph Editor
* - This is called by the deselect all operator, as well as other ones!
*
- * - test: check if select or deselect all
+ * - test: check if select or deselect all
* - sel: how to select keyframes
* 0 = deselect
* 1 = select
* 2 = invert
* - do_channels: whether to affect selection status of channels
*/
-static void deselect_graph_keys (bAnimContext *ac, short test, short sel, short do_channels)
+static void deselect_graph_keys(bAnimContext *ac, short test, short sel, short do_channels)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo= (SpaceIpo *)ac->sl;
- KeyframeEditData ked= {{NULL}};
+ 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 = (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);
+ 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) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
if (ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, test_cb, NULL)) {
- sel= SELECT_SUBTRACT;
+ sel = SELECT_SUBTRACT;
break;
}
}
}
/* convert sel to selectmode, and use that to get editor */
- sel_cb= ANIM_editkeyframes_select(sel);
+ 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;
+ 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);
@@ -161,7 +161,7 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
deselect_graph_keys(&ac, 1, SELECT_ADD, TRUE);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -178,7 +178,7 @@ void GRAPH_OT_select_all_toggle(wmOperatorType *ot)
ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
/* props */
ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
@@ -186,7 +186,7 @@ void GRAPH_OT_select_all_toggle(wmOperatorType *ot)
/* ******************** Border Select Operator **************************** */
/* This operator currently works in one of three ways:
- * -> BKEY - 1) all keyframes within region are selected (validation with BEZT_OK_REGION)
+ * -> BKEY - 1) all keyframes within region are selected (validation with BEZT_OK_REGION)
* -> ALT-BKEY - depending on which axis of the region was larger...
* -> 2) x-axis, so select all frames within frame range (validation with BEZT_OK_FRAMERANGE)
* -> 3) y-axis, so select all frames within channels that region included (validation with BEZT_OK_VALUERANGE)
@@ -197,16 +197,16 @@ void GRAPH_OT_select_all_toggle(wmOperatorType *ot)
* this, and allow handles to be considered independently too.
* Also, for convenience, handles should get same status as keyframe (if it was within bounds).
*/
-static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, short selectmode, short incl_handles)
+static void borderselect_graphkeys(bAnimContext *ac, rcti rect, short mode, short selectmode, short incl_handles)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter, mapping_flag;
- SpaceIpo *sipo= (SpaceIpo *)ac->sl;
+ SpaceIpo *sipo = (SpaceIpo *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc ok_cb, select_cb;
- View2D *v2d= &ac->ar->v2d;
+ View2D *v2d = &ac->ar->v2d;
rctf rectf;
/* convert mouse coordinates to frame ranges and channel coordinates corrected for view pan/zoom */
@@ -214,29 +214,29 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
+ 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);
+ select_cb = ANIM_editkeyframes_select(selectmode);
+ ok_cb = ANIM_editkeyframes_ok(mode);
/* init editing data */
memset(&ked, 0, sizeof(KeyframeEditData));
- ked.data= &rectf;
+ ked.data = &rectf;
/* treat handles separately? */
if (incl_handles) {
ked.iterflags |= KEYFRAME_ITER_INCL_HANDLES;
- mapping_flag= 0;
+ mapping_flag = 0;
}
else
- mapping_flag= ANIM_UNITCONV_ONLYKEYS;
+ mapping_flag = ANIM_UNITCONV_ONLYKEYS;
/* 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;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
+ FCurve *fcu = (FCurve *)ale->key_data;
/* apply unit corrections */
ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, mapping_flag);
@@ -245,19 +245,19 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
* guess when a callback might use something different
*/
if (adt)
- ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, incl_handles==0);
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, incl_handles == 0);
/* 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)
+ * (which uses ked.data, i.e. rectf)
*/
if (mode != BEZT_OK_VALUERANGE) {
- ked.f1= rectf.xmin;
- ked.f2= rectf.xmax;
+ ked.f1 = rectf.xmin;
+ ked.f2 = rectf.xmax;
}
else {
- ked.f1= rectf.ymin;
- ked.f2= rectf.ymax;
+ ked.f1 = rectf.ymin;
+ ked.f2 = rectf.ymax;
}
/* firstly, check if any keyframes will be hit by this */
@@ -275,10 +275,10 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
/* un-apply NLA mapping from all the keyframes */
if (adt)
- ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, incl_handles==0);
+ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, incl_handles == 0);
/* unapply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE|mapping_flag);
+ ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE | mapping_flag);
}
/* cleanup */
@@ -291,7 +291,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
rcti rect;
- short mode=0, selectmode=0;
+ short mode = 0, selectmode = 0;
short incl_handles;
int extend;
@@ -300,7 +300,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* clear all selection if not extending selection */
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (!extend)
deselect_graph_keys(&ac, 1, SELECT_SUBTRACT, TRUE);
@@ -308,10 +308,10 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
* - 'gesture_mode' from the operator specifies how to select
* - 'include_handles' from the operator specifies whether to include handles in the selection
*/
- if (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT)
- selectmode= SELECT_ADD;
+ if (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT)
+ selectmode = SELECT_ADD;
else
- selectmode= SELECT_SUBTRACT;
+ selectmode = SELECT_SUBTRACT;
incl_handles = RNA_boolean_get(op->ptr, "include_handles");
@@ -329,18 +329,18 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
* used for tweaking timing when "blocking", while channels is not that useful...
*/
if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
- mode= BEZT_OK_FRAMERANGE;
+ mode = BEZT_OK_FRAMERANGE;
else
- mode= BEZT_OK_VALUERANGE;
+ mode = BEZT_OK_VALUERANGE;
}
else
- mode= BEZT_OK_REGION;
+ mode = BEZT_OK_REGION;
/* apply borderselect action */
borderselect_graphkeys(&ac, rect, mode, selectmode, incl_handles);
/* send notifier that keyframe selection has changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -361,7 +361,7 @@ void GRAPH_OT_select_border(wmOperatorType *ot)
ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -392,14 +392,14 @@ static EnumPropertyItem prop_column_select_types[] = {
/* 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
* should de-duplicate - campbell */
-static void markers_selectkeys_between (bAnimContext *ac)
+static void markers_selectkeys_between(bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
KeyframeEditFunc ok_cb, select_cb;
- KeyframeEditData ked= {{NULL}};
+ KeyframeEditData ked = {{NULL}};
float min, max;
/* get extreme markers */
@@ -408,19 +408,19 @@ static void markers_selectkeys_between (bAnimContext *ac)
max += 0.5f;
/* get editing funcs + data */
- ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
- select_cb= ANIM_editkeyframes_select(SELECT_ADD);
+ ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
+ select_cb = ANIM_editkeyframes_select(SELECT_ADD);
- ked.f1= min;
- ked.f2= max;
+ ked.f1 = min;
+ ked.f2 = max;
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
+ 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);
+ 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);
@@ -438,13 +438,13 @@ static void markers_selectkeys_between (bAnimContext *ac)
/* Selects all visible keyframes in the same frames as the specified elements */
-static void columnselect_graph_keys (bAnimContext *ac, short mode)
+static void columnselect_graph_keys(bAnimContext *ac, short mode)
{
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- Scene *scene= ac->scene;
+ Scene *scene = ac->scene;
CfraElem *ce;
KeyframeEditFunc select_cb, ok_cb;
KeyframeEditData ked;
@@ -455,10 +455,10 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
/* build list of columns */
switch (mode) {
case GRAPHKEYS_COLUMNSEL_KEYS: /* list of selected keys */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
+ 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)
+ for (ale = anim_data.first; ale; ale = ale->next)
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_to_cfraelem, NULL);
BLI_freelistN(&anim_data);
@@ -466,10 +466,10 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
case GRAPHKEYS_COLUMNSEL_CFRA: /* current frame */
/* make a single CfraElem for storing this */
- ce= MEM_callocN(sizeof(CfraElem), "cfraElem");
+ ce = MEM_callocN(sizeof(CfraElem), "cfraElem");
BLI_addtail(&ked.list, ce);
- ce->cfra= (float)CFRA;
+ ce->cfra = (float)CFRA;
break;
case GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN: /* list of selected markers */
@@ -481,24 +481,24 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
}
/* set up BezTriple edit callbacks */
- select_cb= ANIM_editkeyframes_select(SELECT_ADD);
- ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAME);
+ 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);
+ 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);
+ 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
*/
- for (ce= ked.list.first; ce; ce= ce->next) {
+ for (ce = ked.list.first; ce; ce = ce->next) {
/* set frame for validation callback to refer to */
- ked.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
+ ked.f1 = BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
/* select elements with frame number matching cfraelem */
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
@@ -522,7 +522,7 @@ static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* action to take depends on the mode */
- mode= RNA_enum_get(op->ptr, "mode");
+ mode = RNA_enum_get(op->ptr, "mode");
if (mode == GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN)
markers_selectkeys_between(&ac);
@@ -530,7 +530,7 @@ static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
columnselect_graph_keys(&ac, mode);
/* set notifier that keyframe selection has changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -547,7 +547,7 @@ void GRAPH_OT_select_column(wmOperatorType *ot)
ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
/* props */
ot->prop = RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
@@ -555,11 +555,11 @@ void GRAPH_OT_select_column(wmOperatorType *ot)
/* ******************** Select Linked Operator *********************** */
-static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
+static int graphkeys_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
@@ -571,11 +571,11 @@ static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
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);
+ 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;
+ 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)) {
@@ -588,7 +588,7 @@ static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
BLI_freelistN(&anim_data);
/* set notifier that keyframe selection has changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -605,15 +605,15 @@ void GRAPH_OT_select_linked(wmOperatorType *ot)
ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
}
/* ******************** Select More/Less Operators *********************** */
/* Common code to perform selection */
-static void select_moreless_graph_keys (bAnimContext *ac, short mode)
+static void select_moreless_graph_keys(bAnimContext *ac, short mode)
{
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
@@ -622,22 +622,22 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode)
/* init selmap building data */
- build_cb= ANIM_editkeyframes_buildselmap(mode);
+ build_cb = ANIM_editkeyframes_buildselmap(mode);
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);
+ 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;
+ 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");
+ 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 */
@@ -645,7 +645,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode)
/* free the selmap used here */
MEM_freeN(ked.data);
- ked.data= NULL;
+ ked.data = NULL;
}
/* Cleanup */
@@ -654,7 +654,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode)
/* ----------------- */
-static int graphkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
+static int graphkeys_select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -666,7 +666,7 @@ static int graphkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
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);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -683,12 +683,12 @@ void GRAPH_OT_select_more(wmOperatorType *ot)
ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
}
/* ----------------- */
-static int graphkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
+static int graphkeys_select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -700,7 +700,7 @@ static int graphkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
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);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -717,7 +717,7 @@ void GRAPH_OT_select_less(wmOperatorType *ot)
ot->poll = graphop_visible_keyframes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
}
/* ******************** Select Left/Right Operator ************************* */
@@ -733,19 +733,19 @@ static EnumPropertyItem prop_graphkeys_leftright_select_types[] = {
/* --------------------------------- */
-static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short select_mode)
+static void graphkeys_select_leftright(bAnimContext *ac, short leftright, short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
KeyframeEditFunc ok_cb, select_cb;
- KeyframeEditData ked= {{NULL}};
- Scene *scene= ac->scene;
+ 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;
+ 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
@@ -754,8 +754,8 @@ static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short
}
/* set callbacks and editing data */
- ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
- select_cb= ANIM_editkeyframes_select(select_mode);
+ ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
+ select_cb = ANIM_editkeyframes_select(select_mode);
if (leftright == GRAPHKEYS_LRSEL_LEFT) {
ked.f1 = MINAFRAMEF;
@@ -767,12 +767,12 @@ static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short
}
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS);
+ 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);
+ 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);
@@ -789,7 +789,7 @@ static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short
/* ----------------- */
-static int graphkeys_select_leftright_exec (bContext *C, wmOperator *op)
+static int graphkeys_select_leftright_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
@@ -801,9 +801,9 @@ static int graphkeys_select_leftright_exec (bContext *C, wmOperator *op)
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
- selectmode= SELECT_INVERT;
+ selectmode = SELECT_INVERT;
else
- selectmode= SELECT_REPLACE;
+ selectmode = SELECT_REPLACE;
/* if "test" mode is set, we don't have any info to set this with */
if (leftright == GRAPHKEYS_LRSEL_TEST)
@@ -813,12 +813,12 @@ static int graphkeys_select_leftright_exec (bContext *C, wmOperator *op)
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|ND_ANIMCHAN|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | ND_ANIMCHAN | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
-static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent *event)
+static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
@@ -829,9 +829,9 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve
/* handle mode-based testing */
if (leftright == GRAPHKEYS_LRSEL_TEST) {
- Scene *scene= ac.scene;
- ARegion *ar= ac.ar;
- View2D *v2d= &ar->v2d;
+ Scene *scene = ac.scene;
+ ARegion *ar = ac.ar;
+ View2D *v2d = &ar->v2d;
float x;
/* determine which side of the current frame mouse is on */
@@ -854,12 +854,12 @@ void GRAPH_OT_select_leftright(wmOperatorType *ot)
ot->description = "Select keyframes to the left or the right of the current frame";
/* api callbacks */
- ot->invoke= graphkeys_select_leftright_invoke;
+ 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;
+ 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", "");
@@ -880,26 +880,26 @@ void GRAPH_OT_select_leftright(wmOperatorType *ot)
typedef struct tNearestVertInfo {
struct tNearestVertInfo *next, *prev;
- FCurve *fcu; /* F-Curve that keyframe comes from */
+ FCurve *fcu; /* F-Curve that keyframe comes from */
- BezTriple *bezt; /* keyframe to consider */
- FPoint *fpt; /* sample point to consider */
+ 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 */
+ 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 */
} tNearestVertInfo;
/* Tags for the type of graph vert that we have */
typedef enum eGraphVertIndex {
- NEAREST_HANDLE_LEFT = -1,
+ NEAREST_HANDLE_LEFT = -1,
NEAREST_HANDLE_KEY,
NEAREST_HANDLE_RIGHT
} 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?
-#define GVERTSEL_TOL 10
+#define GVERTSEL_TOL 10
/* ....... */
@@ -908,13 +908,13 @@ typedef enum eGraphVertIndex {
static int fcurve_handle_sel_check(SpaceIpo *sipo, BezTriple *bezt)
{
if (sipo->flag & SIPO_NOHANDLES) return 0;
- if ((sipo->flag & SIPO_SELVHANDLESONLY) && BEZSELECTED(bezt)==0) return 0;
+ if ((sipo->flag & SIPO_SELVHANDLESONLY) && BEZSELECTED(bezt) == 0) return 0;
return 1;
}
/* check if the given vertex is within bounds or not */
// TODO: should we return if we hit something?
-static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *fcu, BezTriple *bezt, FPoint *fpt, short hpoint, const int mval[2])
+static void nearest_fcurve_vert_store(ListBase *matches, View2D *v2d, FCurve *fcu, BezTriple *bezt, FPoint *fpt, short hpoint, const int mval[2])
{
/* Keyframes or Samples? */
if (bezt) {
@@ -922,16 +922,16 @@ static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *f
/* 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
+ * needed to access the relevant vertex coordinates in the 3x3
+ * 'vec' matrix
*/
- UI_view2d_view_to_region(v2d, bezt->vec[hpoint+1][0], bezt->vec[hpoint+1][1], &screen_co[0], &screen_co[1]);
+ UI_view2d_view_to_region(v2d, bezt->vec[hpoint + 1][0], bezt->vec[hpoint + 1][1], &screen_co[0], &screen_co[1]);
/* check if distance from mouse cursor to vert in screen space is within tolerance */
- // XXX: inlined distance calculation, since we cannot do this on ints using the math lib...
+ // XXX: inlined distance calculation, since we cannot do this on ints using the math lib...
//dist = len_v2v2(mval, screen_co);
- dist = sqrt((mval[0] - screen_co[0])*(mval[0] - screen_co[0]) +
- (mval[1] - screen_co[1])*(mval[1] - screen_co[1]));
+ dist = sqrt((mval[0] - screen_co[0]) * (mval[0] - screen_co[0]) +
+ (mval[1] - screen_co[1]) * (mval[1] - screen_co[1]));
if (dist <= GVERTSEL_TOL) {
tNearestVertInfo *nvi = (tNearestVertInfo *)matches->last;
@@ -941,7 +941,7 @@ static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *f
if ((nvi) && (nvi->fcu == fcu)) {
/* replace if we are closer, or if equal and that one wasn't selected but we are... */
if ( (nvi->dist > dist) || ((nvi->sel == 0) && BEZSELECTED(bezt)) )
- replace= 1;
+ replace = 1;
}
/* add new if not replacing... */
if (replace == 0)
@@ -953,7 +953,7 @@ static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *f
nvi->hpoint = hpoint;
nvi->dist = dist;
- nvi->sel= BEZSELECTED(bezt); // XXX... should this use the individual verts instead?
+ nvi->sel = BEZSELECTED(bezt); // XXX... should this use the individual verts instead?
/* add to list of matches if appropriate... */
if (replace == 0)
@@ -966,27 +966,27 @@ static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *f
}
/* helper for find_nearest_fcurve_vert() - build the list of nearest matches */
-static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2], ListBase *matches)
+static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], ListBase *matches)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo= (SpaceIpo *)ac->sl;
- View2D *v2d= &ac->ar->v2d;
+ SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ View2D *v2d = &ac->ar->v2d;
/* 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...
*/
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
- if (sipo->flag & SIPO_SELCUVERTSONLY) // FIXME: this should really be check for by the filtering code...
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
+ if (sipo->flag & SIPO_SELCUVERTSONLY) // FIXME: this should really be check for by the filtering code...
filter |= ANIMFILTER_SEL;
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);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ FCurve *fcu = (FCurve *)ale->key_data;
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
/* apply unit corrections */
ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0);
@@ -996,17 +996,17 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2],
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
if (fcu->bezt) {
- BezTriple *bezt1=fcu->bezt, *prevbezt=NULL;
+ BezTriple *bezt1 = fcu->bezt, *prevbezt = NULL;
int i;
- for (i=0; i < fcu->totvert; i++, prevbezt=bezt1, bezt1++) {
+ for (i = 0; i < fcu->totvert; i++, prevbezt = bezt1, bezt1++) {
/* keyframe */
nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_KEY, mval);
/* 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))) {
+ if ((!prevbezt && (bezt1->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) {
nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_LEFT, mval);
}
@@ -1035,7 +1035,7 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2],
}
/* helper for find_nearest_fcurve_vert() - get the best match to use */
-static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches)
+static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches)
{
tNearestVertInfo *nvi = NULL;
short found = 0;
@@ -1047,7 +1047,7 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches)
/* if list only has 1 item, remove it from the list and return */
if (matches->first == matches->last) {
/* need to remove from the list, otherwise it gets freed and then we can't return it */
- nvi= matches->first;
+ nvi = matches->first;
BLI_remlink(matches, nvi);
return nvi;
@@ -1066,7 +1066,7 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches)
else {
/* if vert is selected, we've got what we want... */
if (nvi->sel)
- found= 1;
+ found = 1;
}
}
@@ -1081,7 +1081,7 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches)
/* 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])
+static tNearestVertInfo *find_nearest_fcurve_vert(bAnimContext *ac, const int mval[2])
{
ListBase matches = {NULL, NULL};
tNearestVertInfo *nvi;
@@ -1090,7 +1090,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, const int m
get_nearest_fcurve_verts_list(ac, mval, &matches);
/* step 2: find the best vert */
- nvi= get_best_nearest_fcurve_vert(&matches);
+ nvi = get_best_nearest_fcurve_vert(&matches);
BLI_freelistN(&matches);
@@ -1101,11 +1101,11 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, const int m
/* ------------------- */
/* option 1) select keyframe directly under mouse */
-static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_mode, short curves_only)
+static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_mode, short curves_only)
{
- SpaceIpo *sipo= (SpaceIpo *)ac->sl;
+ SpaceIpo *sipo = (SpaceIpo *)ac->sl;
tNearestVertInfo *nvi;
- BezTriple *bezt= NULL;
+ BezTriple *bezt = NULL;
/* find the beztriple that we're selecting, and the handle that was clicked on */
nvi = find_nearest_fcurve_vert(ac, mval);
@@ -1117,7 +1117,7 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_
/* deselect all other curves? */
if (select_mode == SELECT_REPLACE) {
/* reset selection mode */
- select_mode= SELECT_ADD;
+ select_mode = SELECT_ADD;
/* deselect all other keyframes (+ F-Curves too) */
deselect_graph_keys(ac, 0, SELECT_SUBTRACT, TRUE);
@@ -1132,10 +1132,10 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_
/* 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)) {
+ if ((curves_only == 0) && ((nvi->fcu->flag & FCURVE_PROTECTED) == 0)) {
/* only if there's keyframe */
if (nvi->bezt) {
- bezt= nvi->bezt; /* used to check bezt seletion is set */
+ bezt = nvi->bezt; /* used to check bezt seletion is set */
/* depends on selection mode */
if (select_mode == SELECT_INVERT) {
/* keyframe - invert select of all */
@@ -1182,7 +1182,7 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_
memset(&ked, 0, sizeof(KeyframeEditData));
/* set up BezTriple edit callbacks */
- select_cb= ANIM_editkeyframes_select(select_mode);
+ select_cb = ANIM_editkeyframes_select(select_mode);
/* select all keyframes */
ANIM_fcurve_keyframes_loop(&ked, nvi->fcu, NULL, select_cb, NULL);
@@ -1212,7 +1212,7 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_
/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
/* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) otherwise the active flag won't be set [#26452] */
if (nvi->fcu->flag & FCURVE_SELECTED) {
- int filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
+ int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, ANIMTYPE_FCURVE);
}
@@ -1224,9 +1224,9 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_
/* (see graphkeys_select_leftright) */
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
-static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short select_mode)
+static void graphkeys_mselect_column(bAnimContext *ac, const int mval[2], short select_mode)
{
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
@@ -1245,14 +1245,14 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short
/* get frame number on which elements should be selected */
// TODO: should we restrict to integer frames only?
if (nvi->bezt)
- selx= nvi->bezt->vec[1][0];
+ selx = nvi->bezt->vec[1][0];
else if (nvi->fpt)
- selx= nvi->fpt->vec[0];
+ selx = nvi->fpt->vec[0];
/* if select mode is replace, deselect all keyframes first */
- if (select_mode==SELECT_REPLACE) {
+ if (select_mode == SELECT_REPLACE) {
/* reset selection mode to add to selection */
- select_mode= SELECT_ADD;
+ 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
@@ -1264,23 +1264,23 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short
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);
+ 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);
+ 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);
+ 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);
+ ked.f1 = BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP);
else
- ked.f1= selx;
+ ked.f1 = selx;
/* select elements with frame number matching cfra */
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
@@ -1306,9 +1306,9 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
- selectmode= SELECT_INVERT;
+ selectmode = SELECT_INVERT;
else
- selectmode= SELECT_REPLACE;
+ selectmode = SELECT_REPLACE;
/* figure out action to take */
if (RNA_boolean_get(op->ptr, "column")) {
@@ -1325,10 +1325,10 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
}
/* set notifier that keyframe selection (and also channel selection in some cases) has changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|ND_ANIMCHAN|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | ND_ANIMCHAN | NA_SELECTED, NULL);
/* for tweak grab to work */
- return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+ return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
void GRAPH_OT_clickselect(wmOperatorType *ot)
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index 46c886b7d3c..93dfd3644dd 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -54,7 +54,7 @@
#include "ED_anim_api.h"
-#include "graph_intern.h" // own include
+#include "graph_intern.h" // own include
/* ************************************************************** */
/* Active F-Curve */
@@ -65,17 +65,17 @@
*
* NOTE: curve-visible flag isn't included, otherwise selecting a curve via list to edit is too cumbersome
*/
-bAnimListElem *get_active_fcurve_channel (bAnimContext *ac)
+bAnimListElem *get_active_fcurve_channel(bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
- int filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_ACTIVE);
+ 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;
+ 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);
@@ -97,7 +97,7 @@ int graphop_visible_keyframes_poll(bContext *C)
bAnimContext ac;
bAnimListElem *ale;
ListBase anim_data = {NULL, NULL};
- ScrArea *sa= CTX_wm_area(C);
+ ScrArea *sa = CTX_wm_area(C);
size_t items;
int filter;
short found = 0;
@@ -114,13 +114,13 @@ int graphop_visible_keyframes_poll(bContext *C)
/* 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);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
if (items == 0)
return 0;
- for (ale = anim_data.first; ale; ale= ale->next) {
- FCurve *fcu= (FCurve *)ale->data;
+ 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
@@ -146,7 +146,7 @@ int graphop_editable_keyframes_poll(bContext *C)
bAnimContext ac;
bAnimListElem *ale;
ListBase anim_data = {NULL, NULL};
- ScrArea *sa= CTX_wm_area(C);
+ ScrArea *sa = CTX_wm_area(C);
size_t items;
int filter;
short found = 0;
@@ -163,13 +163,13 @@ int graphop_editable_keyframes_poll(bContext *C)
/* 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);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
if (items == 0)
return 0;
- for (ale = anim_data.first; ale; ale= ale->next) {
- FCurve *fcu= (FCurve *)ale->data;
+ 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
@@ -195,8 +195,8 @@ int graphop_active_fcurve_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
- ScrArea *sa= CTX_wm_area(C);
- short has_fcurve= 0;
+ ScrArea *sa = CTX_wm_area(C);
+ short has_fcurve = 0;
/* firstly, check if in Graph Editor */
// TODO: also check for region?
@@ -208,15 +208,15 @@ int graphop_active_fcurve_poll(bContext *C)
return 0;
/* try to get the Active F-Curve */
- ale= get_active_fcurve_channel(&ac);
+ ale = get_active_fcurve_channel(&ac);
if (ale == NULL)
return 0;
/* free temp data... */
- has_fcurve= ((ale->data) && (ale->type == ANIMTYPE_FCURVE));
+ has_fcurve = ((ale->data) && (ale->type == ANIMTYPE_FCURVE));
if (has_fcurve) {
- FCurve *fcu= (FCurve *)ale->data;
- has_fcurve= (fcu->flag & FCURVE_VISIBLE)!=0;
+ FCurve *fcu = (FCurve *)ale->data;
+ has_fcurve = (fcu->flag & FCURVE_VISIBLE) != 0;
}
MEM_freeN(ale);
@@ -230,7 +230,7 @@ int graphop_selected_fcurve_poll(bContext *C)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
- ScrArea *sa= CTX_wm_area(C);
+ ScrArea *sa = CTX_wm_area(C);
size_t items;
int filter;
@@ -246,7 +246,7 @@ int graphop_selected_fcurve_poll(bContext *C)
/* 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);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
if (items == 0)
return 0;
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 1b60a0a39ac..ffff86df4eb 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -61,7 +61,7 @@
#include "UI_resources.h"
#include "UI_view2d.h"
-#include "graph_intern.h" // own include
+#include "graph_intern.h" // own include
/* ******************** manage regions ********************* */
@@ -69,20 +69,20 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
- ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
if (ar) return ar;
/* add subdiv level; after main */
- ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
/* is error! */
- if (ar==NULL) return NULL;
+ if (ar == NULL) return NULL;
- arnew= MEM_callocN(sizeof(ARegion), "buttons for graph");
+ 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->regiontype = RGN_TYPE_UI;
+ arnew->alignment = RGN_ALIGN_RIGHT;
arnew->flag = RGN_FLAG_HIDDEN;
@@ -94,71 +94,71 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
static SpaceLink *graph_new(const bContext *C)
{
- Scene *scene= CTX_data_scene(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 = MEM_callocN(sizeof(SpaceIpo), "init graphedit");
+ sipo->spacetype = SPACE_IPO;
- sipo->autosnap= SACTSNAP_FRAME;
+ sipo->autosnap = SACTSNAP_FRAME;
/* allocate DopeSheet data for Graph Editor */
- sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
- sipo->ads->source= (ID *)scene;
+ 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");
+ ar = MEM_callocN(sizeof(ARegion), "header for graphedit");
BLI_addtail(&sipo->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
+ ar->regiontype = RGN_TYPE_HEADER;
+ ar->alignment = RGN_ALIGN_BOTTOM;
/* channels */
- ar= MEM_callocN(sizeof(ARegion), "channels area for graphedit");
+ ar = MEM_callocN(sizeof(ARegion), "channels area for graphedit");
BLI_addtail(&sipo->regionbase, ar);
- ar->regiontype= RGN_TYPE_CHANNELS;
- ar->alignment= RGN_ALIGN_LEFT;
+ ar->regiontype = RGN_TYPE_CHANNELS;
+ ar->alignment = RGN_ALIGN_LEFT;
- ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+ ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
/* ui buttons */
- ar= MEM_callocN(sizeof(ARegion), "buttons area for graphedit");
+ ar = MEM_callocN(sizeof(ARegion), "buttons area for graphedit");
BLI_addtail(&sipo->regionbase, ar);
- ar->regiontype= RGN_TYPE_UI;
- ar->alignment= RGN_ALIGN_RIGHT;
+ ar->regiontype = RGN_TYPE_UI;
+ ar->alignment = RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
/* main area */
- ar= MEM_callocN(sizeof(ARegion), "main area for graphedit");
+ ar = MEM_callocN(sizeof(ARegion), "main area for graphedit");
BLI_addtail(&sipo->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
+ 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.cur = ar->v2d.tot;
- ar->v2d.min[0]= FLT_MIN;
- ar->v2d.min[1]= FLT_MIN;
+ 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.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.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
+ ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
- ar->v2d.keeptot= 0;
+ ar->v2d.keeptot = 0;
return (SpaceLink *)sipo;
}
@@ -166,7 +166,7 @@ static SpaceLink *graph_new(const bContext *C)
/* not spacelink itself */
static void graph_free(SpaceLink *sl)
{
- SpaceIpo *si= (SpaceIpo *)sl;
+ SpaceIpo *si = (SpaceIpo *)sl;
if (si->ads) {
BLI_freelistN(&si->ads->chanbase);
@@ -181,12 +181,12 @@ static void graph_free(SpaceLink *sl)
/* spacetype; init callback */
static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
- SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first;
+ SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
/* init dopesheet data if non-existant (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...
+ 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...
}
ED_area_tag_refresh(sa);
@@ -194,11 +194,11 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
static SpaceLink *graph_duplicate(SpaceLink *sl)
{
- SpaceIpo *sipon= MEM_dupallocN(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);
+ sipon->ads = MEM_dupallocN(sipon->ads);
return (SpaceLink *)sipon;
}
@@ -220,13 +220,13 @@ static void graph_main_area_init(wmWindowManager *wm, ARegion *ar)
static void graph_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- SpaceIpo *sipo= CTX_wm_space_graph(C);
+ SpaceIpo *sipo = CTX_wm_space_graph(C);
bAnimContext ac;
- View2D *v2d= &ar->v2d;
+ View2D *v2d = &ar->v2d;
View2DGrid *grid;
View2DScrollers *scrollers;
float col[3];
- short unitx=0, unity=V2D_UNIT_VALUES, flag=0;
+ short unitx = 0, unity = V2D_UNIT_VALUES, flag = 0;
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
@@ -236,8 +236,8 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* grid */
- unitx= (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);
+ unitx = (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);
/* draw data */
@@ -260,29 +260,29 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_grid_free(grid);
/* horizontal component of value-cursor (value line before the current frame line) */
- if ((sipo->flag & SIPO_NODRAWCURSOR)==0) {
+ if ((sipo->flag & SIPO_NODRAWCURSOR) == 0) {
float vec[2];
/* Draw a green line to indicate the cursor value */
- vec[1]= sipo->cursorVal;
+ vec[1] = sipo->cursorVal;
UI_ThemeColorShadeAlpha(TH_CFRAME, -10, -50);
glLineWidth(2.0);
glEnable(GL_BLEND);
glBegin(GL_LINE_STRIP);
- vec[0]= v2d->cur.xmin;
- glVertex2fv(vec);
+ vec[0] = v2d->cur.xmin;
+ glVertex2fv(vec);
- vec[0]= v2d->cur.xmax;
- glVertex2fv(vec);
+ vec[0] = v2d->cur.xmax;
+ glVertex2fv(vec);
glEnd(); // GL_LINE_STRIP
glDisable(GL_BLEND);
}
/* current frame */
- if (sipo->flag & SIPO_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS;
- if ((sipo->flag & SIPO_NODRAWCFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX;
+ if (sipo->flag & SIPO_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS;
+ if ((sipo->flag & SIPO_NODRAWCFRANUM) == 0) flag |= DRAWCFRA_SHOW_NUMBOX;
ANIM_draw_cfra(C, v2d, flag);
/* markers */
@@ -297,8 +297,8 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
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);
+ // 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);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}
@@ -319,7 +319,7 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar)
static void graph_channel_area_draw(const bContext *C, ARegion *ar)
{
bAnimContext ac;
- View2D *v2d= &ar->v2d;
+ View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
float col[3];
@@ -332,14 +332,14 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar)
/* draw channels */
if (ANIM_animdata_get_context(C, &ac)) {
- graph_draw_channel_names((bContext*)C, &ac, ar);
+ 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);
+ 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);
UI_view2d_scrollers_free(scrollers);
}
@@ -418,7 +418,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
default:
- if (wmn->data==ND_KEYS)
+ if (wmn->data == ND_KEYS)
ED_region_tag_redraw(ar);
}
@@ -427,7 +427,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
/* editor level listener */
static void graph_listener(ScrArea *sa, wmNotifier *wmn)
{
- SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first;
+ SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
/* context changes */
switch (wmn->category) {
@@ -440,7 +440,7 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
break;
case NC_SCENE:
switch (wmn->data) {
- case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
+ case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
case ND_OB_SELECT:
sipo->flag |= SIPO_TEMP_NEEDCHANSYNC;
ED_area_tag_refresh(sa);
@@ -453,7 +453,7 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
break;
case NC_OBJECT:
switch (wmn->data) {
- case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
+ case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
case ND_BONE_ACTIVE:
sipo->flag |= SIPO_TEMP_NEEDCHANSYNC;
ED_area_tag_refresh(sa);
@@ -472,16 +472,16 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
sipo->flag |= SIPO_TEMP_NEEDCHANSYNC;
ED_area_tag_refresh(sa);
}
- break;
+ break;
case NC_SPACE:
if (wmn->data == ND_SPACE_GRAPH)
ED_area_tag_redraw(sa);
break;
- // XXX: restore the case below if not enough updates occur...
- //default:
- // if (wmn->data==ND_KEYS)
- // ED_area_tag_redraw(sa);
+ // XXX: restore the case below if not enough updates occur...
+ //default:
+ // if (wmn->data==ND_KEYS)
+ // ED_area_tag_redraw(sa);
}
}
@@ -498,13 +498,13 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
{
}
- break;
+ break;
case SIPO_MODE_DRIVERS: /* drivers only */
{
}
- break;
+ break;
}
/* region updates? */
@@ -528,15 +528,15 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
int i;
/* 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
+ * - 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);
+ 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;
+ 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) {
@@ -551,7 +551,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
/* 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;
+ float *col = fcu->color;
switch (fcu->array_index) {
case 0:
@@ -569,7 +569,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
break;
}
}
- break;
+ break;
case FCURVE_COLOR_AUTO_RAINBOW:
default:
@@ -579,7 +579,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
*/
getcolor_fcurve_rainbow(i, items, fcu->color);
}
- break;
+ break;
}
}
@@ -591,10 +591,10 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
/* only called once, from space/spacetypes.c */
void ED_spacetype_ipo(void)
{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype ipo");
+ SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype ipo");
ARegionType *art;
- st->spaceid= SPACE_IPO;
+ st->spaceid = SPACE_IPO;
strncpy(st->name, "Graph", BKE_ST_MAXNAME);
st->new = graph_new;
@@ -612,7 +612,7 @@ void ED_spacetype_ipo(void)
art->init = graph_main_area_init;
art->draw = graph_main_area_draw;
art->listener = graph_region_listener;
- art->keymapflag = ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
+ art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_MARKERS | ED_KEYMAP_ANIMATION | ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
@@ -620,7 +620,7 @@ void ED_spacetype_ipo(void)
art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey = HEADERY;
- art->keymapflag = ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
art->listener = graph_region_listener;
art->init = graph_header_area_init;
art->draw = graph_header_area_draw;
@@ -631,7 +631,7 @@ void ED_spacetype_ipo(void)
art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_CHANNELS;
art->prefsizex = 200 + V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
- art->keymapflag = ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
art->listener = graph_region_listener;
art->init = graph_channel_area_init;
art->draw = graph_channel_area_draw;