style cleanup: animation + buttons
This commit is contained in:
@@ -80,7 +80,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f
|
||||
return;
|
||||
|
||||
/* only clear the 'active' flag for the channels of the same type */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
/* skip if types don't match */
|
||||
if (channel_type != ale->type)
|
||||
continue;
|
||||
@@ -89,28 +89,28 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f
|
||||
switch (ale->type) {
|
||||
case ANIMTYPE_GROUP:
|
||||
{
|
||||
bActionGroup *agrp= (bActionGroup *)ale->data;
|
||||
bActionGroup *agrp = (bActionGroup *)ale->data;
|
||||
|
||||
ACHANNEL_SET_FLAG(agrp, ACHANNEL_SETFLAG_CLEAR, AGRP_ACTIVE);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_FCURVE:
|
||||
{
|
||||
FCurve *fcu= (FCurve *)ale->data;
|
||||
FCurve *fcu = (FCurve *)ale->data;
|
||||
|
||||
ACHANNEL_SET_FLAG(fcu, ACHANNEL_SETFLAG_CLEAR, FCURVE_ACTIVE);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_NLATRACK:
|
||||
{
|
||||
NlaTrack *nlt= (NlaTrack *)ale->data;
|
||||
NlaTrack *nlt = (NlaTrack *)ale->data;
|
||||
|
||||
ACHANNEL_SET_FLAG(nlt, ACHANNEL_SETFLAG_CLEAR, NLATRACK_ACTIVE);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_FILLACTD: /* Action Expander */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSLAM:
|
||||
case ANIMTYPE_DSCAM:
|
||||
case ANIMTYPE_DSCUR:
|
||||
@@ -129,7 +129,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f
|
||||
ACHANNEL_SET_FLAG(ale->adt, ACHANNEL_SETFLAG_CLEAR, ADT_UI_ACTIVE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,25 +138,25 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f
|
||||
switch (channel_type) {
|
||||
case ANIMTYPE_GROUP:
|
||||
{
|
||||
bActionGroup *agrp= (bActionGroup *)channel_data;
|
||||
bActionGroup *agrp = (bActionGroup *)channel_data;
|
||||
agrp->flag |= AGRP_ACTIVE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_FCURVE:
|
||||
{
|
||||
FCurve *fcu= (FCurve *)channel_data;
|
||||
FCurve *fcu = (FCurve *)channel_data;
|
||||
fcu->flag |= FCURVE_ACTIVE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_NLATRACK:
|
||||
{
|
||||
NlaTrack *nlt= (NlaTrack *)channel_data;
|
||||
NlaTrack *nlt = (NlaTrack *)channel_data;
|
||||
nlt->flag |= NLATRACK_ACTIVE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_FILLACTD: /* Action Expander */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSLAM:
|
||||
case ANIMTYPE_DSCAM:
|
||||
case ANIMTYPE_DSCUR:
|
||||
@@ -174,7 +174,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f
|
||||
ale->adt->flag |= ADT_UI_ACTIVE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,45 +196,45 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s
|
||||
|
||||
/* filter data */
|
||||
/* NOTE: no list visible, otherwise, we get dangling */
|
||||
filter= ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
|
||||
filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, data, datatype);
|
||||
|
||||
/* See if we should be selecting or deselecting */
|
||||
if (test) {
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
if (sel == 0)
|
||||
break;
|
||||
|
||||
switch (ale->type) {
|
||||
case ANIMTYPE_SCENE:
|
||||
if (ale->flag & SCE_DS_SELECTED)
|
||||
sel= ACHANNEL_SETFLAG_CLEAR;
|
||||
sel = ACHANNEL_SETFLAG_CLEAR;
|
||||
break;
|
||||
case ANIMTYPE_OBJECT:
|
||||
#if 0 /* for now, do not take object selection into account, since it gets too annoying */
|
||||
#if 0 /* for now, do not take object selection into account, since it gets too annoying */
|
||||
if (ale->flag & SELECT)
|
||||
sel= ACHANNEL_SETFLAG_CLEAR;
|
||||
sel = ACHANNEL_SETFLAG_CLEAR;
|
||||
#endif
|
||||
break;
|
||||
case ANIMTYPE_GROUP:
|
||||
if (ale->flag & AGRP_SELECTED)
|
||||
sel= ACHANNEL_SETFLAG_CLEAR;
|
||||
sel = ACHANNEL_SETFLAG_CLEAR;
|
||||
break;
|
||||
case ANIMTYPE_FCURVE:
|
||||
if (ale->flag & FCURVE_SELECTED)
|
||||
sel= ACHANNEL_SETFLAG_CLEAR;
|
||||
sel = ACHANNEL_SETFLAG_CLEAR;
|
||||
break;
|
||||
case ANIMTYPE_SHAPEKEY:
|
||||
if (ale->flag & KEYBLOCK_SEL)
|
||||
sel= ACHANNEL_SETFLAG_CLEAR;
|
||||
sel = ACHANNEL_SETFLAG_CLEAR;
|
||||
break;
|
||||
case ANIMTYPE_NLATRACK:
|
||||
if (ale->flag & NLATRACK_SELECTED)
|
||||
sel= ACHANNEL_SETFLAG_CLEAR;
|
||||
sel = ACHANNEL_SETFLAG_CLEAR;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_FILLACTD: /* Action Expander */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSLAM:
|
||||
case ANIMTYPE_DSCAM:
|
||||
case ANIMTYPE_DSCUR:
|
||||
@@ -250,24 +250,24 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s
|
||||
case ANIMTYPE_DSSPK:
|
||||
{
|
||||
if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
|
||||
sel= ACHANNEL_SETFLAG_CLEAR;
|
||||
sel = ACHANNEL_SETFLAG_CLEAR;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_GPLAYER:
|
||||
if (ale->flag & GP_LAYER_SELECT)
|
||||
sel= ACHANNEL_SETFLAG_CLEAR;
|
||||
sel = ACHANNEL_SETFLAG_CLEAR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now set the flags */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
switch (ale->type) {
|
||||
case ANIMTYPE_SCENE:
|
||||
{
|
||||
Scene *scene= (Scene *)ale->data;
|
||||
Scene *scene = (Scene *)ale->data;
|
||||
|
||||
ACHANNEL_SET_FLAG(scene, sel, SCE_DS_SELECTED);
|
||||
|
||||
@@ -275,56 +275,56 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s
|
||||
ACHANNEL_SET_FLAG(scene, sel, ADT_UI_SELECTED);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_OBJECT:
|
||||
#if 0 /* for now, do not take object selection into account, since it gets too annoying */
|
||||
{
|
||||
Base *base= (Base *)ale->data;
|
||||
Object *ob= base->object;
|
||||
#if 0 /* for now, do not take object selection into account, since it gets too annoying */
|
||||
{
|
||||
Base *base = (Base *)ale->data;
|
||||
Object *ob = base->object;
|
||||
|
||||
ACHANNEL_SET_FLAG(base, sel, SELECT);
|
||||
ACHANNEL_SET_FLAG(ob, sel, SELECT);
|
||||
ACHANNEL_SET_FLAG(base, sel, SELECT);
|
||||
ACHANNEL_SET_FLAG(ob, sel, SELECT);
|
||||
|
||||
if (ob->adt) {
|
||||
ACHANNEL_SET_FLAG(ob, sel, ADT_UI_SELECTED);
|
||||
if (ob->adt) {
|
||||
ACHANNEL_SET_FLAG(ob, sel, ADT_UI_SELECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ANIMTYPE_GROUP:
|
||||
{
|
||||
bActionGroup *agrp= (bActionGroup *)ale->data;
|
||||
bActionGroup *agrp = (bActionGroup *)ale->data;
|
||||
|
||||
ACHANNEL_SET_FLAG(agrp, sel, AGRP_SELECTED);
|
||||
agrp->flag &= ~AGRP_ACTIVE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_FCURVE:
|
||||
{
|
||||
FCurve *fcu= (FCurve *)ale->data;
|
||||
FCurve *fcu = (FCurve *)ale->data;
|
||||
|
||||
ACHANNEL_SET_FLAG(fcu, sel, FCURVE_SELECTED);
|
||||
fcu->flag &= ~FCURVE_ACTIVE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_SHAPEKEY:
|
||||
{
|
||||
KeyBlock *kb= (KeyBlock *)ale->data;
|
||||
KeyBlock *kb = (KeyBlock *)ale->data;
|
||||
|
||||
ACHANNEL_SET_FLAG(kb, sel, KEYBLOCK_SEL);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_NLATRACK:
|
||||
{
|
||||
NlaTrack *nlt= (NlaTrack *)ale->data;
|
||||
NlaTrack *nlt = (NlaTrack *)ale->data;
|
||||
|
||||
ACHANNEL_SET_FLAG(nlt, sel, NLATRACK_SELECTED);
|
||||
nlt->flag &= ~NLATRACK_ACTIVE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_FILLACTD: /* Action Expander */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSLAM:
|
||||
case ANIMTYPE_DSCAM:
|
||||
case ANIMTYPE_DSCUR:
|
||||
@@ -345,7 +345,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s
|
||||
ale->adt->flag &= ~ADT_UI_ACTIVE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_GPLAYER:
|
||||
{
|
||||
@@ -353,7 +353,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s
|
||||
|
||||
ACHANNEL_SET_FLAG(gpl, sel, GP_LAYER_SELECT);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,21 +374,21 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s
|
||||
*/
|
||||
void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on)
|
||||
{
|
||||
bAnimListElem *ale, *match=NULL;
|
||||
int prevLevel=0, matchLevel=0;
|
||||
bAnimListElem *ale, *match = NULL;
|
||||
int prevLevel = 0, matchLevel = 0;
|
||||
|
||||
/* sanity check */
|
||||
if (ELEM(NULL, anim_data, anim_data->first))
|
||||
return;
|
||||
|
||||
/* find the channel that got changed */
|
||||
for (ale= anim_data->first; ale; ale= ale->next) {
|
||||
for (ale = anim_data->first; ale; ale = ale->next) {
|
||||
/* compare data, and type as main way of identifying the channel */
|
||||
if ((ale->data == ale_setting->data) && (ale->type == ale_setting->type)) {
|
||||
/* we also have to check the ID, this is assigned to, since a block may have multiple users */
|
||||
// TODO: is the owner-data more revealing?
|
||||
if (ale->id == ale_setting->id) {
|
||||
match= ale;
|
||||
match = ale;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -398,7 +398,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
|
||||
return;
|
||||
}
|
||||
else {
|
||||
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale_setting);
|
||||
bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale_setting);
|
||||
|
||||
if (acf == NULL) {
|
||||
printf("ERROR: no channel info for the changed channel\n");
|
||||
@@ -406,10 +406,10 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
|
||||
}
|
||||
|
||||
/* get the level of the channel that was affected
|
||||
* - we define the level as simply being the offset for the start of the channel
|
||||
* - we define the level as simply being the offset for the start of the channel
|
||||
*/
|
||||
matchLevel= (acf->get_offset)? acf->get_offset(ac, ale_setting) : 0;
|
||||
prevLevel= matchLevel;
|
||||
matchLevel = (acf->get_offset) ? acf->get_offset(ac, ale_setting) : 0;
|
||||
prevLevel = matchLevel;
|
||||
}
|
||||
|
||||
/* flush up?
|
||||
@@ -423,11 +423,11 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
|
||||
* (otherwise, it's too much work to force the parents to be active too)
|
||||
*/
|
||||
if ( ((setting == ACHANNEL_SETTING_VISIBLE) && on) ||
|
||||
((setting != ACHANNEL_SETTING_VISIBLE) && on==0) )
|
||||
((setting != ACHANNEL_SETTING_VISIBLE) && on == 0) )
|
||||
{
|
||||
/* go backwards in the list, until the highest-ranking element (by indention has been covered) */
|
||||
for (ale= match->prev; ale; ale= ale->prev) {
|
||||
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
|
||||
for (ale = match->prev; ale; ale = ale->prev) {
|
||||
bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
int level;
|
||||
|
||||
/* if no channel info was found, skip, since this type might not have any useful info */
|
||||
@@ -435,9 +435,9 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
|
||||
continue;
|
||||
|
||||
/* get the level of the current channel traversed
|
||||
* - we define the level as simply being the offset for the start of the channel
|
||||
* - we define the level as simply being the offset for the start of the channel
|
||||
*/
|
||||
level= (acf->get_offset)? acf->get_offset(ac, ale) : 0;
|
||||
level = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
|
||||
|
||||
/* if the level is 'less than' (i.e. more important) the level we're matching
|
||||
* but also 'less than' the level just tried (i.e. only the 1st group above grouped F-Curves,
|
||||
@@ -449,7 +449,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
|
||||
ANIM_channel_setting_set(ac, ale, setting, on);
|
||||
|
||||
/* store this level as the 'old' level now */
|
||||
prevLevel= level;
|
||||
prevLevel = level;
|
||||
}
|
||||
/* if the level is 'greater than' (i.e. less important) than the previous level... */
|
||||
else if (level > prevLevel) {
|
||||
@@ -470,8 +470,8 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
|
||||
/* flush down (always) */
|
||||
{
|
||||
/* go forwards in the list, until the lowest-ranking element (by indention has been covered) */
|
||||
for (ale= match->next; ale; ale= ale->next) {
|
||||
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
|
||||
for (ale = match->next; ale; ale = ale->next) {
|
||||
bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
int level;
|
||||
|
||||
/* if no channel info was found, skip, since this type might not have any useful info */
|
||||
@@ -479,9 +479,9 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
|
||||
continue;
|
||||
|
||||
/* get the level of the current channel traversed
|
||||
* - we define the level as simply being the offset for the start of the channel
|
||||
* - we define the level as simply being the offset for the start of the channel
|
||||
*/
|
||||
level= (acf->get_offset)? acf->get_offset(ac, ale) : 0;
|
||||
level = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
|
||||
|
||||
/* if the level is 'greater than' (i.e. less important) the channel that was changed,
|
||||
* flush the new status...
|
||||
@@ -537,11 +537,11 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
|
||||
* channel list that are empty, and linger around long after the data they
|
||||
* are for has disappeared (and probably won't come back).
|
||||
*/
|
||||
// XXX: does everybody always want this?
|
||||
/* XXX: there's a problem where many actions could build up in the file if multiple
|
||||
* full add/delete cycles are performed on the same objects, but assume that this is rare
|
||||
*/
|
||||
if ((adt->action->curves.first == NULL) && (adt->flag & ADT_NLA_EDIT_ON)==0) {
|
||||
// XXX: does everybody always want this?
|
||||
/* XXX: there's a problem where many actions could build up in the file if multiple
|
||||
* full add/delete cycles are performed on the same objects, but assume that this is rare
|
||||
*/
|
||||
if ((adt->action->curves.first == NULL) && (adt->flag & ADT_NLA_EDIT_ON) == 0) {
|
||||
id_us_min(&adt->action->id);
|
||||
adt->action = NULL;
|
||||
}
|
||||
@@ -557,9 +557,9 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
|
||||
/* ****************** Operator Utilities ********************************** */
|
||||
|
||||
/* poll callback for being in an Animation Editor channels list region */
|
||||
static int animedit_poll_channels_active (bContext *C)
|
||||
static int animedit_poll_channels_active(bContext *C)
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
|
||||
/* channels region test */
|
||||
// TODO: could enhance with actually testing if channels region?
|
||||
@@ -573,9 +573,9 @@ static int animedit_poll_channels_active (bContext *C)
|
||||
}
|
||||
|
||||
/* poll callback for Animation Editor channels list region + not in NLA-tweakmode for NLA */
|
||||
static int animedit_poll_channels_nla_tweakmode_off (bContext *C)
|
||||
static int animedit_poll_channels_nla_tweakmode_off(bContext *C)
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
/* channels region test */
|
||||
@@ -600,10 +600,10 @@ static int animedit_poll_channels_nla_tweakmode_off (bContext *C)
|
||||
/* constants for channel rearranging */
|
||||
/* WARNING: don't change exising ones without modifying rearrange func accordingly */
|
||||
enum {
|
||||
REARRANGE_ANIMCHAN_TOP= -2,
|
||||
REARRANGE_ANIMCHAN_UP= -1,
|
||||
REARRANGE_ANIMCHAN_DOWN= 1,
|
||||
REARRANGE_ANIMCHAN_BOTTOM= 2
|
||||
REARRANGE_ANIMCHAN_TOP = -2,
|
||||
REARRANGE_ANIMCHAN_UP = -1,
|
||||
REARRANGE_ANIMCHAN_DOWN = 1,
|
||||
REARRANGE_ANIMCHAN_BOTTOM = 2
|
||||
};
|
||||
|
||||
/* defines for rearranging channels */
|
||||
@@ -621,21 +621,21 @@ static EnumPropertyItem prop_animchannel_rearrange_types[] = {
|
||||
typedef struct tReorderChannelIsland {
|
||||
struct tReorderChannelIsland *next, *prev;
|
||||
|
||||
ListBase channels; /* channels within this region with the same state */
|
||||
int flag; /* eReorderIslandFlag */
|
||||
ListBase channels; /* channels within this region with the same state */
|
||||
int flag; /* eReorderIslandFlag */
|
||||
} tReorderChannelIsland;
|
||||
|
||||
/* flags for channel reordering islands */
|
||||
typedef enum eReorderIslandFlag {
|
||||
REORDER_ISLAND_SELECTED = (1<<0), /* island is selected */
|
||||
REORDER_ISLAND_UNTOUCHABLE = (1<<1), /* island should be ignored */
|
||||
REORDER_ISLAND_MOVED = (1<<2) /* island has already been moved */
|
||||
REORDER_ISLAND_SELECTED = (1 << 0), /* island is selected */
|
||||
REORDER_ISLAND_UNTOUCHABLE = (1 << 1), /* island should be ignored */
|
||||
REORDER_ISLAND_MOVED = (1 << 2) /* island has already been moved */
|
||||
} eReorderIslandFlag;
|
||||
|
||||
|
||||
/* Rearrange Methods --------------------------------------------- */
|
||||
|
||||
static short rearrange_island_ok (tReorderChannelIsland *island)
|
||||
static short rearrange_island_ok(tReorderChannelIsland *island)
|
||||
{
|
||||
/* island must not be untouchable */
|
||||
if (island->flag & REORDER_ISLAND_UNTOUCHABLE)
|
||||
@@ -647,7 +647,7 @@ static short rearrange_island_ok (tReorderChannelIsland *island)
|
||||
|
||||
/* ............................. */
|
||||
|
||||
static short rearrange_island_top (ListBase *list, tReorderChannelIsland *island)
|
||||
static short rearrange_island_top(ListBase *list, tReorderChannelIsland *island)
|
||||
{
|
||||
if (rearrange_island_ok(island)) {
|
||||
/* remove from current position */
|
||||
@@ -662,11 +662,11 @@ static short rearrange_island_top (ListBase *list, tReorderChannelIsland *island
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short rearrange_island_up (ListBase *list, tReorderChannelIsland *island)
|
||||
static short rearrange_island_up(ListBase *list, tReorderChannelIsland *island)
|
||||
{
|
||||
if (rearrange_island_ok(island)) {
|
||||
/* moving up = moving before the previous island, otherwise we're in the same place */
|
||||
tReorderChannelIsland *prev= island->prev;
|
||||
tReorderChannelIsland *prev = island->prev;
|
||||
|
||||
if (prev) {
|
||||
/* remove from current position */
|
||||
@@ -682,7 +682,7 @@ static short rearrange_island_up (ListBase *list, tReorderChannelIsland *island)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short rearrange_island_down (ListBase *list, tReorderChannelIsland *island)
|
||||
static short rearrange_island_down(ListBase *list, tReorderChannelIsland *island)
|
||||
{
|
||||
if (rearrange_island_ok(island)) {
|
||||
/* moving down = moving after the next island, otherwise we're in the same place */
|
||||
@@ -690,7 +690,7 @@ static short rearrange_island_down (ListBase *list, tReorderChannelIsland *islan
|
||||
|
||||
if (next) {
|
||||
/* can only move past if next is not untouchable (i.e. nothing can go after it) */
|
||||
if ((next->flag & REORDER_ISLAND_UNTOUCHABLE)==0) {
|
||||
if ((next->flag & REORDER_ISLAND_UNTOUCHABLE) == 0) {
|
||||
/* remove from current position */
|
||||
BLI_remlink(list, island);
|
||||
|
||||
@@ -706,7 +706,7 @@ static short rearrange_island_down (ListBase *list, tReorderChannelIsland *islan
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short rearrange_island_bottom (ListBase *list, tReorderChannelIsland *island)
|
||||
static short rearrange_island_bottom(ListBase *list, tReorderChannelIsland *island)
|
||||
{
|
||||
if (rearrange_island_ok(island)) {
|
||||
tReorderChannelIsland *last = list->last;
|
||||
@@ -715,7 +715,7 @@ static short rearrange_island_bottom (ListBase *list, tReorderChannelIsland *isl
|
||||
BLI_remlink(list, island);
|
||||
|
||||
/* add before or after the last channel? */
|
||||
if ((last->flag & REORDER_ISLAND_UNTOUCHABLE)==0) {
|
||||
if ((last->flag & REORDER_ISLAND_UNTOUCHABLE) == 0) {
|
||||
/* can add after it */
|
||||
BLI_addtail(list, island);
|
||||
}
|
||||
@@ -741,7 +741,7 @@ static short rearrange_island_bottom (ListBase *list, tReorderChannelIsland *isl
|
||||
typedef short (*AnimChanRearrangeFp)(ListBase *list, tReorderChannelIsland *island);
|
||||
|
||||
/* get rearranging function, given 'rearrange' mode */
|
||||
static AnimChanRearrangeFp rearrange_get_mode_func (short mode)
|
||||
static AnimChanRearrangeFp rearrange_get_mode_func(short mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case REARRANGE_ANIMCHAN_TOP:
|
||||
@@ -760,35 +760,35 @@ static AnimChanRearrangeFp rearrange_get_mode_func (short mode)
|
||||
/* Rearrange Islands Generics ------------------------------------- */
|
||||
|
||||
/* add channel into list of islands */
|
||||
static void rearrange_animchannel_add_to_islands (ListBase *islands, ListBase *srcList, Link *channel, short type)
|
||||
static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *srcList, Link *channel, short type)
|
||||
{
|
||||
tReorderChannelIsland *island = islands->last; /* always try to add to last island if possible */
|
||||
short is_sel=0, is_untouchable=0;
|
||||
tReorderChannelIsland *island = islands->last; /* always try to add to last island if possible */
|
||||
short is_sel = 0, is_untouchable = 0;
|
||||
|
||||
/* get flags - selected and untouchable from the channel */
|
||||
switch (type) {
|
||||
case ANIMTYPE_GROUP:
|
||||
{
|
||||
bActionGroup *agrp= (bActionGroup *)channel;
|
||||
bActionGroup *agrp = (bActionGroup *)channel;
|
||||
|
||||
is_sel= SEL_AGRP(agrp);
|
||||
is_untouchable= (agrp->flag & AGRP_TEMP) != 0;
|
||||
is_sel = SEL_AGRP(agrp);
|
||||
is_untouchable = (agrp->flag & AGRP_TEMP) != 0;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_FCURVE:
|
||||
{
|
||||
FCurve *fcu= (FCurve *)channel;
|
||||
FCurve *fcu = (FCurve *)channel;
|
||||
|
||||
is_sel= SEL_FCU(fcu);
|
||||
is_sel = SEL_FCU(fcu);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_NLATRACK:
|
||||
{
|
||||
NlaTrack *nlt= (NlaTrack *)channel;
|
||||
NlaTrack *nlt = (NlaTrack *)channel;
|
||||
|
||||
is_sel= SEL_NLT(nlt);
|
||||
is_sel = SEL_NLT(nlt);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("rearrange_animchannel_add_to_islands(): don't know how to handle channels of type %d\n", type);
|
||||
@@ -797,8 +797,8 @@ static void rearrange_animchannel_add_to_islands (ListBase *islands, ListBase *s
|
||||
|
||||
/* do we need to add to a new island? */
|
||||
if ((island == NULL) || /* 1) no islands yet */
|
||||
((island->flag & REORDER_ISLAND_SELECTED) == 0) || /* 2) unselected islands have single channels only - to allow up/down movement */
|
||||
(is_sel == 0)) /* 3) if channel is unselected, stop existing island (it was either wrong sel status, or full already) */
|
||||
((island->flag & REORDER_ISLAND_SELECTED) == 0) || /* 2) unselected islands have single channels only - to allow up/down movement */
|
||||
(is_sel == 0)) /* 3) if channel is unselected, stop existing island (it was either wrong sel status, or full already) */
|
||||
{
|
||||
/* create a new island now */
|
||||
island = MEM_callocN(sizeof(tReorderChannelIsland), "tReorderChannelIsland");
|
||||
@@ -816,9 +816,9 @@ static void rearrange_animchannel_add_to_islands (ListBase *islands, ListBase *s
|
||||
}
|
||||
|
||||
/* flatten islands out into a single list again */
|
||||
static void rearrange_animchannel_flatten_islands (ListBase *islands, ListBase *srcList)
|
||||
static void rearrange_animchannel_flatten_islands(ListBase *islands, ListBase *srcList)
|
||||
{
|
||||
tReorderChannelIsland *island, *isn=NULL;
|
||||
tReorderChannelIsland *island, *isn = NULL;
|
||||
|
||||
/* make sure srcList is empty now */
|
||||
BLI_assert(srcList->first == NULL);
|
||||
@@ -836,10 +836,10 @@ static void rearrange_animchannel_flatten_islands (ListBase *islands, ListBase *
|
||||
/* ............................. */
|
||||
|
||||
/* performing rearranging of channels using islands */
|
||||
static short rearrange_animchannel_islands (ListBase *list, AnimChanRearrangeFp rearrange_func, short mode, short type)
|
||||
static short rearrange_animchannel_islands(ListBase *list, AnimChanRearrangeFp rearrange_func, short mode, short type)
|
||||
{
|
||||
ListBase islands = {NULL, NULL};
|
||||
Link *channel, *chanNext=NULL;
|
||||
Link *channel, *chanNext = NULL;
|
||||
short done = 0;
|
||||
|
||||
/* don't waste effort on an empty list */
|
||||
@@ -858,7 +858,7 @@ static short rearrange_animchannel_islands (ListBase *list, AnimChanRearrangeFp
|
||||
*/
|
||||
if (islands.first != islands.last) {
|
||||
tReorderChannelIsland *first = (mode > 0) ? islands.last : islands.first;
|
||||
tReorderChannelIsland *island, *isn=NULL;
|
||||
tReorderChannelIsland *island, *isn = NULL;
|
||||
|
||||
for (island = first; island; island = isn) {
|
||||
isn = (mode > 0) ? island->prev : island->next;
|
||||
@@ -884,7 +884,7 @@ static short rearrange_animchannel_islands (ListBase *list, AnimChanRearrangeFp
|
||||
* ! NLA tracks are displayed in opposite order, so directions need care
|
||||
* mode: REARRANGE_ANIMCHAN_*
|
||||
*/
|
||||
static void rearrange_nla_channels (bAnimContext *UNUSED(ac), AnimData *adt, short mode)
|
||||
static void rearrange_nla_channels(bAnimContext *UNUSED(ac), AnimData *adt, short mode)
|
||||
{
|
||||
AnimChanRearrangeFp rearrange_func;
|
||||
|
||||
@@ -909,7 +909,7 @@ static void rearrange_nla_channels (bAnimContext *UNUSED(ac), AnimData *adt, sho
|
||||
/* Change the order drivers within AnimData block
|
||||
* mode: REARRANGE_ANIMCHAN_*
|
||||
*/
|
||||
static void rearrange_driver_channels (bAnimContext *UNUSED(ac), AnimData *adt, short mode)
|
||||
static void rearrange_driver_channels(bAnimContext *UNUSED(ac), AnimData *adt, short mode)
|
||||
{
|
||||
/* get rearranging function */
|
||||
AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode);
|
||||
@@ -928,7 +928,7 @@ static void rearrange_driver_channels (bAnimContext *UNUSED(ac), AnimData *adt,
|
||||
/* Action Specific Stuff ------------------------------------------------- */
|
||||
|
||||
/* make sure all action-channels belong to a group (and clear action's list) */
|
||||
static void split_groups_action_temp (bAction *act, bActionGroup *tgrp)
|
||||
static void split_groups_action_temp(bAction *act, bActionGroup *tgrp)
|
||||
{
|
||||
bActionGroup *agrp;
|
||||
FCurve *fcu;
|
||||
@@ -937,37 +937,37 @@ static void split_groups_action_temp (bAction *act, bActionGroup *tgrp)
|
||||
return;
|
||||
|
||||
/* Separate F-Curves into lists per group */
|
||||
for (agrp= act->groups.first; agrp; agrp= agrp->next) {
|
||||
for (agrp = act->groups.first; agrp; agrp = agrp->next) {
|
||||
if (agrp->channels.first) {
|
||||
fcu= agrp->channels.last;
|
||||
act->curves.first= fcu->next;
|
||||
fcu = agrp->channels.last;
|
||||
act->curves.first = fcu->next;
|
||||
|
||||
fcu= agrp->channels.first;
|
||||
fcu->prev= NULL;
|
||||
fcu = agrp->channels.first;
|
||||
fcu->prev = NULL;
|
||||
|
||||
fcu= agrp->channels.last;
|
||||
fcu->next= NULL;
|
||||
fcu = agrp->channels.last;
|
||||
fcu->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize memory for temp-group */
|
||||
memset(tgrp, 0, sizeof(bActionGroup));
|
||||
tgrp->flag |= (AGRP_EXPANDED|AGRP_TEMP);
|
||||
tgrp->flag |= (AGRP_EXPANDED | AGRP_TEMP);
|
||||
BLI_strncpy(tgrp->name, "#TempGroup", sizeof(tgrp->name));
|
||||
|
||||
/* Move any action-channels not already moved, to the temp group */
|
||||
if (act->curves.first) {
|
||||
/* start of list */
|
||||
fcu= act->curves.first;
|
||||
fcu->prev= NULL;
|
||||
tgrp->channels.first= fcu;
|
||||
act->curves.first= NULL;
|
||||
fcu = act->curves.first;
|
||||
fcu->prev = NULL;
|
||||
tgrp->channels.first = fcu;
|
||||
act->curves.first = NULL;
|
||||
|
||||
/* end of list */
|
||||
fcu= act->curves.last;
|
||||
fcu->next= NULL;
|
||||
tgrp->channels.last= fcu;
|
||||
act->curves.last= NULL;
|
||||
fcu = act->curves.last;
|
||||
fcu->next = NULL;
|
||||
tgrp->channels.last = fcu;
|
||||
act->curves.last = NULL;
|
||||
}
|
||||
|
||||
/* Add temp-group to list */
|
||||
@@ -975,17 +975,17 @@ static void split_groups_action_temp (bAction *act, bActionGroup *tgrp)
|
||||
}
|
||||
|
||||
/* link lists of channels that groups have */
|
||||
static void join_groups_action_temp (bAction *act)
|
||||
static void join_groups_action_temp(bAction *act)
|
||||
{
|
||||
bActionGroup *agrp;
|
||||
|
||||
for (agrp= act->groups.first; agrp; agrp= agrp->next) {
|
||||
for (agrp = act->groups.first; agrp; agrp = agrp->next) {
|
||||
ListBase tempGroup;
|
||||
|
||||
/* add list of channels to action's channels */
|
||||
tempGroup= agrp->channels;
|
||||
tempGroup = agrp->channels;
|
||||
BLI_movelisttolist(&act->curves, &agrp->channels);
|
||||
agrp->channels= tempGroup;
|
||||
agrp->channels = tempGroup;
|
||||
|
||||
/* clear moved flag */
|
||||
agrp->flag &= ~AGRP_MOVED;
|
||||
@@ -1001,7 +1001,7 @@ static void join_groups_action_temp (bAction *act)
|
||||
/* Change the order of anim-channels within action
|
||||
* mode: REARRANGE_ANIMCHAN_*
|
||||
*/
|
||||
static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mode)
|
||||
static void rearrange_action_channels(bAnimContext *ac, bAction *act, short mode)
|
||||
{
|
||||
bActionGroup tgrp;
|
||||
short do_channels;
|
||||
@@ -1024,7 +1024,7 @@ static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mod
|
||||
if (do_channels) {
|
||||
bActionGroup *agrp;
|
||||
|
||||
for (agrp= act->groups.first; agrp; agrp= agrp->next) {
|
||||
for (agrp = act->groups.first; agrp; agrp = agrp->next) {
|
||||
/* only consider F-Curves if they're visible (group expanded) */
|
||||
if (EXPANDED_AGRP(ac, agrp)) {
|
||||
rearrange_animchannel_islands(&agrp->channels, rearrange_func, mode, ANIMTYPE_FCURVE);
|
||||
@@ -1048,7 +1048,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* get mode */
|
||||
mode= RNA_enum_get(op->ptr, "direction");
|
||||
mode = RNA_enum_get(op->ptr, "direction");
|
||||
|
||||
/* method to move channels depends on the editor */
|
||||
if (ac.datatype == ANIMCONT_GPENCIL) {
|
||||
@@ -1065,11 +1065,11 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
|
||||
int filter;
|
||||
|
||||
/* get animdata blocks */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA);
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
AnimData *adt= ale->data;
|
||||
AnimData *adt = ale->data;
|
||||
|
||||
switch (ac.datatype) {
|
||||
case ANIMCONT_NLA: /* NLA-tracks only */
|
||||
@@ -1096,12 +1096,12 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_move (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_move(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Move Channels";
|
||||
@@ -1113,7 +1113,7 @@ static void ANIM_OT_channels_move (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_nla_tweakmode_off;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
ot->prop = RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
|
||||
@@ -1140,15 +1140,15 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
/* do groups only first (unless in Drivers mode, where there are none) */
|
||||
if (ac.datatype != ANIMCONT_DRIVERS) {
|
||||
/* filter data */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* delete selected groups and their associated channels */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
/* only groups - don't check other types yet, since they may no-longer exist */
|
||||
if (ale->type == ANIMTYPE_GROUP) {
|
||||
bActionGroup *agrp= (bActionGroup *)ale->data;
|
||||
AnimData *adt= ale->adt;
|
||||
bActionGroup *agrp = (bActionGroup *)ale->data;
|
||||
AnimData *adt = ale->adt;
|
||||
FCurve *fcu, *fcn;
|
||||
|
||||
/* skip this group if no AnimData available, as we can't safely remove the F-Curves */
|
||||
@@ -1156,8 +1156,8 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
continue;
|
||||
|
||||
/* delete all of the Group's F-Curves, but no others */
|
||||
for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcn) {
|
||||
fcn= fcu->next;
|
||||
for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcn) {
|
||||
fcn = fcu->next;
|
||||
|
||||
/* remove from group and action, then free */
|
||||
action_groups_remove_channel(adt->action, fcu);
|
||||
@@ -1177,34 +1177,34 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
}
|
||||
|
||||
/* filter data */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* delete selected data channels */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
switch (ale->type) {
|
||||
case ANIMTYPE_FCURVE:
|
||||
{
|
||||
/* F-Curves if we can identify its parent */
|
||||
AnimData *adt= ale->adt;
|
||||
FCurve *fcu= (FCurve *)ale->data;
|
||||
AnimData *adt = ale->adt;
|
||||
FCurve *fcu = (FCurve *)ale->data;
|
||||
|
||||
/* try to free F-Curve */
|
||||
ANIM_fcurve_delete_from_animdata(&ac, adt, fcu);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_GPLAYER:
|
||||
{
|
||||
/* Grease Pencil layer */
|
||||
bGPdata *gpd= (bGPdata *)ale->id;
|
||||
bGPDlayer *gpl= (bGPDlayer *)ale->data;
|
||||
bGPdata *gpd = (bGPdata *)ale->id;
|
||||
bGPDlayer *gpl = (bGPDlayer *)ale->data;
|
||||
|
||||
/* try to delete the layer's data and the layer itself */
|
||||
free_gpencil_frames(gpl);
|
||||
BLI_freelinkN(&gpd->layers, gpl);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1212,12 +1212,12 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
BLI_freelistN(&anim_data);
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_delete (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_delete(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Delete Channels";
|
||||
@@ -1229,7 +1229,7 @@ static void ANIM_OT_channels_delete (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ******************** Set Channel Visibility Operator *********************** */
|
||||
@@ -1250,7 +1250,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
/* get list of all channels that selection may need to be flushed to
|
||||
* - hierarchy mustn't affect what we have access to here...
|
||||
*/
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* hide all channels not selected
|
||||
@@ -1262,15 +1262,15 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
*/
|
||||
if ((ac.spacetype == SPACE_IPO) && (ac.regiontype != RGN_TYPE_CHANNELS)) {
|
||||
/* graph editor (case 2) */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_UNSEL | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_UNSEL | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
|
||||
}
|
||||
else {
|
||||
/* standard case */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_UNSEL | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_UNSEL | ANIMFILTER_NODUPLIS);
|
||||
}
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
/* clear setting first */
|
||||
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_CLEAR);
|
||||
|
||||
@@ -1283,10 +1283,10 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
BLI_freelistN(&anim_data);
|
||||
|
||||
/* make all the selected channels visible */
|
||||
filter= (ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
|
||||
// TODO: find out why this is the case, and fix that
|
||||
if (ale->type == ANIMTYPE_OBJECT)
|
||||
@@ -1304,12 +1304,12 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_visibility_set (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_visibility_set(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Set Visibility";
|
||||
@@ -1321,7 +1321,7 @@ static void ANIM_OT_channels_visibility_set (wmOperatorType *ot)
|
||||
ot->poll = ED_operator_graphedit_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
@@ -1335,7 +1335,7 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o
|
||||
ListBase all_data = {NULL, NULL};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
short vis= ACHANNEL_SETFLAG_ADD;
|
||||
short vis = ACHANNEL_SETFLAG_ADD;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
@@ -1344,26 +1344,26 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o
|
||||
/* get list of all channels that selection may need to be flushed to
|
||||
* - hierarchy mustn't affect what we have access to here...
|
||||
*/
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* filter data
|
||||
* - restrict this to only applying on settings we can get to in the list
|
||||
*/
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* See if we should be making showing all selected or hiding */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
/* set the setting in the appropriate way (if available) */
|
||||
if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE)) {
|
||||
vis= ACHANNEL_SETFLAG_CLEAR;
|
||||
vis = ACHANNEL_SETFLAG_CLEAR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now set the flags */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
|
||||
// TODO: find out why this is the case, and fix that
|
||||
if (ale->type == ANIMTYPE_OBJECT)
|
||||
@@ -1381,12 +1381,12 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o
|
||||
BLI_freelistN(&all_data);
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_visibility_toggle(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Toggle Visibility";
|
||||
@@ -1398,7 +1398,7 @@ static void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot)
|
||||
ot->poll = ED_operator_graphedit_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ********************** Set Flags Operator *********************** */
|
||||
@@ -1429,7 +1429,7 @@ static EnumPropertyItem prop_animchannel_settings_types[] = {
|
||||
* onlysel: only selected channels get the flag set
|
||||
*/
|
||||
// TODO: enable a setting which turns flushing on/off?
|
||||
static void setflag_anim_channels (bAnimContext *ac, short setting, short mode, short onlysel, short flush)
|
||||
static void setflag_anim_channels(bAnimContext *ac, short setting, short mode, short onlysel, short flush)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase all_data = {NULL, NULL};
|
||||
@@ -1442,7 +1442,7 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode,
|
||||
* - hierarchy visibility needs to be ignored so that settings can get flushed
|
||||
* "down" inside closed containers
|
||||
*/
|
||||
filter= ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
|
||||
filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
|
||||
ANIM_animdata_filter(ac, &all_data, filter, ac->data, ac->datatype);
|
||||
}
|
||||
|
||||
@@ -1455,11 +1455,11 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode,
|
||||
*/
|
||||
if ((ac->spacetype == SPACE_IPO) && (ac->regiontype != RGN_TYPE_CHANNELS)) {
|
||||
/* graph editor (case 2) */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
|
||||
}
|
||||
else {
|
||||
/* standard case */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
|
||||
}
|
||||
if (onlysel) filter |= ANIMFILTER_SEL;
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
@@ -1467,20 +1467,20 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode,
|
||||
/* if toggling, check if disable or enable */
|
||||
if (mode == ACHANNEL_SETFLAG_TOGGLE) {
|
||||
/* default to turn all on, unless we encounter one that's on... */
|
||||
mode= ACHANNEL_SETFLAG_ADD;
|
||||
mode = ACHANNEL_SETFLAG_ADD;
|
||||
|
||||
/* see if we should turn off instead... */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
/* set the setting in the appropriate way (if available) */
|
||||
if (ANIM_channel_setting_get(ac, ale, setting) > 0) {
|
||||
mode= ACHANNEL_SETFLAG_CLEAR;
|
||||
mode = ACHANNEL_SETFLAG_CLEAR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* apply the setting */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
/* skip channel if setting is not available */
|
||||
if (ANIM_channel_setting_get(ac, ale, setting) == -1)
|
||||
continue;
|
||||
@@ -1503,19 +1503,19 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAnimContext ac;
|
||||
short mode, setting;
|
||||
short flush=1;
|
||||
short flush = 1;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* mode (eAnimChannels_SetFlag), setting (eAnimChannel_Settings) */
|
||||
mode= RNA_enum_get(op->ptr, "mode");
|
||||
setting= RNA_enum_get(op->ptr, "type");
|
||||
mode = RNA_enum_get(op->ptr, "mode");
|
||||
setting = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
/* check if setting is flushable */
|
||||
if (setting == ACHANNEL_SETTING_EXPAND)
|
||||
flush= 0;
|
||||
flush = 0;
|
||||
|
||||
/* modify setting
|
||||
* - only selected channels are affected
|
||||
@@ -1523,13 +1523,13 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op)
|
||||
setflag_anim_channels(&ac, setting, mode, 1, flush);
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* duplicate of 'ANIM_OT_channels_setting_toggle' for menu title only, weak! */
|
||||
static void ANIM_OT_channels_setting_enable (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_setting_enable(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Enable Channel Setting";
|
||||
@@ -1542,16 +1542,16 @@ static void ANIM_OT_channels_setting_enable (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
/* flag-setting mode */
|
||||
/* flag-setting mode */
|
||||
RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_ADD, "Mode", "");
|
||||
/* setting to set */
|
||||
/* setting to set */
|
||||
ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
|
||||
}
|
||||
/* duplicate of 'ANIM_OT_channels_setting_toggle' for menu title only, weak! */
|
||||
static void ANIM_OT_channels_setting_disable (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_setting_disable(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Disable Channel Setting";
|
||||
@@ -1564,16 +1564,16 @@ static void ANIM_OT_channels_setting_disable (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
/* flag-setting mode */
|
||||
/* flag-setting mode */
|
||||
RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_CLEAR, "Mode", "");
|
||||
/* setting to set */
|
||||
/* setting to set */
|
||||
ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_setting_toggle (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_setting_toggle(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Toggle Channel Setting";
|
||||
@@ -1586,16 +1586,16 @@ static void ANIM_OT_channels_setting_toggle (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
/* flag-setting mode */
|
||||
/* flag-setting mode */
|
||||
RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
|
||||
/* setting to set */
|
||||
/* setting to set */
|
||||
ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_editable_toggle (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_editable_toggle(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Toggle Channel Editability";
|
||||
@@ -1607,21 +1607,21 @@ static void ANIM_OT_channels_editable_toggle (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
/* flag-setting mode */
|
||||
/* flag-setting mode */
|
||||
RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
|
||||
/* setting to set */
|
||||
/* setting to set */
|
||||
RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, ACHANNEL_SETTING_PROTECT, "Type", "");
|
||||
}
|
||||
|
||||
/* ********************** Expand Channels Operator *********************** */
|
||||
|
||||
static int animchannels_expand_exec (bContext *C, wmOperator *op)
|
||||
static int animchannels_expand_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAnimContext ac;
|
||||
short onlysel= 1;
|
||||
short onlysel = 1;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
@@ -1629,18 +1629,18 @@ static int animchannels_expand_exec (bContext *C, wmOperator *op)
|
||||
|
||||
/* only affect selected channels? */
|
||||
if (RNA_boolean_get(op->ptr, "all"))
|
||||
onlysel= 0;
|
||||
onlysel = 0;
|
||||
|
||||
/* modify setting */
|
||||
setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, ACHANNEL_SETFLAG_ADD, onlysel, 0);
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_expand (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_expand(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Expand Channels";
|
||||
@@ -1652,7 +1652,7 @@ static void ANIM_OT_channels_expand (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all channels (not just selected ones)");
|
||||
@@ -1660,10 +1660,10 @@ static void ANIM_OT_channels_expand (wmOperatorType *ot)
|
||||
|
||||
/* ********************** Collapse Channels Operator *********************** */
|
||||
|
||||
static int animchannels_collapse_exec (bContext *C, wmOperator *op)
|
||||
static int animchannels_collapse_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAnimContext ac;
|
||||
short onlysel= 1;
|
||||
short onlysel = 1;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
@@ -1671,18 +1671,18 @@ static int animchannels_collapse_exec (bContext *C, wmOperator *op)
|
||||
|
||||
/* only affect selected channels? */
|
||||
if (RNA_boolean_get(op->ptr, "all"))
|
||||
onlysel= 0;
|
||||
onlysel = 0;
|
||||
|
||||
/* modify setting */
|
||||
setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, ACHANNEL_SETFLAG_CLEAR, onlysel, 0);
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_collapse (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_collapse(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Collapse Channels";
|
||||
@@ -1694,7 +1694,7 @@ static void ANIM_OT_channels_collapse (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not just selected ones)");
|
||||
@@ -1702,9 +1702,9 @@ static void ANIM_OT_channels_collapse (wmOperatorType *ot)
|
||||
|
||||
/* ******************* Reenable Disabled Operator ******************* */
|
||||
|
||||
static int animchannels_enable_poll (bContext *C)
|
||||
static int animchannels_enable_poll(bContext *C)
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
|
||||
/* channels region test */
|
||||
// TODO: could enhance with actually testing if channels region?
|
||||
@@ -1718,7 +1718,7 @@ static int animchannels_enable_poll (bContext *C)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int animchannels_enable_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
static int animchannels_enable_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
bAnimContext ac;
|
||||
|
||||
@@ -1731,11 +1731,11 @@ static int animchannels_enable_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* filter data */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS);
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* loop through filtered data and clean curves */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
FCurve *fcu = (FCurve *)ale->data;
|
||||
|
||||
/* remove disabled flags from F-Curves */
|
||||
@@ -1753,12 +1753,12 @@ static int animchannels_enable_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
BLI_freelistN(&anim_data);
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_fcurves_enable (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_fcurves_enable(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Revive Disabled F-Curves";
|
||||
@@ -1770,12 +1770,12 @@ static void ANIM_OT_channels_fcurves_enable (wmOperatorType *ot)
|
||||
ot->poll = animchannels_enable_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ********************** Select All Operator *********************** */
|
||||
|
||||
static int animchannels_deselectall_exec (bContext *C, wmOperator *op)
|
||||
static int animchannels_deselectall_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAnimContext ac;
|
||||
|
||||
@@ -1790,12 +1790,12 @@ static int animchannels_deselectall_exec (bContext *C, wmOperator *op)
|
||||
ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 1, ACHANNEL_SETFLAG_ADD);
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_SELECTED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_select_all_toggle(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Select All";
|
||||
@@ -1807,7 +1807,7 @@ static void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_nla_tweakmode_off;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
|
||||
@@ -1815,14 +1815,14 @@ static void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot)
|
||||
|
||||
/* ******************** Borderselect Operator *********************** */
|
||||
|
||||
static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short selectmode)
|
||||
static void borderselect_anim_channels(bAnimContext *ac, rcti *rect, 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, ymax;
|
||||
|
||||
@@ -1837,19 +1837,19 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
/* loop over data, doing border select */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
if (ac->datatype == ANIMCONT_NLA)
|
||||
ymin= ymax - NLACHANNEL_STEP(snla);
|
||||
ymin = ymax - NLACHANNEL_STEP(snla);
|
||||
else
|
||||
ymin= ymax - ACHANNEL_STEP;
|
||||
ymin = ymax - ACHANNEL_STEP;
|
||||
|
||||
/* if channel is within border-select region, alter it */
|
||||
if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
|
||||
@@ -1860,27 +1860,27 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele
|
||||
switch (ale->type) {
|
||||
case ANIMTYPE_GROUP:
|
||||
{
|
||||
bActionGroup *agrp= (bActionGroup *)ale->data;
|
||||
bActionGroup *agrp = (bActionGroup *)ale->data;
|
||||
|
||||
/* always clear active flag after doing this */
|
||||
agrp->flag &= ~AGRP_ACTIVE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_NLATRACK:
|
||||
{
|
||||
NlaTrack *nlt= (NlaTrack *)ale->data;
|
||||
NlaTrack *nlt = (NlaTrack *)ale->data;
|
||||
|
||||
/* for now, it's easier just to do this here manually, as defining a new type
|
||||
* currently adds complications when doing other stuff
|
||||
*/
|
||||
ACHANNEL_SET_FLAG(nlt, selectmode, NLATRACK_SELECTED);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* set minimum extent to be the maximum of the next channel */
|
||||
ymax= ymin;
|
||||
ymax = ymin;
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
@@ -1893,7 +1893,7 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAnimContext ac;
|
||||
rcti rect;
|
||||
short selectmode=0;
|
||||
short selectmode = 0;
|
||||
int gesture_mode, extend;
|
||||
|
||||
/* get editor data */
|
||||
@@ -1906,8 +1906,8 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
|
||||
rect.xmax = RNA_int_get(op->ptr, "xmax");
|
||||
rect.ymax = RNA_int_get(op->ptr, "ymax");
|
||||
|
||||
gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
|
||||
extend= RNA_boolean_get(op->ptr, "extend");
|
||||
gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
|
||||
extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
if (!extend)
|
||||
ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 1, ACHANNEL_SETFLAG_CLEAR);
|
||||
@@ -1921,7 +1921,7 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
|
||||
borderselect_anim_channels(&ac, &rect, selectmode);
|
||||
|
||||
/* send notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_SELECTED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1942,7 +1942,7 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_nla_tweakmode_off;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
@@ -1951,7 +1951,7 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot)
|
||||
/* ******************* Rename Operator ***************************** */
|
||||
/* Allow renaming some channels by clicking on them */
|
||||
|
||||
static void rename_anim_channels (bAnimContext *ac, int channel_index)
|
||||
static void rename_anim_channels(bAnimContext *ac, int channel_index)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
bAnimChannelType *acf;
|
||||
@@ -1959,12 +1959,12 @@ static void rename_anim_channels (bAnimContext *ac, int channel_index)
|
||||
int filter;
|
||||
|
||||
/* get the channel that was clicked on */
|
||||
/* filter channels */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
||||
/* filter channels */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* get channel from index */
|
||||
ale= BLI_findlink(&anim_data, channel_index);
|
||||
/* get channel from index */
|
||||
ale = BLI_findlink(&anim_data, channel_index);
|
||||
if (ale == NULL) {
|
||||
/* channel not found */
|
||||
if (G.debug & G_DEBUG)
|
||||
@@ -2000,7 +2000,7 @@ static void rename_anim_channels (bAnimContext *ac, int channel_index)
|
||||
ED_region_tag_redraw(ac->ar);
|
||||
}
|
||||
|
||||
static int animchannels_rename_invoke (bContext *C, wmOperator *UNUSED(op), wmEvent *evt)
|
||||
static int animchannels_rename_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *evt)
|
||||
{
|
||||
bAnimContext ac;
|
||||
ARegion *ar;
|
||||
@@ -2013,8 +2013,8 @@ static int animchannels_rename_invoke (bContext *C, wmOperator *UNUSED(op), wmEv
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* get useful pointers from animation context data */
|
||||
ar= ac.ar;
|
||||
v2d= &ar->v2d;
|
||||
ar = ac.ar;
|
||||
v2d = &ar->v2d;
|
||||
|
||||
/* figure out which channel user clicked in
|
||||
* Note: although channels technically start at y= ACHANNEL_FIRST, we need to adjust by half a channel's height
|
||||
@@ -2037,7 +2037,7 @@ static int animchannels_rename_invoke (bContext *C, wmOperator *UNUSED(op), wmEv
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_rename (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_rename(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Rename Channels";
|
||||
@@ -2052,7 +2052,7 @@ static void ANIM_OT_channels_rename (wmOperatorType *ot)
|
||||
/* ******************** Mouse-Click Operator *********************** */
|
||||
/* Handle selection changes due to clicking on channels. Settings will get caught by UI code... */
|
||||
|
||||
static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_index, short selectmode)
|
||||
static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_index, short selectmode)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
bAnimListElem *ale;
|
||||
@@ -2060,12 +2060,12 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
int notifierFlags = 0;
|
||||
|
||||
/* get the channel that was clicked on */
|
||||
/* filter channels */
|
||||
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
||||
/* filter channels */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* get channel from index */
|
||||
ale= BLI_findlink(&anim_data, channel_index);
|
||||
/* get channel from index */
|
||||
ale = BLI_findlink(&anim_data, channel_index);
|
||||
if (ale == NULL) {
|
||||
/* channel not found */
|
||||
if (G.debug & G_DEBUG)
|
||||
@@ -2088,8 +2088,8 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
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) {
|
||||
@@ -2102,22 +2102,22 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
if (adt) adt->flag |= ADT_UI_SELECTED;
|
||||
}
|
||||
|
||||
notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
|
||||
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_OBJECT:
|
||||
{
|
||||
bDopeSheet *ads= (bDopeSheet *)ac->data;
|
||||
Scene *sce= (Scene *)ads->source;
|
||||
Base *base= (Base *)ale->data;
|
||||
Object *ob= base->object;
|
||||
AnimData *adt= ob->adt;
|
||||
bDopeSheet *ads = (bDopeSheet *)ac->data;
|
||||
Scene *sce = (Scene *)ads->source;
|
||||
Base *base = (Base *)ale->data;
|
||||
Object *ob = base->object;
|
||||
AnimData *adt = ob->adt;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
@@ -2126,10 +2126,10 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
|
||||
/* 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 */
|
||||
@@ -2141,12 +2141,12 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
if ((adt) && (adt->flag & ADT_UI_SELECTED))
|
||||
adt->flag |= ADT_UI_ACTIVE;
|
||||
|
||||
notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
|
||||
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_FILLACTD: /* Action Expander */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
|
||||
case ANIMTYPE_DSLAM:
|
||||
case ANIMTYPE_DSCAM:
|
||||
case ANIMTYPE_DSCUR:
|
||||
@@ -2179,13 +2179,13 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
ale->adt->flag |= ADT_UI_ACTIVE;
|
||||
}
|
||||
|
||||
notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
|
||||
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_GROUP:
|
||||
{
|
||||
bActionGroup *agrp= (bActionGroup *)ale->data;
|
||||
bActionGroup *agrp = (bActionGroup *)ale->data;
|
||||
|
||||
/* select/deselect group */
|
||||
if (selectmode == SELECT_INVERT) {
|
||||
@@ -2200,7 +2200,7 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
|
||||
|
||||
/* only select channels in group and group itself */
|
||||
for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next)
|
||||
for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcu->next)
|
||||
fcu->flag |= FCURVE_SELECTED;
|
||||
agrp->flag |= AGRP_SELECTED;
|
||||
}
|
||||
@@ -2214,12 +2214,12 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
if (agrp->flag & AGRP_SELECTED)
|
||||
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
|
||||
|
||||
notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
|
||||
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_FCURVE:
|
||||
{
|
||||
FCurve *fcu= (FCurve *)ale->data;
|
||||
FCurve *fcu = (FCurve *)ale->data;
|
||||
|
||||
/* select/deselect */
|
||||
if (selectmode == SELECT_INVERT) {
|
||||
@@ -2236,12 +2236,12 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
if (fcu->flag & FCURVE_SELECTED)
|
||||
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
|
||||
|
||||
notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
|
||||
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_SHAPEKEY:
|
||||
{
|
||||
KeyBlock *kb= (KeyBlock *)ale->data;
|
||||
KeyBlock *kb = (KeyBlock *)ale->data;
|
||||
|
||||
/* select/deselect */
|
||||
if (selectmode == SELECT_INVERT) {
|
||||
@@ -2254,24 +2254,24 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
kb->flag |= KEYBLOCK_SEL;
|
||||
}
|
||||
|
||||
notifierFlags |= (ND_ANIMCHAN|NA_SELECTED);
|
||||
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_GPDATABLOCK:
|
||||
{
|
||||
bGPdata *gpd= (bGPdata *)ale->data;
|
||||
bGPdata *gpd = (bGPdata *)ale->data;
|
||||
|
||||
/* toggle expand
|
||||
* - although the triangle widget already allows this, the whole channel can also be used for this purpose
|
||||
*/
|
||||
gpd->flag ^= GP_DATA_EXPAND;
|
||||
|
||||
notifierFlags |= (ND_ANIMCHAN|NA_EDITED);
|
||||
notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_GPLAYER:
|
||||
{
|
||||
bGPDlayer *gpl= (bGPDlayer *)ale->data;
|
||||
bGPDlayer *gpl = (bGPDlayer *)ale->data;
|
||||
|
||||
/* select/deselect */
|
||||
if (selectmode == SELECT_INVERT) {
|
||||
@@ -2284,9 +2284,9 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
|
||||
gpl->flag |= GP_LAYER_SELECT;
|
||||
}
|
||||
|
||||
notifierFlags |= (ND_ANIMCHAN|NA_EDITED);
|
||||
notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
if (G.debug & G_DEBUG)
|
||||
printf("Error: Invalid channel type in mouse_anim_channels()\n");
|
||||
@@ -2318,16 +2318,16 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* get useful pointers from animation context data */
|
||||
ar= ac.ar;
|
||||
v2d= &ar->v2d;
|
||||
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 if (RNA_boolean_get(op->ptr, "children_only"))
|
||||
selectmode= -1; /* this is a bit of a special case for ActionGroups only... should it be removed or extended to all instead? */
|
||||
selectmode = -1; /* this is a bit of a special case for ActionGroups only... should it be removed or extended to all instead? */
|
||||
else
|
||||
selectmode= SELECT_REPLACE;
|
||||
selectmode = SELECT_REPLACE;
|
||||
|
||||
/* figure out which channel user clicked in
|
||||
* Note: although channels technically start at y= ACHANNEL_FIRST, we need to adjust by half a channel's height
|
||||
@@ -2338,15 +2338,15 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
|
||||
UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP, 0, (float)ACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
|
||||
|
||||
/* handle mouse-click in the relevant channel then */
|
||||
notifierFlags= mouse_anim_channels(&ac, x, channel_index, selectmode);
|
||||
notifierFlags = mouse_anim_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;
|
||||
}
|
||||
|
||||
static void ANIM_OT_channels_click (wmOperatorType *ot)
|
||||
static void ANIM_OT_channels_click(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Mouse Click on Channels";
|
||||
@@ -2358,7 +2358,7 @@ static void ANIM_OT_channels_click (wmOperatorType *ot)
|
||||
ot->poll = animedit_poll_channels_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
|
||||
@@ -2382,7 +2382,7 @@ void ED_operatortypes_animchannels(void)
|
||||
|
||||
WM_operatortype_append(ANIM_OT_channels_delete);
|
||||
|
||||
// XXX does this need to be a separate operator?
|
||||
// XXX does this need to be a separate operator?
|
||||
WM_operatortype_append(ANIM_OT_channels_editable_toggle);
|
||||
|
||||
WM_operatortype_append(ANIM_OT_channels_move);
|
||||
@@ -2403,20 +2403,20 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf)
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
/* selection */
|
||||
/* click-select */
|
||||
// XXX for now, only leftmouse....
|
||||
/* click-select */
|
||||
// XXX for now, only leftmouse....
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "children_only", TRUE);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "children_only", TRUE);
|
||||
|
||||
/* rename */
|
||||
/* rename */
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_channels_rename", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
|
||||
|
||||
/* deselect all */
|
||||
/* deselect all */
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", AKEY, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "invert", TRUE);
|
||||
|
||||
/* borderselect */
|
||||
/* borderselect */
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_channels_select_border", BKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_channels_select_border", EVT_TWEAK_L, KM_ANY, 0, 0);
|
||||
|
||||
@@ -2426,7 +2426,7 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf)
|
||||
|
||||
/* settings */
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_enable", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_enable", WKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_disable", WKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
/* settings - specialized hotkeys */
|
||||
|
||||
@@ -67,17 +67,17 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
|
||||
FCurve *fcu;
|
||||
AnimData *adt;
|
||||
|
||||
id= ale->id;
|
||||
id = ale->id;
|
||||
if (!id)
|
||||
return;
|
||||
|
||||
/* tag AnimData for refresh so that other views will update in realtime with these changes */
|
||||
adt= BKE_animdata_from_id(id);
|
||||
adt = BKE_animdata_from_id(id);
|
||||
if (adt)
|
||||
adt->recalc |= ADT_RECALC_ANIM;
|
||||
|
||||
/* update data */
|
||||
fcu= (ale->datatype == ALE_FCURVE)? ale->key_data: NULL;
|
||||
fcu = (ale->datatype == ALE_FCURVE) ? ale->key_data : NULL;
|
||||
|
||||
if (fcu && fcu->rna_path) {
|
||||
/* if we have an fcurve, call the update for the property we
|
||||
@@ -94,7 +94,7 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
|
||||
else {
|
||||
/* in other case we do standard depsgaph update, ideally
|
||||
* we'd be calling property update functions here too ... */
|
||||
DAG_id_tag_update(id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME); // XXX or do we want something more restrictive?
|
||||
DAG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); // XXX or do we want something more restrictive?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,14 +103,14 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
|
||||
void ANIM_id_update(Scene *UNUSED(scene), ID *id)
|
||||
{
|
||||
if (id) {
|
||||
AnimData *adt= BKE_animdata_from_id(id);
|
||||
AnimData *adt = BKE_animdata_from_id(id);
|
||||
|
||||
/* tag AnimData for refresh so that other views will update in realtime with these changes */
|
||||
if (adt)
|
||||
adt->recalc |= ADT_RECALC_ANIM;
|
||||
|
||||
/* set recalc flags */
|
||||
DAG_id_tag_update(id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME); // XXX or do we want something more restrictive?
|
||||
DAG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); // XXX or do we want something more restrictive?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,10 +125,10 @@ void ANIM_id_update(Scene *UNUSED(scene), ID *id)
|
||||
*/
|
||||
|
||||
/* perform syncing updates for Action Groups */
|
||||
static void animchan_sync_group (bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
static void animchan_sync_group(bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
{
|
||||
bActionGroup *agrp= (bActionGroup *)ale->data;
|
||||
ID *owner_id= ale->id;
|
||||
bActionGroup *agrp = (bActionGroup *)ale->data;
|
||||
ID *owner_id = ale->id;
|
||||
|
||||
/* major priority is selection status
|
||||
* so we need both a group and an owner
|
||||
@@ -138,13 +138,13 @@ static void animchan_sync_group (bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
|
||||
/* for standard Objects, check if group is the name of some bone */
|
||||
if (GS(owner_id->name) == ID_OB) {
|
||||
Object *ob= (Object *)owner_id;
|
||||
Object *ob = (Object *)owner_id;
|
||||
|
||||
/* check if there are bones, and whether the name matches any
|
||||
* NOTE: this feature will only really work if groups by default contain the F-Curves for a single bone
|
||||
*/
|
||||
if (ob->pose) {
|
||||
bPoseChannel *pchan= BKE_pose_channel_find_name(ob->pose, agrp->name);
|
||||
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, agrp->name);
|
||||
|
||||
/* if one matches, sync the selection status */
|
||||
if (pchan) {
|
||||
@@ -158,10 +158,10 @@ static void animchan_sync_group (bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
}
|
||||
|
||||
/* perform syncing updates for F-Curves */
|
||||
static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
{
|
||||
FCurve *fcu= (FCurve *)ale->data;
|
||||
ID *owner_id= ale->id;
|
||||
FCurve *fcu = (FCurve *)ale->data;
|
||||
ID *owner_id = ale->id;
|
||||
|
||||
/* major priority is selection status, so refer to the checks done in anim_filter.c
|
||||
* skip_fcurve_selected_data() for reference about what's going on here...
|
||||
@@ -170,7 +170,7 @@ static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
return;
|
||||
|
||||
if (GS(owner_id->name) == ID_OB) {
|
||||
Object *ob= (Object *)owner_id;
|
||||
Object *ob = (Object *)owner_id;
|
||||
|
||||
/* only affect if F-Curve involves pose.bones */
|
||||
if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones")) {
|
||||
@@ -178,8 +178,8 @@ static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
char *bone_name;
|
||||
|
||||
/* get bone-name, and check if this bone is selected */
|
||||
bone_name= BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
|
||||
pchan= BKE_pose_channel_find_name(ob->pose, bone_name);
|
||||
bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
|
||||
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
|
||||
if (bone_name) MEM_freeN(bone_name);
|
||||
|
||||
/* F-Curve selection depends on whether the bone is selected */
|
||||
@@ -196,12 +196,12 @@ static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
|
||||
/* only affect if F-Curve involves sequence_editor.sequences */
|
||||
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
Editing *ed = seq_give_editing(scene, FALSE);
|
||||
Sequence *seq;
|
||||
char *seq_name;
|
||||
|
||||
/* get strip name, and check if this strip is selected */
|
||||
seq_name= BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
|
||||
seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
|
||||
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
|
||||
if (seq_name) MEM_freeN(seq_name);
|
||||
|
||||
@@ -223,7 +223,7 @@ static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale)
|
||||
char *node_name;
|
||||
|
||||
/* get strip name, and check if this strip is selected */
|
||||
node_name= BLI_getQuotedStr(fcu->rna_path, "nodes[");
|
||||
node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
|
||||
node = nodeFindNodebyName(ntree, node_name);
|
||||
if (node_name) MEM_freeN(node_name);
|
||||
|
||||
@@ -254,12 +254,12 @@ void ANIM_sync_animchannels_to_data(const bContext *C)
|
||||
return;
|
||||
|
||||
/* filter data */
|
||||
/* NOTE: we want all channels, since we want to be able to set selection status on some of them even when collapsed */
|
||||
filter= ANIMFILTER_DATA_VISIBLE|ANIMFILTER_LIST_CHANNELS;
|
||||
/* NOTE: we want all channels, since we want to be able to set selection status on some of them even when collapsed */
|
||||
filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* flush settings as appropriate depending on the types of the channels */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
switch (ale->type) {
|
||||
case ANIMTYPE_GROUP:
|
||||
animchan_sync_group(&ac, ale);
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
/* TIME CODE FORMATTING */
|
||||
|
||||
/* Generate timecode/frame number string and store in the supplied string
|
||||
* - buffer: must be at least 13 chars long
|
||||
* - buffer: must be at least 13 chars long
|
||||
* - power: special setting for View2D grid drawing,
|
||||
* used to specify how detailed we need to be
|
||||
* - timecodes: boolean specifying whether timecodes or
|
||||
@@ -66,41 +66,41 @@
|
||||
void ANIM_timecode_string_from_frame(char *str, Scene *scene, int power, short timecodes, float cfra)
|
||||
{
|
||||
if (timecodes) {
|
||||
int hours=0, minutes=0, seconds=0, frames=0;
|
||||
float raw_seconds= cfra;
|
||||
char neg[2]= {'\0'};
|
||||
int hours = 0, minutes = 0, seconds = 0, frames = 0;
|
||||
float raw_seconds = cfra;
|
||||
char neg[2] = {'\0'};
|
||||
|
||||
/* get cframes */
|
||||
if (cfra < 0) {
|
||||
/* correction for negative cfraues */
|
||||
neg[0]= '-';
|
||||
neg[0] = '-';
|
||||
cfra = -cfra;
|
||||
}
|
||||
if (cfra >= 3600) {
|
||||
/* hours */
|
||||
/* XXX should we only display a single digit for hours since clips are
|
||||
* VERY UNLIKELY to be more than 1-2 hours max? However, that would
|
||||
* VERY UNLIKELY to be more than 1-2 hours max? However, that would
|
||||
* go against conventions...
|
||||
*/
|
||||
hours= (int)cfra / 3600;
|
||||
cfra= (float)fmod(cfra, 3600);
|
||||
hours = (int)cfra / 3600;
|
||||
cfra = (float)fmod(cfra, 3600);
|
||||
}
|
||||
if (cfra >= 60) {
|
||||
/* minutes */
|
||||
minutes= (int)cfra / 60;
|
||||
cfra= (float)fmod(cfra, 60);
|
||||
minutes = (int)cfra / 60;
|
||||
cfra = (float)fmod(cfra, 60);
|
||||
}
|
||||
if (power <= 0) {
|
||||
/* seconds + frames
|
||||
* Frames are derived from 'fraction' of second. We need to perform some additional rounding
|
||||
* to cope with 'half' frames, etc., which should be fine in most cases
|
||||
*/
|
||||
seconds= (int)cfra;
|
||||
frames= (int)floor( (((double)cfra - (double)seconds) * FPS) + 0.5 );
|
||||
seconds = (int)cfra;
|
||||
frames = (int)floor( (((double)cfra - (double)seconds) * FPS) + 0.5);
|
||||
}
|
||||
else {
|
||||
/* seconds (with pixel offset rounding) */
|
||||
seconds= (int)floor(cfra + 0.375f);
|
||||
seconds = (int)floor(cfra + 0.375f);
|
||||
}
|
||||
|
||||
switch (U.timecode_style) {
|
||||
@@ -124,7 +124,7 @@ void ANIM_timecode_string_from_frame(char *str, Scene *scene, int power, short t
|
||||
else sprintf(str, "%s%02d:%02d", neg, minutes, seconds);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case USER_TIMECODE_SMPTE_MSF:
|
||||
{
|
||||
@@ -132,27 +132,27 @@ void ANIM_timecode_string_from_frame(char *str, Scene *scene, int power, short t
|
||||
if (hours) sprintf(str, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
|
||||
else sprintf(str, "%s%02d:%02d:%02d", neg, minutes, seconds, frames);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case USER_TIMECODE_MILLISECONDS:
|
||||
{
|
||||
/* reduced SMPTE. Instead of frames, milliseconds are shown */
|
||||
int ms_dp= (power <= 0) ? (1 - power) : 1; /* precision of decimal part */
|
||||
int s_pad= ms_dp+3; /* to get 2 digit whole-number part for seconds display (i.e. 3 is for 2 digits + radix, on top of full length) */
|
||||
int ms_dp = (power <= 0) ? (1 - power) : 1; /* precision of decimal part */
|
||||
int s_pad = ms_dp + 3; /* to get 2 digit whole-number part for seconds display (i.e. 3 is for 2 digits + radix, on top of full length) */
|
||||
|
||||
if (hours) sprintf(str, "%s%02d:%02d:%0*.*f", neg, hours, minutes, s_pad, ms_dp, cfra);
|
||||
else sprintf(str, "%s%02d:%0*.*f", neg, minutes, s_pad, ms_dp, cfra);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case USER_TIMECODE_SECONDS_ONLY:
|
||||
{
|
||||
/* only show the original seconds display */
|
||||
/* round to whole numbers if power is >= 1 (i.e. scale is coarse) */
|
||||
if (power <= 0) sprintf(str, "%.*f", 1-power, raw_seconds);
|
||||
if (power <= 0) sprintf(str, "%.*f", 1 - power, raw_seconds);
|
||||
else sprintf(str, "%d", (int)floor(raw_seconds + 0.375f));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case USER_TIMECODE_SMPTE_FULL:
|
||||
default:
|
||||
@@ -160,12 +160,12 @@ void ANIM_timecode_string_from_frame(char *str, Scene *scene, int power, short t
|
||||
/* full SMPTE format */
|
||||
sprintf(str, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* round to whole numbers if power is >= 1 (i.e. scale is coarse) */
|
||||
if (power <= 0) sprintf(str, "%.*f", 1-power, cfra);
|
||||
if (power <= 0) sprintf(str, "%.*f", 1 - power, cfra);
|
||||
else sprintf(str, "%d", (int)floor(cfra + 0.375f));
|
||||
}
|
||||
}
|
||||
@@ -174,15 +174,15 @@ void ANIM_timecode_string_from_frame(char *str, Scene *scene, int power, short t
|
||||
/* CURRENT FRAME DRAWING */
|
||||
|
||||
/* Draw current frame number in a little green box beside the current frame indicator */
|
||||
static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
|
||||
static void draw_cfra_number(Scene *scene, View2D *v2d, float cfra, short time)
|
||||
{
|
||||
float xscale, yscale, x, y;
|
||||
char numstr[32] = " t"; /* t is the character to start replacing from */
|
||||
char numstr[32] = " t"; /* t is the character to start replacing from */
|
||||
short slen;
|
||||
|
||||
/* because the frame number text is subject to the same scaling as the contents of the view */
|
||||
UI_view2d_getscale(v2d, &xscale, &yscale);
|
||||
glScalef(1.0f/xscale, 1.0f, 1.0f);
|
||||
glScalef(1.0f / xscale, 1.0f, 1.0f);
|
||||
|
||||
/* get timecode string
|
||||
* - padding on str-buf passed so that it doesn't sit on the frame indicator
|
||||
@@ -193,19 +193,19 @@ static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
|
||||
ANIM_timecode_string_from_frame(&numstr[4], scene, 0, time, FRA2TIME(cfra));
|
||||
else
|
||||
ANIM_timecode_string_from_frame(&numstr[4], scene, 1, time, cfra);
|
||||
slen= (short)UI_GetStringWidth(numstr) - 1;
|
||||
slen = (short)UI_GetStringWidth(numstr) - 1;
|
||||
|
||||
/* get starting coordinates for drawing */
|
||||
x= cfra * xscale;
|
||||
y= 18;
|
||||
x = cfra * xscale;
|
||||
y = 18;
|
||||
|
||||
/* draw green box around/behind text */
|
||||
UI_ThemeColorShade(TH_CFRAME, 0);
|
||||
glRectf(x, y, x+slen, y+15);
|
||||
glRectf(x, y, x + slen, y + 15);
|
||||
|
||||
/* draw current frame number - black text */
|
||||
UI_ThemeColor(TH_TEXT);
|
||||
UI_DrawString(x-5, y+3, numstr);
|
||||
UI_DrawString(x - 5, y + 3, numstr);
|
||||
|
||||
/* restore view transform */
|
||||
glScalef(xscale, 1.0, 1.0);
|
||||
@@ -214,11 +214,11 @@ static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
|
||||
/* General call for drawing current frame indicator in animation editor */
|
||||
void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
float vec[2];
|
||||
|
||||
/* Draw a light green line to indicate current frame */
|
||||
vec[0]= (float)(scene->r.cfra * scene->r.framelen);
|
||||
vec[0] = (float)(scene->r.cfra * scene->r.framelen);
|
||||
|
||||
UI_ThemeColor(TH_CFRAME);
|
||||
if (flag & DRAWCFRA_WIDE)
|
||||
@@ -227,11 +227,11 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
|
||||
glLineWidth(2.0);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
vec[1]= v2d->cur.ymin-500.0f; /* XXX arbitrary... want it go to bottom */
|
||||
glVertex2fv(vec);
|
||||
vec[1] = v2d->cur.ymin - 500.0f; /* XXX arbitrary... want it go to bottom */
|
||||
glVertex2fv(vec);
|
||||
|
||||
vec[1]= v2d->cur.ymax;
|
||||
glVertex2fv(vec);
|
||||
vec[1] = v2d->cur.ymax;
|
||||
glVertex2fv(vec);
|
||||
glEnd();
|
||||
|
||||
glLineWidth(1.0);
|
||||
@@ -250,7 +250,7 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
|
||||
/* Draw preview range 'curtains' for highlighting where the animation data is */
|
||||
void ANIM_draw_previewrange(const bContext *C, View2D *v2d)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
/* only draw this if preview range is set */
|
||||
if (PRVRANGEON) {
|
||||
@@ -298,16 +298,16 @@ AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale)
|
||||
static short bezt_nlamapping_restore(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
/* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */
|
||||
AnimData *adt= (AnimData *)ked->data;
|
||||
short only_keys= (short)ked->i1;
|
||||
AnimData *adt = (AnimData *)ked->data;
|
||||
short only_keys = (short)ked->i1;
|
||||
|
||||
/* adjust BezTriple handles only if allowed to */
|
||||
if (only_keys == 0) {
|
||||
bezt->vec[0][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], NLATIME_CONVERT_UNMAP);
|
||||
bezt->vec[2][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], NLATIME_CONVERT_UNMAP);
|
||||
bezt->vec[0][0] = BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], NLATIME_CONVERT_UNMAP);
|
||||
bezt->vec[2][0] = BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], NLATIME_CONVERT_UNMAP);
|
||||
}
|
||||
|
||||
bezt->vec[1][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_UNMAP);
|
||||
bezt->vec[1][0] = BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_UNMAP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -316,16 +316,16 @@ static short bezt_nlamapping_restore(KeyframeEditData *ked, BezTriple *bezt)
|
||||
static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
/* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */
|
||||
AnimData *adt= (AnimData*)ked->data;
|
||||
short only_keys= (short)ked->i1;
|
||||
AnimData *adt = (AnimData *)ked->data;
|
||||
short only_keys = (short)ked->i1;
|
||||
|
||||
/* adjust BezTriple handles only if allowed to */
|
||||
if (only_keys == 0) {
|
||||
bezt->vec[0][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], NLATIME_CONVERT_MAP);
|
||||
bezt->vec[2][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], NLATIME_CONVERT_MAP);
|
||||
bezt->vec[0][0] = BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], NLATIME_CONVERT_MAP);
|
||||
bezt->vec[2][0] = BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], NLATIME_CONVERT_MAP);
|
||||
}
|
||||
|
||||
bezt->vec[1][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_MAP);
|
||||
bezt->vec[1][0] = BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_MAP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -333,25 +333,25 @@ static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
|
||||
|
||||
/* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve
|
||||
* - restore = whether to map points back to non-mapped time
|
||||
* - only_keys = whether to only adjust the location of the center point of beztriples
|
||||
* - only_keys = whether to only adjust the location of the center point of beztriples
|
||||
*/
|
||||
void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, short restore, short only_keys)
|
||||
{
|
||||
KeyframeEditData ked= {{NULL}};
|
||||
KeyframeEditData ked = {{NULL}};
|
||||
KeyframeEditFunc map_cb;
|
||||
|
||||
/* init edit data
|
||||
* - AnimData is stored in 'data'
|
||||
* - only_keys is stored in 'i1'
|
||||
*/
|
||||
ked.data= (void *)adt;
|
||||
ked.i1= (int)only_keys;
|
||||
ked.data = (void *)adt;
|
||||
ked.i1 = (int)only_keys;
|
||||
|
||||
/* get editing callback */
|
||||
if (restore)
|
||||
map_cb= bezt_nlamapping_restore;
|
||||
map_cb = bezt_nlamapping_restore;
|
||||
else
|
||||
map_cb= bezt_nlamapping_apply;
|
||||
map_cb = bezt_nlamapping_apply;
|
||||
|
||||
/* apply to F-Curve */
|
||||
ANIM_fcurve_keyframes_loop(&ked, fcu, NULL, map_cb, NULL);
|
||||
@@ -376,9 +376,9 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest
|
||||
/* if the radians flag is not set, default to using degrees which need conversions */
|
||||
if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) {
|
||||
if (restore)
|
||||
return DEG2RADF(1.0f); /* degrees to radians */
|
||||
return DEG2RADF(1.0f); /* degrees to radians */
|
||||
else
|
||||
return RAD2DEGF(1.0f); /* radians to degrees */
|
||||
return RAD2DEGF(1.0f); /* radians to degrees */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,18 +393,18 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest
|
||||
/* ----------------------- */
|
||||
|
||||
/* helper function for ANIM_unit_mapping_apply_fcurve -> mapping callback for unit mapping */
|
||||
static short bezt_unit_mapping_apply (KeyframeEditData *ked, BezTriple *bezt)
|
||||
static short bezt_unit_mapping_apply(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
/* mapping factor is stored in f1, flags are stored in i1 */
|
||||
short only_keys= (ked->i1 & ANIM_UNITCONV_ONLYKEYS);
|
||||
short sel_vs= (ked->i1 & ANIM_UNITCONV_SELVERTS);
|
||||
float fac= ked->f1;
|
||||
short only_keys = (ked->i1 & ANIM_UNITCONV_ONLYKEYS);
|
||||
short sel_vs = (ked->i1 & ANIM_UNITCONV_SELVERTS);
|
||||
float fac = ked->f1;
|
||||
|
||||
/* adjust BezTriple handles only if allowed to */
|
||||
if (only_keys == 0) {
|
||||
if ((sel_vs==0) || (bezt->f1 & SELECT))
|
||||
if ((sel_vs == 0) || (bezt->f1 & SELECT))
|
||||
bezt->vec[0][1] *= fac;
|
||||
if ((sel_vs==0) || (bezt->f3 & SELECT))
|
||||
if ((sel_vs == 0) || (bezt->f3 & SELECT))
|
||||
bezt->vec[2][1] *= fac;
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ void ANIM_unit_mapping_apply_fcurve(Scene *scene, ID *id, FCurve *fcu, short fla
|
||||
if (G.rendering) return;
|
||||
|
||||
/* calculate mapping factor, and abort if nothing to change */
|
||||
fac= ANIM_unit_mapping_get_factor(scene, id, fcu, (flag & ANIM_UNITCONV_RESTORE));
|
||||
fac = ANIM_unit_mapping_get_factor(scene, id, fcu, (flag & ANIM_UNITCONV_RESTORE));
|
||||
if (fac == 1.0f)
|
||||
return;
|
||||
|
||||
@@ -434,14 +434,14 @@ void ANIM_unit_mapping_apply_fcurve(Scene *scene, ID *id, FCurve *fcu, short fla
|
||||
* - flags are stored in 'i1'
|
||||
*/
|
||||
memset(&ked, 0, sizeof(KeyframeEditData));
|
||||
ked.f1= (float)fac;
|
||||
ked.i1= (int)flag;
|
||||
ked.f1 = (float)fac;
|
||||
ked.i1 = (int)flag;
|
||||
|
||||
/* only selected? */
|
||||
if (flag & ANIM_UNITCONV_ONLYSEL)
|
||||
sel_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
|
||||
sel_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
|
||||
else
|
||||
sel_cb= NULL;
|
||||
sel_cb = NULL;
|
||||
|
||||
/* apply to F-Curve */
|
||||
ANIM_fcurve_keyframes_loop(&ked, fcu, sel_cb, bezt_unit_mapping_apply, NULL);
|
||||
@@ -452,7 +452,7 @@ void ANIM_unit_mapping_apply_fcurve(Scene *scene, ID *id, FCurve *fcu, short fla
|
||||
FPoint *fpt;
|
||||
unsigned int i;
|
||||
|
||||
for (i=0, fpt=fcu->fpt; i < fcu->totvert; i++, fpt++) {
|
||||
for (i = 0, fpt = fcu->fpt; i < fcu->totvert; i++, fpt++) {
|
||||
/* apply unit mapping */
|
||||
fpt->vec[1] *= fac;
|
||||
}
|
||||
|
||||
@@ -99,9 +99,9 @@
|
||||
|
||||
/* Get shapekey data being edited (for Action Editor -> ShapeKey mode) */
|
||||
/* Note: there's a similar function in key.c (ob_get_key) */
|
||||
static Key *actedit_get_shapekeys (bAnimContext *ac)
|
||||
static Key *actedit_get_shapekeys(bAnimContext *ac)
|
||||
{
|
||||
Scene *scene= ac->scene;
|
||||
Scene *scene = ac->scene;
|
||||
Object *ob;
|
||||
Key *key;
|
||||
|
||||
@@ -113,7 +113,7 @@ static Key *actedit_get_shapekeys (bAnimContext *ac)
|
||||
//if (saction->pin) return NULL;
|
||||
|
||||
/* shapekey data is stored with geometry data */
|
||||
key= ob_get_key(ob);
|
||||
key = ob_get_key(ob);
|
||||
|
||||
if (key) {
|
||||
if (key->type == KEY_RELATIVE)
|
||||
@@ -124,7 +124,7 @@ static Key *actedit_get_shapekeys (bAnimContext *ac)
|
||||
}
|
||||
|
||||
/* Get data being edited in Action Editor (depending on current 'mode') */
|
||||
static short actedit_get_context (bAnimContext *ac, SpaceAction *saction)
|
||||
static short actedit_get_context(bAnimContext *ac, SpaceAction *saction)
|
||||
{
|
||||
/* get dopesheet */
|
||||
ac->ads = &saction->ads;
|
||||
@@ -133,25 +133,25 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction)
|
||||
switch (saction->mode) {
|
||||
case SACTCONT_ACTION: /* 'Action Editor' */
|
||||
/* if not pinned, sync with active object */
|
||||
if (/*saction->pin == 0*/1) {
|
||||
if (/*saction->pin == 0*/ 1) {
|
||||
if (ac->obact && ac->obact->adt)
|
||||
saction->action = ac->obact->adt->action;
|
||||
else
|
||||
saction->action = NULL;
|
||||
}
|
||||
|
||||
ac->datatype= ANIMCONT_ACTION;
|
||||
ac->data= saction->action;
|
||||
ac->datatype = ANIMCONT_ACTION;
|
||||
ac->data = saction->action;
|
||||
|
||||
ac->mode= saction->mode;
|
||||
ac->mode = saction->mode;
|
||||
return 1;
|
||||
|
||||
case SACTCONT_SHAPEKEY: /* 'ShapeKey Editor' */
|
||||
ac->datatype= ANIMCONT_SHAPEKEY;
|
||||
ac->data= actedit_get_shapekeys(ac);
|
||||
ac->datatype = ANIMCONT_SHAPEKEY;
|
||||
ac->data = actedit_get_shapekeys(ac);
|
||||
|
||||
/* if not pinned, sync with active object */
|
||||
if (/*saction->pin == 0*/1) {
|
||||
if (/*saction->pin == 0*/ 1) {
|
||||
Key *key = (Key *)ac->data;
|
||||
|
||||
if (key && key->adt)
|
||||
@@ -160,34 +160,34 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction)
|
||||
saction->action = NULL;
|
||||
}
|
||||
|
||||
ac->mode= saction->mode;
|
||||
ac->mode = saction->mode;
|
||||
return 1;
|
||||
|
||||
case SACTCONT_GPENCIL: /* Grease Pencil */ // XXX review how this mode is handled...
|
||||
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
|
||||
saction->ads.source= (ID *)ac->scene;
|
||||
saction->ads.source = (ID *)ac->scene;
|
||||
|
||||
ac->datatype= ANIMCONT_GPENCIL;
|
||||
ac->data= &saction->ads;
|
||||
ac->datatype = ANIMCONT_GPENCIL;
|
||||
ac->data = &saction->ads;
|
||||
|
||||
ac->mode= saction->mode;
|
||||
ac->mode = saction->mode;
|
||||
return 1;
|
||||
|
||||
case SACTCONT_DOPESHEET: /* DopeSheet */
|
||||
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
|
||||
saction->ads.source= (ID *)ac->scene;
|
||||
saction->ads.source = (ID *)ac->scene;
|
||||
|
||||
ac->datatype= ANIMCONT_DOPESHEET;
|
||||
ac->data= &saction->ads;
|
||||
ac->datatype = ANIMCONT_DOPESHEET;
|
||||
ac->data = &saction->ads;
|
||||
|
||||
ac->mode= saction->mode;
|
||||
ac->mode = saction->mode;
|
||||
return 1;
|
||||
|
||||
default: /* unhandled yet */
|
||||
ac->datatype= ANIMCONT_NONE;
|
||||
ac->data= NULL;
|
||||
ac->datatype = ANIMCONT_NONE;
|
||||
ac->data = NULL;
|
||||
|
||||
ac->mode= -1;
|
||||
ac->mode = -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -195,12 +195,12 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction)
|
||||
/* ----------- Private Stuff - Graph Editor ------------- */
|
||||
|
||||
/* Get data being edited in Graph Editor (depending on current 'mode') */
|
||||
static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
|
||||
static short graphedit_get_context(bAnimContext *ac, SpaceIpo *sipo)
|
||||
{
|
||||
/* init dopesheet data if non-existant (i.e. for old files) */
|
||||
if (sipo->ads == NULL) {
|
||||
sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
|
||||
sipo->ads->source= (ID *)ac->scene;
|
||||
sipo->ads = MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
|
||||
sipo->ads->source = (ID *)ac->scene;
|
||||
}
|
||||
ac->ads = sipo->ads;
|
||||
|
||||
@@ -212,33 +212,33 @@ static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
|
||||
|
||||
/* sync settings with current view status, then return appropriate data */
|
||||
switch (sipo->mode) {
|
||||
case SIPO_MODE_ANIMATION: /* Animation F-Curve Editor */
|
||||
case SIPO_MODE_ANIMATION: /* Animation F-Curve Editor */
|
||||
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
|
||||
sipo->ads->source= (ID *)ac->scene;
|
||||
sipo->ads->source = (ID *)ac->scene;
|
||||
sipo->ads->filterflag &= ~ADS_FILTER_ONLYDRIVERS;
|
||||
|
||||
ac->datatype= ANIMCONT_FCURVES;
|
||||
ac->data= sipo->ads;
|
||||
ac->datatype = ANIMCONT_FCURVES;
|
||||
ac->data = sipo->ads;
|
||||
|
||||
ac->mode= sipo->mode;
|
||||
ac->mode = sipo->mode;
|
||||
return 1;
|
||||
|
||||
case SIPO_MODE_DRIVERS: /* Driver F-Curve Editor */
|
||||
case SIPO_MODE_DRIVERS: /* Driver F-Curve Editor */
|
||||
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
|
||||
sipo->ads->source= (ID *)ac->scene;
|
||||
sipo->ads->source = (ID *)ac->scene;
|
||||
sipo->ads->filterflag |= ADS_FILTER_ONLYDRIVERS;
|
||||
|
||||
ac->datatype= ANIMCONT_DRIVERS;
|
||||
ac->data= sipo->ads;
|
||||
ac->datatype = ANIMCONT_DRIVERS;
|
||||
ac->data = sipo->ads;
|
||||
|
||||
ac->mode= sipo->mode;
|
||||
ac->mode = sipo->mode;
|
||||
return 1;
|
||||
|
||||
default: /* unhandled yet */
|
||||
ac->datatype= ANIMCONT_NONE;
|
||||
ac->data= NULL;
|
||||
ac->datatype = ANIMCONT_NONE;
|
||||
ac->data = NULL;
|
||||
|
||||
ac->mode= -1;
|
||||
ac->mode = -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -246,20 +246,20 @@ static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
|
||||
/* ----------- Private Stuff - NLA Editor ------------- */
|
||||
|
||||
/* Get data being edited in Graph Editor (depending on current 'mode') */
|
||||
static short nlaedit_get_context (bAnimContext *ac, SpaceNla *snla)
|
||||
static short nlaedit_get_context(bAnimContext *ac, SpaceNla *snla)
|
||||
{
|
||||
/* 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 = MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet");
|
||||
ac->ads = snla->ads;
|
||||
|
||||
/* sync settings with current view status, then return appropriate data */
|
||||
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
|
||||
snla->ads->source= (ID *)ac->scene;
|
||||
snla->ads->source = (ID *)ac->scene;
|
||||
snla->ads->filterflag |= ADS_FILTER_ONLYNLA;
|
||||
|
||||
ac->datatype= ANIMCONT_NLA;
|
||||
ac->data= snla->ads;
|
||||
ac->datatype = ANIMCONT_NLA;
|
||||
ac->data = snla->ads;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -273,31 +273,31 @@ static short nlaedit_get_context (bAnimContext *ac, SpaceNla *snla)
|
||||
short ANIM_animdata_context_getdata(bAnimContext *ac)
|
||||
{
|
||||
SpaceLink *sl = ac->sl;
|
||||
short ok= 0;
|
||||
short ok = 0;
|
||||
|
||||
/* context depends on editor we are currently in */
|
||||
if (sl) {
|
||||
switch (ac->spacetype) {
|
||||
case SPACE_ACTION:
|
||||
{
|
||||
SpaceAction *saction= (SpaceAction *)sl;
|
||||
ok= actedit_get_context(ac, saction);
|
||||
SpaceAction *saction = (SpaceAction *)sl;
|
||||
ok = actedit_get_context(ac, saction);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPACE_IPO:
|
||||
{
|
||||
SpaceIpo *sipo= (SpaceIpo *)sl;
|
||||
ok= graphedit_get_context(ac, sipo);
|
||||
SpaceIpo *sipo = (SpaceIpo *)sl;
|
||||
ok = graphedit_get_context(ac, sipo);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SPACE_NLA:
|
||||
{
|
||||
SpaceNla *snla= (SpaceNla *)sl;
|
||||
ok= nlaedit_get_context(ac, snla);
|
||||
SpaceNla *snla = (SpaceNla *)sl;
|
||||
ok = nlaedit_get_context(ac, snla);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,26 +315,26 @@ short ANIM_animdata_context_getdata(bAnimContext *ac)
|
||||
*/
|
||||
short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceLink *sl= CTX_wm_space_data(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
SpaceLink *sl = CTX_wm_space_data(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
/* clear old context info */
|
||||
if (ac == NULL) return 0;
|
||||
memset(ac, 0, sizeof(bAnimContext));
|
||||
|
||||
/* get useful default context settings from context */
|
||||
ac->scene= scene;
|
||||
ac->scene = scene;
|
||||
if (scene) {
|
||||
ac->markers= ED_context_get_markers(C);
|
||||
ac->obact= (scene->basact)? scene->basact->object : NULL;
|
||||
ac->markers = ED_context_get_markers(C);
|
||||
ac->obact = (scene->basact) ? scene->basact->object : NULL;
|
||||
}
|
||||
ac->sa= sa;
|
||||
ac->ar= ar;
|
||||
ac->sl= sl;
|
||||
ac->spacetype= (sa) ? sa->spacetype : 0;
|
||||
ac->regiontype= (ar) ? ar->regiontype : 0;
|
||||
ac->sa = sa;
|
||||
ac->ar = ar;
|
||||
ac->sl = sl;
|
||||
ac->spacetype = (sa) ? sa->spacetype : 0;
|
||||
ac->regiontype = (ar) ? ar->regiontype : 0;
|
||||
|
||||
/* get data context info */
|
||||
return ANIM_animdata_context_getdata(ac);
|
||||
@@ -355,28 +355,28 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
* dealt with by the recursive detection idiom in place.
|
||||
*
|
||||
* Implementation Note:
|
||||
* YES the _doSubChannels variable is NOT read anywhere. BUT, this is NOT an excuse
|
||||
* to go steamrolling the logic into a single-line expression as from experience,
|
||||
* those are notoriously difficult to read + debug when extending later on. The code
|
||||
* below is purposefully laid out so that each case noted above corresponds clearly to
|
||||
* one case below.
|
||||
* YES the _doSubChannels variable is NOT read anywhere. BUT, this is NOT an excuse
|
||||
* to go steamrolling the logic into a single-line expression as from experience,
|
||||
* those are notoriously difficult to read + debug when extending later on. The code
|
||||
* below is purposefully laid out so that each case noted above corresponds clearly to
|
||||
* one case below.
|
||||
*/
|
||||
#define BEGIN_ANIMFILTER_SUBCHANNELS(expanded_check) \
|
||||
{ \
|
||||
int _filter = filter_mode; \
|
||||
short _doSubChannels = 0; \
|
||||
if (!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check)) \
|
||||
_doSubChannels=1; \
|
||||
_doSubChannels = 1; \
|
||||
else if (!(filter_mode & ANIMFILTER_LIST_CHANNELS)) \
|
||||
_doSubChannels=2; \
|
||||
else {\
|
||||
_doSubChannels = 2; \
|
||||
else { \
|
||||
filter_mode |= ANIMFILTER_TMP_PEEK; \
|
||||
} \
|
||||
\
|
||||
\
|
||||
{ \
|
||||
(void) _doSubChannels; \
|
||||
}
|
||||
/* ... standard sub-channel filtering can go on here now ... */
|
||||
/* ... standard sub-channel filtering can go on here now ... */
|
||||
#define END_ANIMFILTER_SUBCHANNELS \
|
||||
filter_mode = _filter; \
|
||||
}
|
||||
@@ -402,9 +402,9 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
* - ListBase anim_data;
|
||||
* - bDopeSheet *ads;
|
||||
* - bAnimListElem *ale;
|
||||
* - size_t items;
|
||||
* - size_t items;
|
||||
*
|
||||
* - id: ID block which should have an AnimData pointer following it immediately, to use
|
||||
* - id: ID block which should have an AnimData pointer following it immediately, to use
|
||||
* - adtOk: line or block of code to execute for AnimData-blocks case (usually ANIMDATA_ADD_ANIMDATA)
|
||||
* - nlaOk: line or block of code to execute for NLA tracks+strips case
|
||||
* - driversOk: line or block of code to execute for Drivers case
|
||||
@@ -421,32 +421,32 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
* 4) normal keyframes: only when there is an active action
|
||||
*/
|
||||
#define ANIMDATA_FILTER_CASES(id, adtOk, nlaOk, driversOk, keysOk) \
|
||||
{\
|
||||
if ((id)->adt) {\
|
||||
if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !((id)->adt->flag & ADT_CURVES_NOT_VISIBLE)) {\
|
||||
if (filter_mode & ANIMFILTER_ANIMDATA) {\
|
||||
adtOk\
|
||||
}\
|
||||
else if (ads->filterflag & ADS_FILTER_ONLYNLA) {\
|
||||
if (ANIMDATA_HAS_NLA(id)) {\
|
||||
nlaOk\
|
||||
}\
|
||||
else if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) && ANIMDATA_HAS_KEYS(id)) {\
|
||||
nlaOk\
|
||||
}\
|
||||
}\
|
||||
else if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {\
|
||||
if (ANIMDATA_HAS_DRIVERS(id)) {\
|
||||
driversOk\
|
||||
}\
|
||||
}\
|
||||
else {\
|
||||
if (ANIMDATA_HAS_KEYS(id)) {\
|
||||
keysOk\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
{ \
|
||||
if ((id)->adt) { \
|
||||
if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !((id)->adt->flag & ADT_CURVES_NOT_VISIBLE)) { \
|
||||
if (filter_mode & ANIMFILTER_ANIMDATA) { \
|
||||
adtOk \
|
||||
} \
|
||||
else if (ads->filterflag & ADS_FILTER_ONLYNLA) { \
|
||||
if (ANIMDATA_HAS_NLA(id)) { \
|
||||
nlaOk \
|
||||
} \
|
||||
else if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) && ANIMDATA_HAS_KEYS(id)) { \
|
||||
nlaOk \
|
||||
} \
|
||||
} \
|
||||
else if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) { \
|
||||
if (ANIMDATA_HAS_DRIVERS(id)) { \
|
||||
driversOk \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
if (ANIMDATA_HAS_KEYS(id)) { \
|
||||
keysOk \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/* ............................... */
|
||||
@@ -461,10 +461,10 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
if (filter_mode & ANIMFILTER_TMP_PEEK) \
|
||||
return 1; \
|
||||
else { \
|
||||
bAnimListElem *ale= make_new_animlistelem(channel_data, channel_type, (ID *)owner_id); \
|
||||
if (ale) {\
|
||||
bAnimListElem *ale = make_new_animlistelem(channel_data, channel_type, (ID *)owner_id); \
|
||||
if (ale) { \
|
||||
BLI_addtail(anim_data, ale); \
|
||||
items++; \
|
||||
items ++; \
|
||||
ale_statement \
|
||||
} \
|
||||
}
|
||||
@@ -476,13 +476,13 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
|
||||
/* quick macro to test if an anim-channel representing an AnimData block is suitably active */
|
||||
#define ANIMCHANNEL_ACTIVEOK(ale) \
|
||||
( !(filter_mode & ANIMFILTER_ACTIVE) || !(ale->adt) || (ale->adt->flag & ADT_UI_ACTIVE) )
|
||||
(!(filter_mode & ANIMFILTER_ACTIVE) || !(ale->adt) || (ale->adt->flag & ADT_UI_ACTIVE) )
|
||||
|
||||
/* quick macro to test if an anim-channel (F-Curve, Group, etc.) is selected in an acceptable way */
|
||||
#define ANIMCHANNEL_SELOK(test_func) \
|
||||
( !(filter_mode & (ANIMFILTER_SEL|ANIMFILTER_UNSEL)) || \
|
||||
((filter_mode & ANIMFILTER_SEL) && test_func) || \
|
||||
((filter_mode & ANIMFILTER_UNSEL) && test_func==0) )
|
||||
(!(filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) || \
|
||||
((filter_mode & ANIMFILTER_SEL) && test_func) || \
|
||||
((filter_mode & ANIMFILTER_UNSEL) && test_func == 0) )
|
||||
|
||||
/* quick macro to test if an anim-channel (F-Curve) is selected ok for editing purposes
|
||||
* - _SELEDIT means that only selected curves will have visible+editable keyframes
|
||||
@@ -493,29 +493,29 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
* 3) test_func (i.e. selection test) - only if selected, this test will pass
|
||||
*/
|
||||
#define ANIMCHANNEL_SELEDITOK(test_func) \
|
||||
( !(filter_mode & ANIMFILTER_SELEDIT) || \
|
||||
!(filter_mode & ANIMFILTER_FOREDIT) || \
|
||||
(test_func) )
|
||||
(!(filter_mode & ANIMFILTER_SELEDIT) || \
|
||||
!(filter_mode & ANIMFILTER_FOREDIT) || \
|
||||
(test_func) )
|
||||
|
||||
/* ----------- 'Private' Stuff --------------- */
|
||||
|
||||
/* this function allocates memory for a new bAnimListElem struct for the
|
||||
* provided animation channel-data.
|
||||
*/
|
||||
static bAnimListElem *make_new_animlistelem (void *data, short datatype, ID *owner_id)
|
||||
static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owner_id)
|
||||
{
|
||||
bAnimListElem *ale= NULL;
|
||||
bAnimListElem *ale = NULL;
|
||||
|
||||
/* only allocate memory if there is data to convert */
|
||||
if (data) {
|
||||
/* allocate and set generic data */
|
||||
ale= MEM_callocN(sizeof(bAnimListElem), "bAnimListElem");
|
||||
ale = MEM_callocN(sizeof(bAnimListElem), "bAnimListElem");
|
||||
|
||||
ale->data= data;
|
||||
ale->type= datatype;
|
||||
ale->data = data;
|
||||
ale->type = datatype;
|
||||
|
||||
ale->id= owner_id;
|
||||
ale->adt= BKE_animdata_from_id(owner_id);
|
||||
ale->id = owner_id;
|
||||
ale->adt = BKE_animdata_from_id(owner_id);
|
||||
|
||||
/* do specifics */
|
||||
switch (datatype) {
|
||||
@@ -524,307 +524,307 @@ static bAnimListElem *make_new_animlistelem (void *data, short datatype, ID *own
|
||||
/* nothing to include for now... this is just a dummy wrappy around all the other channels
|
||||
* in the DopeSheet, and gets included at the start of the list
|
||||
*/
|
||||
ale->key_data= NULL;
|
||||
ale->datatype= ALE_ALL;
|
||||
ale->key_data = NULL;
|
||||
ale->datatype = ALE_ALL;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_SCENE:
|
||||
{
|
||||
Scene *sce= (Scene *)data;
|
||||
Scene *sce = (Scene *)data;
|
||||
|
||||
ale->flag= sce->flag;
|
||||
ale->flag = sce->flag;
|
||||
|
||||
ale->key_data= sce;
|
||||
ale->datatype= ALE_SCE;
|
||||
ale->key_data = sce;
|
||||
ale->datatype = ALE_SCE;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_OBJECT:
|
||||
{
|
||||
Base *base= (Base *)data;
|
||||
Object *ob= base->object;
|
||||
Base *base = (Base *)data;
|
||||
Object *ob = base->object;
|
||||
|
||||
ale->flag= ob->flag;
|
||||
ale->flag = ob->flag;
|
||||
|
||||
ale->key_data= ob;
|
||||
ale->datatype= ALE_OB;
|
||||
ale->key_data = ob;
|
||||
ale->datatype = ALE_OB;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(&ob->id);
|
||||
ale->adt = BKE_animdata_from_id(&ob->id);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_FILLACTD:
|
||||
{
|
||||
bAction *act= (bAction *)data;
|
||||
bAction *act = (bAction *)data;
|
||||
|
||||
ale->flag= act->flag;
|
||||
ale->flag = act->flag;
|
||||
|
||||
ale->key_data= act;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = act;
|
||||
ale->datatype = ALE_ACT;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_FILLDRIVERS:
|
||||
{
|
||||
AnimData *adt= (AnimData *)data;
|
||||
AnimData *adt = (AnimData *)data;
|
||||
|
||||
ale->flag= adt->flag;
|
||||
ale->flag = adt->flag;
|
||||
|
||||
// XXX... drivers don't show summary for now
|
||||
ale->key_data= NULL;
|
||||
ale->datatype= ALE_NONE;
|
||||
// XXX... drivers don't show summary for now
|
||||
ale->key_data = NULL;
|
||||
ale->datatype = ALE_NONE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_DSMAT:
|
||||
{
|
||||
Material *ma= (Material *)data;
|
||||
AnimData *adt= ma->adt;
|
||||
Material *ma = (Material *)data;
|
||||
AnimData *adt = ma->adt;
|
||||
|
||||
ale->flag= FILTER_MAT_OBJD(ma);
|
||||
ale->flag = FILTER_MAT_OBJD(ma);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSLAM:
|
||||
{
|
||||
Lamp *la= (Lamp *)data;
|
||||
AnimData *adt= la->adt;
|
||||
Lamp *la = (Lamp *)data;
|
||||
AnimData *adt = la->adt;
|
||||
|
||||
ale->flag= FILTER_LAM_OBJD(la);
|
||||
ale->flag = FILTER_LAM_OBJD(la);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSCAM:
|
||||
{
|
||||
Camera *ca= (Camera *)data;
|
||||
AnimData *adt= ca->adt;
|
||||
Camera *ca = (Camera *)data;
|
||||
AnimData *adt = ca->adt;
|
||||
|
||||
ale->flag= FILTER_CAM_OBJD(ca);
|
||||
ale->flag = FILTER_CAM_OBJD(ca);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSCUR:
|
||||
{
|
||||
Curve *cu= (Curve *)data;
|
||||
AnimData *adt= cu->adt;
|
||||
Curve *cu = (Curve *)data;
|
||||
AnimData *adt = cu->adt;
|
||||
|
||||
ale->flag= FILTER_CUR_OBJD(cu);
|
||||
ale->flag = FILTER_CUR_OBJD(cu);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSARM:
|
||||
{
|
||||
bArmature *arm= (bArmature *)data;
|
||||
AnimData *adt= arm->adt;
|
||||
bArmature *arm = (bArmature *)data;
|
||||
AnimData *adt = arm->adt;
|
||||
|
||||
ale->flag= FILTER_ARM_OBJD(arm);
|
||||
ale->flag = FILTER_ARM_OBJD(arm);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSMESH:
|
||||
{
|
||||
Mesh *me= (Mesh *)data;
|
||||
AnimData *adt= me->adt;
|
||||
Mesh *me = (Mesh *)data;
|
||||
AnimData *adt = me->adt;
|
||||
|
||||
ale->flag= FILTER_MESH_OBJD(me);
|
||||
ale->flag = FILTER_MESH_OBJD(me);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSLAT:
|
||||
{
|
||||
Lattice *lt= (Lattice *)data;
|
||||
AnimData *adt= lt->adt;
|
||||
Lattice *lt = (Lattice *)data;
|
||||
AnimData *adt = lt->adt;
|
||||
|
||||
ale->flag= FILTER_LATTICE_OBJD(lt);
|
||||
ale->flag = FILTER_LATTICE_OBJD(lt);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSSPK:
|
||||
{
|
||||
Speaker *spk= (Speaker *)data;
|
||||
AnimData *adt= spk->adt;
|
||||
Speaker *spk = (Speaker *)data;
|
||||
AnimData *adt = spk->adt;
|
||||
|
||||
ale->flag= FILTER_SPK_OBJD(spk);
|
||||
ale->flag = FILTER_SPK_OBJD(spk);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSSKEY:
|
||||
{
|
||||
Key *key= (Key *)data;
|
||||
AnimData *adt= key->adt;
|
||||
Key *key = (Key *)data;
|
||||
AnimData *adt = key->adt;
|
||||
|
||||
ale->flag= FILTER_SKE_OBJD(key);
|
||||
ale->flag = FILTER_SKE_OBJD(key);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSWOR:
|
||||
{
|
||||
World *wo= (World *)data;
|
||||
AnimData *adt= wo->adt;
|
||||
World *wo = (World *)data;
|
||||
AnimData *adt = wo->adt;
|
||||
|
||||
ale->flag= FILTER_WOR_SCED(wo);
|
||||
ale->flag = FILTER_WOR_SCED(wo);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSNTREE:
|
||||
{
|
||||
bNodeTree *ntree= (bNodeTree *)data;
|
||||
AnimData *adt= ntree->adt;
|
||||
bNodeTree *ntree = (bNodeTree *)data;
|
||||
AnimData *adt = ntree->adt;
|
||||
|
||||
ale->flag= FILTER_NTREE_DATA(ntree);
|
||||
ale->flag = FILTER_NTREE_DATA(ntree);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSPART:
|
||||
{
|
||||
ParticleSettings *part= (ParticleSettings*)ale->data;
|
||||
AnimData *adt= part->adt;
|
||||
ParticleSettings *part = (ParticleSettings *)ale->data;
|
||||
AnimData *adt = part->adt;
|
||||
|
||||
ale->flag= FILTER_PART_OBJD(part);
|
||||
ale->flag = FILTER_PART_OBJD(part);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_DSTEX:
|
||||
{
|
||||
Tex *tex= (Tex *)data;
|
||||
AnimData *adt= tex->adt;
|
||||
Tex *tex = (Tex *)data;
|
||||
AnimData *adt = tex->adt;
|
||||
|
||||
ale->flag= FILTER_TEX_DATA(tex);
|
||||
ale->flag = FILTER_TEX_DATA(tex);
|
||||
|
||||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
ale->key_data = (adt) ? adt->action : NULL;
|
||||
ale->datatype = ALE_ACT;
|
||||
|
||||
ale->adt= BKE_animdata_from_id(data);
|
||||
ale->adt = BKE_animdata_from_id(data);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_GROUP:
|
||||
{
|
||||
bActionGroup *agrp= (bActionGroup *)data;
|
||||
bActionGroup *agrp = (bActionGroup *)data;
|
||||
|
||||
ale->flag= agrp->flag;
|
||||
ale->flag = agrp->flag;
|
||||
|
||||
ale->key_data= NULL;
|
||||
ale->datatype= ALE_GROUP;
|
||||
ale->key_data = NULL;
|
||||
ale->datatype = ALE_GROUP;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_FCURVE:
|
||||
{
|
||||
FCurve *fcu= (FCurve *)data;
|
||||
FCurve *fcu = (FCurve *)data;
|
||||
|
||||
ale->flag= fcu->flag;
|
||||
ale->flag = fcu->flag;
|
||||
|
||||
ale->key_data= fcu;
|
||||
ale->datatype= ALE_FCURVE;
|
||||
ale->key_data = fcu;
|
||||
ale->datatype = ALE_FCURVE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_SHAPEKEY:
|
||||
{
|
||||
KeyBlock *kb= (KeyBlock *)data;
|
||||
Key *key= (Key *)ale->id;
|
||||
KeyBlock *kb = (KeyBlock *)data;
|
||||
Key *key = (Key *)ale->id;
|
||||
|
||||
ale->flag= kb->flag;
|
||||
ale->flag = kb->flag;
|
||||
|
||||
/* whether we have keyframes depends on whether there is a Key block to find it from */
|
||||
if (key) {
|
||||
/* index of shapekey is defined by place in key's list */
|
||||
ale->index= BLI_findindex(&key->block, kb);
|
||||
ale->index = BLI_findindex(&key->block, kb);
|
||||
|
||||
/* the corresponding keyframes are from the animdata */
|
||||
if (ale->adt && ale->adt->action) {
|
||||
bAction *act= ale->adt->action;
|
||||
bAction *act = ale->adt->action;
|
||||
char *rna_path = key_get_curValue_rnaPath(key, kb);
|
||||
|
||||
/* try to find the F-Curve which corresponds to this exactly,
|
||||
* then free the MEM_alloc'd string
|
||||
*/
|
||||
if (rna_path) {
|
||||
ale->key_data= (void *)list_find_fcurve(&act->curves, rna_path, 0);
|
||||
ale->key_data = (void *)list_find_fcurve(&act->curves, rna_path, 0);
|
||||
MEM_freeN(rna_path);
|
||||
}
|
||||
}
|
||||
ale->datatype= (ale->key_data)? ALE_FCURVE : ALE_NONE;
|
||||
ale->datatype = (ale->key_data) ? ALE_FCURVE : ALE_NONE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_GPLAYER:
|
||||
{
|
||||
bGPDlayer *gpl= (bGPDlayer *)data;
|
||||
bGPDlayer *gpl = (bGPDlayer *)data;
|
||||
|
||||
ale->flag= gpl->flag;
|
||||
ale->flag = gpl->flag;
|
||||
|
||||
ale->key_data= NULL;
|
||||
ale->datatype= ALE_GPFRAME;
|
||||
ale->key_data = NULL;
|
||||
ale->datatype = ALE_GPFRAME;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_NLATRACK:
|
||||
{
|
||||
NlaTrack *nlt= (NlaTrack *)data;
|
||||
NlaTrack *nlt = (NlaTrack *)data;
|
||||
|
||||
ale->flag= nlt->flag;
|
||||
ale->flag = nlt->flag;
|
||||
|
||||
ale->key_data= &nlt->strips;
|
||||
ale->datatype= ALE_NLASTRIP;
|
||||
ale->key_data = &nlt->strips;
|
||||
ale->datatype = ALE_NLASTRIP;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANIMTYPE_NLAACTION:
|
||||
{
|
||||
/* nothing to include for now... nothing editable from NLA-perspective here */
|
||||
ale->key_data= NULL;
|
||||
ale->datatype= ALE_NONE;
|
||||
ale->key_data = NULL;
|
||||
ale->datatype = ALE_NONE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -837,13 +837,13 @@ static bAnimListElem *make_new_animlistelem (void *data, short datatype, ID *own
|
||||
/* 'Only Selected' selected data and/or 'Include Hidden' filtering
|
||||
* NOTE: when this function returns true, the F-Curve is to be skipped
|
||||
*/
|
||||
static short skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_id, int filter_mode)
|
||||
static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id, int filter_mode)
|
||||
{
|
||||
/* hidden items should be skipped if we only care about visible data, but we aren't interested in hidden stuff */
|
||||
short skip_hidden = (filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN);
|
||||
|
||||
if (GS(owner_id->name) == ID_OB) {
|
||||
Object *ob= (Object *)owner_id;
|
||||
Object *ob = (Object *)owner_id;
|
||||
|
||||
/* only consider if F-Curve involves pose.bones */
|
||||
if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones")) {
|
||||
@@ -851,15 +851,15 @@ static short skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_
|
||||
char *bone_name;
|
||||
|
||||
/* get bone-name, and check if this bone is selected */
|
||||
bone_name= BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
|
||||
pchan= BKE_pose_channel_find_name(ob->pose, bone_name);
|
||||
bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
|
||||
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
|
||||
if (bone_name) MEM_freeN(bone_name);
|
||||
|
||||
/* check whether to continue or skip */
|
||||
if ((pchan) && (pchan->bone)) {
|
||||
/* if only visible channels, skip if bone not visible unless user wants channels from hidden data too */
|
||||
if (skip_hidden) {
|
||||
bArmature *arm= (bArmature *)ob->data;
|
||||
bArmature *arm = (bArmature *)ob->data;
|
||||
|
||||
/* skipping - not visible on currently visible layers */
|
||||
if ((arm->layer & pchan->bone->layer) == 0)
|
||||
@@ -882,18 +882,18 @@ static short skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_
|
||||
|
||||
/* only consider if F-Curve involves sequence_editor.sequences */
|
||||
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
Editing *ed = seq_give_editing(scene, FALSE);
|
||||
Sequence *seq;
|
||||
char *seq_name;
|
||||
|
||||
/* get strip name, and check if this strip is selected */
|
||||
seq_name= BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
|
||||
seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
|
||||
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
|
||||
if (seq_name) MEM_freeN(seq_name);
|
||||
|
||||
/* can only add this F-Curve if it is selected */
|
||||
if (ads->filterflag & ADS_FILTER_ONLYSEL) {
|
||||
if ((seq == NULL) || (seq->flag & SELECT)==0)
|
||||
if ((seq == NULL) || (seq->flag & SELECT) == 0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -907,13 +907,13 @@ static short skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_
|
||||
char *node_name;
|
||||
|
||||
/* get strip name, and check if this strip is selected */
|
||||
node_name= BLI_getQuotedStr(fcu->rna_path, "nodes[");
|
||||
node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
|
||||
node = nodeFindNodebyName(ntree, node_name);
|
||||
if (node_name) MEM_freeN(node_name);
|
||||
|
||||
/* can only add this F-Curve if it is selected */
|
||||
if (ads->filterflag & ADS_FILTER_ONLYSEL) {
|
||||
if ((node) && (node->flag & NODE_SELECT)==0)
|
||||
if ((node) && (node->flag & NODE_SELECT) == 0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -924,7 +924,7 @@ static short skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_
|
||||
/* (Display-)Name-based F-Curve filtering
|
||||
* NOTE: when this function returns true, the F-Curve is to be skipped
|
||||
*/
|
||||
static short skip_fcurve_with_name (bDopeSheet *ads, FCurve *fcu, ID *owner_id)
|
||||
static short skip_fcurve_with_name(bDopeSheet *ads, FCurve *fcu, ID *owner_id)
|
||||
{
|
||||
bAnimListElem ale_dummy = {NULL};
|
||||
bAnimChannelType *acf;
|
||||
@@ -953,14 +953,14 @@ static short skip_fcurve_with_name (bDopeSheet *ads, FCurve *fcu, ID *owner_id)
|
||||
}
|
||||
|
||||
/* find the next F-Curve that is usable for inclusion */
|
||||
static FCurve *animfilter_fcurve_next (bDopeSheet *ads, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id)
|
||||
static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id)
|
||||
{
|
||||
FCurve *fcu = NULL;
|
||||
|
||||
/* loop over F-Curves - assume that the caller of this has already checked that these should be included
|
||||
* NOTE: we need to check if the F-Curves belong to the same group, as this gets called for groups too...
|
||||
*/
|
||||
for (fcu= first; ((fcu) && (fcu->grp==grp)); fcu= fcu->next) {
|
||||
for (fcu = first; ((fcu) && (fcu->grp == grp)); fcu = fcu->next) {
|
||||
/* special exception for Pose-Channel/Sequence-Strip/Node Based F-Curves:
|
||||
* - the 'Only Selected' and 'Include Hidden' data filters should be applied to sub-ID data which
|
||||
* can be independently selected/hidden, such as Pose-Channels, Sequence Strips, and Nodes.
|
||||
@@ -970,7 +970,7 @@ static FCurve *animfilter_fcurve_next (bDopeSheet *ads, FCurve *first, bActionGr
|
||||
* - this will also affect things like Drivers, and also works for Bone Constraints
|
||||
*/
|
||||
if (ads && owner_id) {
|
||||
if ((ads->filterflag & ADS_FILTER_ONLYSEL) || (ads->filterflag & ADS_FILTER_INCL_HIDDEN)==0) {
|
||||
if ((ads->filterflag & ADS_FILTER_ONLYSEL) || (ads->filterflag & ADS_FILTER_INCL_HIDDEN) == 0) {
|
||||
if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
|
||||
continue;
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ static FCurve *animfilter_fcurve_next (bDopeSheet *ads, FCurve *first, bActionGr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static size_t animfilter_fcurves (ListBase *anim_data, bDopeSheet *ads, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id)
|
||||
static size_t animfilter_fcurves(ListBase *anim_data, bDopeSheet *ads, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id)
|
||||
{
|
||||
FCurve *fcu;
|
||||
size_t items = 0;
|
||||
@@ -1024,7 +1024,7 @@ static size_t animfilter_fcurves (ListBase *anim_data, bDopeSheet *ads, FCurve *
|
||||
return items;
|
||||
}
|
||||
|
||||
static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *UNUSED(act), bActionGroup *agrp, int filter_mode, ID *owner_id)
|
||||
static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *UNUSED(act), bActionGroup *agrp, int filter_mode, ID *owner_id)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
@@ -1033,12 +1033,12 @@ static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDope
|
||||
|
||||
/* if we care about the selection status of the channels,
|
||||
* but the group isn't expanded (1)...
|
||||
* (1) this only matters if we actually care about the hierarchy though.
|
||||
* (1) this only matters if we actually care about the hierarchy though.
|
||||
* - Hierarchy matters: this hack should be applied
|
||||
* - Hierarchy ignored: cases like [#21276] won't work properly, unless we skip this hack
|
||||
*/
|
||||
if ( ((filter_mode & ANIMFILTER_LIST_VISIBLE) && EXPANDED_AGRP(ac, agrp)==0) && /* care about hierarchy but group isn't expanded */
|
||||
(filter_mode & (ANIMFILTER_SEL|ANIMFILTER_UNSEL)) ) /* care about selection status */
|
||||
if ( ((filter_mode & ANIMFILTER_LIST_VISIBLE) && EXPANDED_AGRP(ac, agrp) == 0) && /* care about hierarchy but group isn't expanded */
|
||||
(filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) ) /* care about selection status */
|
||||
{
|
||||
/* if the group itself isn't selected appropriately, we shouldn't consider it's children either */
|
||||
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0)
|
||||
@@ -1052,7 +1052,7 @@ static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDope
|
||||
* - pasting keyframes
|
||||
* - creating ghost curves in Graph Editor
|
||||
*/
|
||||
filter_mode &= ~(ANIMFILTER_SEL|ANIMFILTER_UNSEL|ANIMFILTER_LIST_VISIBLE);
|
||||
filter_mode &= ~(ANIMFILTER_SEL | ANIMFILTER_UNSEL | ANIMFILTER_LIST_VISIBLE);
|
||||
}
|
||||
|
||||
/* add grouped F-Curves */
|
||||
@@ -1086,7 +1086,7 @@ static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDope
|
||||
//filter_mode = ofilter;
|
||||
|
||||
/* filter selection of channel specially here again, since may be open and not subject to previous test */
|
||||
if ( ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) ) {
|
||||
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) ) {
|
||||
ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id);
|
||||
}
|
||||
}
|
||||
@@ -1101,7 +1101,7 @@ static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDope
|
||||
return items;
|
||||
}
|
||||
|
||||
static size_t animfilter_action (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *act, int filter_mode, ID *owner_id)
|
||||
static size_t animfilter_action(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *act, int filter_mode, ID *owner_id)
|
||||
{
|
||||
bActionGroup *agrp;
|
||||
FCurve *lastchan = NULL;
|
||||
@@ -1119,7 +1119,7 @@ static size_t animfilter_action (bAnimContext *ac, ListBase *anim_data, bDopeShe
|
||||
for (agrp = act->groups.first; agrp; agrp = agrp->next) {
|
||||
/* store reference to last channel of group */
|
||||
if (agrp->channels.last)
|
||||
lastchan= agrp->channels.last;
|
||||
lastchan = agrp->channels.last;
|
||||
|
||||
/* action group's channels */
|
||||
items += animfilter_act_group(ac, anim_data, ads, act, agrp, filter_mode, owner_id);
|
||||
@@ -1127,7 +1127,7 @@ static size_t animfilter_action (bAnimContext *ac, ListBase *anim_data, bDopeShe
|
||||
|
||||
/* un-grouped F-Curves (only if we're not only considering those channels in the active group) */
|
||||
if (!(filter_mode & ANIMFILTER_ACTGROUPED)) {
|
||||
FCurve *firstfcu = (lastchan)? (lastchan->next) : (act->curves.first);
|
||||
FCurve *firstfcu = (lastchan) ? (lastchan->next) : (act->curves.first);
|
||||
items += animfilter_fcurves(anim_data, ads, firstfcu, NULL, filter_mode, owner_id);
|
||||
}
|
||||
|
||||
@@ -1143,10 +1143,10 @@ static size_t animfilter_action (bAnimContext *ac, ListBase *anim_data, bDopeShe
|
||||
* - for normal filtering (i.e. for editing), we only need the NLA-tracks but they can be in 'normal' evaluation
|
||||
* order, i.e. first to last. Otherwise, some tools may get screwed up.
|
||||
*/
|
||||
static size_t animfilter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDopeSheet *ads, AnimData *adt, int filter_mode, ID *owner_id)
|
||||
static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDopeSheet *ads, AnimData *adt, int filter_mode, ID *owner_id)
|
||||
{
|
||||
NlaTrack *nlt;
|
||||
NlaTrack *first=NULL, *next=NULL;
|
||||
NlaTrack *first = NULL, *next = NULL;
|
||||
size_t items = 0;
|
||||
|
||||
/* if showing channels, include active action */
|
||||
@@ -1163,26 +1163,26 @@ static size_t animfilter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDo
|
||||
*/
|
||||
ANIMCHANNEL_NEW_CHANNEL_FULL((void *)(&adt->action), ANIMTYPE_NLAACTION, owner_id,
|
||||
{
|
||||
ale->data= adt->action ? adt->action : NULL;
|
||||
ale->data = adt->action ? adt->action : NULL;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* first track to include will be the last one if we're filtering by channels */
|
||||
first= adt->nla_tracks.last;
|
||||
first = adt->nla_tracks.last;
|
||||
}
|
||||
else {
|
||||
/* first track to include will the the first one (as per normal) */
|
||||
first= adt->nla_tracks.first;
|
||||
first = adt->nla_tracks.first;
|
||||
}
|
||||
|
||||
/* loop over NLA Tracks - assume that the caller of this has already checked that these should be included */
|
||||
for (nlt= first; nlt; nlt= next) {
|
||||
for (nlt = first; nlt; nlt = next) {
|
||||
/* 'next' NLA-Track to use depends on whether we're filtering for drawing or not */
|
||||
if (filter_mode & ANIMFILTER_LIST_CHANNELS)
|
||||
next= nlt->prev;
|
||||
next = nlt->prev;
|
||||
else
|
||||
next= nlt->next;
|
||||
next = nlt->next;
|
||||
|
||||
/* if we're in NLA-tweakmode, don't show this track if it was disabled (due to tweaking) for now
|
||||
* - active track should still get shown though (even though it has disabled flag set)
|
||||
@@ -1208,14 +1208,14 @@ static size_t animfilter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDo
|
||||
}
|
||||
|
||||
/* determine what animation data from AnimData block should get displayed */
|
||||
static size_t animfilter_block_data (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *id, int filter_mode)
|
||||
static size_t animfilter_block_data(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *id, int filter_mode)
|
||||
{
|
||||
AnimData *adt = BKE_animdata_from_id(id);
|
||||
size_t items = 0;
|
||||
|
||||
/* image object datablocks have no anim-data so check for NULL */
|
||||
if (adt) {
|
||||
IdAdtTemplate *iat = (IdAdtTemplate*)id;
|
||||
IdAdtTemplate *iat = (IdAdtTemplate *)id;
|
||||
|
||||
/* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed
|
||||
* in a few places in he rest of the code still - notably for the few cases where special mode-based
|
||||
@@ -1244,7 +1244,7 @@ static size_t animfilter_block_data (bAnimContext *ac, ListBase *anim_data, bDop
|
||||
|
||||
|
||||
/* Include ShapeKey Data for ShapeKey Editor */
|
||||
static size_t animdata_filter_shapekey (bAnimContext *ac, ListBase *anim_data, Key *key, int filter_mode)
|
||||
static size_t animdata_filter_shapekey(bAnimContext *ac, ListBase *anim_data, Key *key, int filter_mode)
|
||||
{
|
||||
size_t items = 0;
|
||||
|
||||
@@ -1253,7 +1253,7 @@ static size_t animdata_filter_shapekey (bAnimContext *ac, ListBase *anim_data, K
|
||||
KeyBlock *kb;
|
||||
|
||||
/* loop through the channels adding ShapeKeys as appropriate */
|
||||
for (kb= key->block.first; kb; kb= kb->next) {
|
||||
for (kb = key->block.first; kb; kb = kb->next) {
|
||||
/* skip the first one, since that's the non-animatable basis */
|
||||
// XXX maybe in future this may become handy?
|
||||
if (kb == key->block.first) continue;
|
||||
@@ -1261,7 +1261,7 @@ static size_t animdata_filter_shapekey (bAnimContext *ac, ListBase *anim_data, K
|
||||
/* only work with this channel and its subchannels if it is editable */
|
||||
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_SHAPEKEY(kb)) {
|
||||
/* only include this track if selected in a way consistent with the filtering requirements */
|
||||
if ( ANIMCHANNEL_SELOK(SEL_SHAPEKEY(kb)) ) {
|
||||
if (ANIMCHANNEL_SELOK(SEL_SHAPEKEY(kb)) ) {
|
||||
// TODO: consider 'active' too?
|
||||
|
||||
/* owner-id here must be key so that the F-Curve can be resolved... */
|
||||
@@ -1278,7 +1278,7 @@ static size_t animdata_filter_shapekey (bAnimContext *ac, ListBase *anim_data, K
|
||||
ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, key);
|
||||
}
|
||||
else if (key->adt->action) {
|
||||
items= animfilter_action(ac, anim_data, NULL, key->adt->action, filter_mode, (ID *)key);
|
||||
items = animfilter_action(ac, anim_data, NULL, key->adt->action, filter_mode, (ID *)key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1287,15 +1287,15 @@ static size_t animdata_filter_shapekey (bAnimContext *ac, ListBase *anim_data, K
|
||||
return items;
|
||||
}
|
||||
|
||||
static size_t animdata_filter_gpencil_data (ListBase *anim_data, bGPdata *gpd, int filter_mode)
|
||||
static size_t animdata_filter_gpencil_data(ListBase *anim_data, bGPdata *gpd, int filter_mode)
|
||||
{
|
||||
bGPDlayer *gpl;
|
||||
size_t items = 0;
|
||||
|
||||
/* loop over layers as the conditions are acceptable */
|
||||
for (gpl= gpd->layers.first; gpl; gpl= gpl->next) {
|
||||
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
/* only if selected */
|
||||
if ( ANIMCHANNEL_SELOK(SEL_GPL(gpl)) ) {
|
||||
if (ANIMCHANNEL_SELOK(SEL_GPL(gpl)) ) {
|
||||
/* only if editable */
|
||||
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_GPL(gpl)) {
|
||||
/* active... */
|
||||
@@ -1312,7 +1312,7 @@ static size_t animdata_filter_gpencil_data (ListBase *anim_data, bGPdata *gpd, i
|
||||
|
||||
/* Grab all Grease Pencil datablocks in file */
|
||||
// TODO: should this be amalgamated with the dopesheet filtering code?
|
||||
static size_t animdata_filter_gpencil (ListBase *anim_data, void *UNUSED(data), int filter_mode)
|
||||
static size_t animdata_filter_gpencil(ListBase *anim_data, void *UNUSED(data), int filter_mode)
|
||||
{
|
||||
bGPdata *gpd;
|
||||
size_t items = 0;
|
||||
@@ -1355,7 +1355,7 @@ static size_t animdata_filter_gpencil (ListBase *anim_data, void *UNUSED(data),
|
||||
|
||||
/* NOTE: owner_id is scene, material, or texture block, which is the direct owner of the node tree in question */
|
||||
// TODO: how to handle group nodes is still unclear...
|
||||
static size_t animdata_filter_ds_nodetree (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, bNodeTree *ntree, int filter_mode)
|
||||
static size_t animdata_filter_ds_nodetree(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, bNodeTree *ntree, int filter_mode)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
@@ -1390,11 +1390,11 @@ static size_t animdata_filter_ds_nodetree (bAnimContext *ac, ListBase *anim_data
|
||||
}
|
||||
|
||||
/* NOTE: owner_id is either material, lamp, or world block, which is the direct owner of the texture stack in question */
|
||||
static size_t animdata_filter_ds_textures (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, int filter_mode)
|
||||
static size_t animdata_filter_ds_textures(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, int filter_mode)
|
||||
{
|
||||
MTex **mtex = NULL;
|
||||
size_t items=0;
|
||||
int a=0;
|
||||
size_t items = 0;
|
||||
int a = 0;
|
||||
|
||||
/* get datatype specific data first */
|
||||
if (owner_id == NULL)
|
||||
@@ -1403,22 +1403,22 @@ static size_t animdata_filter_ds_textures (bAnimContext *ac, ListBase *anim_data
|
||||
switch (GS(owner_id->name)) {
|
||||
case ID_MA:
|
||||
{
|
||||
Material *ma= (Material *)owner_id;
|
||||
mtex= (MTex**)(&ma->mtex);
|
||||
Material *ma = (Material *)owner_id;
|
||||
mtex = (MTex **)(&ma->mtex);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_LA:
|
||||
{
|
||||
Lamp *la= (Lamp *)owner_id;
|
||||
mtex= (MTex**)(&la->mtex);
|
||||
Lamp *la = (Lamp *)owner_id;
|
||||
mtex = (MTex **)(&la->mtex);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_WO:
|
||||
{
|
||||
World *wo= (World *)owner_id;
|
||||
mtex= (MTex**)(&wo->mtex);
|
||||
World *wo = (World *)owner_id;
|
||||
mtex = (MTex **)(&wo->mtex);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
/* invalid/unsupported option */
|
||||
@@ -1429,8 +1429,8 @@ static size_t animdata_filter_ds_textures (bAnimContext *ac, ListBase *anim_data
|
||||
}
|
||||
|
||||
/* firstly check that we actuallly have some textures, by gathering all textures in a temp list */
|
||||
for (a=0; a < MAX_MTEX; a++) {
|
||||
Tex *tex= (mtex[a]) ? mtex[a]->tex : NULL;
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
Tex *tex = (mtex[a]) ? mtex[a]->tex : NULL;
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
|
||||
@@ -1476,7 +1476,7 @@ static size_t animdata_filter_ds_textures (bAnimContext *ac, ListBase *anim_data
|
||||
}
|
||||
|
||||
|
||||
static size_t animdata_filter_ds_material (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Material *ma, int filter_mode)
|
||||
static size_t animdata_filter_ds_material(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Material *ma, int filter_mode)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
@@ -1518,7 +1518,7 @@ static size_t animdata_filter_ds_material (bAnimContext *ac, ListBase *anim_data
|
||||
return items;
|
||||
}
|
||||
|
||||
static size_t animdata_filter_ds_materials (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
|
||||
static size_t animdata_filter_ds_materials(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
|
||||
{
|
||||
short has_nested = 0;
|
||||
size_t items = 0;
|
||||
@@ -1559,12 +1559,12 @@ static size_t animdata_filter_ds_materials (bAnimContext *ac, ListBase *anim_dat
|
||||
return items;
|
||||
}
|
||||
|
||||
static size_t animdata_filter_ds_particles (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
|
||||
static size_t animdata_filter_ds_particles(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
|
||||
{
|
||||
ParticleSystem *psys;
|
||||
size_t items= 0;
|
||||
size_t items = 0;
|
||||
|
||||
for (psys = ob->particlesystem.first; psys; psys=psys->next) {
|
||||
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
|
||||
@@ -1601,85 +1601,85 @@ static size_t animdata_filter_ds_particles (bAnimContext *ac, ListBase *anim_dat
|
||||
return items;
|
||||
}
|
||||
|
||||
static size_t animdata_filter_ds_obdata (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
|
||||
static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
size_t items= 0;
|
||||
size_t items = 0;
|
||||
|
||||
IdAdtTemplate *iat= ob->data;
|
||||
short type=0, expanded=0;
|
||||
IdAdtTemplate *iat = ob->data;
|
||||
short type = 0, expanded = 0;
|
||||
|
||||
/* get settings based on data type */
|
||||
switch (ob->type) {
|
||||
case OB_CAMERA: /* ------- Camera ------------ */
|
||||
{
|
||||
Camera *ca= (Camera *)ob->data;
|
||||
Camera *ca = (Camera *)ob->data;
|
||||
|
||||
if (ads->filterflag & ADS_FILTER_NOCAM)
|
||||
return 0;
|
||||
|
||||
type= ANIMTYPE_DSCAM;
|
||||
expanded= FILTER_CAM_OBJD(ca);
|
||||
type = ANIMTYPE_DSCAM;
|
||||
expanded = FILTER_CAM_OBJD(ca);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case OB_LAMP: /* ---------- Lamp ----------- */
|
||||
{
|
||||
Lamp *la= (Lamp *)ob->data;
|
||||
Lamp *la = (Lamp *)ob->data;
|
||||
|
||||
if (ads->filterflag & ADS_FILTER_NOLAM)
|
||||
return 0;
|
||||
|
||||
type= ANIMTYPE_DSLAM;
|
||||
expanded= FILTER_LAM_OBJD(la);
|
||||
type = ANIMTYPE_DSLAM;
|
||||
expanded = FILTER_LAM_OBJD(la);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case OB_CURVE: /* ------- Curve ---------- */
|
||||
case OB_SURF: /* ------- Nurbs Surface ---------- */
|
||||
case OB_FONT: /* ------- Text Curve ---------- */
|
||||
{
|
||||
Curve *cu= (Curve *)ob->data;
|
||||
Curve *cu = (Curve *)ob->data;
|
||||
|
||||
if (ads->filterflag & ADS_FILTER_NOCUR)
|
||||
return 0;
|
||||
|
||||
type= ANIMTYPE_DSCUR;
|
||||
expanded= FILTER_CUR_OBJD(cu);
|
||||
type = ANIMTYPE_DSCUR;
|
||||
expanded = FILTER_CUR_OBJD(cu);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case OB_MBALL: /* ------- MetaBall ---------- */
|
||||
{
|
||||
MetaBall *mb= (MetaBall *)ob->data;
|
||||
MetaBall *mb = (MetaBall *)ob->data;
|
||||
|
||||
if (ads->filterflag & ADS_FILTER_NOMBA)
|
||||
return 0;
|
||||
|
||||
type= ANIMTYPE_DSMBALL;
|
||||
expanded= FILTER_MBALL_OBJD(mb);
|
||||
type = ANIMTYPE_DSMBALL;
|
||||
expanded = FILTER_MBALL_OBJD(mb);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case OB_ARMATURE: /* ------- Armature ---------- */
|
||||
{
|
||||
bArmature *arm= (bArmature *)ob->data;
|
||||
bArmature *arm = (bArmature *)ob->data;
|
||||
|
||||
if (ads->filterflag & ADS_FILTER_NOARM)
|
||||
return 0;
|
||||
|
||||
type= ANIMTYPE_DSARM;
|
||||
expanded= FILTER_ARM_OBJD(arm);
|
||||
type = ANIMTYPE_DSARM;
|
||||
expanded = FILTER_ARM_OBJD(arm);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case OB_MESH: /* ------- Mesh ---------- */
|
||||
{
|
||||
Mesh *me= (Mesh *)ob->data;
|
||||
Mesh *me = (Mesh *)ob->data;
|
||||
|
||||
if (ads->filterflag & ADS_FILTER_NOMESH)
|
||||
return 0;
|
||||
|
||||
type= ANIMTYPE_DSMESH;
|
||||
expanded= FILTER_MESH_OBJD(me);
|
||||
type = ANIMTYPE_DSMESH;
|
||||
expanded = FILTER_MESH_OBJD(me);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case OB_LATTICE: /* ---- Lattice ---- */
|
||||
{
|
||||
Lattice *lt = (Lattice *)ob->data;
|
||||
@@ -1687,18 +1687,18 @@ static size_t animdata_filter_ds_obdata (bAnimContext *ac, ListBase *anim_data,
|
||||
if (ads->filterflag & ADS_FILTER_NOLAT)
|
||||
return 0;
|
||||
|
||||
type= ANIMTYPE_DSLAT;
|
||||
expanded= FILTER_LATTICE_OBJD(lt);
|
||||
type = ANIMTYPE_DSLAT;
|
||||
expanded = FILTER_LATTICE_OBJD(lt);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case OB_SPEAKER: /* ---------- Speaker ----------- */
|
||||
{
|
||||
Speaker *spk= (Speaker *)ob->data;
|
||||
Speaker *spk = (Speaker *)ob->data;
|
||||
|
||||
type= ANIMTYPE_DSSPK;
|
||||
expanded= FILTER_SPK_OBJD(spk);
|
||||
type = ANIMTYPE_DSSPK;
|
||||
expanded = FILTER_SPK_OBJD(spk);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
/* add object data animation channels */
|
||||
@@ -1709,13 +1709,13 @@ static size_t animdata_filter_ds_obdata (bAnimContext *ac, ListBase *anim_data,
|
||||
|
||||
/* sub-data filtering... */
|
||||
switch (ob->type) {
|
||||
case OB_LAMP: /* lamp - textures */
|
||||
case OB_LAMP: /* lamp - textures */
|
||||
{
|
||||
/* textures */
|
||||
if (!(ads->filterflag & ADS_FILTER_NOTEX))
|
||||
tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, ob->data, filter_mode);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
END_ANIMFILTER_SUBCHANNELS;
|
||||
@@ -1741,7 +1741,7 @@ static size_t animdata_filter_ds_obdata (bAnimContext *ac, ListBase *anim_data,
|
||||
}
|
||||
|
||||
/* shapekey-level animation */
|
||||
static size_t animdata_filter_ds_keyanim (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, Key *key, int filter_mode)
|
||||
static size_t animdata_filter_ds_keyanim(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, Key *key, int filter_mode)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
@@ -1775,27 +1775,27 @@ static size_t animdata_filter_ds_keyanim (bAnimContext *ac, ListBase *anim_data,
|
||||
}
|
||||
|
||||
/* object-level animation */
|
||||
static size_t animdata_filter_ds_obanim (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
|
||||
static size_t animdata_filter_ds_obanim(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
size_t items = 0;
|
||||
|
||||
AnimData *adt = ob->adt;
|
||||
short type=0, expanded=1;
|
||||
short type = 0, expanded = 1;
|
||||
void *cdata = NULL;
|
||||
|
||||
/* determine the type of expander channels to use */
|
||||
// this is the best way to do this for now...
|
||||
ANIMDATA_FILTER_CASES(ob,
|
||||
{/* AnimData - no channel, but consider data */},
|
||||
{/* NLA - no channel, but consider data */},
|
||||
{/* Drivers */
|
||||
{ /* AnimData - no channel, but consider data */ },
|
||||
{ /* NLA - no channel, but consider data */ },
|
||||
{ /* Drivers */
|
||||
type = ANIMTYPE_FILLDRIVERS;
|
||||
cdata = adt;
|
||||
expanded = EXPANDED_DRVD(adt);
|
||||
},
|
||||
{/* Keyframes */
|
||||
{ /* Keyframes */
|
||||
type = ANIMTYPE_FILLACTD;
|
||||
cdata = adt->action;
|
||||
expanded = EXPANDED_ACTC(adt->action);
|
||||
@@ -1830,17 +1830,17 @@ static size_t animdata_filter_ds_obanim (bAnimContext *ac, ListBase *anim_data,
|
||||
}
|
||||
|
||||
/* get animation channels from object2 */
|
||||
static size_t animdata_filter_dopesheet_ob (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
|
||||
static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
Object *ob= base->object;
|
||||
Object *ob = base->object;
|
||||
size_t tmp_items = 0;
|
||||
size_t items = 0;
|
||||
|
||||
/* filter data contained under object first */
|
||||
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_OBJC(ob))
|
||||
{
|
||||
Key *key= ob_get_key(ob);
|
||||
Key *key = ob_get_key(ob);
|
||||
|
||||
/* object-level animation */
|
||||
if ((ob->adt) && !(ads->filterflag & ADS_FILTER_NOOBJ)) {
|
||||
@@ -1894,7 +1894,7 @@ static size_t animdata_filter_dopesheet_ob (bAnimContext *ac, ListBase *anim_dat
|
||||
return items;
|
||||
}
|
||||
|
||||
static size_t animdata_filter_ds_world (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Scene *sce, World *wo, int filter_mode)
|
||||
static size_t animdata_filter_ds_world(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Scene *sce, World *wo, int filter_mode)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
@@ -1936,27 +1936,27 @@ static size_t animdata_filter_ds_world (bAnimContext *ac, ListBase *anim_data, b
|
||||
return items;
|
||||
}
|
||||
|
||||
static size_t animdata_filter_ds_scene (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Scene *sce, int filter_mode)
|
||||
static size_t animdata_filter_ds_scene(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Scene *sce, int filter_mode)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
size_t items = 0;
|
||||
|
||||
AnimData *adt = sce->adt;
|
||||
short type=0, expanded=1;
|
||||
short type = 0, expanded = 1;
|
||||
void *cdata = NULL;
|
||||
|
||||
/* determine the type of expander channels to use */
|
||||
// this is the best way to do this for now...
|
||||
ANIMDATA_FILTER_CASES(sce,
|
||||
{/* AnimData - no channel, but consider data */},
|
||||
{/* NLA - no channel, but consider data */},
|
||||
{/* Drivers */
|
||||
{ /* AnimData - no channel, but consider data */},
|
||||
{ /* NLA - no channel, but consider data */},
|
||||
{ /* Drivers */
|
||||
type = ANIMTYPE_FILLDRIVERS;
|
||||
cdata = adt;
|
||||
expanded = EXPANDED_DRVD(adt);
|
||||
},
|
||||
{/* Keyframes */
|
||||
{ /* Keyframes */
|
||||
type = ANIMTYPE_FILLACTD;
|
||||
cdata = adt->action;
|
||||
expanded = EXPANDED_ACTC(adt->action);
|
||||
@@ -1990,7 +1990,7 @@ static size_t animdata_filter_ds_scene (bAnimContext *ac, ListBase *anim_data, b
|
||||
return items;
|
||||
}
|
||||
|
||||
static size_t animdata_filter_dopesheet_scene (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Scene *sce, int filter_mode)
|
||||
static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Scene *sce, int filter_mode)
|
||||
{
|
||||
ListBase tmp_data = {NULL, NULL};
|
||||
size_t tmp_items = 0;
|
||||
@@ -1999,8 +1999,8 @@ static size_t animdata_filter_dopesheet_scene (bAnimContext *ac, ListBase *anim_
|
||||
/* filter data contained under object first */
|
||||
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_SCEC(sce))
|
||||
{
|
||||
bNodeTree *ntree= sce->nodetree;
|
||||
World *wo= sce->world;
|
||||
bNodeTree *ntree = sce->nodetree;
|
||||
World *wo = sce->world;
|
||||
|
||||
/* Action, Drivers, or NLA for Scene */
|
||||
if ((ads->filterflag & ADS_FILTER_NOSCE) == 0) {
|
||||
@@ -2043,17 +2043,17 @@ static size_t animdata_filter_dopesheet_scene (bAnimContext *ac, ListBase *anim_
|
||||
}
|
||||
|
||||
// TODO: implement pinning... (if and when pinning is done, what we need to do is to provide freeing mechanisms - to protect against data that was deleted)
|
||||
static size_t animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, int filter_mode)
|
||||
static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, int filter_mode)
|
||||
{
|
||||
Scene *sce= (Scene *)ads->source;
|
||||
Scene *sce = (Scene *)ads->source;
|
||||
Base *base;
|
||||
size_t items = 0;
|
||||
|
||||
/* check that we do indeed have a scene */
|
||||
if ((ads->source == NULL) || (GS(ads->source->name)!=ID_SCE)) {
|
||||
if ((ads->source == NULL) || (GS(ads->source->name) != ID_SCE)) {
|
||||
printf("DopeSheet Error: Not scene!\n");
|
||||
if (G.debug & G_DEBUG)
|
||||
printf("\tPointer = %p, Name = '%s'\n", (void *)ads->source, (ads->source)?ads->source->name:NULL);
|
||||
printf("\tPointer = %p, Name = '%s'\n", (void *)ads->source, (ads->source) ? ads->source->name : NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2069,10 +2069,10 @@ static size_t animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data,
|
||||
items += animdata_filter_dopesheet_scene(ac, anim_data, ads, sce, filter_mode);
|
||||
|
||||
/* loop over all bases (i.e.objects) in the scene */
|
||||
for (base= sce->base.first; base; base= base->next) {
|
||||
for (base = sce->base.first; base; base = base->next) {
|
||||
/* check if there's an object (all the relevant checks are done in the ob-function) */
|
||||
if (base->object) {
|
||||
Object *ob= base->object;
|
||||
Object *ob = base->object;
|
||||
|
||||
/* firstly, check if object can be included, by the following factors:
|
||||
* - if only visible, must check for layer and also viewport visibility
|
||||
@@ -2085,7 +2085,7 @@ static size_t animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data,
|
||||
*/
|
||||
if ((filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
|
||||
/* layer visibility - we check both object and base, since these may not be in sync yet */
|
||||
if ((sce->lay & (ob->lay|base->lay))==0) continue;
|
||||
if ((sce->lay & (ob->lay | base->lay)) == 0) continue;
|
||||
|
||||
/* outliner restrict-flag */
|
||||
if (ob->restrictflag & OB_RESTRICT_VIEW) continue;
|
||||
@@ -2124,9 +2124,9 @@ static size_t animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data,
|
||||
}
|
||||
|
||||
/* Summary track for DopeSheet/Action Editor
|
||||
* - return code is whether the summary lets the other channels get drawn
|
||||
* - return code is whether the summary lets the other channels get drawn
|
||||
*/
|
||||
static short animdata_filter_dopesheet_summary (bAnimContext *ac, ListBase *anim_data, int filter_mode, size_t *items)
|
||||
static short animdata_filter_dopesheet_summary(bAnimContext *ac, ListBase *anim_data, int filter_mode, size_t *items)
|
||||
{
|
||||
bDopeSheet *ads = NULL;
|
||||
|
||||
@@ -2136,8 +2136,8 @@ static short animdata_filter_dopesheet_summary (bAnimContext *ac, ListBase *anim
|
||||
* being applicable.
|
||||
*/
|
||||
if ((ac && ac->sl) && (ac->spacetype == SPACE_ACTION)) {
|
||||
SpaceAction *saction= (SpaceAction *)ac->sl;
|
||||
ads= &saction->ads;
|
||||
SpaceAction *saction = (SpaceAction *)ac->sl;
|
||||
ads = &saction->ads;
|
||||
}
|
||||
else {
|
||||
/* invalid space type - skip this summary channels */
|
||||
@@ -2149,7 +2149,7 @@ static short animdata_filter_dopesheet_summary (bAnimContext *ac, ListBase *anim
|
||||
* - only useful for DopeSheet/Action/etc. editors where it is actually useful
|
||||
*/
|
||||
if ((filter_mode & ANIMFILTER_LIST_CHANNELS) && (ads->filterflag & ADS_FILTER_SUMMARY)) {
|
||||
bAnimListElem *ale= make_new_animlistelem(ac, ANIMTYPE_SUMMARY, NULL);
|
||||
bAnimListElem *ale = make_new_animlistelem(ac, ANIMTYPE_SUMMARY, NULL);
|
||||
if (ale) {
|
||||
BLI_addtail(anim_data, ale);
|
||||
(*items)++;
|
||||
@@ -2169,7 +2169,7 @@ static short animdata_filter_dopesheet_summary (bAnimContext *ac, ListBase *anim
|
||||
/* ......................... */
|
||||
|
||||
/* filter data associated with a channel - usually for handling summary-channels in DopeSheet */
|
||||
static size_t animdata_filter_animchan (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAnimListElem *channel, int filter_mode)
|
||||
static size_t animdata_filter_animchan(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAnimListElem *channel, int filter_mode)
|
||||
{
|
||||
size_t items = 0;
|
||||
|
||||
@@ -2195,14 +2195,14 @@ static size_t animdata_filter_animchan (bAnimContext *ac, ListBase *anim_data, b
|
||||
/* ----------- Cleanup API --------------- */
|
||||
|
||||
/* Remove entries with invalid types in animation channel list */
|
||||
static size_t animdata_filter_remove_invalid (ListBase *anim_data)
|
||||
static size_t animdata_filter_remove_invalid(ListBase *anim_data)
|
||||
{
|
||||
bAnimListElem *ale, *next;
|
||||
size_t items = 0;
|
||||
|
||||
/* only keep entries with valid types */
|
||||
for (ale= anim_data->first; ale; ale= next) {
|
||||
next= ale->next;
|
||||
for (ale = anim_data->first; ale; ale = next) {
|
||||
next = ale->next;
|
||||
|
||||
if (ale->type == ANIMTYPE_NONE)
|
||||
BLI_freelinkN(anim_data, ale);
|
||||
@@ -2214,7 +2214,7 @@ static size_t animdata_filter_remove_invalid (ListBase *anim_data)
|
||||
}
|
||||
|
||||
/* Remove duplicate entries in animation channel list */
|
||||
static size_t animdata_filter_remove_duplis (ListBase *anim_data)
|
||||
static size_t animdata_filter_remove_duplis(ListBase *anim_data)
|
||||
{
|
||||
bAnimListElem *ale, *next;
|
||||
GHash *gh;
|
||||
@@ -2223,7 +2223,7 @@ static size_t animdata_filter_remove_duplis (ListBase *anim_data)
|
||||
/* build new hashtable to efficiently store and retrieve which entries have been
|
||||
* encountered already while searching
|
||||
*/
|
||||
gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "animdata_filter_duplis_remove gh");
|
||||
gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "animdata_filter_duplis_remove gh");
|
||||
|
||||
/* loop through items, removing them from the list if a similar item occurs already */
|
||||
for (ale = anim_data->first; ale; ale = next) {
|
||||
@@ -2256,7 +2256,7 @@ static size_t animdata_filter_remove_duplis (ListBase *anim_data)
|
||||
/* This function filters the active data source to leave only animation channels suitable for
|
||||
* usage by the caller. It will return the length of the list
|
||||
*
|
||||
* *anim_data: is a pointer to a ListBase, to which the filtered animation channels
|
||||
* *anim_data: is a pointer to a ListBase, to which the filtered animation channels
|
||||
* will be placed for use.
|
||||
* filter_mode: how should the data be filtered - bitmapping accessed flags
|
||||
*/
|
||||
@@ -2269,31 +2269,31 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
|
||||
|
||||
/* firstly filter the data */
|
||||
switch (datatype) {
|
||||
case ANIMCONT_ACTION: /* 'Action Editor' */
|
||||
case ANIMCONT_ACTION: /* 'Action Editor' */
|
||||
{
|
||||
Object *obact= ac->obact;
|
||||
Object *obact = ac->obact;
|
||||
SpaceAction *saction = (SpaceAction *)ac->sl;
|
||||
bDopeSheet *ads = (saction)? &saction->ads : NULL;
|
||||
bDopeSheet *ads = (saction) ? &saction->ads : NULL;
|
||||
|
||||
/* the check for the DopeSheet summary is included here since the summary works here too */
|
||||
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
|
||||
items += animfilter_action(ac, anim_data, ads, data, filter_mode, (ID *)obact);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMCONT_SHAPEKEY: /* 'ShapeKey Editor' */
|
||||
{
|
||||
/* the check for the DopeSheet summary is included here since the summary works here too */
|
||||
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
|
||||
items= animdata_filter_shapekey(ac, anim_data, data, filter_mode);
|
||||
items = animdata_filter_shapekey(ac, anim_data, data, filter_mode);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMCONT_GPENCIL:
|
||||
{
|
||||
items= animdata_filter_gpencil(anim_data, data, filter_mode);
|
||||
items = animdata_filter_gpencil(anim_data, data, filter_mode);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMCONT_DOPESHEET: /* 'DopeSheet Editor' */
|
||||
{
|
||||
@@ -2301,7 +2301,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
|
||||
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
|
||||
items += animdata_filter_dopesheet(ac, anim_data, data, filter_mode);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMCONT_FCURVES: /* Graph Editor -> FCurves/Animation Editing */
|
||||
case ANIMCONT_DRIVERS: /* Graph Editor -> Drivers Editing */
|
||||
@@ -2310,7 +2310,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
|
||||
/* all of these editors use the basic DopeSheet data for filtering options, but don't have all the same features */
|
||||
items = animdata_filter_dopesheet(ac, anim_data, data, filter_mode);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ANIMCONT_CHANNEL: /* animation channel */
|
||||
{
|
||||
@@ -2319,7 +2319,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
|
||||
/* based on the channel type, filter relevant data for this */
|
||||
items = animdata_filter_animchan(ac, anim_data, ads, data, filter_mode);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
/* remove any 'weedy' entries */
|
||||
|
||||
@@ -40,14 +40,14 @@ extern ListBase builtin_keyingsets;
|
||||
|
||||
/* Main Keyframe Management operators:
|
||||
* These handle keyframes management from various spaces. They only make use of
|
||||
* Keying Sets.
|
||||
* Keying Sets.
|
||||
*/
|
||||
void ANIM_OT_keyframe_insert(struct wmOperatorType *ot);
|
||||
void ANIM_OT_keyframe_delete(struct wmOperatorType *ot);
|
||||
|
||||
/* Main Keyframe Management operators:
|
||||
* These handle keyframes management from various spaces. They will handle the menus
|
||||
* required for each space.
|
||||
* required for each space.
|
||||
*/
|
||||
void ANIM_OT_keyframe_insert_menu(struct wmOperatorType *ot);
|
||||
void ANIM_OT_keyframe_delete_v3d(struct wmOperatorType *ot);
|
||||
|
||||
@@ -78,9 +78,9 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
||||
|
||||
/* try to resolve the path */
|
||||
if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) {
|
||||
const char *structname=NULL, *propname=NULL;
|
||||
const char *structname = NULL, *propname = NULL;
|
||||
char arrayindbuf[16];
|
||||
const char *arrayname=NULL;
|
||||
const char *arrayname = NULL;
|
||||
short free_structname = 0;
|
||||
|
||||
/* For now, name will consist of 3 parts: struct-name, property name, array index
|
||||
@@ -104,44 +104,44 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
||||
*/
|
||||
if (strstr(fcu->rna_path, "bones") && strstr(fcu->rna_path, "constraints")) {
|
||||
/* perform string 'chopping' to get "Bone Name : Constraint Name" */
|
||||
char *pchanName= BLI_getQuotedStr(fcu->rna_path, "bones[");
|
||||
char *constName= BLI_getQuotedStr(fcu->rna_path, "constraints[");
|
||||
char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones[");
|
||||
char *constName = BLI_getQuotedStr(fcu->rna_path, "constraints[");
|
||||
|
||||
/* assemble the string to display in the UI... */
|
||||
structname= BLI_sprintfN("%s : %s", pchanName, constName);
|
||||
free_structname= 1;
|
||||
structname = BLI_sprintfN("%s : %s", pchanName, constName);
|
||||
free_structname = 1;
|
||||
|
||||
/* free the temp names */
|
||||
if (pchanName) MEM_freeN(pchanName);
|
||||
if (constName) MEM_freeN(constName);
|
||||
}
|
||||
else if (ptr.data != ptr.id.data) {
|
||||
PropertyRNA *nameprop= RNA_struct_name_property(ptr.type);
|
||||
PropertyRNA *nameprop = RNA_struct_name_property(ptr.type);
|
||||
if (nameprop) {
|
||||
/* this gets a string which will need to be freed */
|
||||
structname= RNA_property_string_get_alloc(&ptr, nameprop, NULL, 0, NULL);
|
||||
free_structname= 1;
|
||||
structname = RNA_property_string_get_alloc(&ptr, nameprop, NULL, 0, NULL);
|
||||
free_structname = 1;
|
||||
}
|
||||
else
|
||||
structname= RNA_struct_ui_name(ptr.type);
|
||||
structname = RNA_struct_ui_name(ptr.type);
|
||||
}
|
||||
|
||||
/* Property Name is straightforward */
|
||||
propname= RNA_property_ui_name(prop);
|
||||
propname = RNA_property_ui_name(prop);
|
||||
|
||||
/* Array Index - only if applicable */
|
||||
if (RNA_property_array_length(&ptr, prop)) {
|
||||
char c= RNA_property_array_item_char(prop, fcu->array_index);
|
||||
char c = RNA_property_array_item_char(prop, fcu->array_index);
|
||||
|
||||
/* we need to write the index to a temp buffer (in py syntax) */
|
||||
if (c) BLI_snprintf(arrayindbuf, sizeof(arrayindbuf), "%c ", c);
|
||||
else BLI_snprintf(arrayindbuf, sizeof(arrayindbuf), "[%d]", fcu->array_index);
|
||||
|
||||
arrayname= &arrayindbuf[0];
|
||||
arrayname = &arrayindbuf[0];
|
||||
}
|
||||
else {
|
||||
/* no array index */
|
||||
arrayname= "";
|
||||
arrayname = "";
|
||||
}
|
||||
|
||||
/* putting this all together into the buffer */
|
||||
@@ -160,7 +160,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
||||
/* Icon for this property's owner:
|
||||
* use the struct's icon if it is set
|
||||
*/
|
||||
icon= RNA_struct_ui_icon(ptr.type);
|
||||
icon = RNA_struct_ui_icon(ptr.type);
|
||||
|
||||
/* valid path - remove the invalid tag since we now know how to use it saving
|
||||
* users manual effort to reenable using "Revive Disabled FCurves" [#29629]
|
||||
@@ -173,7 +173,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
||||
|
||||
/* icon for this should be the icon for the base ID */
|
||||
// TODO: or should we just use the error icon?
|
||||
icon= RNA_struct_ui_icon(id_ptr.type);
|
||||
icon = RNA_struct_ui_icon(id_ptr.type);
|
||||
|
||||
/* tag F-Curve as disabled - as not usable path */
|
||||
fcu->flag |= FCURVE_DISABLED;
|
||||
@@ -187,7 +187,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
||||
/* ------------------------------- Color Codes for F-Curve Channels ---------------------------- */
|
||||
|
||||
/* step between the major distinguishable color bands of the primary colors */
|
||||
#define HSV_BANDWIDTH 0.3f
|
||||
#define HSV_BANDWIDTH 0.3f
|
||||
|
||||
/* used to determine the color of F-Curves with FCURVE_COLOR_AUTO_RAINBOW set */
|
||||
//void fcurve_rainbow (unsigned int cur, unsigned int tot, float *out)
|
||||
@@ -202,8 +202,8 @@ void getcolor_fcurve_rainbow(int cur, int tot, float *out)
|
||||
* 4 - for 'even' numbers of curves - there should be a majority of quartets of curves
|
||||
* so the base color is simply one of the three primary colors
|
||||
*/
|
||||
grouping= (4 - (tot % 2));
|
||||
hue= HSV_BANDWIDTH * (float)(cur % grouping);
|
||||
grouping = (4 - (tot % 2));
|
||||
hue = HSV_BANDWIDTH * (float)(cur % grouping);
|
||||
|
||||
/* 'Value' (i.e. darkness) needs to vary so that larger sets of three will be
|
||||
* 'darker' (i.e. smaller value), so that they don't look that similar to previous ones.
|
||||
@@ -214,15 +214,15 @@ void getcolor_fcurve_rainbow(int cur, int tot, float *out)
|
||||
|
||||
/* the base color can get offset a bit so that the colors aren't so identical */
|
||||
hue += fac * HSV_BANDWIDTH;
|
||||
if (hue > 1.0f) hue= fmod(hue, 1.0f);
|
||||
if (hue > 1.0f) hue = fmod(hue, 1.0f);
|
||||
|
||||
/* saturation adjustments for more visible range */
|
||||
if ((hue > 0.5f) && (hue < 0.8f)) sat= 0.5f;
|
||||
else sat= 0.6f;
|
||||
if ((hue > 0.5f) && (hue < 0.8f)) sat = 0.5f;
|
||||
else sat = 0.6f;
|
||||
|
||||
/* value is fixed at 1.0f, otherwise we cannot clearly see the curves... */
|
||||
val= 1.0f;
|
||||
val = 1.0f;
|
||||
|
||||
/* finally, conver this to RGB colors */
|
||||
hsv_to_rgb(hue, sat, val, out, out+1, out+2);
|
||||
hsv_to_rgb(hue, sat, val, out, out + 1, out + 2);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ static ListBase *context_get_markers(Scene *scene, ScrArea *sa)
|
||||
SpaceAction *saction = (SpaceAction *)sa->spacedata.first;
|
||||
|
||||
/* local markers can only be shown when there's only a single active action to grab them from
|
||||
* - flag only takes effect when there's an action, otherwise it can get too confusing?
|
||||
* - flag only takes effect when there's an action, otherwise it can get too confusing?
|
||||
*/
|
||||
if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) && (saction->action)) {
|
||||
if (saction->flag & SACTION_POSEMARKERS_SHOW) {
|
||||
@@ -139,23 +139,23 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
|
||||
case TFM_TIME_EXTEND:
|
||||
{
|
||||
/* apply delta if marker is on the right side of the current frame */
|
||||
if ((side=='B') ||
|
||||
(side=='L' && marker->frame < cfra) ||
|
||||
(side=='R' && marker->frame >= cfra))
|
||||
if ((side == 'B') ||
|
||||
(side == 'L' && marker->frame < cfra) ||
|
||||
(side == 'R' && marker->frame >= cfra))
|
||||
{
|
||||
marker->frame += (int)floorf(value + 0.5f);
|
||||
changed++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case TFM_TIME_SCALE:
|
||||
{
|
||||
/* rescale the distance between the marker and the current frame */
|
||||
marker->frame= cfra + (int)floorf(((float)(marker->frame - cfra) * value) + 0.5f);
|
||||
marker->frame = cfra + (int)floorf(((float)(marker->frame - cfra) * value) + 0.5f);
|
||||
changed++;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,18 +167,18 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
|
||||
|
||||
/* Get the marker that is closest to this point */
|
||||
/* XXX for select, the min_dist should be small */
|
||||
TimeMarker *ED_markers_find_nearest_marker (ListBase *markers, float x)
|
||||
TimeMarker *ED_markers_find_nearest_marker(ListBase *markers, float x)
|
||||
{
|
||||
TimeMarker *marker, *nearest=NULL;
|
||||
float dist, min_dist= 1000000;
|
||||
TimeMarker *marker, *nearest = NULL;
|
||||
float dist, min_dist = 1000000;
|
||||
|
||||
if (markers) {
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
dist = ABS((float)marker->frame - x);
|
||||
|
||||
if (dist < min_dist) {
|
||||
min_dist= dist;
|
||||
nearest= marker;
|
||||
min_dist = dist;
|
||||
nearest = marker;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ TimeMarker *ED_markers_find_nearest_marker (ListBase *markers, float x)
|
||||
/* Return the time of the marker that occurs on a frame closest to the given time */
|
||||
int ED_markers_find_nearest_marker_time(ListBase *markers, float x)
|
||||
{
|
||||
TimeMarker *nearest= ED_markers_find_nearest_marker(markers, x);
|
||||
TimeMarker *nearest = ED_markers_find_nearest_marker(markers, x);
|
||||
return (nearest) ? (nearest->frame) : (int)floor(x + 0.5f);
|
||||
}
|
||||
|
||||
@@ -209,11 +209,11 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
|
||||
}
|
||||
|
||||
if (markers->first && markers->last) {
|
||||
TimeMarker *fm= markers->first;
|
||||
TimeMarker *lm= markers->last;
|
||||
TimeMarker *fm = markers->first;
|
||||
TimeMarker *lm = markers->last;
|
||||
|
||||
min= (float)fm->frame;
|
||||
max= (float)lm->frame;
|
||||
min = (float)fm->frame;
|
||||
max = (float)lm->frame;
|
||||
}
|
||||
else {
|
||||
*first = 0.0f;
|
||||
@@ -223,39 +223,39 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
|
||||
|
||||
/* count how many markers are usable - see later */
|
||||
if (sel) {
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if (marker->flag & SELECT)
|
||||
selcount++;
|
||||
}
|
||||
}
|
||||
else
|
||||
selcount= BLI_countlist(markers);
|
||||
selcount = BLI_countlist(markers);
|
||||
|
||||
/* if only selected are to be considered, only consider the selected ones
|
||||
* (optimization for not searching list)
|
||||
*/
|
||||
if (selcount > 1) {
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if (sel) {
|
||||
if (marker->flag & SELECT) {
|
||||
if (marker->frame < min)
|
||||
min= (float)marker->frame;
|
||||
min = (float)marker->frame;
|
||||
if (marker->frame > max)
|
||||
max= (float)marker->frame;
|
||||
max = (float)marker->frame;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (marker->frame < min)
|
||||
min= (float)marker->frame;
|
||||
min = (float)marker->frame;
|
||||
if (marker->frame > max)
|
||||
max= (float)marker->frame;
|
||||
max = (float)marker->frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* set the min/max values */
|
||||
*first= min;
|
||||
*last= max;
|
||||
*first = min;
|
||||
*last = max;
|
||||
}
|
||||
|
||||
/* --------------------------------- */
|
||||
@@ -266,26 +266,26 @@ static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only
|
||||
CfraElem *ce, *cen;
|
||||
|
||||
/* should this one only be considered if it is selected? */
|
||||
if ((only_sel) && ((marker->flag & SELECT)==0))
|
||||
if ((only_sel) && ((marker->flag & SELECT) == 0))
|
||||
return;
|
||||
|
||||
/* insertion sort - try to find a previous cfra elem */
|
||||
for (ce= lb->first; ce; ce= ce->next) {
|
||||
for (ce = lb->first; ce; ce = ce->next) {
|
||||
if (ce->cfra == marker->frame) {
|
||||
/* do because of double keys */
|
||||
if (marker->flag & SELECT)
|
||||
ce->sel= marker->flag;
|
||||
ce->sel = marker->flag;
|
||||
return;
|
||||
}
|
||||
else if (ce->cfra > marker->frame) break;
|
||||
}
|
||||
|
||||
cen= MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
|
||||
cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
|
||||
if (ce) BLI_insertlinkbefore(lb, ce, cen);
|
||||
else BLI_addtail(lb, cen);
|
||||
|
||||
cen->cfra= marker->frame;
|
||||
cen->sel= marker->flag;
|
||||
cen->cfra = marker->frame;
|
||||
cen->sel = marker->flag;
|
||||
}
|
||||
|
||||
/* This function makes a list of all the markers. The only_sel
|
||||
@@ -299,7 +299,7 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
|
||||
if (markers == NULL)
|
||||
return;
|
||||
|
||||
for (marker= markers->first; marker; marker= marker->next)
|
||||
for (marker = markers->first; marker; marker = marker->next)
|
||||
add_marker_to_cfra_elem(lb, marker, only_sel);
|
||||
}
|
||||
|
||||
@@ -349,15 +349,15 @@ void debug_markers_print_list(ListBase *markers)
|
||||
static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
|
||||
{
|
||||
float xpos, ypixels, xscale, yscale;
|
||||
int icon_id= 0;
|
||||
int icon_id = 0;
|
||||
|
||||
xpos = marker->frame;
|
||||
|
||||
/* no time correction for framelen! space is drawn with old values */
|
||||
ypixels= v2d->mask.ymax-v2d->mask.ymin;
|
||||
ypixels = v2d->mask.ymax - v2d->mask.ymin;
|
||||
UI_view2d_getscale(v2d, &xscale, &yscale);
|
||||
|
||||
glScalef(1.0f/xscale, 1.0f, 1.0f);
|
||||
glScalef(1.0f / xscale, 1.0f, 1.0f);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -377,8 +377,8 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
|
||||
glColor4ub(0, 0, 0, 96);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f((xpos*xscale)+0.5f, 12.0f);
|
||||
glVertex2f((xpos*xscale)+0.5f, (v2d->cur.ymax+12.0f)*yscale);
|
||||
glVertex2f((xpos * xscale) + 0.5f, 12.0f);
|
||||
glVertex2f((xpos * xscale) + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
|
||||
glEnd();
|
||||
|
||||
setlinestyle(0);
|
||||
@@ -386,16 +386,16 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
|
||||
|
||||
/* 5 px to offset icon to align properly, space / pixels corrects for zoom */
|
||||
if (flag & DRAW_MARKERS_LOCAL) {
|
||||
icon_id= (marker->flag & ACTIVE) ? ICON_PMARKER_ACT :
|
||||
(marker->flag & SELECT) ? ICON_PMARKER_SEL :
|
||||
ICON_PMARKER;
|
||||
icon_id = (marker->flag & ACTIVE) ? ICON_PMARKER_ACT :
|
||||
(marker->flag & SELECT) ? ICON_PMARKER_SEL :
|
||||
ICON_PMARKER;
|
||||
}
|
||||
else {
|
||||
icon_id= (marker->flag & SELECT) ? ICON_MARKER_HLT :
|
||||
ICON_MARKER;
|
||||
icon_id = (marker->flag & SELECT) ? ICON_MARKER_HLT :
|
||||
ICON_MARKER;
|
||||
}
|
||||
|
||||
UI_icon_draw(xpos*xscale-5.0f, 16.0f, icon_id);
|
||||
UI_icon_draw(xpos * xscale - 5.0f, 16.0f, icon_id);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
@@ -405,18 +405,18 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
|
||||
|
||||
if (marker->flag & SELECT) {
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
x= xpos*xscale + 4.0f;
|
||||
y= (ypixels <= 39.0f)? (ypixels-10.0f) : 29.0f;
|
||||
x = xpos * xscale + 4.0f;
|
||||
y = (ypixels <= 39.0f) ? (ypixels - 10.0f) : 29.0f;
|
||||
}
|
||||
else {
|
||||
UI_ThemeColor(TH_TEXT);
|
||||
if ((marker->frame <= cfra) && (marker->frame+5 > cfra)) {
|
||||
x= xpos*xscale + 4.0f;
|
||||
y= (ypixels <= 39.0f)? (ypixels - 10.0f) : 29.0f;
|
||||
if ((marker->frame <= cfra) && (marker->frame + 5 > cfra)) {
|
||||
x = xpos * xscale + 4.0f;
|
||||
y = (ypixels <= 39.0f) ? (ypixels - 10.0f) : 29.0f;
|
||||
}
|
||||
else {
|
||||
x= xpos*xscale + 4.0f;
|
||||
y= 17.0f;
|
||||
x = xpos * xscale + 4.0f;
|
||||
y = 17.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
|
||||
if (marker->camera && (marker->camera->restrictflag & OB_RESTRICT_RENDER)) {
|
||||
float col[4];
|
||||
glGetFloatv(GL_CURRENT_COLOR, col);
|
||||
col[3]= 0.4;
|
||||
col[3] = 0.4;
|
||||
glColor4fv(col);
|
||||
}
|
||||
#endif
|
||||
@@ -438,7 +438,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
|
||||
/* Draw Scene-Markers in time window */
|
||||
void draw_markers_time(const bContext *C, int flag)
|
||||
{
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
View2D *v2d;
|
||||
TimeMarker *marker;
|
||||
Scene *scene;
|
||||
@@ -450,14 +450,14 @@ void draw_markers_time(const bContext *C, int flag)
|
||||
v2d = UI_view2d_fromcontext(C);
|
||||
|
||||
/* unselected markers are drawn at the first time */
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if ((marker->flag & SELECT) == 0) {
|
||||
draw_marker(v2d, marker, scene->r.cfra, flag);
|
||||
}
|
||||
}
|
||||
|
||||
/* selected markers are drawn later */
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if (marker->flag & SELECT) {
|
||||
draw_marker(v2d, marker, scene->r.cfra, flag);
|
||||
}
|
||||
@@ -549,32 +549,32 @@ static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
/* add TimeMarker at curent frame */
|
||||
static int ed_marker_add(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
TimeMarker *marker;
|
||||
int frame= CTX_data_scene(C)->r.cfra;
|
||||
int frame = CTX_data_scene(C)->r.cfra;
|
||||
|
||||
if (markers == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* prefer not having 2 markers at the same place,
|
||||
* though the user can move them to overlap once added */
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if (marker->frame == frame)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* deselect all */
|
||||
for (marker= markers->first; marker; marker= marker->next)
|
||||
for (marker = markers->first; marker; marker = marker->next)
|
||||
marker->flag &= ~SELECT;
|
||||
|
||||
marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
|
||||
marker->flag= SELECT;
|
||||
marker->frame= frame;
|
||||
marker->flag = SELECT;
|
||||
marker->frame = frame;
|
||||
BLI_snprintf(marker->name, sizeof(marker->name), "F_%02d", frame); // XXX - temp code only
|
||||
BLI_addtail(markers, marker);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -592,7 +592,7 @@ static void MARKER_OT_add(wmOperatorType *ot)
|
||||
ot->poll = ED_operator_animview_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ************************** transform markers *************************** */
|
||||
@@ -623,7 +623,7 @@ static void MARKER_OT_add(wmOperatorType *ot)
|
||||
typedef struct MarkerMove {
|
||||
SpaceLink *slink;
|
||||
ListBase *markers;
|
||||
int event_type; /* store invoke-event, to verify */
|
||||
int event_type; /* store invoke-event, to verify */
|
||||
int *oldframe, evtx, firstx;
|
||||
NumInput num;
|
||||
} MarkerMove;
|
||||
@@ -632,32 +632,32 @@ typedef struct MarkerMove {
|
||||
/* return 0 if not OK */
|
||||
static int ed_marker_move_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
MarkerMove *mm;
|
||||
TimeMarker *marker;
|
||||
int totmark=0;
|
||||
int totmark = 0;
|
||||
int a;
|
||||
|
||||
if (markers == NULL) return 0;
|
||||
|
||||
for (marker= markers->first; marker; marker= marker->next)
|
||||
for (marker = markers->first; marker; marker = marker->next)
|
||||
if (marker->flag & SELECT) totmark++;
|
||||
|
||||
if (totmark==0) return 0;
|
||||
if (totmark == 0) return 0;
|
||||
|
||||
op->customdata= mm= MEM_callocN(sizeof(MarkerMove), "Markermove");
|
||||
mm->slink= CTX_wm_space_data(C);
|
||||
mm->markers= markers;
|
||||
mm->oldframe= MEM_callocN(totmark*sizeof(int), "MarkerMove oldframe");
|
||||
op->customdata = mm = MEM_callocN(sizeof(MarkerMove), "Markermove");
|
||||
mm->slink = CTX_wm_space_data(C);
|
||||
mm->markers = markers;
|
||||
mm->oldframe = MEM_callocN(totmark * sizeof(int), "MarkerMove oldframe");
|
||||
|
||||
initNumInput(&mm->num);
|
||||
mm->num.idx_max = 0; /* one axis */
|
||||
mm->num.flag |= NUM_NO_FRACTION;
|
||||
mm->num.increment = 1.0f;
|
||||
|
||||
for (a=0, marker= markers->first; marker; marker= marker->next) {
|
||||
for (a = 0, marker = markers->first; marker; marker = marker->next) {
|
||||
if (marker->flag & SELECT) {
|
||||
mm->oldframe[a]= marker->frame;
|
||||
mm->oldframe[a] = marker->frame;
|
||||
a++;
|
||||
}
|
||||
}
|
||||
@@ -668,12 +668,12 @@ static int ed_marker_move_init(bContext *C, wmOperator *op)
|
||||
/* free stuff */
|
||||
static void ed_marker_move_exit(bContext *C, wmOperator *op)
|
||||
{
|
||||
MarkerMove *mm= op->customdata;
|
||||
MarkerMove *mm = op->customdata;
|
||||
|
||||
/* free data */
|
||||
MEM_freeN(mm->oldframe);
|
||||
MEM_freeN(op->customdata);
|
||||
op->customdata= NULL;
|
||||
op->customdata = NULL;
|
||||
|
||||
/* clear custom header prints */
|
||||
ED_area_headerprint(CTX_wm_area(C), NULL);
|
||||
@@ -682,11 +682,11 @@ static void ed_marker_move_exit(bContext *C, wmOperator *op)
|
||||
static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
{
|
||||
if (ed_marker_move_init(C, op)) {
|
||||
MarkerMove *mm= op->customdata;
|
||||
MarkerMove *mm = op->customdata;
|
||||
|
||||
mm->evtx= evt->x;
|
||||
mm->firstx= evt->x;
|
||||
mm->event_type= evt->type;
|
||||
mm->evtx = evt->x;
|
||||
mm->firstx = evt->x;
|
||||
mm->event_type = evt->type;
|
||||
|
||||
/* add temp handler */
|
||||
WM_event_add_modal_handler(C, op);
|
||||
@@ -708,14 +708,14 @@ static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *e
|
||||
/* note, init has to be called succesfully */
|
||||
static void ed_marker_move_apply(wmOperator *op)
|
||||
{
|
||||
MarkerMove *mm= op->customdata;
|
||||
MarkerMove *mm = op->customdata;
|
||||
TimeMarker *marker;
|
||||
int a, offs;
|
||||
|
||||
offs= RNA_int_get(op->ptr, "frames");
|
||||
for (a=0, marker= mm->markers->first; marker; marker= marker->next) {
|
||||
offs = RNA_int_get(op->ptr, "frames");
|
||||
for (a = 0, marker = mm->markers->first; marker; marker = marker->next) {
|
||||
if (marker->flag & SELECT) {
|
||||
marker->frame= mm->oldframe[a] + offs;
|
||||
marker->frame = mm->oldframe[a] + offs;
|
||||
a++;
|
||||
}
|
||||
}
|
||||
@@ -728,8 +728,8 @@ static int ed_marker_move_cancel(bContext *C, wmOperator *op)
|
||||
ed_marker_move_apply(op);
|
||||
ed_marker_move_exit(C, op);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -738,10 +738,10 @@ static int ed_marker_move_cancel(bContext *C, wmOperator *op)
|
||||
|
||||
static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
MarkerMove *mm= op->customdata;
|
||||
View2D *v2d= UI_view2d_fromcontext(C);
|
||||
TimeMarker *marker, *selmarker=NULL;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
MarkerMove *mm = op->customdata;
|
||||
View2D *v2d = UI_view2d_fromcontext(C);
|
||||
TimeMarker *marker, *selmarker = NULL;
|
||||
float dx, fac;
|
||||
char str[256];
|
||||
|
||||
@@ -756,7 +756,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
ed_marker_move_cancel(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
/* else continue; <--- see if release event should be caught for tweak-end */
|
||||
/* else continue; <--- see if release event should be caught for tweak-end */
|
||||
|
||||
case RETKEY:
|
||||
case PADENTER:
|
||||
@@ -764,8 +764,8 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
case MIDDLEMOUSE:
|
||||
if (WM_modal_tweak_exit(evt, mm->event_type)) {
|
||||
ed_marker_move_exit(C, op);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
break;
|
||||
@@ -773,44 +773,44 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
if (hasNumInput(&mm->num))
|
||||
break;
|
||||
|
||||
dx= v2d->mask.xmax-v2d->mask.xmin;
|
||||
dx= (v2d->cur.xmax-v2d->cur.xmin)/dx;
|
||||
dx = v2d->mask.xmax - v2d->mask.xmin;
|
||||
dx = (v2d->cur.xmax - v2d->cur.xmin) / dx;
|
||||
|
||||
if (evt->x != mm->evtx) { /* XXX maybe init for firsttime */
|
||||
int a, offs, totmark=0;
|
||||
if (evt->x != mm->evtx) { /* XXX maybe init for first time */
|
||||
int a, offs, totmark = 0;
|
||||
|
||||
mm->evtx= evt->x;
|
||||
mm->evtx = evt->x;
|
||||
|
||||
fac= ((float)(evt->x - mm->firstx)*dx);
|
||||
fac = ((float)(evt->x - mm->firstx) * dx);
|
||||
|
||||
if (mm->slink->spacetype == SPACE_TIME)
|
||||
apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, FPS, 0.1*FPS, 0);
|
||||
apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, FPS, 0.1 * FPS, 0);
|
||||
else
|
||||
apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, 1.0, 0.1, 0 /*was: U.flag & USER_AUTOGRABGRID*/);
|
||||
|
||||
offs= (int)fac;
|
||||
offs = (int)fac;
|
||||
RNA_int_set(op->ptr, "frames", offs);
|
||||
ed_marker_move_apply(op);
|
||||
|
||||
/* cruft below is for header print */
|
||||
for (a=0, marker= mm->markers->first; marker; marker= marker->next) {
|
||||
for (a = 0, marker = mm->markers->first; marker; marker = marker->next) {
|
||||
if (marker->flag & SELECT) {
|
||||
selmarker= marker;
|
||||
selmarker = marker;
|
||||
a++; totmark++;
|
||||
}
|
||||
}
|
||||
|
||||
if (totmark==1) {
|
||||
if (totmark == 1) {
|
||||
/* we print current marker value */
|
||||
if (mm->slink->spacetype == SPACE_TIME) {
|
||||
SpaceTime *stime= (SpaceTime *)mm->slink;
|
||||
SpaceTime *stime = (SpaceTime *)mm->slink;
|
||||
if (stime->flag & TIME_DRAWFRAMES)
|
||||
BLI_snprintf(str, sizeof(str), "Marker %d offset %d", selmarker->frame, offs);
|
||||
else
|
||||
BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
|
||||
}
|
||||
else if (mm->slink->spacetype == SPACE_ACTION) {
|
||||
SpaceAction *saction= (SpaceAction *)mm->slink;
|
||||
SpaceAction *saction = (SpaceAction *)mm->slink;
|
||||
if (saction->flag & SACTION_DRAWTIME)
|
||||
BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
|
||||
else
|
||||
@@ -823,14 +823,14 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
else {
|
||||
/* we only print the offset */
|
||||
if (mm->slink->spacetype == SPACE_TIME) {
|
||||
SpaceTime *stime= (SpaceTime *)mm->slink;
|
||||
SpaceTime *stime = (SpaceTime *)mm->slink;
|
||||
if (stime->flag & TIME_DRAWFRAMES)
|
||||
BLI_snprintf(str, sizeof(str), "Marker offset %d ", offs);
|
||||
else
|
||||
BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", FRA2TIME(offs));
|
||||
}
|
||||
else if (mm->slink->spacetype == SPACE_ACTION) {
|
||||
SpaceAction *saction= (SpaceAction *)mm->slink;
|
||||
SpaceAction *saction = (SpaceAction *)mm->slink;
|
||||
if (saction->flag & SACTION_DRAWTIME)
|
||||
BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", FRA2TIME(offs));
|
||||
else
|
||||
@@ -841,13 +841,13 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
ED_area_headerprint(CTX_wm_area(C), str);
|
||||
}
|
||||
}
|
||||
|
||||
if (evt->val==KM_PRESS) {
|
||||
if (evt->val == KM_PRESS) {
|
||||
float vec[3];
|
||||
char str_tx[256];
|
||||
|
||||
@@ -862,8 +862,8 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
BLI_snprintf(str, sizeof(str), "Marker offset %s", str_tx);
|
||||
ED_area_headerprint(CTX_wm_area(C), str);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,7 +895,7 @@ static void MARKER_OT_move(wmOperatorType *ot)
|
||||
ot->cancel = ed_marker_move_cancel;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
|
||||
|
||||
/* rna storage */
|
||||
RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
|
||||
@@ -922,7 +922,7 @@ static void MARKER_OT_move(wmOperatorType *ot)
|
||||
/* duplicate selected TimeMarkers */
|
||||
static void ed_marker_duplicate_apply(bContext *C)
|
||||
{
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
TimeMarker *marker, *newmarker;
|
||||
|
||||
if (markers == NULL)
|
||||
@@ -931,19 +931,19 @@ static void ed_marker_duplicate_apply(bContext *C)
|
||||
/* go through the list of markers, duplicate selected markers and add duplicated copies
|
||||
* to the beginning of the list (unselect original markers)
|
||||
*/
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if (marker->flag & SELECT) {
|
||||
/* unselect selected marker */
|
||||
marker->flag &= ~SELECT;
|
||||
|
||||
/* create and set up new marker */
|
||||
newmarker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
|
||||
newmarker->flag= SELECT;
|
||||
newmarker->frame= marker->frame;
|
||||
newmarker->flag = SELECT;
|
||||
newmarker->frame = marker->frame;
|
||||
BLI_strncpy(newmarker->name, marker->name, sizeof(marker->name));
|
||||
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
newmarker->camera= marker->camera;
|
||||
newmarker->camera = marker->camera;
|
||||
#endif
|
||||
|
||||
/* new marker is added to the beginning of list */
|
||||
@@ -956,7 +956,7 @@ static void ed_marker_duplicate_apply(bContext *C)
|
||||
static int ed_marker_duplicate_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ed_marker_duplicate_apply(C);
|
||||
ed_marker_move_exec(C, op); /* assumes frs delta set */
|
||||
ed_marker_move_exec(C, op); /* assumes frs delta set */
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
@@ -988,7 +988,7 @@ static void MARKER_OT_duplicate(wmOperatorType *ot)
|
||||
ot->cancel = ed_marker_move_cancel;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna storage */
|
||||
RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
|
||||
@@ -1000,9 +1000,9 @@ static void MARKER_OT_duplicate(wmOperatorType *ot)
|
||||
static void select_timeline_marker_frame(ListBase *markers, int frame, unsigned char shift)
|
||||
{
|
||||
TimeMarker *marker;
|
||||
int select=0;
|
||||
int select = 0;
|
||||
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
/* if Shift is not set, then deselect Markers */
|
||||
if (!shift) marker->flag &= ~SELECT;
|
||||
|
||||
@@ -1019,20 +1019,20 @@ static void select_timeline_marker_frame(ListBase *markers, int frame, unsigned
|
||||
|
||||
static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
|
||||
{
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
View2D *v2d= UI_view2d_fromcontext(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
View2D *v2d = UI_view2d_fromcontext(C);
|
||||
float viewx;
|
||||
int x, y, cfra;
|
||||
|
||||
if (markers == NULL)
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
|
||||
x= evt->x - CTX_wm_region(C)->winrct.xmin;
|
||||
y= evt->y - CTX_wm_region(C)->winrct.ymin;
|
||||
x = evt->x - CTX_wm_region(C)->winrct.xmin;
|
||||
y = evt->y - CTX_wm_region(C)->winrct.ymin;
|
||||
|
||||
UI_view2d_region_to_view(v2d, x, y, &viewx, NULL);
|
||||
|
||||
cfra= ED_markers_find_nearest_marker_time(markers, viewx);
|
||||
cfra = ED_markers_find_nearest_marker_time(markers, viewx);
|
||||
|
||||
if (extend)
|
||||
select_timeline_marker_frame(markers, cfra, 1);
|
||||
@@ -1042,25 +1042,25 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
|
||||
if (camera) {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Base *base;
|
||||
TimeMarker *marker;
|
||||
int sel= 0;
|
||||
int sel = 0;
|
||||
|
||||
if (!extend)
|
||||
BKE_scene_base_deselect_all(scene);
|
||||
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
if (marker->frame==cfra) {
|
||||
sel= (marker->flag & SELECT);
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if (marker->frame == cfra) {
|
||||
sel = (marker->flag & SELECT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if (marker->camera) {
|
||||
if (marker->frame==cfra) {
|
||||
base= BKE_scene_base_find(scene, marker->camera);
|
||||
if (marker->frame == cfra) {
|
||||
base = BKE_scene_base_find(scene, marker->camera);
|
||||
if (base) {
|
||||
ED_base_object_select(base, sel);
|
||||
if (sel)
|
||||
@@ -1070,25 +1070,25 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
}
|
||||
#else
|
||||
(void)camera;
|
||||
#endif
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
|
||||
/* allowing tweaks, but needs OPERATOR_FINISHED, otherwise renaming fails... [#25987] */
|
||||
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
|
||||
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
static int ed_marker_select_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
{
|
||||
short extend= RNA_boolean_get(op->ptr, "extend");
|
||||
short camera= 0;
|
||||
short extend = RNA_boolean_get(op->ptr, "extend");
|
||||
short camera = 0;
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
camera= RNA_boolean_get(op->ptr, "camera");
|
||||
camera = RNA_boolean_get(op->ptr, "camera");
|
||||
#endif
|
||||
return ed_marker_select(C, evt, extend, camera);
|
||||
}
|
||||
@@ -1110,7 +1110,7 @@ static void MARKER_OT_select(wmOperatorType *ot)
|
||||
ot->poll = ed_markers_poll_markers_exist;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
@@ -1128,29 +1128,29 @@ static void MARKER_OT_select(wmOperatorType *ot)
|
||||
*
|
||||
* callbacks:
|
||||
*
|
||||
* exec() has to be filled in by user
|
||||
* exec() has to be filled in by user
|
||||
*
|
||||
* invoke() default WM function
|
||||
* adds modal handler
|
||||
* invoke() default WM function
|
||||
* adds modal handler
|
||||
*
|
||||
* modal() default WM function
|
||||
* accept modal events while doing it, calls exec(), handles ESC and border drawing
|
||||
* modal() default WM function
|
||||
* accept modal events while doing it, calls exec(), handles ESC and border drawing
|
||||
*
|
||||
* poll() has to be filled in by user for context
|
||||
* poll() has to be filled in by user for context
|
||||
*/
|
||||
|
||||
static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
View2D *v2d= UI_view2d_fromcontext(C);
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
View2D *v2d = UI_view2d_fromcontext(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
TimeMarker *marker;
|
||||
float xminf, xmaxf, yminf, ymaxf;
|
||||
int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
|
||||
int xmin= RNA_int_get(op->ptr, "xmin");
|
||||
int xmax= RNA_int_get(op->ptr, "xmax");
|
||||
int ymin= RNA_int_get(op->ptr, "ymin");
|
||||
int ymax= RNA_int_get(op->ptr, "ymax");
|
||||
int extend= RNA_boolean_get(op->ptr, "extend");
|
||||
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
|
||||
int xmin = RNA_int_get(op->ptr, "xmin");
|
||||
int xmax = RNA_int_get(op->ptr, "xmax");
|
||||
int ymin = RNA_int_get(op->ptr, "ymin");
|
||||
int ymax = RNA_int_get(op->ptr, "ymax");
|
||||
int extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
UI_view2d_region_to_view(v2d, xmin, ymin, &xminf, &yminf);
|
||||
UI_view2d_region_to_view(v2d, xmax, ymax, &xmaxf, &ymaxf);
|
||||
@@ -1159,7 +1159,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
|
||||
return 0;
|
||||
|
||||
/* XXX marker context */
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if ((marker->frame > xminf) && (marker->frame <= xmaxf)) {
|
||||
switch (gesture_mode) {
|
||||
case GESTURE_MODAL_SELECT:
|
||||
@@ -1175,8 +1175,8 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1202,7 +1202,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot)
|
||||
ot->poll = ed_markers_poll_markers_exist;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
@@ -1212,7 +1212,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot)
|
||||
|
||||
static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
TimeMarker *marker;
|
||||
int action = RNA_enum_get(op->ptr, "action");
|
||||
|
||||
@@ -1223,22 +1223,22 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
|
||||
action = (ED_markers_get_first_selected(markers) != NULL) ? SEL_DESELECT : SEL_SELECT;
|
||||
}
|
||||
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
switch (action) {
|
||||
case SEL_SELECT:
|
||||
marker->flag |= SELECT;
|
||||
break;
|
||||
case SEL_DESELECT:
|
||||
marker->flag &= ~SELECT;
|
||||
break;
|
||||
case SEL_INVERT:
|
||||
marker->flag ^= SELECT;
|
||||
break;
|
||||
case SEL_SELECT:
|
||||
marker->flag |= SELECT;
|
||||
break;
|
||||
case SEL_DESELECT:
|
||||
marker->flag &= ~SELECT;
|
||||
break;
|
||||
case SEL_INVERT:
|
||||
marker->flag ^= SELECT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1256,7 +1256,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot)
|
||||
ot->poll = ed_markers_poll_markers_exist;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_select_all(ot);
|
||||
@@ -1267,24 +1267,24 @@ static void MARKER_OT_select_all(wmOperatorType *ot)
|
||||
/* remove selected TimeMarkers */
|
||||
static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
TimeMarker *marker, *nmarker;
|
||||
short changed= 0;
|
||||
short changed = 0;
|
||||
|
||||
if (markers == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
for (marker= markers->first; marker; marker= nmarker) {
|
||||
nmarker= marker->next;
|
||||
for (marker = markers->first; marker; marker = nmarker) {
|
||||
nmarker = marker->next;
|
||||
if (marker->flag & SELECT) {
|
||||
BLI_freelinkN(markers, marker);
|
||||
changed= 1;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -1309,7 +1309,7 @@ static void MARKER_OT_delete(wmOperatorType *ot)
|
||||
ot->poll = ed_markers_poll_selected_markers;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
@@ -1318,13 +1318,13 @@ static void MARKER_OT_delete(wmOperatorType *ot)
|
||||
/* rename first selected TimeMarker */
|
||||
static int ed_marker_rename_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
TimeMarker *marker= ED_markers_get_first_selected(ED_context_get_markers(C));
|
||||
TimeMarker *marker = ED_markers_get_first_selected(ED_context_get_markers(C));
|
||||
|
||||
if (marker) {
|
||||
RNA_string_get(op->ptr, "name", marker->name);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1357,7 +1357,7 @@ static void MARKER_OT_rename(wmOperatorType *ot)
|
||||
ot->poll = ed_markers_poll_selected_markers;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
ot->prop = RNA_def_string(ot->srna, "name", "RenamedMarker", sizeof(((TimeMarker *)NULL)->name), "Name", "New name for marker");
|
||||
@@ -1368,11 +1368,11 @@ static void MARKER_OT_rename(wmOperatorType *ot)
|
||||
|
||||
static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
|
||||
TimeMarker *marker, *marker_new;
|
||||
|
||||
if (scene_to==NULL) {
|
||||
if (scene_to == NULL) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Scene not found");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -1383,10 +1383,10 @@ static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* copy markers */
|
||||
for (marker= markers->first; marker; marker= marker->next) {
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
if (marker->flag & SELECT) {
|
||||
marker_new= MEM_dupallocN(marker);
|
||||
marker_new->prev= marker_new->next = NULL;
|
||||
marker_new = MEM_dupallocN(marker);
|
||||
marker_new->prev = marker_new->next = NULL;
|
||||
|
||||
BLI_addtail(&scene_to->markers, marker_new);
|
||||
}
|
||||
@@ -1410,10 +1410,10 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot)
|
||||
ot->poll = ed_markers_poll_selected_markers;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
|
||||
prop = RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
|
||||
RNA_def_enum_funcs(prop, RNA_scene_itemf);
|
||||
ot->prop = prop;
|
||||
|
||||
@@ -1424,25 +1424,25 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot)
|
||||
|
||||
static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
bScreen *sc = CTX_wm_screen(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ListBase *markers= ED_context_get_markers(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
TimeMarker *marker;
|
||||
|
||||
marker= ED_markers_get_first_selected(markers);
|
||||
marker = ED_markers_get_first_selected(markers);
|
||||
if (marker == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
marker->camera= ob;
|
||||
marker->camera = ob;
|
||||
|
||||
/* camera may have changes */
|
||||
BKE_scene_camera_switch_update(scene);
|
||||
BKE_screen_view3d_scene_sync(sc);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|NA_EDITED, scene); /* so we get view3d redraws */
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene); /* so we get view3d redraws */
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1460,7 +1460,7 @@ static void MARKER_OT_camera_bind(wmOperatorType *ot)
|
||||
ot->poll = ed_markers_poll_selected_markers;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1501,7 +1501,7 @@ void ED_marker_keymap(wmKeyConfig *keyconf)
|
||||
RNA_boolean_set(kmi->ptr, "extend", FALSE);
|
||||
RNA_boolean_set(kmi->ptr, "camera", TRUE);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
|
||||
kmi = WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
|
||||
RNA_boolean_set(kmi->ptr, "extend", TRUE);
|
||||
RNA_boolean_set(kmi->ptr, "camera", TRUE);
|
||||
#else
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
/* Check if the operator can be run from the current context */
|
||||
static int change_frame_poll(bContext *C)
|
||||
{
|
||||
ScrArea *curarea= CTX_wm_area(C);
|
||||
ScrArea *curarea = CTX_wm_area(C);
|
||||
|
||||
/* XXX temp? prevent changes during render */
|
||||
if (G.rendering) return 0;
|
||||
@@ -77,17 +77,17 @@ static int change_frame_poll(bContext *C)
|
||||
/* Set the new frame number */
|
||||
static void change_frame_apply(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
/* set the new frame number */
|
||||
CFRA= RNA_int_get(op->ptr, "frame");
|
||||
CFRA = RNA_int_get(op->ptr, "frame");
|
||||
FRAMENUMBER_MIN_CLAMP(CFRA);
|
||||
SUBFRA = 0.f;
|
||||
|
||||
/* do updates */
|
||||
sound_seek_scene(bmain, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
||||
}
|
||||
|
||||
/* ---- */
|
||||
@@ -105,14 +105,14 @@ static int change_frame_exec(bContext *C, wmOperator *op)
|
||||
/* Get frame from mouse coordinates */
|
||||
static int frame_from_event(bContext *C, wmEvent *event)
|
||||
{
|
||||
ARegion *region= CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
float viewx;
|
||||
|
||||
/* convert from region coordinates to View2D 'tot' space */
|
||||
UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &viewx, NULL);
|
||||
|
||||
/* round result to nearest int (frames are ints!) */
|
||||
return (int)floor(viewx+0.5f);
|
||||
return (int)floor(viewx + 0.5f);
|
||||
}
|
||||
|
||||
/* Modal Operator init */
|
||||
@@ -150,7 +150,7 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
/* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init
|
||||
* the modal op) doesn't work for some reason
|
||||
*/
|
||||
if (event->val==KM_RELEASE)
|
||||
if (event->val == KM_RELEASE)
|
||||
return OPERATOR_FINISHED;
|
||||
break;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ static void ANIM_OT_change_frame(wmOperatorType *ot)
|
||||
ot->poll = change_frame_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
|
||||
@@ -182,14 +182,14 @@ static void ANIM_OT_change_frame(wmOperatorType *ot)
|
||||
|
||||
static int previewrange_define_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
float sfra, efra;
|
||||
int xmin, xmax;
|
||||
|
||||
/* get min/max values from border select rect (already in region coordinates, not screen) */
|
||||
xmin= RNA_int_get(op->ptr, "xmin");
|
||||
xmax= RNA_int_get(op->ptr, "xmax");
|
||||
xmin = RNA_int_get(op->ptr, "xmin");
|
||||
xmax = RNA_int_get(op->ptr, "xmax");
|
||||
|
||||
/* convert min/max values to frames (i.e. region to 'tot' rect) */
|
||||
UI_view2d_region_to_view(&ar->v2d, xmin, 0, &sfra, NULL);
|
||||
@@ -201,14 +201,14 @@ static int previewrange_define_exec(bContext *C, wmOperator *op)
|
||||
*/
|
||||
FRAMENUMBER_MIN_CLAMP(sfra);
|
||||
FRAMENUMBER_MIN_CLAMP(efra);
|
||||
if (efra < sfra) efra= sfra;
|
||||
if (efra < sfra) efra = sfra;
|
||||
|
||||
scene->r.flag |= SCER_PRV_RANGE;
|
||||
scene->r.psfra= (int)floor(sfra + 0.5f);
|
||||
scene->r.pefra= (int)floor(efra + 0.5f);
|
||||
scene->r.psfra = (int)floor(sfra + 0.5f);
|
||||
scene->r.pefra = (int)floor(efra + 0.5f);
|
||||
|
||||
/* send notifiers */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -229,13 +229,13 @@ static void ANIM_OT_previewrange_set(wmOperatorType *ot)
|
||||
ot->poll = ED_operator_animview_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
/* used to define frame range */
|
||||
/* used to define frame range */
|
||||
RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
|
||||
RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
|
||||
/* these are not used, but are needed by borderselect gesture operator stuff */
|
||||
/* these are not used, but are needed by borderselect gesture operator stuff */
|
||||
RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
|
||||
RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
|
||||
}
|
||||
@@ -244,8 +244,8 @@ static void ANIM_OT_previewrange_set(wmOperatorType *ot)
|
||||
|
||||
static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ScrArea *curarea= CTX_wm_area(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ScrArea *curarea = CTX_wm_area(C);
|
||||
|
||||
/* sanity checks */
|
||||
if (ELEM(NULL, scene, curarea))
|
||||
@@ -253,8 +253,8 @@ static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
/* simply clear values */
|
||||
scene->r.flag &= ~SCER_PRV_RANGE;
|
||||
scene->r.psfra= 0;
|
||||
scene->r.pefra= 0;
|
||||
scene->r.psfra = 0;
|
||||
scene->r.pefra = 0;
|
||||
|
||||
ED_area_tag_redraw(curarea);
|
||||
|
||||
@@ -274,7 +274,7 @@ static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
|
||||
ot->poll = ED_operator_animview_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ************************** registration **********************************/
|
||||
@@ -319,7 +319,7 @@ void ED_keymap_anim(wmKeyConfig *keyconf)
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
/* frame management */
|
||||
/* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons */
|
||||
/* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons */
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_change_frame", ACTIONMOUSE, KM_PRESS, 0, 0);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TKEY, KM_PRESS, KM_CTRL, 0);
|
||||
|
||||
@@ -78,7 +78,7 @@ void free_anim_drivers_copybuf(void);
|
||||
* 1 - add new Driver FCurve,
|
||||
* -1 - add new Driver FCurve without driver stuff (for pasting)
|
||||
*/
|
||||
FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_index, short add)
|
||||
FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_index, short add)
|
||||
{
|
||||
AnimData *adt;
|
||||
FCurve *fcu;
|
||||
@@ -88,9 +88,9 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind
|
||||
return NULL;
|
||||
|
||||
/* init animdata if none available yet */
|
||||
adt= BKE_animdata_from_id(id);
|
||||
adt = BKE_animdata_from_id(id);
|
||||
if ((adt == NULL) && (add))
|
||||
adt= BKE_id_add_animdata(id);
|
||||
adt = BKE_id_add_animdata(id);
|
||||
if (adt == NULL) {
|
||||
/* if still none (as not allowed to add, or ID doesn't have animdata for some reason) */
|
||||
return NULL;
|
||||
@@ -100,22 +100,22 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind
|
||||
* - add if not found and allowed to add one
|
||||
* TODO: add auto-grouping support? how this works will need to be resolved
|
||||
*/
|
||||
fcu= list_find_fcurve(&adt->drivers, rna_path, array_index);
|
||||
fcu = list_find_fcurve(&adt->drivers, rna_path, array_index);
|
||||
|
||||
if ((fcu == NULL) && (add)) {
|
||||
/* use default settings to make a F-Curve */
|
||||
fcu= MEM_callocN(sizeof(FCurve), "FCurve");
|
||||
fcu = MEM_callocN(sizeof(FCurve), "FCurve");
|
||||
|
||||
fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED);
|
||||
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
|
||||
|
||||
/* store path - make copy, and store that */
|
||||
fcu->rna_path= BLI_strdupn(rna_path, strlen(rna_path));
|
||||
fcu->array_index= array_index;
|
||||
fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
|
||||
fcu->array_index = array_index;
|
||||
|
||||
/* if add is negative, don't init this data yet, since it will be filled in by the pasted driver */
|
||||
if (add > 0) {
|
||||
/* add some new driver data */
|
||||
fcu->driver= MEM_callocN(sizeof(ChannelDriver), "ChannelDriver");
|
||||
fcu->driver = MEM_callocN(sizeof(ChannelDriver), "ChannelDriver");
|
||||
|
||||
/* add simple generator modifier for driver so that there is some visible representation */
|
||||
add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR);
|
||||
@@ -133,7 +133,7 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind
|
||||
/* Driver Management API */
|
||||
|
||||
/* Main Driver Management API calls:
|
||||
* Add a new driver for the specified property on the given ID block
|
||||
* Add a new driver for the specified property on the given ID block
|
||||
*/
|
||||
short ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type)
|
||||
{
|
||||
@@ -147,18 +147,18 @@ short ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int ar
|
||||
RNA_id_pointer_create(id, &id_ptr);
|
||||
if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
|
||||
BKE_reportf(reports, RPT_ERROR,
|
||||
"Could not add Driver, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
|
||||
id->name, rna_path);
|
||||
"Could not add Driver, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
|
||||
id->name, rna_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* key entire array convenience method */
|
||||
if (array_index == -1) {
|
||||
array_index_max= RNA_property_array_length(&ptr, prop);
|
||||
array_index= 0;
|
||||
array_index_max = RNA_property_array_length(&ptr, prop);
|
||||
array_index = 0;
|
||||
}
|
||||
else
|
||||
array_index_max= array_index;
|
||||
array_index_max = array_index;
|
||||
|
||||
/* maximum index should be greater than the start index */
|
||||
if (array_index == array_index_max)
|
||||
@@ -167,40 +167,40 @@ short ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int ar
|
||||
/* will only loop once unless the array index was -1 */
|
||||
for (; array_index < array_index_max; array_index++) {
|
||||
/* create F-Curve with Driver */
|
||||
fcu= verify_driver_fcurve(id, rna_path, array_index, 1);
|
||||
fcu = verify_driver_fcurve(id, rna_path, array_index, 1);
|
||||
|
||||
if (fcu && fcu->driver) {
|
||||
ChannelDriver *driver= fcu->driver;
|
||||
ChannelDriver *driver = fcu->driver;
|
||||
|
||||
/* set the type of the driver */
|
||||
driver->type= type;
|
||||
driver->type = type;
|
||||
|
||||
/* creating drivers for buttons will create the driver(s) with type
|
||||
* "scripted expression" so that their values won't be lost immediately,
|
||||
* so here we copy those values over to the driver's expression
|
||||
*/
|
||||
if (type == DRIVER_TYPE_PYTHON) {
|
||||
PropertyType proptype= RNA_property_type(prop);
|
||||
int array= RNA_property_array_length(&ptr, prop);
|
||||
char *expression= driver->expression;
|
||||
int val, maxlen= sizeof(driver->expression);
|
||||
PropertyType proptype = RNA_property_type(prop);
|
||||
int array = RNA_property_array_length(&ptr, prop);
|
||||
char *expression = driver->expression;
|
||||
int val, maxlen = sizeof(driver->expression);
|
||||
float fval;
|
||||
|
||||
if (proptype == PROP_BOOLEAN) {
|
||||
if (!array) val= RNA_property_boolean_get(&ptr, prop);
|
||||
else val= RNA_property_boolean_get_index(&ptr, prop, array_index);
|
||||
if (!array) val = RNA_property_boolean_get(&ptr, prop);
|
||||
else val = RNA_property_boolean_get_index(&ptr, prop, array_index);
|
||||
|
||||
BLI_strncpy(expression, (val)? "True": "False", maxlen);
|
||||
BLI_strncpy(expression, (val) ? "True" : "False", maxlen);
|
||||
}
|
||||
else if (proptype == PROP_INT) {
|
||||
if (!array) val= RNA_property_int_get(&ptr, prop);
|
||||
else val= RNA_property_int_get_index(&ptr, prop, array_index);
|
||||
if (!array) val = RNA_property_int_get(&ptr, prop);
|
||||
else val = RNA_property_int_get_index(&ptr, prop, array_index);
|
||||
|
||||
BLI_snprintf(expression, maxlen, "%d", val);
|
||||
}
|
||||
else if (proptype == PROP_FLOAT) {
|
||||
if (!array) fval= RNA_property_float_get(&ptr, prop);
|
||||
else fval= RNA_property_float_get_index(&ptr, prop, array_index);
|
||||
if (!array) fval = RNA_property_float_get(&ptr, prop);
|
||||
else fval = RNA_property_float_get_index(&ptr, prop, array_index);
|
||||
|
||||
BLI_snprintf(expression, maxlen, "%.3f", fval);
|
||||
}
|
||||
@@ -227,25 +227,25 @@ short ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int ar
|
||||
}
|
||||
|
||||
/* Main Driver Management API calls:
|
||||
* Remove the driver for the specified property on the given ID block (if available)
|
||||
* Remove the driver for the specified property on the given ID block (if available)
|
||||
*/
|
||||
short ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag))
|
||||
{
|
||||
AnimData *adt;
|
||||
FCurve *fcu;
|
||||
int success= 0;
|
||||
int success = 0;
|
||||
|
||||
/* we don't check the validity of the path here yet, but it should be ok... */
|
||||
adt= BKE_animdata_from_id(id);
|
||||
adt = BKE_animdata_from_id(id);
|
||||
|
||||
if (adt) {
|
||||
if (array_index == -1) {
|
||||
/* step through all drivers, removing all of those with the same base path */
|
||||
FCurve *fcu_iter= adt->drivers.first;
|
||||
FCurve *fcu_iter = adt->drivers.first;
|
||||
|
||||
while ((fcu = iter_step_fcurve(fcu_iter, rna_path)) != NULL) {
|
||||
/* store the next fcurve for looping */
|
||||
fcu_iter= fcu->next;
|
||||
fcu_iter = fcu->next;
|
||||
|
||||
/* remove F-Curve from driver stack, then free it */
|
||||
BLI_remlink(&adt->drivers, fcu);
|
||||
@@ -258,9 +258,9 @@ short ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_pat
|
||||
else {
|
||||
/* find the matching driver and remove it only
|
||||
* Note: here is one of the places where we don't want new F-Curve + Driver added!
|
||||
* so 'add' var must be 0
|
||||
* so 'add' var must be 0
|
||||
*/
|
||||
fcu= verify_driver_fcurve(id, rna_path, array_index, 0);
|
||||
fcu = verify_driver_fcurve(id, rna_path, array_index, 0);
|
||||
if (fcu) {
|
||||
BLI_remlink(&adt->drivers, fcu);
|
||||
free_fcurve(fcu);
|
||||
@@ -286,7 +286,7 @@ void free_anim_drivers_copybuf(void)
|
||||
/* free the buffer F-Curve if it exists, as if it were just another F-Curve */
|
||||
if (channeldriver_copypaste_buf)
|
||||
free_fcurve(channeldriver_copypaste_buf);
|
||||
channeldriver_copypaste_buf= NULL;
|
||||
channeldriver_copypaste_buf = NULL;
|
||||
}
|
||||
|
||||
/* Checks if there is a driver in the copy/paste buffer */
|
||||
@@ -298,7 +298,7 @@ short ANIM_driver_can_paste(void)
|
||||
/* ------------------- */
|
||||
|
||||
/* Main Driver Management API calls:
|
||||
* Make a copy of the driver for the specified property on the given ID block
|
||||
* Make a copy of the driver for the specified property on the given ID block
|
||||
*/
|
||||
short ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
|
||||
{
|
||||
@@ -310,13 +310,13 @@ short ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int a
|
||||
RNA_id_pointer_create(id, &id_ptr);
|
||||
if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
|
||||
BKE_reportf(reports, RPT_ERROR,
|
||||
"Could not find Driver to copy, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
|
||||
id->name, rna_path);
|
||||
"Could not find Driver to copy, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
|
||||
id->name, rna_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* try to get F-Curve with Driver */
|
||||
fcu= verify_driver_fcurve(id, rna_path, array_index, 0);
|
||||
fcu = verify_driver_fcurve(id, rna_path, array_index, 0);
|
||||
|
||||
/* clear copy/paste buffer first (for consistency with other copy/paste buffers) */
|
||||
free_anim_drivers_copybuf();
|
||||
@@ -327,13 +327,13 @@ short ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int a
|
||||
* so that we don't end up wasting memory storing the path which won't get used ever...
|
||||
*/
|
||||
char *tmp_path = fcu->rna_path;
|
||||
fcu->rna_path= NULL;
|
||||
fcu->rna_path = NULL;
|
||||
|
||||
/* make a copy of the F-Curve with */
|
||||
channeldriver_copypaste_buf= copy_fcurve(fcu);
|
||||
channeldriver_copypaste_buf = copy_fcurve(fcu);
|
||||
|
||||
/* restore the path */
|
||||
fcu->rna_path= tmp_path;
|
||||
fcu->rna_path = tmp_path;
|
||||
|
||||
/* copied... */
|
||||
return 1;
|
||||
@@ -344,7 +344,7 @@ short ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int a
|
||||
}
|
||||
|
||||
/* Main Driver Management API calls:
|
||||
* Add a new driver for the specified property on the given ID block or replace an existing one
|
||||
* Add a new driver for the specified property on the given ID block or replace an existing one
|
||||
* with the driver + driver-curve data from the buffer
|
||||
*/
|
||||
short ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
|
||||
@@ -357,8 +357,8 @@ short ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int
|
||||
RNA_id_pointer_create(id, &id_ptr);
|
||||
if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
|
||||
BKE_reportf(reports, RPT_ERROR,
|
||||
"Could not paste Driver, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
|
||||
id->name, rna_path);
|
||||
"Could not paste Driver, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
|
||||
id->name, rna_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -369,25 +369,25 @@ short ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int
|
||||
}
|
||||
|
||||
/* create Driver F-Curve, but without data which will be copied across... */
|
||||
fcu= verify_driver_fcurve(id, rna_path, array_index, -1);
|
||||
fcu = verify_driver_fcurve(id, rna_path, array_index, -1);
|
||||
|
||||
if (fcu) {
|
||||
/* copy across the curve data from the buffer curve
|
||||
* NOTE: this step needs care to not miss new settings
|
||||
*/
|
||||
/* keyframes/samples */
|
||||
fcu->bezt= MEM_dupallocN(channeldriver_copypaste_buf->bezt);
|
||||
fcu->fpt= MEM_dupallocN(channeldriver_copypaste_buf->fpt);
|
||||
fcu->totvert= channeldriver_copypaste_buf->totvert;
|
||||
/* keyframes/samples */
|
||||
fcu->bezt = MEM_dupallocN(channeldriver_copypaste_buf->bezt);
|
||||
fcu->fpt = MEM_dupallocN(channeldriver_copypaste_buf->fpt);
|
||||
fcu->totvert = channeldriver_copypaste_buf->totvert;
|
||||
|
||||
/* modifiers */
|
||||
/* modifiers */
|
||||
copy_fmodifiers(&fcu->modifiers, &channeldriver_copypaste_buf->modifiers);
|
||||
|
||||
/* extrapolation mode */
|
||||
fcu->extend= channeldriver_copypaste_buf->extend;
|
||||
/* extrapolation mode */
|
||||
fcu->extend = channeldriver_copypaste_buf->extend;
|
||||
|
||||
/* the 'juicy' stuff - the driver */
|
||||
fcu->driver= fcurve_copy_driver(channeldriver_copypaste_buf->driver);
|
||||
/* the 'juicy' stuff - the driver */
|
||||
fcu->driver = fcurve_copy_driver(channeldriver_copypaste_buf->driver);
|
||||
}
|
||||
|
||||
/* done */
|
||||
@@ -407,7 +407,7 @@ short ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int
|
||||
*
|
||||
* > returns: MEM_alloc'd string representing the path to the property from the given PointerRNA
|
||||
*/
|
||||
static char *get_driver_path_hack (bContext *C, PointerRNA *ptr, PropertyRNA *prop)
|
||||
static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
|
||||
{
|
||||
ID *id = (ID *)ptr->id.data;
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
@@ -431,17 +431,17 @@ static char *get_driver_path_hack (bContext *C, PointerRNA *ptr, PropertyRNA *pr
|
||||
Material *ma = give_current_material(ob, ob->actcol);
|
||||
|
||||
/* assumes: material will only be shown if it is active objects's active material it's ok */
|
||||
if ((ID*)ma == id) {
|
||||
if ((ID *)ma == id) {
|
||||
/* create new path */
|
||||
// TODO: use RNA path functions to construct instead?
|
||||
path = BLI_sprintfN("material_slots[\"%s\"].material.%s",
|
||||
ma->id.name+2, basepath);
|
||||
ma->id.name + 2, basepath);
|
||||
|
||||
/* free old one */
|
||||
MEM_freeN(basepath);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ID_TE: /* textures */
|
||||
{
|
||||
@@ -449,17 +449,17 @@ static char *get_driver_path_hack (bContext *C, PointerRNA *ptr, PropertyRNA *pr
|
||||
Tex *tex = give_current_material_texture(ma);
|
||||
|
||||
/* assumes: texture will only be shown if it is active material's active texture it's ok */
|
||||
if ((ID*)tex == id) {
|
||||
if ((ID *)tex == id) {
|
||||
/* create new path */
|
||||
// TODO: use RNA path functions to construct step by step instead?
|
||||
path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s",
|
||||
ma->id.name+2, tex->id.name+2, basepath);
|
||||
ma->id.name + 2, tex->id.name + 2, basepath);
|
||||
|
||||
/* free old one */
|
||||
MEM_freeN(basepath);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
/* fix RNA pointer, as we've now changed the ID root by changing the paths */
|
||||
@@ -476,25 +476,25 @@ static char *get_driver_path_hack (bContext *C, PointerRNA *ptr, PropertyRNA *pr
|
||||
|
||||
/* Add Driver Button Operator ------------------------ */
|
||||
|
||||
static int add_driver_button_exec (bContext *C, wmOperator *op)
|
||||
static int add_driver_button_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr= {{NULL}};
|
||||
PropertyRNA *prop= NULL;
|
||||
short success= 0;
|
||||
int index, all= RNA_boolean_get(op->ptr, "all");
|
||||
PointerRNA ptr = {{NULL}};
|
||||
PropertyRNA *prop = NULL;
|
||||
short success = 0;
|
||||
int index, all = RNA_boolean_get(op->ptr, "all");
|
||||
|
||||
/* try to create driver using property retrieved from UI */
|
||||
uiContextActiveProperty(C, &ptr, &prop, &index);
|
||||
|
||||
if (all)
|
||||
index= -1;
|
||||
index = -1;
|
||||
|
||||
if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
|
||||
char *path= get_driver_path_hack(C, &ptr, prop);
|
||||
char *path = get_driver_path_hack(C, &ptr, prop);
|
||||
short flags = CREATEDRIVER_WITH_DEFAULT_DVAR;
|
||||
|
||||
if (path) {
|
||||
success+= ANIM_add_driver(op->reports, ptr.id.data, path, index, flags, DRIVER_TYPE_PYTHON);
|
||||
success += ANIM_add_driver(op->reports, ptr.id.data, path, index, flags, DRIVER_TYPE_PYTHON);
|
||||
|
||||
MEM_freeN(path);
|
||||
}
|
||||
@@ -506,10 +506,10 @@ static int add_driver_button_exec (bContext *C, wmOperator *op)
|
||||
|
||||
DAG_ids_flush_update(CTX_data_main(C), 0);
|
||||
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_FCURVES_ORDER, NULL); // XXX
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
|
||||
}
|
||||
|
||||
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
|
||||
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
void ANIM_OT_driver_button_add(wmOperatorType *ot)
|
||||
@@ -524,7 +524,7 @@ void ANIM_OT_driver_button_add(wmOperatorType *ot)
|
||||
//op->poll= ??? // TODO: need to have some animatable property to do this
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "all", 1, "All", "Create drivers for all elements of the array");
|
||||
@@ -532,23 +532,23 @@ void ANIM_OT_driver_button_add(wmOperatorType *ot)
|
||||
|
||||
/* Remove Driver Button Operator ------------------------ */
|
||||
|
||||
static int remove_driver_button_exec (bContext *C, wmOperator *op)
|
||||
static int remove_driver_button_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr= {{NULL}};
|
||||
PropertyRNA *prop= NULL;
|
||||
short success= 0;
|
||||
int index, all= RNA_boolean_get(op->ptr, "all");
|
||||
PointerRNA ptr = {{NULL}};
|
||||
PropertyRNA *prop = NULL;
|
||||
short success = 0;
|
||||
int index, all = RNA_boolean_get(op->ptr, "all");
|
||||
|
||||
/* try to find driver using property retrieved from UI */
|
||||
uiContextActiveProperty(C, &ptr, &prop, &index);
|
||||
|
||||
if (all)
|
||||
index= -1;
|
||||
index = -1;
|
||||
|
||||
if (ptr.id.data && ptr.data && prop) {
|
||||
char *path= get_driver_path_hack(C, &ptr, prop);
|
||||
char *path = get_driver_path_hack(C, &ptr, prop);
|
||||
|
||||
success= ANIM_remove_driver(op->reports, ptr.id.data, path, index, 0);
|
||||
success = ANIM_remove_driver(op->reports, ptr.id.data, path, index, 0);
|
||||
MEM_freeN(path);
|
||||
}
|
||||
|
||||
@@ -558,10 +558,10 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op)
|
||||
|
||||
DAG_ids_flush_update(CTX_data_main(C), 0);
|
||||
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_FCURVES_ORDER, NULL); // XXX
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
|
||||
}
|
||||
|
||||
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
|
||||
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
void ANIM_OT_driver_button_remove(wmOperatorType *ot)
|
||||
@@ -576,7 +576,7 @@ void ANIM_OT_driver_button_remove(wmOperatorType *ot)
|
||||
//op->poll= ??? // TODO: need to have some driver to be able to do this...
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "all", 1, "All", "Delete drivers for all elements of the array");
|
||||
@@ -584,22 +584,22 @@ void ANIM_OT_driver_button_remove(wmOperatorType *ot)
|
||||
|
||||
/* Copy Driver Button Operator ------------------------ */
|
||||
|
||||
static int copy_driver_button_exec (bContext *C, wmOperator *op)
|
||||
static int copy_driver_button_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr= {{NULL}};
|
||||
PropertyRNA *prop= NULL;
|
||||
short success= 0;
|
||||
PointerRNA ptr = {{NULL}};
|
||||
PropertyRNA *prop = NULL;
|
||||
short success = 0;
|
||||
int index;
|
||||
|
||||
/* try to create driver using property retrieved from UI */
|
||||
uiContextActiveProperty(C, &ptr, &prop, &index);
|
||||
|
||||
if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
|
||||
char *path= get_driver_path_hack(C, &ptr, prop);
|
||||
char *path = get_driver_path_hack(C, &ptr, prop);
|
||||
|
||||
if (path) {
|
||||
/* only copy the driver for the button that this was involved for */
|
||||
success= ANIM_copy_driver(op->reports, ptr.id.data, path, index, 0);
|
||||
success = ANIM_copy_driver(op->reports, ptr.id.data, path, index, 0);
|
||||
|
||||
uiContextAnimUpdate(C);
|
||||
|
||||
@@ -608,7 +608,7 @@ static int copy_driver_button_exec (bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* since we're just copying, we don't really need to do anything else...*/
|
||||
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
|
||||
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
void ANIM_OT_copy_driver_button(wmOperatorType *ot)
|
||||
@@ -623,27 +623,27 @@ void ANIM_OT_copy_driver_button(wmOperatorType *ot)
|
||||
//op->poll= ??? // TODO: need to have some driver to be able to do this...
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* Paste Driver Button Operator ------------------------ */
|
||||
|
||||
static int paste_driver_button_exec (bContext *C, wmOperator *op)
|
||||
static int paste_driver_button_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr= {{NULL}};
|
||||
PropertyRNA *prop= NULL;
|
||||
short success= 0;
|
||||
PointerRNA ptr = {{NULL}};
|
||||
PropertyRNA *prop = NULL;
|
||||
short success = 0;
|
||||
int index;
|
||||
|
||||
/* try to create driver using property retrieved from UI */
|
||||
uiContextActiveProperty(C, &ptr, &prop, &index);
|
||||
|
||||
if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
|
||||
char *path= get_driver_path_hack(C, &ptr, prop);
|
||||
char *path = get_driver_path_hack(C, &ptr, prop);
|
||||
|
||||
if (path) {
|
||||
/* only copy the driver for the button that this was involved for */
|
||||
success= ANIM_paste_driver(op->reports, ptr.id.data, path, index, 0);
|
||||
success = ANIM_paste_driver(op->reports, ptr.id.data, path, index, 0);
|
||||
|
||||
uiContextAnimUpdate(C);
|
||||
|
||||
@@ -652,7 +652,7 @@ static int paste_driver_button_exec (bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* since we're just copying, we don't really need to do anything else...*/
|
||||
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
|
||||
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
void ANIM_OT_paste_driver_button(wmOperatorType *ot)
|
||||
@@ -667,7 +667,7 @@ void ANIM_OT_paste_driver_button(wmOperatorType *ot)
|
||||
//op->poll= ??? // TODO: need to have some driver to be able to do this...
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ************************************************** */
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
#include "BKE_key.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_global.h" // XXX remove me!
|
||||
#include "BKE_global.h" // XXX remove me!
|
||||
|
||||
|
||||
#include "BIF_gl.h"
|
||||
@@ -82,8 +82,8 @@
|
||||
/* NOTE: this is exported to other modules that use the ActKeyColumns for finding keyframes */
|
||||
short compare_ak_cfraPtr(void *node, void *data)
|
||||
{
|
||||
ActKeyColumn *ak= (ActKeyColumn *)node;
|
||||
float *cframe= data;
|
||||
ActKeyColumn *ak = (ActKeyColumn *)node;
|
||||
float *cframe = data;
|
||||
|
||||
if (*cframe < ak->cfra)
|
||||
return -1;
|
||||
@@ -96,10 +96,10 @@ short compare_ak_cfraPtr(void *node, void *data)
|
||||
/* --------------- */
|
||||
|
||||
/* Comparator callback used for ActKeyColumns and BezTriple */
|
||||
static short compare_ak_bezt (void *node, void *data)
|
||||
static short compare_ak_bezt(void *node, void *data)
|
||||
{
|
||||
ActKeyColumn *ak= (ActKeyColumn *)node;
|
||||
BezTriple *bezt= (BezTriple *)data;
|
||||
ActKeyColumn *ak = (ActKeyColumn *)node;
|
||||
BezTriple *bezt = (BezTriple *)data;
|
||||
|
||||
if (bezt->vec[1][0] < ak->cfra)
|
||||
return -1;
|
||||
@@ -110,15 +110,15 @@ static short compare_ak_bezt (void *node, void *data)
|
||||
}
|
||||
|
||||
/* New node callback used for building ActKeyColumns from BezTriples */
|
||||
static DLRBT_Node *nalloc_ak_bezt (void *data)
|
||||
static DLRBT_Node *nalloc_ak_bezt(void *data)
|
||||
{
|
||||
ActKeyColumn *ak= MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn");
|
||||
BezTriple *bezt= (BezTriple *)data;
|
||||
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn");
|
||||
BezTriple *bezt = (BezTriple *)data;
|
||||
|
||||
/* store settings based on state of BezTriple */
|
||||
ak->cfra= bezt->vec[1][0];
|
||||
ak->sel= BEZSELECTED(bezt) ? SELECT : 0;
|
||||
ak->key_type= BEZKEYTYPE(bezt);
|
||||
ak->cfra = bezt->vec[1][0];
|
||||
ak->sel = BEZSELECTED(bezt) ? SELECT : 0;
|
||||
ak->key_type = BEZKEYTYPE(bezt);
|
||||
|
||||
/* set 'modified', since this is used to identify long keyframes */
|
||||
ak->modified = 1;
|
||||
@@ -127,10 +127,10 @@ static DLRBT_Node *nalloc_ak_bezt (void *data)
|
||||
}
|
||||
|
||||
/* Node updater callback used for building ActKeyColumns from BezTriples */
|
||||
static void nupdate_ak_bezt (void *node, void *data)
|
||||
static void nupdate_ak_bezt(void *node, void *data)
|
||||
{
|
||||
ActKeyColumn *ak= (ActKeyColumn *)node;
|
||||
BezTriple *bezt= (BezTriple *)data;
|
||||
ActKeyColumn *ak = (ActKeyColumn *)node;
|
||||
BezTriple *bezt = (BezTriple *)data;
|
||||
|
||||
/* set selection status and 'touched' status */
|
||||
if (BEZSELECTED(bezt)) ak->sel = SELECT;
|
||||
@@ -138,16 +138,16 @@ static void nupdate_ak_bezt (void *node, void *data)
|
||||
|
||||
/* for keyframe type, 'proper' keyframes have priority over breakdowns (and other types for now) */
|
||||
if (BEZKEYTYPE(bezt) == BEZT_KEYTYPE_KEYFRAME)
|
||||
ak->key_type= BEZT_KEYTYPE_KEYFRAME;
|
||||
ak->key_type = BEZT_KEYTYPE_KEYFRAME;
|
||||
}
|
||||
|
||||
/* ......... */
|
||||
|
||||
/* Comparator callback used for ActKeyColumns and GPencil frame */
|
||||
static short compare_ak_gpframe (void *node, void *data)
|
||||
static short compare_ak_gpframe(void *node, void *data)
|
||||
{
|
||||
ActKeyColumn *ak= (ActKeyColumn *)node;
|
||||
bGPDframe *gpf= (bGPDframe *)data;
|
||||
ActKeyColumn *ak = (ActKeyColumn *)node;
|
||||
bGPDframe *gpf = (bGPDframe *)data;
|
||||
|
||||
if (gpf->framenum < ak->cfra)
|
||||
return -1;
|
||||
@@ -158,14 +158,14 @@ static short compare_ak_gpframe (void *node, void *data)
|
||||
}
|
||||
|
||||
/* New node callback used for building ActKeyColumns from GPencil frames */
|
||||
static DLRBT_Node *nalloc_ak_gpframe (void *data)
|
||||
static DLRBT_Node *nalloc_ak_gpframe(void *data)
|
||||
{
|
||||
ActKeyColumn *ak= MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
|
||||
bGPDframe *gpf= (bGPDframe *)data;
|
||||
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
|
||||
bGPDframe *gpf = (bGPDframe *)data;
|
||||
|
||||
/* store settings based on state of BezTriple */
|
||||
ak->cfra= gpf->framenum;
|
||||
ak->sel= (gpf->flag & GP_FRAME_SELECT) ? SELECT : 0;
|
||||
ak->cfra = gpf->framenum;
|
||||
ak->sel = (gpf->flag & GP_FRAME_SELECT) ? SELECT : 0;
|
||||
|
||||
/* set 'modified', since this is used to identify long keyframes */
|
||||
ak->modified = 1;
|
||||
@@ -174,10 +174,10 @@ static DLRBT_Node *nalloc_ak_gpframe (void *data)
|
||||
}
|
||||
|
||||
/* Node updater callback used for building ActKeyColumns from GPencil frames */
|
||||
static void nupdate_ak_gpframe (void *node, void *data)
|
||||
static void nupdate_ak_gpframe(void *node, void *data)
|
||||
{
|
||||
ActKeyColumn *ak= (ActKeyColumn *)node;
|
||||
bGPDframe *gpf= (bGPDframe *)data;
|
||||
ActKeyColumn *ak = (ActKeyColumn *)node;
|
||||
bGPDframe *gpf = (bGPDframe *)data;
|
||||
|
||||
/* set selection status and 'touched' status */
|
||||
if (gpf->flag & GP_FRAME_SELECT) ak->sel = SELECT;
|
||||
@@ -207,36 +207,36 @@ static void add_gpframe_to_keycolumns_list(DLRBT_Tree *keys, bGPDframe *gpf)
|
||||
/* ActBeztColumns (Helpers for Long Keyframes) ------------------------------ */
|
||||
|
||||
/* maximum size of default buffer for BezTriple columns */
|
||||
#define MAX_ABK_BUFSIZE 4
|
||||
#define MAX_ABK_BUFSIZE 4
|
||||
|
||||
/* BezTriple Container Node */
|
||||
// NOTE: only used internally while building Long Keyframes for now, but may be useful externally?
|
||||
typedef struct ActBeztColumn {
|
||||
/* Tree Node interface ---------------- */
|
||||
/* ListBase linkage */
|
||||
/* ListBase linkage */
|
||||
struct ActBeztColumn *next, *prev;
|
||||
|
||||
/* sorting-tree linkage */
|
||||
struct ActBeztColumn *left, *right; /* 'children' of this node, less than and greater than it (respectively) */
|
||||
struct ActBeztColumn *parent; /* parent of this node in the tree */
|
||||
char tree_col; /* DLRB_BLACK or DLRB_RED */
|
||||
/* sorting-tree linkage */
|
||||
struct ActBeztColumn *left, *right; /* 'children' of this node, less than and greater than it (respectively) */
|
||||
struct ActBeztColumn *parent; /* parent of this node in the tree */
|
||||
char tree_col; /* DLRB_BLACK or DLRB_RED */
|
||||
char pad;
|
||||
|
||||
/* BezTriple Store -------------------- */
|
||||
short numBezts; /* number of BezTriples on this frame */
|
||||
float cfra; /* frame that the BezTriples occur on */
|
||||
short numBezts; /* number of BezTriples on this frame */
|
||||
float cfra; /* frame that the BezTriples occur on */
|
||||
|
||||
BezTriple *bezts[MAX_ABK_BUFSIZE]; /* buffer of pointers to BezTriples on the same frame */
|
||||
BezTriple *bezts[MAX_ABK_BUFSIZE]; /* buffer of pointers to BezTriples on the same frame */
|
||||
//BezTriple **bezts_extra; /* secondary buffer of pointers if need be */
|
||||
} ActBeztColumn;
|
||||
|
||||
/* --------------- */
|
||||
|
||||
/* Comparator callback used for ActBeztColumns and BezTriple */
|
||||
static short compare_abk_bezt (void *node, void *data)
|
||||
static short compare_abk_bezt(void *node, void *data)
|
||||
{
|
||||
ActBeztColumn *abk= (ActBeztColumn *)node;
|
||||
BezTriple *bezt= (BezTriple *)data;
|
||||
ActBeztColumn *abk = (ActBeztColumn *)node;
|
||||
BezTriple *bezt = (BezTriple *)data;
|
||||
|
||||
if (bezt->vec[1][0] < abk->cfra)
|
||||
return -1;
|
||||
@@ -247,23 +247,23 @@ static short compare_abk_bezt (void *node, void *data)
|
||||
}
|
||||
|
||||
/* New node callback used for building ActBeztColumns from BezTriples */
|
||||
static DLRBT_Node *nalloc_abk_bezt (void *data)
|
||||
static DLRBT_Node *nalloc_abk_bezt(void *data)
|
||||
{
|
||||
ActBeztColumn *abk= MEM_callocN(sizeof(ActBeztColumn), "ActKeyColumn");
|
||||
BezTriple *bezt= (BezTriple *)data;
|
||||
ActBeztColumn *abk = MEM_callocN(sizeof(ActBeztColumn), "ActKeyColumn");
|
||||
BezTriple *bezt = (BezTriple *)data;
|
||||
|
||||
/* store the BeztTriple in the buffer, and keep track of its frame number */
|
||||
abk->cfra= bezt->vec[1][0];
|
||||
abk->bezts[abk->numBezts++]= bezt;
|
||||
abk->cfra = bezt->vec[1][0];
|
||||
abk->bezts[abk->numBezts++] = bezt;
|
||||
|
||||
return (DLRBT_Node *)abk;
|
||||
}
|
||||
|
||||
/* Node updater callback used for building ActBeztColumns from BezTriples */
|
||||
static void nupdate_abk_bezt (void *node, void *data)
|
||||
static void nupdate_abk_bezt(void *node, void *data)
|
||||
{
|
||||
ActBeztColumn *abk= (ActBeztColumn *)node;
|
||||
BezTriple *bezt= (BezTriple *)data;
|
||||
ActBeztColumn *abk = (ActBeztColumn *)node;
|
||||
BezTriple *bezt = (BezTriple *)data;
|
||||
|
||||
/* just add the BezTriple to the buffer if there's space, or allocate a new one */
|
||||
if (abk->numBezts >= MAX_ABK_BUFSIZE) {
|
||||
@@ -274,14 +274,14 @@ static void nupdate_abk_bezt (void *node, void *data)
|
||||
}
|
||||
else {
|
||||
/* just store an extra one */
|
||||
abk->bezts[abk->numBezts++]= bezt;
|
||||
abk->bezts[abk->numBezts++] = bezt;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- */
|
||||
|
||||
/* Return the BezTriple in the given ActBeztColumn that matches the requested value */
|
||||
static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
|
||||
static BezTriple *abk_get_bezt_with_value(ActBeztColumn *abk, float value)
|
||||
{
|
||||
BezTriple *bezt;
|
||||
int i;
|
||||
@@ -293,12 +293,12 @@ static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
|
||||
/* look over each BezTriple in this container */
|
||||
for (i = 0; i < abk->numBezts; i++) {
|
||||
/* only do exact match for now... */
|
||||
if (/*i >= MAX_ABK_BUFSIZE*/0) {
|
||||
if (/*i >= MAX_ABK_BUFSIZE*/ 0) {
|
||||
// TODO: this case needs special handling
|
||||
}
|
||||
else {
|
||||
/* just use the default buffer */
|
||||
bezt= abk->bezts[i];
|
||||
bezt = abk->bezts[i];
|
||||
|
||||
if (bezt->vec[1][1] == value)
|
||||
return bezt;
|
||||
@@ -314,8 +314,8 @@ static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
|
||||
/* NOTE: this is exported to other modules that use the ActKeyBlocks for finding long-keyframes */
|
||||
short compare_ab_cfraPtr(void *node, void *data)
|
||||
{
|
||||
ActKeyBlock *ab= (ActKeyBlock *)node;
|
||||
float *cframe= data;
|
||||
ActKeyBlock *ab = (ActKeyBlock *)node;
|
||||
float *cframe = data;
|
||||
|
||||
if (*cframe < ab->start)
|
||||
return -1;
|
||||
@@ -330,13 +330,13 @@ short compare_ab_cfraPtr(void *node, void *data)
|
||||
/* Create a ActKeyColumn for a pair of BezTriples */
|
||||
static ActKeyBlock *bezts_to_new_actkeyblock(BezTriple *prev, BezTriple *beztn)
|
||||
{
|
||||
ActKeyBlock *ab= MEM_callocN(sizeof(ActKeyBlock), "ActKeyBlock");
|
||||
ActKeyBlock *ab = MEM_callocN(sizeof(ActKeyBlock), "ActKeyBlock");
|
||||
|
||||
ab->start= prev->vec[1][0];
|
||||
ab->end= beztn->vec[1][0];
|
||||
ab->val= beztn->vec[1][1];
|
||||
ab->start = prev->vec[1][0];
|
||||
ab->end = beztn->vec[1][0];
|
||||
ab->val = beztn->vec[1][1];
|
||||
|
||||
ab->sel= (BEZSELECTED(prev) || BEZSELECTED(beztn)) ? SELECT : 0;
|
||||
ab->sel = (BEZSELECTED(prev) || BEZSELECTED(beztn)) ? SELECT : 0;
|
||||
ab->modified = 1;
|
||||
|
||||
return ab;
|
||||
@@ -344,44 +344,44 @@ static ActKeyBlock *bezts_to_new_actkeyblock(BezTriple *prev, BezTriple *beztn)
|
||||
|
||||
static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree, BezTriple *beztn)
|
||||
{
|
||||
ActKeyBlock *new_ab= NULL;
|
||||
ActKeyBlock *new_ab = NULL;
|
||||
ActBeztColumn *abk;
|
||||
BezTriple *prev;
|
||||
|
||||
/* get the BezTriple immediately before the given one which has the same value */
|
||||
/* the keyframes immediately before the ones containing the specified keyframe */
|
||||
abk= (ActBeztColumn *)BLI_dlrbTree_search_prev(beztTree, compare_abk_bezt, beztn);
|
||||
/* if applicable, the BezTriple with the same value */
|
||||
prev= (abk) ? abk_get_bezt_with_value(abk, beztn->vec[1][1]) : NULL;
|
||||
/* the keyframes immediately before the ones containing the specified keyframe */
|
||||
abk = (ActBeztColumn *)BLI_dlrbTree_search_prev(beztTree, compare_abk_bezt, beztn);
|
||||
/* if applicable, the BezTriple with the same value */
|
||||
prev = (abk) ? abk_get_bezt_with_value(abk, beztn->vec[1][1]) : NULL;
|
||||
|
||||
/* check if block needed - same value(s)?
|
||||
* -> firstly, handles must have same central value as each other
|
||||
* -> secondly, handles which control that section of the curve must be constant
|
||||
*/
|
||||
if ((!prev) || (!beztn)) return;
|
||||
if (IS_EQF(beztn->vec[1][1], prev->vec[1][1])==0) return;
|
||||
if (IS_EQF(beztn->vec[1][1], beztn->vec[0][1])==0) return;
|
||||
if (IS_EQF(prev->vec[1][1], prev->vec[2][1])==0) return;
|
||||
if (IS_EQF(beztn->vec[1][1], prev->vec[1][1]) == 0) return;
|
||||
if (IS_EQF(beztn->vec[1][1], beztn->vec[0][1]) == 0) return;
|
||||
if (IS_EQF(prev->vec[1][1], prev->vec[2][1]) == 0) return;
|
||||
|
||||
|
||||
/* if there are no blocks already, just add as root */
|
||||
if (blocks->root == NULL) {
|
||||
/* just add this as the root, then call the tree-balancing functions to validate */
|
||||
new_ab= bezts_to_new_actkeyblock(prev, beztn);
|
||||
blocks->root= (DLRBT_Node *)new_ab;
|
||||
new_ab = bezts_to_new_actkeyblock(prev, beztn);
|
||||
blocks->root = (DLRBT_Node *)new_ab;
|
||||
}
|
||||
else {
|
||||
ActKeyBlock *ab, *abn=NULL;
|
||||
ActKeyBlock *ab, *abn = NULL;
|
||||
|
||||
/* try to find a keyblock that starts on the previous beztriple, and add a new one if none start there
|
||||
* Note: we can't search from end to try to optimize this as it causes errors there's
|
||||
* an A ___ B |---| B situation
|
||||
* an A ___ B |---| B situation
|
||||
*/
|
||||
// FIXME: here there is a bug where we are trying to get the summary for the following channels
|
||||
// A|--------------|A ______________ B|--------------|B
|
||||
// A|------------------------------------------------|A
|
||||
// A|----|A|---|A|-----------------------------------|A
|
||||
for (ab= blocks->root; ab; ab= abn) {
|
||||
for (ab = blocks->root; ab; ab = abn) {
|
||||
/* check if this is a match, or whether we go left or right */
|
||||
if (ab->start == prev->vec[1][0]) {
|
||||
/* set selection status and 'touched' status */
|
||||
@@ -392,24 +392,24 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ActKeyBlock **abnp= NULL;
|
||||
ActKeyBlock **abnp = NULL;
|
||||
|
||||
/* check if go left or right, but if not available, add new node */
|
||||
if (ab->start < prev->vec[1][0])
|
||||
abnp= &ab->right;
|
||||
abnp = &ab->right;
|
||||
else
|
||||
abnp= &ab->left;
|
||||
abnp = &ab->left;
|
||||
|
||||
/* if this does not exist, add a new node, otherwise continue... */
|
||||
if (*abnp == NULL) {
|
||||
/* add a new node representing this, and attach it to the relevant place */
|
||||
new_ab= bezts_to_new_actkeyblock(prev, beztn);
|
||||
new_ab->parent= ab;
|
||||
*abnp= new_ab;
|
||||
new_ab = bezts_to_new_actkeyblock(prev, beztn);
|
||||
new_ab->parent = ab;
|
||||
*abnp = new_ab;
|
||||
break;
|
||||
}
|
||||
else
|
||||
abn= *abnp;
|
||||
abn = *abnp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,7 +421,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
|
||||
/* --------- */
|
||||
|
||||
/* Handle the 'touched' status of ActKeyColumn tree nodes */
|
||||
static void set_touched_actkeycolumn (ActKeyColumn *ak)
|
||||
static void set_touched_actkeycolumn(ActKeyColumn *ak)
|
||||
{
|
||||
/* sanity check */
|
||||
if (ak == NULL)
|
||||
@@ -429,7 +429,7 @@ static void set_touched_actkeycolumn (ActKeyColumn *ak)
|
||||
|
||||
/* deal with self first */
|
||||
if (ak->modified) {
|
||||
ak->modified= 0;
|
||||
ak->modified = 0;
|
||||
ak->totcurve++;
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ static void set_touched_actkeycolumn (ActKeyColumn *ak)
|
||||
}
|
||||
|
||||
/* Handle the 'touched' status of ActKeyBlock tree nodes */
|
||||
static void set_touched_actkeyblock (ActKeyBlock *ab)
|
||||
static void set_touched_actkeyblock(ActKeyBlock *ab)
|
||||
{
|
||||
/* sanity check */
|
||||
if (ab == NULL)
|
||||
@@ -447,7 +447,7 @@ static void set_touched_actkeyblock (ActKeyBlock *ab)
|
||||
|
||||
/* deal with self first */
|
||||
if (ab->modified) {
|
||||
ab->modified= 0;
|
||||
ab->modified = 0;
|
||||
ab->totcurve++;
|
||||
}
|
||||
|
||||
@@ -469,17 +469,17 @@ short actkeyblock_is_valid(ActKeyBlock *ab, DLRBT_Tree *keys)
|
||||
return 0;
|
||||
|
||||
/* find out how many curves occur at each keyframe */
|
||||
ak= (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->start);
|
||||
startCurves = (ak)? ak->totcurve: 0;
|
||||
ak = (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->start);
|
||||
startCurves = (ak) ? ak->totcurve : 0;
|
||||
|
||||
ak= (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->end);
|
||||
endCurves = (ak)? ak->totcurve: 0;
|
||||
ak = (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->end);
|
||||
endCurves = (ak) ? ak->totcurve : 0;
|
||||
|
||||
/* only draw keyblock if it appears in at all of the keyframes at lowest end */
|
||||
if (!startCurves && !endCurves)
|
||||
return 0;
|
||||
|
||||
totCurves = (startCurves>endCurves)? endCurves: startCurves;
|
||||
totCurves = (startCurves > endCurves) ? endCurves : startCurves;
|
||||
return (ab->totcurve >= totCurves);
|
||||
}
|
||||
|
||||
@@ -487,52 +487,54 @@ short actkeyblock_is_valid(ActKeyBlock *ab, DLRBT_Tree *keys)
|
||||
|
||||
/* coordinates for diamond shape */
|
||||
static const float _unit_diamond_shape[4][2] = {
|
||||
{0.0f, 1.0f}, /* top vert */
|
||||
{1.0f, 0.0f}, /* mid-right */
|
||||
{0.0f, -1.0f}, /* bottom vert */
|
||||
{-1.0f, 0.0f} /* mid-left */
|
||||
{0.0f, 1.0f}, /* top vert */
|
||||
{1.0f, 0.0f}, /* mid-right */
|
||||
{0.0f, -1.0f}, /* bottom vert */
|
||||
{-1.0f, 0.0f} /* mid-left */
|
||||
};
|
||||
|
||||
/* draw a simple diamond shape with OpenGL */
|
||||
void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
|
||||
{
|
||||
static GLuint displist1=0;
|
||||
static GLuint displist2=0;
|
||||
static GLuint displist1 = 0;
|
||||
static GLuint displist2 = 0;
|
||||
|
||||
/* initialize 2 display lists for diamond shape - one empty, one filled */
|
||||
if (displist1 == 0) {
|
||||
displist1= glGenLists(1);
|
||||
glNewList(displist1, GL_COMPILE);
|
||||
displist1 = glGenLists(1);
|
||||
glNewList(displist1, GL_COMPILE);
|
||||
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2fv(_unit_diamond_shape[0]);
|
||||
glVertex2fv(_unit_diamond_shape[1]);
|
||||
glVertex2fv(_unit_diamond_shape[2]);
|
||||
glVertex2fv(_unit_diamond_shape[3]);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2fv(_unit_diamond_shape[0]);
|
||||
glVertex2fv(_unit_diamond_shape[1]);
|
||||
glVertex2fv(_unit_diamond_shape[2]);
|
||||
glVertex2fv(_unit_diamond_shape[3]);
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
}
|
||||
if (displist2 == 0) {
|
||||
displist2= glGenLists(1);
|
||||
glNewList(displist2, GL_COMPILE);
|
||||
displist2 = glGenLists(1);
|
||||
glNewList(displist2, GL_COMPILE);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2fv(_unit_diamond_shape[0]);
|
||||
glVertex2fv(_unit_diamond_shape[1]);
|
||||
glVertex2fv(_unit_diamond_shape[2]);
|
||||
glVertex2fv(_unit_diamond_shape[3]);
|
||||
glEnd();
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2fv(_unit_diamond_shape[0]);
|
||||
glVertex2fv(_unit_diamond_shape[1]);
|
||||
glVertex2fv(_unit_diamond_shape[2]);
|
||||
glVertex2fv(_unit_diamond_shape[3]);
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
/* tweak size of keyframe shape according to type of keyframe
|
||||
* - 'proper' keyframes have key_type=0, so get drawn at full size
|
||||
* - 'proper' keyframes have key_type=0, so get drawn at full size
|
||||
*/
|
||||
hsize -= 0.5f*key_type;
|
||||
hsize -= 0.5f * key_type;
|
||||
|
||||
/* adjust view transform before starting */
|
||||
glTranslatef(x, y, 0.0f);
|
||||
glScalef(1.0f/xscale*hsize, hsize, 1.0f);
|
||||
glScalef(1.0f / xscale * hsize, hsize, 1.0f);
|
||||
|
||||
/* anti-aliased lines for more consistent appearance */
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
@@ -546,29 +548,29 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
|
||||
if (sel) glColor4f(0.33f, 0.75f, 0.93f, alpha);
|
||||
else glColor4f(0.70f, 0.86f, 0.91f, alpha);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case BEZT_KEYTYPE_EXTREME: /* redish frames for now */
|
||||
{
|
||||
if (sel) glColor4f(0.95f, 0.5f, 0.5f, alpha);
|
||||
else glColor4f(0.91f, 0.70f, 0.80f, alpha);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case BEZT_KEYTYPE_JITTER: /* greenish frames for now? */
|
||||
{
|
||||
if (sel) glColor4f(0.38f, 0.75f, 0.26f, alpha);
|
||||
else glColor4f(0.58f, 0.90f, 0.46f, alpha);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames for now */
|
||||
default:
|
||||
{
|
||||
if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255*(1.0f-alpha));
|
||||
if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255 * (1.0f - alpha));
|
||||
else glColor4f(0.91f, 0.91f, 0.91f, alpha);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
glCallList(displist2);
|
||||
@@ -584,7 +586,7 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
|
||||
/* restore view transform */
|
||||
glScalef(xscale/hsize, 1.0f/hsize, 1.0);
|
||||
glScalef(xscale / hsize, 1.0f / hsize, 1.0f);
|
||||
glTranslatef(-x, -y, 0.0f);
|
||||
}
|
||||
|
||||
@@ -601,7 +603,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
|
||||
|
||||
/* draw keyblocks */
|
||||
if (blocks) {
|
||||
for (ab= blocks->first; ab; ab= ab->next) {
|
||||
for (ab = blocks->first; ab; ab = ab->next) {
|
||||
if (actkeyblock_is_valid(ab, keys)) {
|
||||
/* draw block */
|
||||
if (ab->sel)
|
||||
@@ -609,7 +611,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
|
||||
else
|
||||
UI_ThemeColor4(TH_STRIP);
|
||||
|
||||
glRectf(ab->start, ypos-5, ab->end, ypos+5);
|
||||
glRectf(ab->start, ypos - 5, ab->end, ypos + 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -618,9 +620,9 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
|
||||
if (keys) {
|
||||
/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
|
||||
// TODO: allow this opacity factor to be themed?
|
||||
float kalpha = (channelLocked)? 0.35f : 1.0f;
|
||||
float kalpha = (channelLocked) ? 0.35f : 1.0f;
|
||||
|
||||
for (ak= keys->first; ak; ak= ak->next) {
|
||||
for (ak = keys->first; ak; ak = ak->next) {
|
||||
/* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw
|
||||
* - this might give some improvements, since we current have to flip between view/region matrices
|
||||
*/
|
||||
@@ -646,12 +648,12 @@ void draw_summary_channel(View2D *v2d, bAnimContext *ac, float ypos)
|
||||
BLI_dlrbTree_init(&keys);
|
||||
BLI_dlrbTree_init(&blocks);
|
||||
|
||||
summary_to_keylist(ac, &keys, &blocks);
|
||||
summary_to_keylist(ac, &keys, &blocks);
|
||||
|
||||
BLI_dlrbTree_linkedlist_sync(&keys);
|
||||
BLI_dlrbTree_linkedlist_sync(&blocks);
|
||||
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, 0);
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, 0);
|
||||
|
||||
BLI_dlrbTree_free(&keys);
|
||||
BLI_dlrbTree_free(&blocks);
|
||||
@@ -664,12 +666,12 @@ void draw_scene_channel(View2D *v2d, bDopeSheet *ads, Scene *sce, float ypos)
|
||||
BLI_dlrbTree_init(&keys);
|
||||
BLI_dlrbTree_init(&blocks);
|
||||
|
||||
scene_to_keylist(ads, sce, &keys, &blocks);
|
||||
scene_to_keylist(ads, sce, &keys, &blocks);
|
||||
|
||||
BLI_dlrbTree_linkedlist_sync(&keys);
|
||||
BLI_dlrbTree_linkedlist_sync(&blocks);
|
||||
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, 0);
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, 0);
|
||||
|
||||
BLI_dlrbTree_free(&keys);
|
||||
BLI_dlrbTree_free(&blocks);
|
||||
@@ -682,12 +684,12 @@ void draw_object_channel(View2D *v2d, bDopeSheet *ads, Object *ob, float ypos)
|
||||
BLI_dlrbTree_init(&keys);
|
||||
BLI_dlrbTree_init(&blocks);
|
||||
|
||||
ob_to_keylist(ads, ob, &keys, &blocks);
|
||||
ob_to_keylist(ads, ob, &keys, &blocks);
|
||||
|
||||
BLI_dlrbTree_linkedlist_sync(&keys);
|
||||
BLI_dlrbTree_linkedlist_sync(&blocks);
|
||||
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, 0);
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, 0);
|
||||
|
||||
BLI_dlrbTree_free(&keys);
|
||||
BLI_dlrbTree_free(&blocks);
|
||||
@@ -700,12 +702,12 @@ void draw_fcurve_channel(View2D *v2d, AnimData *adt, FCurve *fcu, float ypos)
|
||||
BLI_dlrbTree_init(&keys);
|
||||
BLI_dlrbTree_init(&blocks);
|
||||
|
||||
fcurve_to_keylist(adt, fcu, &keys, &blocks);
|
||||
fcurve_to_keylist(adt, fcu, &keys, &blocks);
|
||||
|
||||
BLI_dlrbTree_linkedlist_sync(&keys);
|
||||
BLI_dlrbTree_linkedlist_sync(&blocks);
|
||||
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, (fcu->flag & FCURVE_PROTECTED));
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, (fcu->flag & FCURVE_PROTECTED));
|
||||
|
||||
BLI_dlrbTree_free(&keys);
|
||||
BLI_dlrbTree_free(&blocks);
|
||||
@@ -718,12 +720,12 @@ void draw_agroup_channel(View2D *v2d, AnimData *adt, bActionGroup *agrp, float y
|
||||
BLI_dlrbTree_init(&keys);
|
||||
BLI_dlrbTree_init(&blocks);
|
||||
|
||||
agroup_to_keylist(adt, agrp, &keys, &blocks);
|
||||
agroup_to_keylist(adt, agrp, &keys, &blocks);
|
||||
|
||||
BLI_dlrbTree_linkedlist_sync(&keys);
|
||||
BLI_dlrbTree_linkedlist_sync(&blocks);
|
||||
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, (agrp->flag & AGRP_PROTECTED));
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, (agrp->flag & AGRP_PROTECTED));
|
||||
|
||||
BLI_dlrbTree_free(&keys);
|
||||
BLI_dlrbTree_free(&blocks);
|
||||
@@ -736,12 +738,12 @@ void draw_action_channel(View2D *v2d, AnimData *adt, bAction *act, float ypos)
|
||||
BLI_dlrbTree_init(&keys);
|
||||
BLI_dlrbTree_init(&blocks);
|
||||
|
||||
action_to_keylist(adt, act, &keys, &blocks);
|
||||
action_to_keylist(adt, act, &keys, &blocks);
|
||||
|
||||
BLI_dlrbTree_linkedlist_sync(&keys);
|
||||
BLI_dlrbTree_linkedlist_sync(&blocks);
|
||||
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, 0);
|
||||
draw_keylist(v2d, &keys, &blocks, ypos, 0);
|
||||
|
||||
BLI_dlrbTree_free(&keys);
|
||||
BLI_dlrbTree_free(&blocks);
|
||||
@@ -753,11 +755,11 @@ void draw_gpl_channel(View2D *v2d, bDopeSheet *ads, bGPDlayer *gpl, float ypos)
|
||||
|
||||
BLI_dlrbTree_init(&keys);
|
||||
|
||||
gpl_to_keylist(ads, gpl, &keys);
|
||||
gpl_to_keylist(ads, gpl, &keys);
|
||||
|
||||
BLI_dlrbTree_linkedlist_sync(&keys);
|
||||
|
||||
draw_keylist(v2d, &keys, NULL, ypos, (gpl->flag & GP_LAYER_LOCKED));
|
||||
draw_keylist(v2d, &keys, NULL, ypos, (gpl->flag & GP_LAYER_LOCKED));
|
||||
|
||||
BLI_dlrbTree_free(&keys);
|
||||
}
|
||||
@@ -772,11 +774,11 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, DLRBT_Tree *blocks)
|
||||
int filter;
|
||||
|
||||
/* get F-Curves to take keyframes from */
|
||||
filter= ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
filter = ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* loop through each F-Curve, grabbing the keyframes */
|
||||
for (ale= anim_data.first; ale; ale= ale->next)
|
||||
for (ale = anim_data.first; ale; ale = ale->next)
|
||||
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
|
||||
|
||||
BLI_freelistN(&anim_data);
|
||||
@@ -806,11 +808,11 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, DLRBT_Tree *keys, DLRBT_Tree
|
||||
ac.datatype = ANIMCONT_CHANNEL;
|
||||
|
||||
/* get F-Curves to take keyframes from */
|
||||
filter= ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
filter = ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* loop through each F-Curve, grabbing the keyframes */
|
||||
for (ale= anim_data.first; ale; ale= ale->next)
|
||||
for (ale = anim_data.first; ale; ale = ale->next)
|
||||
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
|
||||
|
||||
BLI_freelistN(&anim_data);
|
||||
@@ -842,11 +844,11 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *bl
|
||||
ac.datatype = ANIMCONT_CHANNEL;
|
||||
|
||||
/* get F-Curves to take keyframes from */
|
||||
filter= ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
filter = ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* loop through each F-Curve, grabbing the keyframes */
|
||||
for (ale= anim_data.first; ale; ale= ale->next)
|
||||
for (ale = anim_data.first; ale; ale = ale->next)
|
||||
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
|
||||
|
||||
BLI_freelistN(&anim_data);
|
||||
@@ -868,10 +870,10 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree
|
||||
*/
|
||||
if (blocks) {
|
||||
/* init new tree */
|
||||
beztTree= BLI_dlrbTree_new();
|
||||
beztTree = BLI_dlrbTree_new();
|
||||
|
||||
/* populate tree with the BezTriples */
|
||||
for (v=0, bezt=fcu->bezt; v < fcu->totvert; v++, bezt++)
|
||||
for (v = 0, bezt = fcu->bezt; v < fcu->totvert; v++, bezt++)
|
||||
BLI_dlrbTree_add(beztTree, compare_abk_bezt, nalloc_abk_bezt, nupdate_abk_bezt, bezt);
|
||||
|
||||
/* make sure that it is suitable for linked-list searching too */
|
||||
@@ -879,7 +881,7 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree
|
||||
}
|
||||
|
||||
/* loop through beztriples, making ActKeysColumns and ActKeyBlocks */
|
||||
for (v=0, bezt=fcu->bezt; v < fcu->totvert; v++, bezt++) {
|
||||
for (v = 0, bezt = fcu->bezt; v < fcu->totvert; v++, bezt++) {
|
||||
add_bezt_to_keycolumns_list(keys, bezt);
|
||||
if (blocks) add_bezt_to_keyblocks_list(blocks, beztTree, bezt);
|
||||
}
|
||||
@@ -908,7 +910,7 @@ void agroup_to_keylist(AnimData *adt, bActionGroup *agrp, DLRBT_Tree *keys, DLRB
|
||||
|
||||
if (agrp) {
|
||||
/* loop through F-Curves */
|
||||
for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) {
|
||||
for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcu->next) {
|
||||
fcurve_to_keylist(adt, fcu, keys, blocks);
|
||||
}
|
||||
}
|
||||
@@ -920,7 +922,7 @@ void action_to_keylist(AnimData *adt, bAction *act, DLRBT_Tree *keys, DLRBT_Tree
|
||||
|
||||
if (act) {
|
||||
/* loop through F-Curves */
|
||||
for (fcu= act->curves.first; fcu; fcu= fcu->next) {
|
||||
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
|
||||
fcurve_to_keylist(adt, fcu, keys, blocks);
|
||||
}
|
||||
}
|
||||
@@ -933,7 +935,7 @@ void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys)
|
||||
|
||||
if (gpl && keys) {
|
||||
/* although the frames should already be in an ordered list, they are not suitable for displaying yet */
|
||||
for (gpf= gpl->frames.first; gpf; gpf= gpf->next)
|
||||
for (gpf = gpl->frames.first; gpf; gpf = gpf->next)
|
||||
add_gpframe_to_keycolumns_list(keys, gpf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,9 +102,9 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
|
||||
|
||||
/* set the F-Curve into the editdata so that it can be accessed */
|
||||
if (ked) {
|
||||
ked->fcu= fcu;
|
||||
ked->curIndex= 0;
|
||||
ked->curflags= ok;
|
||||
ked->fcu = fcu;
|
||||
ked->curIndex = 0;
|
||||
ked->curflags = ok;
|
||||
}
|
||||
|
||||
/* if function to apply to bezier curves is set, then loop through executing it on beztriples */
|
||||
@@ -113,16 +113,16 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
|
||||
* (this is should be more efficient than checking for it in every loop)
|
||||
*/
|
||||
if (key_ok) {
|
||||
for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
|
||||
for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) {
|
||||
if (ked) {
|
||||
/* advance the index, and reset the ok flags (to not influence the result) */
|
||||
ked->curIndex= i;
|
||||
ked->curflags= 0;
|
||||
ked->curIndex = i;
|
||||
ked->curflags = 0;
|
||||
}
|
||||
|
||||
/* Only operate on this BezTriple if it fullfills the criteria of the validation func */
|
||||
if ( (ok = key_ok(ked, bezt)) ) {
|
||||
if (ked) ked->curflags= ok;
|
||||
if (ked) ked->curflags = ok;
|
||||
|
||||
/* Exit with return-code '1' if function returns positive
|
||||
* This is useful if finding if some BezTriple satisfies a condition.
|
||||
@@ -132,8 +132,8 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
|
||||
if (ked) ked->curIndex= i;
|
||||
for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) {
|
||||
if (ked) ked->curIndex = i;
|
||||
|
||||
/* Exit with return-code '1' if function returns positive
|
||||
* This is useful if finding if some BezTriple satisfies a condition.
|
||||
@@ -145,9 +145,9 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
|
||||
|
||||
/* unset the F-Curve from the editdata now that it's done */
|
||||
if (ked) {
|
||||
ked->fcu= NULL;
|
||||
ked->curIndex= 0;
|
||||
ked->curflags= 0;
|
||||
ked->fcu = NULL;
|
||||
ked->curIndex = 0;
|
||||
ked->curflags = 0;
|
||||
}
|
||||
|
||||
/* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
|
||||
@@ -170,7 +170,7 @@ static short agrp_keyframes_loop(KeyframeEditData *ked, bActionGroup *agrp, Keyf
|
||||
return 0;
|
||||
|
||||
/* only iterate over the F-Curves that are in this group */
|
||||
for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) {
|
||||
for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcu->next) {
|
||||
if (ANIM_fcurve_keyframes_loop(ked, fcu, key_ok, key_cb, fcu_cb))
|
||||
return 1;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ static short act_keyframes_loop(KeyframeEditData *ked, bAction *act, KeyframeEdi
|
||||
return 0;
|
||||
|
||||
/* just loop through all F-Curves */
|
||||
for (fcu= act->curves.first; fcu; fcu= fcu->next) {
|
||||
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
|
||||
if (ANIM_fcurve_keyframes_loop(ked, fcu, key_ok, key_cb, fcu_cb))
|
||||
return 1;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
int ret=0;
|
||||
int ret = 0;
|
||||
|
||||
bAnimListElem dummychan = {NULL};
|
||||
Base dummybase = {NULL};
|
||||
@@ -224,12 +224,12 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o
|
||||
ac.datatype = ANIMCONT_CHANNEL;
|
||||
|
||||
/* get F-Curves to take keyframes from */
|
||||
filter= ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
filter = ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* loop through each F-Curve, applying the operation as required, but stopping on the first one */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
if (ANIM_fcurve_keyframes_loop(ked, (FCurve*)ale->data, key_ok, key_cb, fcu_cb)) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
if (ANIM_fcurve_keyframes_loop(ked, (FCurve *)ale->data, key_ok, key_cb, fcu_cb)) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
@@ -248,7 +248,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
int ret=0;
|
||||
int ret = 0;
|
||||
|
||||
bAnimListElem dummychan = {NULL};
|
||||
|
||||
@@ -266,12 +266,12 @@ static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene
|
||||
ac.datatype = ANIMCONT_CHANNEL;
|
||||
|
||||
/* get F-Curves to take keyframes from */
|
||||
filter= ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
filter = ANIMFILTER_DATA_VISIBLE; // curves only
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
|
||||
/* loop through each F-Curve, applying the operation as required, but stopping on the first one */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
if (ANIM_fcurve_keyframes_loop(ked, (FCurve*)ale->data, key_ok, key_cb, fcu_cb)) {
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
if (ANIM_fcurve_keyframes_loop(ked, (FCurve *)ale->data, key_ok, key_cb, fcu_cb)) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
@@ -288,19 +288,19 @@ static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, Key
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
bAnimListElem *ale;
|
||||
int filter, ret_code=0;
|
||||
int filter, ret_code = 0;
|
||||
|
||||
/* sanity check */
|
||||
if (ac == NULL)
|
||||
return 0;
|
||||
|
||||
/* get F-Curves to take keyframes from */
|
||||
filter= ANIMFILTER_DATA_VISIBLE;
|
||||
filter = ANIMFILTER_DATA_VISIBLE;
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* loop through each F-Curve, working on the keyframes until the first curve aborts */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
ret_code= ANIM_fcurve_keyframes_loop(ked, ale->data, key_ok, key_cb, fcu_cb);
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
ret_code = ANIM_fcurve_keyframes_loop(ked, ale->data, key_ok, key_cb, fcu_cb);
|
||||
|
||||
if (ret_code)
|
||||
break;
|
||||
@@ -388,16 +388,16 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac)
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
/* when not in graph view, don't use handles */
|
||||
SpaceIpo *sipo= (ac->spacetype == SPACE_IPO) ? (SpaceIpo *)ac->sl : NULL;
|
||||
SpaceIpo *sipo = (ac->spacetype == SPACE_IPO) ? (SpaceIpo *)ac->sl : NULL;
|
||||
const short use_handle = sipo ? !(sipo->flag & SIPO_NOHANDLES) : FALSE;
|
||||
|
||||
/* filter animation data */
|
||||
filter= ANIMFILTER_DATA_VISIBLE;
|
||||
filter = ANIMFILTER_DATA_VISIBLE;
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* loop over F-Curves that are likely to have been edited, and check them */
|
||||
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||
FCurve *fcu= ale->key_data;
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
FCurve *fcu = ale->key_data;
|
||||
|
||||
/* make sure keyframes in F-Curve are all in order, and handles are in valid positions */
|
||||
sort_time_fcurve(fcu);
|
||||
@@ -439,7 +439,7 @@ static short ok_bezier_frame(KeyframeEditData *ked, BezTriple *bezt)
|
||||
|
||||
/* frame is stored in f1 property (this float accuracy check may need to be dropped?) */
|
||||
#define KEY_CHECK_OK(_index) IS_EQF(bezt->vec[_index][0], ked->f1)
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
#undef KEY_CHECK_OK
|
||||
|
||||
/* return ok flags */
|
||||
@@ -452,7 +452,7 @@ static short ok_bezier_framerange(KeyframeEditData *ked, BezTriple *bezt)
|
||||
|
||||
/* frame range is stored in float properties */
|
||||
#define KEY_CHECK_OK(_index) ((bezt->vec[_index][0] > ked->f1) && (bezt->vec[_index][0] < ked->f2))
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
#undef KEY_CHECK_OK
|
||||
|
||||
/* return ok flags */
|
||||
@@ -462,7 +462,7 @@ static short ok_bezier_framerange(KeyframeEditData *ked, BezTriple *bezt)
|
||||
static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
/* this macro checks all beztriple handles for selection...
|
||||
* only one of the verts has to be selected for this to be ok...
|
||||
* only one of the verts has to be selected for this to be ok...
|
||||
*/
|
||||
if (BEZSELECTED(bezt))
|
||||
return KEYFRAME_OK_ALL;
|
||||
@@ -479,7 +479,7 @@ static short ok_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
|
||||
* - should value be stored in f2 instead so that we won't have conflicts when using f1 for frames too?
|
||||
*/
|
||||
#define KEY_CHECK_OK(_index) IS_EQF(bezt->vec[_index][1], ked->f1)
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
#undef KEY_CHECK_OK
|
||||
|
||||
/* return ok flags */
|
||||
@@ -492,7 +492,7 @@ static short ok_bezier_valuerange(KeyframeEditData *ked, BezTriple *bezt)
|
||||
|
||||
/* value range is stored in float properties */
|
||||
#define KEY_CHECK_OK(_index) ((bezt->vec[_index][1] > ked->f1) && (bezt->vec[_index][1] < ked->f2))
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
#undef KEY_CHECK_OK
|
||||
|
||||
/* return ok flags */
|
||||
@@ -506,7 +506,7 @@ static short ok_bezier_region(KeyframeEditData *ked, BezTriple *bezt)
|
||||
short ok = 0;
|
||||
|
||||
#define KEY_CHECK_OK(_index) BLI_in_rctf(ked->data, bezt->vec[_index][0], bezt->vec[_index][1])
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
#undef KEY_CHECK_OK
|
||||
|
||||
/* return ok flags */
|
||||
@@ -525,7 +525,7 @@ KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
|
||||
return ok_bezier_frame;
|
||||
case BEZT_OK_FRAMERANGE: /* only if bezt falls within the specified frame range (floats) */
|
||||
return ok_bezier_framerange;
|
||||
case BEZT_OK_SELECTED: /* only if bezt is selected (self) */
|
||||
case BEZT_OK_SELECTED: /* only if bezt is selected (self) */
|
||||
return ok_bezier_selected;
|
||||
case BEZT_OK_VALUE: /* only if bezt value matches (float) */
|
||||
return ok_bezier_value;
|
||||
@@ -566,10 +566,10 @@ short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
/* only if selected */
|
||||
if (bezt->f2 & SELECT) {
|
||||
CfraElem *ce= MEM_callocN(sizeof(CfraElem), "cfraElem");
|
||||
CfraElem *ce = MEM_callocN(sizeof(CfraElem), "cfraElem");
|
||||
BLI_addtail(&ked->list, ce);
|
||||
|
||||
ce->cfra= bezt->vec[1][0];
|
||||
ce->cfra = bezt->vec[1][0];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -580,15 +580,15 @@ short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
|
||||
*/
|
||||
void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
KeyframeEditCD_Remap *rmap= (KeyframeEditCD_Remap*)ked->data;
|
||||
KeyframeEditCD_Remap *rmap = (KeyframeEditCD_Remap *)ked->data;
|
||||
const float scale = (rmap->newMax - rmap->newMin) / (rmap->oldMax - rmap->oldMin);
|
||||
|
||||
/* perform transform on all three handles unless indicated otherwise */
|
||||
// TODO: need to include some checks for that
|
||||
|
||||
bezt->vec[0][0]= scale*(bezt->vec[0][0] - rmap->oldMin) + rmap->newMin;
|
||||
bezt->vec[1][0]= scale*(bezt->vec[1][0] - rmap->oldMin) + rmap->newMin;
|
||||
bezt->vec[2][0]= scale*(bezt->vec[2][0] - rmap->oldMin) + rmap->newMin;
|
||||
bezt->vec[0][0] = scale * (bezt->vec[0][0] - rmap->oldMin) + rmap->newMin;
|
||||
bezt->vec[1][0] = scale * (bezt->vec[1][0] - rmap->oldMin) + rmap->newMin;
|
||||
bezt->vec[2][0] = scale * (bezt->vec[2][0] - rmap->oldMin) + rmap->newMin;
|
||||
}
|
||||
|
||||
/* ******************************************* */
|
||||
@@ -598,27 +598,27 @@ void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt)
|
||||
static short snap_bezier_nearest(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
bezt->vec[1][0]= (float)(floorf(bezt->vec[1][0]+0.5f));
|
||||
bezt->vec[1][0] = (float)(floorf(bezt->vec[1][0] + 0.5f));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* snaps the keyframe to the neares second */
|
||||
static short snap_bezier_nearestsec(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
const Scene *scene= ked->scene;
|
||||
const Scene *scene = ked->scene;
|
||||
const float secf = (float)FPS;
|
||||
|
||||
if (bezt->f2 & SELECT)
|
||||
bezt->vec[1][0]= ((float)floor(bezt->vec[1][0]/secf + 0.5f) * secf);
|
||||
bezt->vec[1][0] = ((float)floor(bezt->vec[1][0] / secf + 0.5f) * secf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* snaps the keyframe to the current frame */
|
||||
static short snap_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
const Scene *scene= ked->scene;
|
||||
const Scene *scene = ked->scene;
|
||||
if (bezt->f2 & SELECT)
|
||||
bezt->vec[1][0]= (float)CFRA;
|
||||
bezt->vec[1][0] = (float)CFRA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ static short snap_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt)
|
||||
static short snap_bezier_nearmarker(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
bezt->vec[1][0]= (float)ED_markers_find_nearest_marker_time(&ked->list, bezt->vec[1][0]);
|
||||
bezt->vec[1][0] = (float)ED_markers_find_nearest_marker_time(&ked->list, bezt->vec[1][0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -634,10 +634,10 @@ static short snap_bezier_nearmarker(KeyframeEditData *ked, BezTriple *bezt)
|
||||
static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT) {
|
||||
bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1];
|
||||
bezt->vec[0][1] = bezt->vec[2][1] = bezt->vec[1][1];
|
||||
|
||||
if (ELEM3(bezt->h1, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h1= HD_ALIGN;
|
||||
if (ELEM3(bezt->h2, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h2= HD_ALIGN;
|
||||
if (ELEM3(bezt->h1, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h1 = HD_ALIGN;
|
||||
if (ELEM3(bezt->h2, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h2 = HD_ALIGN;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -646,7 +646,7 @@ static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *be
|
||||
static short snap_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
bezt->vec[1][1]= ked->f1;
|
||||
bezt->vec[1][1] = ked->f1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -675,12 +675,12 @@ KeyframeEditFunc ANIM_editkeyframes_snap(short type)
|
||||
|
||||
static short mirror_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
const Scene *scene= ked->scene;
|
||||
const Scene *scene = ked->scene;
|
||||
float diff;
|
||||
|
||||
if (bezt->f2 & SELECT) {
|
||||
diff= ((float)CFRA - bezt->vec[1][0]);
|
||||
bezt->vec[1][0]= ((float)CFRA + diff);
|
||||
diff = ((float)CFRA - bezt->vec[1][0]);
|
||||
bezt->vec[1][0] = ((float)CFRA + diff);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -691,8 +691,8 @@ static short mirror_bezier_yaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
float diff;
|
||||
|
||||
if (bezt->f2 & SELECT) {
|
||||
diff= (0.0f - bezt->vec[1][0]);
|
||||
bezt->vec[1][0]= (0.0f + diff);
|
||||
diff = (0.0f - bezt->vec[1][0]);
|
||||
bezt->vec[1][0] = (0.0f + diff);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -703,8 +703,8 @@ static short mirror_bezier_xaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
float diff;
|
||||
|
||||
if (bezt->f2 & SELECT) {
|
||||
diff= (0.0f - bezt->vec[1][1]);
|
||||
bezt->vec[1][1]= (0.0f + diff);
|
||||
diff = (0.0f - bezt->vec[1][1]);
|
||||
bezt->vec[1][1] = (0.0f + diff);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -714,8 +714,8 @@ static short mirror_bezier_marker(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
/* mirroring time stored in f1 */
|
||||
if (bezt->f2 & SELECT) {
|
||||
const float diff= (ked->f1 - bezt->vec[1][0]);
|
||||
bezt->vec[1][0]= (ked->f1 + diff);
|
||||
const float diff = (ked->f1 - bezt->vec[1][0]);
|
||||
bezt->vec[1][0] = (ked->f1 + diff);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -727,8 +727,8 @@ static short mirror_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
|
||||
|
||||
/* value to mirror over is stored in the custom data -> first float value slot */
|
||||
if (bezt->f2 & SELECT) {
|
||||
diff= (ked->f1 - bezt->vec[1][1]);
|
||||
bezt->vec[1][1]= (ked->f1 + diff);
|
||||
diff = (ked->f1 - bezt->vec[1][1]);
|
||||
bezt->vec[1][1] = (ked->f1 + diff);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -763,17 +763,17 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
|
||||
#define ENSURE_HANDLES_MATCH(bezt) \
|
||||
if (bezt->h1 != bezt->h2) { \
|
||||
if (ELEM3(bezt->h1, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM)) \
|
||||
bezt->h1= HD_FREE; \
|
||||
bezt->h1 = HD_FREE; \
|
||||
if (ELEM3(bezt->h2, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM)) \
|
||||
bezt->h2= HD_FREE; \
|
||||
bezt->h2 = HD_FREE; \
|
||||
}
|
||||
|
||||
/* Sets the selected bezier handles to type 'auto' */
|
||||
static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
|
||||
if (bezt->f1 & SELECT) bezt->h1= HD_AUTO;
|
||||
if (bezt->f3 & SELECT) bezt->h2= HD_AUTO;
|
||||
if (bezt->f1 & SELECT) bezt->h1 = HD_AUTO;
|
||||
if (bezt->f3 & SELECT) bezt->h2 = HD_AUTO;
|
||||
|
||||
ENSURE_HANDLES_MATCH(bezt);
|
||||
}
|
||||
@@ -786,8 +786,8 @@ static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
static short set_bezier_auto_clamped(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
|
||||
if (bezt->f1 & SELECT) bezt->h1= HD_AUTO_ANIM;
|
||||
if (bezt->f3 & SELECT) bezt->h2= HD_AUTO_ANIM;
|
||||
if (bezt->f1 & SELECT) bezt->h1 = HD_AUTO_ANIM;
|
||||
if (bezt->f3 & SELECT) bezt->h2 = HD_AUTO_ANIM;
|
||||
|
||||
ENSURE_HANDLES_MATCH(bezt);
|
||||
}
|
||||
@@ -797,8 +797,8 @@ static short set_bezier_auto_clamped(KeyframeEditData *UNUSED(ked), BezTriple *b
|
||||
/* Sets the selected bezier handles to type 'vector' */
|
||||
static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f1 & SELECT) bezt->h1= HD_VECT;
|
||||
if (bezt->f3 & SELECT) bezt->h2= HD_VECT;
|
||||
if (bezt->f1 & SELECT) bezt->h1 = HD_VECT;
|
||||
if (bezt->f3 & SELECT) bezt->h2 = HD_VECT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -815,16 +815,16 @@ static short bezier_isfree(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
/* Sets selected bezier handles to type 'align' */
|
||||
static short set_bezier_align(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f1 & SELECT) bezt->h1= HD_ALIGN;
|
||||
if (bezt->f3 & SELECT) bezt->h2= HD_ALIGN;
|
||||
if (bezt->f1 & SELECT) bezt->h1 = HD_ALIGN;
|
||||
if (bezt->f3 & SELECT) bezt->h2 = HD_ALIGN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Sets selected bezier handles to type 'free' */
|
||||
static short set_bezier_free(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f1 & SELECT) bezt->h1= HD_FREE;
|
||||
if (bezt->f3 & SELECT) bezt->h2= HD_FREE;
|
||||
if (bezt->f1 & SELECT) bezt->h1 = HD_FREE;
|
||||
if (bezt->f3 & SELECT) bezt->h2 = HD_FREE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -855,21 +855,21 @@ KeyframeEditFunc ANIM_editkeyframes_handles(short code)
|
||||
static short set_bezt_constant(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
bezt->ipo= BEZT_IPO_CONST;
|
||||
bezt->ipo = BEZT_IPO_CONST;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short set_bezt_linear(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
bezt->ipo= BEZT_IPO_LIN;
|
||||
bezt->ipo = BEZT_IPO_LIN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short set_bezt_bezier(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
bezt->ipo= BEZT_IPO_BEZ;
|
||||
bezt->ipo = BEZT_IPO_BEZ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -892,28 +892,28 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code)
|
||||
static short set_keytype_keyframe(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_KEYFRAME;
|
||||
BEZKEYTYPE(bezt) = BEZT_KEYTYPE_KEYFRAME;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short set_keytype_breakdown(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_BREAKDOWN;
|
||||
BEZKEYTYPE(bezt) = BEZT_KEYTYPE_BREAKDOWN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short set_keytype_extreme(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_EXTREME;
|
||||
BEZKEYTYPE(bezt) = BEZT_KEYTYPE_EXTREME;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short set_keytype_jitter(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
|
||||
{
|
||||
if (bezt->f2 & SELECT)
|
||||
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_JITTER;
|
||||
BEZKEYTYPE(bezt) = BEZT_KEYTYPE_JITTER;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1017,32 +1017,32 @@ KeyframeEditFunc ANIM_editkeyframes_select(short selectmode)
|
||||
|
||||
static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
FCurve *fcu= ked->fcu;
|
||||
char *map= ked->data;
|
||||
int i= ked->curIndex;
|
||||
FCurve *fcu = ked->fcu;
|
||||
char *map = ked->data;
|
||||
int i = ked->curIndex;
|
||||
|
||||
/* if current is selected, just make sure it stays this way */
|
||||
if (BEZSELECTED(bezt)) {
|
||||
map[i]= 1;
|
||||
map[i] = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if previous is selected, that means that selection should extend across */
|
||||
if (i > 0) {
|
||||
BezTriple *prev= bezt - 1;
|
||||
BezTriple *prev = bezt - 1;
|
||||
|
||||
if (BEZSELECTED(prev)) {
|
||||
map[i]= 1;
|
||||
map[i] = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* if next is selected, that means that selection should extend across */
|
||||
if (i < (fcu->totvert-1)) {
|
||||
BezTriple *next= bezt + 1;
|
||||
if (i < (fcu->totvert - 1)) {
|
||||
BezTriple *next = bezt + 1;
|
||||
|
||||
if (BEZSELECTED(next)) {
|
||||
map[i]= 1;
|
||||
map[i] = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1052,9 +1052,9 @@ static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt)
|
||||
|
||||
static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
FCurve *fcu= ked->fcu;
|
||||
char *map= ked->data;
|
||||
int i= ked->curIndex;
|
||||
FCurve *fcu = ked->fcu;
|
||||
char *map = ked->data;
|
||||
int i = ked->curIndex;
|
||||
|
||||
/* if current is selected, check the left/right keyframes
|
||||
* since it might need to be deselected (but otherwise no)
|
||||
@@ -1062,7 +1062,7 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
|
||||
if (BEZSELECTED(bezt)) {
|
||||
/* if previous is not selected, we're on the tip of an iceberg */
|
||||
if (i > 0) {
|
||||
BezTriple *prev= bezt - 1;
|
||||
BezTriple *prev = bezt - 1;
|
||||
|
||||
if (BEZSELECTED(prev) == 0)
|
||||
return 0;
|
||||
@@ -1073,19 +1073,19 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
|
||||
}
|
||||
|
||||
/* if next is not selected, we're on the tip of an iceberg */
|
||||
if (i < (fcu->totvert-1)) {
|
||||
BezTriple *next= bezt + 1;
|
||||
if (i < (fcu->totvert - 1)) {
|
||||
BezTriple *next = bezt + 1;
|
||||
|
||||
if (BEZSELECTED(next) == 0)
|
||||
return 0;
|
||||
}
|
||||
else if (i == (fcu->totvert-1)) {
|
||||
else if (i == (fcu->totvert - 1)) {
|
||||
/* current keyframe is selected at an endpoint, so should get deselected */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if we're still here, that means that keyframe should remain untouched */
|
||||
map[i]= 1;
|
||||
map[i] = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1109,8 +1109,8 @@ KeyframeEditFunc ANIM_editkeyframes_buildselmap(short mode)
|
||||
/* flush selection map values to the given beztriple */
|
||||
short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
char *map= ked->data;
|
||||
short on= map[ked->curIndex];
|
||||
char *map = ked->data;
|
||||
short on = map[ked->curIndex];
|
||||
|
||||
/* select or deselect based on whether the map allows it or not */
|
||||
if (on) {
|
||||
|
||||
@@ -90,13 +90,13 @@ void delete_fcurve_key(FCurve *fcu, int index, short do_recalc)
|
||||
index += fcu->totvert;
|
||||
|
||||
/* Delete this keyframe */
|
||||
memmove(&fcu->bezt[index], &fcu->bezt[index+1], sizeof(BezTriple)*(fcu->totvert-index-1));
|
||||
memmove(&fcu->bezt[index], &fcu->bezt[index + 1], sizeof(BezTriple) * (fcu->totvert - index - 1));
|
||||
fcu->totvert--;
|
||||
|
||||
if (fcu->totvert == 0) {
|
||||
if (fcu->bezt)
|
||||
MEM_freeN(fcu->bezt);
|
||||
fcu->bezt= NULL;
|
||||
fcu->bezt = NULL;
|
||||
}
|
||||
|
||||
/* recalc handles - only if it won't cause problems */
|
||||
@@ -109,13 +109,13 @@ void delete_fcurve_keys(FCurve *fcu)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (fcu->bezt==NULL) /* ignore baked curves */
|
||||
if (fcu->bezt == NULL) /* ignore baked curves */
|
||||
return;
|
||||
|
||||
/* Delete selected BezTriples */
|
||||
for (i=0; i < fcu->totvert; i++) {
|
||||
for (i = 0; i < fcu->totvert; i++) {
|
||||
if (fcu->bezt[i].f2 & SELECT) {
|
||||
memmove(&fcu->bezt[i], &fcu->bezt[i+1], sizeof(BezTriple)*(fcu->totvert-i-1));
|
||||
memmove(&fcu->bezt[i], &fcu->bezt[i + 1], sizeof(BezTriple) * (fcu->totvert - i - 1));
|
||||
fcu->totvert--;
|
||||
i--;
|
||||
}
|
||||
@@ -131,9 +131,9 @@ void clear_fcurve_keys(FCurve *fcu)
|
||||
{
|
||||
if (fcu->bezt)
|
||||
MEM_freeN(fcu->bezt);
|
||||
fcu->bezt= NULL;
|
||||
fcu->bezt = NULL;
|
||||
|
||||
fcu->totvert= 0;
|
||||
fcu->totvert = 0;
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
@@ -148,20 +148,20 @@ void duplicate_fcurve_keys(FCurve *fcu)
|
||||
if (ELEM(NULL, fcu, fcu->bezt))
|
||||
return;
|
||||
|
||||
for (i=0; i < fcu->totvert; i++) {
|
||||
for (i = 0; i < fcu->totvert; i++) {
|
||||
/* If a key is selected */
|
||||
if (fcu->bezt[i].f2 & SELECT) {
|
||||
/* Expand the list */
|
||||
newbezt = MEM_callocN(sizeof(BezTriple) * (fcu->totvert+1), "beztriple");
|
||||
newbezt = MEM_callocN(sizeof(BezTriple) * (fcu->totvert + 1), "beztriple");
|
||||
|
||||
memcpy(newbezt, fcu->bezt, sizeof(BezTriple) * (i+1));
|
||||
memcpy(newbezt+i+1, fcu->bezt+i, sizeof(BezTriple));
|
||||
memcpy(newbezt+i+2, fcu->bezt+i+1, sizeof (BezTriple) *(fcu->totvert-(i+1)));
|
||||
memcpy(newbezt, fcu->bezt, sizeof(BezTriple) * (i + 1));
|
||||
memcpy(newbezt + i + 1, fcu->bezt + i, sizeof(BezTriple));
|
||||
memcpy(newbezt + i + 2, fcu->bezt + i + 1, sizeof (BezTriple) * (fcu->totvert - (i + 1)));
|
||||
fcu->totvert++;
|
||||
|
||||
/* reassign pointers... (free old, and add new) */
|
||||
MEM_freeN(fcu->bezt);
|
||||
fcu->bezt=newbezt;
|
||||
fcu->bezt = newbezt;
|
||||
|
||||
/* Unselect the current key */
|
||||
BEZ_DESEL(&fcu->bezt[i]);
|
||||
@@ -200,20 +200,20 @@ void clean_fcurve(FCurve *fcu, float thresh)
|
||||
/* Loop through BezTriples, comparing them. Skip any that do
|
||||
* not fit the criteria for "ok" points.
|
||||
*/
|
||||
for (i=1; i<totCount; i++) {
|
||||
for (i = 1; i < totCount; i++) {
|
||||
float prev[2], cur[2], next[2];
|
||||
|
||||
/* get BezTriples and their values */
|
||||
if (i < (totCount - 1)) {
|
||||
beztn = (old_bezts + (i+1));
|
||||
next[0]= beztn->vec[1][0]; next[1]= beztn->vec[1][1];
|
||||
beztn = (old_bezts + (i + 1));
|
||||
next[0] = beztn->vec[1][0]; next[1] = beztn->vec[1][1];
|
||||
}
|
||||
else {
|
||||
beztn = NULL;
|
||||
next[0] = next[1] = 0.0f;
|
||||
}
|
||||
lastb= (fcu->bezt + (fcu->totvert - 1));
|
||||
bezt= (old_bezts + i);
|
||||
lastb = (fcu->bezt + (fcu->totvert - 1));
|
||||
bezt = (old_bezts + i);
|
||||
|
||||
/* get references for quicker access */
|
||||
prev[0] = lastb->vec[1][0]; prev[1] = lastb->vec[1][1];
|
||||
@@ -226,7 +226,7 @@ void clean_fcurve(FCurve *fcu, float thresh)
|
||||
* current is further away than the next one is to the previous.
|
||||
*/
|
||||
if (beztn && (IS_EQT(cur[0], next[0], thresh)) &&
|
||||
(IS_EQT(next[1], prev[1], thresh)==0))
|
||||
(IS_EQT(next[1], prev[1], thresh) == 0))
|
||||
{
|
||||
/* only add if current is further away from previous */
|
||||
if (cur[1] > next[1]) {
|
||||
@@ -276,8 +276,8 @@ void clean_fcurve(FCurve *fcu, float thresh)
|
||||
|
||||
/* temp struct used for smooth_fcurve */
|
||||
typedef struct tSmooth_Bezt {
|
||||
float *h1, *h2, *h3; /* bezt->vec[0,1,2][1] */
|
||||
float y1, y2, y3; /* averaged before/new/after y-values */
|
||||
float *h1, *h2, *h3; /* bezt->vec[0,1,2][1] */
|
||||
float y1, y2, y3; /* averaged before/new/after y-values */
|
||||
} tSmooth_Bezt;
|
||||
|
||||
/* Use a weighted moving-means method to reduce intensity of fluctuations */
|
||||
@@ -288,8 +288,8 @@ void smooth_fcurve(FCurve *fcu)
|
||||
int i, x, totSel = 0;
|
||||
|
||||
/* first loop through - count how many verts are selected */
|
||||
bezt= fcu->bezt;
|
||||
for (i=0; i < fcu->totvert; i++, bezt++) {
|
||||
bezt = fcu->bezt;
|
||||
for (i = 0; i < fcu->totvert; i++, bezt++) {
|
||||
if (BEZSELECTED(bezt))
|
||||
totSel++;
|
||||
}
|
||||
@@ -299,11 +299,11 @@ void smooth_fcurve(FCurve *fcu)
|
||||
tSmooth_Bezt *tarray, *tsb;
|
||||
|
||||
/* allocate memory in one go */
|
||||
tsb= tarray= MEM_callocN(totSel*sizeof(tSmooth_Bezt), "tSmooth_Bezt Array");
|
||||
tsb = tarray = MEM_callocN(totSel * sizeof(tSmooth_Bezt), "tSmooth_Bezt Array");
|
||||
|
||||
/* populate tarray with data of selected points */
|
||||
bezt= fcu->bezt;
|
||||
for (i=0, x=0; (i < fcu->totvert) && (x < totSel); i++, bezt++) {
|
||||
bezt = fcu->bezt;
|
||||
for (i = 0, x = 0; (i < fcu->totvert) && (x < totSel); i++, bezt++) {
|
||||
if (BEZSELECTED(bezt)) {
|
||||
/* tsb simply needs pointer to vec, and index */
|
||||
tsb->h1 = &bezt->vec[0][1];
|
||||
@@ -311,7 +311,7 @@ void smooth_fcurve(FCurve *fcu)
|
||||
tsb->h3 = &bezt->vec[2][1];
|
||||
|
||||
/* advance to the next tsb to populate */
|
||||
if (x < totSel-1)
|
||||
if (x < totSel - 1)
|
||||
tsb++;
|
||||
else
|
||||
break;
|
||||
@@ -321,19 +321,19 @@ void smooth_fcurve(FCurve *fcu)
|
||||
/* calculate the new smoothed F-Curve's with weighted averages:
|
||||
* - this is done with two passes to avoid progressive corruption errors
|
||||
* - uses 5 points for each operation (which stores in the relevant handles)
|
||||
* - previous: w/a ratio = 3:5:2:1:1
|
||||
* - next: w/a ratio = 1:1:2:5:3
|
||||
* - previous: w/a ratio = 3:5:2:1:1
|
||||
* - next: w/a ratio = 1:1:2:5:3
|
||||
*/
|
||||
|
||||
/* round 1: calculate smoothing deltas and new values */
|
||||
tsb= tarray;
|
||||
for (i=0; i < totSel; i++, tsb++) {
|
||||
tsb = tarray;
|
||||
for (i = 0; i < totSel; i++, tsb++) {
|
||||
/* don't touch end points (otherwise, curves slowly explode, as we don't have enough data there) */
|
||||
if (ELEM(i, 0, (totSel-1)) == 0) {
|
||||
if (ELEM(i, 0, (totSel - 1)) == 0) {
|
||||
const tSmooth_Bezt *tP1 = tsb - 1;
|
||||
const tSmooth_Bezt *tP2 = (i-2 > 0) ? (tsb - 2) : (NULL);
|
||||
const tSmooth_Bezt *tP2 = (i - 2 > 0) ? (tsb - 2) : (NULL);
|
||||
const tSmooth_Bezt *tN1 = tsb + 1;
|
||||
const tSmooth_Bezt *tN2 = (i+2 < totSel) ? (tsb + 2) : (NULL);
|
||||
const tSmooth_Bezt *tN2 = (i + 2 < totSel) ? (tsb + 2) : (NULL);
|
||||
|
||||
const float p1 = *tP1->h2;
|
||||
const float p2 = (tP2) ? (*tP2->h2) : (*tP1->h2);
|
||||
@@ -342,18 +342,18 @@ void smooth_fcurve(FCurve *fcu)
|
||||
const float n2 = (tN2) ? (*tN2->h2) : (*tN1->h2);
|
||||
|
||||
/* calculate previous and next, then new position by averaging these */
|
||||
tsb->y1= (3*p2 + 5*p1 + 2*c1 + n1 + n2) / 12;
|
||||
tsb->y3= (p2 + p1 + 2*c1 + 5*n1 + 3*n2) / 12;
|
||||
tsb->y1 = (3 * p2 + 5 * p1 + 2 * c1 + n1 + n2) / 12;
|
||||
tsb->y3 = (p2 + p1 + 2 * c1 + 5 * n1 + 3 * n2) / 12;
|
||||
|
||||
tsb->y2 = (tsb->y1 + tsb->y3) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* round 2: apply new values */
|
||||
tsb= tarray;
|
||||
for (i=0; i < totSel; i++, tsb++) {
|
||||
tsb = tarray;
|
||||
for (i = 0; i < totSel; i++, tsb++) {
|
||||
/* don't touch end points, as their values were't touched above */
|
||||
if (ELEM(i, 0, (totSel-1)) == 0) {
|
||||
if (ELEM(i, 0, (totSel - 1)) == 0) {
|
||||
/* y2 takes the average of the 2 points */
|
||||
*tsb->h2 = tsb->y2;
|
||||
|
||||
@@ -382,42 +382,42 @@ typedef struct tempFrameValCache {
|
||||
/* Evaluates the curves between each selected keyframe on each frame, and keys the value */
|
||||
void sample_fcurve(FCurve *fcu)
|
||||
{
|
||||
BezTriple *bezt, *start=NULL, *end=NULL;
|
||||
BezTriple *bezt, *start = NULL, *end = NULL;
|
||||
tempFrameValCache *value_cache, *fp;
|
||||
int sfra, range;
|
||||
int i, n, nIndex;
|
||||
|
||||
if (fcu->bezt==NULL) /* ignore baked */
|
||||
if (fcu->bezt == NULL) /* ignore baked */
|
||||
return;
|
||||
|
||||
/* find selected keyframes... once pair has been found, add keyframes */
|
||||
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
/* check if selected, and which end this is */
|
||||
if (BEZSELECTED(bezt)) {
|
||||
if (start) {
|
||||
/* set end */
|
||||
end= bezt;
|
||||
end = bezt;
|
||||
|
||||
/* cache values then add keyframes using these values, as adding
|
||||
* keyframes while sampling will affect the outcome...
|
||||
* - only start sampling+adding from index=1, so that we don't overwrite original keyframe
|
||||
*/
|
||||
range= (int)( ceil(end->vec[1][0] - start->vec[1][0]) );
|
||||
sfra= (int)( floor(start->vec[1][0]) );
|
||||
range = (int)(ceil(end->vec[1][0] - start->vec[1][0]) );
|
||||
sfra = (int)(floor(start->vec[1][0]) );
|
||||
|
||||
if (range) {
|
||||
value_cache= MEM_callocN(sizeof(tempFrameValCache)*range, "IcuFrameValCache");
|
||||
value_cache = MEM_callocN(sizeof(tempFrameValCache) * range, "IcuFrameValCache");
|
||||
|
||||
/* sample values */
|
||||
for (n=1, fp=value_cache; n<range && fp; n++, fp++) {
|
||||
fp->frame= (float)(sfra + n);
|
||||
fp->val= evaluate_fcurve(fcu, fp->frame);
|
||||
/* sample values */
|
||||
for (n = 1, fp = value_cache; n < range && fp; n++, fp++) {
|
||||
fp->frame = (float)(sfra + n);
|
||||
fp->val = evaluate_fcurve(fcu, fp->frame);
|
||||
}
|
||||
|
||||
/* add keyframes with these, tagging as 'breakdowns' */
|
||||
for (n=1, fp=value_cache; n<range && fp; n++, fp++) {
|
||||
nIndex= insert_vert_fcurve(fcu, fp->frame, fp->val, 1);
|
||||
BEZKEYTYPE(fcu->bezt + nIndex)= BEZT_KEYTYPE_BREAKDOWN;
|
||||
/* add keyframes with these, tagging as 'breakdowns' */
|
||||
for (n = 1, fp = value_cache; n < range && fp; n++, fp++) {
|
||||
nIndex = insert_vert_fcurve(fcu, fp->frame, fp->val, 1);
|
||||
BEZKEYTYPE(fcu->bezt + nIndex) = BEZT_KEYTYPE_BREAKDOWN;
|
||||
}
|
||||
|
||||
/* free temp cache */
|
||||
@@ -429,13 +429,13 @@ void sample_fcurve(FCurve *fcu)
|
||||
}
|
||||
|
||||
/* bezt was selected, so it now marks the start of a whole new chain to search */
|
||||
start= bezt;
|
||||
end= NULL;
|
||||
start = bezt;
|
||||
end = NULL;
|
||||
}
|
||||
else {
|
||||
/* just set start keyframe */
|
||||
start= bezt;
|
||||
end= NULL;
|
||||
start = bezt;
|
||||
end = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -455,23 +455,23 @@ void sample_fcurve(FCurve *fcu)
|
||||
|
||||
/* globals for copy/paste data (like for other copy/paste buffers) */
|
||||
static ListBase animcopybuf = {NULL, NULL};
|
||||
static float animcopy_firstframe= 999999999.0f;
|
||||
static float animcopy_lastframe= -999999999.0f;
|
||||
static float animcopy_cfra= 0.0;
|
||||
static float animcopy_firstframe = 999999999.0f;
|
||||
static float animcopy_lastframe = -999999999.0f;
|
||||
static float animcopy_cfra = 0.0;
|
||||
|
||||
/* datatype for use in copy/paste buffer */
|
||||
typedef struct tAnimCopybufItem {
|
||||
struct tAnimCopybufItem *next, *prev;
|
||||
|
||||
ID *id; /* ID which owns the curve */
|
||||
bActionGroup *grp; /* Action Group */
|
||||
char *rna_path; /* RNA-Path */
|
||||
int array_index; /* array index */
|
||||
ID *id; /* ID which owns the curve */
|
||||
bActionGroup *grp; /* Action Group */
|
||||
char *rna_path; /* RNA-Path */
|
||||
int array_index; /* array index */
|
||||
|
||||
int totvert; /* number of keyframes stored for this channel */
|
||||
BezTriple *bezt; /* keyframes in buffer */
|
||||
int totvert; /* number of keyframes stored for this channel */
|
||||
BezTriple *bezt; /* keyframes in buffer */
|
||||
|
||||
short id_type; /* Result of GS(id->name)*/
|
||||
short id_type; /* Result of GS(id->name)*/
|
||||
} tAnimCopybufItem;
|
||||
|
||||
|
||||
@@ -482,8 +482,8 @@ void free_anim_copybuf(void)
|
||||
tAnimCopybufItem *aci, *acn;
|
||||
|
||||
/* free each buffer element */
|
||||
for (aci= animcopybuf.first; aci; aci= acn) {
|
||||
acn= aci->next;
|
||||
for (aci = animcopybuf.first; aci; aci = acn) {
|
||||
acn = aci->next;
|
||||
|
||||
/* free keyframes */
|
||||
if (aci->bezt)
|
||||
@@ -498,9 +498,9 @@ void free_anim_copybuf(void)
|
||||
}
|
||||
|
||||
/* restore initial state */
|
||||
animcopybuf.first= animcopybuf.last= NULL;
|
||||
animcopy_firstframe= 999999999.0f;
|
||||
animcopy_lastframe= -999999999.0f;
|
||||
animcopybuf.first = animcopybuf.last = NULL;
|
||||
animcopy_firstframe = 999999999.0f;
|
||||
animcopy_lastframe = -999999999.0f;
|
||||
}
|
||||
|
||||
/* ------------------- */
|
||||
@@ -509,14 +509,14 @@ void free_anim_copybuf(void)
|
||||
short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
|
||||
{
|
||||
bAnimListElem *ale;
|
||||
Scene *scene= ac->scene;
|
||||
Scene *scene = ac->scene;
|
||||
|
||||
/* clear buffer first */
|
||||
free_anim_copybuf();
|
||||
|
||||
/* assume that each of these is an F-Curve */
|
||||
for (ale= anim_data->first; ale; ale= ale->next) {
|
||||
FCurve *fcu= (FCurve *)ale->key_data;
|
||||
for (ale = anim_data->first; ale; ale = ale->next) {
|
||||
FCurve *fcu = (FCurve *)ale->key_data;
|
||||
tAnimCopybufItem *aci;
|
||||
BezTriple *bezt, *nbezt, *newbuf;
|
||||
int i;
|
||||
@@ -529,42 +529,42 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
|
||||
continue;
|
||||
|
||||
/* init copybuf item info */
|
||||
aci= MEM_callocN(sizeof(tAnimCopybufItem), "AnimCopybufItem");
|
||||
aci->id= ale->id;
|
||||
aci->id_type= GS(ale->id->name);
|
||||
aci->grp= fcu->grp;
|
||||
aci->rna_path= MEM_dupallocN(fcu->rna_path);
|
||||
aci->array_index= fcu->array_index;
|
||||
aci = MEM_callocN(sizeof(tAnimCopybufItem), "AnimCopybufItem");
|
||||
aci->id = ale->id;
|
||||
aci->id_type = GS(ale->id->name);
|
||||
aci->grp = fcu->grp;
|
||||
aci->rna_path = MEM_dupallocN(fcu->rna_path);
|
||||
aci->array_index = fcu->array_index;
|
||||
BLI_addtail(&animcopybuf, aci);
|
||||
|
||||
/* add selected keyframes to buffer */
|
||||
// TODO: currently, we resize array everytime we add a new vert - this works ok as long as it is assumed only a few keys are copied
|
||||
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
if (BEZSELECTED(bezt)) {
|
||||
/* add to buffer */
|
||||
newbuf= MEM_callocN(sizeof(BezTriple)*(aci->totvert+1), "copybuf beztriple");
|
||||
newbuf = MEM_callocN(sizeof(BezTriple) * (aci->totvert + 1), "copybuf beztriple");
|
||||
|
||||
/* assume that since we are just re-sizing the array, just copy all existing data across */
|
||||
if (aci->bezt)
|
||||
memcpy(newbuf, aci->bezt, sizeof(BezTriple)*(aci->totvert));
|
||||
memcpy(newbuf, aci->bezt, sizeof(BezTriple) * (aci->totvert));
|
||||
|
||||
/* copy current beztriple across too */
|
||||
nbezt= &newbuf[aci->totvert];
|
||||
*nbezt= *bezt;
|
||||
nbezt = &newbuf[aci->totvert];
|
||||
*nbezt = *bezt;
|
||||
|
||||
/* ensure copy buffer is selected so pasted keys are selected */
|
||||
BEZ_SEL(nbezt);
|
||||
|
||||
/* free old array and set the new */
|
||||
if (aci->bezt) MEM_freeN(aci->bezt);
|
||||
aci->bezt= newbuf;
|
||||
aci->bezt = newbuf;
|
||||
aci->totvert++;
|
||||
|
||||
/* check if this is the earliest frame encountered so far */
|
||||
if (bezt->vec[1][0] < animcopy_firstframe)
|
||||
animcopy_firstframe= bezt->vec[1][0];
|
||||
animcopy_firstframe = bezt->vec[1][0];
|
||||
if (bezt->vec[1][0] > animcopy_lastframe)
|
||||
animcopy_lastframe= bezt->vec[1][0];
|
||||
animcopy_lastframe = bezt->vec[1][0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
|
||||
return -1;
|
||||
|
||||
/* in case 'relative' paste method is used */
|
||||
animcopy_cfra= CFRA;
|
||||
animcopy_cfra = CFRA;
|
||||
|
||||
/* everything went fine */
|
||||
return 0;
|
||||
@@ -588,7 +588,7 @@ static tAnimCopybufItem *pastebuf_match_path_full(FCurve *fcu, const short from_
|
||||
{
|
||||
tAnimCopybufItem *aci;
|
||||
|
||||
for (aci= animcopybuf.first; aci; aci= aci->next) {
|
||||
for (aci = animcopybuf.first; aci; aci = aci->next) {
|
||||
/* check that paths exist */
|
||||
if (to_simple || (aci->rna_path && fcu->rna_path)) {
|
||||
if (to_simple || (strcmp(aci->rna_path, fcu->rna_path) == 0)) {
|
||||
@@ -606,7 +606,7 @@ static tAnimCopybufItem *pastebuf_match_path_property(FCurve *fcu, const short f
|
||||
{
|
||||
tAnimCopybufItem *aci;
|
||||
|
||||
for (aci= animcopybuf.first; aci; aci= aci->next) {
|
||||
for (aci = animcopybuf.first; aci; aci = aci->next) {
|
||||
/* check that paths exist */
|
||||
if (aci->rna_path && fcu->rna_path) {
|
||||
/* find the property of the fcurve and compare against the end of the tAnimCopybufItem
|
||||
@@ -627,12 +627,12 @@ static tAnimCopybufItem *pastebuf_match_path_property(FCurve *fcu, const short f
|
||||
RNA_path_resolve(&id_ptr, aci->rna_path, &rptr, &prop);
|
||||
|
||||
if (prop) {
|
||||
const char *identifier= RNA_property_identifier(prop);
|
||||
const char *identifier = RNA_property_identifier(prop);
|
||||
int len_id = strlen(identifier);
|
||||
int len_path = strlen(fcu->rna_path);
|
||||
if (len_id <= len_path) {
|
||||
/* note, paths which end with "] will fail with this test - Animated ID Props */
|
||||
if (strcmp(identifier, fcu->rna_path + (len_path-len_id))==0) {
|
||||
if (strcmp(identifier, fcu->rna_path + (len_path - len_id)) == 0) {
|
||||
if ((from_single) || (aci->array_index == fcu->array_index))
|
||||
break;
|
||||
}
|
||||
@@ -653,7 +653,7 @@ static tAnimCopybufItem *pastebuf_match_index_only(FCurve *fcu, const short from
|
||||
{
|
||||
tAnimCopybufItem *aci;
|
||||
|
||||
for (aci= animcopybuf.first; aci; aci= aci->next) {
|
||||
for (aci = animcopybuf.first; aci; aci = aci->next) {
|
||||
/* check that paths exist */
|
||||
if ((from_single) || (aci->array_index == fcu->array_index)) {
|
||||
break;
|
||||
@@ -672,7 +672,7 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float
|
||||
int i;
|
||||
|
||||
/* First de-select existing FCuvre */
|
||||
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
bezt->f2 &= ~SELECT;
|
||||
}
|
||||
|
||||
@@ -693,19 +693,19 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float
|
||||
float f_min;
|
||||
float f_max;
|
||||
|
||||
if (merge_mode==KEYFRAME_PASTE_MERGE_OVER_RANGE) {
|
||||
f_min= aci->bezt[0].vec[1][0] + offset;
|
||||
f_max= aci->bezt[aci->totvert-1].vec[1][0] + offset;
|
||||
if (merge_mode == KEYFRAME_PASTE_MERGE_OVER_RANGE) {
|
||||
f_min = aci->bezt[0].vec[1][0] + offset;
|
||||
f_max = aci->bezt[aci->totvert - 1].vec[1][0] + offset;
|
||||
}
|
||||
else { /* Entire Range */
|
||||
f_min= animcopy_firstframe + offset;
|
||||
f_max= animcopy_lastframe + offset;
|
||||
f_min = animcopy_firstframe + offset;
|
||||
f_max = animcopy_lastframe + offset;
|
||||
}
|
||||
|
||||
/* remove keys in range */
|
||||
if (f_min < f_max) {
|
||||
/* select verts in range for removal */
|
||||
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||
if ((f_min < bezt[0].vec[1][0]) && (bezt[0].vec[1][0] < f_max)) {
|
||||
bezt->f2 |= SELECT;
|
||||
}
|
||||
@@ -719,7 +719,7 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float
|
||||
}
|
||||
|
||||
/* just start pasting, with the the first keyframe on the current frame, and so on */
|
||||
for (i=0, bezt=aci->bezt; i < aci->totvert; i++, bezt++) {
|
||||
for (i = 0, bezt = aci->bezt; i < aci->totvert; i++, bezt++) {
|
||||
/* temporarily apply offset to src beztriple while copying */
|
||||
bezt->vec[0][0] += offset;
|
||||
bezt->vec[1][0] += offset;
|
||||
@@ -765,10 +765,10 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
|
||||
{
|
||||
bAnimListElem *ale;
|
||||
|
||||
const Scene *scene= (ac->scene);
|
||||
const Scene *scene = (ac->scene);
|
||||
|
||||
const short from_single= (animcopybuf.first == animcopybuf.last);
|
||||
const short to_simple= (anim_data->first == anim_data->last);
|
||||
const short from_single = (animcopybuf.first == animcopybuf.last);
|
||||
const short to_simple = (anim_data->first == anim_data->last);
|
||||
|
||||
float offset = 0.0f;
|
||||
int pass;
|
||||
@@ -787,16 +787,16 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
|
||||
/* mathods of offset */
|
||||
switch (offset_mode) {
|
||||
case KEYFRAME_PASTE_OFFSET_CFRA_START:
|
||||
offset= (float)(CFRA - animcopy_firstframe);
|
||||
offset = (float)(CFRA - animcopy_firstframe);
|
||||
break;
|
||||
case KEYFRAME_PASTE_OFFSET_CFRA_END:
|
||||
offset= (float)(CFRA - animcopy_lastframe);
|
||||
offset = (float)(CFRA - animcopy_lastframe);
|
||||
break;
|
||||
case KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE:
|
||||
offset= (float)(CFRA - animcopy_cfra);
|
||||
offset = (float)(CFRA - animcopy_cfra);
|
||||
break;
|
||||
case KEYFRAME_PASTE_OFFSET_NONE:
|
||||
offset= 0.0f;
|
||||
offset = 0.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -805,44 +805,44 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
|
||||
FCurve *fcu;
|
||||
tAnimCopybufItem *aci;
|
||||
|
||||
ale= anim_data->first;
|
||||
fcu= (FCurve *)ale->data; /* destination F-Curve */
|
||||
aci= animcopybuf.first;
|
||||
ale = anim_data->first;
|
||||
fcu = (FCurve *)ale->data; /* destination F-Curve */
|
||||
aci = animcopybuf.first;
|
||||
|
||||
paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode);
|
||||
}
|
||||
else {
|
||||
/* from selected channels
|
||||
* This "passes" system aims to try to find "matching" channels to paste keyframes
|
||||
* into with increasingly loose matching heuristics. The process finishes when at least
|
||||
* one F-Curve has been pasted into.
|
||||
* This "passes" system aims to try to find "matching" channels to paste keyframes
|
||||
* into with increasingly loose matching heuristics. The process finishes when at least
|
||||
* one F-Curve has been pasted into.
|
||||
*/
|
||||
for (pass= 0; pass < 3; pass++) {
|
||||
unsigned int totmatch= 0;
|
||||
for (pass = 0; pass < 3; pass++) {
|
||||
unsigned int totmatch = 0;
|
||||
|
||||
for (ale= anim_data->first; ale; ale= ale->next) {
|
||||
for (ale = anim_data->first; ale; ale = ale->next) {
|
||||
/* find buffer item to paste from
|
||||
* - if names don't matter (i.e. only 1 channel in buffer), don't check id/group
|
||||
* - if names do matter, only check if id-type is ok for now (group check is not that important)
|
||||
* - most importantly, rna-paths should match (array indices are unimportant for now)
|
||||
*/
|
||||
FCurve *fcu = (FCurve *)ale->data; /* destination F-Curve */
|
||||
tAnimCopybufItem *aci= NULL;
|
||||
FCurve *fcu = (FCurve *)ale->data; /* destination F-Curve */
|
||||
tAnimCopybufItem *aci = NULL;
|
||||
|
||||
switch (pass) {
|
||||
case 0:
|
||||
/* most strict, must be exact path match data_path & index */
|
||||
aci= pastebuf_match_path_full(fcu, from_single, to_simple);
|
||||
aci = pastebuf_match_path_full(fcu, from_single, to_simple);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* less strict, just compare property names */
|
||||
aci= pastebuf_match_path_property(fcu, from_single, to_simple);
|
||||
aci = pastebuf_match_path_property(fcu, from_single, to_simple);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* Comparing properties gave no results, so just do index comparisons */
|
||||
aci= pastebuf_match_index_only(fcu, from_single, to_simple);
|
||||
aci = pastebuf_match_index_only(fcu, from_single, to_simple);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,16 +75,16 @@
|
||||
*/
|
||||
|
||||
/* poll callback for adding default KeyingSet */
|
||||
static int keyingset_poll_default_add (bContext *C)
|
||||
static int keyingset_poll_default_add(bContext *C)
|
||||
{
|
||||
/* as long as there's an active Scene, it's fine */
|
||||
return (CTX_data_scene(C) != NULL);
|
||||
}
|
||||
|
||||
/* poll callback for editing active KeyingSet */
|
||||
static int keyingset_poll_active_edit (bContext *C)
|
||||
static int keyingset_poll_active_edit(bContext *C)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
if (scene == NULL)
|
||||
return 0;
|
||||
@@ -94,9 +94,9 @@ static int keyingset_poll_active_edit (bContext *C)
|
||||
}
|
||||
|
||||
/* poll callback for editing active KeyingSet Path */
|
||||
static int keyingset_poll_activePath_edit (bContext *C)
|
||||
static int keyingset_poll_activePath_edit(bContext *C)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
KeyingSet *ks;
|
||||
|
||||
if (scene == NULL)
|
||||
@@ -104,7 +104,7 @@ static int keyingset_poll_activePath_edit (bContext *C)
|
||||
if (scene->active_keyingset <= 0)
|
||||
return 0;
|
||||
else
|
||||
ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* there must be an active KeyingSet and an active path */
|
||||
return ((ks) && (ks->paths.first) && (ks->active_path > 0));
|
||||
@@ -113,10 +113,10 @@ static int keyingset_poll_activePath_edit (bContext *C)
|
||||
|
||||
/* Add a Default (Empty) Keying Set ------------------------- */
|
||||
|
||||
static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
static int add_default_keyingset_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
short flag=0, keyingflag=0;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
short flag = 0, keyingflag = 0;
|
||||
|
||||
/* validate flags
|
||||
* - absolute KeyingSets should be created by default
|
||||
@@ -129,10 +129,10 @@ static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
/* call the API func, and set the active keyingset index */
|
||||
BKE_keyingset_add(&scene->keyingsets, NULL, NULL, flag, keyingflag);
|
||||
|
||||
scene->active_keyingset= BLI_countlist(&scene->keyingsets);
|
||||
scene->active_keyingset = BLI_countlist(&scene->keyingsets);
|
||||
|
||||
/* send notifiers */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -151,9 +151,9 @@ void ANIM_OT_keying_set_add(wmOperatorType *ot)
|
||||
|
||||
/* Remove 'Active' Keying Set ------------------------- */
|
||||
|
||||
static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
|
||||
static int remove_active_keyingset_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
KeyingSet *ks;
|
||||
|
||||
/* verify the Keying Set to use:
|
||||
@@ -169,7 +169,7 @@ static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else
|
||||
ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* free KeyingSet's data, then remove it from the scene */
|
||||
BKE_keyingset_free(ks);
|
||||
@@ -179,7 +179,7 @@ static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
|
||||
scene->active_keyingset--;
|
||||
|
||||
/* send notifiers */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -198,9 +198,9 @@ void ANIM_OT_keying_set_remove(wmOperatorType *ot)
|
||||
|
||||
/* Add Empty Keying Set Path ------------------------- */
|
||||
|
||||
static int add_empty_ks_path_exec (bContext *C, wmOperator *op)
|
||||
static int add_empty_ks_path_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
KeyingSet *ks;
|
||||
KS_Path *ksp;
|
||||
|
||||
@@ -213,16 +213,16 @@ static int add_empty_ks_path_exec (bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else
|
||||
ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* don't use the API method for this, since that checks on values... */
|
||||
ksp= MEM_callocN(sizeof(KS_Path), "KeyingSetPath Empty");
|
||||
ksp = MEM_callocN(sizeof(KS_Path), "KeyingSetPath Empty");
|
||||
BLI_addtail(&ks->paths, ksp);
|
||||
ks->active_path= BLI_countlist(&ks->paths);
|
||||
ks->active_path = BLI_countlist(&ks->paths);
|
||||
|
||||
ksp->groupmode= KSP_GROUP_KSNAME; // XXX?
|
||||
ksp->idtype= ID_OB;
|
||||
ksp->flag= KSP_FLAG_WHOLE_ARRAY;
|
||||
ksp->groupmode = KSP_GROUP_KSNAME; // XXX?
|
||||
ksp->idtype = ID_OB;
|
||||
ksp->flag = KSP_FLAG_WHOLE_ARRAY;
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -241,14 +241,14 @@ void ANIM_OT_keying_set_path_add(wmOperatorType *ot)
|
||||
|
||||
/* Remove Active Keying Set Path ------------------------- */
|
||||
|
||||
static int remove_active_ks_path_exec (bContext *C, wmOperator *op)
|
||||
static int remove_active_ks_path_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
KeyingSet *ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
KeyingSet *ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* if there is a KeyingSet, find the nominated path to remove */
|
||||
if (ks) {
|
||||
KS_Path *ksp= BLI_findlink(&ks->paths, ks->active_path-1);
|
||||
KS_Path *ksp = BLI_findlink(&ks->paths, ks->active_path - 1);
|
||||
|
||||
if (ksp) {
|
||||
/* remove the active path from the KeyingSet */
|
||||
@@ -287,24 +287,24 @@ void ANIM_OT_keying_set_path_remove(wmOperatorType *ot)
|
||||
|
||||
/* Add to KeyingSet Button Operator ------------------------ */
|
||||
|
||||
static int add_keyingset_button_exec (bContext *C, wmOperator *op)
|
||||
static int add_keyingset_button_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
KeyingSet *ks = NULL;
|
||||
PropertyRNA *prop= NULL;
|
||||
PointerRNA ptr= {{NULL}};
|
||||
PropertyRNA *prop = NULL;
|
||||
PointerRNA ptr = {{NULL}};
|
||||
char *path = NULL;
|
||||
short success= 0;
|
||||
int index=0, pflag=0;
|
||||
int all= RNA_boolean_get(op->ptr, "all");
|
||||
short success = 0;
|
||||
int index = 0, pflag = 0;
|
||||
int all = RNA_boolean_get(op->ptr, "all");
|
||||
|
||||
/* verify the Keying Set to use:
|
||||
* - use the active one for now (more control over this can be added later)
|
||||
* - add a new one if it doesn't exist
|
||||
*/
|
||||
if (scene->active_keyingset == 0) {
|
||||
short flag=0, keyingflag=0;
|
||||
short flag = 0, keyingflag = 0;
|
||||
|
||||
/* validate flags
|
||||
* - absolute KeyingSets should be created by default
|
||||
@@ -317,23 +317,23 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
|
||||
keyingflag |= INSERTKEY_XYZ2RGB;
|
||||
|
||||
/* call the API func, and set the active keyingset index */
|
||||
ks= BKE_keyingset_add(&scene->keyingsets, "ButtonKeyingSet", "Button Keying Set", flag, keyingflag);
|
||||
ks = BKE_keyingset_add(&scene->keyingsets, "ButtonKeyingSet", "Button Keying Set", flag, keyingflag);
|
||||
|
||||
scene->active_keyingset= BLI_countlist(&scene->keyingsets);
|
||||
scene->active_keyingset = BLI_countlist(&scene->keyingsets);
|
||||
}
|
||||
else if (scene->active_keyingset < 0) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Cannot add property to built in Keying Set");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else
|
||||
ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* try to add to keyingset using property retrieved from UI */
|
||||
uiContextActiveProperty(C, &ptr, &prop, &index);
|
||||
|
||||
/* check if property is able to be added */
|
||||
if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
|
||||
path= RNA_path_from_ID_to_property(&ptr, prop);
|
||||
path = RNA_path_from_ID_to_property(&ptr, prop);
|
||||
|
||||
if (path) {
|
||||
/* set flags */
|
||||
@@ -344,13 +344,13 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
|
||||
* necessary if we want the entire array for most cases to get included without the user
|
||||
* having to worry about where they clicked
|
||||
*/
|
||||
index= 0;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
/* add path to this setting */
|
||||
BKE_keyingset_add_path(ks, ptr.id.data, NULL, path, index, pflag, KSP_GROUP_KSNAME);
|
||||
ks->active_path= BLI_countlist(&ks->paths);
|
||||
success= 1;
|
||||
ks->active_path = BLI_countlist(&ks->paths);
|
||||
success = 1;
|
||||
|
||||
/* free the temp path created */
|
||||
MEM_freeN(path);
|
||||
@@ -362,10 +362,10 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
|
||||
DAG_ids_flush_update(bmain, 0);
|
||||
|
||||
/* for now, only send ND_KEYS for KeyingSets */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
|
||||
}
|
||||
|
||||
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
|
||||
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
|
||||
@@ -380,7 +380,7 @@ void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
|
||||
//op->poll= ???
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "all", 1, "All", "Add all elements of the array to a Keying Set");
|
||||
@@ -388,16 +388,16 @@ void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
|
||||
|
||||
/* Remove from KeyingSet Button Operator ------------------------ */
|
||||
|
||||
static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
|
||||
static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
KeyingSet *ks = NULL;
|
||||
PropertyRNA *prop= NULL;
|
||||
PointerRNA ptr= {{NULL}};
|
||||
PropertyRNA *prop = NULL;
|
||||
PointerRNA ptr = {{NULL}};
|
||||
char *path = NULL;
|
||||
short success= 0;
|
||||
int index=0;
|
||||
short success = 0;
|
||||
int index = 0;
|
||||
|
||||
/* verify the Keying Set to use:
|
||||
* - use the active one for now (more control over this can be added later)
|
||||
@@ -412,23 +412,23 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else
|
||||
ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* try to add to keyingset using property retrieved from UI */
|
||||
uiContextActiveProperty(C, &ptr, &prop, &index);
|
||||
|
||||
if (ptr.id.data && ptr.data && prop) {
|
||||
path= RNA_path_from_ID_to_property(&ptr, prop);
|
||||
path = RNA_path_from_ID_to_property(&ptr, prop);
|
||||
|
||||
if (path) {
|
||||
KS_Path *ksp;
|
||||
|
||||
/* try to find a path matching this description */
|
||||
ksp= BKE_keyingset_find_path(ks, ptr.id.data, ks->name, path, index, KSP_GROUP_KSNAME);
|
||||
ksp = BKE_keyingset_find_path(ks, ptr.id.data, ks->name, path, index, KSP_GROUP_KSNAME);
|
||||
|
||||
if (ksp) {
|
||||
BKE_keyingset_free_path(ks, ksp);
|
||||
success= 1;
|
||||
success = 1;
|
||||
}
|
||||
|
||||
/* free temp path used */
|
||||
@@ -442,10 +442,10 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
|
||||
DAG_ids_flush_update(bmain, 0);
|
||||
|
||||
/* for now, only send ND_KEYS for KeyingSets */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
|
||||
}
|
||||
|
||||
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
|
||||
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
|
||||
@@ -460,7 +460,7 @@ void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
|
||||
//op->poll= ???
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ******************************************* */
|
||||
@@ -468,7 +468,7 @@ void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
|
||||
/* Change Active KeyingSet Operator ------------------------ */
|
||||
/* This operator checks if a menu should be shown for choosing the KeyingSet to make the active one */
|
||||
|
||||
static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
|
||||
static int keyingset_active_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
|
||||
{
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
@@ -482,7 +482,7 @@ static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *U
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int keyingset_active_menu_exec (bContext *C, wmOperator *op)
|
||||
static int keyingset_active_menu_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
int type = RNA_enum_get(op->ptr, "type");
|
||||
@@ -491,7 +491,7 @@ static int keyingset_active_menu_exec (bContext *C, wmOperator *op)
|
||||
scene->active_keyingset = type;
|
||||
|
||||
/* send notifiers */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -511,10 +511,10 @@ void ANIM_OT_keying_set_active_set(wmOperatorType *ot)
|
||||
ot->poll = ED_operator_areaactive;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* keyingset to use (dynamic enum) */
|
||||
prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
|
||||
prop = RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
|
||||
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
|
||||
/* RNA_def_property_flag(prop, PROP_HIDDEN);*/
|
||||
}
|
||||
@@ -531,7 +531,7 @@ ListBase builtin_keyingsets = {NULL, NULL};
|
||||
/* --------------- */
|
||||
|
||||
/* Find KeyingSet type info given a name */
|
||||
KeyingSetInfo *ANIM_keyingset_info_find_name (const char name[])
|
||||
KeyingSetInfo *ANIM_keyingset_info_find_name(const char name[])
|
||||
{
|
||||
/* sanity checks */
|
||||
if ((name == NULL) || (name[0] == 0))
|
||||
@@ -542,9 +542,9 @@ KeyingSetInfo *ANIM_keyingset_info_find_name (const char name[])
|
||||
}
|
||||
|
||||
/* Find builtin KeyingSet by name */
|
||||
KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[])
|
||||
KeyingSet *ANIM_builtin_keyingset_get_named(KeyingSet *prevKS, const char name[])
|
||||
{
|
||||
KeyingSet *ks, *first=NULL;
|
||||
KeyingSet *ks, *first = NULL;
|
||||
|
||||
/* sanity checks any name to check? */
|
||||
if (name[0] == 0)
|
||||
@@ -552,12 +552,12 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[
|
||||
|
||||
/* get first KeyingSet to use */
|
||||
if (prevKS && prevKS->next)
|
||||
first= prevKS->next;
|
||||
first = prevKS->next;
|
||||
else
|
||||
first= builtin_keyingsets.first;
|
||||
first = builtin_keyingsets.first;
|
||||
|
||||
/* loop over KeyingSets checking names */
|
||||
for (ks= first; ks; ks= ks->next) {
|
||||
for (ks = first; ks; ks = ks->next) {
|
||||
if (strcmp(name, ks->idname) == 0)
|
||||
return ks;
|
||||
}
|
||||
@@ -601,7 +601,7 @@ void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *ksi)
|
||||
/* find relevant builtin KeyingSets which use this, and remove them */
|
||||
// TODO: this isn't done now, since unregister is really only used atm when we
|
||||
// reload the scripts, which kindof defeats the purpose of "builtin"?
|
||||
for (ks= builtin_keyingsets.first; ks; ks= ksn) {
|
||||
for (ks = builtin_keyingsets.first; ks; ks = ksn) {
|
||||
ksn = ks->next;
|
||||
|
||||
/* remove if matching typeinfo name */
|
||||
@@ -610,7 +610,7 @@ void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *ksi)
|
||||
BKE_keyingset_free(ks);
|
||||
BLI_remlink(&builtin_keyingsets, ks);
|
||||
|
||||
for (scene= bmain->scene.first; scene; scene= scene->id.next)
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next)
|
||||
BLI_remlink_safe(&scene->keyingsets, ks);
|
||||
|
||||
MEM_freeN(ks);
|
||||
@@ -628,8 +628,8 @@ void ANIM_keyingset_infos_exit(void)
|
||||
KeyingSetInfo *ksi, *next;
|
||||
|
||||
/* free type infos */
|
||||
for (ksi=keyingset_type_infos.first; ksi; ksi=next) {
|
||||
next= ksi->next;
|
||||
for (ksi = keyingset_type_infos.first; ksi; ksi = next) {
|
||||
next = ksi->next;
|
||||
|
||||
/* free extra RNA data, and remove from list */
|
||||
if (ksi->ext.free)
|
||||
@@ -647,7 +647,7 @@ void ANIM_keyingset_infos_exit(void)
|
||||
/* Getters for Active/Indices ----------------------------- */
|
||||
|
||||
/* Get the active Keying Set for the Scene provided */
|
||||
KeyingSet *ANIM_scene_get_active_keyingset (Scene *scene)
|
||||
KeyingSet *ANIM_scene_get_active_keyingset(Scene *scene)
|
||||
{
|
||||
/* if no scene, we've got no hope of finding the Keying Set */
|
||||
if (scene == NULL)
|
||||
@@ -659,9 +659,9 @@ KeyingSet *ANIM_scene_get_active_keyingset (Scene *scene)
|
||||
* - < 0: a builtin keying set
|
||||
*/
|
||||
if (scene->active_keyingset > 0)
|
||||
return BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
|
||||
return BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
else
|
||||
return BLI_findlink(&builtin_keyingsets, (-scene->active_keyingset)-1);
|
||||
return BLI_findlink(&builtin_keyingsets, (-scene->active_keyingset) - 1);
|
||||
}
|
||||
|
||||
/* Get the index of the Keying Set provided, for the given Scene */
|
||||
@@ -699,7 +699,7 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformK
|
||||
{
|
||||
/* get KeyingSet to use
|
||||
* - use the active KeyingSet if defined (and user wants to use it for all autokeying),
|
||||
* or otherwise key transforms only
|
||||
* or otherwise key transforms only
|
||||
*/
|
||||
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (scene->active_keyingset))
|
||||
return ANIM_scene_get_active_keyingset(scene);
|
||||
@@ -712,13 +712,13 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformK
|
||||
/* Menu of All Keying Sets ----------------------------- */
|
||||
|
||||
/* Dynamically populate an enum of Keying Sets */
|
||||
EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
|
||||
EnumPropertyItem *ANIM_keying_sets_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
KeyingSet *ks;
|
||||
EnumPropertyItem *item= NULL, item_tmp= {0};
|
||||
int totitem= 0;
|
||||
int i= 0;
|
||||
EnumPropertyItem *item = NULL, item_tmp = {0};
|
||||
int totitem = 0;
|
||||
int i = 0;
|
||||
|
||||
if (C == NULL) {
|
||||
return DummyRNA_DEFAULT_items;
|
||||
@@ -729,9 +729,9 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
|
||||
*/
|
||||
if (scene->active_keyingset) {
|
||||
/* active Keying Set */
|
||||
item_tmp.identifier= "__ACTIVE__";
|
||||
item_tmp.name= "Active Keying Set";
|
||||
item_tmp.value= i;
|
||||
item_tmp.identifier = "__ACTIVE__";
|
||||
item_tmp.name = "Active Keying Set";
|
||||
item_tmp.value = i;
|
||||
RNA_enum_item_add(&item, &totitem, &item_tmp);
|
||||
|
||||
/* separator */
|
||||
@@ -744,12 +744,12 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
|
||||
* - these are listed in the order in which they were defined for the active scene
|
||||
*/
|
||||
if (scene->keyingsets.first) {
|
||||
for (ks= scene->keyingsets.first; ks; ks= ks->next, i++) {
|
||||
for (ks = scene->keyingsets.first; ks; ks = ks->next, i++) {
|
||||
if (ANIM_keyingset_context_ok_poll(C, ks)) {
|
||||
item_tmp.identifier = ks->idname;
|
||||
item_tmp.name = ks->name;
|
||||
item_tmp.description = ks->description;
|
||||
item_tmp.value= i;
|
||||
item_tmp.value = i;
|
||||
RNA_enum_item_add(&item, &totitem, &item_tmp);
|
||||
}
|
||||
}
|
||||
@@ -759,20 +759,20 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
|
||||
}
|
||||
|
||||
/* builtin Keying Sets */
|
||||
i= -1;
|
||||
for (ks= builtin_keyingsets.first; ks; ks= ks->next, i--) {
|
||||
i = -1;
|
||||
for (ks = builtin_keyingsets.first; ks; ks = ks->next, i--) {
|
||||
/* only show KeyingSet if context is suitable */
|
||||
if (ANIM_keyingset_context_ok_poll(C, ks)) {
|
||||
item_tmp.identifier = ks->idname;
|
||||
item_tmp.name = ks->name;
|
||||
item_tmp.description = ks->description;
|
||||
item_tmp.value= i;
|
||||
item_tmp.value = i;
|
||||
RNA_enum_item_add(&item, &totitem, &item_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
RNA_enum_item_end(&item, &totitem);
|
||||
*free= 1;
|
||||
*free = 1;
|
||||
|
||||
return item;
|
||||
}
|
||||
@@ -803,12 +803,12 @@ short ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *ks)
|
||||
/* Special 'Overrides' Iterator for Relative KeyingSets ------ */
|
||||
|
||||
/* 'Data Sources' for relative Keying Set 'overrides'
|
||||
* - this is basically a wrapper for PointerRNA's in a linked list
|
||||
* - this is basically a wrapper for PointerRNA's in a linked list
|
||||
* - do not allow this to be accessed from outside for now
|
||||
*/
|
||||
typedef struct tRKS_DSource {
|
||||
struct tRKS_DSource *next, *prev;
|
||||
PointerRNA ptr; /* the whole point of this exercise! */
|
||||
PointerRNA ptr; /* the whole point of this exercise! */
|
||||
} tRKS_DSource;
|
||||
|
||||
|
||||
@@ -816,7 +816,7 @@ typedef struct tRKS_DSource {
|
||||
* relative Keying Sets, with the main usage of this being operators
|
||||
* requiring Auto Keyframing. Internal Use Only!
|
||||
*/
|
||||
static void RKS_ITER_overrides_list (KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, ListBase *dsources)
|
||||
static void RKS_ITER_overrides_list(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, ListBase *dsources)
|
||||
{
|
||||
tRKS_DSource *ds;
|
||||
|
||||
@@ -910,11 +910,11 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
|
||||
*/
|
||||
int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ReportList *reports = CTX_wm_reports(C);
|
||||
KS_Path *ksp;
|
||||
int kflag=0, success= 0;
|
||||
char *groupname= NULL;
|
||||
int kflag = 0, success = 0;
|
||||
char *groupname = NULL;
|
||||
|
||||
/* sanity checks */
|
||||
if (ks == NULL)
|
||||
@@ -923,13 +923,13 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
|
||||
/* get flags to use */
|
||||
if (mode == MODIFYKEY_MODE_INSERT) {
|
||||
/* use KeyingSet's flags as base */
|
||||
kflag= ks->keyingflag;
|
||||
kflag = ks->keyingflag;
|
||||
|
||||
/* suppliment with info from the context */
|
||||
kflag |= ANIM_get_keyframing_flags(scene, 1);
|
||||
}
|
||||
else if (mode == MODIFYKEY_MODE_DELETE)
|
||||
kflag= 0;
|
||||
kflag = 0;
|
||||
|
||||
/* if relative Keying Sets, poll and build up the paths */
|
||||
success = ANIM_validate_keyingset(C, dsources, ks);
|
||||
@@ -940,15 +940,15 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
|
||||
}
|
||||
|
||||
/* apply the paths as specified in the KeyingSet now */
|
||||
for (ksp= ks->paths.first; ksp; ksp= ksp->next) {
|
||||
for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
|
||||
int arraylen, i;
|
||||
short kflag2;
|
||||
|
||||
/* skip path if no ID pointer is specified */
|
||||
if (ksp->id == NULL) {
|
||||
BKE_reportf(reports, RPT_WARNING,
|
||||
"Skipping path in Keying Set, as it has no ID (KS = '%s', Path = '%s'[%d])",
|
||||
ks->name, ksp->rna_path, ksp->array_index);
|
||||
"Skipping path in Keying Set, as it has no ID (KS = '%s', Path = '%s'[%d])",
|
||||
ks->name, ksp->rna_path, ksp->array_index);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -957,17 +957,17 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
|
||||
|
||||
/* get pointer to name of group to add channels to */
|
||||
if (ksp->groupmode == KSP_GROUP_NONE)
|
||||
groupname= NULL;
|
||||
groupname = NULL;
|
||||
else if (ksp->groupmode == KSP_GROUP_KSNAME)
|
||||
groupname= ks->name;
|
||||
groupname = ks->name;
|
||||
else
|
||||
groupname= ksp->group;
|
||||
groupname = ksp->group;
|
||||
|
||||
/* init arraylen and i - arraylen should be greater than i so that
|
||||
* normal non-array entries get keyframed correctly
|
||||
*/
|
||||
i= ksp->array_index;
|
||||
arraylen= i;
|
||||
i = ksp->array_index;
|
||||
arraylen = i;
|
||||
|
||||
/* get length of array if whole array option is enabled */
|
||||
if (ksp->flag & KSP_FLAG_WHOLE_ARRAY) {
|
||||
@@ -976,7 +976,7 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
|
||||
|
||||
RNA_id_pointer_create(ksp->id, &id_ptr);
|
||||
if (RNA_path_resolve(&id_ptr, ksp->rna_path, &ptr, &prop) && prop)
|
||||
arraylen= RNA_property_array_length(&ptr, prop);
|
||||
arraylen = RNA_property_array_length(&ptr, prop);
|
||||
}
|
||||
|
||||
/* we should do at least one step */
|
||||
@@ -998,15 +998,15 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
|
||||
switch (GS(ksp->id->name)) {
|
||||
case ID_OB: /* Object (or Object-Related) Keyframes */
|
||||
{
|
||||
Object *ob= (Object *)ksp->id;
|
||||
Object *ob = (Object *)ksp->id;
|
||||
|
||||
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; // XXX: only object transforms only?
|
||||
ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; // XXX: only object transforms only?
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
/* send notifiers for updates (this doesn't require context to work!) */
|
||||
WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
|
||||
WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
|
||||
}
|
||||
|
||||
/* return the number of channels successfully affected */
|
||||
|
||||
@@ -63,15 +63,15 @@
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "buttons_intern.h" // own include
|
||||
#include "buttons_intern.h" // own include
|
||||
|
||||
static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type)
|
||||
{
|
||||
PointerRNA *ptr;
|
||||
int a;
|
||||
|
||||
for (a=0; a<path->len; a++) {
|
||||
ptr= &path->ptr[a];
|
||||
for (a = 0; a < path->len; a++) {
|
||||
ptr = &path->ptr[a];
|
||||
|
||||
if (RNA_struct_is_a(ptr->type, type)) {
|
||||
CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
|
||||
@@ -87,8 +87,8 @@ static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type)
|
||||
PointerRNA *ptr;
|
||||
int a;
|
||||
|
||||
for (a=0; a<path->len; a++) {
|
||||
ptr= &path->ptr[a];
|
||||
for (a = 0; a < path->len; a++) {
|
||||
ptr = &path->ptr[a];
|
||||
|
||||
if (RNA_struct_is_a(ptr->type, type))
|
||||
return ptr;
|
||||
@@ -101,7 +101,7 @@ static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type)
|
||||
|
||||
static int buttons_context_path_scene(ButsContextPath *path)
|
||||
{
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
|
||||
/* this one just verifies */
|
||||
return RNA_struct_is_a(ptr->type, &RNA_Scene);
|
||||
@@ -113,7 +113,7 @@ static int buttons_context_path_world(ButsContextPath *path)
|
||||
{
|
||||
Scene *scene;
|
||||
World *world;
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
|
||||
/* if we already have a (pinned) world, we're done */
|
||||
if (RNA_struct_is_a(ptr->type, &RNA_World)) {
|
||||
@@ -121,8 +121,8 @@ static int buttons_context_path_world(ButsContextPath *path)
|
||||
}
|
||||
/* if we have a scene, use the scene's world */
|
||||
else if (buttons_context_path_scene(path)) {
|
||||
scene= path->ptr[path->len-1].data;
|
||||
world= scene->world;
|
||||
scene = path->ptr[path->len - 1].data;
|
||||
world = scene->world;
|
||||
|
||||
if (world) {
|
||||
RNA_id_pointer_create(&scene->world->id, &path->ptr[path->len]);
|
||||
@@ -143,7 +143,7 @@ static int buttons_context_path_object(ButsContextPath *path)
|
||||
{
|
||||
Scene *scene;
|
||||
Object *ob;
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
|
||||
/* if we already have a (pinned) object, we're done */
|
||||
if (RNA_struct_is_a(ptr->type, &RNA_Object)) {
|
||||
@@ -151,8 +151,8 @@ static int buttons_context_path_object(ButsContextPath *path)
|
||||
}
|
||||
/* if we have a scene, use the scene's active object */
|
||||
else if (buttons_context_path_scene(path)) {
|
||||
scene= path->ptr[path->len-1].data;
|
||||
ob= (scene->basact)? scene->basact->object: NULL;
|
||||
scene = path->ptr[path->len - 1].data;
|
||||
ob = (scene->basact) ? scene->basact->object : NULL;
|
||||
|
||||
if (ob) {
|
||||
RNA_id_pointer_create(&ob->id, &path->ptr[path->len]);
|
||||
@@ -169,7 +169,7 @@ static int buttons_context_path_object(ButsContextPath *path)
|
||||
static int buttons_context_path_data(ButsContextPath *path, int type)
|
||||
{
|
||||
Object *ob;
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
|
||||
/* if we already have a data, we're done */
|
||||
if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) return 1;
|
||||
@@ -182,7 +182,7 @@ static int buttons_context_path_data(ButsContextPath *path, int type)
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1;
|
||||
/* try to get an object in the path, no pinning supported here */
|
||||
else if (buttons_context_path_object(path)) {
|
||||
ob= path->ptr[path->len-1].data;
|
||||
ob = path->ptr[path->len - 1].data;
|
||||
|
||||
if (ob && (type == -1 || type == ob->type)) {
|
||||
RNA_id_pointer_create(ob->data, &path->ptr[path->len]);
|
||||
@@ -201,7 +201,7 @@ static int buttons_context_path_modifier(ButsContextPath *path)
|
||||
Object *ob;
|
||||
|
||||
if (buttons_context_path_object(path)) {
|
||||
ob= path->ptr[path->len-1].data;
|
||||
ob = path->ptr[path->len - 1].data;
|
||||
|
||||
if (ob && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE))
|
||||
return 1;
|
||||
@@ -213,7 +213,7 @@ static int buttons_context_path_modifier(ButsContextPath *path)
|
||||
static int buttons_context_path_material(ButsContextPath *path, int for_texture)
|
||||
{
|
||||
Object *ob;
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
Material *ma;
|
||||
|
||||
/* if we already have a (pinned) material, we're done */
|
||||
@@ -222,17 +222,17 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture)
|
||||
}
|
||||
/* if we have an object, use the object material slot */
|
||||
else if (buttons_context_path_object(path)) {
|
||||
ob= path->ptr[path->len-1].data;
|
||||
ob = path->ptr[path->len - 1].data;
|
||||
|
||||
if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
|
||||
ma= give_current_material(ob, ob->actcol);
|
||||
ma = give_current_material(ob, ob->actcol);
|
||||
RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
|
||||
if (for_texture && give_current_material_texture_node(ma))
|
||||
return 1;
|
||||
|
||||
ma= give_node_material(ma);
|
||||
ma = give_node_material(ma);
|
||||
if (ma) {
|
||||
RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@@ -252,11 +252,11 @@ static int buttons_context_path_bone(ButsContextPath *path)
|
||||
|
||||
/* if we have an armature, get the active bone */
|
||||
if (buttons_context_path_data(path, OB_ARMATURE)) {
|
||||
arm= path->ptr[path->len-1].data;
|
||||
arm = path->ptr[path->len - 1].data;
|
||||
|
||||
if (arm->edbo) {
|
||||
if (arm->act_edbone) {
|
||||
edbo= arm->act_edbone;
|
||||
edbo = arm->act_edbone;
|
||||
RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
return 1;
|
||||
@@ -277,7 +277,7 @@ static int buttons_context_path_bone(ButsContextPath *path)
|
||||
|
||||
static int buttons_context_path_pose_bone(ButsContextPath *path)
|
||||
{
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
|
||||
/* if we already have a (pinned) PoseBone, we're done */
|
||||
if (RNA_struct_is_a(ptr->type, &RNA_PoseBone)) {
|
||||
@@ -286,15 +286,15 @@ static int buttons_context_path_pose_bone(ButsContextPath *path)
|
||||
|
||||
/* if we have an armature, get the active bone */
|
||||
if (buttons_context_path_object(path)) {
|
||||
Object *ob= path->ptr[path->len-1].data;
|
||||
bArmature *arm= ob->data; /* path->ptr[path->len-1].data - works too */
|
||||
Object *ob = path->ptr[path->len - 1].data;
|
||||
bArmature *arm = ob->data; /* path->ptr[path->len-1].data - works too */
|
||||
|
||||
if (ob->type != OB_ARMATURE || arm->edbo) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (arm->act_bone) {
|
||||
bPoseChannel *pchan= BKE_pose_channel_find_name(ob->pose, arm->act_bone->name);
|
||||
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, arm->act_bone->name);
|
||||
if (pchan) {
|
||||
RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@@ -313,7 +313,7 @@ static int buttons_context_path_particle(ButsContextPath *path)
|
||||
{
|
||||
Object *ob;
|
||||
ParticleSystem *psys;
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
|
||||
/* if we already have (pinned) particle settings, we're done */
|
||||
if (RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) {
|
||||
@@ -321,10 +321,10 @@ static int buttons_context_path_particle(ButsContextPath *path)
|
||||
}
|
||||
/* if we have an object, get the active particle system */
|
||||
if (buttons_context_path_object(path)) {
|
||||
ob= path->ptr[path->len-1].data;
|
||||
ob = path->ptr[path->len - 1].data;
|
||||
|
||||
if (ob && ob->type == OB_MESH) {
|
||||
psys= psys_get_current(ob);
|
||||
psys = psys_get_current(ob);
|
||||
|
||||
RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@@ -339,8 +339,8 @@ static int buttons_context_path_particle(ButsContextPath *path)
|
||||
static int buttons_context_path_brush(ButsContextPath *path)
|
||||
{
|
||||
Scene *scene;
|
||||
Brush *br= NULL;
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
Brush *br = NULL;
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
|
||||
/* if we already have a (pinned) brush, we're done */
|
||||
if (RNA_struct_is_a(ptr->type, &RNA_Brush)) {
|
||||
@@ -348,10 +348,10 @@ static int buttons_context_path_brush(ButsContextPath *path)
|
||||
}
|
||||
/* if we have a scene, use the toolsettings brushes */
|
||||
else if (buttons_context_path_scene(path)) {
|
||||
scene= path->ptr[path->len-1].data;
|
||||
scene = path->ptr[path->len - 1].data;
|
||||
|
||||
if (scene)
|
||||
br= paint_brush(paint_get_active(scene));
|
||||
br = paint_brush(paint_get_active(scene));
|
||||
|
||||
if (br) {
|
||||
RNA_id_pointer_create((ID *)br, &path->ptr[path->len]);
|
||||
@@ -369,7 +369,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
{
|
||||
if (ct) {
|
||||
/* new shading system */
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
ID *id;
|
||||
|
||||
/* if we already have a (pinned) texture, we're done */
|
||||
@@ -379,7 +379,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
if (!ct->user)
|
||||
return 0;
|
||||
|
||||
id= ct->user->id;
|
||||
id = ct->user->id;
|
||||
|
||||
if (id) {
|
||||
if (GS(id->name) == ID_BR)
|
||||
@@ -411,7 +411,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
World *wo;
|
||||
ParticleSystem *psys;
|
||||
Tex *tex;
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
PointerRNA *ptr = &path->ptr[path->len - 1];
|
||||
int orig_len = path->len;
|
||||
|
||||
/* if we already have a (pinned) texture, we're done */
|
||||
@@ -420,10 +420,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
}
|
||||
/* try brush */
|
||||
if ((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) {
|
||||
br= path->ptr[path->len-1].data;
|
||||
br = path->ptr[path->len - 1].data;
|
||||
|
||||
if (br) {
|
||||
tex= give_current_brush_texture(br);
|
||||
tex = give_current_brush_texture(br);
|
||||
|
||||
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@@ -432,10 +432,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
}
|
||||
/* try world */
|
||||
if ((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) {
|
||||
wo= path->ptr[path->len-1].data;
|
||||
wo = path->ptr[path->len - 1].data;
|
||||
|
||||
if (wo && GS(wo->id.name)==ID_WO) {
|
||||
tex= give_current_world_texture(wo);
|
||||
if (wo && GS(wo->id.name) == ID_WO) {
|
||||
tex = give_current_world_texture(wo);
|
||||
|
||||
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@@ -444,19 +444,19 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
}
|
||||
/* try particles */
|
||||
if ((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) {
|
||||
if (path->ptr[path->len-1].type == &RNA_ParticleSettings) {
|
||||
ParticleSettings *part = path->ptr[path->len-1].data;
|
||||
if (path->ptr[path->len - 1].type == &RNA_ParticleSettings) {
|
||||
ParticleSettings *part = path->ptr[path->len - 1].data;
|
||||
|
||||
tex= give_current_particle_texture(part);
|
||||
tex = give_current_particle_texture(part);
|
||||
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
psys= path->ptr[path->len-1].data;
|
||||
psys = path->ptr[path->len - 1].data;
|
||||
|
||||
if (psys && psys->part && GS(psys->part->id.name)==ID_PA) {
|
||||
tex= give_current_particle_texture(psys->part);
|
||||
if (psys && psys->part && GS(psys->part->id.name) == ID_PA) {
|
||||
tex = give_current_particle_texture(psys->part);
|
||||
|
||||
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@@ -466,10 +466,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
}
|
||||
/* try material */
|
||||
if (buttons_context_path_material(path, 1)) {
|
||||
ma= path->ptr[path->len-1].data;
|
||||
ma = path->ptr[path->len - 1].data;
|
||||
|
||||
if (ma) {
|
||||
tex= give_current_material_texture(ma);
|
||||
tex = give_current_material_texture(ma);
|
||||
|
||||
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@@ -478,10 +478,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
}
|
||||
/* try lamp */
|
||||
if (buttons_context_path_data(path, OB_LAMP)) {
|
||||
la= path->ptr[path->len-1].data;
|
||||
la = path->ptr[path->len - 1].data;
|
||||
|
||||
if (la) {
|
||||
tex= give_current_lamp_texture(la);
|
||||
tex = give_current_lamp_texture(la);
|
||||
|
||||
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@@ -491,10 +491,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
/* try brushes again in case of no material, lamp, etc */
|
||||
path->len = orig_len;
|
||||
if (buttons_context_path_brush(path)) {
|
||||
br= path->ptr[path->len-1].data;
|
||||
br = path->ptr[path->len - 1].data;
|
||||
|
||||
if (br) {
|
||||
tex= give_current_brush_texture(br);
|
||||
tex = give_current_brush_texture(br);
|
||||
|
||||
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@@ -510,17 +510,17 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
|
||||
|
||||
static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag)
|
||||
{
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
ID *id;
|
||||
int found;
|
||||
|
||||
memset(path, 0, sizeof(*path));
|
||||
path->flag= flag;
|
||||
path->flag = flag;
|
||||
path->tex_ctx = sbuts->texture_context;
|
||||
|
||||
/* if some ID datablock is pinned, set the root pointer */
|
||||
if (sbuts->pinid) {
|
||||
id= sbuts->pinid;
|
||||
id = sbuts->pinid;
|
||||
|
||||
RNA_id_pointer_create(id, &path->ptr[0]);
|
||||
path->len++;
|
||||
@@ -528,7 +528,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
|
||||
|
||||
/* no pinned root, use scene as root */
|
||||
if (path->len == 0) {
|
||||
id= (ID*)CTX_data_scene(C);
|
||||
id = (ID *)CTX_data_scene(C);
|
||||
RNA_id_pointer_create(id, &path->ptr[0]);
|
||||
path->len++;
|
||||
}
|
||||
@@ -538,41 +538,41 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
|
||||
switch (mainb) {
|
||||
case BCONTEXT_SCENE:
|
||||
case BCONTEXT_RENDER:
|
||||
found= buttons_context_path_scene(path);
|
||||
found = buttons_context_path_scene(path);
|
||||
break;
|
||||
case BCONTEXT_WORLD:
|
||||
found= buttons_context_path_world(path);
|
||||
found = buttons_context_path_world(path);
|
||||
break;
|
||||
case BCONTEXT_OBJECT:
|
||||
case BCONTEXT_PHYSICS:
|
||||
case BCONTEXT_CONSTRAINT:
|
||||
found= buttons_context_path_object(path);
|
||||
found = buttons_context_path_object(path);
|
||||
break;
|
||||
case BCONTEXT_MODIFIER:
|
||||
found= buttons_context_path_modifier(path);
|
||||
found = buttons_context_path_modifier(path);
|
||||
break;
|
||||
case BCONTEXT_DATA:
|
||||
found= buttons_context_path_data(path, -1);
|
||||
found = buttons_context_path_data(path, -1);
|
||||
break;
|
||||
case BCONTEXT_PARTICLE:
|
||||
found= buttons_context_path_particle(path);
|
||||
found = buttons_context_path_particle(path);
|
||||
break;
|
||||
case BCONTEXT_MATERIAL:
|
||||
found= buttons_context_path_material(path, 0);
|
||||
found = buttons_context_path_material(path, 0);
|
||||
break;
|
||||
case BCONTEXT_TEXTURE:
|
||||
found= buttons_context_path_texture(path, sbuts->texuser);
|
||||
found = buttons_context_path_texture(path, sbuts->texuser);
|
||||
break;
|
||||
case BCONTEXT_BONE:
|
||||
found= buttons_context_path_bone(path);
|
||||
found = buttons_context_path_bone(path);
|
||||
if (!found)
|
||||
found= buttons_context_path_data(path, OB_ARMATURE);
|
||||
found = buttons_context_path_data(path, OB_ARMATURE);
|
||||
break;
|
||||
case BCONTEXT_BONE_CONSTRAINT:
|
||||
found= buttons_context_path_pose_bone(path);
|
||||
found = buttons_context_path_pose_bone(path);
|
||||
break;
|
||||
default:
|
||||
found= 0;
|
||||
found = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
|
||||
|
||||
static int buttons_shading_context(const bContext *C, int mainb)
|
||||
{
|
||||
Object *ob= CTX_data_active_object(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
if (ELEM3(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE))
|
||||
return 1;
|
||||
@@ -593,7 +593,7 @@ static int buttons_shading_context(const bContext *C, int mainb)
|
||||
|
||||
static int buttons_shading_new_context(const bContext *C, int flag)
|
||||
{
|
||||
Object *ob= CTX_data_active_object(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
if (flag & (1 << BCONTEXT_MATERIAL))
|
||||
return BCONTEXT_MATERIAL;
|
||||
@@ -609,29 +609,29 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
|
||||
{
|
||||
ButsContextPath *path;
|
||||
PointerRNA *ptr;
|
||||
int a, pflag= 0, flag= 0;
|
||||
int a, pflag = 0, flag = 0;
|
||||
|
||||
buttons_texture_context_compute(C, sbuts);
|
||||
|
||||
if (!sbuts->path)
|
||||
sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath");
|
||||
sbuts->path = MEM_callocN(sizeof(ButsContextPath), "ButsContextPath");
|
||||
|
||||
path= sbuts->path;
|
||||
path = sbuts->path;
|
||||
|
||||
/* for each context, see if we can compute a valid path to it, if
|
||||
* this is the case, we know we have to display the button */
|
||||
for (a=0; a<BCONTEXT_TOT; a++) {
|
||||
for (a = 0; a < BCONTEXT_TOT; a++) {
|
||||
if (buttons_context_path(C, path, a, pflag)) {
|
||||
flag |= (1<<a);
|
||||
flag |= (1 << a);
|
||||
|
||||
/* setting icon for data context */
|
||||
if (a == BCONTEXT_DATA) {
|
||||
ptr= &path->ptr[path->len-1];
|
||||
ptr = &path->ptr[path->len - 1];
|
||||
|
||||
if (ptr->type)
|
||||
sbuts->dataicon= RNA_struct_ui_icon(ptr->type);
|
||||
sbuts->dataicon = RNA_struct_ui_icon(ptr->type);
|
||||
else
|
||||
sbuts->dataicon= ICON_EMPTY_DATA;
|
||||
sbuts->dataicon = ICON_EMPTY_DATA;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -639,21 +639,21 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
|
||||
/* always try to use the tab that was explicitly
|
||||
* set to the user, so that once that context comes
|
||||
* back, the tab is activated again */
|
||||
sbuts->mainb= sbuts->mainbuser;
|
||||
sbuts->mainb = sbuts->mainbuser;
|
||||
|
||||
/* in case something becomes invalid, change */
|
||||
if ((flag & (1 << sbuts->mainb)) == 0) {
|
||||
if (sbuts->flag & SB_SHADING_CONTEXT) {
|
||||
/* try to keep showing shading related buttons */
|
||||
sbuts->mainb= buttons_shading_new_context(C, flag);
|
||||
sbuts->mainb = buttons_shading_new_context(C, flag);
|
||||
}
|
||||
else if (flag & BCONTEXT_OBJECT) {
|
||||
sbuts->mainb= BCONTEXT_OBJECT;
|
||||
sbuts->mainb = BCONTEXT_OBJECT;
|
||||
}
|
||||
else {
|
||||
for (a=0; a<BCONTEXT_TOT; a++) {
|
||||
for (a = 0; a < BCONTEXT_TOT; a++) {
|
||||
if (flag & (1 << a)) {
|
||||
sbuts->mainb= a;
|
||||
sbuts->mainb = a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -664,9 +664,9 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
|
||||
|
||||
if (!(flag & (1 << sbuts->mainb))) {
|
||||
if (flag & (1 << BCONTEXT_OBJECT))
|
||||
sbuts->mainb= BCONTEXT_OBJECT;
|
||||
sbuts->mainb = BCONTEXT_OBJECT;
|
||||
else
|
||||
sbuts->mainb= BCONTEXT_SCENE;
|
||||
sbuts->mainb = BCONTEXT_SCENE;
|
||||
}
|
||||
|
||||
if (buttons_shading_context(C, sbuts->mainb))
|
||||
@@ -674,7 +674,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
|
||||
else
|
||||
sbuts->flag &= ~SB_SHADING_CONTEXT;
|
||||
|
||||
sbuts->pathflag= flag;
|
||||
sbuts->pathflag = flag;
|
||||
}
|
||||
|
||||
/************************* Context Callback ************************/
|
||||
@@ -684,12 +684,13 @@ const char *buttons_context_dir[] = {
|
||||
"meta_ball", "lamp", "speaker", "camera", "material", "material_slot",
|
||||
"texture", "texture_slot", "texture_user", "bone", "edit_bone",
|
||||
"pose_bone", "particle_system", "particle_system_editable",
|
||||
"cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", NULL};
|
||||
"cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", NULL
|
||||
};
|
||||
|
||||
int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
|
||||
{
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
ButsContextPath *path= sbuts?sbuts->path:NULL;
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
ButsContextPath *path = sbuts ? sbuts->path : NULL;
|
||||
|
||||
if (!path)
|
||||
return 0;
|
||||
@@ -744,7 +745,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "texture")) {
|
||||
ButsContextTexture *ct= sbuts->texuser;
|
||||
ButsContextTexture *ct = sbuts->texuser;
|
||||
|
||||
if (ct) {
|
||||
/* new shading system */
|
||||
@@ -758,15 +759,15 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "material_slot")) {
|
||||
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
|
||||
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
|
||||
|
||||
if (ptr) {
|
||||
Object *ob= ptr->data;
|
||||
Object *ob = ptr->data;
|
||||
|
||||
if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) {
|
||||
/* a valid actcol isn't ensured [#27526] */
|
||||
int matnr= ob->actcol-1;
|
||||
if (matnr < 0) matnr= 0;
|
||||
int matnr = ob->actcol - 1;
|
||||
if (matnr < 0) matnr = 0;
|
||||
CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, &ob->mat[matnr]);
|
||||
}
|
||||
}
|
||||
@@ -774,20 +775,20 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "texture_user")) {
|
||||
ButsContextTexture *ct= sbuts->texuser;
|
||||
ButsContextTexture *ct = sbuts->texuser;
|
||||
|
||||
if (!ct)
|
||||
return -1; /* old shading system (found but not available) */
|
||||
return -1; /* old shading system (found but not available) */
|
||||
|
||||
if (ct->user && ct->user->ptr.data) {
|
||||
ButsTextureUser *user= ct->user;
|
||||
ButsTextureUser *user = ct->user;
|
||||
CTX_data_pointer_set(result, user->ptr.id.data, user->ptr.type, user->ptr.data);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "texture_node")) {
|
||||
ButsContextTexture *ct= sbuts->texuser;
|
||||
ButsContextTexture *ct = sbuts->texuser;
|
||||
|
||||
if (ct) {
|
||||
/* new shading system */
|
||||
@@ -800,11 +801,11 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
/* old shading system */
|
||||
PointerRNA *ptr;
|
||||
|
||||
if ((ptr=get_pointer_type(path, &RNA_Material))) {
|
||||
Material *ma= ptr->data;
|
||||
if ((ptr = get_pointer_type(path, &RNA_Material))) {
|
||||
Material *ma = ptr->data;
|
||||
|
||||
if (ma) {
|
||||
bNode *node= give_current_material_texture_node(ma);
|
||||
bNode *node = give_current_material_texture_node(ma);
|
||||
CTX_data_pointer_set(result, &ma->nodetree->id, &RNA_Node, node);
|
||||
}
|
||||
}
|
||||
@@ -813,14 +814,14 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
}
|
||||
}
|
||||
else if (CTX_data_equals(member, "texture_slot")) {
|
||||
ButsContextTexture *ct= sbuts->texuser;
|
||||
ButsContextTexture *ct = sbuts->texuser;
|
||||
PointerRNA *ptr;
|
||||
|
||||
if (ct)
|
||||
return 0; /* new shading system */
|
||||
return 0; /* new shading system */
|
||||
|
||||
if ((ptr=get_pointer_type(path, &RNA_Material))) {
|
||||
Material *ma= ptr->data;
|
||||
if ((ptr = get_pointer_type(path, &RNA_Material))) {
|
||||
Material *ma = ptr->data;
|
||||
|
||||
/* if we have a node material, get slot from material in material node */
|
||||
if (ma && ma->use_nodes && ma->nodetree) {
|
||||
@@ -829,7 +830,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
if (give_current_material_texture_node(ma))
|
||||
return 0;
|
||||
|
||||
ma= give_node_material(ma);
|
||||
ma = give_node_material(ma);
|
||||
if (ma)
|
||||
CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]);
|
||||
else
|
||||
@@ -839,26 +840,26 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]);
|
||||
}
|
||||
}
|
||||
else if ((ptr=get_pointer_type(path, &RNA_Lamp))) {
|
||||
Lamp *la= ptr->data;
|
||||
else if ((ptr = get_pointer_type(path, &RNA_Lamp))) {
|
||||
Lamp *la = ptr->data;
|
||||
|
||||
if (la)
|
||||
CTX_data_pointer_set(result, &la->id, &RNA_LampTextureSlot, la->mtex[(int)la->texact]);
|
||||
}
|
||||
else if ((ptr=get_pointer_type(path, &RNA_World))) {
|
||||
World *wo= ptr->data;
|
||||
else if ((ptr = get_pointer_type(path, &RNA_World))) {
|
||||
World *wo = ptr->data;
|
||||
|
||||
if (wo)
|
||||
CTX_data_pointer_set(result, &wo->id, &RNA_WorldTextureSlot, wo->mtex[(int)wo->texact]);
|
||||
}
|
||||
else if ((ptr=get_pointer_type(path, &RNA_Brush))) { /* how to get this into context? */
|
||||
Brush *br= ptr->data;
|
||||
else if ((ptr = get_pointer_type(path, &RNA_Brush))) { /* how to get this into context? */
|
||||
Brush *br = ptr->data;
|
||||
|
||||
if (br)
|
||||
CTX_data_pointer_set(result, &br->id, &RNA_BrushTextureSlot, &br->mtex);
|
||||
}
|
||||
else if ((ptr=get_pointer_type(path, &RNA_ParticleSystem))) {
|
||||
ParticleSettings *part= ((ParticleSystem *)ptr->data)->part;
|
||||
else if ((ptr = get_pointer_type(path, &RNA_ParticleSystem))) {
|
||||
ParticleSettings *part = ((ParticleSystem *)ptr->data)->part;
|
||||
|
||||
if (part)
|
||||
CTX_data_pointer_set(result, &part->id, &RNA_ParticleSettingsTextureSlot, part->mtex[(int)part->texact]);
|
||||
@@ -883,59 +884,59 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "particle_system_editable")) {
|
||||
if (PE_poll((bContext*)C))
|
||||
if (PE_poll((bContext *)C))
|
||||
set_pointer_type(path, result, &RNA_ParticleSystem);
|
||||
else
|
||||
CTX_data_pointer_set(result, NULL, &RNA_ParticleSystem, NULL);
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "cloth")) {
|
||||
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
|
||||
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
|
||||
|
||||
if (ptr && ptr->data) {
|
||||
Object *ob= ptr->data;
|
||||
ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth);
|
||||
Object *ob = ptr->data;
|
||||
ModifierData *md = modifiers_findByType(ob, eModifierType_Cloth);
|
||||
CTX_data_pointer_set(result, &ob->id, &RNA_ClothModifier, md);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (CTX_data_equals(member, "soft_body")) {
|
||||
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
|
||||
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
|
||||
|
||||
if (ptr && ptr->data) {
|
||||
Object *ob= ptr->data;
|
||||
ModifierData *md= modifiers_findByType(ob, eModifierType_Softbody);
|
||||
Object *ob = ptr->data;
|
||||
ModifierData *md = modifiers_findByType(ob, eModifierType_Softbody);
|
||||
CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodyModifier, md);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (CTX_data_equals(member, "fluid")) {
|
||||
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
|
||||
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
|
||||
|
||||
if (ptr && ptr->data) {
|
||||
Object *ob= ptr->data;
|
||||
ModifierData *md= modifiers_findByType(ob, eModifierType_Fluidsim);
|
||||
Object *ob = ptr->data;
|
||||
ModifierData *md = modifiers_findByType(ob, eModifierType_Fluidsim);
|
||||
CTX_data_pointer_set(result, &ob->id, &RNA_FluidSimulationModifier, md);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
else if (CTX_data_equals(member, "smoke")) {
|
||||
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
|
||||
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
|
||||
|
||||
if (ptr && ptr->data) {
|
||||
Object *ob= ptr->data;
|
||||
ModifierData *md= modifiers_findByType(ob, eModifierType_Smoke);
|
||||
Object *ob = ptr->data;
|
||||
ModifierData *md = modifiers_findByType(ob, eModifierType_Smoke);
|
||||
CTX_data_pointer_set(result, &ob->id, &RNA_SmokeModifier, md);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (CTX_data_equals(member, "collision")) {
|
||||
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
|
||||
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
|
||||
|
||||
if (ptr && ptr->data) {
|
||||
Object *ob= ptr->data;
|
||||
ModifierData *md= modifiers_findByType(ob, eModifierType_Collision);
|
||||
Object *ob = ptr->data;
|
||||
ModifierData *md = modifiers_findByType(ob, eModifierType_Collision);
|
||||
CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md);
|
||||
return 1;
|
||||
}
|
||||
@@ -945,11 +946,11 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "dynamic_paint")) {
|
||||
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
|
||||
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
|
||||
|
||||
if (ptr && ptr->data) {
|
||||
Object *ob= ptr->data;
|
||||
ModifierData *md= modifiers_findByType(ob, eModifierType_DynamicPaint);
|
||||
Object *ob = ptr->data;
|
||||
ModifierData *md = modifiers_findByType(ob, eModifierType_DynamicPaint);
|
||||
CTX_data_pointer_set(result, &ob->id, &RNA_DynamicPaintModifier, md);
|
||||
return 1;
|
||||
}
|
||||
@@ -965,21 +966,21 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
|
||||
static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
|
||||
{
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
|
||||
if (sbuts->flag & SB_PIN_CONTEXT) {
|
||||
sbuts->pinid= buttons_context_id_path(C);
|
||||
sbuts->pinid = buttons_context_id_path(C);
|
||||
}
|
||||
else
|
||||
sbuts->pinid= NULL;
|
||||
sbuts->pinid = NULL;
|
||||
|
||||
ED_area_tag_redraw(CTX_wm_area(C));
|
||||
}
|
||||
|
||||
void buttons_context_draw(const bContext *C, uiLayout *layout)
|
||||
{
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
ButsContextPath *path= sbuts->path;
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
ButsContextPath *path = sbuts->path;
|
||||
uiLayout *row;
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
@@ -990,28 +991,28 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
row= uiLayoutRow(layout, 1);
|
||||
row = uiLayoutRow(layout, 1);
|
||||
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
|
||||
|
||||
block= uiLayoutGetBlock(row);
|
||||
block = uiLayoutGetBlock(row);
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
but = uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed");
|
||||
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
||||
uiButSetFunc(but, pin_cb, NULL, NULL);
|
||||
|
||||
for (a=0; a<path->len; a++) {
|
||||
ptr= &path->ptr[a];
|
||||
for (a = 0; a < path->len; a++) {
|
||||
ptr = &path->ptr[a];
|
||||
|
||||
if (a != 0)
|
||||
uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC);
|
||||
|
||||
if (ptr->data) {
|
||||
icon= RNA_struct_ui_icon(ptr->type);
|
||||
name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL);
|
||||
icon = RNA_struct_ui_icon(ptr->type);
|
||||
name = RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL);
|
||||
|
||||
if (name) {
|
||||
if (!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE) && ptr->type == &RNA_Scene)
|
||||
uiItemLDrag(row, ptr, "", icon); /* save some space */
|
||||
uiItemLDrag(row, ptr, "", icon); /* save some space */
|
||||
else
|
||||
uiItemLDrag(row, ptr, name, icon);
|
||||
|
||||
@@ -1033,24 +1034,24 @@ void buttons_context_register(ARegionType *art)
|
||||
{
|
||||
PanelType *pt;
|
||||
|
||||
pt= MEM_callocN(sizeof(PanelType), "spacetype buttons panel context");
|
||||
pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context");
|
||||
strcpy(pt->idname, "BUTTONS_PT_context");
|
||||
strcpy(pt->label, "Context");
|
||||
pt->draw= buttons_panel_context;
|
||||
pt->flag= PNL_NO_HEADER;
|
||||
pt->draw = buttons_panel_context;
|
||||
pt->flag = PNL_NO_HEADER;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
}
|
||||
|
||||
ID *buttons_context_id_path(const bContext *C)
|
||||
{
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
ButsContextPath *path= sbuts->path;
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
ButsContextPath *path = sbuts->path;
|
||||
PointerRNA *ptr;
|
||||
int a;
|
||||
|
||||
if (path->len) {
|
||||
for (a=path->len-1; a>=0; a--) {
|
||||
ptr= &path->ptr[a];
|
||||
for (a = path->len - 1; a >= 0; a--) {
|
||||
ptr = &path->ptr[a];
|
||||
|
||||
/* pin particle settings instead of system, since only settings are an idblock*/
|
||||
if (sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) {
|
||||
|
||||
@@ -51,8 +51,8 @@
|
||||
#include "buttons_intern.h"
|
||||
|
||||
|
||||
#define B_CONTEXT_SWITCH 101
|
||||
#define B_BUTSPREVIEW 102
|
||||
#define B_CONTEXT_SWITCH 101
|
||||
#define B_BUTSPREVIEW 102
|
||||
|
||||
static void set_texture_context(bContext *C, SpaceButs *sbuts)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ static void set_texture_context(bContext *C, SpaceButs *sbuts)
|
||||
case BCONTEXT_DATA:
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
if (ob && ob->type==OB_LAMP)
|
||||
if (ob && ob->type == OB_LAMP)
|
||||
sbuts->texture_context = SB_TEXC_MAT_OR_LAMP;
|
||||
break;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ static void set_texture_context(bContext *C, SpaceButs *sbuts)
|
||||
|
||||
static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
|
||||
{
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
|
||||
if (!sbuts) /* editor type switch */
|
||||
return;
|
||||
@@ -90,28 +90,28 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
|
||||
|
||||
set_texture_context(C, sbuts);
|
||||
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
sbuts->mainbuser= sbuts->mainb;
|
||||
sbuts->mainbuser = sbuts->mainb;
|
||||
}
|
||||
|
||||
#define BUT_UNIT_X (UI_UNIT_X+2)
|
||||
#define BUT_UNIT_X (UI_UNIT_X + 2)
|
||||
|
||||
void buttons_header_buttons(const bContext *C, ARegion *ar)
|
||||
{
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
int xco, yco= 2;
|
||||
int xco, yco = 2;
|
||||
|
||||
buttons_context_compute(C, sbuts);
|
||||
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
uiBlockSetHandleFunc(block, do_buttons_buttons, NULL);
|
||||
|
||||
xco= ED_area_header_switchbutton(C, block, yco);
|
||||
xco = ED_area_header_switchbutton(C, block, yco);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
@@ -122,8 +122,8 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
|
||||
uiBlockBeginAlign(block);
|
||||
|
||||
#define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \
|
||||
if (sbuts->pathflag & (1<<_ctx)) { \
|
||||
but = uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, TIP_(_tip)); \
|
||||
if (sbuts->pathflag & (1 << _ctx)) { \
|
||||
but = uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco += BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, TIP_(_tip)); \
|
||||
uiButClearFlag(but, UI_BUT_UNDO); \
|
||||
} \
|
||||
|
||||
@@ -143,12 +143,12 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
|
||||
|
||||
#undef BUTTON_HEADER_CTX
|
||||
|
||||
xco+= BUT_UNIT_X;
|
||||
xco += BUT_UNIT_X;
|
||||
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/* always as last */
|
||||
UI_view2d_totRect_set(&ar->v2d, xco+(UI_UNIT_X/2), ar->v2d.tot.ymax-ar->v2d.tot.ymin);
|
||||
UI_view2d_totRect_set(&ar->v2d, xco + (UI_UNIT_X / 2), ar->v2d.tot.ymax - ar->v2d.tot.ymin);
|
||||
|
||||
uiEndBlock(C, block);
|
||||
uiDrawBlock(C, block);
|
||||
|
||||
@@ -47,17 +47,17 @@ struct uiLayout;
|
||||
struct wmOperatorType;
|
||||
|
||||
/* buts->scaflag */
|
||||
#define BUTS_SENS_SEL 1
|
||||
#define BUTS_SENS_ACT 2
|
||||
#define BUTS_SENS_LINK 4
|
||||
#define BUTS_CONT_SEL 8
|
||||
#define BUTS_CONT_ACT 16
|
||||
#define BUTS_CONT_LINK 32
|
||||
#define BUTS_ACT_SEL 64
|
||||
#define BUTS_ACT_ACT 128
|
||||
#define BUTS_ACT_LINK 256
|
||||
#define BUTS_SENS_STATE 512
|
||||
#define BUTS_ACT_STATE 1024
|
||||
#define BUTS_SENS_SEL 1
|
||||
#define BUTS_SENS_ACT 2
|
||||
#define BUTS_SENS_LINK 4
|
||||
#define BUTS_CONT_SEL 8
|
||||
#define BUTS_CONT_ACT 16
|
||||
#define BUTS_CONT_LINK 32
|
||||
#define BUTS_ACT_SEL 64
|
||||
#define BUTS_ACT_ACT 128
|
||||
#define BUTS_ACT_LINK 256
|
||||
#define BUTS_SENS_STATE 512
|
||||
#define BUTS_ACT_STATE 1024
|
||||
|
||||
/* context data */
|
||||
|
||||
|
||||
@@ -56,22 +56,22 @@
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "buttons_intern.h" // own include
|
||||
#include "buttons_intern.h" /* own include */
|
||||
|
||||
/********************** toolbox operator *********************/
|
||||
|
||||
static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
|
||||
{
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
bScreen *sc = CTX_wm_screen(C);
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
PointerRNA ptr;
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
|
||||
RNA_pointer_create(&sc->id, &RNA_SpaceProperties, sbuts, &ptr);
|
||||
|
||||
pup= uiPupMenuBegin(C, "Align", ICON_NONE);
|
||||
layout= uiPupMenuLayout(pup);
|
||||
pup = uiPupMenuBegin(C, "Align", ICON_NONE);
|
||||
layout = uiPupMenuLayout(pup);
|
||||
uiItemsEnumR(layout, &ptr, "align");
|
||||
uiPupMenuEnd(C, pup);
|
||||
|
||||
@@ -99,15 +99,15 @@ typedef struct FileBrowseOp {
|
||||
|
||||
static int file_browse_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
FileBrowseOp *fbo= op->customdata;
|
||||
FileBrowseOp *fbo = op->customdata;
|
||||
ID *id;
|
||||
char *str, path[FILE_MAX];
|
||||
const char *path_prop= RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath";
|
||||
const char *path_prop = RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath";
|
||||
|
||||
if (RNA_struct_property_is_set(op->ptr, path_prop)==0 || fbo==NULL)
|
||||
if (RNA_struct_property_is_set(op->ptr, path_prop) == 0 || fbo == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
str= RNA_string_get_alloc(op->ptr, path_prop, NULL, 0);
|
||||
str = RNA_string_get_alloc(op->ptr, path_prop, NULL, 0);
|
||||
|
||||
/* add slash for directories, important for some properties */
|
||||
if (RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
|
||||
@@ -119,7 +119,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
|
||||
BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name);
|
||||
|
||||
if (BLI_is_dir(path)) {
|
||||
str = MEM_reallocN(str, strlen(str)+2);
|
||||
str = MEM_reallocN(str, strlen(str) + 2);
|
||||
BLI_add_slash(str);
|
||||
}
|
||||
else
|
||||
@@ -133,7 +133,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* special, annoying exception, filesel on redo panel [#26618] */
|
||||
{
|
||||
wmOperator *redo_op= WM_operator_last_redo(C);
|
||||
wmOperator *redo_op = WM_operator_last_redo(C);
|
||||
if (redo_op) {
|
||||
if (fbo->ptr.data == redo_op->ptr->data) {
|
||||
ED_undo_operator_repeat(C, redo_op);
|
||||
@@ -149,7 +149,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
|
||||
static int file_browse_cancel(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
MEM_freeN(op->customdata);
|
||||
op->customdata= NULL;
|
||||
op->customdata = NULL;
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
if (!prop)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
str= RNA_property_string_get_alloc(&ptr, prop, NULL, 0, NULL);
|
||||
str = RNA_property_string_get_alloc(&ptr, prop, NULL, 0, NULL);
|
||||
|
||||
/* useful yet irritating feature, Shift+Click to open the file
|
||||
* Alt+Click to browse a folder in the OS's browser */
|
||||
@@ -179,9 +179,9 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
PointerRNA props_ptr;
|
||||
|
||||
if (event->alt) {
|
||||
char *lslash= BLI_last_slash(str);
|
||||
char *lslash = BLI_last_slash(str);
|
||||
if (lslash)
|
||||
*lslash= '\0';
|
||||
*lslash = '\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -194,11 +194,11 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else {
|
||||
const char *path_prop= RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath";
|
||||
fbo= MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp");
|
||||
fbo->ptr= ptr;
|
||||
fbo->prop= prop;
|
||||
op->customdata= fbo;
|
||||
const char *path_prop = RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath";
|
||||
fbo = MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp");
|
||||
fbo->ptr = ptr;
|
||||
fbo->prop = prop;
|
||||
op->customdata = fbo;
|
||||
|
||||
RNA_string_set(op->ptr, path_prop, str);
|
||||
MEM_freeN(str);
|
||||
@@ -230,7 +230,7 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot)
|
||||
ot->cancel = file_browse_cancel;
|
||||
|
||||
/* properties */
|
||||
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
|
||||
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
|
||||
}
|
||||
|
||||
/* second operator, only difference from BUTTONS_OT_file_browse is WM_FILESEL_DIRECTORY */
|
||||
@@ -247,5 +247,5 @@ void BUTTONS_OT_directory_browse(wmOperatorType *ot)
|
||||
ot->cancel = file_browse_cancel;
|
||||
|
||||
/* properties */
|
||||
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
|
||||
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
|
||||
}
|
||||
|
||||
@@ -68,17 +68,17 @@
|
||||
|
||||
#include "../interface/interface_intern.h"
|
||||
|
||||
#include "buttons_intern.h" // own include
|
||||
#include "buttons_intern.h" // own include
|
||||
|
||||
/************************* Texture User **************************/
|
||||
|
||||
static void buttons_texture_user_property_add(ListBase *users, ID *id,
|
||||
PointerRNA ptr, PropertyRNA *prop,
|
||||
const char *category, int icon, const char *name)
|
||||
PointerRNA ptr, PropertyRNA *prop,
|
||||
const char *category, int icon, const char *name)
|
||||
{
|
||||
ButsTextureUser *user = MEM_callocN(sizeof(ButsTextureUser), "ButsTextureUser");
|
||||
|
||||
user->id= id;
|
||||
user->id = id;
|
||||
user->ptr = ptr;
|
||||
user->prop = prop;
|
||||
user->category = category;
|
||||
@@ -90,12 +90,12 @@ static void buttons_texture_user_property_add(ListBase *users, ID *id,
|
||||
}
|
||||
|
||||
static void buttons_texture_user_node_add(ListBase *users, ID *id,
|
||||
bNodeTree *ntree, bNode *node,
|
||||
const char *category, int icon, const char *name)
|
||||
bNodeTree *ntree, bNode *node,
|
||||
const char *category, int icon, const char *name)
|
||||
{
|
||||
ButsTextureUser *user = MEM_callocN(sizeof(ButsTextureUser), "ButsTextureUser");
|
||||
|
||||
user->id= id;
|
||||
user->id = id;
|
||||
user->ntree = ntree;
|
||||
user->node = node;
|
||||
user->category = category;
|
||||
@@ -107,12 +107,12 @@ static void buttons_texture_user_node_add(ListBase *users, ID *id,
|
||||
}
|
||||
|
||||
static void buttons_texture_users_find_nodetree(ListBase *users, ID *id,
|
||||
bNodeTree *ntree, const char *category)
|
||||
bNodeTree *ntree, const char *category)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
if (ntree) {
|
||||
for (node=ntree->nodes.first; node; node=node->next) {
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
|
||||
PointerRNA ptr;
|
||||
/* PropertyRNA *prop; */ /* UNUSED */
|
||||
@@ -121,10 +121,10 @@ static void buttons_texture_users_find_nodetree(ListBase *users, ID *id,
|
||||
/* prop = RNA_struct_find_property(&ptr, "texture"); */ /* UNUSED */
|
||||
|
||||
buttons_texture_user_node_add(users, id, ntree, node,
|
||||
category, RNA_struct_ui_icon(ptr.type), node->name);
|
||||
category, RNA_struct_ui_icon(ptr.type), node->name);
|
||||
}
|
||||
else if (node->type == NODE_GROUP && node->id) {
|
||||
buttons_texture_users_find_nodetree(users, id, (bNodeTree*)node->id, category);
|
||||
buttons_texture_users_find_nodetree(users, id, (bNodeTree *)node->id, category);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,48 +140,48 @@ static void buttons_texture_modifier_foreach(void *userData, Object *ob, Modifie
|
||||
prop = RNA_struct_find_property(&ptr, propname);
|
||||
|
||||
buttons_texture_user_property_add(users, &ob->id, ptr, prop,
|
||||
"Modifiers", RNA_struct_ui_icon(ptr.type), md->name);
|
||||
"Modifiers", RNA_struct_ui_icon(ptr.type), md->name);
|
||||
}
|
||||
|
||||
static void buttons_texture_users_from_context(ListBase *users, const bContext *C, SpaceButs *sbuts)
|
||||
{
|
||||
Scene *scene= NULL;
|
||||
Object *ob= NULL;
|
||||
Material *ma= NULL;
|
||||
Lamp *la= NULL;
|
||||
World *wrld= NULL;
|
||||
Brush *brush= NULL;
|
||||
Scene *scene = NULL;
|
||||
Object *ob = NULL;
|
||||
Material *ma = NULL;
|
||||
Lamp *la = NULL;
|
||||
World *wrld = NULL;
|
||||
Brush *brush = NULL;
|
||||
ID *pinid = sbuts->pinid;
|
||||
|
||||
/* get data from context */
|
||||
if (pinid) {
|
||||
if (GS(pinid->name) == ID_SCE)
|
||||
scene= (Scene*)pinid;
|
||||
scene = (Scene *)pinid;
|
||||
else if (GS(pinid->name) == ID_OB)
|
||||
ob= (Object*)pinid;
|
||||
ob = (Object *)pinid;
|
||||
else if (GS(pinid->name) == ID_LA)
|
||||
la= (Lamp*)pinid;
|
||||
la = (Lamp *)pinid;
|
||||
else if (GS(pinid->name) == ID_WO)
|
||||
wrld= (World*)pinid;
|
||||
wrld = (World *)pinid;
|
||||
else if (GS(pinid->name) == ID_MA)
|
||||
ma= (Material*)pinid;
|
||||
ma = (Material *)pinid;
|
||||
else if (GS(pinid->name) == ID_BR)
|
||||
brush= (Brush*)pinid;
|
||||
brush = (Brush *)pinid;
|
||||
}
|
||||
|
||||
if (!scene)
|
||||
scene= CTX_data_scene(C);
|
||||
scene = CTX_data_scene(C);
|
||||
|
||||
if (!(pinid || pinid == &scene->id)) {
|
||||
ob= (scene->basact)? scene->basact->object: NULL;
|
||||
wrld= scene->world;
|
||||
brush= paint_brush(paint_get_active(scene));
|
||||
ob = (scene->basact) ? scene->basact->object : NULL;
|
||||
wrld = scene->world;
|
||||
brush = paint_brush(paint_get_active(scene));
|
||||
}
|
||||
|
||||
if (ob && ob->type == OB_LAMP && !la)
|
||||
la= ob->data;
|
||||
la = ob->data;
|
||||
if (ob && !ma)
|
||||
ma= give_current_material(ob, ob->actcol);
|
||||
ma = give_current_material(ob, ob->actcol);
|
||||
|
||||
/* fill users */
|
||||
users->first = users->last = NULL;
|
||||
@@ -194,7 +194,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
|
||||
buttons_texture_users_find_nodetree(users, &wrld->id, wrld->nodetree, "World");
|
||||
|
||||
if (ob) {
|
||||
ParticleSystem *psys= psys_get_current(ob);
|
||||
ParticleSystem *psys = psys_get_current(ob);
|
||||
MTex *mtex;
|
||||
int a;
|
||||
|
||||
@@ -204,7 +204,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
|
||||
/* particle systems */
|
||||
if (psys) {
|
||||
/* todo: these slots are not in the UI */
|
||||
for (a=0; a<MAX_MTEX; a++) {
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
mtex = psys->part->mtex[a];
|
||||
|
||||
if (mtex) {
|
||||
@@ -215,7 +215,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
|
||||
prop = RNA_struct_find_property(&ptr, "texture");
|
||||
|
||||
buttons_texture_user_property_add(users, &psys->part->id, ptr, prop,
|
||||
"Particles", RNA_struct_ui_icon(&RNA_ParticleSettings), psys->name);
|
||||
"Particles", RNA_struct_ui_icon(&RNA_ParticleSettings), psys->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,7 +229,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
|
||||
prop = RNA_struct_find_property(&ptr, "texture");
|
||||
|
||||
buttons_texture_user_property_add(users, &ob->id, ptr, prop,
|
||||
"Fields", ICON_FORCE_TEXTURE, "Texture Field");
|
||||
"Fields", ICON_FORCE_TEXTURE, "Texture Field");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,10 +239,10 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_pointer_create(&brush->id, &RNA_BrushTextureSlot, &brush->mtex, &ptr);
|
||||
prop= RNA_struct_find_property(&ptr, "texture");
|
||||
prop = RNA_struct_find_property(&ptr, "texture");
|
||||
|
||||
buttons_texture_user_property_add(users, &brush->id, ptr, prop,
|
||||
"Brush", ICON_BRUSH_DATA, brush->id.name+2);
|
||||
"Brush", ICON_BRUSH_DATA, brush->id.name + 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,22 +250,22 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
|
||||
{
|
||||
/* gatheravailable texture users in context. runs on every draw of
|
||||
* properties editor, before the buttons are created. */
|
||||
ButsContextTexture *ct= sbuts->texuser;
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ButsContextTexture *ct = sbuts->texuser;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
if (!BKE_scene_use_new_shading_nodes(scene)) {
|
||||
if (ct) {
|
||||
BLI_freelistN(&ct->users);
|
||||
MEM_freeN(ct);
|
||||
sbuts->texuser= NULL;
|
||||
sbuts->texuser = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ct) {
|
||||
ct= MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture");
|
||||
sbuts->texuser= ct;
|
||||
ct = MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture");
|
||||
sbuts->texuser = ct;
|
||||
}
|
||||
else {
|
||||
BLI_freelistN(&ct->users);
|
||||
@@ -275,7 +275,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
|
||||
|
||||
/* set one user as active based on active index */
|
||||
if (ct->index >= BLI_countlist(&ct->users))
|
||||
ct->index= 0;
|
||||
ct->index = 0;
|
||||
|
||||
ct->user = BLI_findlink(&ct->users, ct->index);
|
||||
ct->texture = NULL;
|
||||
@@ -287,7 +287,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
|
||||
|
||||
/* get texture datablock pointer if it's a property */
|
||||
texptr = RNA_property_pointer_get(&ct->user->ptr, ct->user->prop);
|
||||
tex = (RNA_struct_is_a(texptr.type, &RNA_Texture))? texptr.data: NULL;
|
||||
tex = (RNA_struct_is_a(texptr.type, &RNA_Texture)) ? texptr.data : NULL;
|
||||
|
||||
ct->texture = tex;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
|
||||
|
||||
/* detect change of active texture node in same node tree, in that
|
||||
* case we also automatically switch to the other node */
|
||||
for (user=ct->users.first; user; user=user->next) {
|
||||
for (user = ct->users.first; user; user = user->next) {
|
||||
if (user->ntree == ct->user->ntree && user->node != ct->user->node) {
|
||||
if (user->node->flag & NODE_ACTIVE_TEXTURE) {
|
||||
ct->user = user;
|
||||
@@ -313,8 +313,8 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg)
|
||||
{
|
||||
/* callback when selecting a texture user in the menu */
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL;
|
||||
ButsTextureUser *user = (ButsTextureUser*)user_p;
|
||||
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
|
||||
ButsTextureUser *user = (ButsTextureUser *)user_p;
|
||||
PointerRNA texptr;
|
||||
Tex *tex;
|
||||
|
||||
@@ -328,7 +328,7 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg)
|
||||
}
|
||||
else {
|
||||
texptr = RNA_property_pointer_get(&user->ptr, user->prop);
|
||||
tex = (RNA_struct_is_a(texptr.type, &RNA_Texture))? texptr.data: NULL;
|
||||
tex = (RNA_struct_is_a(texptr.type, &RNA_Texture)) ? texptr.data : NULL;
|
||||
|
||||
ct->texture = tex;
|
||||
}
|
||||
@@ -341,27 +341,27 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
|
||||
{
|
||||
/* callback when opening texture user selection menu, to create buttons. */
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL;
|
||||
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
|
||||
ButsTextureUser *user;
|
||||
uiBlock *block = uiLayoutGetBlock(layout);
|
||||
const char *last_category = NULL;
|
||||
|
||||
for (user=ct->users.first; user; user=user->next) {
|
||||
for (user = ct->users.first; user; user = user->next) {
|
||||
uiBut *but;
|
||||
char name[UI_MAX_NAME_STR];
|
||||
|
||||
/* add label per category */
|
||||
if (!last_category || strcmp(last_category, user->category) != 0) {
|
||||
uiItemL(layout, user->category, ICON_NONE);
|
||||
but= block->buttons.last;
|
||||
but->flag= UI_TEXT_LEFT;
|
||||
but = block->buttons.last;
|
||||
but->flag = UI_TEXT_LEFT;
|
||||
}
|
||||
|
||||
/* create button */
|
||||
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name);
|
||||
|
||||
but = uiDefIconTextBut(block, BUT, 0, user->icon, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
|
||||
NULL, 0.0, 0.0, 0.0, 0.0, "");
|
||||
but = uiDefIconTextBut(block, BUT, 0, user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
|
||||
NULL, 0.0, 0.0, 0.0, 0.0, "");
|
||||
uiButSetNFunc(but, template_texture_select, MEM_dupallocN(user), NULL);
|
||||
|
||||
last_category = user->category;
|
||||
@@ -374,7 +374,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
|
||||
* gathered before drawing in ButsContextTexture, we merely need to
|
||||
* display the current item. */
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL;
|
||||
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
|
||||
uiBlock *block = uiLayoutGetBlock(layout);
|
||||
uiBut *but;
|
||||
ButsTextureUser *user;
|
||||
@@ -384,7 +384,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
|
||||
return;
|
||||
|
||||
/* get current user */
|
||||
user= ct->user;
|
||||
user = ct->user;
|
||||
|
||||
if (!user) {
|
||||
uiItemL(layout, "No textures in context.", ICON_NONE);
|
||||
@@ -396,15 +396,15 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
|
||||
|
||||
if (user->icon) {
|
||||
but = uiDefIconTextMenuBut(block, template_texture_user_menu, NULL,
|
||||
user->icon, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
|
||||
user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, "");
|
||||
}
|
||||
else {
|
||||
but = uiDefMenuBut(block, template_texture_user_menu, NULL,
|
||||
name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
|
||||
name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, "");
|
||||
}
|
||||
|
||||
/* some cosmetic tweaks */
|
||||
but->type= MENU;
|
||||
but->type = MENU;
|
||||
but->flag |= UI_TEXT_LEFT;
|
||||
but->flag &= ~UI_ICON_SUBMENU;
|
||||
}
|
||||
@@ -414,13 +414,13 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
|
||||
static void template_texture_show(bContext *C, void *data_p, void *prop_p)
|
||||
{
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL;
|
||||
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
|
||||
ButsTextureUser *user;
|
||||
|
||||
if (!ct)
|
||||
return;
|
||||
|
||||
for (user=ct->users.first; user; user=user->next)
|
||||
for (user = ct->users.first; user; user = user->next)
|
||||
if (user->ptr.data == data_p && user->prop == prop_p)
|
||||
break;
|
||||
|
||||
@@ -429,9 +429,9 @@ static void template_texture_show(bContext *C, void *data_p, void *prop_p)
|
||||
template_texture_select(C, user, NULL);
|
||||
|
||||
/* change context */
|
||||
sbuts->mainb= BCONTEXT_TEXTURE;
|
||||
sbuts->mainbuser= sbuts->mainb;
|
||||
sbuts->preview= 1;
|
||||
sbuts->mainb = BCONTEXT_TEXTURE;
|
||||
sbuts->mainbuser = sbuts->mainb;
|
||||
sbuts->preview = 1;
|
||||
|
||||
/* redraw editor */
|
||||
ED_area_tag_redraw(CTX_wm_area(C));
|
||||
@@ -442,7 +442,7 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope
|
||||
{
|
||||
/* button to quickly show texture in texture tab */
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL;
|
||||
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
|
||||
ButsTextureUser *user;
|
||||
|
||||
/* only show button in other tabs in properties editor */
|
||||
@@ -450,7 +450,7 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope
|
||||
return;
|
||||
|
||||
/* find corresponding texture user */
|
||||
for (user=ct->users.first; user; user=user->next)
|
||||
for (user = ct->users.first; user; user = user->next)
|
||||
if (user->ptr.data == ptr->data && user->prop == prop)
|
||||
break;
|
||||
|
||||
@@ -460,7 +460,7 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope
|
||||
uiBut *but;
|
||||
|
||||
but = uiDefIconBut(block, BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y,
|
||||
NULL, 0.0, 0.0, 0.0, 0.0, "Show texture in texture tab");
|
||||
NULL, 0.0, 0.0, 0.0, 0.0, "Show texture in texture tab");
|
||||
uiButSetFunc(but, template_texture_show, user->ptr.data, user->prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
#include "ED_render.h"
|
||||
|
||||
#include "buttons_intern.h" // own include
|
||||
#include "buttons_intern.h" /* own include */
|
||||
|
||||
/* ******************** default callbacks for buttons space ***************** */
|
||||
|
||||
@@ -64,30 +64,30 @@ static SpaceLink *buttons_new(const bContext *UNUSED(C))
|
||||
ARegion *ar;
|
||||
SpaceButs *sbuts;
|
||||
|
||||
sbuts= MEM_callocN(sizeof(SpaceButs), "initbuts");
|
||||
sbuts->spacetype= SPACE_BUTS;
|
||||
sbuts->align= BUT_VERTICAL;
|
||||
sbuts = MEM_callocN(sizeof(SpaceButs), "initbuts");
|
||||
sbuts->spacetype = SPACE_BUTS;
|
||||
sbuts->align = BUT_VERTICAL;
|
||||
|
||||
/* header */
|
||||
ar= MEM_callocN(sizeof(ARegion), "header for buts");
|
||||
ar = MEM_callocN(sizeof(ARegion), "header for buts");
|
||||
|
||||
BLI_addtail(&sbuts->regionbase, ar);
|
||||
ar->regiontype= RGN_TYPE_HEADER;
|
||||
ar->alignment= RGN_ALIGN_TOP;
|
||||
ar->regiontype = RGN_TYPE_HEADER;
|
||||
ar->alignment = RGN_ALIGN_TOP;
|
||||
|
||||
#if 0
|
||||
/* context area */
|
||||
ar= MEM_callocN(sizeof(ARegion), "context area for buts");
|
||||
ar = MEM_callocN(sizeof(ARegion), "context area for buts");
|
||||
BLI_addtail(&sbuts->regionbase, ar);
|
||||
ar->regiontype= RGN_TYPE_CHANNELS;
|
||||
ar->alignment= RGN_ALIGN_TOP;
|
||||
ar->regiontype = RGN_TYPE_CHANNELS;
|
||||
ar->alignment = RGN_ALIGN_TOP;
|
||||
#endif
|
||||
|
||||
/* main area */
|
||||
ar= MEM_callocN(sizeof(ARegion), "main area for buts");
|
||||
ar = MEM_callocN(sizeof(ARegion), "main area for buts");
|
||||
|
||||
BLI_addtail(&sbuts->regionbase, ar);
|
||||
ar->regiontype= RGN_TYPE_WINDOW;
|
||||
ar->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
return (SpaceLink *)sbuts;
|
||||
}
|
||||
@@ -95,13 +95,13 @@ static SpaceLink *buttons_new(const bContext *UNUSED(C))
|
||||
/* not spacelink itself */
|
||||
static void buttons_free(SpaceLink *sl)
|
||||
{
|
||||
SpaceButs *sbuts= (SpaceButs*) sl;
|
||||
SpaceButs *sbuts = (SpaceButs *) sl;
|
||||
|
||||
if (sbuts->path)
|
||||
MEM_freeN(sbuts->path);
|
||||
|
||||
if (sbuts->texuser) {
|
||||
ButsContextTexture *ct= sbuts->texuser;
|
||||
ButsContextTexture *ct = sbuts->texuser;
|
||||
BLI_freelistN(&ct->users);
|
||||
MEM_freeN(ct);
|
||||
}
|
||||
@@ -110,24 +110,24 @@ static void buttons_free(SpaceLink *sl)
|
||||
/* spacetype; init callback */
|
||||
static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
|
||||
{
|
||||
SpaceButs *sbuts= sa->spacedata.first;
|
||||
SpaceButs *sbuts = sa->spacedata.first;
|
||||
|
||||
/* auto-align based on size */
|
||||
if (sbuts->align == BUT_AUTO || !sbuts->align) {
|
||||
if (sa->winx > sa->winy)
|
||||
sbuts->align= BUT_HORIZONTAL;
|
||||
sbuts->align = BUT_HORIZONTAL;
|
||||
else
|
||||
sbuts->align= BUT_VERTICAL;
|
||||
sbuts->align = BUT_VERTICAL;
|
||||
}
|
||||
}
|
||||
|
||||
static SpaceLink *buttons_duplicate(SpaceLink *sl)
|
||||
{
|
||||
SpaceButs *sbutsn= MEM_dupallocN(sl);
|
||||
SpaceButs *sbutsn = MEM_dupallocN(sl);
|
||||
|
||||
/* clear or remove stuff from old */
|
||||
sbutsn->path= NULL;
|
||||
sbutsn->texuser= NULL;
|
||||
sbutsn->path = NULL;
|
||||
sbutsn->texuser = NULL;
|
||||
|
||||
return (SpaceLink *)sbutsn;
|
||||
}
|
||||
@@ -146,8 +146,8 @@ static void buttons_main_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
static void buttons_main_area_draw(const bContext *C, ARegion *ar)
|
||||
{
|
||||
/* draw entirely, view changes should be handled here */
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
int vertical= (sbuts->align == BUT_VERTICAL);
|
||||
SpaceButs *sbuts = CTX_wm_space_buts(C);
|
||||
int vertical = (sbuts->align == BUT_VERTICAL);
|
||||
|
||||
buttons_context_compute(C, sbuts);
|
||||
|
||||
@@ -178,8 +178,8 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
|
||||
else if (sbuts->mainb == BCONTEXT_BONE_CONSTRAINT)
|
||||
ED_region_panels(C, ar, vertical, "bone_constraint", sbuts->mainb);
|
||||
|
||||
sbuts->re_align= 0;
|
||||
sbuts->mainbo= sbuts->mainb;
|
||||
sbuts->re_align = 0;
|
||||
sbuts->mainbo = sbuts->mainb;
|
||||
}
|
||||
|
||||
static void buttons_operatortypes(void)
|
||||
@@ -205,7 +205,7 @@ static void buttons_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
|
||||
static void buttons_header_area_draw(const bContext *C, ARegion *ar)
|
||||
{
|
||||
/* clear */
|
||||
UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL);
|
||||
UI_ThemeClearColor(ED_screen_area_active(C) ? TH_HEADER : TH_HEADERDESEL);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/* set view2d view matrix for scrolling (without scrollers) */
|
||||
@@ -221,7 +221,7 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar)
|
||||
* showing that button set, to reduce unnecessary drawing. */
|
||||
static void buttons_area_redraw(ScrArea *sa, short buttons)
|
||||
{
|
||||
SpaceButs *sbuts= sa->spacedata.first;
|
||||
SpaceButs *sbuts = sa->spacedata.first;
|
||||
|
||||
/* if the area's current button set is equal to the one to redraw */
|
||||
if (sbuts->mainb == buttons)
|
||||
@@ -231,7 +231,7 @@ static void buttons_area_redraw(ScrArea *sa, short buttons)
|
||||
/* reused! */
|
||||
static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
{
|
||||
SpaceButs *sbuts= sa->spacedata.first;
|
||||
SpaceButs *sbuts = sa->spacedata.first;
|
||||
|
||||
/* context changes */
|
||||
switch (wmn->category) {
|
||||
@@ -243,11 +243,11 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
case ND_FRAME:
|
||||
/* any buttons area can have animated properties so redraw all */
|
||||
ED_area_tag_redraw(sa);
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
case ND_OB_ACTIVE:
|
||||
ED_area_tag_redraw(sa);
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
case ND_KEYINGSET:
|
||||
buttons_area_redraw(sa, BCONTEXT_SCENE);
|
||||
@@ -265,7 +265,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
switch (wmn->data) {
|
||||
case ND_TRANSFORM:
|
||||
buttons_area_redraw(sa, BCONTEXT_OBJECT);
|
||||
buttons_area_redraw(sa, BCONTEXT_DATA); /* autotexpace flag */
|
||||
buttons_area_redraw(sa, BCONTEXT_DATA); /* autotexpace flag */
|
||||
break;
|
||||
case ND_POSE:
|
||||
buttons_area_redraw(sa, BCONTEXT_DATA);
|
||||
@@ -280,7 +280,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
ED_area_tag_redraw(sa);
|
||||
else
|
||||
buttons_area_redraw(sa, BCONTEXT_MODIFIER);
|
||||
buttons_area_redraw(sa, BCONTEXT_PHYSICS);
|
||||
buttons_area_redraw(sa, BCONTEXT_PHYSICS);
|
||||
break;
|
||||
case ND_CONSTRAINT:
|
||||
buttons_area_redraw(sa, BCONTEXT_CONSTRAINT);
|
||||
@@ -289,7 +289,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
case ND_PARTICLE:
|
||||
if (wmn->action == NA_EDITED)
|
||||
buttons_area_redraw(sa, BCONTEXT_PARTICLE);
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
case ND_DRAW:
|
||||
buttons_area_redraw(sa, BCONTEXT_OBJECT);
|
||||
@@ -298,7 +298,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
case ND_SHADING:
|
||||
case ND_SHADING_DRAW:
|
||||
/* currently works by redraws... if preview is set, it (re)starts job */
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
default:
|
||||
/* Not all object RNA props have a ND_ notifier (yet) */
|
||||
@@ -321,17 +321,17 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
case ND_SHADING_DRAW:
|
||||
case ND_NODES:
|
||||
/* currently works by redraws... if preview is set, it (re)starts job */
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NC_WORLD:
|
||||
buttons_area_redraw(sa, BCONTEXT_WORLD);
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
case NC_LAMP:
|
||||
buttons_area_redraw(sa, BCONTEXT_DATA);
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
case NC_BRUSH:
|
||||
buttons_area_redraw(sa, BCONTEXT_TEXTURE);
|
||||
@@ -339,7 +339,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
case NC_TEXTURE:
|
||||
case NC_IMAGE:
|
||||
ED_area_tag_redraw(sa);
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
case NC_SPACE:
|
||||
if (wmn->data == ND_SPACE_PROPERTIES)
|
||||
@@ -358,17 +358,17 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
}
|
||||
break;
|
||||
case NC_NODE:
|
||||
if (wmn->action==NA_SELECTED) {
|
||||
if (wmn->action == NA_SELECTED) {
|
||||
ED_area_tag_redraw(sa);
|
||||
/* new active node, update texture preview */
|
||||
if (sbuts->mainb == BCONTEXT_TEXTURE)
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
}
|
||||
break;
|
||||
/* Listener for preview render, when doing an global undo. */
|
||||
case NC_WINDOW:
|
||||
ED_area_tag_redraw(sa);
|
||||
sbuts->preview= 1;
|
||||
sbuts->preview = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -379,39 +379,39 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
|
||||
/* only called once, from space/spacetypes.c */
|
||||
void ED_spacetype_buttons(void)
|
||||
{
|
||||
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype buttons");
|
||||
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype buttons");
|
||||
ARegionType *art;
|
||||
|
||||
st->spaceid= SPACE_BUTS;
|
||||
st->spaceid = SPACE_BUTS;
|
||||
strncpy(st->name, "Buttons", BKE_ST_MAXNAME);
|
||||
|
||||
st->new= buttons_new;
|
||||
st->free= buttons_free;
|
||||
st->init= buttons_init;
|
||||
st->duplicate= buttons_duplicate;
|
||||
st->operatortypes= buttons_operatortypes;
|
||||
st->keymap= buttons_keymap;
|
||||
st->listener= buttons_area_listener;
|
||||
st->context= buttons_context;
|
||||
st->new = buttons_new;
|
||||
st->free = buttons_free;
|
||||
st->init = buttons_init;
|
||||
st->duplicate = buttons_duplicate;
|
||||
st->operatortypes = buttons_operatortypes;
|
||||
st->keymap = buttons_keymap;
|
||||
st->listener = buttons_area_listener;
|
||||
st->context = buttons_context;
|
||||
|
||||
/* regions: main window */
|
||||
art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
|
||||
art->regionid = RGN_TYPE_WINDOW;
|
||||
art->init= buttons_main_area_init;
|
||||
art->draw= buttons_main_area_draw;
|
||||
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
|
||||
art->init = buttons_main_area_init;
|
||||
art->draw = buttons_main_area_draw;
|
||||
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
buttons_context_register(art);
|
||||
|
||||
/* regions: header */
|
||||
art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype buttons 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= buttons_header_area_init;
|
||||
art->draw= buttons_header_area_draw;
|
||||
art->init = buttons_header_area_init;
|
||||
art->draw = buttons_header_area_draw;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
BKE_spacetype_register(st);
|
||||
|
||||
Reference in New Issue
Block a user