style cleanup: nla

This commit is contained in:
Campbell Barton 2012-05-08 18:05:57 +00:00
parent 855c11ff8c
commit f605679515
8 changed files with 877 additions and 877 deletions

View File

@ -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);

View File

@ -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;
}
/* *********************************************** */

View File

@ -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);

File diff suppressed because it is too large Load Diff

View File

@ -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);

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}