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-08 22:05:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-08 22:05:57 +0400
commitf605679515bad2f9ebbe8c5cf5bd833219fcbbff (patch)
tree9e3522f9a09f57f2e9151b88809905de2ebb85a8
parent855c11ff8c3363521ac956f4a1b8991a66d774ad (diff)
style cleanup: nla
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c228
-rw-r--r--source/blender/editors/space_nla/nla_channels.c132
-rw-r--r--source/blender/editors/space_nla/nla_draw.c414
-rw-r--r--source/blender/editors/space_nla/nla_edit.c546
-rw-r--r--source/blender/editors/space_nla/nla_intern.h4
-rw-r--r--source/blender/editors/space_nla/nla_ops.c101
-rw-r--r--source/blender/editors/space_nla/nla_select.c148
-rw-r--r--source/blender/editors/space_nla/space_nla.c181
8 files changed, 877 insertions, 877 deletions
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index a133d370d99..95a56176523 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -62,13 +62,13 @@
#include "UI_interface.h"
#include "UI_resources.h"
-#include "nla_intern.h" // own include
+#include "nla_intern.h" // own include
/* ******************* nla editor space & buttons ************** */
-#define B_NOP 1
-#define B_REDR 2
+#define B_NOP 1
+#define B_REDR 2
/* -------------- */
@@ -81,16 +81,16 @@ static void do_nla_region_buttons(bContext *C, void *UNUSED(arg), int event)
}
/* default for now */
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_SCENE|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_TRANSFORM, NULL);
}
static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA *nlt_ptr, PointerRNA *strip_ptr)
{
bAnimContext ac;
- bAnimListElem *ale= NULL;
+ bAnimListElem *ale = NULL;
ListBase anim_data = {NULL, NULL};
- short found=0;
+ short found = 0;
int filter;
/* for now, only draw if we could init the anim-context info (necessary for all animation-related tools)
@@ -103,15 +103,15 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA
* - we need the channels flag to get the active AnimData block when there are no NLA Tracks
*/
// XXX: double-check active!
- filter= (ANIMFILTER_DATA_VISIBLE|ANIMFILTER_LIST_VISIBLE|ANIMFILTER_ACTIVE|ANIMFILTER_LIST_CHANNELS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_LIST_CHANNELS);
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) {
switch (ale->type) {
case ANIMTYPE_NLATRACK: /* NLA Track - The primary data type which should get caught */
{
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
/* found it, now set the pointers */
if (adt_ptr) {
@@ -124,18 +124,18 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA
}
if (strip_ptr) {
/* NLA-Strip pointer */
- NlaStrip *strip= BKE_nlastrip_find_active(nlt);
+ NlaStrip *strip = BKE_nlastrip_find_active(nlt);
RNA_pointer_create(ale->id, &RNA_NlaStrip, strip, strip_ptr);
}
- found= 1;
+ found = 1;
}
- break;
+ break;
- case ANIMTYPE_SCENE: /* Top-Level Widgets doubling up as datablocks */
+ case ANIMTYPE_SCENE: /* Top-Level Widgets doubling up as datablocks */
case ANIMTYPE_OBJECT:
case ANIMTYPE_FILLACTD: /* Action Expander */
- case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
+ case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
case ANIMTYPE_DSLAM:
case ANIMTYPE_DSCAM:
case ANIMTYPE_DSCUR:
@@ -156,11 +156,11 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA
/* set found status to -1, since setting to 1 would break the loop
* and potentially skip an active NLA-Track in some cases...
*/
- found= -1;
+ found = -1;
}
}
}
- break;
+ break;
}
if (found > 0)
@@ -208,7 +208,7 @@ static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt)
if (ptr.data == NULL)
return 0;
- strip= ptr.data;
+ strip = ptr.data;
return (strip->type == NLASTRIP_TYPE_CLIP);
}
@@ -222,7 +222,7 @@ static int nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt))
if (ptr.data == NULL)
return 0;
- strip= ptr.data;
+ strip = ptr.data;
if (strip->type == NLASTRIP_TYPE_SOUND)
return 0;
@@ -233,11 +233,11 @@ static int nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt))
/* -------------- */
/* active AnimData */
-static void nla_panel_animdata (const bContext *C, Panel *pa)
+static void nla_panel_animdata(const bContext *C, Panel *pa)
{
PointerRNA adt_ptr;
/* AnimData *adt; */
- uiLayout *layout= pa->layout;
+ uiLayout *layout = pa->layout;
uiLayout *row;
uiBlock *block;
@@ -247,32 +247,32 @@ static void nla_panel_animdata (const bContext *C, Panel *pa)
/* adt= adt_ptr.data; */
- block= uiLayoutGetBlock(layout);
+ block = uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
/* Active Action Properties ------------------------------------- */
/* action */
- row= uiLayoutRow(layout, 1);
- uiTemplateID(row, (bContext *)C, &adt_ptr, "action", "ACTION_OT_new", NULL, NULL /*"ACTION_OT_unlink"*/); // XXX: need to make these operators
+ row = uiLayoutRow(layout, 1);
+ uiTemplateID(row, (bContext *)C, &adt_ptr, "action", "ACTION_OT_new", NULL, NULL /*"ACTION_OT_unlink"*/); // XXX: need to make these operators
/* extrapolation */
- row= uiLayoutRow(layout, 1);
- uiItemR(row, &adt_ptr, "action_extrapolation", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, &adt_ptr, "action_extrapolation", 0, NULL, ICON_NONE);
/* blending */
- row= uiLayoutRow(layout, 1);
- uiItemR(row, &adt_ptr, "action_blend_type", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, &adt_ptr, "action_blend_type", 0, NULL, ICON_NONE);
/* influence */
- row= uiLayoutRow(layout, 1);
- uiItemR(row, &adt_ptr, "action_influence", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, &adt_ptr, "action_influence", 0, NULL, ICON_NONE);
}
/* active NLA-Track */
-static void nla_panel_track (const bContext *C, Panel *pa)
+static void nla_panel_track(const bContext *C, Panel *pa)
{
PointerRNA nlt_ptr;
- uiLayout *layout= pa->layout;
+ uiLayout *layout = pa->layout;
uiLayout *row;
uiBlock *block;
@@ -280,19 +280,19 @@ static void nla_panel_track (const bContext *C, Panel *pa)
if (!nla_panel_context(C, NULL, &nlt_ptr, NULL))
return;
- block= uiLayoutGetBlock(layout);
+ block = uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
/* Info - Active NLA-Context:Track ---------------------- */
- row= uiLayoutRow(layout, 1);
- uiItemR(row, &nlt_ptr, "name", 0, NULL, ICON_NLA);
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, &nlt_ptr, "name", 0, NULL, ICON_NLA);
}
/* generic settings for active NLA-Strip */
static void nla_panel_properties(const bContext *C, Panel *pa)
{
PointerRNA strip_ptr;
- uiLayout *layout= pa->layout;
+ uiLayout *layout = pa->layout;
uiLayout *column, *row, *sub;
uiBlock *block;
short showEvalProps = 1;
@@ -300,20 +300,20 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
return;
- block= uiLayoutGetBlock(layout);
+ block = uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
/* Strip Properties ------------------------------------- */
/* strip type */
- row= uiLayoutColumn(layout, 1);
- uiItemR(row, &strip_ptr, "name", 0, NULL, ICON_NLA); // XXX icon?
- uiItemR(row, &strip_ptr, "type", 0, NULL, ICON_NONE);
+ row = uiLayoutColumn(layout, 1);
+ uiItemR(row, &strip_ptr, "name", 0, NULL, ICON_NLA); // XXX icon?
+ uiItemR(row, &strip_ptr, "type", 0, NULL, ICON_NONE);
/* strip extents */
- column= uiLayoutColumn(layout, 1);
- uiItemL(column, "Strip Extents:", ICON_NONE);
- uiItemR(column, &strip_ptr, "frame_start", 0, NULL, ICON_NONE);
- uiItemR(column, &strip_ptr, "frame_end", 0, NULL, ICON_NONE);
+ column = uiLayoutColumn(layout, 1);
+ uiItemL(column, "Strip Extents:", ICON_NONE);
+ uiItemR(column, &strip_ptr, "frame_start", 0, NULL, ICON_NONE);
+ uiItemR(column, &strip_ptr, "frame_end", 0, NULL, ICON_NONE);
/* Evaluation-Related Strip Properties ------------------ */
@@ -324,31 +324,31 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
/* only show if allowed to... */
if (showEvalProps) {
/* extrapolation */
- row= uiLayoutRow(layout, 1);
- uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, ICON_NONE);
/* blending */
- row= uiLayoutRow(layout, 1);
- uiItemR(row, &strip_ptr, "blend_type", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, &strip_ptr, "blend_type", 0, NULL, ICON_NONE);
/* blend in/out + autoblending
* - blend in/out can only be set when autoblending is off
*/
- column= uiLayoutColumn(layout, 1);
- uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence")==0);
- uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle?
-
- sub= uiLayoutColumn(column, 1);
- uiLayoutSetActive(sub, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0);
- uiItemR(sub, &strip_ptr, "blend_in", 0, NULL, ICON_NONE);
- uiItemR(sub, &strip_ptr, "blend_out", 0, NULL, ICON_NONE);
+ column = uiLayoutColumn(layout, 1);
+ uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence") == 0);
+ uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle?
+
+ sub = uiLayoutColumn(column, 1);
+ uiLayoutSetActive(sub, RNA_boolean_get(&strip_ptr, "use_auto_blend") == 0);
+ uiItemR(sub, &strip_ptr, "blend_in", 0, NULL, ICON_NONE);
+ uiItemR(sub, &strip_ptr, "blend_out", 0, NULL, ICON_NONE);
/* settings */
- column= uiLayoutColumn(layout, 1);
- uiLayoutSetActive(column, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || RNA_boolean_get(&strip_ptr, "use_animated_time")));
- uiItemL(column, "Playback Settings:", ICON_NONE);
- uiItemR(column, &strip_ptr, "mute", 0, NULL, ICON_NONE);
- uiItemR(column, &strip_ptr, "use_reverse", 0, NULL, ICON_NONE);
+ column = uiLayoutColumn(layout, 1);
+ uiLayoutSetActive(column, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || RNA_boolean_get(&strip_ptr, "use_animated_time")));
+ uiItemL(column, "Playback Settings:", ICON_NONE);
+ uiItemR(column, &strip_ptr, "mute", 0, NULL, ICON_NONE);
+ uiItemR(column, &strip_ptr, "use_reverse", 0, NULL, ICON_NONE);
}
}
@@ -357,7 +357,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
static void nla_panel_actclip(const bContext *C, Panel *pa)
{
PointerRNA strip_ptr;
- uiLayout *layout= pa->layout;
+ uiLayout *layout = pa->layout;
uiLayout *column, *row;
uiBlock *block;
@@ -365,35 +365,35 @@ static void nla_panel_actclip(const bContext *C, Panel *pa)
if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
return;
- block= uiLayoutGetBlock(layout);
+ block = uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
/* Strip Properties ------------------------------------- */
/* action pointer */
- row= uiLayoutRow(layout, 1);
- uiItemR(row, &strip_ptr, "action", 0, NULL, ICON_ACTION);
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, &strip_ptr, "action", 0, NULL, ICON_ACTION);
/* action extents */
// XXX custom names were used here (to avoid the prefixes)... probably not necessary in future?
- column= uiLayoutColumn(layout, 1);
- uiItemL(column, "Action Extents:", ICON_NONE);
- uiItemR(column, &strip_ptr, "action_frame_start", 0, "Start Frame", ICON_NONE);
- uiItemR(column, &strip_ptr, "action_frame_end", 0, "End Frame", ICON_NONE);
- uiItemO(column, NULL, ICON_NONE, "NLA_OT_action_sync_length");
+ column = uiLayoutColumn(layout, 1);
+ uiItemL(column, "Action Extents:", ICON_NONE);
+ uiItemR(column, &strip_ptr, "action_frame_start", 0, "Start Frame", ICON_NONE);
+ uiItemR(column, &strip_ptr, "action_frame_end", 0, "End Frame", ICON_NONE);
+ uiItemO(column, NULL, ICON_NONE, "NLA_OT_action_sync_length");
/* action usage */
- column= uiLayoutColumn(layout, 1);
- uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_time")==0);
- uiItemL(column, "Playback Settings:", ICON_NONE);
- uiItemR(column, &strip_ptr, "scale", 0, NULL, ICON_NONE);
- uiItemR(column, &strip_ptr, "repeat", 0, NULL, ICON_NONE);
+ column = uiLayoutColumn(layout, 1);
+ uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_time") == 0);
+ uiItemL(column, "Playback Settings:", ICON_NONE);
+ uiItemR(column, &strip_ptr, "scale", 0, NULL, ICON_NONE);
+ uiItemR(column, &strip_ptr, "repeat", 0, NULL, ICON_NONE);
}
/* evaluation settings for active NLA-Strip */
static void nla_panel_evaluation(const bContext *C, Panel *pa)
{
PointerRNA strip_ptr;
- uiLayout *layout= pa->layout;
+ uiLayout *layout = pa->layout;
uiLayout *col, *sub;
uiBlock *block;
@@ -401,22 +401,22 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
return;
- block= uiLayoutGetBlock(layout);
+ block = uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
- col= uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, 1);
uiItemR(col, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE);
- sub= uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, 1);
uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence"));
uiItemR(sub, &strip_ptr, "influence", 0, NULL, ICON_NONE);
- col= uiLayoutColumn(layout, 1);
- sub= uiLayoutRow(col, 0);
+ col = uiLayoutColumn(layout, 1);
+ sub = uiLayoutRow(col, 0);
uiItemR(sub, &strip_ptr, "use_animated_time", 0, NULL, ICON_NONE);
uiItemR(sub, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NONE);
- sub= uiLayoutRow(col, 0);
+ sub = uiLayoutRow(col, 0);
uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_time"));
uiItemR(sub, &strip_ptr, "strip_time", 0, NULL, ICON_NONE);
}
@@ -433,30 +433,30 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
/* check context and also validity of pointer */
if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
return;
- strip= strip_ptr.data;
+ strip = strip_ptr.data;
- block= uiLayoutGetBlock(pa->layout);
+ block = uiLayoutGetBlock(pa->layout);
uiBlockSetHandleFunc(block, do_nla_region_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 temporary 'add modifier' operator
// FIXME: we need to set the only-active property so that this will only add modifiers for the active strip (not all selected)
uiDefButO(block, BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 10, 0, 150, 20,
- TIP_("Adds a new F-Modifier for the active NLA Strip"));
+ TIP_("Adds a new F-Modifier for the active NLA Strip"));
/* copy/paste (as sub-row)*/
- row= uiLayoutRow(row, 1);
- uiItemO(row, "", ICON_COPYDOWN, "NLA_OT_fmodifier_copy");
- uiItemO(row, "", ICON_PASTEDOWN, "NLA_OT_fmodifier_paste");
+ row = uiLayoutRow(row, 1);
+ uiItemO(row, "", ICON_COPYDOWN, "NLA_OT_fmodifier_copy");
+ uiItemO(row, "", ICON_PASTEDOWN, "NLA_OT_fmodifier_paste");
}
/* draw each modifier */
- for (fcm= strip->modifiers.first; fcm; fcm= fcm->next) {
- col= uiLayoutColumn(pa->layout, 1);
+ for (fcm = strip->modifiers.first; fcm; fcm = fcm->next) {
+ col = uiLayoutColumn(pa->layout, 1);
ANIM_uiTemplate_fmodifier_draw(col, strip_ptr.id.data, &strip->modifiers, fcm);
}
@@ -469,54 +469,54 @@ void nla_buttons_register(ARegionType *art)
{
PanelType *pt;
- pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel animdata");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel animdata");
strcpy(pt->idname, "NLA_PT_animdata");
strcpy(pt->label, "Animation Data");
- pt->draw= nla_panel_animdata;
- pt->poll= nla_animdata_panel_poll;
- pt->flag= PNL_DEFAULT_CLOSED;
+ pt->draw = nla_panel_animdata;
+ pt->poll = nla_animdata_panel_poll;
+ pt->flag = PNL_DEFAULT_CLOSED;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel track");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel track");
strcpy(pt->idname, "NLA_PT_track");
strcpy(pt->label, "Active Track");
- pt->draw= nla_panel_track;
- pt->poll= nla_track_panel_poll;
+ pt->draw = nla_panel_track;
+ pt->poll = nla_track_panel_poll;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel properties");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel properties");
strcpy(pt->idname, "NLA_PT_properties");
strcpy(pt->label, "Active Strip");
- pt->draw= nla_panel_properties;
- pt->poll= nla_strip_panel_poll;
+ pt->draw = nla_panel_properties;
+ pt->poll = nla_strip_panel_poll;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel properties");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel properties");
strcpy(pt->idname, "NLA_PT_actionclip");
strcpy(pt->label, "Action Clip");
- pt->draw= nla_panel_actclip;
- pt->poll= nla_strip_actclip_panel_poll;
+ pt->draw = nla_panel_actclip;
+ pt->poll = nla_strip_actclip_panel_poll;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel evaluation");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel evaluation");
strcpy(pt->idname, "NLA_PT_evaluation");
strcpy(pt->label, "Evaluation");
- pt->draw= nla_panel_evaluation;
- pt->poll= nla_strip_eval_panel_poll;
+ pt->draw = nla_panel_evaluation;
+ pt->poll = nla_strip_eval_panel_poll;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel modifiers");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel modifiers");
strcpy(pt->idname, "NLA_PT_modifiers");
strcpy(pt->label, "Modifiers");
- pt->draw= nla_panel_modifiers;
- pt->poll= nla_strip_eval_panel_poll;
+ pt->draw = nla_panel_modifiers;
+ pt->poll = nla_strip_eval_panel_poll;
BLI_addtail(&art->paneltypes, pt);
}
static int nla_properties(bContext *C, wmOperator *UNUSED(op))
{
- ScrArea *sa= CTX_wm_area(C);
- ARegion *ar= nla_has_buttons_region(sa);
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = nla_has_buttons_region(sa);
if (ar)
ED_region_toggle_hidden(C, ar);
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index c8f9c66d24b..e3c831824f1 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -61,7 +61,7 @@
#include "UI_view2d.h"
-#include "nla_intern.h" // own include
+#include "nla_intern.h" // own include
/* *********************************************** */
/* Operators for NLA channels-list which need to be different from the standard Animation Editor ones */
@@ -74,22 +74,22 @@
* --> Most channels are now selection only...
*/
-static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, short selectmode)
+static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, short selectmode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- View2D *v2d= &ac->ar->v2d;
+ View2D *v2d = &ac->ar->v2d;
int notifierFlags = 0;
/* get the channel that was clicked on */
- /* filter channels */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
+ /* filter channels */
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
- /* get channel from index */
- ale= BLI_findlink(&anim_data, channel_index);
+ /* get channel from index */
+ ale = BLI_findlink(&anim_data, channel_index);
if (ale == NULL) {
/* channel not found */
if (G.debug & G_DEBUG)
@@ -104,8 +104,8 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
switch (ale->type) {
case ANIMTYPE_SCENE:
{
- Scene *sce= (Scene *)ale->data;
- AnimData *adt= sce->adt;
+ Scene *sce = (Scene *)ale->data;
+ AnimData *adt = sce->adt;
/* set selection status */
if (selectmode == SELECT_INVERT) {
@@ -118,23 +118,23 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
if (adt) adt->flag |= ADT_UI_SELECTED;
}
- notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
+ notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
}
- break;
+ break;
case ANIMTYPE_OBJECT:
{
- bDopeSheet *ads= (bDopeSheet *)ac->data;
- Scene *sce= (Scene *)ads->source;
- Base *base= (Base *)ale->data;
- Object *ob= base->object;
- AnimData *adt= ob->adt;
+ bDopeSheet *ads = (bDopeSheet *)ac->data;
+ Scene *sce = (Scene *)ads->source;
+ Base *base = (Base *)ale->data;
+ Object *ob = base->object;
+ AnimData *adt = ob->adt;
if (nlaedit_is_tweakmode_on(ac) == 0) {
/* set selection status */
if (selectmode == SELECT_INVERT) {
/* swap select */
base->flag ^= SELECT;
- ob->flag= base->flag;
+ ob->flag = base->flag;
if (adt) adt->flag ^= ADT_UI_SELECTED;
}
@@ -143,10 +143,10 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
/* deselect all */
// TODO: should this deselect all other types of channels too?
- for (b= sce->base.first; b; b= b->next) {
+ for (b = sce->base.first; b; b = b->next) {
b->flag &= ~SELECT;
- b->object->flag= b->flag;
- if (b->object->adt) b->object->adt->flag &= ~(ADT_UI_SELECTED|ADT_UI_ACTIVE);
+ b->object->flag = b->flag;
+ if (b->object->adt) b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE);
}
/* select object now */
@@ -159,13 +159,13 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
adt->flag |= ADT_UI_ACTIVE;
/* notifiers - channel was selected */
- notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
+ notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
}
}
- break;
+ break;
case ANIMTYPE_FILLACTD: /* Action Expander */
- case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
+ case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
case ANIMTYPE_DSLAM:
case ANIMTYPE_DSCAM:
case ANIMTYPE_DSCUR:
@@ -198,47 +198,47 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
ale->adt->flag |= ADT_UI_ACTIVE;
}
- notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
+ notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
}
- break;
+ break;
case ANIMTYPE_NLATRACK:
{
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
short offset;
/* offset for start of channel (on LHS of channel-list) */
if (ale->id) {
/* special exception for materials and particles */
if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
- offset= 21 + NLACHANNEL_BUTTON_WIDTH;
+ offset = 21 + NLACHANNEL_BUTTON_WIDTH;
else
- offset= 14;
+ offset = 14;
}
else
- offset= 0;
+ offset = 0;
- if (x >= (v2d->cur.xmax-NLACHANNEL_BUTTON_WIDTH)) {
+ if (x >= (v2d->cur.xmax - NLACHANNEL_BUTTON_WIDTH)) {
/* toggle protection (only if there's a toggle there) */
nlt->flag ^= NLATRACK_PROTECTED;
/* notifier flags - channel was edited */
- notifierFlags |= (ND_ANIMCHAN|NA_EDITED);
+ notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
}
- else if (x >= (v2d->cur.xmax-2*NLACHANNEL_BUTTON_WIDTH)) {
+ else if (x >= (v2d->cur.xmax - 2 * NLACHANNEL_BUTTON_WIDTH)) {
/* toggle mute */
nlt->flag ^= NLATRACK_MUTED;
/* notifier flags - channel was edited */
- notifierFlags |= (ND_ANIMCHAN|NA_EDITED);
+ notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
}
- else if (x <= ((NLACHANNEL_BUTTON_WIDTH*2)+offset)) {
+ else if (x <= ((NLACHANNEL_BUTTON_WIDTH * 2) + offset)) {
/* toggle 'solo' */
BKE_nlatrack_solo_toggle(adt, nlt);
/* notifier flags - channel was edited */
- notifierFlags |= (ND_ANIMCHAN|NA_EDITED);
+ notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
}
else if (nlaedit_is_tweakmode_on(ac) == 0) {
/* set selection */
@@ -257,19 +257,19 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nlt, ANIMTYPE_NLATRACK);
/* notifier flags - channel was selected */
- notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
+ notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
}
}
- break;
+ break;
case ANIMTYPE_NLAACTION:
{
- AnimData *adt= BKE_animdata_from_id(ale->id);
+ AnimData *adt = BKE_animdata_from_id(ale->id);
- if (x >= (v2d->cur.xmax-NLACHANNEL_BUTTON_WIDTH)) {
+ if (x >= (v2d->cur.xmax - NLACHANNEL_BUTTON_WIDTH)) {
if (nlaedit_is_tweakmode_on(ac) == 0) {
/* 'push-down' action - only usable when not in TweakMode */
// TODO: make this use the operator instead of calling the function directly
- // however, calling the operator requires that we supply the args, and that works with proper buttons only
+ // however, calling the operator requires that we supply the args, and that works with proper buttons only
BKE_nla_action_pushdown(adt);
}
else {
@@ -281,7 +281,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
notifierFlags |= ND_NLA_ACTCHANGE;
}
}
- break;
+ break;
default:
if (G.debug & G_DEBUG)
@@ -314,15 +314,15 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
return OPERATOR_CANCELLED;
/* get useful pointers from animation context data */
- snla= (SpaceNla *)ac.sl;
- ar= ac.ar;
- v2d= &ar->v2d;
+ snla = (SpaceNla *)ac.sl;
+ ar = ac.ar;
+ v2d = &ar->v2d;
/* 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 which channel user clicked in
* Note: although channels technically start at y= NLACHANNEL_FIRST, we need to adjust by half a channel's height
@@ -333,10 +333,10 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
UI_view2d_listview_view_to_cell(v2d, NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP(snla), 0, (float)NLACHANNEL_HEIGHT_HALF(snla), x, y, NULL, &channel_index);
/* handle mouse-click in the relevant channel then */
- notifierFlags= mouse_nla_channels(&ac, x, channel_index, selectmode);
+ notifierFlags = mouse_nla_channels(&ac, x, channel_index, selectmode);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|notifierFlags, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | notifierFlags, NULL);
return OPERATOR_FINISHED;
}
@@ -353,7 +353,7 @@ void NLA_OT_channels_click(wmOperatorType *ot)
ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
@@ -365,7 +365,7 @@ void NLA_OT_channels_click(wmOperatorType *ot)
/* ******************** Add Tracks Operator ***************************** */
/* Add NLA Tracks to the same AnimData block as a selected track, or above the selected tracks */
-static int nlaedit_add_tracks_exec (bContext *C, wmOperator *op)
+static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
@@ -374,21 +374,21 @@ static int nlaedit_add_tracks_exec (bContext *C, wmOperator *op)
int filter;
AnimData *lastAdt = NULL;
- short above_sel= RNA_boolean_get(op->ptr, "above_selected");
+ short above_sel = RNA_boolean_get(op->ptr, "above_selected");
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* get a list of the AnimData blocks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* add tracks... */
- for (ale= anim_data.first; ale; ale= ale->next) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
if (ale->type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
/* check if just adding a new track above this one,
* or whether we're adding a new one to the top of the stack that this one belongs to
@@ -400,7 +400,7 @@ static int nlaedit_add_tracks_exec (bContext *C, wmOperator *op)
else if ((lastAdt == NULL) || (adt != lastAdt)) {
/* add one track to the top of the owning AnimData's stack, then don't add anymore to this stack */
add_nlatrack(adt, NULL);
- lastAdt= adt;
+ lastAdt = adt;
}
}
}
@@ -409,7 +409,7 @@ static int nlaedit_add_tracks_exec (bContext *C, wmOperator *op)
BLI_freelistN(&anim_data);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -427,7 +427,7 @@ void NLA_OT_tracks_add(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "above_selected", 0, "Above Selected", "Add a new NLA Track above every existing selected one");
@@ -436,7 +436,7 @@ void NLA_OT_tracks_add(wmOperatorType *ot)
/* ******************** Delete Tracks Operator ***************************** */
/* Delete selected NLA Tracks */
-static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_delete_tracks_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -449,14 +449,14 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of the AnimData blocks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* delete tracks */
- for (ale= anim_data.first; ale; ale= ale->next) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
if (ale->type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
/* if track is currently 'solo', then AnimData should have its
* 'has solo' flag disabled
@@ -473,7 +473,7 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
BLI_freelistN(&anim_data);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -491,7 +491,7 @@ void NLA_OT_delete_tracks(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* *********************************************** */
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index d331415bc46..c12cd6f2d39 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -66,7 +66,7 @@
#include "UI_view2d.h"
-#include "nla_intern.h" // own include
+#include "nla_intern.h" /* own include */
/* *********************************************** */
@@ -77,29 +77,29 @@
/* get colors for drawing Action-Line
* NOTE: color returned includes fine-tuned alpha!
*/
-static void nla_action_get_color (AnimData *adt, bAction *act, float color[4])
+static void nla_action_get_color(AnimData *adt, bAction *act, float color[4])
{
if (adt && (adt->flag & ADT_NLA_EDIT_ON)) {
// greenish color (same as tweaking strip) - hardcoded for now
- color[0]= 0.30f;
- color[1]= 0.95f;
- color[2]= 0.10f;
- color[3]= 0.30f;
+ color[0] = 0.30f;
+ color[1] = 0.95f;
+ color[2] = 0.10f;
+ color[3] = 0.30f;
}
else {
if (act) {
// reddish color - hardcoded for now
- color[0]= 0.8f;
- color[1]= 0.2f;
- color[2]= 0.0f;
- color[3]= 0.4f;
+ color[0] = 0.8f;
+ color[1] = 0.2f;
+ color[2] = 0.0f;
+ color[3] = 0.4f;
}
else {
// greyish-red color - hardcoded for now
- color[0]= 0.6f;
- color[1]= 0.5f;
- color[2]= 0.5f;
- color[3]= 0.3f;
+ color[0] = 0.6f;
+ color[1] = 0.5f;
+ color[2] = 0.5f;
+ color[3] = 0.3f;
}
}
@@ -109,7 +109,7 @@ static void nla_action_get_color (AnimData *adt, bAction *act, float color[4])
}
/* draw the keyframes in the specified Action */
-static void nla_action_draw_keyframes (AnimData *adt, bAction *act, View2D *v2d, float y, float ymin, float ymax)
+static void nla_action_draw_keyframes(AnimData *adt, bAction *act, View2D *v2d, float y, float ymin, float ymax)
{
DLRBT_Tree keys;
ActKeyColumn *ak;
@@ -132,13 +132,13 @@ static void nla_action_draw_keyframes (AnimData *adt, bAction *act, View2D *v2d,
color[3] *= 2.5f;
glColor4fv(color);
- /* - draw a rect from the first to the last frame (no extra overlaps for now)
+ /* - draw a rect from the first to the last frame (no extra overlaps for now)
* that is slightly stumpier than the track background (hardcoded 2-units here)
*/
- f1= ((ActKeyColumn *)keys.first)->cfra;
- f2= ((ActKeyColumn *)keys.last)->cfra;
+ f1 = ((ActKeyColumn *)keys.first)->cfra;
+ f2 = ((ActKeyColumn *)keys.last)->cfra;
- glRectf(f1, ymin+2, f2, ymax-2);
+ glRectf(f1, ymin + 2, f2, ymax - 2);
/* get View2D scaling factor */
@@ -150,7 +150,7 @@ static void nla_action_draw_keyframes (AnimData *adt, bAction *act, View2D *v2d,
/* just draw each keyframe as a simple dot (regardless of the selection status)
* - size is 3.0f which is smaller than the editable keyframes, so that there is a distinction
*/
- for (ak= keys.first; ak; ak= ak->next)
+ for (ak = keys.first; ak; ak = ak->next)
draw_keyframe_shape(ak->cfra, y, xscale, 3.0f, 0, ak->key_type, KEYFRAME_SHAPE_FRAME, 1.0f);
/* free icons */
@@ -160,23 +160,23 @@ static void nla_action_draw_keyframes (AnimData *adt, bAction *act, View2D *v2d,
/* Strips (Proper) ---------------------- */
/* get colors for drawing NLA-Strips */
-static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float color[3])
+static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float color[3])
{
if (strip->type == NLASTRIP_TYPE_TRANSITION) {
/* Transition Clip */
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* selected - use a bright blue color */
// FIXME: hardcoded temp-hack colors
- color[0]= 0.18f;
- color[1]= 0.46f;
- color[2]= 0.86f;
+ color[0] = 0.18f;
+ color[1] = 0.46f;
+ color[2] = 0.86f;
}
else {
/* normal, unselected strip - use (hardly noticeable) blue tinge */
// FIXME: hardcoded temp-hack colors
- color[0]= 0.11f;
- color[1]= 0.15f;
- color[2]= 0.19f;
+ color[0] = 0.11f;
+ color[1] = 0.15f;
+ color[2] = 0.19f;
}
}
else if (strip->type == NLASTRIP_TYPE_META) {
@@ -185,16 +185,16 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* selected - use a bold purple color */
// FIXME: hardcoded temp-hack colors
- color[0]= 0.41f;
- color[1]= 0.13f;
- color[2]= 0.59f;
+ color[0] = 0.41f;
+ color[1] = 0.13f;
+ color[2] = 0.59f;
}
else {
/* normal, unselected strip - use (hardly noticeable) dark purple tinge */
// FIXME: hardcoded temp-hack colors
- color[0]= 0.20f;
- color[1]= 0.15f;
- color[2]= 0.26f;
+ color[0] = 0.20f;
+ color[1] = 0.15f;
+ color[2] = 0.26f;
}
}
else if (strip->type == NLASTRIP_TYPE_SOUND) {
@@ -202,16 +202,16 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* selected - use a bright teal color */
// FIXME: hardcoded temp-hack colors
- color[0]= 0.12f;
- color[1]= 0.48f;
- color[2]= 0.48f;
+ color[0] = 0.12f;
+ color[1] = 0.48f;
+ color[2] = 0.48f;
}
else {
/* normal, unselected strip - use (hardly noticeable) teal tinge */
// FIXME: hardcoded temp-hack colors
- color[0]= 0.17f;
- color[1]= 0.24f;
- color[2]= 0.24f;
+ color[0] = 0.17f;
+ color[1] = 0.24f;
+ color[2] = 0.24f;
}
}
else {
@@ -221,18 +221,18 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co
* however, this case should be skipped for when not in EditMode...
*/
// FIXME: hardcoded temp-hack colors
- color[0]= 0.3f;
- color[1]= 0.95f;
- color[2]= 0.1f;
+ color[0] = 0.3f;
+ color[1] = 0.95f;
+ color[2] = 0.1f;
}
else if (strip->flag & NLASTRIP_FLAG_TWEAKUSER) {
/* alert user that this strip is also used by the tweaking track (this is set when going into
* 'editmode' for that strip), since the edits made here may not be what the user anticipated
*/
// FIXME: hardcoded temp-hack colors
- color[0]= 0.85f;
- color[1]= 0.0f;
- color[2]= 0.0f;
+ color[0] = 0.85f;
+ color[1] = 0.0f;
+ color[2] = 0.0f;
}
else if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* selected strip - use theme color for selected */
@@ -246,7 +246,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co
}
/* helper call for drawing influence/time control curves for a given NLA-strip */
-static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc)
+static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc)
{
const float yheight = ymaxc - yminc;
@@ -261,39 +261,39 @@ static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc)
/* influence -------------------------- */
if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) {
- FCurve *fcu= list_find_fcurve(&strip->fcurves, "influence", 0);
+ FCurve *fcu = list_find_fcurve(&strip->fcurves, "influence", 0);
float cfra;
/* plot the curve (over the strip's main region) */
glBegin(GL_LINE_STRIP);
- /* sample at 1 frame intervals, and draw
- * - min y-val is yminc, max is y-maxc, so clamp in those regions
- */
- for (cfra= strip->start; cfra <= strip->end; cfra += 1.0f) {
- float y= evaluate_fcurve(fcu, cfra); // assume this to be in 0-1 range
- glVertex2f(cfra, ((y*yheight)+yminc));
- }
+ /* sample at 1 frame intervals, and draw
+ * - min y-val is yminc, max is y-maxc, so clamp in those regions
+ */
+ for (cfra = strip->start; cfra <= strip->end; cfra += 1.0f) {
+ float y = evaluate_fcurve(fcu, cfra); // assume this to be in 0-1 range
+ glVertex2f(cfra, ((y * yheight) + yminc));
+ }
glEnd(); // GL_LINE_STRIP
}
else {
/* use blend in/out values only if both aren't zero */
- if ((IS_EQF(strip->blendin, 0.0f) && IS_EQF(strip->blendout, 0.0f))==0) {
+ if ((IS_EQF(strip->blendin, 0.0f) && IS_EQF(strip->blendout, 0.0f)) == 0) {
glBegin(GL_LINE_STRIP);
- /* start of strip - if no blendin, start straight at 1, otherwise from 0 to 1 over blendin frames */
- if (IS_EQF(strip->blendin, 0.0f) == 0) {
- glVertex2f(strip->start, yminc);
- glVertex2f(strip->start + strip->blendin, ymaxc);
- }
- else
- glVertex2f(strip->start, ymaxc);
+ /* start of strip - if no blendin, start straight at 1, otherwise from 0 to 1 over blendin frames */
+ if (IS_EQF(strip->blendin, 0.0f) == 0) {
+ glVertex2f(strip->start, yminc);
+ glVertex2f(strip->start + strip->blendin, ymaxc);
+ }
+ else
+ glVertex2f(strip->start, ymaxc);
- /* end of strip */
- if (IS_EQF(strip->blendout, 0.0f) == 0) {
- glVertex2f(strip->end - strip->blendout, ymaxc);
- glVertex2f(strip->end, yminc);
- }
- else
- glVertex2f(strip->end, ymaxc);
+ /* end of strip */
+ if (IS_EQF(strip->blendout, 0.0f) == 0) {
+ glVertex2f(strip->end - strip->blendout, ymaxc);
+ glVertex2f(strip->end, yminc);
+ }
+ else
+ glVertex2f(strip->end, ymaxc);
glEnd(); // GL_LINE_STRIP
}
}
@@ -307,9 +307,9 @@ static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc)
}
/* main call for drawing a single NLA-strip */
-static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStrip *strip, View2D *v2d, float yminc, float ymaxc)
+static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStrip *strip, View2D *v2d, float yminc, float ymaxc)
{
- short nonSolo = ((adt && (adt->flag & ADT_NLA_SOLO_TRACK)) && (nlt->flag & NLATRACK_SOLO)==0);
+ short nonSolo = ((adt && (adt->flag & ADT_NLA_SOLO_TRACK)) && (nlt->flag & NLATRACK_SOLO) == 0);
float color[3];
/* get color of strip */
@@ -335,34 +335,34 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr
/* draw the rect to the edge of the screen */
glBegin(GL_QUADS);
- glVertex2f(v2d->cur.xmin, yminc);
- glVertex2f(v2d->cur.xmin, ymaxc);
- glVertex2f(strip->start, ymaxc);
- glVertex2f(strip->start, yminc);
+ glVertex2f(v2d->cur.xmin, yminc);
+ glVertex2f(v2d->cur.xmin, ymaxc);
+ glVertex2f(strip->start, ymaxc);
+ glVertex2f(strip->start, yminc);
glEnd();
}
- /* no break needed... */
+ /* no break needed... */
/* this only draws after the strip */
case NLASTRIP_EXTEND_HOLD_FORWARD:
/* only need to try and draw if the next strip doesn't occur immediately after */
- if ((strip->next == NULL) || (IS_EQF(strip->next->start, strip->end)==0)) {
+ if ((strip->next == NULL) || (IS_EQF(strip->next->start, strip->end) == 0)) {
/* set the drawing color to the color of the strip, but this time less faint */
glColor4f(color[0], color[1], color[2], 0.3f);
/* draw the rect to the next strip or the edge of the screen */
glBegin(GL_QUADS);
- glVertex2f(strip->end, yminc);
- glVertex2f(strip->end, ymaxc);
+ glVertex2f(strip->end, yminc);
+ glVertex2f(strip->end, ymaxc);
- if (strip->next) {
- glVertex2f(strip->next->start, ymaxc);
- glVertex2f(strip->next->start, yminc);
- }
- else {
- glVertex2f(v2d->cur.xmax, ymaxc);
- glVertex2f(v2d->cur.xmax, yminc);
- }
+ if (strip->next) {
+ glVertex2f(strip->next->start, ymaxc);
+ glVertex2f(strip->next->start, yminc);
+ }
+ else {
+ glVertex2f(v2d->cur.xmax, ymaxc);
+ glVertex2f(v2d->cur.xmax, yminc);
+ }
glEnd();
}
break;
@@ -385,7 +385,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr
glColor4f(color[0], color[1], color[2], 0.1f);
glEnable(GL_BLEND);
- glRectf(strip->start, yminc, strip->end, ymaxc);
+ glRectf(strip->start, yminc, strip->end, ymaxc);
glDisable(GL_BLEND);
}
@@ -417,7 +417,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr
uiDrawBoxShade(GL_LINE_LOOP, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1);
/* if action-clip strip, draw lines delimiting repeats too (in the same color as outline) */
- if ((strip->type == NLASTRIP_TYPE_CLIP) && IS_EQF(strip->repeat, 1.0f)==0) {
+ if ((strip->type == NLASTRIP_TYPE_CLIP) && IS_EQF(strip->repeat, 1.0f) == 0) {
float repeatLen = (strip->actend - strip->actstart) * strip->scale;
int i;
@@ -429,20 +429,20 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr
/* don't draw if line would end up on or after the end of the strip */
if (repeatPos < strip->end)
- fdrawline(repeatPos, yminc+4, repeatPos, ymaxc-4);
+ fdrawline(repeatPos, yminc + 4, repeatPos, ymaxc - 4);
}
}
/* or if meta-strip, draw lines delimiting extents of sub-strips (in same color as outline, if more than 1 exists) */
else if ((strip->type == NLASTRIP_TYPE_META) && (strip->strips.first != strip->strips.last)) {
NlaStrip *cs;
- float y= (ymaxc-yminc)/2.0f + yminc;
+ float y = (ymaxc - yminc) / 2.0f + yminc;
/* only draw first-level of child-strips, but don't draw any lines on the endpoints */
- for (cs= strip->strips.first; cs; cs= cs->next) {
+ for (cs = strip->strips.first; cs; cs = cs->next) {
/* draw start-line if not same as end of previous (and only if not the first strip)
* - on upper half of strip
*/
- if ((cs->prev) && IS_EQF(cs->prev->end, cs->start)==0)
+ if ((cs->prev) && IS_EQF(cs->prev->end, cs->start) == 0)
fdrawline(cs->start, y, cs->start, ymaxc);
/* draw end-line if not the last strip
@@ -458,9 +458,9 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr
}
/* add the relevant text to the cache of text-strings to draw in pixelspace */
-static void nla_draw_strip_text (AnimData *adt, NlaTrack *nlt, NlaStrip *strip, int index, View2D *v2d, float yminc, float ymaxc)
+static void nla_draw_strip_text(AnimData *adt, NlaTrack *nlt, NlaStrip *strip, int index, View2D *v2d, float yminc, float ymaxc)
{
- short notSolo = ((adt && (adt->flag & ADT_NLA_SOLO_TRACK)) && (nlt->flag & NLATRACK_SOLO)==0);
+ short notSolo = ((adt && (adt->flag & ADT_NLA_SOLO_TRACK)) && (nlt->flag & NLATRACK_SOLO) == 0);
char str[256];
char col[4];
float xofs;
@@ -475,18 +475,18 @@ static void nla_draw_strip_text (AnimData *adt, NlaTrack *nlt, NlaStrip *strip,
}
/* set text color - if colors (see above) are light, draw black text, otherwise draw white */
- if (strip->flag & (NLASTRIP_FLAG_ACTIVE|NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_TWEAKUSER)) {
- col[0]= col[1]= col[2]= 0;
+ if (strip->flag & (NLASTRIP_FLAG_ACTIVE | NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_TWEAKUSER)) {
+ col[0] = col[1] = col[2] = 0;
}
else {
- col[0]= col[1]= col[2]= 255;
+ col[0] = col[1] = col[2] = 255;
}
/* text opacity depends on whether if there's a solo'd track, this isn't it */
if (notSolo == 0)
- col[3]= 255;
+ col[3] = 255;
else
- col[3]= 128;
+ col[3] = 128;
/* determine the amount of padding required - cannot be constant otherwise looks weird in some cases */
if ((strip->end - strip->start) <= 5.0f)
@@ -523,13 +523,13 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
* - 1 dp is compromise between lack of precision (ints only, as per sequencer)
* while also preserving some accuracy, since we do use floats
*/
- /* start frame */
+ /* start frame */
BLI_snprintf(numstr, sizeof(numstr), "%.1f", strip->start);
- UI_view2d_text_cache_add(v2d, strip->start-1.0f, ymaxc+ytol, numstr, col);
+ UI_view2d_text_cache_add(v2d, strip->start - 1.0f, ymaxc + ytol, numstr, col);
- /* end frame */
+ /* end frame */
BLI_snprintf(numstr, sizeof(numstr), "%.1f", strip->end);
- UI_view2d_text_cache_add(v2d, strip->end, ymaxc+ytol, numstr, col);
+ UI_view2d_text_cache_add(v2d, strip->end, ymaxc + ytol, numstr, col);
}
/* ---------------------- */
@@ -540,49 +540,49 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
bAnimListElem *ale;
int filter;
- View2D *v2d= &ar->v2d;
- float y= 0.0f;
+ View2D *v2d = &ar->v2d;
+ float y = 0.0f;
size_t items;
int height;
/* 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 NLACHANNEL_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= ((items*NLACHANNEL_STEP(snla)) + (NLACHANNEL_HEIGHT(snla)*2));
+ height = ((items * NLACHANNEL_STEP(snla)) + (NLACHANNEL_HEIGHT(snla) * 2));
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
v2d->tot.ymin = (float)(-height);
/* loop through channels, and set up drawing depending on their type */
- y= (float)(-NLACHANNEL_HEIGHT(snla));
+ y = (float)(-NLACHANNEL_HEIGHT(snla));
- for (ale= anim_data.first; ale; ale= ale->next) {
- const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
- const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ const float yminc = (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
+ const float ymaxc = (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
/* 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) )
{
/* data to draw depends on the type of channel */
switch (ale->type) {
case ANIMTYPE_NLATRACK:
{
- AnimData *adt= ale->adt;
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
int index;
/* draw each strip in the track (if visible) */
- for (strip=nlt->strips.first, index=1; strip; strip=strip->next, index++) {
+ for (strip = nlt->strips.first, index = 1; strip; strip = strip->next, index++) {
if (BKE_nlastrip_within_bounds(strip, v2d->cur.xmin, v2d->cur.xmax)) {
/* draw the visualisation of the strip */
nla_draw_strip(snla, adt, nlt, strip, v2d, yminc, ymaxc);
@@ -598,11 +598,11 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
}
}
}
- break;
+ break;
case ANIMTYPE_NLAACTION:
{
- AnimData *adt= ale->adt;
+ AnimData *adt = ale->adt;
float color[4];
/* just draw a semi-shaded rect spanning the width of the viewable area if there's data,
@@ -618,27 +618,27 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* draw slightly shifted up for greater separation from standard channels,
* but also slightly shorter for some more contrast when viewing the strips
*/
- glRectf(v2d->cur.xmin, yminc+NLACHANNEL_SKIP, v2d->cur.xmax, ymaxc-NLACHANNEL_SKIP);
+ glRectf(v2d->cur.xmin, yminc + NLACHANNEL_SKIP, v2d->cur.xmax, ymaxc - NLACHANNEL_SKIP);
/* draw keyframes in the action */
- nla_action_draw_keyframes(adt, ale->data, v2d, y, yminc+NLACHANNEL_SKIP, ymaxc-NLACHANNEL_SKIP);
+ nla_action_draw_keyframes(adt, ale->data, v2d, y, yminc + NLACHANNEL_SKIP, ymaxc - NLACHANNEL_SKIP);
/* draw 'embossed' lines above and below the strip for effect */
- /* white base-lines */
+ /* white base-lines */
glLineWidth(2.0f);
glColor4f(1.0f, 1.0f, 1.0f, 0.3);
- fdrawline(v2d->cur.xmin, yminc+NLACHANNEL_SKIP, v2d->cur.xmax, yminc+NLACHANNEL_SKIP);
- fdrawline(v2d->cur.xmin, ymaxc-NLACHANNEL_SKIP, v2d->cur.xmax, ymaxc-NLACHANNEL_SKIP);
+ fdrawline(v2d->cur.xmin, yminc + NLACHANNEL_SKIP, v2d->cur.xmax, yminc + NLACHANNEL_SKIP);
+ fdrawline(v2d->cur.xmin, ymaxc - NLACHANNEL_SKIP, v2d->cur.xmax, ymaxc - NLACHANNEL_SKIP);
- /* black top-lines */
+ /* black top-lines */
glLineWidth(1.0f);
glColor3f(0.0f, 0.0f, 0.0f);
- fdrawline(v2d->cur.xmin, yminc+NLACHANNEL_SKIP, v2d->cur.xmax, yminc+NLACHANNEL_SKIP);
- fdrawline(v2d->cur.xmin, ymaxc-NLACHANNEL_SKIP, v2d->cur.xmax, ymaxc-NLACHANNEL_SKIP);
+ fdrawline(v2d->cur.xmin, yminc + NLACHANNEL_SKIP, v2d->cur.xmax, yminc + NLACHANNEL_SKIP);
+ fdrawline(v2d->cur.xmin, ymaxc - NLACHANNEL_SKIP, v2d->cur.xmax, ymaxc - NLACHANNEL_SKIP);
glDisable(GL_BLEND);
}
- break;
+ break;
}
}
@@ -655,40 +655,40 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* old code for drawing NLA channels using GL only */
// TODO: depreceate this code...
-static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, View2D *v2d, float y)
+static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View2D *v2d, float y)
{
SpaceNla *snla = (SpaceNla *)ac->sl;
bAnimListElem *ale;
float x = 0.0f;
/* loop through channels, and set up drawing depending on their type */
- for (ale= anim_data->first; ale; ale= ale->next) {
- const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
- const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
- const float ydatac= (float)(y - 7);
+ for (ale = anim_data->first; ale; ale = ale->next) {
+ const float yminc = (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
+ const float ymaxc = (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
+ const float ydatac = (float)(y - 7);
/* 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) )
{
AnimData *adt = ale->adt;
- short indent= 0, offset= 0, sel= 0, group= 0, nonSolo= 0;
- int expand= -1, protect = -1, special= -1, mute = -1;
+ short indent = 0, offset = 0, sel = 0, group = 0, nonSolo = 0;
+ int expand = -1, protect = -1, special = -1, mute = -1;
char name[128];
- short doDraw=0;
+ short doDraw = 0;
/* determine what needs to be drawn */
switch (ale->type) {
case ANIMTYPE_NLATRACK: /* NLA Track */
{
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
/* 'solo' as the 'special' button? */
if (nlt->flag & NLATRACK_SOLO)
- special= ICON_SOLO_ON;
+ special = ICON_SOLO_ON;
else
- special= ICON_SOLO_OFF;
+ special = ICON_SOLO_OFF;
/* if this track is active and we're tweaking it, don't draw these toggles */
// TODO: need a special macro for this...
@@ -708,7 +708,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
if ((adt) && (adt->flag & ADT_NLA_SOLO_TRACK)) {
if ((nlt->flag & NLATRACK_SOLO) == 0) {
/* tag for special non-solo handling; also hide the mute toggles */
- nonSolo= 1;
+ nonSolo = 1;
mute = 0;
}
}
@@ -717,26 +717,26 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
BLI_strncpy(name, nlt->name, sizeof(name));
// draw manually still
- doDraw= 1;
+ doDraw = 1;
}
- break;
+ break;
case ANIMTYPE_NLAACTION: /* NLA Action-Line */
{
- bAction *act= (bAction *)ale->data;
+ bAction *act = (bAction *)ale->data;
group = 5;
special = ICON_ACTION;
if (act)
- BLI_snprintf(name, sizeof(name), "%s", act->id.name+2);
+ BLI_snprintf(name, sizeof(name), "%s", act->id.name + 2);
else
BLI_strncpy(name, "<No Action>", sizeof(name));
// draw manually still
- doDraw= 1;
+ doDraw = 1;
}
- break;
+ break;
default: /* handled by standard channel-drawing API */
// draw backdrops only...
@@ -749,8 +749,8 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
if (ale->id) {
/* special exception for textures */
if (GS(ale->id->name) == ID_TE) {
- offset= 14;
- indent= 1;
+ offset = 14;
+ indent = 1;
}
/* special exception for nodetrees */
else if (GS(ale->id->name) == ID_NT) {
@@ -760,30 +760,32 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
case NTREE_SHADER:
{
/* same as for textures */
- offset= 14;
- indent= 1;
+ offset = 14;
+ indent = 1;
}
- break;
+ break;
case NTREE_TEXTURE:
{
/* even more */
- offset= 21;
- indent= 1;
+ offset = 21;
+ indent = 1;
}
- break;
+ break;
default:
/* normal will do */
- offset= 14;
+ offset = 14;
break;
}
}
- else
- offset= 14;
+ else {
+ offset = 14;
+ }
+ }
+ else {
+ offset = 0;
}
- else
- offset= 0;
/* now, start drawing based on this information */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -799,12 +801,12 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
}
else {
/* if a track is being solo'd, action is ignored, so draw less boldly (alpha lower) */
- float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK))? 0.3f : 1.0f;
+ float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f;
if (ale->data)
- glColor4f(0.8f, 0.2f, 0.0f, alpha); // reddish color - hardcoded for now
+ glColor4f(0.8f, 0.2f, 0.0f, alpha); // reddish color - hardcoded for now
else
- glColor4f(0.6f, 0.5f, 0.5f, alpha); // greyish-red color - hardcoded for now
+ glColor4f(0.6f, 0.5f, 0.5f, alpha); // greyish-red color - hardcoded for now
}
offset += 7 * indent;
@@ -815,35 +817,35 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
/* draw slightly shifted up vertically to look like it has more separation from other channels,
* but we then need to slightly shorten it so that it doesn't look like it overlaps
*/
- uiDrawBox(GL_POLYGON, x+offset, yminc+NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc+NLACHANNEL_SKIP-1, 8);
+ uiDrawBox(GL_POLYGON, x + offset, yminc + NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8);
/* clear group value, otherwise we cause errors... */
group = 0;
}
else {
/* NLA tracks - darker color if not solo track when we're showing solo */
- UI_ThemeColorShade(TH_HEADER, ((nonSolo == 0)? 20 : -20));
+ UI_ThemeColorShade(TH_HEADER, ((nonSolo == 0) ? 20 : -20));
indent += group;
offset += 7 * indent;
glBegin(GL_QUADS);
- glVertex2f(x+offset, yminc);
- glVertex2f(x+offset, ymaxc);
- glVertex2f((float)v2d->cur.xmax, ymaxc);
- glVertex2f((float)v2d->cur.xmax, yminc);
+ glVertex2f(x + offset, yminc);
+ glVertex2f(x + offset, ymaxc);
+ glVertex2f((float)v2d->cur.xmax, ymaxc);
+ glVertex2f((float)v2d->cur.xmax, yminc);
glEnd();
}
/* draw expand/collapse triangle */
if (expand > 0) {
- UI_icon_draw(x+offset, ydatac, expand);
+ UI_icon_draw(x + offset, ydatac, expand);
offset += 17;
}
/* draw special icon indicating certain data-types */
if (special > -1) {
/* for normal channels */
- UI_icon_draw(x+offset, ydatac, special);
+ UI_icon_draw(x + offset, ydatac, special);
offset += 17;
}
glDisable(GL_BLEND);
@@ -854,7 +856,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
else
UI_ThemeColor(TH_TEXT);
offset += 3;
- UI_DrawString(x+offset, y-4, name);
+ UI_DrawString(x + offset, y - 4, name);
/* reset offset - for RHS of panel */
offset = 0;
@@ -866,18 +868,18 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
/* draw protect 'lock' */
if (protect > -1) {
offset = 16;
- UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, protect);
+ UI_icon_draw((float)(v2d->cur.xmax - offset), ydatac, protect);
}
/* draw mute 'eye' */
if (mute > -1) {
offset += 16;
- UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, mute);
+ UI_icon_draw((float)(v2d->cur.xmax - offset), ydatac, mute);
}
/* draw NLA-action line 'status-icons' - only when there's an action */
if ((ale->type == ANIMTYPE_NLAACTION) && (ale->data)) {
- AnimData *adt= ale->adt;
+ AnimData *adt = ale->adt;
offset += 16;
@@ -886,28 +888,28 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
/* toggle for tweaking with mapping/no-mapping (i.e. 'in place editing' toggle) */
// for now, use pin icon to symbolise this
if (adt->flag & ADT_NLA_EDIT_NOMAP)
- UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_PINNED);
+ UI_icon_draw((float)(v2d->cur.xmax - offset), ydatac, ICON_PINNED);
else
- UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_UNPINNED);
+ UI_icon_draw((float)(v2d->cur.xmax - offset), ydatac, ICON_UNPINNED);
- fdrawline((float)(v2d->cur.xmax-offset), yminc,
- (float)(v2d->cur.xmax-offset), ymaxc);
+ fdrawline((float)(v2d->cur.xmax - offset), yminc,
+ (float)(v2d->cur.xmax - offset), ymaxc);
offset += 16;
/* 'tweaking action' indicator - not a button */
- UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_EDIT);
+ UI_icon_draw((float)(v2d->cur.xmax - offset), ydatac, ICON_EDIT);
}
else {
/* XXX firstly draw a little rect to help identify that it's different from the toggles */
glBegin(GL_LINE_LOOP);
- glVertex2f((float)v2d->cur.xmax-offset-1, y-7);
- glVertex2f((float)v2d->cur.xmax-offset-1, y+9);
- glVertex2f((float)v2d->cur.xmax-1, y+9);
- glVertex2f((float)v2d->cur.xmax-1, y-7);
+ glVertex2f((float)v2d->cur.xmax - offset - 1, y - 7);
+ glVertex2f((float)v2d->cur.xmax - offset - 1, y + 9);
+ glVertex2f((float)v2d->cur.xmax - 1, y + 9);
+ glVertex2f((float)v2d->cur.xmax - 1, y - 7);
glEnd(); // GL_LINES
/* 'push down' icon for normal active-actions */
- UI_icon_draw((float)v2d->cur.xmax-offset, ydatac, ICON_FREEZE);
+ UI_icon_draw((float)v2d->cur.xmax - offset, ydatac, ICON_FREEZE);
}
}
@@ -927,22 +929,22 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar)
int filter;
SpaceNla *snla = (SpaceNla *)ac->sl;
- View2D *v2d= &ar->v2d;
- float y= 0.0f;
+ View2D *v2d = &ar->v2d;
+ float y = 0.0f;
size_t items;
int height;
/* 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 NLACHANNEL_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= ((items*NLACHANNEL_STEP(snla)) + (NLACHANNEL_HEIGHT(snla)*2));
+ height = ((items * NLACHANNEL_STEP(snla)) + (NLACHANNEL_HEIGHT(snla) * 2));
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
@@ -951,29 +953,29 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar)
UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY);
/* draw channels */
- { /* first pass: backdrops + oldstyle drawing */
- y= (float)(-NLACHANNEL_HEIGHT(snla));
+ { /* first pass: backdrops + oldstyle drawing */
+ y = (float)(-NLACHANNEL_HEIGHT(snla));
draw_nla_channel_list_gl(ac, &anim_data, v2d, y);
}
- { /* second pass: UI widgets */
- uiBlock *block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
+ { /* second pass: UI widgets */
+ uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
size_t channel_index = 0;
- y= (float)(-NLACHANNEL_HEIGHT(snla));
+ y = (float)(-NLACHANNEL_HEIGHT(snla));
/* set blending again, as may not be set in previous step */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
/* loop through channels, and set up drawing depending on their type */
- for (ale= anim_data.first; ale; ale= ale->next) {
- const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
- const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ const float yminc = (float)(y - NLACHANNEL_HEIGHT_HALF(snla));
+ const float ymaxc = (float)(y + NLACHANNEL_HEIGHT_HALF(snla));
/* 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_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 57ad552f7e2..8a7e2a8a904 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -69,7 +69,7 @@
#include "UI_resources.h"
#include "UI_view2d.h"
-#include "nla_intern.h" // own include
+#include "nla_intern.h" // own include
#include "nla_private.h" // FIXME... maybe this shouldn't be included?
/* *********************************************** */
@@ -80,12 +80,12 @@ void ED_nla_postop_refresh(bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_FOREDIT);
+ short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_FOREDIT);
/* get blocks to work on */
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) {
/* performing auto-blending, extend-mode validation, etc. */
BKE_nla_validate_state(ale->data);
}
@@ -102,21 +102,21 @@ void ED_nla_postop_refresh(bAnimContext *ac)
* as if it were the normal Active-Action of its AnimData block.
*/
-static int nlaedit_enable_tweakmode_exec (bContext *C, wmOperator *op)
+static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- int ok=0;
+ int ok = 0;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* get a list of the AnimData blocks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* if no blocks, popup error? */
@@ -126,8 +126,8 @@ static int nlaedit_enable_tweakmode_exec (bContext *C, wmOperator *op)
}
/* for each AnimData block with NLA-data, try setting it in tweak-mode */
- for (ale= anim_data.first; ale; ale= ale->next) {
- AnimData *adt= ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ale->data;
/* try entering tweakmode if valid */
ok += BKE_nla_tweakmode_enter(adt);
@@ -144,7 +144,7 @@ static int nlaedit_enable_tweakmode_exec (bContext *C, wmOperator *op)
ac.scene->flag |= SCE_NLA_EDIT_ON;
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
}
else {
BKE_report(op->reports, RPT_ERROR, "No active strip(s) to enter tweakmode on");
@@ -167,12 +167,12 @@ void NLA_OT_tweakmode_enter(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ------------- */
-static int nlaedit_disable_tweakmode_exec (bContext *C, wmOperator *op)
+static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
@@ -185,7 +185,7 @@ static int nlaedit_disable_tweakmode_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get a list of the AnimData blocks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* if no blocks, popup error? */
@@ -195,8 +195,8 @@ static int nlaedit_disable_tweakmode_exec (bContext *C, wmOperator *op)
}
/* for each AnimData block with NLA-data, try exitting tweak-mode */
- for (ale= anim_data.first; ale; ale= ale->next) {
- AnimData *adt= ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ale->data;
/* try entering tweakmode if valid */
BKE_nla_tweakmode_exit(adt);
@@ -213,7 +213,7 @@ static int nlaedit_disable_tweakmode_exec (bContext *C, wmOperator *op)
ac.scene->flag &= ~SCE_NLA_EDIT_ON;
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
}
/* done */
@@ -232,7 +232,7 @@ void NLA_OT_tweakmode_exit(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_on;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* *********************************************** */
@@ -241,24 +241,24 @@ void NLA_OT_tweakmode_exit(wmOperatorType *ot)
/* *************************** Calculate Range ************************** */
/* Get the min/max strip extents */
-static void get_nlastrip_extents (bAnimContext *ac, float *min, float *max, const short onlySel)
+static void get_nlastrip_extents(bAnimContext *ac, float *min, float *max, const short onlySel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
/* get data to filter */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* set large values to try to override */
- *min= 999999999.0f;
- *max= -999999999.0f;
+ *min = 999999999.0f;
+ *max = -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) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
@@ -278,12 +278,12 @@ static void get_nlastrip_extents (bAnimContext *ac, float *min, float *max, cons
else {
/* set default range */
if (ac->scene) {
- *min= (float)ac->scene->r.sfra;
- *max= (float)ac->scene->r.efra;
+ *min = (float)ac->scene->r.sfra;
+ *max = (float)ac->scene->r.efra;
}
else {
- *min= -5;
- *max= 100;
+ *min = -5;
+ *max = 100;
}
}
}
@@ -299,12 +299,12 @@ static int nlaedit_viewall(bContext *C, const short onlySel)
/* 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_nlastrip_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, onlySel);
- 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;
@@ -347,7 +347,7 @@ void NLA_OT_view_all(wmOperatorType *ot)
ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
void NLA_OT_view_selected(wmOperatorType *ot)
@@ -362,7 +362,7 @@ void NLA_OT_view_selected(wmOperatorType *ot)
ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* *********************************************** */
@@ -373,7 +373,7 @@ void NLA_OT_view_selected(wmOperatorType *ot)
/* add the specified action as new strip */
-static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
+static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
Scene *scene;
@@ -391,11 +391,11 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- scene= ac.scene;
- cfra= (float)CFRA;
+ scene = ac.scene;
+ cfra = (float)CFRA;
/* get action to use */
- act= BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
+ act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid Action to add");
@@ -405,15 +405,15 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
else if (act->idroot == 0) {
/* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */
BKE_reportf(op->reports, RPT_WARNING,
- "Action '%s' does not specify what datablocks it can be used on. Try setting the 'ID Root Type' setting from the Datablocks Editor for this Action to avoid future problems",
- act->id.name+2);
+ "Action '%s' does not specify what datablocks it can be used on. Try setting the 'ID Root Type' setting from the Datablocks Editor for this Action to avoid future problems",
+ act->id.name + 2);
}
/* get a list of the editable tracks being shown in the NLA
* - this is limited to active ones for now, but could be expanded to
*/
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT);
- items= ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT);
+ items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
if (items == 0) {
BKE_report(op->reports, RPT_ERROR, "No active track(s) to add strip to");
@@ -421,33 +421,33 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
}
/* for every active track, try to add strip to free space in track or to the top of the stack if no space */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
- NlaStrip *strip= NULL;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
+ NlaStrip *strip = NULL;
/* sanity check: only apply actions of the right type for this ID
* NOTE: in the case that this hasn't been set, we've already warned the user about this already
*/
if ((act->idroot) && (act->idroot != GS(ale->id->name))) {
BKE_reportf(op->reports, RPT_ERROR,
- "Couldn't add action '%s' as it cannot be used relative to ID-blocks of type '%s'",
- act->id.name+2, ale->id->name);
+ "Couldn't add action '%s' as it cannot be used relative to ID-blocks of type '%s'",
+ act->id.name + 2, ale->id->name);
continue;
}
/* create a new strip, and offset it to start on the current frame */
- strip= add_nlastrip(act);
+ strip = add_nlastrip(act);
- strip->end += (cfra - strip->start);
- strip->start = cfra;
+ strip->end += (cfra - strip->start);
+ strip->start = cfra;
/* firstly try adding strip to our current track, but if that fails, add to a new track */
if (BKE_nlatrack_add_strip(nlt, strip) == 0) {
/* trying to add to the current failed (no space),
* so add a new track to the stack, and add to that...
*/
- nlt= add_nlatrack(adt, NULL);
+ nlt = add_nlatrack(adt, NULL);
BKE_nlatrack_add_strip(nlt, strip);
}
@@ -462,7 +462,7 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -483,11 +483,11 @@ void NLA_OT_actionclip_add(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- // TODO: this would be nicer as an ID-pointer...
- prop= RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
+ // TODO: this would be nicer as an ID-pointer...
+ prop = RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
RNA_def_enum_funcs(prop, RNA_action_itemf);
ot->prop = prop;
}
@@ -495,7 +495,7 @@ void NLA_OT_actionclip_add(wmOperatorType *ot)
/* ******************** Add Transition Operator ***************************** */
/* Add a new transition strip between selected strips */
-static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
+static int nlaedit_add_transition_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
@@ -510,23 +510,23 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each track, find pairs of strips to add transitions to */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
NlaStrip *s1, *s2;
/* get initial pair of strips */
if (ELEM(nlt->strips.first, NULL, nlt->strips.last))
continue;
- s1= nlt->strips.first;
- s2= s1->next;
+ s1 = nlt->strips.first;
+ s2 = s1->next;
/* loop over strips */
- for (; s1 && s2; s1=s2, s2=s2->next) {
+ for (; s1 && s2; s1 = s2, s2 = s2->next) {
NlaStrip *strip;
/* check if both are selected */
@@ -537,7 +537,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
continue;
/* make sure neither one is a transition
* - although this is impossible to create with the standard tools,
- * the user may have altered the settings
+ * the user may have altered the settings
*/
if (ELEM(NLASTRIP_TYPE_TRANSITION, s1->type, s2->type))
continue;
@@ -546,25 +546,25 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
continue;
/* allocate new strip */
- strip= MEM_callocN(sizeof(NlaStrip), "NlaStrip");
+ strip = MEM_callocN(sizeof(NlaStrip), "NlaStrip");
BLI_insertlinkafter(&nlt->strips, s1, strip);
/* set the type */
- strip->type= NLASTRIP_TYPE_TRANSITION;
+ strip->type = NLASTRIP_TYPE_TRANSITION;
/* generic settings
* - selected flag to highlight this to the user
* - auto-blends to ensure that blend in/out values are automatically
* determined by overlaps of strips
*/
- strip->flag = NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_AUTO_BLENDS;
+ strip->flag = NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_AUTO_BLENDS;
/* range is simply defined as the endpoints of the adjacent strips */
- strip->start = s1->end;
- strip->end = s2->start;
+ strip->start = s1->end;
+ strip->end = s2->start;
/* scale and repeat aren't of any use, but shouldn't ever be 0 */
- strip->scale= 1.0f;
+ strip->scale = 1.0f;
strip->repeat = 1.0f;
/* auto-name it */
@@ -584,7 +584,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -607,13 +607,13 @@ void NLA_OT_transition_add(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Add Sound Clip Operator ***************************** */
/* Add a new sound clip */
-static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_add_sound_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -632,16 +632,16 @@ static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
cfra = CFRA;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each track, add sound clips if it belongs to a speaker */
// TODO: what happens if there aren't any tracks... well that's a more general problem for later
- for (ale= anim_data.first; ale; ale= ale->next) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
Object *ob = (Object *)ale->id; /* may not be object until we actually check! */
AnimData *adt = ale->adt;
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* does this belong to speaker - assumed to live on Object level only */
@@ -649,17 +649,17 @@ static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
continue;
/* create a new strip, and offset it to start on the current frame */
- strip= add_nla_soundstrip(ac.scene, ob->data);
+ strip = add_nla_soundstrip(ac.scene, ob->data);
- strip->start += cfra;
- strip->end += cfra;
+ strip->start += cfra;
+ strip->end += cfra;
/* firstly try adding strip to our current track, but if that fails, add to a new track */
if (BKE_nlatrack_add_strip(nlt, strip) == 0) {
/* trying to add to the current failed (no space),
* so add a new track to the stack, and add to that...
*/
- nlt= add_nlatrack(adt, NULL);
+ nlt = add_nlatrack(adt, NULL);
BKE_nlatrack_add_strip(nlt, strip);
}
@@ -674,7 +674,7 @@ static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -692,14 +692,14 @@ void NLA_OT_soundclip_add(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Add Meta-Strip Operator ***************************** */
/* Add new meta-strips incorporating the selected strips */
/* add the specified action as new strip */
-static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_add_meta_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -712,20 +712,20 @@ static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each track, find pairs of strips to add transitions to */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
NlaStrip *strip;
/* create meta-strips from the continuous chains of selected strips */
BKE_nlastrips_make_metas(&nlt->strips, 0);
/* name the metas */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* auto-name this strip if selected (that means it is a meta) */
if (strip->flag & NLASTRIP_FLAG_SELECT)
BKE_nlastrip_validate_name(adt, strip);
@@ -736,7 +736,7 @@ static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op))
BLI_freelistN(&anim_data);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -754,13 +754,13 @@ void NLA_OT_meta_add(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Remove Meta-Strip Operator ***************************** */
/* Separate out the strips held by the selected meta-strips */
-static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_remove_meta_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -773,12 +773,12 @@ static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each track, find pairs of strips to add transitions to */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
/* clear all selected meta-strips, regardless of whether they are temporary or not */
BKE_nlastrips_clear_metas(&nlt->strips, 1, 0);
@@ -788,7 +788,7 @@ static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op))
BLI_freelistN(&anim_data);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -806,7 +806,7 @@ void NLA_OT_meta_remove(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Duplicate Strips Operator ************************** */
@@ -814,7 +814,7 @@ void NLA_OT_meta_remove(wmOperatorType *ot)
* the originals were housed in.
*/
-static int nlaedit_duplicate_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -829,25 +829,25 @@ static int nlaedit_duplicate_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* duplicate strips in tracks starting from the last one so that we're
* less likely to duplicate strips we just duplicated...
*/
- for (ale= anim_data.last; ale; ale= ale->prev) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
+ for (ale = anim_data.last; ale; ale = ale->prev) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
NlaStrip *strip, *nstrip, *next;
NlaTrack *track;
- for (strip= nlt->strips.first; strip; strip= next) {
- next= strip->next;
+ for (strip = nlt->strips.first; strip; strip = next) {
+ next = strip->next;
/* if selected, split the strip at its midpoint */
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* make a copy (assume that this is possible) */
- nstrip= copy_nlastrip(strip);
+ nstrip = copy_nlastrip(strip);
/* in case there's no space in the track above, or we haven't got a reference to it yet, try adding */
if (BKE_nlatrack_add_strip(nlt->next, nstrip) == 0) {
@@ -855,12 +855,12 @@ static int nlaedit_duplicate_exec (bContext *C, wmOperator *UNUSED(op))
* - if the current one is the last one, nlt->next will be NULL, which defaults to adding
* at the top of the stack anyway...
*/
- track= add_nlatrack(adt, nlt->next);
+ track = add_nlatrack(adt, nlt->next);
BKE_nlatrack_add_strip(track, nstrip);
}
/* deselect the original and the active flag */
- strip->flag &= ~(NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_ACTIVE);
+ strip->flag &= ~(NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE);
/* auto-name newly created strip */
BKE_nlastrip_validate_name(adt, nstrip);
@@ -878,7 +878,7 @@ static int nlaedit_duplicate_exec (bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -910,7 +910,7 @@ void NLA_OT_duplicate(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* 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", "");
@@ -919,7 +919,7 @@ void NLA_OT_duplicate(wmOperatorType *ot)
/* ******************** Delete Strips Operator ***************************** */
/* Deletes the selected NLA-Strips */
-static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -932,16 +932,16 @@ static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each NLA-Track, delete all selected strips */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip, *nstrip;
- for (strip= nlt->strips.first; strip; strip= nstrip) {
- nstrip= strip->next;
+ for (strip = nlt->strips.first; strip; strip = nstrip) {
+ nstrip = strip->next;
/* if selected, delete */
if (strip->flag & NLASTRIP_FLAG_SELECT) {
@@ -949,7 +949,7 @@ static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION))
free_nlastrip(&nlt->strips, strip->prev);
if ((nstrip) && (nstrip->type == NLASTRIP_TYPE_TRANSITION)) {
- nstrip= nstrip->next;
+ nstrip = nstrip->next;
free_nlastrip(&nlt->strips, strip->next);
}
@@ -966,7 +966,7 @@ static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -984,17 +984,17 @@ void NLA_OT_delete(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Split Strips Operator ***************************** */
/* Splits the selected NLA-Strips into two strips at the midpoint of the strip */
// TODO's?
-// - multiple splits
-// - variable-length splits?
+// - multiple splits
+// - variable-length splits?
/* split a given Action-Clip strip */
-static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip *strip, float cfra)
+static void nlaedit_split_strip_actclip(AnimData *adt, NlaTrack *nlt, NlaStrip *strip, float cfra)
{
NlaStrip *nstrip;
float splitframe, splitaframe;
@@ -1004,44 +1004,44 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip
*/
if ((cfra > strip->start) && (cfra < strip->end)) {
/* use the current frame */
- splitframe= cfra;
- splitaframe= nlastrip_get_frame(strip, cfra, NLATIME_CONVERT_UNMAP);
+ splitframe = cfra;
+ splitaframe = nlastrip_get_frame(strip, cfra, NLATIME_CONVERT_UNMAP);
}
else {
/* split in the middle */
float len;
- /* strip extents */
- len= strip->end - strip->start;
+ /* strip extents */
+ len = strip->end - strip->start;
if (IS_EQF(len, 0.0f))
return;
else
- splitframe= strip->start + (len / 2.0f);
+ splitframe = strip->start + (len / 2.0f);
- /* action range */
- len= strip->actend - strip->actstart;
+ /* action range */
+ len = strip->actend - strip->actstart;
if (IS_EQF(len, 0.0f))
- splitaframe= strip->actend;
+ splitaframe = strip->actend;
else
- splitaframe= strip->actstart + (len / 2.0f);
+ splitaframe = strip->actstart + (len / 2.0f);
}
/* make a copy (assume that this is possible) and append
* it immediately after the current strip
*/
- nstrip= copy_nlastrip(strip);
+ nstrip = copy_nlastrip(strip);
BLI_insertlinkafter(&nlt->strips, strip, nstrip);
/* set the endpoint of the first strip and the start of the new strip
* to the splitframe values calculated above
*/
- strip->end= splitframe;
- nstrip->start= splitframe;
+ strip->end = splitframe;
+ nstrip->start = splitframe;
if ((splitaframe > strip->actstart) && (splitaframe < strip->actend)) {
/* only do this if we're splitting down the middle... */
- strip->actend= splitaframe;
- nstrip->actstart= splitaframe;
+ strip->actend = splitaframe;
+ nstrip->actstart = splitaframe;
}
/* clear the active flag from the copy */
@@ -1052,7 +1052,7 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip
}
/* split a given Meta strip */
-static void nlaedit_split_strip_meta (NlaTrack *nlt, NlaStrip *strip)
+static void nlaedit_split_strip_meta(NlaTrack *nlt, NlaStrip *strip)
{
/* simply ungroup it for now... */
BKE_nlastrips_clear_metastrip(&nlt->strips, strip);
@@ -1060,7 +1060,7 @@ static void nlaedit_split_strip_meta (NlaTrack *nlt, NlaStrip *strip)
/* ----- */
-static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_split_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1073,17 +1073,17 @@ static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each NLA-Track, split all selected strips into two strips */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- AnimData *adt= ale->adt;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
NlaStrip *strip, *next;
- for (strip= nlt->strips.first; strip; strip= next) {
- next= strip->next;
+ for (strip = nlt->strips.first; strip; strip = next) {
+ next = strip->next;
/* if selected, split the strip at its midpoint */
if (strip->flag & NLASTRIP_FLAG_SELECT) {
@@ -1111,7 +1111,7 @@ static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1129,13 +1129,13 @@ void NLA_OT_split(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Bake Strips Operator ***************************** */
/* Bakes the NLA Strips for the active AnimData blocks */
-static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_bake_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1149,11 +1149,11 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each AnimData block, bake strips to animdata... */
- for (ale= anim_data.first; ale; ale= ale->next) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
//BKE_nla_bake(ac.scene, ale->id, ale->data, flag);
}
@@ -1164,7 +1164,7 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1182,7 +1182,7 @@ void NLA_OT_bake(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* *********************************************** */
@@ -1191,7 +1191,7 @@ void NLA_OT_bake(wmOperatorType *ot)
/* ******************** Toggle Muting Operator ************************** */
/* Toggles whether strips are muted or not */
-static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_toggle_mute_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1204,16 +1204,16 @@ static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* go over all selected strips */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* for every selected strip, toggle muting */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* just flip the mute flag for now */
// TODO: have a pre-pass to check if mute all or unmute all?
@@ -1226,7 +1226,7 @@ static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op))
BLI_freelistN(&anim_data);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1244,13 +1244,13 @@ void NLA_OT_mute_toggle(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Swap Strips Operator ************************** */
/* Tries to exchange strips within their owner tracks */
-static int nlaedit_swap_exec (bContext *C, wmOperator *op)
+static int nlaedit_swap_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
@@ -1263,15 +1263,15 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* consider each track in turn */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
- NlaStrip *strip, *stripN=NULL;
- NlaStrip *sa=NULL, *sb=NULL;
+ NlaStrip *strip, *stripN = NULL;
+ NlaStrip *sa = NULL, *sb = NULL;
/* make temporary metastrips so that entire islands of selections can be moved around */
BKE_nlastrips_make_metas(&nlt->strips, 1);
@@ -1289,7 +1289,7 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
}
/* get two selected strips only (these will be metas due to prev step) to operate on
- * - only allow swapping 2, as with more the context becomes unclear
+ * - only allow swapping 2, as with more the context becomes unclear
*/
for (strip = nlt->strips.first; strip; strip = stripN) {
stripN = strip->next;
@@ -1314,8 +1314,8 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
if (strip) {
/* too many selected warning */
BKE_reportf(op->reports, RPT_WARNING,
- "Too many clusters of strips selected in NLA Track (%s): needs exactly 2 to be selected",
- nlt->name);
+ "Too many clusters of strips selected in NLA Track (%s): needs exactly 2 to be selected",
+ nlt->name);
}
else if (sa == NULL) {
/* no warning as this is just a common case, and it may get annoying when doing multiple tracks */
@@ -1323,8 +1323,8 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
else if (sb == NULL) {
/* too few selected warning */
BKE_reportf(op->reports, RPT_WARNING,
- "Too few clusters of strips selected in NLA Track (%s): needs exactly 2 to be selected",
- nlt->name);
+ "Too few clusters of strips selected in NLA Track (%s): needs exactly 2 to be selected",
+ nlt->name);
}
else {
float nsa[2], nsb[2];
@@ -1334,16 +1334,16 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
BLI_remlink(&nlt->strips, sb);
/* calculate new extents for strips */
- /* a --> b */
+ /* a --> b */
nsa[0] = sb->start;
nsa[1] = sb->start + (sa->end - sa->start);
- /* b --> a */
+ /* b --> a */
nsb[0] = sa->start;
nsb[1] = sa->start + (sb->end - sb->start);
/* check if the track has room for the strips to be swapped */
if (BKE_nlastrips_has_space(&nlt->strips, nsa[0], nsa[1]) &&
- BKE_nlastrips_has_space(&nlt->strips, nsb[0], nsb[1]))
+ BKE_nlastrips_has_space(&nlt->strips, nsb[0], nsb[1]))
{
/* set new extents for strips then */
sa->start = nsa[0];
@@ -1358,12 +1358,12 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
/* not enough room to swap, so show message */
if ((sa->flag & NLASTRIP_FLAG_TEMP_META) || (sb->flag & NLASTRIP_FLAG_TEMP_META)) {
BKE_report(op->reports, RPT_WARNING,
- "Cannot swap selected strips as they will not be able to fit in their new places");
+ "Cannot swap selected strips as they will not be able to fit in their new places");
}
else {
BKE_reportf(op->reports, RPT_WARNING,
- "Cannot swap '%s' and '%s' as one or both will not be able to fit in their new places",
- sa->name, sb->name);
+ "Cannot swap '%s' and '%s' as one or both will not be able to fit in their new places",
+ sa->name, sb->name);
}
}
@@ -1383,7 +1383,7 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1401,13 +1401,13 @@ void NLA_OT_swap(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Move Strips Up Operator ************************** */
/* Tries to move the selected strips into the track above if possible. */
-static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1420,15 +1420,15 @@ static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* since we're potentially moving strips from lower tracks to higher tracks, we should
* loop over the tracks in reverse order to avoid moving earlier strips up multiple tracks
*/
- for (ale= anim_data.last; ale; ale= ale->prev) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- NlaTrack *nltn= nlt->next;
+ for (ale = anim_data.last; ale; ale = ale->prev) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ NlaTrack *nltn = nlt->next;
NlaStrip *strip, *stripn;
/* if this track has no tracks after it, skip for now... */
@@ -1436,8 +1436,8 @@ static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
continue;
/* for every selected strip, try to move */
- for (strip= nlt->strips.first; strip; strip= stripn) {
- stripn= strip->next;
+ for (strip = nlt->strips.first; strip; strip = stripn) {
+ stripn = strip->next;
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* check if the track above has room for this strip */
@@ -1457,7 +1457,7 @@ static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1475,13 +1475,13 @@ void NLA_OT_move_up(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Move Strips Down Operator ************************** */
/* Tries to move the selected strips into the track above if possible. */
-static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_move_down_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1494,15 +1494,15 @@ static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* loop through the tracks in normal order, since we're pushing strips down,
* strips won't get operated on twice
*/
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
- NlaTrack *nltp= nlt->prev;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ NlaTrack *nltp = nlt->prev;
NlaStrip *strip, *stripn;
/* if this track has no tracks before it, skip for now... */
@@ -1510,8 +1510,8 @@ static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
continue;
/* for every selected strip, try to move */
- for (strip= nlt->strips.first; strip; strip= stripn) {
- stripn= strip->next;
+ for (strip = nlt->strips.first; strip; strip = stripn) {
+ stripn = strip->next;
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* check if the track below has room for this strip */
@@ -1531,7 +1531,7 @@ static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1549,36 +1549,36 @@ void NLA_OT_move_down(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Sync Action Length Operator ***************************** */
/* Recalculate the extents of the action ranges used for the selected strips */
-static int nlaedit_sync_actlen_exec (bContext *C, wmOperator *op)
+static int nlaedit_sync_actlen_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- short active_only= RNA_boolean_get(op->ptr, "active");
+ short active_only = RNA_boolean_get(op->ptr, "active");
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
if (active_only) filter |= ANIMFILTER_ACTIVE;
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each NLA-Track, apply scale of all selected strips */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* strip selection/active status check */
if (active_only) {
if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0)
@@ -1607,7 +1607,7 @@ static int nlaedit_sync_actlen_exec (bContext *C, wmOperator *op)
BLI_freelistN(&anim_data);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1625,7 +1625,7 @@ void NLA_OT_action_sync_length(wmOperatorType *ot)
ot->poll = ED_operator_nla_active; // XXX: is this satisfactory... probably requires a check for active strip...
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_boolean(ot->srna, "active", 1, "Active Strip Only", "Only sync the active length for the active strip");
@@ -1635,21 +1635,21 @@ void NLA_OT_action_sync_length(wmOperatorType *ot)
/* Reset the scaling of the selected strips to 1.0f */
/* apply scaling to keyframe */
-static short bezt_apply_nlamapping (KeyframeEditData *ked, BezTriple *bezt)
+static short bezt_apply_nlamapping(KeyframeEditData *ked, BezTriple *bezt)
{
/* NLA-strip which has this scaling is stored in ked->data */
- NlaStrip *strip= (NlaStrip *)ked->data;
+ NlaStrip *strip = (NlaStrip *)ked->data;
/* adjust all the times */
- bezt->vec[0][0]= nlastrip_get_frame(strip, bezt->vec[0][0], NLATIME_CONVERT_MAP);
- bezt->vec[1][0]= nlastrip_get_frame(strip, bezt->vec[1][0], NLATIME_CONVERT_MAP);
- bezt->vec[2][0]= nlastrip_get_frame(strip, bezt->vec[2][0], NLATIME_CONVERT_MAP);
+ bezt->vec[0][0] = nlastrip_get_frame(strip, bezt->vec[0][0], NLATIME_CONVERT_MAP);
+ bezt->vec[1][0] = nlastrip_get_frame(strip, bezt->vec[1][0], NLATIME_CONVERT_MAP);
+ bezt->vec[2][0] = nlastrip_get_frame(strip, bezt->vec[2][0], NLATIME_CONVERT_MAP);
/* nothing to return or else we exit */
return 0;
}
-static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1657,24 +1657,24 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
bAnimListElem *ale;
int filter;
- KeyframeEditData ked= {{NULL}};
+ KeyframeEditData ked = {{NULL}};
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* init the editing data */
/* for each NLA-Track, apply scale of all selected strips */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* strip must be selected, and must be action-clip only (transitions don't have scale) */
if ((strip->flag & NLASTRIP_FLAG_SELECT) && (strip->type == NLASTRIP_TYPE_CLIP)) {
/* if the referenced action is used by other strips, make this strip use its own copy */
@@ -1682,22 +1682,22 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
continue;
if (strip->act->id.us > 1) {
/* make a copy of the Action to work on */
- bAction *act= BKE_action_copy(strip->act);
+ bAction *act = BKE_action_copy(strip->act);
/* set this as the new referenced action, decrementing the users of the old one */
strip->act->id.us--;
- strip->act= act;
+ strip->act = act;
}
/* setup iterator, and iterate over all the keyframes in the action, applying this scaling */
- ked.data= strip;
+ ked.data = strip;
ANIM_animchanneldata_keyframes_loop(&ked, ac.ads, strip->act, ALE_ACT, NULL, bezt_apply_nlamapping, calchandles_fcurve);
/* clear scale of strip now that it has been applied,
* and recalculate the extents of the action now that it has been scaled
* but leave everything else alone
*/
- strip->scale= 1.0f;
+ strip->scale = 1.0f;
calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
}
}
@@ -1707,7 +1707,7 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
BLI_freelistN(&anim_data);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1725,13 +1725,13 @@ void NLA_OT_apply_scale(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Clear Scale Operator ***************************** */
/* Reset the scaling of the selected strips to 1.0f */
-static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op))
+static int nlaedit_clear_scale_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1744,15 +1744,15 @@ static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each NLA-Track, reset scale of all selected strips */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* strip must be selected, and must be action-clip only (transitions don't have scale) */
if ((strip->flag & NLASTRIP_FLAG_SELECT) && (strip->type == NLASTRIP_TYPE_CLIP)) {
PointerRNA strip_ptr;
@@ -1770,7 +1770,7 @@ static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1788,7 +1788,7 @@ void NLA_OT_clear_scale(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Snap Strips Operator ************************** */
@@ -1803,7 +1803,7 @@ static EnumPropertyItem prop_nlaedit_snap_types[] = {
{0, NULL, 0, NULL, NULL}
};
-static int nlaedit_snap_exec (bContext *C, wmOperator *op)
+static int nlaedit_snap_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
@@ -1820,18 +1820,18 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* get some necessary vars */
- scene= ac.scene;
- secf= (float)FPS;
+ scene = ac.scene;
+ secf = (float)FPS;
/* since we may add tracks, perform this in reverse order */
- for (ale= anim_data.last; ale; ale= ale->prev) {
+ for (ale = anim_data.last; ale; ale = ale->prev) {
ListBase tmp_strips = {NULL, NULL};
- AnimData *adt= ale->adt;
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ AnimData *adt = ale->adt;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip, *stripn;
NlaTrack *track;
@@ -1841,37 +1841,37 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
/* apply the snapping to all the temp meta-strips, then put them in a separate list to be added
* back to the original only if they still fit
*/
- for (strip= nlt->strips.first; strip; strip= stripn) {
- stripn= strip->next;
+ for (strip = nlt->strips.first; strip; strip = stripn) {
+ stripn = strip->next;
if (strip->flag & NLASTRIP_FLAG_TEMP_META) {
float start, end;
/* get the existing end-points */
- start= strip->start;
- end= strip->end;
+ start = strip->start;
+ end = strip->end;
/* calculate new start position based on snapping mode */
switch (mode) {
case NLAEDIT_SNAP_CFRA: /* to current frame */
- strip->start= (float)CFRA;
+ strip->start = (float)CFRA;
break;
case NLAEDIT_SNAP_NEAREST_FRAME: /* to nearest frame */
- strip->start= floorf(start+0.5f);
+ strip->start = floorf(start + 0.5f);
break;
case NLAEDIT_SNAP_NEAREST_SECOND: /* to nearest second */
- strip->start= floorf(start/secf + 0.5f) * secf;
+ strip->start = floorf(start / secf + 0.5f) * secf;
break;
case NLAEDIT_SNAP_NEAREST_MARKER: /* to nearest marker */
- strip->start= (float)ED_markers_find_nearest_marker_time(ac.markers, start);
+ strip->start = (float)ED_markers_find_nearest_marker_time(ac.markers, start);
break;
default: /* just in case... no snapping */
- strip->start= start;
+ strip->start = start;
break;
}
/* get new endpoint based on start-point (and old length) */
- strip->end= strip->start + (end - start);
+ strip->end = strip->start + (end - start);
/* apply transforms to meta-strip to its children */
BKE_nlameta_flush_transforms(strip);
@@ -1883,8 +1883,8 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
}
/* try adding each meta-strip back to the track one at a time, to make sure they'll fit */
- for (strip= tmp_strips.first; strip; strip= stripn) {
- stripn= strip->next;
+ for (strip = tmp_strips.first; strip; strip = stripn) {
+ stripn = strip->next;
/* remove from temp-strips list */
BLI_remlink(&tmp_strips, strip);
@@ -1892,7 +1892,7 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
/* in case there's no space in the current track, try adding */
if (BKE_nlatrack_add_strip(nlt, strip) == 0) {
/* need to add a new track above the current one */
- track= add_nlatrack(adt, nlt);
+ track = add_nlatrack(adt, nlt);
BKE_nlatrack_add_strip(track, strip);
/* clear temp meta-strips on this new track, as we may not be able to get back to it */
@@ -1911,7 +1911,7 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
ED_nla_postop_refresh(&ac);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1930,7 +1930,7 @@ void NLA_OT_snap(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", prop_nlaedit_snap_types, 0, "Type", "");
@@ -1942,18 +1942,18 @@ void NLA_OT_snap(wmOperatorType *ot)
/* ******************** Add F-Modifier Operator *********************** */
/* present a special customised popup menu for this, with some filtering */
-static int nla_fmodifier_add_invoke (bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
+static int nla_fmodifier_add_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
uiPopupMenu *pup;
uiLayout *layout;
int i;
- pup= uiPupMenuBegin(C, "Add F-Modifier", ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, "Add F-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);
/* check if modifier is valid for this context */
if (fmi == NULL)
@@ -1980,7 +1980,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
int filter;
FModifier *fcm;
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
short onlyActive = RNA_boolean_get(op->ptr, "only_active");
/* get editor data */
@@ -1988,24 +1988,24 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each NLA-Track, add the specified modifier to all selected strips */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
- for (strip= nlt->strips.first; strip; strip=strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* can F-Modifier be added to the current strip? */
if (onlyActive) {
/* if not active, cannot add since we're only adding to active strip */
- if ((strip->flag & NLASTRIP_FLAG_ACTIVE)==0)
+ if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0)
continue;
}
else {
/* strip must be selected, since we're not just doing active */
- if ((strip->flag & NLASTRIP_FLAG_SELECT)==0)
+ if ((strip->flag & NLASTRIP_FLAG_SELECT) == 0)
continue;
}
@@ -2014,14 +2014,14 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
continue;
/* add F-Modifier of specified type to selected, and make it the active one */
- fcm= add_fmodifier(&strip->modifiers, type);
+ fcm = add_fmodifier(&strip->modifiers, type);
if (fcm)
set_active_fmodifier(&strip->modifiers, fcm);
else {
BKE_reportf(op->reports, RPT_ERROR,
- "Modifier couldn't be added to (%s : %s) (see console for details)",
- nlt->name, strip->name);
+ "Modifier couldn't be added to (%s : %s) (see console for details)",
+ nlt->name, strip->name);
}
}
}
@@ -2030,7 +2030,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
BLI_freelistN(&anim_data);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -2049,7 +2049,7 @@ void NLA_OT_fmodifier_add(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* 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", "");
@@ -2063,7 +2063,7 @@ static int nla_fmodifier_copy_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)
@@ -2073,17 +2073,17 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
free_fmodifiers_copybuf();
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each NLA-Track, add the specified modifier to all selected strips */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
- for (strip= nlt->strips.first; strip; strip=strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* only add F-Modifier if on active strip? */
- if ((strip->flag & NLASTRIP_FLAG_ACTIVE)==0)
+ if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0)
continue;
// TODO: when 'active' vs 'all' boolean is added, change last param!
@@ -2112,7 +2112,7 @@ void NLA_OT_fmodifier_copy(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* 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");
@@ -2125,22 +2125,22 @@ static int nla_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;
/* get a list of the editable tracks being shown in the NLA */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each NLA-Track, add the specified modifier to all selected strips */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
- for (strip= nlt->strips.first; strip; strip=strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
// TODO: do we want to replace existing modifiers? add user pref for that!
ok += ANIM_fmodifiers_paste_from_buf(&strip->modifiers, 0);
}
@@ -2153,7 +2153,7 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op)
if (ok) {
/* set notifier that things have changed */
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
else {
@@ -2174,7 +2174,7 @@ void NLA_OT_fmodifier_paste(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* *********************************************** */
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 9d0762ce108..398d2d5f1f4 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -55,7 +55,7 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar);
/* defines for left-right select tool */
enum {
- NLAEDIT_LRSEL_TEST = -1,
+ NLAEDIT_LRSEL_TEST = -1,
NLAEDIT_LRSEL_NONE,
NLAEDIT_LRSEL_LEFT,
NLAEDIT_LRSEL_RIGHT
@@ -131,7 +131,7 @@ void NLA_OT_delete_tracks(wmOperatorType *ot);
/* nla_ops.c */
int nlaop_poll_tweakmode_off(bContext *C);
-int nlaop_poll_tweakmode_on (bContext *C);
+int nlaop_poll_tweakmode_on(bContext *C);
short nlaedit_is_tweakmode_on(bAnimContext *ac);
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index b320adc25fb..3a74d0b4c9c 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -53,7 +53,7 @@
#include "RNA_access.h"
-#include "nla_intern.h" // own include
+#include "nla_intern.h" /* own include */
/* ************************** poll callbacks for operators **********************************/
@@ -63,7 +63,7 @@ int nlaop_poll_tweakmode_off(bContext *C)
Scene *scene;
/* for now, we check 2 things:
- * 1) active editor must be NLA
+ * 1) active editor must be NLA
* 2) tweakmode is currently set as a 'per-scene' flag
* so that it will affect entire NLA data-sets,
* but not all AnimData blocks will be in tweakmode for
@@ -72,7 +72,7 @@ int nlaop_poll_tweakmode_off(bContext *C)
if (ED_operator_nla_active(C) == 0)
return 0;
- scene= CTX_data_scene(C);
+ scene = CTX_data_scene(C);
if ((scene == NULL) || (scene->flag & SCE_NLA_EDIT_ON))
return 0;
@@ -85,7 +85,7 @@ int nlaop_poll_tweakmode_on(bContext *C)
Scene *scene;
/* for now, we check 2 things:
- * 1) active editor must be NLA
+ * 1) active editor must be NLA
* 2) tweakmode is currently set as a 'per-scene' flag
* so that it will affect entire NLA data-sets,
* but not all AnimData blocks will be in tweakmode for
@@ -94,7 +94,7 @@ int nlaop_poll_tweakmode_on(bContext *C)
if (ED_operator_nla_active(C) == 0)
return 0;
- scene= CTX_data_scene(C);
+ scene = CTX_data_scene(C);
if ((scene == NULL) || !(scene->flag & SCE_NLA_EDIT_ON))
return 0;
@@ -173,119 +173,119 @@ static void nla_keymap_channels(wmKeyMap *keymap)
/* NLA-specific (different to standard channels keymap) -------------------------- */
/* selection */
- /* click-select */
- // XXX for now, only leftmouse....
+ /* click-select */
+ // XXX for now, only leftmouse....
kmi = WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
kmi = WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
/* channel operations */
- /* add tracks */
+ /* add tracks */
kmi = WM_keymap_add_item(keymap, "NLA_OT_tracks_add", AKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "above_selected", FALSE);
- kmi = WM_keymap_add_item(keymap, "NLA_OT_tracks_add", AKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "NLA_OT_tracks_add", AKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "above_selected", TRUE);
- /* delete tracks */
+ /* delete tracks */
WM_keymap_add_item(keymap, "NLA_OT_delete_tracks", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NLA_OT_delete_tracks", DELKEY, KM_PRESS, 0, 0);
}
-static void nla_keymap_main (wmKeyConfig *keyconf, wmKeyMap *keymap)
+static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap)
{
wmKeyMapItem *kmi;
/* selection */
- /* click select */
+ /* click select */
kmi = WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
kmi = WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ RNA_boolean_set(kmi->ptr, "extend", TRUE);
- /* select left/right */
+ /* select left/right */
kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_TEST);
- kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "extend", TRUE);
- RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_TEST);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_TEST);
+ kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_TEST);
kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_LEFT);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_LEFT);
kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "extend", FALSE);
- RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_RIGHT);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_RIGHT);
- /* deselect all */
- /* TODO: uniformize with other select_all ops? */
+ /* deselect all */
+ /* TODO: uniformize with other select_all ops? */
kmi = WM_keymap_add_item(keymap, "NLA_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, "NLA_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, "NLA_OT_select_border", BKEY, KM_PRESS, 0, 0);
- RNA_boolean_set(kmi->ptr, "axis_range", FALSE);
+ RNA_boolean_set(kmi->ptr, "axis_range", FALSE);
kmi = WM_keymap_add_item(keymap, "NLA_OT_select_border", BKEY, KM_PRESS, KM_ALT, 0);
- RNA_boolean_set(kmi->ptr, "axis_range", TRUE);
+ RNA_boolean_set(kmi->ptr, "axis_range", TRUE);
/* view*/
- /* auto-set range */
+ /* auto-set range */
//WM_keymap_add_item(keymap, "NLA_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
WM_keymap_add_item(keymap, "NLA_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NLA_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
/* editing */
- /* tweakmode
- * - enter and exit are separate operators with the same hotkey...
- * This works as they use different poll()'s
- */
+ /* tweakmode
+ * - enter and exit are separate operators with the same hotkey...
+ * This works as they use different poll()'s
+ */
WM_keymap_add_item(keymap, "NLA_OT_tweakmode_enter", TABKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NLA_OT_tweakmode_exit", TABKEY, KM_PRESS, 0, 0);
- /* add strips */
+ /* add strips */
WM_keymap_add_item(keymap, "NLA_OT_actionclip_add", AKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "NLA_OT_transition_add", TKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "NLA_OT_soundclip_add", KKEY, KM_PRESS, KM_SHIFT, 0);
- /* meta-strips */
+ /* meta-strips */
WM_keymap_add_item(keymap, "NLA_OT_meta_add", GKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "NLA_OT_meta_remove", GKEY, KM_PRESS, KM_ALT, 0);
- /* duplicate */
+ /* duplicate */
WM_keymap_add_item(keymap, "NLA_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
- /* delete */
+ /* delete */
WM_keymap_add_item(keymap, "NLA_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NLA_OT_delete", DELKEY, KM_PRESS, 0, 0);
- /* split */
+ /* split */
WM_keymap_add_item(keymap, "NLA_OT_split", YKEY, KM_PRESS, 0, 0);
- /* toggles */
+ /* toggles */
WM_keymap_add_item(keymap, "NLA_OT_mute_toggle", HKEY, KM_PRESS, 0, 0);
- /* swap */
+ /* swap */
WM_keymap_add_item(keymap, "NLA_OT_swap", FKEY, KM_PRESS, KM_ALT, 0);
- /* move up */
+ /* move up */
WM_keymap_add_item(keymap, "NLA_OT_move_up", PAGEUPKEY, KM_PRESS, 0, 0);
- /* move down */
+ /* move down */
WM_keymap_add_item(keymap, "NLA_OT_move_down", PAGEDOWNKEY, KM_PRESS, 0, 0);
- /* apply scale */
+ /* apply scale */
WM_keymap_add_item(keymap, "NLA_OT_apply_scale", AKEY, KM_PRESS, KM_CTRL, 0);
- /* clear scale */
+ /* clear scale */
WM_keymap_add_item(keymap, "NLA_OT_clear_scale", SKEY, KM_PRESS, KM_ALT, 0);
- /* snap */
+ /* snap */
WM_keymap_add_item(keymap, "NLA_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
- /* add f-modifier */
- WM_keymap_add_item(keymap, "NLA_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ /* add f-modifier */
+ WM_keymap_add_item(keymap, "NLA_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
/* transform system */
transform_keymap_for_space(keyconf, keymap, SPACE_NLA);
@@ -318,4 +318,3 @@ void nla_keymap(wmKeyConfig *keyconf)
keymap = WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0);
nla_keymap_main(keyconf, keymap);
}
-
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index cfd4a3202d2..1ba15d529e8 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -57,12 +57,12 @@
#include "UI_view2d.h"
-#include "nla_intern.h" // own include
+#include "nla_intern.h" // own include
/* ******************** Utilities ***************************************** */
/* Convert SELECT_* flags to ACHANNEL_SETFLAG_* flags */
-static short selmodes_to_flagmodes (short sel)
+static short selmodes_to_flagmodes(short sel)
{
/* convert selection modes to selection modes */
switch (sel) {
@@ -98,13 +98,13 @@ enum {
/* Deselects strips in the NLA Editor
* - This is called by the deselect all operator, as well as other ones!
*
- * - test: check if select or deselect all (1) or clear all active (2)
+ * - test: check if select or deselect all (1) or clear all active (2)
* - sel: how to select keyframes
* 0 = deselect
* 1 = select
* 2 = invert
*/
-static void deselect_nla_strips (bAnimContext *ac, short test, short sel)
+static void deselect_nla_strips(bAnimContext *ac, short test, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -113,21 +113,21 @@ static void deselect_nla_strips (bAnimContext *ac, short test, short sel)
/* determine type-based settings */
// FIXME: double check whether ANIMFILTER_LIST_VISIBLE is needed!
- filter= (ANIMFILTER_DATA_VISIBLE);
+ filter = (ANIMFILTER_DATA_VISIBLE);
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* See if we should be selecting or deselecting */
if (test == DESELECT_STRIPS_TEST) {
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* if any strip is selected, break out, since we should now be deselecting */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (strip->flag & NLASTRIP_FLAG_SELECT) {
- sel= SELECT_SUBTRACT;
+ sel = SELECT_SUBTRACT;
break;
}
}
@@ -138,15 +138,15 @@ static void deselect_nla_strips (bAnimContext *ac, short test, short sel)
}
/* convert selection modes to selection modes */
- smode= selmodes_to_flagmodes(sel);
+ smode = selmodes_to_flagmodes(sel);
/* Now set the flags */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* apply same selection to all strips */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* set selection */
if (test != DESELECT_STRIPS_CLEARACTIVE)
ACHANNEL_SET_FLAG(strip, smode, NLASTRIP_FLAG_SELECT);
@@ -178,7 +178,7 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op)
deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_ADD);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -195,7 +195,7 @@ void NLA_OT_select_all_toggle(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
/* props */
RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
@@ -203,57 +203,57 @@ void NLA_OT_select_all_toggle(wmOperatorType *ot)
/* ******************** Border Select Operator **************************** */
/* This operator currently works in one of three ways:
- * -> BKEY - 1) all strips within region are selected (NLAEDIT_BORDERSEL_ALLSTRIPS)
- * -> ALT-BKEY - depending on which axis of the region was larger...
- * -> 2) x-axis, so select all frames within frame range (NLAEDIT_BORDERSEL_FRAMERANGE)
- * -> 3) y-axis, so select all frames within channels that region included (NLAEDIT_BORDERSEL_CHANNELS)
+ * -> BKEY - 1) all strips within region are selected (NLAEDIT_BORDERSEL_ALLSTRIPS)
+ * -> ALT-BKEY - depending on which axis of the region was larger...
+ * -> 2) x-axis, so select all frames within frame range (NLAEDIT_BORDERSEL_FRAMERANGE)
+ * -> 3) y-axis, so select all frames within channels that region included (NLAEDIT_BORDERSEL_CHANNELS)
*/
/* defines for borderselect mode */
enum {
- NLA_BORDERSEL_ALLSTRIPS = 0,
+ NLA_BORDERSEL_ALLSTRIPS = 0,
NLA_BORDERSEL_FRAMERANGE,
NLA_BORDERSEL_CHANNELS,
} /* eNLAEDIT_BorderSelect_Mode */;
-static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, short selectmode)
+static void borderselect_nla_strips(bAnimContext *ac, rcti rect, short mode, short selectmode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
SpaceNla *snla = (SpaceNla *)ac->sl;
- View2D *v2d= &ac->ar->v2d;
+ View2D *v2d = &ac->ar->v2d;
rctf rectf;
- float ymin /* =(float)(-NLACHANNEL_HEIGHT(snla)) */ /* UNUSED */, ymax=0;
+ float ymin /* =(float)(-NLACHANNEL_HEIGHT(snla)) */ /* UNUSED */, ymax = 0;
/* convert border-region to view coordinates */
- UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin+2, &rectf.xmin, &rectf.ymin);
- UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax-2, &rectf.xmax, &rectf.ymax);
+ UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin + 2, &rectf.xmin, &rectf.ymin);
+ UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax - 2, &rectf.xmax, &rectf.ymax);
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* convert selection modes to selection modes */
- selectmode= selmodes_to_flagmodes(selectmode);
+ selectmode = selmodes_to_flagmodes(selectmode);
/* loop over data, doing border select */
- for (ale= anim_data.first; ale; ale= ale->next) {
- ymin= ymax - NLACHANNEL_STEP(snla);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ ymin = ymax - NLACHANNEL_STEP(snla);
/* perform vertical suitability check (if applicable) */
if ( (mode == NLA_BORDERSEL_FRAMERANGE) ||
- !((ymax < rectf.ymin) || (ymin > rectf.ymax)) )
+ !((ymax < rectf.ymin) || (ymin > rectf.ymax)) )
{
/* loop over data selecting (only if NLA-Track) */
if (ale->type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* only select strips if they fall within the required ranges (if applicable) */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if ( (mode == NLA_BORDERSEL_CHANNELS) ||
BKE_nlastrip_within_bounds(strip, rectf.xmin, rectf.xmax))
{
@@ -268,7 +268,7 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh
}
/* set minimum extent to be the maximum of the next channel */
- ymax= ymin;
+ ymax = ymin;
}
/* cleanup */
@@ -281,7 +281,7 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
rcti rect;
- short mode=0, selectmode=0;
+ short mode = 0, selectmode = 0;
int extend;
/* get editor data */
@@ -289,7 +289,7 @@ static int nlaedit_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_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT);
@@ -312,18 +312,18 @@ static int nlaedit_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= NLA_BORDERSEL_FRAMERANGE;
+ mode = NLA_BORDERSEL_FRAMERANGE;
else
- mode= NLA_BORDERSEL_CHANNELS;
+ mode = NLA_BORDERSEL_CHANNELS;
}
else
- mode= NLA_BORDERSEL_ALLSTRIPS;
+ mode = NLA_BORDERSEL_ALLSTRIPS;
/* apply borderselect action */
borderselect_nla_strips(&ac, rect, mode, selectmode);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -344,7 +344,7 @@ void NLA_OT_select_border(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, 1);
@@ -365,13 +365,13 @@ static EnumPropertyItem prop_nlaedit_leftright_select_types[] = {
/* ------------------- */
-static void nlaedit_select_leftright (bContext *C, bAnimContext *ac, short leftright, short select_mode)
+static void nlaedit_select_leftright(bContext *C, bAnimContext *ac, short leftright, short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- Scene *scene= ac->scene;
+ Scene *scene = ac->scene;
float xmin, xmax;
/* if currently in tweakmode, exit tweakmode first */
@@ -379,8 +379,8 @@ static void nlaedit_select_leftright (bContext *C, bAnimContext *ac, short leftr
WM_operator_name_call(C, "NLA_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, NULL);
/* 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
@@ -398,20 +398,20 @@ static void nlaedit_select_leftright (bContext *C, bAnimContext *ac, short leftr
xmax = MAXFRAMEF;
}
- select_mode= selmodes_to_flagmodes(select_mode);
+ select_mode = selmodes_to_flagmodes(select_mode);
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select strips on the side where most data occurs */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* check each strip to see if it is appropriate */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (BKE_nlastrip_within_bounds(strip, xmin, xmax)) {
ACHANNEL_SET_FLAG(strip, select_mode, NLASTRIP_FLAG_SELECT);
}
@@ -424,7 +424,7 @@ static void nlaedit_select_leftright (bContext *C, bAnimContext *ac, short leftr
/* ------------------- */
-static int nlaedit_select_leftright_exec (bContext *C, wmOperator *op)
+static int nlaedit_select_leftright_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
@@ -436,9 +436,9 @@ static int nlaedit_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 == NLAEDIT_LRSEL_TEST)
@@ -448,12 +448,12 @@ static int nlaedit_select_leftright_exec (bContext *C, wmOperator *op)
nlaedit_select_leftright(C, &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 nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent *event)
+static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
@@ -464,9 +464,9 @@ static int nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
/* handle mode-based testing */
if (leftright == NLAEDIT_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 */
@@ -494,7 +494,7 @@ void NLA_OT_select_leftright(wmOperatorType *ot)
ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "mode", prop_nlaedit_leftright_select_types, NLAEDIT_LRSEL_TEST, "Mode", "");
@@ -505,15 +505,15 @@ void NLA_OT_select_leftright(wmOperatorType *ot)
/* ******************** Mouse-Click Select Operator *********************** */
/* select strip directly under mouse */
-static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2], short select_mode)
+static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale = NULL;
int filter;
SpaceNla *snla = (SpaceNla *)ac->sl;
- View2D *v2d= &ac->ar->v2d;
- Scene *scene= ac->scene;
+ View2D *v2d = &ac->ar->v2d;
+ Scene *scene = ac->scene;
NlaStrip *strip = NULL;
int channel_index;
float xmin, xmax, dummy;
@@ -527,15 +527,15 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2],
/* x-range to check is +/- 7 (in screen/region-space) on either side of mouse click
* (that is the size of keyframe icons, so user should be expecting similar tolerances)
*/
- UI_view2d_region_to_view(v2d, mval[0]-7, mval[1], &xmin, &dummy);
- UI_view2d_region_to_view(v2d, mval[0]+7, mval[1], &xmax, &dummy);
+ UI_view2d_region_to_view(v2d, mval[0] - 7, mval[1], &xmin, &dummy);
+ UI_view2d_region_to_view(v2d, mval[0] + 7, mval[1], &xmax, &dummy);
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* try to get channel */
- ale= BLI_findlink(&anim_data, channel_index);
+ ale = BLI_findlink(&anim_data, channel_index);
if (ale == NULL) {
/* channel not found */
printf("Error: animation channel (index = %d) not found in mouse_nla_strips()\n", channel_index);
@@ -545,10 +545,10 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2],
else {
/* found some channel - we only really should do somethign when its an Nla-Track */
if (ale->type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
/* loop over NLA-strips in this track, trying to find one which occurs in the necessary bounds */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (BKE_nlastrip_within_bounds(strip, xmin, xmax))
break;
}
@@ -580,7 +580,7 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2],
/* Highlight NLA-Track */
if (ale->type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
nlt->flag |= NLATRACK_SELECTED;
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nlt, ANIMTYPE_NLATRACK);
@@ -591,7 +591,7 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2],
if (ale) {
/* select the strip accordingly (if a matching one was found) */
if (strip) {
- select_mode= selmodes_to_flagmodes(select_mode);
+ select_mode = selmodes_to_flagmodes(select_mode);
ACHANNEL_SET_FLAG(strip, select_mode, NLASTRIP_FLAG_SELECT);
/* if we selected it, we can make it active too
@@ -629,18 +629,18 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
/* 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;
/* select strips based upon mouse position */
mouse_nla_strips(C, &ac, event->mval, selectmode);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
/* for tweak grab to work */
- return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+ return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
void NLA_OT_click_select(wmOperatorType *ot)
@@ -655,7 +655,7 @@ void NLA_OT_click_select(wmOperatorType *ot)
ot->poll = ED_operator_nla_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 27c48d2232f..7c9014bd45f 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -60,7 +60,7 @@
#include "UI_resources.h"
#include "UI_view2d.h"
-#include "nla_intern.h" // own include
+#include "nla_intern.h" /* own include */
/* ******************** manage regions ********************* */
@@ -68,20 +68,20 @@ ARegion *nla_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 nla");
+ arnew = MEM_callocN(sizeof(ARegion), "buttons for nla");
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,72 +94,72 @@ ARegion *nla_has_buttons_region(ScrArea *sa)
static SpaceLink *nla_new(const bContext *C)
{
- Scene *scene= CTX_data_scene(C);
- ScrArea *sa= CTX_wm_area(C);
+ Scene *scene = CTX_data_scene(C);
+ ScrArea *sa = CTX_wm_area(C);
ARegion *ar;
SpaceNla *snla;
- snla= MEM_callocN(sizeof(SpaceNla), "initnla");
- snla->spacetype= SPACE_NLA;
+ snla = MEM_callocN(sizeof(SpaceNla), "initnla");
+ snla->spacetype = SPACE_NLA;
/* allocate DopeSheet data for NLA Editor */
- snla->ads= MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet");
- snla->ads->source= (ID *)scene;
+ snla->ads = MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet");
+ snla->ads->source = (ID *)scene;
/* set auto-snapping settings */
snla->autosnap = SACTSNAP_FRAME;
/* header */
- ar= MEM_callocN(sizeof(ARegion), "header for nla");
+ ar = MEM_callocN(sizeof(ARegion), "header for nla");
BLI_addtail(&snla->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
+ ar->regiontype = RGN_TYPE_HEADER;
+ ar->alignment = RGN_ALIGN_BOTTOM;
/* channel list region */
- ar= MEM_callocN(sizeof(ARegion), "channel list for nla");
+ ar = MEM_callocN(sizeof(ARegion), "channel list for nla");
BLI_addtail(&snla->regionbase, ar);
- ar->regiontype= RGN_TYPE_CHANNELS;
- ar->alignment= RGN_ALIGN_LEFT;
+ ar->regiontype = RGN_TYPE_CHANNELS;
+ ar->alignment = RGN_ALIGN_LEFT;
- /* only need to set these settings since this will use the 'stack' configuration */
+ /* only need to set these settings since this will use the 'stack' configuration */
ar->v2d.scroll = V2D_SCROLL_BOTTOM;
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
/* ui buttons */
- ar= MEM_callocN(sizeof(ARegion), "buttons area for nla");
+ ar = MEM_callocN(sizeof(ARegion), "buttons area for nla");
BLI_addtail(&snla->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 nla");
+ ar = MEM_callocN(sizeof(ARegion), "main area for nla");
BLI_addtail(&snla->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
+ ar->regiontype = RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin = (float)(SFRA-10);
- ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
- ar->v2d.tot.xmax = (float)(EFRA+10);
+ ar->v2d.tot.xmin = (float)(SFRA - 10);
+ ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+ ar->v2d.tot.xmax = (float)(EFRA + 10);
ar->v2d.tot.ymax = 0.0f;
ar->v2d.cur = ar->v2d.tot;
- ar->v2d.min[0]= 0.0f;
- ar->v2d.min[1]= 0.0f;
+ ar->v2d.min[0] = 0.0f;
+ ar->v2d.min[1] = 0.0f;
- ar->v2d.max[0]= MAXFRAMEF;
- ar->v2d.max[1]= 10000.0f;
+ ar->v2d.max[0] = MAXFRAMEF;
+ ar->v2d.max[1] = 10000.0f;
- ar->v2d.minzoom= 0.01f;
- ar->v2d.maxzoom= 50;
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+ ar->v2d.minzoom = 0.01f;
+ ar->v2d.maxzoom = 50;
+ ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
- ar->v2d.keepofs= V2D_KEEPOFS_Y;
- ar->v2d.align= V2D_ALIGN_NO_POS_Y;
+ ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
+ ar->v2d.keepofs = V2D_KEEPOFS_Y;
+ ar->v2d.align = V2D_ALIGN_NO_POS_Y;
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
return (SpaceLink *)snla;
@@ -168,7 +168,7 @@ static SpaceLink *nla_new(const bContext *C)
/* not spacelink itself */
static void nla_free(SpaceLink *sl)
{
- SpaceNla *snla= (SpaceNla*) sl;
+ SpaceNla *snla = (SpaceNla *) sl;
if (snla->ads) {
BLI_freelistN(&snla->ads->chanbase);
@@ -180,12 +180,12 @@ static void nla_free(SpaceLink *sl)
/* spacetype; init callback */
static void nla_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
- SpaceNla *snla= (SpaceNla *)sa->spacedata.first;
+ SpaceNla *snla = (SpaceNla *)sa->spacedata.first;
/* init dopesheet data if non-existant (i.e. for old files) */
if (snla->ads == NULL) {
- snla->ads= MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet");
- snla->ads->source= (ID *)G.main->scene.first; // XXX this is bad, but we need this to be set correct
+ snla->ads = MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet");
+ snla->ads->source = (ID *)G.main->scene.first; // XXX this is bad, but we need this to be set correct
}
ED_area_tag_refresh(sa);
@@ -193,10 +193,10 @@ static void nla_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
static SpaceLink *nla_duplicate(SpaceLink *sl)
{
- SpaceNla *snlan= MEM_dupallocN(sl);
+ SpaceNla *snlan = MEM_dupallocN(sl);
/* clear or remove stuff from old */
- snlan->ads= MEM_dupallocN(snlan->ads);
+ snlan->ads = MEM_dupallocN(snlan->ads);
return (SpaceLink *)snlan;
}
@@ -209,10 +209,10 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
/* own keymap */
- /* own channels map first to override some channel keymaps */
+ /* own channels map first to override some channel keymaps */
keymap = WM_keymap_find(wm->defaultconf, "NLA Channels", SPACE_NLA, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- /* now generic channels map for everything else that can apply */
+ /* now generic channels map for everything else that can apply */
keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
@@ -224,7 +224,7 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
static void nla_channel_area_draw(const bContext *C, ARegion *ar)
{
bAnimContext ac;
- View2D *v2d= &ar->v2d;
+ View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
/* clear and setup matrix */
@@ -242,7 +242,7 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar)
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);
}
@@ -265,12 +265,12 @@ static void nla_main_area_init(wmWindowManager *wm, ARegion *ar)
static void nla_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- SpaceNla *snla= CTX_wm_space_nla(C);
+ SpaceNla *snla = CTX_wm_space_nla(C);
bAnimContext ac;
- View2D *v2d= &ar->v2d;
+ View2D *v2d = &ar->v2d;
View2DGrid *grid;
View2DScrollers *scrollers;
- short unit=0, flag=0;
+ short unit = 0, flag = 0;
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
@@ -279,8 +279,8 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* time grid */
- unit= (snla->flag & SNLA_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES;
- grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
+ unit = (snla->flag & SNLA_DRAWTIME) ? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES;
+ grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL);
UI_view2d_grid_free(grid);
@@ -296,8 +296,8 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* current frame */
- if (snla->flag & SNLA_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS;
- if ((snla->flag & SNLA_NODRAWCFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX;
+ if (snla->flag & SNLA_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS;
+ if ((snla->flag & SNLA_NODRAWCFRANUM) == 0) flag |= DRAWCFRA_SHOW_NUMBOX;
ANIM_draw_cfra(C, v2d, flag);
/* markers */
@@ -312,7 +312,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* scrollers */
- scrollers= UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+ scrollers = UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}
@@ -371,7 +371,7 @@ static void nla_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
default:
- if (wmn->data==ND_KEYS)
+ if (wmn->data == ND_KEYS)
ED_region_tag_redraw(ar);
break;
}
@@ -417,7 +417,7 @@ static void nla_main_area_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);
}
}
@@ -451,7 +451,7 @@ static void nla_channel_area_listener(ARegion *ar, wmNotifier *wmn)
break;
default:
- if (wmn->data==ND_KEYS)
+ if (wmn->data == ND_KEYS)
ED_region_tag_redraw(ar);
}
}
@@ -496,61 +496,61 @@ static void nla_listener(ScrArea *sa, wmNotifier *wmn)
/* only called once, from space/spacetypes.c */
void ED_spacetype_nla(void)
{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype nla");
+ SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype nla");
ARegionType *art;
- st->spaceid= SPACE_NLA;
+ st->spaceid = SPACE_NLA;
strncpy(st->name, "NLA", BKE_ST_MAXNAME);
- st->new= nla_new;
- st->free= nla_free;
- st->init= nla_init;
- st->duplicate= nla_duplicate;
- st->operatortypes= nla_operatortypes;
- st->listener= nla_listener;
- st->keymap= nla_keymap;
+ st->new = nla_new;
+ st->free = nla_free;
+ st->init = nla_init;
+ st->duplicate = nla_duplicate;
+ st->operatortypes = nla_operatortypes;
+ st->listener = nla_listener;
+ st->keymap = nla_keymap;
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype nla region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype nla region");
art->regionid = RGN_TYPE_WINDOW;
- art->init= nla_main_area_init;
- art->draw= nla_main_area_draw;
- art->listener= nla_main_area_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
+ art->init = nla_main_area_init;
+ art->draw = nla_main_area_draw;
+ art->listener = nla_main_area_listener;
+ art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_MARKERS | ED_KEYMAP_ANIMATION | ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype nla region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype nla region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
- art->init= nla_header_area_init;
- art->draw= nla_header_area_draw;
+ art->init = nla_header_area_init;
+ art->draw = nla_header_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: channels */
- art= MEM_callocN(sizeof(ARegionType), "spacetype nla region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype nla region");
art->regionid = RGN_TYPE_CHANNELS;
- art->prefsizex= 200;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+ art->prefsizex = 200;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
- art->init= nla_channel_area_init;
- art->draw= nla_channel_area_draw;
- art->listener= nla_channel_area_listener;
+ art->init = nla_channel_area_init;
+ art->draw = nla_channel_area_draw;
+ art->listener = nla_channel_area_listener;
BLI_addhead(&st->regiontypes, art);
/* regions: UI buttons */
- art= MEM_callocN(sizeof(ARegionType), "spacetype nla region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype nla region");
art->regionid = RGN_TYPE_UI;
- art->prefsizex= 200;
- art->keymapflag= ED_KEYMAP_UI;
- art->listener= nla_region_listener;
- art->init= nla_buttons_area_init;
- art->draw= nla_buttons_area_draw;
+ art->prefsizex = 200;
+ art->keymapflag = ED_KEYMAP_UI;
+ art->listener = nla_region_listener;
+ art->init = nla_buttons_area_init;
+ art->draw = nla_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
@@ -559,4 +559,3 @@ void ED_spacetype_nla(void)
BKE_spacetype_register(st);
}
-