forked from bartvdbraak/blender
style cleanup: nla
This commit is contained in:
parent
855c11ff8c
commit
f605679515
@ -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,11 +124,11 @@ 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;
|
||||
|
||||
@ -156,7 +156,7 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
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);
|
||||
row = uiLayoutRow(layout, 1);
|
||||
uiItemR(row, &adt_ptr, "action_extrapolation", 0, NULL, ICON_NONE);
|
||||
|
||||
/* blending */
|
||||
row= uiLayoutRow(layout, 1);
|
||||
row = uiLayoutRow(layout, 1);
|
||||
uiItemR(row, &adt_ptr, "action_blend_type", 0, NULL, ICON_NONE);
|
||||
|
||||
/* influence */
|
||||
row= uiLayoutRow(layout, 1);
|
||||
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,11 +280,11 @@ 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);
|
||||
row = uiLayoutRow(layout, 1);
|
||||
uiItemR(row, &nlt_ptr, "name", 0, NULL, ICON_NLA);
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ static void nla_panel_track (const bContext *C, Panel *pa)
|
||||
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,17 +300,17 @@ 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);
|
||||
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);
|
||||
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);
|
||||
@ -324,27 +324,27 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
|
||||
/* only show if allowed to... */
|
||||
if (showEvalProps) {
|
||||
/* extrapolation */
|
||||
row= uiLayoutRow(layout, 1);
|
||||
row = uiLayoutRow(layout, 1);
|
||||
uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, ICON_NONE);
|
||||
|
||||
/* blending */
|
||||
row= uiLayoutRow(layout, 1);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
@ -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,25 +365,25 @@ 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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
@ -393,7 +393,7 @@ static void nla_panel_actclip(const bContext *C, Panel *pa)
|
||||
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,15 +433,15 @@ 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)
|
||||
@ -449,14 +449,14 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
|
||||
TIP_("Adds a new F-Modifier for the active NLA Strip"));
|
||||
|
||||
/* copy/paste (as sub-row)*/
|
||||
row= uiLayoutRow(row, 1);
|
||||
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);
|
||||
|
@ -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 = (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);
|
||||
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;
|
||||
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,7 +159,7 @@ 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;
|
||||
@ -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;
|
||||
|
||||
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,15 +257,15 @@ 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;
|
||||
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
|
||||
@ -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;
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
|
@ -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;
|
||||
@ -135,10 +135,10 @@ static void nla_action_draw_keyframes (AnimData *adt, bAction *act, View2D *v2d,
|
||||
/* - 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,7 +261,7 @@ 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) */
|
||||
@ -269,15 +269,15 @@ static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc)
|
||||
/* 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));
|
||||
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) {
|
||||
@ -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 */
|
||||
@ -346,7 +346,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr
|
||||
/* 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);
|
||||
|
||||
@ -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)
|
||||
@ -525,11 +525,11 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
|
||||
*/
|
||||
/* 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 */
|
||||
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,14 +540,14 @@ 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
|
||||
@ -555,34 +555,34 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
|
||||
* - 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) ||
|
||||
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);
|
||||
@ -602,7 +602,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
|
||||
|
||||
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,23 +618,23 @@ 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 */
|
||||
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 */
|
||||
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);
|
||||
}
|
||||
@ -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) ||
|
||||
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,24 +717,24 @@ 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;
|
||||
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;
|
||||
|
||||
@ -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;
|
||||
|
||||
case NTREE_TEXTURE:
|
||||
{
|
||||
/* even more */
|
||||
offset= 21;
|
||||
indent= 1;
|
||||
offset = 21;
|
||||
indent = 1;
|
||||
}
|
||||
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,7 +801,7 @@ 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
|
||||
@ -815,20 +817,20 @@ 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(x + offset, yminc);
|
||||
glVertex2f(x + offset, ymaxc);
|
||||
glVertex2f((float)v2d->cur.xmax, ymaxc);
|
||||
glVertex2f((float)v2d->cur.xmax, yminc);
|
||||
glEnd();
|
||||
@ -836,14 +838,14 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
|
||||
|
||||
/* 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,14 +929,14 @@ 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
|
||||
@ -942,7 +944,7 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar)
|
||||
* - 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)
|
||||
*/
|
||||
@ -952,27 +954,27 @@ void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar)
|
||||
|
||||
/* draw channels */
|
||||
{ /* first pass: backdrops + oldstyle drawing */
|
||||
y= (float)(-NLACHANNEL_HEIGHT(snla));
|
||||
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);
|
||||
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) ||
|
||||
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 */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include "RNA_access.h"
|
||||
|
||||
|
||||
#include "nla_intern.h" // own include
|
||||
#include "nla_intern.h" /* own include */
|
||||
|
||||
/* ************************** poll callbacks for operators **********************************/
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -184,7 +184,7 @@ static void nla_keymap_channels(wmKeyMap *keymap)
|
||||
/* 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 */
|
||||
@ -192,7 +192,7 @@ static void nla_keymap_channels(wmKeyMap *keymap)
|
||||
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;
|
||||
|
||||
@ -207,7 +207,7 @@ static void nla_keymap_main (wmKeyConfig *keyconf, wmKeyMap *keymap)
|
||||
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);
|
||||
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);
|
||||
|
||||
@ -285,7 +285,7 @@ static void nla_keymap_main (wmKeyConfig *keyconf, wmKeyMap *keymap)
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
||||
/* ******************** 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) {
|
||||
@ -104,7 +104,7 @@ enum {
|
||||
* 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", "");
|
||||
@ -217,31 +217,31 @@ enum {
|
||||
} /* 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) ||
|
||||
@ -249,11 +249,11 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh
|
||||
{
|
||||
/* 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
|
||||
|
@ -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 */
|
||||
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;
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -297,7 +297,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
|
||||
|
||||
/* 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_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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user