Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c1148
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c896
-rw-r--r--source/blender/editors/animation/anim_deps.c92
-rw-r--r--source/blender/editors/animation/anim_draw.c52
-rw-r--r--source/blender/editors/animation/anim_filter.c884
-rw-r--r--source/blender/editors/animation/anim_intern.h6
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c58
-rw-r--r--source/blender/editors/animation/anim_markers.c230
-rw-r--r--source/blender/editors/animation/anim_ops.c82
-rw-r--r--source/blender/editors/animation/drivers.c318
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c242
-rw-r--r--source/blender/editors/animation/keyframes_draw.c314
-rw-r--r--source/blender/editors/animation/keyframes_edit.c322
-rw-r--r--source/blender/editors/animation/keyframes_general.c212
-rw-r--r--source/blender/editors/animation/keyframing.c600
-rw-r--r--source/blender/editors/animation/keyingsets.c294
16 files changed, 2875 insertions, 2875 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index dba060bfb29..304d548b01b 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -116,11 +116,11 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
-
+
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
glColor3fv(color);
-
+
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
UI_draw_roundbox_corner_set((expanded) ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
@@ -141,11 +141,11 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale
View2D *v2d = &ac->ar->v2d;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
-
+
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
glColor3fv(color);
-
+
/* no rounded corner - just rectangular box */
glRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
}
@@ -154,7 +154,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale
static bool acf_show_channel_colors(bAnimContext *ac)
{
bool showGroupColors = false;
-
+
if (ac->sl) {
switch (ac->spacetype) {
case SPACE_ACTION:
@@ -173,7 +173,7 @@ static bool acf_show_channel_colors(bAnimContext *ac)
}
}
}
-
+
return showGroupColors;
}
@@ -184,19 +184,19 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
bActionGroup *grp = NULL;
short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
bool showGroupColors = acf_show_channel_colors(ac);
-
+
if (ale->type == ANIMTYPE_FCURVE) {
FCurve *fcu = (FCurve *)ale->data;
grp = fcu->grp;
}
-
- /* set color for normal channels
+
+ /* set color for normal channels
* - use 3 shades of color group/standard color for 3 indention level
* - only use group colors if allowed to, and if actually feasible
*/
if (showGroupColors && (grp) && (grp->customCol)) {
unsigned char cp[3];
-
+
if (indent == 2) {
copy_v3_v3_char((char *)cp, grp->cs.solid);
}
@@ -206,7 +206,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
else {
copy_v3_v3_char((char *)cp, grp->cs.active);
}
-
+
/* copy the colors over, transforming from bytes to floats */
rgb_uchar_to_float(r_color, cp);
}
@@ -224,11 +224,11 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f
View2D *v2d = &ac->ar->v2d;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
-
+
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
glColor3fv(color);
-
+
/* no rounded corners - just rectangular box */
glRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
}
@@ -255,16 +255,16 @@ static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale)
static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListElem *ale)
{
short indent = 0;
-
+
/* grouped F-Curves need extra level of indention */
if (ale->type == ANIMTYPE_FCURVE) {
FCurve *fcu = (FCurve *)ale->data;
-
+
// TODO: we need some way of specifying that the indention color should be one less...
if (fcu->grp)
indent++;
}
-
+
/* no indention */
return indent;
}
@@ -273,7 +273,7 @@ static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListE
static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
-
+
if (acf && acf->get_indent_level)
return acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
else
@@ -286,21 +286,21 @@ static short acf_nodetree_rootType_offset(bNodeTree *ntree)
if (ntree) {
switch (ntree->type) {
case NTREE_SHADER:
- /* 1 additional level (i.e. is indented one level in from material,
- * so shift all right by one step)
+ /* 1 additional level (i.e. is indented one level in from material,
+ * so shift all right by one step)
*/
- return INDENT_STEP_SIZE;
-
+ return INDENT_STEP_SIZE;
+
case NTREE_COMPOSIT:
/* no additional levels needed */
- return 0;
-
+ return 0;
+
case NTREE_TEXTURE:
/* 2 additional levels */
return INDENT_STEP_SIZE * 2;
}
}
-
+
/* unknown */
return 0;
}
@@ -309,7 +309,7 @@ static short acf_nodetree_rootType_offset(bNodeTree *ntree)
static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
{
short offset = acf_generic_basic_offset(ac, ale);
-
+
if (ale->id) {
/* texture animdata */
if (GS(ale->id->name) == ID_TE) {
@@ -318,17 +318,17 @@ static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
/* materials and particles animdata */
else if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
offset += (short)(0.7f * U.widget_unit);
-
+
/* if not in Action Editor mode, action-groups (and their children) must carry some offset too... */
else if (ac->datatype != ANIMCONT_ACTION)
offset += (short)(0.7f * U.widget_unit);
-
+
/* nodetree animdata */
if (GS(ale->id->name) == ID_NT) {
offset += acf_nodetree_rootType_offset((bNodeTree *)ale->id);
}
}
-
+
/* offset is just the normal type - i.e. based on indention */
return offset;
}
@@ -339,7 +339,7 @@ static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
static void acf_generic_idblock_name(bAnimListElem *ale, char *name)
{
ID *id = (ID *)ale->data; /* data pointed to should be an ID block */
-
+
/* just copy the name... */
if (id && name)
BLI_strncpy(name, id->name + 2, ANIM_CHAN_NAME_SIZE);
@@ -350,7 +350,7 @@ static bool acf_generic_idblock_name_prop(bAnimListElem *ale, PointerRNA *ptr, P
{
RNA_id_pointer_create(ale->data, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
@@ -361,7 +361,7 @@ static bool acf_generic_idfill_name_prop(bAnimListElem *ale, PointerRNA *ptr, Pr
/* actual ID we're representing is stored in ale->data not ale->id, as id gives the owner */
RNA_id_pointer_create(ale->data, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
@@ -382,11 +382,11 @@ static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem
/* expand is always supported */
case ACHANNEL_SETTING_EXPAND:
return true;
-
+
/* mute is only supported for NLA */
case ACHANNEL_SETTING_MUTE:
return ((ac) && (ac->spacetype == SPACE_NLA));
-
+
/* select is ok for most "ds*" channels (e.g. dsmat) */
case ACHANNEL_SETTING_SELECT:
return true;
@@ -418,14 +418,14 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
View2D *v2d = &ac->ar->v2d;
float color[3];
-
+
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
glColor3fv(color);
-
- /* rounded corners on LHS only
- * - top and bottom
- * - special hack: make the top a bit higher, since we are first...
+
+ /* rounded corners on LHS only
+ * - top and bottom
+ * - special hack: make the top a bit higher, since we are first...
*/
UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
UI_draw_roundbox_gl_mode(GL_POLYGON, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
@@ -470,14 +470,14 @@ static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setti
static void *acf_summary_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
bAnimContext *ac = (bAnimContext *)ale->data;
-
- /* if data is valid, return pointer to active dopesheet's relevant flag
+
+ /* if data is valid, return pointer to active dopesheet's relevant flag
* - this is restricted to DopeSheet/Action Editor only
*/
if ((ac->sl) && (ac->spacetype == SPACE_ACTION) && (setting == ACHANNEL_SETTING_EXPAND)) {
SpaceAction *saction = (SpaceAction *)ac->sl;
bDopeSheet *ads = &saction->ads;
-
+
/* return pointer to DopeSheet's flag */
return GET_ACF_FLAG_PTR(ads->flag, type);
}
@@ -489,7 +489,7 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings s
}
/* all animation summary (DopeSheet only) type define */
-static bAnimChannelType ACF_SUMMARY =
+static bAnimChannelType ACF_SUMMARY =
{
"Summary", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
@@ -521,13 +521,13 @@ static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale)
{
switch (setting) {
/* muted only in NLA */
- case ACHANNEL_SETTING_MUTE:
+ case ACHANNEL_SETTING_MUTE:
return ((ac) && (ac->spacetype == SPACE_NLA));
-
+
/* visible only in Graph Editor */
- case ACHANNEL_SETTING_VISIBLE:
+ case ACHANNEL_SETTING_VISIBLE:
return ((ac) && (ac->spacetype == SPACE_IPO));
-
+
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_EXPAND:
@@ -546,18 +546,18 @@ static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return SCE_DS_SELECTED;
-
+
case ACHANNEL_SETTING_EXPAND: /* expanded */
*neg = true;
return SCE_DS_COLLAPSED;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
@@ -571,30 +571,30 @@ static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_scene_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Scene *scene = (Scene *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return GET_ACF_FLAG_PTR(scene->flag, type);
-
+
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(scene->flag, type);
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (scene->adt)
return GET_ACF_FLAG_PTR(scene->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
}
/* scene type define */
-static bAnimChannelType ACF_SCENE =
+static bAnimChannelType ACF_SCENE =
{
"Scene", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
@@ -619,30 +619,30 @@ static int acf_object_icon(bAnimListElem *ale)
{
Base *base = (Base *)ale->data;
Object *ob = base->object;
-
+
/* icon depends on object-type */
switch (ob->type) {
case OB_LAMP:
return ICON_OUTLINER_OB_LAMP;
- case OB_MESH:
+ case OB_MESH:
return ICON_OUTLINER_OB_MESH;
- case OB_CAMERA:
+ case OB_CAMERA:
return ICON_OUTLINER_OB_CAMERA;
- case OB_CURVE:
+ case OB_CURVE:
return ICON_OUTLINER_OB_CURVE;
- case OB_MBALL:
+ case OB_MBALL:
return ICON_OUTLINER_OB_META;
- case OB_LATTICE:
+ case OB_LATTICE:
return ICON_OUTLINER_OB_LATTICE;
case OB_SPEAKER:
return ICON_OUTLINER_OB_SPEAKER;
case OB_ARMATURE:
return ICON_OUTLINER_OB_ARMATURE;
- case OB_FONT:
+ case OB_FONT:
return ICON_OUTLINER_OB_FONT;
- case OB_SURF:
+ case OB_SURF:
return ICON_OUTLINER_OB_SURFACE;
- case OB_EMPTY:
+ case OB_EMPTY:
return ICON_OUTLINER_OB_EMPTY;
default:
return ICON_OBJECT_DATA;
@@ -654,7 +654,7 @@ static void acf_object_name(bAnimListElem *ale, char *name)
{
Base *base = (Base *)ale->data;
Object *ob = base->object;
-
+
/* just copy the name... */
if (ob && name)
BLI_strncpy(name, ob->id.name + 2, ANIM_CHAN_NAME_SIZE);
@@ -665,7 +665,7 @@ static bool acf_object_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRN
{
RNA_id_pointer_create(ale->id, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
@@ -674,16 +674,16 @@ static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnim
{
Base *base = (Base *)ale->data;
Object *ob = base->object;
-
+
switch (setting) {
/* muted only in NLA */
- case ACHANNEL_SETTING_MUTE:
+ case ACHANNEL_SETTING_MUTE:
return ((ac) && (ac->spacetype == SPACE_NLA));
-
+
/* visible only in Graph Editor */
- case ACHANNEL_SETTING_VISIBLE:
+ case ACHANNEL_SETTING_VISIBLE:
return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
-
+
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_EXPAND:
@@ -702,18 +702,18 @@ static int acf_object_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return SELECT;
-
+
case ACHANNEL_SETTING_EXPAND: /* expanded */
*neg = 1;
return OB_ADS_COLLAPSED;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
@@ -731,17 +731,17 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings se
{
Base *base = (Base *)ale->data;
Object *ob = base->object;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return GET_ACF_FLAG_PTR(ob->flag, type);
-
+
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(ob->nlaflag, type); // xxx
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
case ACHANNEL_SETTING_ALWAYS_VISIBLE:
@@ -755,11 +755,11 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings se
}
/* object type define */
-static bAnimChannelType ACF_OBJECT =
+static bAnimChannelType ACF_OBJECT =
{
"Object", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_root_color, /* backdrop color */
acf_generic_root_backdrop, /* backdrop */
acf_generic_indention_0, /* indent level */
@@ -781,16 +781,16 @@ static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[
{
bActionGroup *agrp = (bActionGroup *)ale->data;
bool showGroupColors = acf_show_channel_colors(ac);
-
+
if (showGroupColors && agrp->customCol) {
unsigned char cp[3];
-
+
/* highlight only for active */
if (ale->flag & AGRP_ACTIVE)
copy_v3_v3_char((char *)cp, agrp->cs.select);
else
copy_v3_v3_char((char *)cp, agrp->cs.solid);
-
+
/* copy the colors over, transforming from bytes to floats */
rgb_uchar_to_float(r_color, cp);
}
@@ -811,11 +811,11 @@ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
-
+
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
glColor3fv(color);
-
+
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
@@ -825,7 +825,7 @@ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc
static void acf_group_name(bAnimListElem *ale, char *name)
{
bActionGroup *agrp = (bActionGroup *)ale->data;
-
+
/* just copy the name... */
if (agrp && name)
BLI_strncpy(name, agrp->name, ANIM_CHAN_NAME_SIZE);
@@ -836,7 +836,7 @@ static bool acf_group_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA
{
RNA_pointer_create(ale->id, &RNA_ActionGroup, ale->data, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
@@ -848,7 +848,7 @@ static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale)
/* unsupported */
case ACHANNEL_SETTING_SOLO: /* Only available in NLA Editor for tracks */
return false;
-
+
/* conditionally supported */
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
return (ac->spacetype == SPACE_IPO);
@@ -866,22 +866,22 @@ static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings settin
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return AGRP_SELECTED;
-
+
case ACHANNEL_SETTING_EXPAND: /* expanded */
{
/* NOTE: Graph Editor uses a different flag to everywhere else for this,
* allowing different collapsing of groups there, since sharing the flag
* proved to be a hazard for workflows...
*/
- return (ac->spacetype == SPACE_IPO) ?
+ return (ac->spacetype == SPACE_IPO) ?
AGRP_EXPANDED_G : /* Graph Editor case */
AGRP_EXPANDED; /* DopeSheet and elsewhere */
}
-
+
case ACHANNEL_SETTING_MUTE: /* muted */
return AGRP_MUTED;
@@ -891,7 +891,7 @@ static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings settin
case ACHANNEL_SETTING_PROTECT: /* protected */
return AGRP_PROTECTED;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
*neg = 1;
return AGRP_NOTVISIBLE;
@@ -909,17 +909,17 @@ static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings settin
static void *acf_group_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
{
bActionGroup *agrp = (bActionGroup *)ale->data;
-
+
/* all flags are just in agrp->flag for now... */
return GET_ACF_FLAG_PTR(agrp->flag, type);
}
/* group type define */
-static bAnimChannelType ACF_GROUP =
+static bAnimChannelType ACF_GROUP =
{
"Group", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
-
+
acf_group_color, /* backdrop color */
acf_group_backdrop, /* backdrop */
acf_generic_indention_0, /* indent level */
@@ -946,9 +946,9 @@ static void acf_fcurve_name(bAnimListElem *ale, char *name)
static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
{
FCurve *fcu = (FCurve *)ale->data;
-
- /* Ctrl-Click Usability Convenience Hack:
- * For disabled F-Curves, allow access to the RNA Path
+
+ /* Ctrl-Click Usability Convenience Hack:
+ * For disabled F-Curves, allow access to the RNA Path
* as our "name" so that user can perform quick fixes
*/
if (fcu->flag & FCURVE_DISABLED) {
@@ -959,7 +959,7 @@ static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRN
/* for "normal" F-Curves - no editable name, but *prop may not be set properly yet... */
*prop = NULL;
}
-
+
return (*prop != NULL);
}
@@ -967,21 +967,21 @@ static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRN
static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
{
FCurve *fcu = (FCurve *)ale->data;
-
+
switch (setting) {
/* unsupported */
case ACHANNEL_SETTING_SOLO: /* Solo Flag is only for NLA */
case ACHANNEL_SETTING_EXPAND: /* F-Curves are not containers */
case ACHANNEL_SETTING_PINNED: /* This is only for NLA Actions */
return false;
-
+
/* conditionally available */
case ACHANNEL_SETTING_PROTECT: /* Protection is only valid when there's keyframes */
if (fcu->bezt)
return true;
else
return false; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
-
+
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
return (ac->spacetype == SPACE_IPO);
@@ -999,20 +999,20 @@ static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return FCURVE_SELECTED;
-
+
case ACHANNEL_SETTING_MUTE: /* muted */
return FCURVE_MUTED;
-
+
case ACHANNEL_SETTING_PROTECT: /* protected */
return FCURVE_PROTECTED;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
return FCURVE_VISIBLE;
-
+
case ACHANNEL_SETTING_MOD_OFF:
*neg = 1;
return FCURVE_MOD_OFF;
@@ -1026,17 +1026,17 @@ static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
static void *acf_fcurve_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
{
FCurve *fcu = (FCurve *)ale->data;
-
+
/* all flags are just in agrp->flag for now... */
return GET_ACF_FLAG_PTR(fcu->flag, type);
}
/* fcurve type define */
-static bAnimChannelType ACF_FCURVE =
+static bAnimChannelType ACF_FCURVE =
{
"F-Curve", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
-
+
acf_generic_channel_color, /* backdrop color */
acf_generic_channel_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */ // xxx rename this to f-curves only?
@@ -1068,11 +1068,11 @@ static void acf_nla_controls_backdrop(bAnimContext *ac, bAnimListElem *ale, floa
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
-
+
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
glColor3fv(color);
-
+
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 5);
@@ -1092,9 +1092,9 @@ static bool acf_nla_controls_setting_valid(bAnimContext *UNUSED(ac), bAnimListEl
/* supported */
case ACHANNEL_SETTING_EXPAND:
return true;
-
+
// TOOD: selected?
-
+
default: /* unsupported */
return false;
}
@@ -1105,12 +1105,12 @@ static int acf_nla_controls_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
*neg = true;
return ADT_NLA_SKEYS_COLLAPSED;
-
+
default:
/* this shouldn't happen */
return 0;
@@ -1121,7 +1121,7 @@ static int acf_nla_controls_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_
static void *acf_nla_controls_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
{
AnimData *adt = (AnimData *)ale->data;
-
+
/* all flags are just in adt->flag for now... */
return GET_ACF_FLAG_PTR(adt->flag, type);
}
@@ -1132,11 +1132,11 @@ static int acf_nla_controls_icon(bAnimListElem *UNUSED(ale))
}
/* NLA Control FCurves Expander type define */
-static bAnimChannelType ACF_NLACONTROLS =
+static bAnimChannelType ACF_NLACONTROLS =
{
"NLA Controls Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_nla_controls_color, /* backdrop color */
acf_nla_controls_backdrop, /* backdrop */
acf_generic_indention_0, /* indent level */
@@ -1160,7 +1160,7 @@ static void acf_nla_curve_name(bAnimListElem *ale, char *name)
NlaStrip *strip = ale->owner;
FCurve *fcu = ale->data;
PropertyRNA *prop;
-
+
/* try to get RNA property that this shortened path (relative to the strip) refers to */
prop = RNA_struct_type_find_property(&RNA_NlaStrip, fcu->rna_path);
if (prop) {
@@ -1175,11 +1175,11 @@ static void acf_nla_curve_name(bAnimListElem *ale, char *name)
/* NLA Control F-Curve type define */
-static bAnimChannelType ACF_NLACURVE =
+static bAnimChannelType ACF_NLACURVE =
{
"NLA Control F-Curve", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
-
+
acf_generic_channel_color, /* backdrop color */
acf_generic_channel_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -1210,7 +1210,7 @@ static bool acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_EXPAND:
return true;
-
+
default:
return false;
}
@@ -1221,15 +1221,15 @@ static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Sett
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
case ACHANNEL_SETTING_EXPAND: /* expanded */
*neg = true;
return ACT_COLLAPSED;
-
+
default: /* unsupported */
return 0;
}
@@ -1240,10 +1240,10 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings
{
bAction *act = (bAction *)ale->data;
AnimData *adt = ale->adt;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
if (adt) {
@@ -1253,18 +1253,18 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(act->flag, type);
-
+
default: /* unsupported */
return NULL;
}
}
/* object action expander type define */
-static bAnimChannelType ACF_FILLACTD =
+static bAnimChannelType ACF_FILLACTD =
{
"Ob-Action Filler", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -1300,7 +1300,7 @@ static bool acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListEle
/* only expand supported */
case ACHANNEL_SETTING_EXPAND:
return true;
-
+
default:
return false;
}
@@ -1311,12 +1311,12 @@ static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_S
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
*neg = true;
return ADT_DRIVERS_COLLAPSED;
-
+
default: /* unsupported */
return 0;
}
@@ -1326,25 +1326,25 @@ static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_S
static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
AnimData *adt = (AnimData *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(adt->flag, type);
-
+
default: /* unsupported */
return NULL;
}
}
/* drivers expander type define */
-static bAnimChannelType ACF_FILLDRIVERS =
+static bAnimChannelType ACF_FILLDRIVERS =
{
"Drivers Filler", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -1373,21 +1373,21 @@ static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return MA_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -1397,14 +1397,14 @@ static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_dsmat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Material *ma = (Material *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(ma->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
@@ -1422,7 +1422,7 @@ static bAnimChannelType ACF_DSMAT =
{
"Material Data Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -1450,21 +1450,21 @@ static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return LA_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -1474,21 +1474,21 @@ static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_dslam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Lamp *la = (Lamp *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(la->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (la->adt)
return GET_ACF_FLAG_PTR(la->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -1499,7 +1499,7 @@ static bAnimChannelType ACF_DSLAM =
{
"Lamp Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -1534,21 +1534,21 @@ static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return TEX_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -1558,21 +1558,21 @@ static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_dstex_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Tex *tex = (Tex *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(tex->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (tex->adt)
return GET_ACF_FLAG_PTR(tex->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -1583,7 +1583,7 @@ static bAnimChannelType ACF_DSTEX =
{
"Texture Data Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -1693,18 +1693,18 @@ static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return CAM_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
@@ -1720,14 +1720,14 @@ static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_dscam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Camera *ca = (Camera *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(ca->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
@@ -1735,7 +1735,7 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings set
if (ca->adt)
return GET_ACF_FLAG_PTR(ca->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -1746,7 +1746,7 @@ static bAnimChannelType ACF_DSCAM =
{
"Camera Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -1768,7 +1768,7 @@ static int acf_dscur_icon(bAnimListElem *ale)
{
Curve *cu = (Curve *)ale->data;
short obtype = BKE_curve_type_get(cu);
-
+
switch (obtype) {
case OB_FONT:
return ICON_FONT_DATA;
@@ -1784,21 +1784,21 @@ static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return CU_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -1808,21 +1808,21 @@ static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_dscur_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Curve *cu = (Curve *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(cu->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (cu->adt)
return GET_ACF_FLAG_PTR(cu->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -1833,7 +1833,7 @@ static bAnimChannelType ACF_DSCUR =
{
"Curve Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -1861,21 +1861,21 @@ static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return KEY_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -1885,21 +1885,21 @@ static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
static void *acf_dsskey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Key *key = (Key *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(key->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (key->adt)
return GET_ACF_FLAG_PTR(key->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -1910,7 +1910,7 @@ static bAnimChannelType ACF_DSSKEY =
{
"Shape Key Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -1938,21 +1938,21 @@ static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return WO_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -1962,21 +1962,21 @@ static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_dswor_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
World *wo = (World *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(wo->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (wo->adt)
return GET_ACF_FLAG_PTR(wo->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -1987,7 +1987,7 @@ static bAnimChannelType ACF_DSWOR =
{
"World Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -2015,21 +2015,21 @@ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return PART_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2039,21 +2039,21 @@ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
static void *acf_dspart_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
ParticleSettings *part = (ParticleSettings *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(part->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (part->adt)
return GET_ACF_FLAG_PTR(part->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2064,7 +2064,7 @@ static bAnimChannelType ACF_DSPART =
{
"Particle Data Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -2092,21 +2092,21 @@ static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setti
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return MB_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2116,21 +2116,21 @@ static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setti
static void *acf_dsmball_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
MetaBall *mb = (MetaBall *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(mb->flag2, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (mb->adt)
return GET_ACF_FLAG_PTR(mb->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2141,7 +2141,7 @@ static bAnimChannelType ACF_DSMBALL =
{
"Metaball Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -2169,21 +2169,21 @@ static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return ARM_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2193,21 +2193,21 @@ static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_dsarm_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
bArmature *arm = (bArmature *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(arm->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (arm->adt)
return GET_ACF_FLAG_PTR(arm->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2218,7 +2218,7 @@ static bAnimChannelType ACF_DSARM =
{
"Armature Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -2246,9 +2246,9 @@ static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale)
{
bNodeTree *ntree = (bNodeTree *)ale->data;
short offset = acf_generic_basic_offset(ac, ale);
-
- offset += acf_nodetree_rootType_offset(ntree);
-
+
+ offset += acf_nodetree_rootType_offset(ntree);
+
return offset;
}
@@ -2257,21 +2257,21 @@ static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setti
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return NTREE_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2281,21 +2281,21 @@ static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setti
static void *acf_dsntree_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
bNodeTree *ntree = (bNodeTree *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(ntree->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (ntree->adt)
return GET_ACF_FLAG_PTR(ntree->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2306,7 +2306,7 @@ static bAnimChannelType ACF_DSNTREE =
{
"Node Tree Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -2334,21 +2334,21 @@ static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_S
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return LS_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2358,21 +2358,21 @@ static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_S
static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(linestyle->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (linestyle->adt)
return GET_ACF_FLAG_PTR(linestyle->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2383,16 +2383,16 @@ static bAnimChannelType ACF_DSLINESTYLE =
{
"Line Style Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop,/* backdrop */
acf_generic_indention_1, /* indent level */
acf_generic_basic_offset, /* offset */
-
+
acf_generic_idblock_name, /* name */
acf_generic_idblock_name_prop, /* name prop */
acf_dslinestyle_icon, /* icon */
-
+
acf_generic_dataexpand_setting_valid, /* has setting */
acf_dslinestyle_setting_flag, /* flag for setting */
acf_dslinestyle_setting_ptr /* pointer for setting */
@@ -2411,21 +2411,21 @@ static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return ME_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2435,21 +2435,21 @@ static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Mesh *me = (Mesh *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(me->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (me->adt)
return GET_ACF_FLAG_PTR(me->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2460,7 +2460,7 @@ static bAnimChannelType ACF_DSMESH =
{
"Mesh Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
@@ -2488,21 +2488,21 @@ static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return LT_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2512,21 +2512,21 @@ static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_dslat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Lattice *lt = (Lattice *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(lt->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (lt->adt)
return GET_ACF_FLAG_PTR(lt->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2537,7 +2537,7 @@ static bAnimChannelType ACF_DSLAT =
{
"Lattice Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
@@ -2565,21 +2565,21 @@ static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return SPK_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2589,21 +2589,21 @@ static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting
static void *acf_dsspk_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
Speaker *spk = (Speaker *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(spk->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (spk->adt)
return GET_ACF_FLAG_PTR(spk->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2614,7 +2614,7 @@ static bAnimChannelType ACF_DSSPK =
{
"Speaker Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -2642,21 +2642,21 @@ static int acf_dsgpencil_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Set
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GP_DATA_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg = true;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2666,21 +2666,21 @@ static int acf_dsgpencil_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Set
static void *acf_dsgpencil_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
bGPdata *gpd = (bGPdata *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GET_ACF_FLAG_PTR(gpd->flag, type);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (gpd->adt)
return GET_ACF_FLAG_PTR(gpd->adt->flag, type);
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2691,7 +2691,7 @@ static bAnimChannelType ACF_DSGPENCIL =
{
"GPencil DS Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop, /* backdrop */
acf_generic_indention_1, /* indent level */
@@ -2790,7 +2790,7 @@ static bAnimChannelType ACF_DSMCLIP =
static void acf_shapekey_name(bAnimListElem *ale, char *name)
{
KeyBlock *kb = (KeyBlock *)ale->data;
-
+
/* just copy the name... */
if (kb && name) {
/* if the KeyBlock had a name, use it, otherwise use the index */
@@ -2805,15 +2805,15 @@ static void acf_shapekey_name(bAnimListElem *ale, char *name)
static bool acf_shapekey_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
{
KeyBlock *kb = (KeyBlock *)ale->data;
-
+
/* if the KeyBlock had a name, use it, otherwise use the index */
if (kb && kb->name[0]) {
RNA_pointer_create(ale->id, &RNA_ShapeKey, kb, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
-
+
return false;
}
@@ -2825,7 +2825,7 @@ static bool acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *
case ACHANNEL_SETTING_MUTE: /* muted */
case ACHANNEL_SETTING_PROTECT: /* protected */
return true;
-
+
/* nothing else is supported */
default:
return false;
@@ -2837,17 +2837,17 @@ static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Sett
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_MUTE: /* mute */
return KEYBLOCK_MUTE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return KEYBLOCK_SEL;
-
+
case ACHANNEL_SETTING_PROTECT: /* locked */
return KEYBLOCK_LOCKED;
-
+
default: /* unsupported */
return 0;
}
@@ -2857,16 +2857,16 @@ static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Sett
static void *acf_shapekey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
KeyBlock *kb = (KeyBlock *)ale->data;
-
+
/* clear extra return data first */
*type = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted */
case ACHANNEL_SETTING_PROTECT: /* protected */
return GET_ACF_FLAG_PTR(kb->flag, type);
-
+
default: /* unsupported */
return NULL;
}
@@ -2877,7 +2877,7 @@ static bAnimChannelType ACF_SHAPEKEY =
{
"Shape Key", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
-
+
acf_generic_channel_color, /* backdrop color */
acf_generic_channel_backdrop, /* backdrop */
acf_generic_indention_0, /* indent level */
@@ -2915,7 +2915,7 @@ static bool acf_gpd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSE
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_EXPAND:
return true;
-
+
default:
return false;
}
@@ -2926,14 +2926,14 @@ static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return AGRP_SELECTED;
-
+
case ACHANNEL_SETTING_EXPAND: /* expanded */
return GP_DATA_EXPAND;
-
+
default:
/* these shouldn't happen */
return 0;
@@ -2944,17 +2944,17 @@ static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings
static void *acf_gpd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
{
bGPdata *gpd = (bGPdata *)ale->data;
-
+
/* all flags are just in gpd->flag for now... */
return GET_ACF_FLAG_PTR(gpd->flag, type);
}
/* gpencil datablock type define */
-static bAnimChannelType ACF_GPD =
+static bAnimChannelType ACF_GPD =
{
"GPencil Datablock", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_gpd_color, /* backdrop color */
acf_group_backdrop, /* backdrop */
acf_generic_indention_0, /* indent level */
@@ -2975,7 +2975,7 @@ static bAnimChannelType ACF_GPD =
static void acf_gpl_name(bAnimListElem *ale, char *name)
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
-
+
if (gpl && name)
BLI_strncpy(name, gpl->info, ANIM_CHAN_NAME_SIZE);
}
@@ -2986,10 +2986,10 @@ static bool acf_gpl_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA *
if (ale->data) {
RNA_pointer_create(ale->id, &RNA_GPencilLayer, ale->data, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
-
+
return false;
}
@@ -3001,7 +3001,7 @@ static bool acf_gpl_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSE
case ACHANNEL_SETTING_EXPAND: /* gpencil layers are more like F-Curves than groups */
case ACHANNEL_SETTING_SOLO: /* nla editor only */
return false;
-
+
/* always available */
default:
return true;
@@ -3013,21 +3013,21 @@ static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return GP_LAYER_SELECT;
-
+
case ACHANNEL_SETTING_MUTE: /* animation muting - similar to frame lock... */
return GP_LAYER_FRAMELOCK;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visiblity of the layers (NOT muting) */
*neg = true;
return GP_LAYER_HIDE;
-
+
case ACHANNEL_SETTING_PROTECT: /* protected */
return GP_LAYER_LOCKED;
-
+
default: /* unsupported */
return 0;
}
@@ -3037,26 +3037,26 @@ static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings
static void *acf_gpl_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
-
+
/* all flags are just in gpl->flag for now... */
return GET_ACF_FLAG_PTR(gpl->flag, type);
}
/* grease pencil layer type define */
-static bAnimChannelType ACF_GPL =
+static bAnimChannelType ACF_GPL =
{
"GPencil Layer", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
-
+
acf_generic_channel_color, /* backdrop color */
acf_generic_channel_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */
acf_generic_group_offset, /* offset */
-
+
acf_gpl_name, /* name */
acf_gpl_name_prop, /* name prop */
NULL, /* icon */
-
+
acf_gpl_setting_valid, /* has setting */
acf_gpl_setting_flag, /* flag for setting */
acf_gpl_setting_ptr /* pointer for setting */
@@ -3086,7 +3086,7 @@ static bool acf_mask_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUS
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_EXPAND:
return true;
-
+
default:
return false;
}
@@ -3097,15 +3097,15 @@ static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return AGRP_SELECTED;
-
+
case ACHANNEL_SETTING_EXPAND: /* expanded */
return MASK_ANIMF_EXPAND;
-
- default:
+
+ default:
/* this shouldn't happen */
return 0;
}
@@ -3115,7 +3115,7 @@ static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings
static void *acf_mask_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
{
Mask *mask = (Mask *)ale->data;
-
+
/* all flags are just in mask->flag for now... */
return GET_ACF_FLAG_PTR(mask->flag, type);
}
@@ -3125,16 +3125,16 @@ static bAnimChannelType ACF_MASKDATA =
{
"Mask Datablock", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
-
+
acf_mask_color, /* backdrop color */
acf_group_backdrop, /* backdrop */
acf_generic_indention_0, /* indent level */
acf_generic_group_offset, /* offset */
-
+
acf_generic_idblock_name, /* name */
acf_generic_idfill_name_prop, /* name prop */
acf_mask_icon, /* icon */
-
+
acf_mask_setting_valid, /* has setting */
acf_mask_setting_flag, /* flag for setting */
acf_mask_setting_ptr /* pointer for setting */
@@ -3146,7 +3146,7 @@ static bAnimChannelType ACF_MASKDATA =
static void acf_masklay_name(bAnimListElem *ale, char *name)
{
MaskLayer *masklay = (MaskLayer *)ale->data;
-
+
if (masklay && name)
BLI_strncpy(name, masklay->name, ANIM_CHAN_NAME_SIZE);
}
@@ -3157,7 +3157,7 @@ static bool acf_masklay_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyR
if (ale->data) {
RNA_pointer_create(ale->id, &RNA_MaskLayer, ale->data, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
@@ -3173,7 +3173,7 @@ static bool acf_masklay_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *U
case ACHANNEL_SETTING_VISIBLE: /* graph editor only */
case ACHANNEL_SETTING_SOLO: /* nla editor only */
return false;
-
+
/* always available */
default:
return true;
@@ -3185,14 +3185,14 @@ static int acf_masklay_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setti
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return MASK_LAYERFLAG_SELECT;
-
+
case ACHANNEL_SETTING_PROTECT: /* protected */
return MASK_LAYERFLAG_LOCKED;
-
+
default: /* unsupported */
return 0;
}
@@ -3202,7 +3202,7 @@ static int acf_masklay_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setti
static void *acf_masklay_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
{
MaskLayer *masklay = (MaskLayer *)ale->data;
-
+
/* all flags are just in masklay->flag for now... */
return GET_ACF_FLAG_PTR(masklay->flag, type);
}
@@ -3212,16 +3212,16 @@ static bAnimChannelType ACF_MASKLAYER =
{
"Mask Layer", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
-
+
acf_generic_channel_color, /* backdrop color */
acf_generic_channel_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */
acf_generic_group_offset, /* offset */
-
+
acf_masklay_name, /* name */
acf_masklay_name_prop, /* name prop */
NULL, /* icon */
-
+
acf_masklay_setting_valid, /* has setting */
acf_masklay_setting_flag, /* flag for setting */
acf_masklay_setting_ptr /* pointer for setting */
@@ -3235,7 +3235,7 @@ static void acf_nlatrack_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, flo
NlaTrack *nlt = (NlaTrack *)ale->data;
AnimData *adt = ale->adt;
bool nonSolo = false;
-
+
/* is track enabled for solo drawing? */
if ((adt) && (adt->flag & ADT_NLA_SOLO_TRACK)) {
if ((nlt->flag & NLATRACK_SOLO) == 0) {
@@ -3243,7 +3243,7 @@ static void acf_nlatrack_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, flo
nonSolo = true;
}
}
-
+
/* set color for nla track */
UI_GetThemeColorShade3fv(TH_HEADER, ((nonSolo == false) ? 20 : -20), r_color);
}
@@ -3252,7 +3252,7 @@ static void acf_nlatrack_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, flo
static void acf_nlatrack_name(bAnimListElem *ale, char *name)
{
NlaTrack *nlt = (NlaTrack *)ale->data;
-
+
if (nlt && name)
BLI_strncpy(name, nlt->name, ANIM_CHAN_NAME_SIZE);
}
@@ -3263,10 +3263,10 @@ static bool acf_nlatrack_name_prop(bAnimListElem *ale, PointerRNA *ptr, Property
if (ale->data) {
RNA_pointer_create(ale->id, &RNA_NlaTrack, ale->data, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
-
+
return false;
}
@@ -3275,14 +3275,14 @@ static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *
{
NlaTrack *nlt = (NlaTrack *)ale->data;
AnimData *adt = ale->adt;
-
+
/* visibility of settings depends on various states... */
switch (setting) {
/* always supported */
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_SOLO:
return true;
-
+
/* conditionally supported... */
case ACHANNEL_SETTING_PROTECT:
case ACHANNEL_SETTING_MUTE:
@@ -3299,8 +3299,8 @@ static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *
return false;
}
}
-
-
+
+
/* ok - no tracks are solo'd, and this isn't being tweaked */
return true;
}
@@ -3308,7 +3308,7 @@ static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *
/* unsupported - this track is being tweaked */
return false;
}
-
+
/* unsupported */
default:
return false;
@@ -3320,20 +3320,20 @@ static int acf_nlatrack_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Sett
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return NLATRACK_SELECTED;
-
+
case ACHANNEL_SETTING_MUTE: /* muted */
return NLATRACK_MUTED;
-
+
case ACHANNEL_SETTING_PROTECT: /* protected */
return NLATRACK_PROTECTED;
-
+
case ACHANNEL_SETTING_SOLO: /* solo */
return NLATRACK_SOLO;
-
+
default: /* unsupported */
return 0;
}
@@ -3347,20 +3347,20 @@ static void *acf_nlatrack_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings
}
/* nla track type define */
-static bAnimChannelType ACF_NLATRACK =
+static bAnimChannelType ACF_NLATRACK =
{
"NLA Track", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
-
+
acf_nlatrack_color, /* backdrop color */
acf_generic_channel_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */
acf_generic_group_offset, /* offset */ // XXX?
-
+
acf_nlatrack_name, /* name */
acf_nlatrack_name_prop, /* name prop */
NULL, /* icon */
-
+
acf_nlatrack_setting_valid, /* has setting */
acf_nlatrack_setting_flag, /* flag for setting */
acf_nlatrack_setting_ptr /* pointer for setting */
@@ -3372,7 +3372,7 @@ static bAnimChannelType ACF_NLATRACK =
static int acf_nlaaction_icon(bAnimListElem *ale)
{
AnimData *adt = ale->adt;
-
+
/* indicate tweaking-action state by changing the icon... */
if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) {
return ICON_ACTION_TWEAK;
@@ -3382,28 +3382,28 @@ static int acf_nlaaction_icon(bAnimListElem *ale)
}
}
-/* Backdrop color for nla action channel
+/* Backdrop color for nla action channel
* Although this can't be used directly for NLA Action drawing,
* it is still needed for use behind the RHS toggles
*/
static void acf_nlaaction_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float r_color[3])
{
float color[4];
-
+
/* Action Line
- * The alpha values action_get_color returns are only useful for drawing
+ * The alpha values action_get_color returns are only useful for drawing
* strips backgrounds but here we're doing channel list backgrounds instead
* so we ignore that and use our own when needed
*/
nla_action_get_color(ale->adt, (bAction *)ale->data, color);
-
+
/* NOTE: since the return types only allow rgb, we cannot do the alpha-blending we'd
* like for the solo-drawing case. Hence, this method isn't actually used for drawing
* most of the channel...
*/
copy_v3_v3(r_color, color);
}
-
+
/* backdrop for nla action channel */
static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
@@ -3412,14 +3412,14 @@ static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float y
AnimData *adt = ale->adt;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[4];
-
+
/* Action Line
- * The alpha values action_get_color returns are only useful for drawing
+ * The alpha values action_get_color returns are only useful for drawing
* strips backgrounds but here we're doing channel list backgrounds instead
* so we ignore that and use our own when needed
*/
nla_action_get_color(adt, (bAction *)ale->data, color);
-
+
if (adt && (adt->flag & ADT_NLA_EDIT_ON)) {
/* Yes, the color vector has 4 components, BUT we only want to be using 3 of them! */
glColor3fv(color);
@@ -3428,12 +3428,12 @@ static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float y
float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f;
glColor4f(color[0], color[1], color[2], alpha);
}
-
- /* only on top left corner, to show that this channel sits on top of the preceding ones
+
+ /* only on top left corner, to show that this channel sits on top of the preceding ones
* while still linking into the action line strip to the right
*/
UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT);
-
+
/* draw slightly shifted up vertically to look like it has more separation from other channels,
* but we then need to slightly shorten it so that it doesn't look like it overlaps
*/
@@ -3444,7 +3444,7 @@ static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float y
static void acf_nlaaction_name(bAnimListElem *ale, char *name)
{
bAction *act = (bAction *)ale->data;
-
+
if (name) {
if (act) {
// TODO: add special decoration when doing this in tweaking mode?
@@ -3462,10 +3462,10 @@ static bool acf_nlaaction_name_prop(bAnimListElem *ale, PointerRNA *ptr, Propert
if (ale->data) {
RNA_pointer_create(ale->id, &RNA_Action, ale->data, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
-
+
return false;
}
@@ -3473,7 +3473,7 @@ static bool acf_nlaaction_name_prop(bAnimListElem *ale, PointerRNA *ptr, Propert
static bool acf_nlaaction_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *ale, eAnimChannel_Settings setting)
{
AnimData *adt = ale->adt;
-
+
/* visibility of settings depends on various states... */
switch (setting) {
/* conditionally supported */
@@ -3485,7 +3485,7 @@ static bool acf_nlaaction_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem
else {
return false;
}
-
+
/* unsupported */
default:
return false;
@@ -3497,12 +3497,12 @@ static int acf_nlaaction_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Set
{
/* clear extra return data first */
*neg = false;
-
+
switch (setting) {
case ACHANNEL_SETTING_PINNED: /* pinned - map/unmap */
*neg = true; // XXX
return ADT_NLA_EDIT_NOMAP;
-
+
default: /* unsupported */
return 0;
}
@@ -3516,20 +3516,20 @@ static void *acf_nlaaction_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings
}
/* nla action type define */
-static bAnimChannelType ACF_NLAACTION =
+static bAnimChannelType ACF_NLAACTION =
{
"NLA Active Action", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
-
+
acf_nlaaction_color, /* backdrop color (NOTE: the backdrop handles this too, since it needs special hacks) */
acf_nlaaction_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */
acf_generic_group_offset, /* offset */ // XXX?
-
+
acf_nlaaction_name, /* name */
acf_nlaaction_name_prop, /* name prop */
acf_nlaaction_icon, /* icon */
-
+
acf_nlaaction_setting_valid, /* has setting */
acf_nlaaction_setting_flag, /* flag for setting */
acf_nlaaction_setting_ptr /* pointer for setting */
@@ -3547,31 +3547,31 @@ static short ACF_INIT = 1; /* when non-zero, the list needs to be updated */
static void ANIM_init_channel_typeinfo_data(void)
{
int type = 0;
-
+
/* start initializing if necessary... */
if (ACF_INIT) {
ACF_INIT = 0;
-
+
/* NOTE: need to keep the order of these synchronized with the definition of
* channel types (eAnim_ChannelType) in ED_anim_api.h
*/
animchannelTypeInfo[type++] = NULL; /* None */
animchannelTypeInfo[type++] = NULL; /* AnimData */
animchannelTypeInfo[type++] = NULL; /* Special */
-
+
animchannelTypeInfo[type++] = &ACF_SUMMARY; /* Motion Summary */
-
+
animchannelTypeInfo[type++] = &ACF_SCENE; /* Scene */
animchannelTypeInfo[type++] = &ACF_OBJECT; /* Object */
animchannelTypeInfo[type++] = &ACF_GROUP; /* Group */
animchannelTypeInfo[type++] = &ACF_FCURVE; /* F-Curve */
-
+
animchannelTypeInfo[type++] = &ACF_NLACONTROLS; /* NLA Control FCurve Expander */
animchannelTypeInfo[type++] = &ACF_NLACURVE; /* NLA Control FCurve Channel */
-
+
animchannelTypeInfo[type++] = &ACF_FILLACTD; /* Object Action Expander */
animchannelTypeInfo[type++] = &ACF_FILLDRIVERS; /* Drivers Expander */
-
+
animchannelTypeInfo[type++] = &ACF_DSMAT; /* Material Channel */
animchannelTypeInfo[type++] = &ACF_DSLAM; /* Lamp Channel */
animchannelTypeInfo[type++] = &ACF_DSCAM; /* Camera Channel */
@@ -3590,19 +3590,19 @@ static void ANIM_init_channel_typeinfo_data(void)
animchannelTypeInfo[type++] = &ACF_DSSPK; /* Speaker Channel */
animchannelTypeInfo[type++] = &ACF_DSGPENCIL; /* GreasePencil Channel */
animchannelTypeInfo[type++] = &ACF_DSMCLIP; /* MovieClip Channel */
-
+
animchannelTypeInfo[type++] = &ACF_SHAPEKEY; /* ShapeKey */
-
+
animchannelTypeInfo[type++] = &ACF_GPD; /* Grease Pencil Datablock */
animchannelTypeInfo[type++] = &ACF_GPL; /* Grease Pencil Layer */
-
+
animchannelTypeInfo[type++] = &ACF_MASKDATA; /* Mask Datablock */
animchannelTypeInfo[type++] = &ACF_MASKLAYER; /* Mask Layer */
-
+
animchannelTypeInfo[type++] = &ACF_NLATRACK; /* NLA Track */
animchannelTypeInfo[type++] = &ACF_NLAACTION; /* NLA Action */
}
-}
+}
/* Get type info from given channel type */
const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale)
@@ -3610,10 +3610,10 @@ const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale)
/* santiy checks */
if (ale == NULL)
return NULL;
-
+
/* init the typeinfo if not available yet... */
ANIM_init_channel_typeinfo_data();
-
+
/* check if type is in bounds... */
if ((ale->type >= 0) && (ale->type < ANIMTYPE_NUM_TYPES))
return animchannelTypeInfo[ale->type];
@@ -3627,21 +3627,21 @@ const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale)
void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
-
+
/* print indents */
for (; indent_level > 0; indent_level--)
printf(" ");
-
+
/* print info */
if (acf) {
char name[ANIM_CHAN_NAME_SIZE]; /* hopefully this will be enough! */
-
+
/* get UI name */
if (acf->name)
acf->name(ale, name);
else
BLI_strncpy(name, "<No name>", sizeof(name));
-
+
/* print type name + ui name */
printf("ChanType: <%s> Name: \"%s\"\n", acf->channel_type_name, name);
}
@@ -3653,13 +3653,13 @@ void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level)
/* --------------------------- */
-/* Check if some setting for a channel is enabled
+/* Check if some setting for a channel is enabled
* Returns: 1 = On, 0 = Off, -1 = Invalid
*/
short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
-
+
/* 1) check that the setting exists for the current context */
if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) {
/* 2) get pointer to check for flag in, and the flag to check for */
@@ -3667,17 +3667,17 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
bool negflag;
int flag;
void *ptr;
-
+
flag = acf->setting_flag(ac, setting, &negflag);
ptr = acf->setting_ptr(ale, setting, &ptrsize);
-
+
/* check if flag is enabled */
if (ptr && flag) {
switch (ptrsize) {
case sizeof(int): /* integer pointer for setting */
{
const int *val = (int *)ptr;
-
+
if (negflag)
return ((*val) & flag) == 0;
else
@@ -3686,7 +3686,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
case sizeof(short): /* short pointer for setting */
{
const short *val = (short *)ptr;
-
+
if (negflag)
return ((*val) & flag) == 0;
else
@@ -3695,7 +3695,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
case sizeof(char): /* char pointer for setting */
{
const char *val = (char *)ptr;
-
+
if (negflag)
return ((*val) & flag) == 0;
else
@@ -3704,10 +3704,10 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
}
}
}
-
+
/* not found... */
return -1;
-}
+}
/* quick macro for use in ANIM_channel_setting_set - set flag for setting according the mode given */
@@ -3725,14 +3725,14 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
} \
} (void)0
-/* Change value of some setting for a channel
+/* Change value of some setting for a channel
* - setting: eAnimChannel_Settings
* - mode: eAnimChannels_SetFlag
*/
void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
-
+
/* 1) check that the setting exists for the current context */
if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) {
/* 2) get pointer to check for flag in, and the flag to check for */
@@ -3740,10 +3740,10 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, eAnimChannel
bool negflag;
int flag;
void *ptr;
-
+
flag = acf->setting_flag(ac, setting, &negflag);
ptr = acf->setting_ptr(ale, setting, &ptrsize);
-
+
/* check if flag is enabled */
if (ptr && flag) {
switch (ptrsize) {
@@ -3789,7 +3789,7 @@ static bool achannel_is_being_renamed(const bAnimContext *ac, const bAnimChannel
return true;
}
}
-
+
/* not being renamed */
return false;
}
@@ -3802,52 +3802,52 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
View2D *v2d = &ac->ar->v2d;
short selected, offset;
float y, ymid, ytext;
-
+
/* sanity checks - don't draw anything */
if (ELEM(NULL, acf, ale))
return;
-
+
/* get initial offset */
if (acf->get_offset)
offset = acf->get_offset(ac, ale);
else
offset = 0;
-
+
/* calculate appropriate y-coordinates for icon buttons */
y = (ymaxc - yminc) / 2 + yminc;
ymid = y - 0.5f * ICON_WIDTH;
/* y-coordinates for text is only 4 down from middle */
ytext = y - 0.2f * U.widget_unit;
-
+
/* check if channel is selected */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT))
selected = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT);
else
selected = 0;
-
+
/* set blending again, as may not be set in previous step */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
-
+
/* step 1) draw backdrop ........................................... */
if (acf->draw_backdrop)
acf->draw_backdrop(ac, ale, yminc, ymaxc);
-
+
/* step 2) draw expand widget ....................................... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) {
/* just skip - drawn as widget now */
- offset += ICON_WIDTH;
+ offset += ICON_WIDTH;
}
-
+
/* step 3) draw icon ............................................... */
if (acf->icon) {
UI_icon_draw(offset, ymid, acf->icon(ale));
- offset += ICON_WIDTH;
+ offset += ICON_WIDTH;
}
-
+
/* turn off blending, since not needed anymore... */
glDisable(GL_BLEND);
-
+
/* step 4) draw special toggles .................................
* - in Graph Editor, checkboxes for visibility in curves area
* - in NLA Editor, glowing dots for solo/not solo...
@@ -3861,12 +3861,12 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* for F-Curves, draw color-preview of curve behind checkbox */
if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
FCurve *fcu = (FCurve *)ale->data;
-
- /* F-Curve channels need to have a special 'color code' box drawn, which is colored with whatever
- * color the curve has stored
+
+ /* F-Curve channels need to have a special 'color code' box drawn, which is colored with whatever
+ * color the curve has stored
*/
glColor3fv(fcu->color);
-
+
/* just a solid color rect
*/
glRectf(offset, yminc, offset + ICON_WIDTH, ymaxc);
@@ -3881,7 +3881,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
}
else if ((ac->spacetype == SPACE_NLA) && acf->has_setting(ac, ale, ACHANNEL_SETTING_SOLO)) {
/* just skip - drawn as widget now */
- offset += ICON_WIDTH;
+ offset += ICON_WIDTH;
}
else if (ale->type == ANIMTYPE_GPLAYER) {
/* just skip - drawn as a widget */
@@ -3890,24 +3890,24 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
}
/* step 5) draw name ............................................... */
- /* Don't draw this if renaming... */
+ /* Don't draw this if renaming... */
if (acf->name && !achannel_is_being_renamed(ac, acf, channel_index)) {
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
char name[ANIM_CHAN_NAME_SIZE]; /* hopefully this will be enough! */
-
+
/* set text color */
/* XXX: if active, highlight differently? */
if (selected)
UI_ThemeColor(TH_TEXT_HI);
else
UI_ThemeColor(TH_TEXT);
-
+
/* get name */
acf->name(ale, name);
-
+
offset += 3;
UI_fontstyle_draw_simple(fstyle, offset, ytext, name);
-
+
/* draw red underline if channel is disabled */
if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE) && (ale->flag & FCURVE_DISABLED)) {
/* FIXME: replace hardcoded color here, and check on extents! */
@@ -3928,11 +3928,11 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
short draw_sliders = 0;
float ymin_ofs = 0.0f;
float color[3];
-
+
/* get and set backdrop color */
acf->get_backdrop_color(ac, ale, color);
glColor3fv(color);
-
+
/* check if we need to show the sliders */
if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_IPO)) {
switch (ac->spacetype) {
@@ -3956,24 +3956,24 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* protect... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT))
offset += ICON_WIDTH;
-
+
/* mute... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE))
offset += ICON_WIDTH;
if (ale->type == ANIMTYPE_GPLAYER)
offset += ICON_WIDTH;
-
+
/* pinned... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PINNED))
offset += ICON_WIDTH;
-
+
/* NOTE: technically, NLA Action "pushdown" should be here too, but there are no sliders there */
-
+
/* NLA action channels have slightly different spacing requirements... */
if (ale->type == ANIMTYPE_NLAACTION)
ymin_ofs = NLACHANNEL_SKIP;
}
-
+
/* draw slider
* - even if we can draw sliders for this view, we must also check that the channel-type supports them
* (only only F-Curves really can support them for now)
@@ -3983,10 +3983,10 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* adjust offset */
offset += SLIDER_WIDTH;
}
-
-
+
+
/* finally draw a backdrop rect behind these
- * - starts from the point where the first toggle/slider starts,
+ * - starts from the point where the first toggle/slider starts,
* - ends past the space that might be reserved for a scroller
*/
glRectf(v2d->cur.xmax - (float)offset, yminc + ymin_ofs, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
@@ -4010,7 +4010,7 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
int filter;
int setting = GET_INT_FROM_POINTER(setting_wrap);
short on = 0;
-
+
/* send notifiers before doing anything else... */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
@@ -4021,11 +4021,11 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
if (ale_setting->type == ANIMTYPE_GPLAYER)
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL);
-
+
/* verify animation context */
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
-
+
/* check if the setting is on... */
on = ANIM_channel_setting_get(&ac, ale_setting, setting);
@@ -4033,14 +4033,14 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
if (on == -1) {
return;
}
-
+
/* get all channels that can possibly be chosen - but ignore hierarchy */
filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
/* call API method to flush the setting */
ANIM_flush_setting_anim_channels(&ac, &anim_data, ale_setting, setting, on);
-
+
/* free temp data */
ANIM_animdata_freelist(&anim_data);
}
@@ -4050,7 +4050,7 @@ static void achannel_nlatrack_solo_widget_cb(bContext *C, void *adt_poin, void *
{
AnimData *adt = adt_poin;
NlaTrack *nlt = nlt_poin;
-
+
/* Toggle 'solo' mode. There are several complications here which need explaining:
* - The method call is needed to perform a few additional validation operations
* to ensure that the mode is applied properly
@@ -4060,7 +4060,7 @@ static void achannel_nlatrack_solo_widget_cb(bContext *C, void *adt_poin, void *
*/
nlt->flag ^= NLATRACK_SOLO;
BKE_nlatrack_solo_toggle(adt, nlt);
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_RENAME, NULL);
}
@@ -4071,7 +4071,7 @@ static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poi
ID *id = (ID *)id_poin;
AnimData *adt = BKE_animdata_from_id(id);
FCurve *fcu = (FCurve *)fcu_poin;
-
+
ReportList *reports = CTX_wm_reports(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
@@ -4080,25 +4080,25 @@ static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poi
short flag = 0;
bool done = false;
float cfra;
-
+
/* get current frame and apply NLA-mapping to it (if applicable) */
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
-
+
/* get flags for keyframing */
flag = ANIM_get_keyframing_flags(scene, 1);
-
+
/* get RNA pointer, and resolve the path */
RNA_id_pointer_create(id, &id_ptr);
-
+
/* try to resolve the path stored in the F-Curve */
if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &ptr, &prop)) {
/* set the special 'replace' flag if on a keyframe */
if (fcurve_frame_has_keyframe(fcu, cfra, 0))
flag |= INSERTKEY_REPLACE;
-
+
/* insert a keyframe for this F-Curve */
done = insert_keyframe_direct(reports, ptr, prop, fcu, cfra, ts->keyframe_type, flag);
-
+
if (done)
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
@@ -4110,7 +4110,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
Key *key = (Key *)key_poin;
KeyBlock *kb = (KeyBlock *)kb_poin;
char *rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
-
+
ReportList *reports = CTX_wm_reports(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
@@ -4119,34 +4119,34 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
short flag = 0;
bool done = false;
float cfra;
-
+
/* get current frame and apply NLA-mapping to it (if applicable) */
cfra = BKE_nla_tweakedit_remap(key->adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
-
+
/* get flags for keyframing */
flag = ANIM_get_keyframing_flags(scene, 1);
-
+
/* get RNA pointer, and resolve the path */
RNA_id_pointer_create((ID *)key, &id_ptr);
-
+
/* try to resolve the path stored in the F-Curve */
if (RNA_path_resolve_property(&id_ptr, rna_path, &ptr, &prop)) {
/* find or create new F-Curve */
// XXX is the group name for this ok?
bAction *act = verify_adt_action((ID *)key, 1);
FCurve *fcu = verify_fcurve(act, NULL, &ptr, rna_path, 0, 1);
-
+
/* set the special 'replace' flag if on a keyframe */
if (fcurve_frame_has_keyframe(fcu, cfra, 0))
flag |= INSERTKEY_REPLACE;
-
+
/* insert a keyframe for this F-Curve */
done = insert_keyframe_direct(reports, ptr, prop, fcu, cfra, ts->keyframe_type, flag);
-
+
if (done)
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
-
+
/* free the path */
if (rna_path)
MEM_freeN(rna_path);
@@ -4157,35 +4157,35 @@ static void achannel_setting_slider_nla_curve_cb(bContext *C, void *UNUSED(id_po
{
/* ID *id = (ID *)id_poin; */
FCurve *fcu = (FCurve *)fcu_poin;
-
+
PointerRNA ptr;
PropertyRNA *prop;
int index;
-
+
ReportList *reports = CTX_wm_reports(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
short flag = 0;
bool done = false;
float cfra;
-
+
/* get current frame - *no* NLA mapping should be done */
cfra = (float)CFRA;
-
+
/* get flags for keyframing */
flag = ANIM_get_keyframing_flags(scene, 1);
-
+
/* get pointer and property from the slider - this should all match up with the NlaStrip required... */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
-
+
if (fcu && prop) {
/* set the special 'replace' flag if on a keyframe */
if (fcurve_frame_has_keyframe(fcu, cfra, 0))
flag |= INSERTKEY_REPLACE;
-
+
/* insert a keyframe for this F-Curve */
done = insert_keyframe_direct(reports, ptr, prop, fcu, cfra, ts->keyframe_type, flag);
-
+
if (done)
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
@@ -4202,18 +4202,18 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
void *ptr;
const char *tooltip;
uiBut *but = NULL;
-
+
/* get the flag and the pointer to that flag */
flag = acf->setting_flag(ac, setting, &negflag);
ptr = acf->setting_ptr(ale, setting, &ptrsize);
/* enabled = ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */
-
+
/* get the base icon for the setting */
switch (setting) {
case ACHANNEL_SETTING_VISIBLE: /* visibility eyes */
//icon = ((enabled) ? ICON_VISIBLE_IPO_ON : ICON_VISIBLE_IPO_OFF);
icon = ICON_VISIBLE_IPO_OFF;
-
+
if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE))
tooltip = TIP_("F-Curve is visible in Graph Editor for editing");
else if (ale->type == ANIMTYPE_GPLAYER)
@@ -4238,30 +4238,30 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
icon = ICON_TRIA_RIGHT;
tooltip = TIP_("Make channels grouped under this channel visible");
break;
-
+
case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */
//icon = ((enabled) ? ICON_SOLO_OFF : ICON_SOLO_ON);
icon = ICON_SOLO_OFF;
tooltip = TIP_("NLA Track is the only one evaluated in this animation data-block, with all others muted");
break;
-
+
/* --- */
-
+
case ACHANNEL_SETTING_PROTECT: /* protected lock */
// TODO: what about when there's no protect needed?
//icon = ((enabled) ? ICON_LOCKED : ICON_UNLOCKED);
icon = ICON_UNLOCKED;
-
+
if (ale->datatype != ALE_NLASTRIP)
tooltip = TIP_("Editability of keyframes for this channel");
else
tooltip = TIP_("Editability of NLA Strips in this track");
break;
-
+
case ACHANNEL_SETTING_MUTE: /* muted speaker */
//icon = ((enabled) ? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF);
icon = ICON_MUTE_IPO_OFF;
-
+
if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
tooltip = TIP_("Does F-Curve contribute to result");
}
@@ -4275,11 +4275,11 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
tooltip = TIP_("Do channels contribute to result (toggle channel muting)");
}
break;
-
+
case ACHANNEL_SETTING_PINNED: /* pin icon */
//icon = ((enabled) ? ICON_PINNED : ICON_UNPINNED);
icon = ICON_UNPINNED;
-
+
if (ale->type == ANIMTYPE_NLAACTION) {
tooltip = TIP_("Display action without any time remapping (when unpinned)");
}
@@ -4288,13 +4288,13 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
tooltip = NULL;
}
break;
-
+
default:
tooltip = NULL;
icon = 0;
break;
}
-
+
/* type of button */
if (usetoggle) {
if (negflag)
@@ -4312,21 +4312,21 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
if (ptr && flag) {
switch (ptrsize) {
case sizeof(int): /* integer pointer for setting */
- but = uiDefIconButBitI(block, butType, flag, 0, icon,
+ but = uiDefIconButBitI(block, butType, flag, 0, icon,
xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
break;
-
+
case sizeof(short): /* short pointer for setting */
- but = uiDefIconButBitS(block, butType, flag, 0, icon,
+ but = uiDefIconButBitS(block, butType, flag, 0, icon,
xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
break;
-
+
case sizeof(char): /* char pointer for setting */
- but = uiDefIconButBitC(block, butType, flag, 0, icon,
+ but = uiDefIconButBitC(block, butType, flag, 0, icon,
xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
break;
}
-
+
/* set call to send relevant notifiers and/or perform type-specific updates */
if (but) {
switch (setting) {
@@ -4339,12 +4339,12 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
case ACHANNEL_SETTING_ALWAYS_VISIBLE:
UI_but_funcN_set(but, achannel_setting_flush_widget_cb, MEM_dupallocN(ale), SET_INT_IN_POINTER(setting));
break;
-
+
/* settings needing special attention */
case ACHANNEL_SETTING_SOLO: /* NLA Tracks - Solo toggle */
UI_but_func_set(but, achannel_nlatrack_solo_widget_cb, ale->adt, ale->data);
break;
-
+
/* no flushing */
case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush, otherwise all would open/close at once */
default:
@@ -4363,37 +4363,37 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
float y, ymid /*, ytext*/;
short offset;
const bool is_being_renamed = achannel_is_being_renamed(ac, acf, channel_index);
-
+
/* sanity checks - don't draw anything */
if (ELEM(NULL, acf, ale, block))
return;
-
+
/* get initial offset */
if (acf->get_offset)
offset = acf->get_offset(ac, ale);
else
offset = 0;
-
- /* calculate appropriate y-coordinates for icon buttons
+
+ /* calculate appropriate y-coordinates for icon buttons
*/
y = (ymaxc - yminc) / 2 + yminc;
ymid = y - 0.5f * ICON_WIDTH;
-
+
/* no button backdrop behind icons */
UI_block_emboss_set(block, UI_EMBOSS_NONE);
-
+
/* step 1) draw expand widget ....................................... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) {
draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_EXPAND);
- offset += ICON_WIDTH;
+ offset += ICON_WIDTH;
}
-
+
/* step 2) draw icon ............................................... */
if (acf->icon) {
/* icon is not drawn here (not a widget) */
- offset += ICON_WIDTH;
+ offset += ICON_WIDTH;
}
-
+
/* step 3) draw special toggles .................................
* - in Graph Editor, checkboxes for visibility in curves area
* - in NLA Editor, glowing dots for solo/not solo...
@@ -4418,7 +4418,7 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
else if ((ac->spacetype == SPACE_NLA) && acf->has_setting(ac, ale, ACHANNEL_SETTING_SOLO)) {
/* 'solo' setting for NLA Tracks */
draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_SOLO);
- offset += ICON_WIDTH;
+ offset += ICON_WIDTH;
}
else if (ale->type == ANIMTYPE_GPLAYER) {
#if 0
@@ -4427,18 +4427,18 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
bGPDlayer *gpl = (bGPDlayer *)ale->data;
PointerRNA ptr;
float w = ICON_WIDTH / 2.0f;
-
+
RNA_pointer_create(ale->id, &RNA_GPencilLayer, ale->data, &ptr);
-
+
UI_block_align_begin(block);
UI_block_emboss_set(block, RNA_boolean_get(&ptr, "is_stroke_visible") ? UI_EMBOSS : UI_EMBOSS_NONE);
- uiDefButR(block, UI_BTYPE_COLOR, 1, "", offset, yminc, w, ICON_WIDTH,
- &ptr, "color", -1,
+ uiDefButR(block, UI_BTYPE_COLOR, 1, "", offset, yminc, w, ICON_WIDTH,
+ &ptr, "color", -1,
0, 0, 0, 0, gpl->info);
-
+
UI_block_emboss_set(block, RNA_boolean_get(&ptr, "is_fill_visible") ? UI_EMBOSS : UI_EMBOSS_NONE);
- uiDefButR(block, UI_BTYPE_COLOR, 1, "", offset + w, yminc, w, ICON_WIDTH,
- &ptr, "fill_color", -1,
+ uiDefButR(block, UI_BTYPE_COLOR, 1, "", offset + w, yminc, w, ICON_WIDTH,
+ &ptr, "fill_color", -1,
0, 0, 0, 0, gpl->info);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
UI_block_align_end(block);
@@ -4447,14 +4447,14 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
#endif
}
}
-
+
/* step 4) draw text - check if renaming widget is in use... */
if (is_being_renamed) {
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
-
- /* draw renaming widget if we can get RNA pointer for it
- * NOTE: property may only be available in some cases, even if we have
+
+ /* draw renaming widget if we can get RNA pointer for it
+ * NOTE: property may only be available in some cases, even if we have
* a callback available (e.g. broken F-Curve rename)
*/
if (acf->name_prop(ale, &ptr, &prop)) {
@@ -4462,21 +4462,21 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
const short channel_height = round_fl_to_int(ymaxc - yminc);
const short width = ac->ar->winx - offset - (margin_x * 2);
uiBut *but;
-
+
UI_block_emboss_set(block, UI_EMBOSS);
-
+
but = uiDefButR(block, UI_BTYPE_TEXT, 1, "", offset + margin_x, yminc,
MAX2(width, RENAME_TEXT_MIN_WIDTH), channel_height,
&ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL);
-
+
/* copy what outliner does here, see outliner_buttons */
if (UI_but_active_only(C, ac->ar, block, but) == false) {
ac->ads->renameIndex = 0;
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_RENAME, NULL);
}
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
}
else {
@@ -4487,15 +4487,15 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
}
}
-
+
/* step 5) draw mute+protection toggles + (sliders) ....................... */
/* reset offset - now goes from RHS of panel */
offset = 0;
-
+
// TODO: when drawing sliders, make those draw instead of these toggles if not enough space
if (v2d && !is_being_renamed) {
short draw_sliders = 0;
-
+
/* check if we need to show the sliders */
if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_IPO)) {
switch (ac->spacetype) {
@@ -4513,12 +4513,12 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
}
}
}
-
+
/* check if there's enough space for the toggles if the sliders are drawn too */
if (!(draw_sliders) || (BLI_rcti_size_x(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) {
/* protect... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
- offset += ICON_WIDTH;
+ offset += ICON_WIDTH;
draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_PROTECT);
}
/* mute... */
@@ -4531,43 +4531,43 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
offset += ICON_WIDTH;
draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_VISIBLE);
}
-
+
/* modifiers disable */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) {
offset += ICON_WIDTH * 1.2f; /* hack: extra spacing, to avoid touching the mute toggle */
draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_MOD_OFF);
}
-
+
/* ----------- */
-
+
/* pinned... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PINNED)) {
offset += ICON_WIDTH;
draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_PINNED);
}
-
+
/* NLA Action "pushdown" */
if ((ale->type == ANIMTYPE_NLAACTION) && (ale->adt && ale->adt->action) && !(ale->adt->flag & ADT_NLA_EDIT_ON)) {
uiBut *but;
PointerRNA *opptr_b;
-
+
UI_block_emboss_set(block, UI_EMBOSS);
-
+
offset += UI_UNIT_X;
- but = uiDefIconButO(block, UI_BTYPE_BUT, "NLA_OT_action_pushdown", WM_OP_INVOKE_DEFAULT, ICON_NLA_PUSHDOWN,
+ but = uiDefIconButO(block, UI_BTYPE_BUT, "NLA_OT_action_pushdown", WM_OP_INVOKE_DEFAULT, ICON_NLA_PUSHDOWN,
(int)v2d->cur.xmax - offset, ymid, UI_UNIT_X, UI_UNIT_X, NULL);
-
+
opptr_b = UI_but_operator_ptr_get(but);
RNA_int_set(opptr_b, "channel_index", channel_index);
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
}
}
-
+
/* draw slider
* - even if we can draw sliders for this view, we must also check that the channel-type supports them
* (only only F-Curves really can support them for now)
- * - to make things easier, we use RNA-autobuts for this so that changes are reflected immediately,
+ * - to make things easier, we use RNA-autobuts for this so that changes are reflected immediately,
* wherever they occurred. BUT, we don't use the layout engine, otherwise we'd get wrong alignment,
* and wouldn't be able to auto-keyframe...
* - slider should start before the toggles (if they're visible) to keep a clean line down the side
@@ -4576,25 +4576,25 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
/* adjust offset */
// TODO: make slider width dynamic, so that they can be easier to use when the view is wide enough
offset += SLIDER_WIDTH;
-
+
/* need backdrop behind sliders... */
UI_block_emboss_set(block, UI_EMBOSS);
-
+
if (ale->owner) { /* Slider using custom RNA Access ---------- */
if (ale->type == ANIMTYPE_NLACURVE) {
NlaStrip *strip = (NlaStrip *)ale->owner;
FCurve *fcu = (FCurve *)ale->data;
PointerRNA ptr;
PropertyRNA *prop;
-
+
/* create RNA pointers */
RNA_pointer_create(ale->id, &RNA_NlaStrip, strip, &ptr);
prop = RNA_struct_find_property(&ptr, fcu->rna_path);
-
+
/* create property slider */
if (prop) {
uiBut *but;
-
+
/* create the slider button, and assign relevant callback to ensure keyframes are inserted... */
but = uiDefAutoButR(block, &ptr, prop, fcu->array_index, "", ICON_NONE, (int)v2d->cur.xmax - offset, ymid, SLIDER_WIDTH, (int)ymaxc - yminc);
UI_but_func_set(but, achannel_setting_slider_nla_curve_cb, ale->id, ale->data);
@@ -4607,41 +4607,41 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
char *rna_path = NULL;
int array_index = 0;
short free_path = 0;
-
+
/* get destination info */
if (ale->type == ANIMTYPE_FCURVE) {
FCurve *fcu = (FCurve *)ale->data;
-
+
rna_path = fcu->rna_path;
array_index = fcu->array_index;
}
else if (ale->type == ANIMTYPE_SHAPEKEY) {
KeyBlock *kb = (KeyBlock *)ale->data;
Key *key = (Key *)ale->id;
-
+
rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
free_path = 1;
}
-
+
/* only if RNA-Path found */
if (rna_path) {
/* get RNA pointer, and resolve the path */
RNA_id_pointer_create(ale->id, &id_ptr);
-
+
/* try to resolve the path */
if (RNA_path_resolve_property(&id_ptr, rna_path, &ptr, &prop)) {
uiBut *but;
-
+
/* create the slider button, and assign relevant callback to ensure keyframes are inserted... */
but = uiDefAutoButR(block, &ptr, prop, array_index, "", ICON_NONE, (int)v2d->cur.xmax - offset, ymid, SLIDER_WIDTH, (int)ymaxc - yminc);
-
+
/* assign keyframing function according to slider type */
if (ale->type == ANIMTYPE_SHAPEKEY)
UI_but_func_set(but, achannel_setting_slider_shapekey_cb, ale->id, ale->data);
else
UI_but_func_set(but, achannel_setting_slider_cb, ale->id, ale->data);
}
-
+
/* free the path if necessary */
if (free_path)
MEM_freeN(rna_path);
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index b32bbd4874d..1158145ad6b 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -30,7 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
+#include <string.h>
#include "MEM_guardedalloc.h"
@@ -80,24 +80,24 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
-
+
/* try to build list of filtered items */
ANIM_animdata_filter(ac, &anim_data, filter, data, datatype);
if (BLI_listbase_is_empty(&anim_data))
return;
-
+
/* only clear the 'active' flag for the channels of the same type */
for (ale = anim_data.first; ale; ale = ale->next) {
/* skip if types don't match */
if (channel_type != ale->type)
continue;
-
+
/* flag to set depends on type */
switch (ale->type) {
case ANIMTYPE_GROUP:
{
bActionGroup *agrp = (bActionGroup *)ale->data;
-
+
ACHANNEL_SET_FLAG(agrp, ACHANNEL_SETFLAG_CLEAR, AGRP_ACTIVE);
break;
}
@@ -105,14 +105,14 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
case ANIMTYPE_NLACURVE:
{
FCurve *fcu = (FCurve *)ale->data;
-
+
ACHANNEL_SET_FLAG(fcu, ACHANNEL_SETFLAG_CLEAR, FCURVE_ACTIVE);
break;
}
case ANIMTYPE_NLATRACK:
{
NlaTrack *nlt = (NlaTrack *)ale->data;
-
+
ACHANNEL_SET_FLAG(nlt, ACHANNEL_SETFLAG_CLEAR, NLATRACK_ACTIVE);
break;
}
@@ -144,13 +144,13 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
case ANIMTYPE_GPLAYER:
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
-
+
ACHANNEL_SET_FLAG(gpl, ACHANNEL_SETFLAG_CLEAR, GP_LAYER_ACTIVE);
break;
}
}
}
-
+
/* set active flag */
if (channel_data) {
switch (channel_type) {
@@ -199,26 +199,26 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
}
break;
}
-
+
case ANIMTYPE_GPLAYER:
{
bGPDlayer *gpl = (bGPDlayer *)channel_data;
gpl->flag |= GP_LAYER_ACTIVE;
break;
}
-
+
/* unhandled currently, but may be interesting */
case ANIMTYPE_MASKLAYER:
case ANIMTYPE_SHAPEKEY:
case ANIMTYPE_NLAACTION:
break;
-
+
/* other types */
default:
break;
}
}
-
+
/* clean up */
ANIM_animdata_freelist(&anim_data);
}
@@ -250,7 +250,7 @@ static void select_pchan_for_action_group(bAnimContext *ac, bActionGroup *agrp,
}
}
-/* Deselect all animation channels
+/* Deselect all animation channels
* - data: pointer to datatype, as contained in bAnimContext
* - datatype: the type of data that 'data' represents (eAnimCont_Types)
* - test: check if deselecting instead of selecting
@@ -261,18 +261,18 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* filter data */
/* NOTE: no list visible, otherwise, we get dangling */
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) {
- if (sel == 0)
+ if (sel == 0)
break;
-
+
switch (ale->type) {
case ANIMTYPE_SCENE:
if (ale->flag & SCE_DS_SELECTED)
@@ -301,7 +301,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
if (ale->flag & NLATRACK_SELECTED)
sel = ACHANNEL_SETFLAG_CLEAR;
break;
-
+
case ANIMTYPE_FILLACTD: /* Action Expander */
case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */
case ANIMTYPE_DSLAM:
@@ -337,16 +337,16 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
}
}
}
-
+
/* Now set the flags */
for (ale = anim_data.first; ale; ale = ale->next) {
switch (ale->type) {
case ANIMTYPE_SCENE:
{
Scene *scene = (Scene *)ale->data;
-
+
ACHANNEL_SET_FLAG(scene, sel, SCE_DS_SELECTED);
-
+
if (scene->adt) {
ACHANNEL_SET_FLAG(scene, sel, ADT_UI_SELECTED);
}
@@ -379,7 +379,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
case ANIMTYPE_NLACURVE:
{
FCurve *fcu = (FCurve *)ale->data;
-
+
ACHANNEL_SET_FLAG(fcu, sel, FCURVE_SELECTED);
fcu->flag &= ~FCURVE_ACTIVE;
break;
@@ -387,14 +387,14 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
case ANIMTYPE_SHAPEKEY:
{
KeyBlock *kb = (KeyBlock *)ale->data;
-
+
ACHANNEL_SET_FLAG(kb, sel, KEYBLOCK_SEL);
break;
}
case ANIMTYPE_NLATRACK:
{
NlaTrack *nlt = (NlaTrack *)ale->data;
-
+
ACHANNEL_SET_FLAG(nlt, sel, NLATRACK_SELECTED);
nlt->flag &= ~NLATRACK_ACTIVE;
break;
@@ -429,27 +429,27 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
case ANIMTYPE_GPLAYER:
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
-
+
ACHANNEL_SET_FLAG(gpl, sel, GP_LAYER_SELECT);
break;
}
case ANIMTYPE_MASKLAYER:
{
MaskLayer *masklay = (MaskLayer *)ale->data;
-
+
ACHANNEL_SET_FLAG(masklay, sel, MASK_LAYERFLAG_SELECT);
break;
}
}
}
-
+
/* Cleanup */
ANIM_animdata_freelist(&anim_data);
}
/* ---------------------------- Graph Editor ------------------------------------- */
-/* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting
+/* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting
* - anim_data: list of the all the anim channels that can be chosen
* -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too,
* then the channels under closed expanders get ignored...
@@ -462,7 +462,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
{
bAnimListElem *ale, *match = NULL;
int prevLevel = 0, matchLevel = 0;
-
+
/* sanity check */
if (ELEM(NULL, anim_data, anim_data->first))
return;
@@ -489,23 +489,23 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
}
else {
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale_setting);
-
+
if (acf == NULL) {
printf("ERROR: no channel info for the changed channel\n");
return;
}
-
+
/* get the level of the channel that was affected
* - 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;
}
-
- /* flush up?
+
+ /* flush up?
*
* For Visibility:
- * - only flush up if the current state is now enabled (positive 'on' state is default)
+ * - only flush up if the current state is now enabled (positive 'on' state is default)
* (otherwise, it's too much work to force the parents to be inactive too)
*
* For everything else:
@@ -519,25 +519,25 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
for (ale = match->prev; ale; ale = ale->prev) {
const 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 */
if (acf == NULL)
continue;
-
- /* get the level of the current channel traversed
+
+ /* get the level of the current channel traversed
* - 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;
-
+
/* 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,
+ * but also 'less than' the level just tried (i.e. only the 1st group above grouped F-Curves,
* when toggling visibility of F-Curves, gets flushed, which should happen if we don't let prevLevel
* get updated below once the first 1st group is found)...
*/
if (level < prevLevel) {
/* flush the new status... */
ANIM_channel_setting_set(ac, ale, setting, mode);
-
+
/* store this level as the 'old' level now */
prevLevel = level;
}
@@ -549,31 +549,31 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
if (prevLevel == 0)
break;
/* otherwise, this level weaves into another sibling hierarchy to the previous one just
- * finished, so skip until we get to the parent of this level
+ * finished, so skip until we get to the parent of this level
*/
else
continue;
}
}
}
-
+
/* 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) {
const 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 */
if (acf == NULL)
continue;
-
- /* get the level of the current channel traversed
+
+ /* get the level of the current channel traversed
* - 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;
-
- /* if the level is 'greater than' (i.e. less important) the channel that was changed,
+
+ /* if the level is 'greater than' (i.e. less important) the channel that was changed,
* flush the new status...
*/
if (level > matchLevel)
@@ -584,7 +584,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
*/
else
break;
-
+
/* store this level as the 'old' level now */
// prevLevel = level; // XXX: prevLevel is unused
}
@@ -596,13 +596,13 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAn
/* Delete the given F-Curve from its AnimData block */
void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *fcu)
{
- /* - if no AnimData, we've got nowhere to remove the F-Curve from
+ /* - if no AnimData, we've got nowhere to remove the F-Curve from
* (this doesn't guarantee that the F-Curve is in there, but at least we tried
* - if no F-Curve, there is nothing to remove
*/
if (ELEM(NULL, adt, fcu))
return;
-
+
/* remove from whatever list it came from
* - Action Group
* - Action
@@ -615,15 +615,15 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
}
else if (adt->action) {
bAction *act = adt->action;
-
+
/* remove from group or action, whichever one "owns" the F-Curve */
if (fcu->grp) {
bActionGroup *agrp = fcu->grp;
-
+
/* remove F-Curve from group+action */
action_groups_remove_channel(act, fcu);
-
- /* if group has no more channels, remove it too,
+
+ /* if group has no more channels, remove it too,
* otherwise can have many dangling groups [#33541]
*/
if (BLI_listbase_is_empty(&agrp->channels)) {
@@ -633,7 +633,7 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
else {
BLI_remlink(&act->curves, fcu);
}
-
+
/* if action has no more F-Curves as a result of this, unlink it from
* AnimData if it did not come from a NLA Strip being tweaked.
*
@@ -646,7 +646,7 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
adt->action = NULL;
}
}
-
+
/* free the F-Curve itself */
free_fcurve(fcu);
}
@@ -660,7 +660,7 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
static int animedit_poll_channels_active(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
-
+
/* channels region test */
/* TODO: could enhance with actually testing if channels region? */
if (ELEM(NULL, sa, CTX_wm_region(C)))
@@ -685,13 +685,13 @@ static int animedit_poll_channels_nla_tweakmode_off(bContext *C)
/* animation editor test */
if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA) == 0)
return 0;
-
+
/* NLA TweakMode test */
if (sa->spacetype == SPACE_NLA) {
if ((scene == NULL) || (scene->flag & SCE_NLA_EDIT_ON))
return 0;
}
-
+
return 1;
}
@@ -720,7 +720,7 @@ static const EnumPropertyItem prop_animchannel_rearrange_types[] = {
/* Island definition - just a listbase container */
typedef struct tReorderChannelIsland {
struct tReorderChannelIsland *next, *prev;
-
+
ListBase channels; /* channels within this region with the same state */
int flag; /* eReorderIslandFlag */
} tReorderChannelIsland;
@@ -741,7 +741,7 @@ static bool rearrange_island_ok(tReorderChannelIsland *island)
/* island must not be untouchable */
if (island->flag & REORDER_ISLAND_UNTOUCHABLE)
return 0;
-
+
/* island should be selected to be moved */
return (island->flag & REORDER_ISLAND_SELECTED) && !(island->flag & REORDER_ISLAND_MOVED);
}
@@ -753,13 +753,13 @@ static bool rearrange_island_top(ListBase *list, tReorderChannelIsland *island)
if (rearrange_island_ok(island)) {
/* remove from current position */
BLI_remlink(list, island);
-
+
/* make it first element */
BLI_insertlinkbefore(list, list->first, island);
-
+
return 1;
}
-
+
return 0;
}
@@ -777,14 +777,14 @@ static bool rearrange_island_up(ListBase *list, tReorderChannelIsland *island)
if (prev) {
/* remove from current position */
BLI_remlink(list, island);
-
+
/* push it up */
BLI_insertlinkbefore(list, prev, island);
-
+
return 1;
}
}
-
+
return 0;
}
@@ -804,16 +804,16 @@ static bool rearrange_island_down(ListBase *list, tReorderChannelIsland *island)
if ((next->flag & REORDER_ISLAND_UNTOUCHABLE) == 0) {
/* remove from current position */
BLI_remlink(list, island);
-
+
/* push it down */
BLI_insertlinkafter(list, next, island);
-
+
return true;
}
}
/* else: no next channel, so we're at the bottom already, so can't move */
}
-
+
return false;
}
@@ -821,10 +821,10 @@ static bool rearrange_island_bottom(ListBase *list, tReorderChannelIsland *islan
{
if (rearrange_island_ok(island)) {
tReorderChannelIsland *last = list->last;
-
+
/* remove island from current position */
BLI_remlink(list, island);
-
+
/* add before or after the last channel? */
if ((last->flag & REORDER_ISLAND_UNTOUCHABLE) == 0) {
/* can add after it */
@@ -833,12 +833,12 @@ static bool rearrange_island_bottom(ListBase *list, tReorderChannelIsland *islan
else {
/* can at most go just before it, since last cannot be moved */
BLI_insertlinkbefore(list, last, island);
-
+
}
-
+
return true;
}
-
+
return false;
}
@@ -879,13 +879,13 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr
{
tReorderChannelIsland *island = islands->last; /* always try to add to last island if possible */
bool is_sel = false, is_untouchable = false;
-
+
/* get flags - selected and untouchable from the channel */
switch (type) {
case ANIMTYPE_GROUP:
{
bActionGroup *agrp = (bActionGroup *)channel;
-
+
is_sel = SEL_AGRP(agrp);
is_untouchable = (agrp->flag & AGRP_TEMP) != 0;
break;
@@ -894,21 +894,21 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr
case ANIMTYPE_NLACURVE:
{
FCurve *fcu = (FCurve *)channel;
-
+
is_sel = SEL_FCU(fcu);
break;
}
case ANIMTYPE_NLATRACK:
{
NlaTrack *nlt = (NlaTrack *)channel;
-
+
is_sel = SEL_NLT(nlt);
break;
}
case ANIMTYPE_GPLAYER:
{
bGPDlayer *gpl = (bGPDlayer *)channel;
-
+
is_sel = SEL_GPL(gpl);
break;
}
@@ -916,7 +916,7 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr
printf("rearrange_animchannel_add_to_islands(): don't know how to handle channels of type %u\n", type);
return;
}
-
+
/* do we need to add to a new island? */
if (/* 1) no islands yet */
(island == NULL) ||
@@ -931,7 +931,7 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr
/* create a new island now */
island = MEM_callocN(sizeof(tReorderChannelIsland), "tReorderChannelIsland");
BLI_addtail(islands, island);
-
+
if (is_sel)
island->flag |= REORDER_ISLAND_SELECTED;
if (is_untouchable)
@@ -949,14 +949,14 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr
static void rearrange_animchannel_flatten_islands(ListBase *islands, ListBase *srcList)
{
tReorderChannelIsland *island, *isn = NULL;
-
+
/* make sure srcList is empty now */
BLI_assert(BLI_listbase_is_empty(srcList));
-
+
/* go through merging islands */
for (island = islands->first; island; island = isn) {
isn = island->next;
-
+
/* merge island channels back to main list, then delete the island */
BLI_movelisttolist(srcList, &island->channels);
BLI_freelinkN(islands, island);
@@ -971,19 +971,19 @@ static void rearrange_animchannels_filter_visible(ListBase *anim_data_visible, b
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale, *ale_next;
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
-
+
/* get all visible channels */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* now, only keep the ones that are of the types we are interested in */
for (ale = anim_data.first; ale; ale = ale_next) {
ale_next = ale->next;
-
+
if (ale->type != type) {
BLI_freelinkN(&anim_data, ale);
}
}
-
+
/* return cleaned up list */
*anim_data_visible = anim_data;
}
@@ -996,11 +996,11 @@ static bool rearrange_animchannel_islands(ListBase *list, AnimChanRearrangeFp re
ListBase islands = {NULL, NULL};
Link *channel, *chanNext = NULL;
bool done = false;
-
+
/* don't waste effort on an empty list */
if (BLI_listbase_is_empty(list))
return 0;
-
+
/* group channels into islands */
for (channel = list->first; channel; channel = chanNext) {
/* find out whether this channel is present in anim_data_visible or not! */
@@ -1008,18 +1008,18 @@ static bool rearrange_animchannel_islands(ListBase *list, AnimChanRearrangeFp re
chanNext = channel->next;
rearrange_animchannel_add_to_islands(&islands, list, channel, type, is_hidden);
}
-
- /* perform moving of selected islands now, but only if there is more than one of 'em so that something will happen
- * - scanning of the list is performed in the opposite direction to the direction we're moving things, so that we
+
+ /* perform moving of selected islands now, but only if there is more than one of 'em so that something will happen
+ * - scanning of the list is performed in the opposite direction to the direction we're moving things, so that we
* shouldn't need to encounter items we've moved already
*/
if (islands.first != islands.last) {
tReorderChannelIsland *first = (mode > 0) ? islands.last : islands.first;
tReorderChannelIsland *island, *isn = NULL;
-
+
for (island = first; island; island = isn) {
isn = (mode > 0) ? island->prev : island->next;
-
+
/* perform rearranging */
if (rearrange_func(&islands, island)) {
island->flag |= REORDER_ISLAND_MOVED;
@@ -1027,10 +1027,10 @@ static bool rearrange_animchannel_islands(ListBase *list, AnimChanRearrangeFp re
}
}
}
-
+
/* ungroup islands */
rearrange_animchannel_flatten_islands(&islands, list);
-
+
/* did we do anything? */
return done;
}
@@ -1045,21 +1045,21 @@ static void rearrange_nla_channels(bAnimContext *ac, AnimData *adt, eRearrangeAn
{
AnimChanRearrangeFp rearrange_func;
ListBase anim_data_visible = {NULL, NULL};
-
+
/* hack: invert mode so that functions will work in right order */
mode *= -1;
-
+
/* get rearranging function */
rearrange_func = rearrange_get_mode_func(mode);
if (rearrange_func == NULL)
return;
-
+
/* Filter visible data. */
rearrange_animchannels_filter_visible(&anim_data_visible, ac, ANIMTYPE_NLATRACK);
-
+
/* perform rearranging on tracks list */
rearrange_animchannel_islands(&adt->nla_tracks, rearrange_func, mode, ANIMTYPE_NLATRACK, &anim_data_visible);
-
+
/* free temp data */
BLI_freelistN(&anim_data_visible);
}
@@ -1074,20 +1074,20 @@ static void rearrange_driver_channels(bAnimContext *ac, AnimData *adt, eRearrang
/* get rearranging function */
AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode);
ListBase anim_data_visible = {NULL, NULL};
-
+
if (rearrange_func == NULL)
return;
-
+
/* only consider drivers if they're accessible */
if (EXPANDED_DRVD(adt) == 0)
return;
-
+
/* Filter visible data. */
rearrange_animchannels_filter_visible(&anim_data_visible, ac, ANIMTYPE_FCURVE);
-
+
/* perform rearranging on drivers list (drivers are really just F-Curves) */
rearrange_animchannel_islands(&adt->drivers, rearrange_func, mode, ANIMTYPE_FCURVE, &anim_data_visible);
-
+
/* free temp data */
BLI_freelistN(&anim_data_visible);
}
@@ -1099,29 +1099,29 @@ static void split_groups_action_temp(bAction *act, bActionGroup *tgrp)
{
bActionGroup *agrp;
FCurve *fcu;
-
+
if (act == NULL)
return;
-
+
/* Separate F-Curves into lists per group */
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.first;
fcu->prev = NULL;
-
+
fcu = agrp->channels.last;
fcu->next = NULL;
}
}
-
+
/* Initialize memory for temp-group */
memset(tgrp, 0, sizeof(bActionGroup));
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 */
@@ -1129,21 +1129,21 @@ static void split_groups_action_temp(bAction *act, bActionGroup *tgrp)
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;
-
- /* ensure that all of these get their group set to this temp group
+
+ /* ensure that all of these get their group set to this temp group
* (so that visibility filtering works)
*/
for (fcu = tgrp->channels.first; fcu; fcu = fcu->next) {
fcu->grp = tgrp;
}
}
-
+
/* Add temp-group to list */
BLI_addtail(&act->groups, tgrp);
}
@@ -1152,36 +1152,36 @@ static void split_groups_action_temp(bAction *act, bActionGroup *tgrp)
static void join_groups_action_temp(bAction *act)
{
bActionGroup *agrp;
-
+
for (agrp = act->groups.first; agrp; agrp = agrp->next) {
ListBase tempGroup;
-
+
/* add list of channels to action's channels */
tempGroup = agrp->channels;
BLI_movelisttolist(&act->curves, &agrp->channels);
agrp->channels = tempGroup;
-
+
/* clear moved flag */
agrp->flag &= ~AGRP_MOVED;
-
+
/* if group was temporary one:
* - unassign all FCurves which were temporarily added to it
* - remove from list (but don't free as it's on the stack!)
*/
if (agrp->flag & AGRP_TEMP) {
FCurve *fcu;
-
+
for (fcu = agrp->channels.first; fcu; fcu = fcu->next) {
fcu->grp = NULL;
}
-
+
BLI_remlink(&act->groups, agrp);
break;
}
}
}
-/* Change the order of anim-channels within action
+/* Change the order of anim-channels within action
* mode: REARRANGE_ANIMCHAN_*
*/
static void rearrange_action_channels(bAnimContext *ac, bAction *act, eRearrangeAnimChan_Mode mode)
@@ -1189,35 +1189,35 @@ static void rearrange_action_channels(bAnimContext *ac, bAction *act, eRearrange
bActionGroup tgrp;
ListBase anim_data_visible = {NULL, NULL};
bool do_channels;
-
+
/* get rearranging function */
AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode);
-
+
if (rearrange_func == NULL)
return;
-
+
/* make sure we're only operating with groups (vs a mixture of groups+curves) */
split_groups_action_temp(act, &tgrp);
-
+
/* Filter visible data. */
rearrange_animchannels_filter_visible(&anim_data_visible, ac, ANIMTYPE_GROUP);
-
- /* rearrange groups first
+
+ /* rearrange groups first
* - the group's channels will only get considered if nothing happened when rearranging the groups
* i.e. the rearrange function returned 0
*/
do_channels = (rearrange_animchannel_islands(&act->groups, rearrange_func, mode, ANIMTYPE_GROUP,
&anim_data_visible) == 0);
-
+
/* free temp data */
BLI_freelistN(&anim_data_visible);
-
+
if (do_channels) {
bActionGroup *agrp;
-
+
/* Filter visible data. */
rearrange_animchannels_filter_visible(&anim_data_visible, ac, ANIMTYPE_FCURVE);
-
+
for (agrp = act->groups.first; agrp; agrp = agrp->next) {
/* only consider F-Curves if they're visible (group expanded) */
if (EXPANDED_AGRP(ac, agrp)) {
@@ -1225,11 +1225,11 @@ static void rearrange_action_channels(bAnimContext *ac, bAction *act, eRearrange
&anim_data_visible);
}
}
-
+
/* free temp data */
BLI_freelistN(&anim_data_visible);
}
-
+
/* assemble lists into one list (and clear moved tags) */
join_groups_action_temp(act);
}
@@ -1239,23 +1239,23 @@ static void rearrange_action_channels(bAnimContext *ac, bAction *act, eRearrange
static void rearrange_nla_control_channels(bAnimContext *ac, AnimData *adt, eRearrangeAnimChan_Mode mode)
{
ListBase anim_data_visible = {NULL, NULL};
-
+
NlaTrack *nlt;
NlaStrip *strip;
-
+
/* get rearranging function */
AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode);
-
+
if (rearrange_func == NULL)
return;
-
+
/* skip if these curves aren't being shown */
if (adt->flag & ADT_NLA_SKEYS_COLLAPSED)
return;
-
+
/* Filter visible data. */
rearrange_animchannels_filter_visible(&anim_data_visible, ac, ANIMTYPE_NLACURVE);
-
+
/* we cannot rearrange between strips, but within each strip, we can rearrange those curves */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
for (strip = nlt->strips.first; strip; strip = strip->next) {
@@ -1263,7 +1263,7 @@ static void rearrange_nla_control_channels(bAnimContext *ac, AnimData *adt, eRea
&anim_data_visible);
}
}
-
+
/* free temp data */
BLI_freelistN(&anim_data_visible);
}
@@ -1275,36 +1275,36 @@ static void rearrange_gpencil_channels(bAnimContext *ac, eRearrangeAnimChan_Mode
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* get rearranging function */
AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode);
-
+
if (rearrange_func == NULL)
return;
-
+
/* get Grease Pencil datablocks */
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) {
ListBase anim_data_visible = {NULL, NULL};
bGPdata *gpd = ale->data;
-
+
/* only consider layers if this datablock is open */
BLI_assert(ale->type == ANIMTYPE_GPDATABLOCK);
if ((gpd->flag & GP_DATA_EXPAND) == 0)
continue;
-
+
/* Filter visible data. */
rearrange_animchannels_filter_visible(&anim_data_visible, ac, ANIMTYPE_GPLAYER);
-
+
/* rearrange datablock's layers */
rearrange_animchannel_islands(&gpd->layers, rearrange_func, mode, ANIMTYPE_GPLAYER, &anim_data_visible);
-
+
/* free visible layers data */
BLI_freelistN(&anim_data_visible);
}
-
+
/* free GPD channel data */
ANIM_animdata_freelist(&anim_data);
}
@@ -1315,14 +1315,14 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
eRearrangeAnimChan_Mode mode;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get mode */
mode = RNA_enum_get(op->ptr, "direction");
-
+
/* method to move channels depends on the editor */
if (ac.datatype == ANIMCONT_GPENCIL) {
/* Grease Pencil channels */
@@ -1340,23 +1340,23 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* get animdata blocks */
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;
-
+
switch (ac.datatype) {
case ANIMCONT_NLA: /* NLA-tracks only */
rearrange_nla_channels(&ac, adt, mode);
break;
-
+
case ANIMCONT_DRIVERS: /* Drivers list only */
rearrange_driver_channels(&ac, adt, mode);
break;
-
+
case ANIMCONT_ACTION: /* Single Action only... */
case ANIMCONT_SHAPEKEY: // DOUBLE CHECK ME...
{
@@ -1366,13 +1366,13 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
printf("Animdata has no action\n");
break;
}
-
+
default: /* DopeSheet/Graph Editor - Some Actions + NLA Control Curves */
{
/* NLA Control Curves */
if (adt->nla_tracks.first)
rearrange_nla_control_channels(&ac, adt, mode);
-
+
/* Action */
if (adt->action)
rearrange_action_channels(&ac, adt->action, mode);
@@ -1382,14 +1382,14 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
}
}
}
-
+
/* free temp data */
ANIM_animdata_freelist(&anim_data);
}
-
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1399,14 +1399,14 @@ static void ANIM_OT_channels_move(wmOperatorType *ot)
ot->name = "Move Channels";
ot->idname = "ANIM_OT_channels_move";
ot->description = "Rearrange selected animation channels";
-
+
/* api callbacks */
ot->exec = animchannels_rearrange_exec;
ot->poll = animedit_poll_channels_nla_tweakmode_off;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
ot->prop = RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
}
@@ -1422,16 +1422,16 @@ static int animchannels_grouping_poll(bContext *C)
/* TODO: could enhance with actually testing if channels region? */
if (ELEM(NULL, sa, CTX_wm_region(C)))
return 0;
-
+
/* animation editor test - must be suitable modes only */
sl = CTX_wm_space_data(C);
-
+
switch (sa->spacetype) {
/* supported... */
case SPACE_ACTION:
{
SpaceAction *saction = (SpaceAction *)sl;
-
+
/* dopesheet and action only - all others are for other datatypes or have no groups */
if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_DOPESHEET) == 0)
return 0;
@@ -1441,7 +1441,7 @@ static int animchannels_grouping_poll(bContext *C)
case SPACE_IPO:
{
SpaceIpo *sipo = (SpaceIpo *)sl;
-
+
/* drivers can't have groups... */
if (sipo->mode != SIPO_MODE_ANIMATION)
return 0;
@@ -1452,50 +1452,50 @@ static int animchannels_grouping_poll(bContext *C)
default:
return 0;
}
-
+
return 1;
}
/* ----------------------------------------------------------- */
static void animchannels_group_channels(bAnimContext *ac, bAnimListElem *adt_ref, const char name[])
-{
+{
AnimData *adt = adt_ref->adt;
bAction *act = adt->action;
-
+
if (act) {
ListBase anim_data = {NULL, NULL};
int filter;
-
+
/* find selected F-Curves to re-group */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL);
ANIM_animdata_filter(ac, &anim_data, filter, adt_ref, ANIMCONT_CHANNEL);
-
+
if (anim_data.first) {
bActionGroup *agrp;
bAnimListElem *ale;
-
+
/* create new group, which should now be part of the action */
agrp = action_groups_add_new(act, name);
BLI_assert(agrp != NULL);
-
+
/* transfer selected F-Curves across to new group */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->data;
bActionGroup *grp = fcu->grp;
-
+
/* remove F-Curve from group, then group too if it is now empty */
action_groups_remove_channel(act, fcu);
-
+
if ((grp) && BLI_listbase_is_empty(&grp->channels)) {
BLI_freelinkN(&act->groups, grp);
}
-
+
/* add F-Curve to group */
action_groups_add_channel(act, agrp, fcu);
}
}
-
+
/* cleanup */
ANIM_animdata_freelist(&anim_data);
}
@@ -1505,35 +1505,35 @@ static int animchannels_group_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
char name[MAX_NAME];
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get name for new group */
RNA_string_get(op->ptr, "name", name);
-
+
/* XXX: name for group should never be empty... */
if (name[0]) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* handle each animdata block separately, so that the regrouping doesn't flow into blocks */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
animchannels_group_channels(&ac, ale, name);
}
-
+
/* free temp data */
ANIM_animdata_freelist(&anim_data);
-
+
/* updatss */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
-
+
return OPERATOR_FINISHED;
}
@@ -1543,18 +1543,18 @@ static void ANIM_OT_channels_group(wmOperatorType *ot)
ot->name = "Group Channels";
ot->idname = "ANIM_OT_channels_group";
ot->description = "Add selected F-Curves to a new group";
-
+
/* callbacks */
ot->invoke = WM_operator_props_popup;
ot->exec = animchannels_group_exec;
ot->poll = animchannels_grouping_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
- ot->prop = RNA_def_string(ot->srna, "name", "New Group",
- sizeof(((bActionGroup *)NULL)->name),
+ ot->prop = RNA_def_string(ot->srna, "name", "New Group",
+ sizeof(((bActionGroup *)NULL)->name),
"Name", "Name of newly created group");
/* RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE); */ /* XXX: still not too sure about this - keeping same text is confusing... */
}
@@ -1564,33 +1564,33 @@ static void ANIM_OT_channels_group(wmOperatorType *ot)
static int animchannels_ungroup_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
-
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* just selected F-Curves... */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+
for (ale = anim_data.first; ale; ale = ale->next) {
/* find action for this F-Curve... */
if (ale->adt && ale->adt->action) {
FCurve *fcu = (FCurve *)ale->data;
bAction *act = ale->adt->action;
-
+
/* only proceed to remove if F-Curve is in a group... */
- if (fcu->grp) {
+ if (fcu->grp) {
bActionGroup *agrp = fcu->grp;
-
+
/* remove F-Curve from group and add at tail (ungrouped) */
action_groups_remove_channel(act, fcu);
BLI_addtail(&act->curves, fcu);
-
+
/* delete group if it is now empty */
if (BLI_listbase_is_empty(&agrp->channels)) {
BLI_freelinkN(&act->groups, agrp);
@@ -1598,13 +1598,13 @@ static int animchannels_ungroup_exec(bContext *C, wmOperator *UNUSED(op))
}
}
}
-
+
/* cleanup */
ANIM_animdata_freelist(&anim_data);
-
+
/* updates */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1614,11 +1614,11 @@ static void ANIM_OT_channels_ungroup(wmOperatorType *ot)
ot->name = "Ungroup Channels";
ot->idname = "ANIM_OT_channels_ungroup";
ot->description = "Remove selected F-Curves from their current groups";
-
+
/* callbacks */
ot->exec = animchannels_ungroup_exec;
ot->poll = animchannels_grouping_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1631,22 +1631,22 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* cannot delete in shapekey */
- if (ac.datatype == ANIMCONT_SHAPEKEY)
+ if (ac.datatype == ANIMCONT_SHAPEKEY)
return OPERATOR_CANCELLED;
-
-
+
+
/* 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);
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) {
/* only groups - don't check other types yet, since they may no-longer exist */
@@ -1654,20 +1654,20 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
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 */
if (adt == NULL)
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;
-
+
/* remove from group and action, then free */
action_groups_remove_channel(adt->action, fcu);
free_fcurve(fcu);
}
-
+
/* free the group itself */
if (adt->action)
BLI_freelinkN(&adt->action->groups, agrp);
@@ -1675,24 +1675,24 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
MEM_freeN(agrp);
}
}
-
+
/* cleanup */
ANIM_animdata_freelist(&anim_data);
}
-
+
/* filter data */
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) {
switch (ale->type) {
- case ANIMTYPE_FCURVE:
+ case ANIMTYPE_FCURVE:
{
/* F-Curves if we can identify its parent */
AnimData *adt = ale->adt;
FCurve *fcu = (FCurve *)ale->data;
-
+
/* try to free F-Curve */
ANIM_fcurve_delete_from_animdata(&ac, adt, fcu);
break;
@@ -1702,7 +1702,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* NLA Control Curve - Deleting it should disable the corresponding setting... */
NlaStrip *strip = (NlaStrip *)ale->owner;
FCurve *fcu = (FCurve *)ale->data;
-
+
if (STREQ(fcu->rna_path, "strip_time")) {
strip->flag &= ~NLASTRIP_FLAG_USR_TIME;
}
@@ -1712,7 +1712,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
else {
printf("ERROR: Trying to delete NLA Control Curve for unknown property '%s'\n", fcu->rna_path);
}
-
+
/* unlink and free the F-Curve */
BLI_remlink(&strip->fcurves, fcu);
free_fcurve(fcu);
@@ -1723,7 +1723,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* Grease Pencil layer */
bGPdata *gpd = (bGPdata *)ale->id;
bGPDlayer *gpl = (bGPDlayer *)ale->data;
-
+
/* try to delete the layer's data and the layer itself */
BKE_gpencil_free_frames(gpl);
BLI_freelinkN(&gpd->layers, gpl);
@@ -1734,35 +1734,35 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* Mask layer */
Mask *mask = (Mask *)ale->id;
MaskLayer *masklay = (MaskLayer *)ale->data;
-
+
/* try to delete the layer's data and the layer itself */
BKE_mask_layer_remove(mask, masklay);
break;
}
}
}
-
+
/* cleanup */
ANIM_animdata_freelist(&anim_data);
-
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
DAG_relations_tag_update(CTX_data_main(C));
return OPERATOR_FINISHED;
}
-
+
static void ANIM_OT_channels_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Channels";
ot->idname = "ANIM_OT_channels_delete";
ot->description = "Delete all selected animation channels";
-
+
/* api callbacks */
ot->exec = animchannels_delete_exec;
ot->poll = animedit_poll_channels_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1789,7 +1789,7 @@ static const EnumPropertyItem prop_animchannel_settings_types[] = {
/* ------------------- */
-/* Set/clear a particular flag (setting) for all selected + visible channels
+/* Set/clear a particular flag (setting) for all selected + visible channels
* setting: the setting to modify
* mode: eAnimChannels_SetFlag
* onlysel: only selected channels get the flag set
@@ -1801,20 +1801,20 @@ static void setflag_anim_channels(bAnimContext *ac, eAnimChannel_Settings settin
ListBase all_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* filter data that we need if flush is on */
if (flush) {
- /* get list of all channels that selection may need to be flushed to
+ /* get list of all channels that selection may need to be flushed to
* - hierarchy visibility needs to be ignored so that settings can get flushed
* "down" inside closed containers
*/
filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
ANIM_animdata_filter(ac, &all_data, filter, ac->data, ac->datatype);
}
-
- /* filter data that we're working on
+
+ /* filter data that we're working on
* - hierarchy matters if we're doing this from the channels region
- * since we only want to apply this to channels we can "see",
+ * since we only want to apply this to channels we can "see",
* and have these affect their relatives
* - but for Graph Editor, this gets used also from main region
* where hierarchy doesn't apply [#21276]
@@ -1829,12 +1829,12 @@ static void setflag_anim_channels(bAnimContext *ac, eAnimChannel_Settings settin
}
if (onlysel) filter |= ANIMFILTER_SEL;
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
+
/* 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;
-
+
/* see if we should turn off instead... */
for (ale = anim_data.first; ale; ale = ale->next) {
/* set the setting in the appropriate way (if available) */
@@ -1844,21 +1844,21 @@ static void setflag_anim_channels(bAnimContext *ac, eAnimChannel_Settings settin
}
}
}
-
+
/* apply the setting */
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;
-
+
/* set the setting in the appropriate way */
ANIM_channel_setting_set(ac, ale, setting, mode);
-
+
/* if flush status... */
if (flush)
ANIM_flush_setting_anim_channels(ac, &all_data, ale, setting, mode);
}
-
+
ANIM_animdata_freelist(&anim_data);
BLI_freelistN(&all_data);
}
@@ -1871,27 +1871,27 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op)
eAnimChannel_Settings setting;
eAnimChannels_SetFlag mode;
bool flush = true;
-
+
/* 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");
-
+
/* check if setting is flushable */
if (setting == ACHANNEL_SETTING_EXPAND)
flush = false;
-
- /* modify setting
+
+ /* modify setting
* - only selected channels are affected
*/
setflag_anim_channels(&ac, setting, mode, true, flush);
-
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1899,20 +1899,20 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op)
static void ANIM_OT_channels_setting_enable(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Enable Channel Setting";
ot->idname = "ANIM_OT_channels_setting_enable";
ot->description = "Enable specified setting on all selected animation channels";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = animchannels_setflag_exec;
ot->poll = animedit_poll_channels_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
/* flag-setting mode */
prop = RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_ADD, "Mode", "");
@@ -1924,20 +1924,20 @@ static void ANIM_OT_channels_setting_enable(wmOperatorType *ot)
static void ANIM_OT_channels_setting_disable(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Disable Channel Setting";
ot->idname = "ANIM_OT_channels_setting_disable";
ot->description = "Disable specified setting on all selected animation channels";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = animchannels_setflag_exec;
ot->poll = animedit_poll_channels_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
/* flag-setting mode */
prop = RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_CLEAR, "Mode", "");
@@ -1949,20 +1949,20 @@ static void ANIM_OT_channels_setting_disable(wmOperatorType *ot)
static void ANIM_OT_channels_setting_toggle(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Toggle Channel Setting";
ot->idname = "ANIM_OT_channels_setting_toggle";
ot->description = "Toggle specified setting on all selected animation channels";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = animchannels_setflag_exec;
ot->poll = animedit_poll_channels_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
/* flag-setting mode */
prop = RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
@@ -1974,19 +1974,19 @@ static void ANIM_OT_channels_setting_toggle(wmOperatorType *ot)
static void ANIM_OT_channels_editable_toggle(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Toggle Channel Editability";
ot->idname = "ANIM_OT_channels_editable_toggle";
ot->description = "Toggle editability of selected channels";
-
+
/* api callbacks */
ot->exec = animchannels_setflag_exec;
ot->poll = animedit_poll_channels_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
/* flag-setting mode */
RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
@@ -2001,21 +2001,21 @@ static int animchannels_expand_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
bool onlysel = true;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* only affect selected channels? */
if (RNA_boolean_get(op->ptr, "all"))
onlysel = false;
-
+
/* modify setting */
setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, ACHANNEL_SETFLAG_ADD, onlysel, false);
-
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -2025,14 +2025,14 @@ static void ANIM_OT_channels_expand(wmOperatorType *ot)
ot->name = "Expand Channels";
ot->idname = "ANIM_OT_channels_expand";
ot->description = "Expand (i.e. open) all selected expandable animation channels";
-
+
/* api callbacks */
ot->exec = animchannels_expand_exec;
ot->poll = animedit_poll_channels_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all channels (not just selected ones)");
}
@@ -2043,21 +2043,21 @@ static int animchannels_collapse_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
bool onlysel = true;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* only affect selected channels? */
if (RNA_boolean_get(op->ptr, "all"))
onlysel = false;
-
+
/* modify setting */
setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, ACHANNEL_SETFLAG_CLEAR, onlysel, false);
-
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -2067,14 +2067,14 @@ static void ANIM_OT_channels_collapse(wmOperatorType *ot)
ot->name = "Collapse Channels";
ot->idname = "ANIM_OT_channels_collapse";
ot->description = "Collapse (i.e. close) all selected expandable animation channels";
-
+
/* api callbacks */
ot->exec = animchannels_collapse_exec;
ot->poll = animedit_poll_channels_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
ot->prop = RNA_def_boolean(ot->srna, "all", true, "All", "Collapse all channels (not just selected ones)");
}
@@ -2090,37 +2090,37 @@ static void ANIM_OT_channels_collapse(wmOperatorType *ot)
* or are no longer wanted
* 3) No drivers
*/
-
+
static int animchannels_clean_empty_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
-
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get animdata blocks */
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) {
ID *id = ale->id;
AnimData *adt = ale->data;
-
+
bool action_empty = false;
bool nla_empty = false;
bool drivers_empty = false;
-
+
/* sanity checks */
BLI_assert((id != NULL) && (adt != NULL));
-
+
/* check if this is "empty" and can be deleted */
/* (For now, there are only these 3 criteria) */
-
+
/* 1) Active Action is missing or empty */
if (ELEM(NULL, adt->action, adt->action->curves.first)) {
action_empty = true;
@@ -2128,18 +2128,18 @@ static int animchannels_clean_empty_exec(bContext *C, wmOperator *UNUSED(op))
else {
/* TODO: check for keyframe + fmodifier data on these too */
}
-
+
/* 2) No NLA Tracks and/or NLA Strips */
if (adt->nla_tracks.first == NULL) {
nla_empty = true;
}
else {
NlaTrack *nlt;
-
+
/* empty tracks? */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
if (nlt->strips.first) {
- /* stop searching, as we found one that actually had stuff we don't want lost
+ /* stop searching, as we found one that actually had stuff we don't want lost
* NOTE: nla_empty gets reset to false, as a previous track may have been empty
*/
nla_empty = false;
@@ -2151,23 +2151,23 @@ static int animchannels_clean_empty_exec(bContext *C, wmOperator *UNUSED(op))
}
}
}
-
+
/* 3) Drivers */
drivers_empty = (adt->drivers.first == NULL);
-
-
+
+
/* remove AnimData? */
if (action_empty && nla_empty && drivers_empty) {
BKE_animdata_free(id, true);
}
}
-
+
/* free temp data */
ANIM_animdata_freelist(&anim_data);
-
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -2177,11 +2177,11 @@ static void ANIM_OT_channels_clean_empty(wmOperatorType *ot)
ot->name = "Remove Empty Animation Data";
ot->idname = "ANIM_OT_channels_clean_empty";
ot->description = "Delete all empty animation data containers from visible data-blocks";
-
+
/* api callbacks */
ot->exec = animchannels_clean_empty_exec;
ot->poll = animedit_poll_channels_nla_tweakmode_off;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -2191,56 +2191,56 @@ static void ANIM_OT_channels_clean_empty(wmOperatorType *ot)
static int animchannels_enable_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
-
+
/* channels region test */
/* TODO: could enhance with actually testing if channels region? */
if (ELEM(NULL, sa, CTX_wm_region(C)))
return 0;
-
+
/* animation editor test - Action/Dopesheet/etc. and Graph only */
if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO) == 0)
return 0;
-
+
return 1;
}
static int animchannels_enable_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
-
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* filter data */
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) {
FCurve *fcu = (FCurve *)ale->data;
-
+
/* remove disabled flags from F-Curves */
fcu->flag &= ~FCURVE_DISABLED;
-
+
/* for drivers, let's do the same too */
if (fcu->driver)
fcu->driver->flag &= ~DRIVER_FLAG_INVALID;
-
+
/* tag everything for updates - in particular, this is needed to get drivers working again */
ale->update |= ANIM_UPDATE_DEPS;
}
-
+
ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
-
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -2250,11 +2250,11 @@ static void ANIM_OT_channels_fcurves_enable(wmOperatorType *ot)
ot->name = "Revive Disabled F-Curves";
ot->idname = "ANIM_OT_channels_fcurves_enable";
ot->description = "Clears 'disabled' tag from all F-Curves to get broken F-Curves working again";
-
+
/* api callbacks */
ot->exec = animchannels_enable_exec;
ot->poll = animchannels_enable_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -2265,10 +2265,10 @@ static void ANIM_OT_channels_fcurves_enable(wmOperatorType *ot)
static int animchannels_find_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
-
+
if (sa == NULL)
return 0;
-
+
/* animation editor with dopesheet */
return ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA);
}
@@ -2277,14 +2277,14 @@ static int animchannels_find_poll(bContext *C)
static int animchannels_find_invoke(bContext *C, wmOperator *op, const wmEvent *evt)
{
bAnimContext ac;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* set initial filter text, and enable filter */
RNA_string_set(op->ptr, "query", ac.ads->searchstr);
-
+
/* defer to popup */
return WM_operator_props_popup(C, op, evt);
}
@@ -2293,26 +2293,26 @@ static int animchannels_find_invoke(bContext *C, wmOperator *op, const wmEvent *
static int animchannels_find_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* update filter text, and ensure that filter is enabled if there's something there
* NOTE: we turn the filter off if there's nothing (this is a quick shortcut for dismissing)
*/
RNA_string_get(op->ptr, "query", ac.ads->searchstr);
-
+
if (ac.ads->searchstr[0]) {
ac.ads->filterflag |= ADS_FILTER_BY_FCU_NAME;
}
else {
ac.ads->filterflag &= ~ADS_FILTER_BY_FCU_NAME;
}
-
+
/* redraw */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -2322,15 +2322,15 @@ static void ANIM_OT_channels_find(wmOperatorType *ot)
ot->name = "Find Channels";
ot->idname = "ANIM_OT_channels_find";
ot->description = "Filter the set of channels shown to only include those with matching names";
-
+
/* callbacks */
ot->invoke = animchannels_find_invoke;
ot->exec = animchannels_find_exec;
ot->poll = animchannels_find_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
ot->prop = RNA_def_string(ot->srna, "query", "Query", sizeof(((bDopeSheet *)NULL)->searchstr), "", "Text to search for in channel names");
}
@@ -2340,37 +2340,37 @@ static void ANIM_OT_channels_find(wmOperatorType *ot)
static int animchannels_deselectall_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* 'standard' behavior - check if selected, then apply relevant selection */
if (RNA_boolean_get(op->ptr, "invert"))
ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, false, ACHANNEL_SETFLAG_INVERT);
else
ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, true, ACHANNEL_SETFLAG_ADD);
-
+
/* send notifier that things have changed */
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)
{
/* identifiers */
ot->name = "Select All";
ot->idname = "ANIM_OT_channels_select_all_toggle";
ot->description = "Toggle selection of all animation channels";
-
+
/* api callbacks */
ot->exec = animchannels_deselectall_exec;
ot->poll = animedit_poll_channels_nla_tweakmode_off;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
ot->prop = RNA_def_boolean(ot->srna, "invert", false, "Invert", "");
}
@@ -2382,12 +2382,12 @@ static void borderselect_anim_channels(bAnimContext *ac, rcti *rect, short selec
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
SpaceNla *snla = (SpaceNla *)ac->sl;
View2D *v2d = &ac->ar->v2d;
rctf rectf;
float ymin, ymax;
-
+
/* set initial y extents */
if (ac->datatype == ANIMCONT_NLA) {
ymin = (float)(-NLACHANNEL_HEIGHT(snla));
@@ -2397,27 +2397,27 @@ static void borderselect_anim_channels(bAnimContext *ac, rcti *rect, short selec
ymin = 0.0f;
ymax = (float)(-ACHANNEL_HEIGHT(ac));
}
-
+
/* 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);
-
+
/* filter data */
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) {
if (ac->datatype == ANIMCONT_NLA)
ymin = ymax - NLACHANNEL_STEP(snla);
else
ymin = ymax - ACHANNEL_STEP(ac);
-
+
/* if channel is within border-select region, alter it */
if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
/* set selection flags only */
ANIM_channel_setting_set(ac, ale, ACHANNEL_SETTING_SELECT, selectmode);
-
+
/* type specific actions */
switch (ale->type) {
case ANIMTYPE_GROUP:
@@ -2431,20 +2431,20 @@ static void borderselect_anim_channels(bAnimContext *ac, rcti *rect, short selec
case ANIMTYPE_NLATRACK:
{
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
+
+ /* 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;
}
}
}
-
+
/* set minimum extent to be the maximum of the next channel */
ymax = ymin;
}
-
+
/* cleanup */
ANIM_animdata_freelist(&anim_data);
}
@@ -2458,11 +2458,11 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
short selectmode = 0;
const bool select = !RNA_boolean_get(op->ptr, "deselect");
const bool extend = RNA_boolean_get(op->ptr, "extend");
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get settings from operator */
WM_operator_properties_border_to_rcti(op, &rect);
@@ -2476,15 +2476,15 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
else {
selectmode = ACHANNEL_SETFLAG_CLEAR;
}
-
+
/* apply borderselect animation channels */
borderselect_anim_channels(&ac, &rect, selectmode);
-
+
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL);
-
+
return OPERATOR_FINISHED;
-}
+}
static void ANIM_OT_channels_select_border(wmOperatorType *ot)
{
@@ -2492,18 +2492,18 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot)
ot->name = "Border Select";
ot->idname = "ANIM_OT_channels_select_border";
ot->description = "Select all animation channels within the specified region";
-
+
/* api callbacks */
ot->invoke = WM_gesture_border_invoke;
ot->exec = animchannels_borderselect_exec;
ot->modal = WM_gesture_border_modal;
ot->cancel = WM_gesture_border_cancel;
-
+
ot->poll = animedit_poll_channels_nla_tweakmode_off;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* rna */
WM_operator_properties_gesture_border_select(ot);
}
@@ -2518,33 +2518,33 @@ static bool rename_anim_channels(bAnimContext *ac, int channel_index)
bAnimListElem *ale;
int filter;
bool success = false;
-
+
/* get the channel that was clicked on */
/* 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);
if (ale == NULL) {
/* channel not found */
if (G.debug & G_DEBUG)
printf("Error: animation channel (index = %d) not found in rename_anim_channels()\n", channel_index);
-
+
ANIM_animdata_freelist(&anim_data);
return false;
}
-
+
/* check that channel can be renamed */
acf = ANIM_channel_get_typeinfo(ale);
if (acf && acf->name_prop) {
PointerRNA ptr;
PropertyRNA *prop;
-
+
/* ok if we can get name property to edit from this channel */
if (acf->name_prop(ale, &ptr, &prop)) {
/* actually showing the rename textfield is done on redraw,
- * so here we just store the index of this channel in the
+ * so here we just store the index of this channel in the
* dopesheet data, which will get utilized when drawing the
* channel...
*
@@ -2556,7 +2556,7 @@ static bool rename_anim_channels(bAnimContext *ac, int channel_index)
}
}
}
-
+
/* free temp data and tag for refresh */
ANIM_animdata_freelist(&anim_data);
ED_region_tag_redraw(ac->ar);
@@ -2569,18 +2569,18 @@ static int animchannels_channel_get(bAnimContext *ac, const int mval[2])
View2D *v2d;
int channel_index;
float x, y;
-
+
/* get useful pointers from animation context data */
ar = ac->ar;
v2d = &ar->v2d;
-
- /* figure out which channel user clicked in
+
+ /* 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
* so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use
* ACHANNEL_HEIGHT_HALF.
*/
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
-
+
if (ac->datatype == ANIMCONT_NLA) {
SpaceNla *snla = (SpaceNla *)ac->sl;
UI_view2d_listview_view_to_cell(v2d, NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP(snla), 0, (float)NLACHANNEL_HEIGHT_HALF(snla), x, y, NULL, &channel_index);
@@ -2617,7 +2617,7 @@ static void ANIM_OT_channels_rename(wmOperatorType *ot)
ot->name = "Rename Channels";
ot->idname = "ANIM_OT_channels_rename";
ot->description = "Rename animation channel under mouse";
-
+
/* api callbacks */
ot->invoke = animchannels_rename_invoke;
ot->poll = animedit_poll_channels_active;
@@ -2632,19 +2632,19 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
bAnimListElem *ale;
int filter;
int notifierFlags = 0;
-
+
/* get the channel that was clicked on */
/* 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);
if (ale == NULL) {
/* channel not found */
if (G.debug & G_DEBUG)
printf("Error: animation channel (index = %d) not found in mouse_anim_channels()\n", channel_index);
-
+
ANIM_animdata_freelist(&anim_data);
return 0;
}
@@ -2664,7 +2664,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
{
Scene *sce = (Scene *)ale->data;
AnimData *adt = sce->adt;
-
+
/* set selection status */
if (selectmode == SELECT_INVERT) {
/* swap select */
@@ -2675,7 +2675,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
sce->flag |= SCE_DS_SELECTED;
if (adt) adt->flag |= ADT_UI_SELECTED;
}
-
+
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
break;
}
@@ -2686,7 +2686,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
Base *base = (Base *)ale->data;
Object *ob = base->object;
AnimData *adt = ob->adt;
-
+
/* set selection status */
if ((ob->restrictflag & OB_RESTRICT_SELECT) == 0) {
if (selectmode == SELECT_INVERT) {
@@ -2760,28 +2760,28 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR);
ale->adt->flag |= ADT_UI_SELECTED;
}
-
+
/* set active? */
if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
ale->adt->flag |= ADT_UI_ACTIVE;
}
-
+
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
break;
}
- case ANIMTYPE_GROUP:
+ case ANIMTYPE_GROUP:
{
bActionGroup *agrp = (bActionGroup *)ale->data;
-
+
Object *ob = NULL;
bPoseChannel *pchan = NULL;
-
-
+
+
/* Armatures-Specific Feature:
* Since groups are used to collect F-Curves of the same Bone by default
* (via Keying Sets) so that they can be managed better, we try to make
* things here easier for animators by mapping group selection to bone
- * selection.
+ * selection.
*
* Only do this if "Only Selected" dopesheet filter is not active, or else it
* becomes too unpredictable/tricky to manage
@@ -2789,7 +2789,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
if ((ac->ads->filterflag & ADS_FILTER_ONLYSEL) == 0) {
if ((ale->id) && (GS(ale->id->name) == ID_OB)) {
ob = (Object *)ale->id;
-
+
if (ob->type == OB_ARMATURE) {
/* Assume for now that any group with corresponding name is what we want
* (i.e. for an armature whose location is animated, things would break
@@ -2798,10 +2798,10 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
* TODO: check the first F-Curve or so to be sure...
*/
pchan = BKE_pose_channel_find_name(ob->pose, agrp->name);
- }
+ }
}
}
-
+
/* select/deselect group */
if (selectmode == SELECT_INVERT) {
/* inverse selection status of this group only */
@@ -2810,11 +2810,11 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
else if (selectmode == -1) {
/* select all in group (and deselect everthing else) */
FCurve *fcu;
-
+
/* deselect all other channels */
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR);
if (pchan) ED_pose_deselect_all(ob, SEL_DESELECT, false);
-
+
/* only select channels in group and group itself */
for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcu->next)
fcu->flag |= FCURVE_SELECTED;
@@ -2824,10 +2824,10 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
/* select group by itself */
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR);
if (pchan) ED_pose_deselect_all(ob, SEL_DESELECT, false);
-
+
agrp->flag |= AGRP_SELECTED;
}
-
+
/* if group is selected now, make group the 'active' one in the visible list */
if (agrp->flag & AGRP_SELECTED) {
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
@@ -2837,7 +2837,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, NULL, ANIMTYPE_GROUP);
if (pchan) ED_pose_bone_select(ob, pchan, false);
}
-
+
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
break;
}
@@ -2845,7 +2845,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
case ANIMTYPE_NLACURVE:
{
FCurve *fcu = (FCurve *)ale->data;
-
+
/* select/deselect */
if (selectmode == SELECT_INVERT) {
/* inverse selection status of this F-Curve only */
@@ -2856,18 +2856,18 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR);
fcu->flag |= FCURVE_SELECTED;
}
-
+
/* if F-Curve is selected now, make F-Curve the 'active' one in the visible list */
if (fcu->flag & FCURVE_SELECTED)
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ale->type);
-
+
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
break;
}
- case ANIMTYPE_SHAPEKEY:
+ case ANIMTYPE_SHAPEKEY:
{
KeyBlock *kb = (KeyBlock *)ale->data;
-
+
/* select/deselect */
if (selectmode == SELECT_INVERT) {
/* inverse selection status of this ShapeKey only */
@@ -2878,39 +2878,39 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR);
kb->flag |= KEYBLOCK_SEL;
}
-
+
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
break;
}
case ANIMTYPE_NLACONTROLS:
{
AnimData *adt = (AnimData *)ale->data;
-
+
/* toggle expand
* - Although the triangle widget already allows this, since there's nothing else that can be done here now,
* let's just use it for easier expand/collapse for now
*/
adt->flag ^= ADT_NLA_SKEYS_COLLAPSED;
-
+
notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
break;
}
case ANIMTYPE_GPDATABLOCK:
{
bGPdata *gpd = (bGPdata *)ale->data;
-
- /* toggle expand
+
+ /* 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);
break;
}
case ANIMTYPE_GPLAYER:
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
-
+
/* select/deselect */
if (selectmode == SELECT_INVERT) {
/* invert selection status of this layer only */
@@ -2921,12 +2921,12 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR);
gpl->flag |= GP_LAYER_SELECT;
}
-
+
/* change active layer, if this is selected (since we must always have an active layer) */
if (gpl->flag & GP_LAYER_SELECT) {
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, gpl, ANIMTYPE_GPLAYER);
}
-
+
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL); /* Grease Pencil updates */
notifierFlags |= (ND_ANIMCHAN | NA_EDITED); /* Animation Ediotrs updates */
break;
@@ -2934,19 +2934,19 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
case ANIMTYPE_MASKDATABLOCK:
{
Mask *mask = (Mask *)ale->data;
-
+
/* toggle expand
* - although the triangle widget already allows this, the whole channel can also be used for this purpose
*/
mask->flag ^= MASK_ANIMF_EXPAND;
-
+
notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
break;
}
case ANIMTYPE_MASKLAYER:
{
MaskLayer *masklay = (MaskLayer *)ale->data;
-
+
/* select/deselect */
if (selectmode == SELECT_INVERT) {
/* invert selection status of this layer only */
@@ -2957,7 +2957,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, false, ACHANNEL_SETFLAG_CLEAR);
masklay->flag |= MASK_LAYERFLAG_SELECT;
}
-
+
notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
break;
}
@@ -2966,10 +2966,10 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
printf("Error: Invalid channel type in mouse_anim_channels()\n");
break;
}
-
+
/* free channels */
ANIM_animdata_freelist(&anim_data);
-
+
/* return notifier flags */
return notifierFlags;
}
@@ -2986,16 +2986,16 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE
int notifierFlags = 0;
short selectmode;
float x, y;
-
-
+
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
+
/* get useful pointers from animation context data */
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;
@@ -3003,45 +3003,45 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE
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;
-
- /* figure out which channel user clicked in
+
+ /* 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
* so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use
* ACHANNEL_HEIGHT_HALF.
*/
UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP(&ac), 0, (float)ACHANNEL_HEIGHT_HALF(&ac), x, y, NULL, &channel_index);
-
+
/* handle mouse-click in the relevant channel then */
notifierFlags = mouse_anim_channels(C, &ac, channel_index, selectmode);
-
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | notifierFlags, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
static void ANIM_OT_channels_click(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Mouse Click on Channels";
ot->idname = "ANIM_OT_channels_click";
ot->description = "Handle mouse-clicks over animation channels";
-
+
/* api callbacks */
ot->invoke = animchannels_mouseclick_invoke;
ot->poll = animedit_poll_channels_active;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
-
+
/* properties */
/* NOTE: don't save settings, otherwise, can end up with some weird behaviour (sticky extend) */
prop = RNA_def_boolean(ot->srna, "extend", false, "Extend Select", ""); // SHIFTKEY
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-
+
prop = RNA_def_boolean(ot->srna, "children_only", false, "Select Children Only", ""); // CTRLKEY|SHIFTKEY
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
@@ -3152,13 +3152,13 @@ void ED_operatortypes_animchannels(void)
{
WM_operatortype_append(ANIM_OT_channels_select_all_toggle);
WM_operatortype_append(ANIM_OT_channels_select_border);
-
+
WM_operatortype_append(ANIM_OT_channels_click);
WM_operatortype_append(ANIM_OT_channel_select_keys);
WM_operatortype_append(ANIM_OT_channels_rename);
WM_operatortype_append(ANIM_OT_channels_find);
-
+
WM_operatortype_append(ANIM_OT_channels_setting_enable);
WM_operatortype_append(ANIM_OT_channels_setting_disable);
WM_operatortype_append(ANIM_OT_channels_setting_toggle);
@@ -3167,16 +3167,16 @@ void ED_operatortypes_animchannels(void)
/* XXX does this need to be a separate operator? */
WM_operatortype_append(ANIM_OT_channels_editable_toggle);
-
+
WM_operatortype_append(ANIM_OT_channels_move);
-
+
WM_operatortype_append(ANIM_OT_channels_expand);
WM_operatortype_append(ANIM_OT_channels_collapse);
-
+
WM_operatortype_append(ANIM_OT_channels_fcurves_enable);
-
+
WM_operatortype_append(ANIM_OT_channels_clean_empty);
-
+
WM_operatortype_append(ANIM_OT_channels_group);
WM_operatortype_append(ANIM_OT_channels_ungroup);
}
@@ -3186,7 +3186,7 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation Channels", 0, 0);
wmKeyMapItem *kmi;
-
+
/* click-select */
/* XXX for now, only leftmouse.... */
WM_keymap_add_item(keymap, "ANIM_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0);
@@ -3201,31 +3201,31 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf)
/* find (i.e. a shortcut for setting the name filter) */
WM_keymap_add_item(keymap, "ANIM_OT_channels_find", FKEY, KM_PRESS, KM_CTRL, 0);
-
+
/* 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 */
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);
-
+
/* delete */
WM_keymap_add_item(keymap, "ANIM_OT_channels_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ANIM_OT_channels_delete", DELKEY, KM_PRESS, 0, 0);
-
+
/* 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_disable", WKEY, KM_PRESS, KM_ALT, 0);
-
+
/* settings - specialized hotkeys */
WM_keymap_add_item(keymap, "ANIM_OT_channels_editable_toggle", TABKEY, KM_PRESS, 0, 0);
-
+
/* expand/collapse */
WM_keymap_add_item(keymap, "ANIM_OT_channels_expand", PADPLUSKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, 0, 0);
-
+
kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_expand", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "all", false);
kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, KM_CTRL, 0);
@@ -3236,7 +3236,7 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, 0, 0)->ptr, "direction", REARRANGE_ANIMCHAN_DOWN);
RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_TOP);
RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_BOTTOM);
-
+
/* grouping */
WM_keymap_add_item(keymap, "ANIM_OT_channels_group", GKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ANIM_OT_channels_ungroup", GKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index b362efccc9b..7eddb3bc3b2 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -72,7 +72,7 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
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);
if (adt) {
@@ -82,16 +82,16 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
/* update data */
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
* are editing, this is then expected to do the proper redraws
* and depsgraph updates */
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
-
+
RNA_id_pointer_create(id, &id_ptr);
-
+
if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &ptr, &prop))
RNA_property_update_main(G.main, scene, &ptr, prop);
}
@@ -102,17 +102,17 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
}
}
-/* tags the given ID block for refreshes (if applicable) due to
+/* tags the given ID block for refreshes (if applicable) due to
* Animation Editor editing */
void ANIM_id_update(Scene *UNUSED(scene), ID *id)
{
if (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?
}
@@ -133,33 +133,33 @@ static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGro
{
bActionGroup *agrp = (bActionGroup *)ale->data;
ID *owner_id = ale->id;
-
+
/* major priority is selection status
* so we need both a group and an owner
*/
if (ELEM(NULL, agrp, owner_id))
return;
-
+
/* for standard Objects, check if group is the name of some bone */
if (GS(owner_id->name) == ID_OB) {
Object *ob = (Object *)owner_id;
-
- /* check if there are bones, and whether the name matches any
+
+ /* 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);
bArmature *arm = ob->data;
-
+
if (pchan) {
bActionGroup *bgrp;
-
+
/* if one matches, sync the selection status */
if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))
agrp->flag |= AGRP_SELECTED;
else
agrp->flag &= ~AGRP_SELECTED;
-
+
/* also sync active group status */
if ((ob == ac->obact) && (pchan->bone == arm->act_bone)) {
/* if no previous F-Curve has active flag, then we're the first and only one to get it */
@@ -176,7 +176,7 @@ static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGro
/* this can't possibly be active now */
agrp->flag &= ~AGRP_ACTIVE;
}
-
+
/* sync group colors */
bgrp = (bActionGroup *)BLI_findlink(&ob->pose->agroups, (pchan->agrp_index - 1));
if (bgrp) {
@@ -187,33 +187,33 @@ static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGro
}
}
}
-
+
/* perform syncing updates for F-Curves */
static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **active_fcurve)
{
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
+
+ /* 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...
*/
if (ELEM(NULL, fcu, fcu->rna_path, owner_id))
return;
-
+
if (GS(owner_id->name) == ID_OB) {
Object *ob = (Object *)owner_id;
-
+
/* only affect if F-Curve involves pose.bones */
if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones")) {
bArmature *arm = (bArmature *)ob->data;
bPoseChannel *pchan;
char *bone_name;
-
+
/* get bone-name, and check if this bone is selected */
bone_name = BLI_str_quoted_substrN(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 */
if ((pchan) && (pchan->bone)) {
/* F-Curve selection */
@@ -221,8 +221,8 @@ static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **
fcu->flag |= FCURVE_SELECTED;
else
fcu->flag &= ~FCURVE_SELECTED;
-
- /* Active F-Curve - it should be the first one for this bone on the
+
+ /* Active F-Curve - it should be the first one for this bone on the
* active object to be considered as active
*/
if ((ob == ac->obact) && (pchan->bone == arm->act_bone)) {
@@ -245,18 +245,18 @@ static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **
}
else if (GS(owner_id->name) == ID_SCE) {
Scene *scene = (Scene *)owner_id;
-
+
/* only affect if F-Curve involves sequence_editor.sequences */
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
Editing *ed = BKE_sequencer_editing_get(scene, false);
Sequence *seq;
char *seq_name;
-
+
/* get strip name, and check if this strip is selected */
seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, false);
if (seq_name) MEM_freeN(seq_name);
-
+
/* update selection status */
if (seq) {
if (seq->flag & SELECT)
@@ -268,17 +268,17 @@ static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **
}
else if (GS(owner_id->name) == ID_NT) {
bNodeTree *ntree = (bNodeTree *)owner_id;
-
+
/* check for selected nodes */
if ((fcu->rna_path) && strstr(fcu->rna_path, "nodes")) {
bNode *node;
char *node_name;
-
+
/* get strip name, and check if this strip is selected */
node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
node = nodeFindNodebyName(ntree, node_name);
if (node_name) MEM_freeN(node_name);
-
+
/* update selection/active status */
if (node) {
/* update selection status */
@@ -286,7 +286,7 @@ static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **
fcu->flag |= FCURVE_SELECTED;
else
fcu->flag &= ~FCURVE_SELECTED;
-
+
/* update active status */
/* XXX: this may interfere with setting bones as active if both exist at once;
* then again, if that's the case, production setups aren't likely to be animating
@@ -313,7 +313,7 @@ static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **
static void animchan_sync_gplayer(bAnimContext *UNUSED(ac), bAnimListElem *ale)
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
-
+
/* Make sure the selection flags agree with the "active" flag.
* The selection flags are used in the Dopesheet only, whereas
* the active flag is used everywhere else. Hence, we try to
@@ -332,7 +332,7 @@ static void animchan_sync_gplayer(bAnimContext *UNUSED(ac), bAnimListElem *ale)
}
/* ---------------- */
-
+
/* Main call to be exported to animation editors */
void ANIM_sync_animchannels_to_data(const bContext *C)
{
@@ -340,38 +340,38 @@ void ANIM_sync_animchannels_to_data(const bContext *C)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
bActionGroup *active_agrp = NULL;
FCurve *active_fcurve = NULL;
-
+
/* get animation context info for filtering the channels */
if (ANIM_animdata_get_context(C, &ac) == 0)
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
+ /* NOTE: we want all channels, since we want to be able to set selection status on some of them even when collapsed
* However, don't include duplicates so that selection statuses don't override each other
*/
filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS;
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) {
switch (ale->type) {
case ANIMTYPE_GROUP:
animchan_sync_group(&ac, ale, &active_agrp);
break;
-
+
case ANIMTYPE_FCURVE:
animchan_sync_fcurve(&ac, ale, &active_fcurve);
break;
-
+
case ANIMTYPE_GPLAYER:
animchan_sync_gplayer(&ac, ale);
break;
}
}
-
+
ANIM_animdata_freelist(&anim_data);
}
@@ -392,14 +392,14 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
for (ale = anim_data->first; ale; ale = ale->next) {
if (ale->type == ANIMTYPE_GPLAYER) {
bGPDlayer *gpl = ale->data;
-
+
if (ale->update & ANIM_UPDATE_ORDER) {
ale->update &= ~ANIM_UPDATE_ORDER;
if (gpl) {
//gpencil_sort_frames(gpl);
}
}
-
+
if (ale->update & ANIM_UPDATE_DEPS) {
ale->update &= ~ANIM_UPDATE_DEPS;
ANIM_list_elem_update(ac->scene, ale);
@@ -407,19 +407,19 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
}
else if (ale->datatype == ALE_FCURVE) {
FCurve *fcu = ale->key_data;
-
+
if (ale->update & ANIM_UPDATE_ORDER) {
ale->update &= ~ANIM_UPDATE_ORDER;
if (fcu)
sort_time_fcurve(fcu);
}
-
+
if (ale->update & ANIM_UPDATE_HANDLES) {
ale->update &= ~ANIM_UPDATE_HANDLES;
if (fcu)
calchandles_fcurve(fcu);
}
-
+
if (ale->update & ANIM_UPDATE_DEPS) {
ale->update &= ~ANIM_UPDATE_DEPS;
ANIM_list_elem_update(ac->scene, ale);
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 109987bf46a..3feb14cd0f1 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -74,12 +74,12 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const
float xscale, yscale, x, y;
char numstr[32] = " t"; /* t is the character to start replacing from */
int slen;
-
+
/* because the frame number text is subject to the same scaling as the contents of the view */
UI_view2d_scale_get(v2d, &xscale, &yscale);
glScalef(1.0f / xscale, 1.0f, 1.0f);
-
- /* get timecode string
+
+ /* get timecode string
* - padding on str-buf passed so that it doesn't sit on the frame indicator
* - power = 0, gives 'standard' behavior for time
* but power = 1 is required for frames (to get integer frames)
@@ -92,19 +92,19 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const
}
slen = UI_fontstyle_string_width(fstyle, numstr) - 1;
-
+
/* get starting coordinates for drawing */
x = cfra * xscale;
y = 0.9f * U.widget_unit;
-
+
/* draw green box around/behind text */
UI_ThemeColorShade(TH_CFRAME, 0);
glRectf(x, y, x + slen, y + 0.75f * U.widget_unit);
-
+
/* draw current frame number - black text */
UI_ThemeColor(TH_TEXT);
UI_fontstyle_draw_simple(fstyle, x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr);
-
+
/* restore view transform */
glScalef(xscale, 1.0, 1.0);
}
@@ -142,13 +142,13 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
{
Scene *scene = CTX_data_scene(C);
-
+
/* only draw this if preview range is set */
if (PRVRANGEON) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
-
+
/* only draw two separate 'curtains' if there's no overlap between them */
if (PSFRA < PEFRA + end_frame_width) {
glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
@@ -157,7 +157,7 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
else {
glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
}
-
+
glDisable(GL_BLEND);
}
}
@@ -172,10 +172,10 @@ AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale)
/* sanity checks */
if (ac == NULL)
return NULL;
-
+
/* abort if rendering - we may get some race condition issues... */
if (G.is_rendering) return NULL;
-
+
/* apart from strictly keyframe-related contexts, this shouldn't even happen */
// XXX: nla and channel here may not be necessary...
if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_SHAPEKEY, ANIMCONT_DOPESHEET,
@@ -188,7 +188,7 @@ AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale)
return ale->adt;
}
}
-
+
/* cannot handle... */
return NULL;
}
@@ -201,15 +201,15 @@ 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;
-
+
/* 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[1][0] = BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_UNMAP);
-
+
return 0;
}
@@ -219,20 +219,20 @@ 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;
-
+
/* 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[1][0] = BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_MAP);
-
+
return 0;
}
-/* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve
+/* 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
*/
@@ -240,20 +240,20 @@ void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, boo
{
KeyframeEditData ked = {{NULL}};
KeyframeEditFunc map_cb;
-
- /* init edit data
+
+ /* init edit data
* - AnimData is stored in 'data'
* - only_keys is stored in 'i1'
*/
ked.data = (void *)adt;
ked.i1 = (int)only_keys;
-
+
/* get editing callback */
if (restore)
map_cb = bezt_nlamapping_restore;
else
map_cb = bezt_nlamapping_apply;
-
+
/* apply to F-Curve */
ANIM_fcurve_keyframes_loop(&ked, fcu, NULL, map_cb, NULL);
}
@@ -432,7 +432,7 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag
if (id && fcu && fcu->rna_path) {
PointerRNA ptr, id_ptr;
PropertyRNA *prop;
-
+
/* get RNA property that F-Curve affects */
RNA_id_pointer_create(id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &ptr, &prop)) {
@@ -446,7 +446,7 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag
return RAD2DEGF(1.0f); /* radians to degrees */
}
}
-
+
/* TODO: other rotation types here as necessary */
}
}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index fcb1399be30..b41302f4706 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -111,13 +111,13 @@
static void animedit_get_yscale_factor(bAnimContext *ac)
{
bTheme *btheme = UI_GetTheme();
-
+
/* grab scale factor directly from action editor setting
* NOTE: This theme setting doesn't have an ID, as it cannot be accessed normally
* since it is a float, and the theme settings methods can only handle chars.
*/
ac->yscale_fac = btheme->tact.keyframe_scale_fac;
-
+
/* clamp to avoid problems with uninitialised values... */
if (ac->yscale_fac < 0.1f)
ac->yscale_fac = 1.0f;
@@ -133,22 +133,22 @@ static Key *actedit_get_shapekeys(bAnimContext *ac)
Scene *scene = ac->scene;
Object *ob;
Key *key;
-
+
ob = OBACT;
- if (ob == NULL)
+ if (ob == NULL)
return NULL;
-
+
/* XXX pinning is not available in 'ShapeKey' mode... */
//if (saction->pin) return NULL;
-
+
/* shapekey data is stored with geometry data */
key = BKE_key_from_object(ob);
-
+
if (key) {
if (key->type == KEY_RELATIVE)
return key;
}
-
+
return NULL;
}
@@ -157,7 +157,7 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction)
{
/* get dopesheet */
ac->ads = &saction->ads;
-
+
/* sync settings with current view status, then return appropriate data */
switch (saction->mode) {
case SACTCONT_ACTION: /* 'Action Editor' */
@@ -168,37 +168,37 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction)
else
saction->action = NULL;
}
-
+
ac->datatype = ANIMCONT_ACTION;
ac->data = saction->action;
-
+
ac->mode = saction->mode;
return true;
-
+
case SACTCONT_SHAPEKEY: /* 'ShapeKey Editor' */
ac->datatype = ANIMCONT_SHAPEKEY;
ac->data = actedit_get_shapekeys(ac);
-
+
/* if not pinned, sync with active object */
if (/*saction->pin == 0*/ true) {
Key *key = (Key *)ac->data;
-
+
if (key && key->adt)
saction->action = key->adt->action;
else
saction->action = NULL;
}
-
+
ac->mode = saction->mode;
return true;
-
+
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;
-
+
ac->datatype = ANIMCONT_GPENCIL;
ac->data = &saction->ads;
-
+
ac->mode = saction->mode;
return true;
@@ -211,37 +211,37 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction)
ac->mode = saction->mode;
return true;
-
+
case SACTCONT_MASK: /* Mask */ /* XXX review how this mode is handled... */
{
/* TODO, other methods to get the mask */
// Sequence *seq = BKE_sequencer_active_get(ac->scene);
//MovieClip *clip = ac->scene->clip;
// struct Mask *mask = seq ? seq->mask : NULL;
-
+
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
saction->ads.source = (ID *)ac->scene;
-
+
ac->datatype = ANIMCONT_MASK;
ac->data = &saction->ads;
-
+
ac->mode = saction->mode;
return true;
}
case SACTCONT_DOPESHEET: /* DopeSheet */
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
saction->ads.source = (ID *)ac->scene;
-
+
ac->datatype = ANIMCONT_DOPESHEET;
ac->data = &saction->ads;
-
+
ac->mode = saction->mode;
return true;
-
+
default: /* unhandled yet */
ac->datatype = ANIMCONT_NONE;
ac->data = NULL;
-
+
ac->mode = -1;
return false;
}
@@ -258,41 +258,41 @@ static bool graphedit_get_context(bAnimContext *ac, SpaceIpo *sipo)
sipo->ads->source = (ID *)ac->scene;
}
ac->ads = sipo->ads;
-
+
/* set settings for Graph Editor - "Selected = Editable" */
if (sipo->flag & SIPO_SELCUVERTSONLY)
sipo->ads->filterflag |= ADS_FILTER_SELEDIT;
else
sipo->ads->filterflag &= ~ADS_FILTER_SELEDIT;
-
+
/* sync settings with current view status, then return appropriate data */
switch (sipo->mode) {
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->filterflag &= ~ADS_FILTER_ONLYDRIVERS;
-
+
ac->datatype = ANIMCONT_FCURVES;
ac->data = sipo->ads;
-
+
ac->mode = sipo->mode;
return true;
-
+
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->filterflag |= ADS_FILTER_ONLYDRIVERS;
-
+
ac->datatype = ANIMCONT_DRIVERS;
ac->data = sipo->ads;
-
+
ac->mode = sipo->mode;
return true;
-
+
default: /* unhandled yet */
ac->datatype = ANIMCONT_NONE;
ac->data = NULL;
-
+
ac->mode = -1;
return false;
}
@@ -307,21 +307,21 @@ static bool nlaedit_get_context(bAnimContext *ac, SpaceNla *snla)
if (snla->ads == NULL)
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->filterflag |= ADS_FILTER_ONLYNLA;
-
+
ac->datatype = ANIMCONT_NLA;
ac->data = snla->ads;
-
+
return true;
}
/* ----------- Public API --------------- */
-/* Obtain current anim-data context, given that context info from Blender context has already been set
+/* Obtain current anim-data context, given that context info from Blender context has already been set
* - AnimContext to write to is provided as pointer to var on stack so that we don't have
* allocation/freeing costs (which are not that avoidable with channels).
*/
@@ -329,7 +329,7 @@ bool ANIM_animdata_context_getdata(bAnimContext *ac)
{
SpaceLink *sl = ac->sl;
bool ok = false;
-
+
/* context depends on editor we are currently in */
if (sl) {
switch (ac->spacetype) {
@@ -353,12 +353,12 @@ bool ANIM_animdata_context_getdata(bAnimContext *ac)
}
}
}
-
+
/* check if there's any valid data */
return (ok && ac->data);
}
-/* Obtain current anim-data context from Blender Context info
+/* Obtain current anim-data context from Blender Context info
* - AnimContext to write to is provided as pointer to var on stack so that we don't have
* allocation/freeing costs (which are not that avoidable with channels).
* - Clears data and sets the information from Blender Context which is useful
@@ -369,11 +369,11 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
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 false;
memset(ac, 0, sizeof(bAnimContext));
-
+
/* get useful default context settings from context */
ac->scene = scene;
if (scene) {
@@ -385,10 +385,10 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
ac->sl = sl;
ac->spacetype = (sa) ? sa->spacetype : 0;
ac->regiontype = (ar) ? ar->regiontype : 0;
-
+
/* initialise default y-scale factor */
animedit_get_yscale_factor(ac);
-
+
/* get data context info */
// XXX: if the below fails, try to grab this info from context instead... (to allow for scripting)
return ANIM_animdata_context_getdata(ac);
@@ -446,7 +446,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
/* quick macro to test if AnimData is usable for NLA */
#define ANIMDATA_HAS_NLA(id) ((id)->adt && (id)->adt->nla_tracks.first)
-/* Quick macro to test for all three above usability tests, performing the appropriate provided
+/* Quick macro to test for all three above usability tests, performing the appropriate provided
* action for each when the AnimData context is appropriate.
*
* Priority order for this goes (most important, to least): AnimData blocks, NLA, Drivers, Keyframes.
@@ -510,7 +510,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
/* ............................... */
-/* Add a new animation channel, taking into account the "peek" flag, which is used to just check
+/* Add a new animation channel, taking into account the "peek" flag, which is used to just check
* whether any channels will be added (but without needing them to actually get created).
*
* ! This causes the calling function to return early if we're only "peeking" for channels
@@ -527,12 +527,12 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
ale_statement \
} \
} (void)0
-
+
#define ANIMCHANNEL_NEW_CHANNEL(channel_data, channel_type, owner_id) \
ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, {})
-
+
/* ............................... */
-
+
/* 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) )
@@ -542,8 +542,8 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
(!(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
+
+/* 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
*
* checks here work as follows:
@@ -558,29 +558,29 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
/* ----------- 'Private' Stuff --------------- */
-/* this function allocates memory for a new bAnimListElem struct for the
+/* 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)
{
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->data = data;
ale->type = datatype;
-
+
ale->id = owner_id;
ale->adt = BKE_animdata_from_id(owner_id);
-
+
/* do specifics */
switch (datatype) {
case ANIMTYPE_SUMMARY:
{
- /* nothing to include for now... this is just a dummy wrappy around all the other channels
+ /* 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;
@@ -590,12 +590,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
case ANIMTYPE_SCENE:
{
Scene *sce = (Scene *)data;
-
+
ale->flag = sce->flag;
-
+
ale->key_data = sce;
ale->datatype = ALE_SCE;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -603,21 +603,21 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Base *base = (Base *)data;
Object *ob = base->object;
-
+
ale->flag = ob->flag;
-
+
ale->key_data = ob;
ale->datatype = ALE_OB;
-
+
ale->adt = BKE_animdata_from_id(&ob->id);
break;
}
case ANIMTYPE_FILLACTD:
{
bAction *act = (bAction *)data;
-
+
ale->flag = act->flag;
-
+
ale->key_data = act;
ale->datatype = ALE_ACT;
break;
@@ -625,9 +625,9 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
case ANIMTYPE_FILLDRIVERS:
{
AnimData *adt = (AnimData *)data;
-
+
ale->flag = adt->flag;
-
+
// XXX... drivers don't show summary for now
ale->key_data = NULL;
ale->datatype = ALE_NONE;
@@ -637,12 +637,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Material *ma = (Material *)data;
AnimData *adt = ma->adt;
-
+
ale->flag = FILTER_MAT_OBJD(ma);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -650,12 +650,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Lamp *la = (Lamp *)data;
AnimData *adt = la->adt;
-
+
ale->flag = FILTER_LAM_OBJD(la);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -663,12 +663,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Camera *ca = (Camera *)data;
AnimData *adt = ca->adt;
-
+
ale->flag = FILTER_CAM_OBJD(ca);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -689,12 +689,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Curve *cu = (Curve *)data;
AnimData *adt = cu->adt;
-
+
ale->flag = FILTER_CUR_OBJD(cu);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -702,12 +702,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
bArmature *arm = (bArmature *)data;
AnimData *adt = arm->adt;
-
+
ale->flag = FILTER_ARM_OBJD(arm);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -715,12 +715,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Mesh *me = (Mesh *)data;
AnimData *adt = me->adt;
-
+
ale->flag = FILTER_MESH_OBJD(me);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -728,12 +728,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Lattice *lt = (Lattice *)data;
AnimData *adt = lt->adt;
-
+
ale->flag = FILTER_LATTICE_OBJD(lt);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -741,12 +741,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Speaker *spk = (Speaker *)data;
AnimData *adt = spk->adt;
-
+
ale->flag = FILTER_SPK_OBJD(spk);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -754,12 +754,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Key *key = (Key *)data;
AnimData *adt = key->adt;
-
+
ale->flag = FILTER_SKE_OBJD(key);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -767,12 +767,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
World *wo = (World *)data;
AnimData *adt = wo->adt;
-
+
ale->flag = FILTER_WOR_SCED(wo);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -780,12 +780,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
bNodeTree *ntree = (bNodeTree *)data;
AnimData *adt = ntree->adt;
-
+
ale->flag = FILTER_NTREE_DATA(ntree);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -793,12 +793,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
FreestyleLineStyle *linestyle = (FreestyleLineStyle *)data;
AnimData *adt = linestyle->adt;
-
- ale->flag = FILTER_LS_SCED(linestyle);
-
+
+ ale->flag = FILTER_LS_SCED(linestyle);
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -806,12 +806,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
ParticleSettings *part = (ParticleSettings *)ale->data;
AnimData *adt = part->adt;
-
+
ale->flag = FILTER_PART_OBJD(part);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -819,12 +819,12 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
Tex *tex = (Tex *)data;
AnimData *adt = tex->adt;
-
+
ale->flag = FILTER_TEX_DATA(tex);
-
+
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -832,14 +832,14 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
bGPdata *gpd = (bGPdata *)data;
AnimData *adt = gpd->adt;
-
+
/* NOTE: we just reuse the same expand filter for this case */
ale->flag = EXPANDED_GPD(gpd);
-
+
// XXX: currently, this is only used for access to its animation data
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
-
+
ale->adt = BKE_animdata_from_id(data);
break;
}
@@ -859,9 +859,9 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
case ANIMTYPE_NLACONTROLS:
{
AnimData *adt = (AnimData *)data;
-
+
ale->flag = adt->flag;
-
+
ale->key_data = NULL;
ale->datatype = ALE_NONE;
break;
@@ -869,9 +869,9 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
case ANIMTYPE_GROUP:
{
bActionGroup *agrp = (bActionGroup *)data;
-
+
ale->flag = agrp->flag;
-
+
ale->key_data = NULL;
ale->datatype = ALE_GROUP;
break;
@@ -880,9 +880,9 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
case ANIMTYPE_NLACURVE: /* practically the same as ANIMTYPE_FCURVE. Differences are applied post-creation */
{
FCurve *fcu = (FCurve *)data;
-
+
ale->flag = fcu->flag;
-
+
ale->key_data = fcu;
ale->datatype = ALE_FCURVE;
break;
@@ -891,19 +891,19 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
{
KeyBlock *kb = (KeyBlock *)data;
Key *key = (Key *)ale->id;
-
+
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);
-
+
/* the corresponding keyframes are from the animdata */
if (ale->adt && ale->adt->action) {
bAction *act = ale->adt->action;
char *rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
-
+
/* try to find the F-Curve which corresponds to this exactly,
* then free the MEM_alloc'd string
*/
@@ -919,9 +919,9 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
case ANIMTYPE_GPLAYER:
{
bGPDlayer *gpl = (bGPDlayer *)data;
-
+
ale->flag = gpl->flag;
-
+
ale->key_data = NULL;
ale->datatype = ALE_GPFRAME;
break;
@@ -929,9 +929,9 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
case ANIMTYPE_MASKLAYER:
{
MaskLayer *masklay = (MaskLayer *)data;
-
+
ale->flag = masklay->flag;
-
+
ale->key_data = NULL;
ale->datatype = ALE_MASKLAY;
break;
@@ -939,9 +939,9 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
case ANIMTYPE_NLATRACK:
{
NlaTrack *nlt = (NlaTrack *)data;
-
+
ale->flag = nlt->flag;
-
+
ale->key_data = &nlt->strips;
ale->datatype = ALE_NLASTRIP;
break;
@@ -955,11 +955,11 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
}
}
}
-
+
/* return created datatype */
return ale;
}
-
+
/* ----------------------------------------- */
/* 'Only Selected' selected data and/or 'Include Hidden' filtering
@@ -972,26 +972,26 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
}
/* hidden items should be skipped if we only care about visible data, but we aren't interested in hidden stuff */
const bool 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;
-
+
/* only consider if F-Curve involves pose.bones */
if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones")) {
bPoseChannel *pchan;
char *bone_name;
-
+
/* get bone-name, and check if this bone is selected */
bone_name = BLI_str_quoted_substrN(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;
-
+
/* skipping - not visible on currently visible layers */
if ((arm->layer & pchan->bone->layer) == 0)
return true;
@@ -999,7 +999,7 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
if (pchan->bone->flag & BONE_HIDDEN_P)
return true;
}
-
+
/* can only add this F-Curve if it is selected */
if (ads->filterflag & ADS_FILTER_ONLYSEL) {
if ((pchan->bone->flag & BONE_SELECTED) == 0)
@@ -1010,20 +1010,20 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
}
else if (GS(owner_id->name) == ID_SCE) {
Scene *scene = (Scene *)owner_id;
-
+
/* only consider if F-Curve involves sequence_editor.sequences */
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
Editing *ed = BKE_sequencer_editing_get(scene, false);
Sequence *seq = NULL;
char *seq_name;
-
+
if (ed) {
/* get strip name, and check if this strip is selected */
seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
seq = BKE_sequence_get_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)
@@ -1033,17 +1033,17 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
}
else if (GS(owner_id->name) == ID_NT) {
bNodeTree *ntree = (bNodeTree *)owner_id;
-
+
/* check for selected nodes */
if ((fcu->rna_path) && strstr(fcu->rna_path, "nodes")) {
bNode *node;
char *node_name;
-
+
/* get strip name, and check if this strip is selected */
node_name = BLI_str_quoted_substrN(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)
@@ -1051,7 +1051,7 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
}
}
}
-
+
return false;
}
@@ -1062,11 +1062,11 @@ static bool name_matches_dopesheet_filter(bDopeSheet *ads, char *name)
/* full fuzzy, multi-word, case insensitive matches */
const size_t str_len = strlen(ads->searchstr);
const int words_max = (str_len / 2) + 1;
-
+
int (*words)[2] = BLI_array_alloca(words, words_max);
const int words_len = BLI_string_find_split_words(ads->searchstr, str_len, ' ', words, words_max);
bool found = false;
-
+
/* match name against all search words */
for (int index = 0; index < words_len; index++) {
if (BLI_strncasestr(name, ads->searchstr + words[index][0], words[index][1])) {
@@ -1074,7 +1074,7 @@ static bool name_matches_dopesheet_filter(bDopeSheet *ads, char *name)
break;
}
}
-
+
/* if we have a match somewhere, this returns true */
return found;
}
@@ -1091,27 +1091,27 @@ static bool skip_fcurve_with_name(bDopeSheet *ads, FCurve *fcu, eAnim_ChannelTyp
{
bAnimListElem ale_dummy = {NULL};
const bAnimChannelType *acf;
-
+
/* create a dummy wrapper for the F-Curve, so we can get typeinfo for it */
ale_dummy.type = channel_type;
ale_dummy.owner = owner;
ale_dummy.id = owner_id;
ale_dummy.data = fcu;
-
+
/* get type info for channel */
acf = ANIM_channel_get_typeinfo(&ale_dummy);
if (acf && acf->name) {
char name[256]; /* hopefully this will be enough! */
-
+
/* get name */
acf->name(&ale_dummy, name);
-
- /* check for partial match with the match string, assuming case insensitive filtering
+
+ /* check for partial match with the match string, assuming case insensitive filtering
* if match, this channel shouldn't be ignored!
*/
return !name_matches_dopesheet_filter(ads, name);
}
-
+
/* just let this go... */
return true;
}
@@ -1127,19 +1127,19 @@ static bool fcurve_has_errors(FCurve *fcu)
if (fcu->flag & FCURVE_DISABLED) {
return true;
}
-
+
/* driver? */
if (fcu->driver) {
ChannelDriver *driver = fcu->driver;
DriverVar *dvar;
-
+
/* error flag on driver usually means that there is an error
* BUT this may not hold with PyDrivers as this flag gets cleared
* if no critical errors prevent the driver from working...
*/
if (driver->flag & DRIVER_FLAG_INVALID)
return true;
-
+
/* check variables for other things that need linting... */
// TODO: maybe it would be more efficient just to have a quick flag for this?
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
@@ -1151,7 +1151,7 @@ static bool fcurve_has_errors(FCurve *fcu)
DRIVER_TARGETS_LOOPER_END
}
}
-
+
/* no errors found */
return false;
}
@@ -1161,8 +1161,8 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, eAnim_Chan
{
bActionGroup *grp = (channel_type == ANIMTYPE_FCURVE) ? owner : NULL;
FCurve *fcu = NULL;
-
- /* loop over F-Curves - assume that the caller of this has already checked that these should be included
+
+ /* 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) {
@@ -1182,7 +1182,7 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, eAnim_Chan
}
}
}
-
+
/* only include if visible (Graph Editor check, not channels check) */
if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
/* only work with this channel and its subchannels if it is editable */
@@ -1196,14 +1196,14 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, eAnim_Chan
if (skip_fcurve_with_name(ads, fcu, channel_type, owner, owner_id))
continue;
}
-
+
/* error-based filtering... */
if ((ads) && (ads->filterflag & ADS_FILTER_ONLY_ERRORS)) {
/* skip if no errors... */
if (fcurve_has_errors(fcu) == false)
continue;
}
-
+
/* this F-Curve can be used, so return it */
return fcu;
}
@@ -1211,7 +1211,7 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, eAnim_Chan
}
}
}
-
+
/* no (more) F-Curves from the list are suitable... */
return NULL;
}
@@ -1223,14 +1223,14 @@ static size_t animfilter_fcurves(ListBase *anim_data, bDopeSheet *ads,
{
FCurve *fcu;
size_t items = 0;
-
- /* loop over every F-Curve able to be included
- * - this for-loop works like this:
+
+ /* loop over every F-Curve able to be included
+ * - this for-loop works like this:
* 1) the starting F-Curve is assigned to the fcu pointer so that we have a starting point to search from
- * 2) the first valid F-Curve to start from (which may include the one given as 'first') in the remaining
+ * 2) the first valid F-Curve to start from (which may include the one given as 'first') in the remaining
* list of F-Curves is found, and verified to be non-null
* 3) the F-Curve referenced by fcu pointer is added to the list
- * 4) the fcu pointer is set to the F-Curve after the one we just added, so that we can keep going through
+ * 4) the fcu pointer is set to the F-Curve after the one we just added, so that we can keep going through
* the rest of the F-Curve list without an eternal loop. Back to step 2 :)
*/
for (fcu = first; ( (fcu = animfilter_fcurve_next(ads, fcu, fcurve_type, filter_mode, owner, owner_id)) ); fcu = fcu->next) {
@@ -1246,7 +1246,7 @@ static size_t animfilter_fcurves(ListBase *anim_data, bDopeSheet *ads,
ANIMCHANNEL_NEW_CHANNEL(fcu, ANIMTYPE_FCURVE, owner_id);
}
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -1257,8 +1257,8 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
size_t tmp_items = 0;
size_t items = 0;
//int ofilter = filter_mode;
-
- /* if we care about the selection status of the channels,
+
+ /* 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.
* - Hierarchy matters: this hack should be applied
@@ -1270,7 +1270,7 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
/* if the group itself isn't selected appropriately, we shouldn't consider it's children either */
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0)
return 0;
-
+
/* if we're still here, then the selection status of the curves within this group should not matter,
* since this creates too much overhead for animators (i.e. making a slow workflow)
*
@@ -1281,14 +1281,14 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
*/
filter_mode &= ~(ANIMFILTER_SEL | ANIMFILTER_UNSEL | ANIMFILTER_LIST_VISIBLE);
}
-
+
/* add grouped F-Curves */
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_AGRP(ac, agrp))
{
/* special filter so that we can get just the F-Curves within the active group */
if (!(filter_mode & ANIMFILTER_ACTGROUPED) || (agrp->flag & AGRP_ACTIVE)) {
/* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter,
- * but to do this, we need to check that the group doesn't have it's not-visible flag set preventing
+ * but to do this, we need to check that the group doesn't have it's not-visible flag set preventing
* all its sub-curves to be shown
*/
if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE)) {
@@ -1296,7 +1296,7 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) {
/* get first F-Curve which can be used here */
FCurve *first_fcu = animfilter_fcurve_next(ads, agrp->channels.first, ANIMTYPE_FCURVE, filter_mode, agrp, owner_id);
-
+
/* filter list, starting from this F-Curve */
tmp_items += animfilter_fcurves(&tmp_data, ads, first_fcu, ANIMTYPE_FCURVE, filter_mode, agrp, owner_id);
}
@@ -1304,26 +1304,26 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
}
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* add this group as a channel first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* restore original filter mode so that this next step works ok... */
//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)) ) {
ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -1333,30 +1333,30 @@ static size_t animfilter_action(bAnimContext *ac, ListBase *anim_data, bDopeShee
bActionGroup *agrp;
FCurve *lastchan = NULL;
size_t items = 0;
-
+
/* don't include anything from this action if it is linked in from another file,
* and we're getting stuff for editing...
*/
if ((filter_mode & ANIMFILTER_FOREDIT) && ID_IS_LINKED(act))
return 0;
-
+
/* do groups */
// TODO: do nested groups?
for (agrp = act->groups.first; agrp; agrp = agrp->next) {
/* store reference to last channel of group */
- if (agrp->channels.last)
+ if (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);
}
-
+
/* 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);
items += animfilter_fcurves(anim_data, ads, firstfcu, ANIMTYPE_FCURVE, filter_mode, NULL, owner_id);
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -1374,10 +1374,10 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
NlaTrack *nlt;
NlaTrack *first = NULL, *next = NULL;
size_t items = 0;
-
+
/* if showing channels, include active action */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
- /* if NLA action-line filtering is off, don't show unless there are keyframes,
+ /* if NLA action-line filtering is off, don't show unless there are keyframes,
* in order to keep things more compact for doing transforms
*/
if (!(ads->filterflag & ADS_FILTER_NLA_NOACT) || (adt->action)) {
@@ -1387,13 +1387,13 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
* - as AnimData may not have an action, we pass a dummy pointer just to get the list elem created, then
* overwrite this with the real value - REVIEW THIS...
*/
- ANIMCHANNEL_NEW_CHANNEL_FULL((void *)(&adt->action), ANIMTYPE_NLAACTION, owner_id,
+ 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;
}
@@ -1401,22 +1401,22 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
/* first track to include will the first one (as per normal) */
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) {
/* 'next' NLA-Track to use depends on whether we're filtering for drawing or not */
- if (filter_mode & ANIMFILTER_LIST_CHANNELS)
+ if (filter_mode & ANIMFILTER_LIST_CHANNELS)
next = nlt->prev;
else
next = nlt->next;
-
- /* if we're in NLA-tweakmode, don't show this track if it was disabled (due to tweaking) for now
+
+ /* 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)
*/
// FIXME: the channels after should still get drawn, just 'differently', and after an active-action channel
if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED) && (adt->act_track != nlt))
continue;
-
+
/* only work with this channel and its subchannels if it is editable */
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_NLT(nlt)) {
/* only include this track if selected in a way consistent with the filtering requirements */
@@ -1426,10 +1426,10 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
/* name based filtering... */
if (((ads) && (ads->filterflag & ADS_FILTER_BY_FCU_NAME)) && (owner_id)) {
bool track_ok = false, strip_ok = false;
-
+
/* check if the name of the track, or the strips it has are ok... */
track_ok = name_matches_dopesheet_filter(ads, nlt->name);
-
+
if (track_ok == false) {
NlaStrip *strip;
for (strip = nlt->strips.first; strip; strip = strip->next) {
@@ -1439,20 +1439,20 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
}
}
}
-
+
/* skip if both fail this test... */
if (!track_ok && !strip_ok) {
continue;
}
}
-
+
/* add the track now that it has passed all our tests */
ANIMCHANNEL_NEW_CHANNEL(nlt, ANIMTYPE_NLATRACK, owner_id);
}
}
}
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -1465,14 +1465,14 @@ static size_t animfilter_nla_controls(ListBase *anim_data, bDopeSheet *ads, Anim
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
/* add control curves from each NLA strip... */
/* NOTE: ANIMTYPE_FCURVES are created here, to avoid duplicating the code needed */
BEGIN_ANIMFILTER_SUBCHANNELS(((adt->flag & ADT_NLA_SKEYS_COLLAPSED) == 0))
{
NlaTrack *nlt;
NlaStrip *strip;
-
+
/* for now, we only go one level deep - so controls on grouped FCurves are not handled */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
for (strip = nlt->strips.first; strip; strip = strip->next) {
@@ -1482,7 +1482,7 @@ static size_t animfilter_nla_controls(ListBase *anim_data, bDopeSheet *ads, Anim
}
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* add the expander as a channel first */
@@ -1492,13 +1492,13 @@ static size_t animfilter_nla_controls(ListBase *anim_data, bDopeSheet *ads, Anim
ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_NLACONTROLS, owner_id);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the numebr of items added to the list */
return items;
}
@@ -1508,11 +1508,11 @@ static size_t animfilter_block_data(bAnimContext *ac, ListBase *anim_data, bDope
{
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;
-
+
/* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed
* in a few places in the rest of the code still - notably for the few cases where special mode-based
* different types of data expanders are required.
@@ -1538,7 +1538,7 @@ static size_t animfilter_block_data(bAnimContext *ac, ListBase *anim_data, bDope
}
);
}
-
+
return items;
}
@@ -1548,22 +1548,22 @@ static size_t animfilter_block_data(bAnimContext *ac, ListBase *anim_data, bDope
static size_t animdata_filter_shapekey(bAnimContext *ac, ListBase *anim_data, Key *key, int filter_mode)
{
size_t items = 0;
-
+
/* check if channels or only F-Curves */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
KeyBlock *kb;
-
+
/* loop through the channels adding ShapeKeys as appropriate */
for (kb = key->block.first; kb; kb = kb->next) {
/* skip the first one, since that's the non-animatable basis */
if (kb == key->block.first) continue;
-
+
/* 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)) ) {
// TODO: consider 'active' too?
-
+
/* owner-id here must be key so that the F-Curve can be resolved... */
ANIMCHANNEL_NEW_CHANNEL(kb, ANIMTYPE_SHAPEKEY, key);
}
@@ -1584,7 +1584,7 @@ static size_t animdata_filter_shapekey(bAnimContext *ac, ListBase *anim_data, Ke
}
}
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -1594,7 +1594,7 @@ static size_t animdata_filter_gpencil_layers_data(ListBase *anim_data, bDopeShee
{
bGPDlayer *gpl;
size_t items = 0;
-
+
/* loop over layers as the conditions are acceptable */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* only if selected */
@@ -1608,15 +1608,15 @@ static size_t animdata_filter_gpencil_layers_data(ListBase *anim_data, bDopeShee
if (name_matches_dopesheet_filter(ads, gpl->info) == false)
continue;
}
-
-
+
+
/* add to list */
ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd);
}
}
}
}
-
+
return items;
}
@@ -1624,7 +1624,7 @@ static size_t animdata_filter_gpencil_layers_data(ListBase *anim_data, bDopeShee
static size_t animdata_filter_gpencil_data(ListBase *anim_data, bDopeSheet *ads, bGPdata *gpd, int filter_mode)
{
size_t items = 0;
-
+
/* When asked from "AnimData" blocks (i.e. the top-level containers for normal animation),
* for convenience, this will return GP Datablocks instead. This may cause issues down
* the track, but for now, this will do...
@@ -1636,14 +1636,14 @@ static size_t animdata_filter_gpencil_data(ListBase *anim_data, bDopeSheet *ads,
else {
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
-
+
/* add gpencil animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_GPD(gpd))
{
tmp_items += animdata_filter_gpencil_layers_data(&tmp_data, ads, gpd, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include data-expand widget first */
@@ -1651,14 +1651,14 @@ static size_t animdata_filter_gpencil_data(ListBase *anim_data, bDopeSheet *ads,
/* add gpd as channel too (if for drawing, and it has layers) */
ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, NULL);
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
}
-
+
return items;
}
@@ -1668,46 +1668,46 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi
{
bDopeSheet *ads = ac->ads;
size_t items = 0;
-
+
if (ads->filterflag & ADS_FILTER_GP_3DONLY) {
Scene *scene = (Scene *)ads->source;
Base *base;
-
+
/* Active scene's GPencil block first - No parent item needed... */
if (scene->gpd) {
items += animdata_filter_gpencil_data(anim_data, ads, scene->gpd, filter_mode);
}
-
+
/* Objects in the scene */
for (base = scene->base.first; base; base = base->next) {
/* Only consider this object if it has got some GP data (saving on all the other tests) */
if (base->object && base->object->gpd) {
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
* --> while tools may demand only visible, user setting takes priority
* as user option controls whether sets of channels get included while
* tool-flag takes into account collapsed/open channels too
- * - if only selected, must check if object is selected
- * - there must be animation data to edit (this is done recursively as we
+ * - if only selected, must check if object is selected
+ * - there must be animation data to edit (this is done recursively as we
* try to add the channels)
*/
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 ((scene->lay & (ob->lay | base->lay)) == 0) continue;
-
+
/* outliner restrict-flag */
if (ob->restrictflag & OB_RESTRICT_VIEW) continue;
}
-
+
/* check selection and object type filters */
if ( (ads->filterflag & ADS_FILTER_ONLYSEL) && !((base->flag & SELECT) /*|| (base == scene->basact)*/) ) {
/* only selected should be shown */
continue;
}
-
- /* check if object belongs to the filtering group if option to filter
+
+ /* check if object belongs to the filtering group if option to filter
* objects by the grouped status is on
* - used to ease the process of doing multiple-character choreographies
*/
@@ -1715,7 +1715,7 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi
if (BKE_group_object_exists(ads->filter_grp, ob) == 0)
continue;
}
-
+
/* finally, include this object's grease pencil datablock */
/* XXX: Should we store these under expanders per item? */
items += animdata_filter_gpencil_data(anim_data, ads, ob->gpd, filter_mode);
@@ -1724,18 +1724,18 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi
}
else {
bGPdata *gpd;
-
+
/* Grab all Grease Pencil datablocks directly from main, but only those that seem to be useful somewhere */
for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) {
/* only show if gpd is used by something... */
if (ID_REAL_USERS(gpd) < 1)
continue;
-
+
/* add GP frames from this datablock */
items += animdata_filter_gpencil_data(anim_data, ads, gpd, filter_mode);
}
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -1746,19 +1746,19 @@ static size_t animdata_filter_ds_gpencil(bAnimContext *ac, ListBase *anim_data,
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
/* add relevant animation channels for Grease Pencil */
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_GPD(gpd))
{
/* add animation channels */
tmp_items += animfilter_block_data(ac, &tmp_data, ads, &gpd->id, filter_mode);
-
+
/* add Grease Pencil layers */
// TODO: do these need a separate expander?
// XXX: what order should these go in?
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include data-expand widget first */
@@ -1769,13 +1769,13 @@ static size_t animdata_filter_ds_gpencil(bAnimContext *ac, ListBase *anim_data,
ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_DSGPENCIL, gpd);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -1846,24 +1846,24 @@ static size_t animdata_filter_mask(ListBase *anim_data, void *UNUSED(data), int
{
Mask *mask;
size_t items = 0;
-
+
/* for now, grab mask datablocks directly from main */
// XXX: this is not good...
for (mask = G.main->mask.first; mask; mask = mask->id.next) {
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
-
+
/* only show if mask is used by something... */
if (ID_REAL_USERS(mask) < 1)
continue;
-
+
/* add mask animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_MASK(mask))
{
tmp_items += animdata_filter_mask_data(&tmp_data, mask, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include data-expand widget first */
@@ -1871,14 +1871,14 @@ static size_t animdata_filter_mask(ListBase *anim_data, void *UNUSED(data), int
/* add gpd as channel too (if for drawing, and it has layers) */
ANIMCHANNEL_NEW_CHANNEL(mask, ANIMTYPE_MASKDATABLOCK, NULL);
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -1889,7 +1889,7 @@ static size_t animdata_filter_ds_nodetree_group(bAnimContext *ac, ListBase *anim
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
/* add nodetree animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_NTREE_DATA(ntree))
{
@@ -1897,7 +1897,7 @@ static size_t animdata_filter_ds_nodetree_group(bAnimContext *ac, ListBase *anim
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)ntree, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include data-expand widget first */
@@ -1907,13 +1907,13 @@ static size_t animdata_filter_ds_nodetree_group(bAnimContext *ac, ListBase *anim
ANIMCHANNEL_NEW_CHANNEL(ntree, ANIMTYPE_DSNTREE, owner_id);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -1922,9 +1922,9 @@ static size_t animdata_filter_ds_nodetree(bAnimContext *ac, ListBase *anim_data,
{
bNode *node;
size_t items = 0;
-
+
items += animdata_filter_ds_nodetree_group(ac, anim_data, ads, owner_id, ntree, filter_mode);
-
+
for (node = ntree->nodes.first; node; node = node->next) {
if (node->type == NODE_GROUP) {
if (node->id) {
@@ -1945,7 +1945,7 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
SceneRenderLayer *srl;
FreestyleLineSet *lineset;
size_t items = 0;
-
+
for (srl = sce->r.layers.first; srl; srl = srl->next) {
for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
if (lineset->linestyle) {
@@ -1953,12 +1953,12 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
}
}
}
-
+
for (srl = sce->r.layers.first; srl; srl = srl->next) {
/* skip render layers without Freestyle enabled */
if (!(srl->layflag & SCE_LAY_FRS))
continue;
-
+
/* loop over linesets defined in the render layer */
for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
FreestyleLineStyle *linestyle = lineset->linestyle;
@@ -1971,7 +1971,7 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
continue;
}
linestyle->id.tag &= ~LIB_TAG_DOIT;
-
+
/* add scene-level animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_LS_SCED(linestyle))
{
@@ -1979,7 +1979,7 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)linestyle, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include anim-expand widget first */
@@ -1989,7 +1989,7 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
ANIMCHANNEL_NEW_CHANNEL(linestyle, ANIMTYPE_DSLINESTYLE, sce);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
@@ -1997,24 +1997,24 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
}
}
}
-
+
/* return the number of items added to the list */
return items;
}
-static size_t animdata_filter_ds_texture(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads,
+static size_t animdata_filter_ds_texture(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads,
Tex *tex, ID *owner_id, int filter_mode)
{
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
/* add texture's animation data to temp collection */
- BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_TEX_DATA(tex))
+ BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_TEX_DATA(tex))
{
/* texture animdata */
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)tex, filter_mode);
-
+
/* nodes */
if ((tex->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE)) {
/* owner_id as id instead of texture, since it'll otherwise be impossible to track the depth */
@@ -2024,7 +2024,7 @@ static size_t animdata_filter_ds_texture(bAnimContext *ac, ListBase *anim_data,
}
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include texture-expand widget? */
@@ -2034,13 +2034,13 @@ static size_t animdata_filter_ds_texture(bAnimContext *ac, ListBase *anim_data,
ANIMCHANNEL_NEW_CHANNEL(tex, ANIMTYPE_DSTEX, owner_id);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2051,11 +2051,11 @@ static size_t animdata_filter_ds_textures(bAnimContext *ac, ListBase *anim_data,
MTex **mtex = NULL;
size_t items = 0;
int a = 0;
-
+
/* get datatype specific data first */
if (owner_id == NULL)
return 0;
-
+
switch (GS(owner_id->name)) {
case ID_MA:
{
@@ -2081,7 +2081,7 @@ static size_t animdata_filter_ds_textures(bAnimContext *ac, ListBase *anim_data,
mtex = (MTex **)(&part->mtex);
break;
}
- default:
+ default:
{
/* invalid/unsupported option */
if (G.debug & G_DEBUG)
@@ -2089,19 +2089,19 @@ static size_t animdata_filter_ds_textures(bAnimContext *ac, ListBase *anim_data,
return 0;
}
}
-
+
/* 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 now, if no texture returned, skip (this shouldn't confuse the user I hope) */
- if (tex == NULL)
+ if (tex == NULL)
continue;
-
+
/* add texture's anim channels */
items += animdata_filter_ds_texture(ac, anim_data, ads, tex, owner_id, filter_mode);
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2112,23 +2112,23 @@ static size_t animdata_filter_ds_material(bAnimContext *ac, ListBase *anim_data,
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
/* add material's animation data to temp collection */
BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_MAT_OBJD(ma))
{
/* material's animation data */
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)ma, filter_mode);
-
+
/* textures */
if (!(ads->filterflag & ADS_FILTER_NOTEX))
tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, (ID *)ma, filter_mode);
-
+
/* nodes */
- if ((ma->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE))
+ if ((ma->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE))
tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)ma, ma->nodetree, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include material-expand widget first */
@@ -2138,13 +2138,13 @@ static size_t animdata_filter_ds_material(bAnimContext *ac, ListBase *anim_data,
ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
return items;
}
@@ -2153,23 +2153,23 @@ static size_t animdata_filter_ds_materials(bAnimContext *ac, ListBase *anim_data
bool has_nested = false;
size_t items = 0;
int a = 0;
-
+
/* first pass: take the materials referenced via the Material slots of the object */
for (a = 1; a <= ob->totcol; a++) {
Material *ma = give_current_material(ob, a);
-
+
/* if material is valid, try to add relevant contents from here */
if (ma) {
/* add channels */
items += animdata_filter_ds_material(ac, anim_data, ads, ma, filter_mode);
-
+
/* for optimising second pass - check if there's a nested material here to come back for */
if (has_nested == false) {
has_nested = (give_node_material(ma) != NULL);
}
}
}
-
+
/* second pass: go through a second time looking for "nested" materials (material.material references)
*
* NOTE: here we ignore the expanded status of the parent, as it could be too confusing as to why these are
@@ -2179,7 +2179,7 @@ static size_t animdata_filter_ds_materials(bAnimContext *ac, ListBase *anim_data
for (a = 1; a <= ob->totcol; a++) {
Material *base = give_current_material(ob, a);
Material *ma = give_node_material(base);
-
+
/* add channels from the nested material if it exists
* - skip if the same material is referenced in its node tree
* (which is common for BI materials) as that results in
@@ -2190,7 +2190,7 @@ static size_t animdata_filter_ds_materials(bAnimContext *ac, ListBase *anim_data
}
}
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2202,10 +2202,10 @@ static size_t animdata_filter_ds_materials(bAnimContext *ac, ListBase *anim_data
typedef struct tAnimFilterModifiersContext {
bAnimContext *ac; /* anim editor context */
bDopeSheet *ads; /* dopesheet filtering settings */
-
+
ListBase tmp_data; /* list of channels created (but not yet added to the main list) */
size_t items; /* number of channels created */
-
+
int filter_mode; /* flags for stuff we want to filter */
} tAnimFilterModifiersContext;
@@ -2216,31 +2216,31 @@ static void animfilter_modifier_idpoin_cb(void *afm_ptr, Object *ob, ID **idpoin
tAnimFilterModifiersContext *afm = (tAnimFilterModifiersContext *)afm_ptr;
ID *owner_id = &ob->id;
ID *id = *idpoin;
-
- /* NOTE: the walker only guarantees to give us all the ID-ptr *slots*,
+
+ /* NOTE: the walker only guarantees to give us all the ID-ptr *slots*,
* not just the ones which are actually used, so be careful!
*/
if (id == NULL)
return;
-
+
/* check if this is something we're interested in... */
switch (GS(id->name)) {
case ID_TE: /* Textures */
{
Tex *tex = (Tex *)id;
- if (!(afm->ads->filterflag & ADS_FILTER_NOTEX)) {
+ if (!(afm->ads->filterflag & ADS_FILTER_NOTEX)) {
afm->items += animdata_filter_ds_texture(afm->ac, &afm->tmp_data, afm->ads, tex, owner_id, afm->filter_mode);
}
break;
}
-
+
/* TODO: images? */
default:
break;
}
}
-/* animation linked to data used by modifiers
+/* animation linked to data used by modifiers
* NOTE: strictly speaking, modifier animation is already included under Object level
* but for some modifiers (e.g. Displace), there can be linked data that has settings
* which would be nice to animate (i.e. texture parameters) but which are not actually
@@ -2251,8 +2251,8 @@ static size_t animdata_filter_ds_modifiers(bAnimContext *ac, ListBase *anim_data
{
tAnimFilterModifiersContext afm = {NULL};
size_t items = 0;
-
- /* 1) create a temporary "context" containing all the info we have here to pass to the callback
+
+ /* 1) create a temporary "context" containing all the info we have here to pass to the callback
* use to walk through the dependencies of the modifiers
*
* ! Assumes that all other unspecified values (i.e. accumulation buffers) are zero'd out properly
@@ -2260,10 +2260,10 @@ static size_t animdata_filter_ds_modifiers(bAnimContext *ac, ListBase *anim_data
afm.ac = ac;
afm.ads = ads;
afm.filter_mode = filter_mode;
-
+
/* 2) walk over dependencies */
modifiers_foreachIDLink(ob, animfilter_modifier_idpoin_cb, &afm);
-
+
/* 3) extract data from the context, merging it back into the standard list */
if (afm.items) {
/* now add the list of collected channels */
@@ -2271,7 +2271,7 @@ static size_t animdata_filter_ds_modifiers(bAnimContext *ac, ListBase *anim_data
BLI_assert(BLI_listbase_is_empty(&afm.tmp_data));
items += afm.items;
}
-
+
return items;
}
@@ -2286,23 +2286,23 @@ static size_t animdata_filter_ds_particles(bAnimContext *ac, ListBase *anim_data
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
-
+
/* if no material returned, skip - so that we don't get weird blank entries... */
if (ELEM(NULL, psys->part, psys->part->adt))
continue;
-
+
/* add particle-system's animation data to temp collection */
BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_PART_OBJD(psys->part))
{
/* particle system's animation data */
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)psys->part, filter_mode);
-
+
/* textures */
if (!(ads->filterflag & ADS_FILTER_NOTEX))
tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, (ID *)psys->part, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include particle-expand widget first */
@@ -2312,14 +2312,14 @@ static size_t animdata_filter_ds_particles(bAnimContext *ac, ListBase *anim_data
ANIMCHANNEL_NEW_CHANNEL(psys->part, ANIMTYPE_DSPART, psys->part);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2330,19 +2330,19 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 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;
-
+
if (ads->filterflag & ADS_FILTER_NOCAM)
return 0;
-
+
type = ANIMTYPE_DSCAM;
expanded = FILTER_CAM_OBJD(ca);
break;
@@ -2350,10 +2350,10 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
case OB_LAMP: /* ---------- Lamp ----------- */
{
Lamp *la = (Lamp *)ob->data;
-
+
if (ads->filterflag & ADS_FILTER_NOLAM)
return 0;
-
+
type = ANIMTYPE_DSLAM;
expanded = FILTER_LAM_OBJD(la);
break;
@@ -2363,10 +2363,10 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
case OB_FONT: /* ------- Text Curve ---------- */
{
Curve *cu = (Curve *)ob->data;
-
+
if (ads->filterflag & ADS_FILTER_NOCUR)
return 0;
-
+
type = ANIMTYPE_DSCUR;
expanded = FILTER_CUR_OBJD(cu);
break;
@@ -2374,10 +2374,10 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
case OB_MBALL: /* ------- MetaBall ---------- */
{
MetaBall *mb = (MetaBall *)ob->data;
-
+
if (ads->filterflag & ADS_FILTER_NOMBA)
return 0;
-
+
type = ANIMTYPE_DSMBALL;
expanded = FILTER_MBALL_OBJD(mb);
break;
@@ -2385,10 +2385,10 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
case OB_ARMATURE: /* ------- Armature ---------- */
{
bArmature *arm = (bArmature *)ob->data;
-
+
if (ads->filterflag & ADS_FILTER_NOARM)
return 0;
-
+
type = ANIMTYPE_DSARM;
expanded = FILTER_ARM_OBJD(arm);
break;
@@ -2396,10 +2396,10 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
case OB_MESH: /* ------- Mesh ---------- */
{
Mesh *me = (Mesh *)ob->data;
-
+
if (ads->filterflag & ADS_FILTER_NOMESH)
return 0;
-
+
type = ANIMTYPE_DSMESH;
expanded = FILTER_MESH_OBJD(me);
break;
@@ -2407,10 +2407,10 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
case OB_LATTICE: /* ---- Lattice ---- */
{
Lattice *lt = (Lattice *)ob->data;
-
+
if (ads->filterflag & ADS_FILTER_NOLAT)
return 0;
-
+
type = ANIMTYPE_DSLAT;
expanded = FILTER_LATTICE_OBJD(lt);
break;
@@ -2418,30 +2418,30 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
case OB_SPEAKER: /* ---------- Speaker ----------- */
{
Speaker *spk = (Speaker *)ob->data;
-
+
type = ANIMTYPE_DSSPK;
expanded = FILTER_SPK_OBJD(spk);
break;
}
}
-
+
/* add object data animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(expanded)
{
/* animation data filtering */
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)iat, filter_mode);
-
+
/* sub-data filtering... */
switch (ob->type) {
case OB_LAMP: /* lamp - textures + nodetree */
{
Lamp *la = ob->data;
bNodeTree *ntree = la->nodetree;
-
+
/* nodetree */
if ((ntree) && !(ads->filterflag & ADS_FILTER_NONTREE))
tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, &la->id, ntree, filter_mode);
-
+
/* textures */
if (!(ads->filterflag & ADS_FILTER_NOTEX))
tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, &la->id, filter_mode);
@@ -2450,7 +2450,7 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
}
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include data-expand widget first */
@@ -2460,13 +2460,13 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
ANIMCHANNEL_NEW_CHANNEL(iat, type, iat);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2477,7 +2477,7 @@ static size_t animdata_filter_ds_keyanim(bAnimContext *ac, ListBase *anim_data,
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
/* add shapekey-level animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_SKE_OBJD(key))
{
@@ -2485,7 +2485,7 @@ static size_t animdata_filter_ds_keyanim(bAnimContext *ac, ListBase *anim_data,
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)key, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include key-expand widget first */
@@ -2494,13 +2494,13 @@ static size_t animdata_filter_ds_keyanim(bAnimContext *ac, ListBase *anim_data,
ANIMCHANNEL_NEW_CHANNEL(key, ANIMTYPE_DSSKEY, ob);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2512,7 +2512,7 @@ static size_t animdata_filter_ds_obanim(bAnimContext *ac, ListBase *anim_data, b
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
AnimData *adt = ob->adt;
short type = 0, expanded = 1;
void *cdata = NULL;
@@ -2533,7 +2533,7 @@ static size_t animdata_filter_ds_obanim(bAnimContext *ac, ListBase *anim_data, b
cdata = adt->action;
expanded = EXPANDED_ACTC(adt->action);
});
-
+
/* add object-level animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(expanded)
{
@@ -2541,7 +2541,7 @@ static size_t animdata_filter_ds_obanim(bAnimContext *ac, ListBase *anim_data, b
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)ob, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include anim-expand widget first */
@@ -2551,13 +2551,13 @@ static size_t animdata_filter_ds_obanim(bAnimContext *ac, ListBase *anim_data, b
ANIMCHANNEL_NEW_CHANNEL(cdata, type, ob);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2569,50 +2569,50 @@ static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data
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 = BKE_key_from_object(ob);
-
+
/* object-level animation */
if ((ob->adt) && !(ads->filterflag & ADS_FILTER_NOOBJ)) {
tmp_items += animdata_filter_ds_obanim(ac, &tmp_data, ads, ob, filter_mode);
}
-
+
/* shape-key */
if ((key && key->adt) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)) {
tmp_items += animdata_filter_ds_keyanim(ac, &tmp_data, ads, ob, key, filter_mode);
}
-
+
/* modifiers */
if ((ob->modifiers.first) && !(ads->filterflag & ADS_FILTER_NOMODIFIERS)) {
tmp_items += animdata_filter_ds_modifiers(ac, &tmp_data, ads, ob, filter_mode);
}
-
+
/* materials */
if ((ob->totcol) && !(ads->filterflag & ADS_FILTER_NOMAT)) {
tmp_items += animdata_filter_ds_materials(ac, &tmp_data, ads, ob, filter_mode);
}
-
+
/* object data */
if (ob->data) {
tmp_items += animdata_filter_ds_obdata(ac, &tmp_data, ads, ob, filter_mode);
}
-
+
/* particles */
if ((ob->particlesystem.first) && !(ads->filterflag & ADS_FILTER_NOPART)) {
tmp_items += animdata_filter_ds_particles(ac, &tmp_data, ads, ob, filter_mode);
}
-
+
/* grease pencil */
if ((ob->gpd) && !(ads->filterflag & ADS_FILTER_NOGPENCIL)) {
tmp_items += animdata_filter_ds_gpencil(ac, &tmp_data, ads, ob->gpd, filter_mode);
}
}
END_ANIMFILTER_SUBCHANNELS;
-
-
+
+
/* if we collected some channels, add these to the new list... */
if (tmp_items) {
/* firstly add object expander if required */
@@ -2626,13 +2626,13 @@ static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data
}
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added */
return items;
}
@@ -2642,23 +2642,23 @@ static size_t animdata_filter_ds_world(bAnimContext *ac, ListBase *anim_data, bD
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
/* add world animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_WOR_SCED(wo))
{
/* animation data filtering */
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)wo, filter_mode);
-
+
/* textures for world */
if (!(ads->filterflag & ADS_FILTER_NOTEX))
tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, (ID *)wo, filter_mode);
-
+
/* nodes */
- if ((wo->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE))
+ if ((wo->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE))
tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)wo, wo->nodetree, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include data-expand widget first */
@@ -2668,13 +2668,13 @@ static size_t animdata_filter_ds_world(bAnimContext *ac, ListBase *anim_data, bD
ANIMCHANNEL_NEW_CHANNEL(wo, ANIMTYPE_DSWOR, sce);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2684,11 +2684,11 @@ static size_t animdata_filter_ds_scene(bAnimContext *ac, ListBase *anim_data, bD
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
AnimData *adt = sce->adt;
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,
@@ -2705,7 +2705,7 @@ static size_t animdata_filter_ds_scene(bAnimContext *ac, ListBase *anim_data, bD
cdata = adt->action;
expanded = EXPANDED_ACTC(adt->action);
});
-
+
/* add scene-level animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(expanded)
{
@@ -2713,7 +2713,7 @@ static size_t animdata_filter_ds_scene(bAnimContext *ac, ListBase *anim_data, bD
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)sce, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include anim-expand widget first */
@@ -2723,13 +2723,13 @@ static size_t animdata_filter_ds_scene(bAnimContext *ac, ListBase *anim_data, bD
ANIMCHANNEL_NEW_CHANNEL(cdata, type, sce);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2739,39 +2739,39 @@ static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_d
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
-
+
/* filter data contained under object first */
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_SCEC(sce))
{
bNodeTree *ntree = sce->nodetree;
bGPdata *gpd = sce->gpd;
World *wo = sce->world;
-
+
/* Action, Drivers, or NLA for Scene */
if ((ads->filterflag & ADS_FILTER_NOSCE) == 0) {
tmp_items += animdata_filter_ds_scene(ac, &tmp_data, ads, sce, filter_mode);
}
-
+
/* world */
if ((wo) && !(ads->filterflag & ADS_FILTER_NOWOR)) {
tmp_items += animdata_filter_ds_world(ac, &tmp_data, ads, sce, wo, filter_mode);
}
-
+
/* nodetree */
if ((ntree) && !(ads->filterflag & ADS_FILTER_NONTREE)) {
tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)sce, ntree, filter_mode);
}
-
+
/* line styles */
if ((ads->filterflag & ADS_FILTER_NOLINESTYLE) == 0) {
tmp_items += animdata_filter_ds_linestyle(ac, &tmp_data, ads, sce, filter_mode);
}
-
+
/* grease pencil */
if ((gpd) && !(ads->filterflag & ADS_FILTER_NOGPENCIL)) {
tmp_items += animdata_filter_ds_gpencil(ac, &tmp_data, ads, gpd, filter_mode);
}
-
+
/* TODO: one day, when sequencer becomes its own datatype, perhaps it should be included here */
}
END_ANIMFILTER_SUBCHANNELS;
@@ -2786,13 +2786,13 @@ static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_d
ANIMCHANNEL_NEW_CHANNEL(sce, ANIMTYPE_SCENE, sce);
}
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
-
+
/* return the number of items added */
return items;
}
@@ -2846,31 +2846,31 @@ static size_t animdata_filter_dopesheet_movieclips(bAnimContext *ac, ListBase *a
static bool animdata_filter_base_is_ok(bDopeSheet *ads, Scene *scene, Base *base, int filter_mode)
{
Object *ob = base->object;
-
+
if (base->object == NULL)
return false;
-
+
/* firstly, check if object can be included, by the following factors:
* - if only visible, must check for layer and also viewport visibility
* --> while tools may demand only visible, user setting takes priority
* as user option controls whether sets of channels get included while
* tool-flag takes into account collapsed/open channels too
- * - if only selected, must check if object is selected
- * - there must be animation data to edit (this is done recursively as we
+ * - if only selected, must check if object is selected
+ * - there must be animation data to edit (this is done recursively as we
* try to add the channels)
*/
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 ((scene->lay & (ob->lay | base->lay)) == 0)
return false;
-
+
/* outliner restrict-flag */
if (ob->restrictflag & OB_RESTRICT_VIEW)
return false;
}
-
- /* if only F-Curves with visible flags set can be shown, check that
- * datablock hasn't been set to invisible
+
+ /* if only F-Curves with visible flags set can be shown, check that
+ * datablock hasn't been set to invisible
*/
if (filter_mode & ANIMFILTER_CURVE_VISIBLE) {
if ((ob->adt) && (ob->adt->flag & ADT_CURVES_NOT_VISIBLE))
@@ -2900,8 +2900,8 @@ static bool animdata_filter_base_is_ok(bDopeSheet *ads, Scene *scene, Base *base
/* only selected should be shown */
return false;
}
-
- /* check if object belongs to the filtering group if option to filter
+
+ /* check if object belongs to the filtering group if option to filter
* objects by the grouped status is on
* - used to ease the process of doing multiple-character choreographies
*/
@@ -2909,7 +2909,7 @@ static bool animdata_filter_base_is_ok(bDopeSheet *ads, Scene *scene, Base *base
if (BKE_group_object_exists(ads->filter_grp, ob) == 0)
return false;
}
-
+
/* no reason to exclude this object... */
return true;
}
@@ -2919,7 +2919,7 @@ static int ds_base_sorting_cmp(const void *base1_ptr, const void *base2_ptr)
{
const Base *b1 = *((const Base **)base1_ptr);
const Base *b2 = *((const Base **)base2_ptr);
-
+
return strcmp(b1->object->id.name + 2, b2->object->id.name + 2);
}
@@ -2929,17 +2929,17 @@ static Base **animdata_filter_ds_sorted_bases(bDopeSheet *ads, Scene *scene, int
/* Create an array with space for all the bases, but only containing the usable ones */
size_t tot_bases = BLI_listbase_count(&scene->base);
size_t num_bases = 0;
-
+
Base **sorted_bases = MEM_mallocN(sizeof(Base *) * tot_bases, "Dopesheet Usable Sorted Bases");
for (Base *base = scene->base.first; base; base = base->next) {
if (animdata_filter_base_is_ok(ads, scene, base, filter_mode)) {
sorted_bases[num_bases++] = base;
}
}
-
+
/* Sort this list of pointers (based on the names) */
qsort(sorted_bases, num_bases, sizeof(Base *), ds_base_sorting_cmp);
-
+
/* Return list of sorted bases */
*r_usable_bases = num_bases;
return sorted_bases;
@@ -2951,7 +2951,7 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, b
{
Scene *scene = (Scene *)ads->source;
size_t items = 0;
-
+
/* check that we do indeed have a scene */
if ((ads->source == NULL) || (GS(ads->source->name) != ID_SCE)) {
printf("Dope Sheet Error: No scene!\n");
@@ -2959,15 +2959,15 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, b
printf("\tPointer = %p, Name = '%s'\n", (void *)ads->source, (ads->source) ? ads->source->name : NULL);
return 0;
}
-
- /* augment the filter-flags with settings based on the dopesheet filterflags
+
+ /* augment the filter-flags with settings based on the dopesheet filterflags
* so that some temp settings can get added automagically...
*/
if (ads->filterflag & ADS_FILTER_SELEDIT) {
/* only selected F-Curves should get their keyframes considered for editability */
filter_mode |= ANIMFILTER_SELEDIT;
}
-
+
/* Cache files level animations (frame duration and such). */
CacheFile *cache_file = G.main->cachefiles.first;
for (; cache_file; cache_file = cache_file->id.next) {
@@ -2994,16 +2994,16 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, b
// TODO: Cache the old sorted order - if the set of bases hasn't changed, don't re-sort...
Base **sorted_bases;
size_t num_bases;
-
+
sorted_bases = animdata_filter_ds_sorted_bases(ads, scene, filter_mode, &num_bases);
if (sorted_bases) {
/* Add the necessary channels for these bases... */
for (size_t i = 0; i < num_bases; i++) {
items += animdata_filter_dopesheet_ob(ac, anim_data, ads, sorted_bases[i], filter_mode);
}
-
+
// TODO: store something to validate whether any changes are needed?
-
+
/* free temporary data */
MEM_freeN(sorted_bases);
}
@@ -3019,20 +3019,20 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, b
}
}
}
-
+
/* return the number of items in the list */
return items;
}
-/* Summary track for DopeSheet/Action Editor
+/* Summary track for DopeSheet/Action Editor
* - 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)
{
bDopeSheet *ads = NULL;
-
- /* get the DopeSheet information to use
- * - we should only need to deal with the DopeSheet/Action Editor,
+
+ /* get the DopeSheet information to use
+ * - we should only need to deal with the DopeSheet/Action Editor,
* since all the other Animation Editors won't have this concept
* being applicable.
*/
@@ -3044,9 +3044,9 @@ static short animdata_filter_dopesheet_summary(bAnimContext *ac, ListBase *anim_
/* invalid space type - skip this summary channels */
return 1;
}
-
- /* dopesheet summary
- * - only for drawing and/or selecting keyframes in channels, but not for real editing
+
+ /* dopesheet summary
+ * - only for drawing and/or selecting keyframes in channels, but not for real editing
* - only useful for DopeSheet/Action/etc. editors where it is actually useful
*/
if ((filter_mode & ANIMFILTER_LIST_CHANNELS) && (ads->filterflag & ADS_FILTER_SUMMARY)) {
@@ -3055,17 +3055,17 @@ static short animdata_filter_dopesheet_summary(bAnimContext *ac, ListBase *anim_
BLI_addtail(anim_data, ale);
(*items)++;
}
-
- /* if summary is collapsed, don't show other channels beneath this
+
+ /* if summary is collapsed, don't show other channels beneath this
* - this check is put inside the summary check so that it doesn't interfere with normal operation
- */
+ */
if (ads->flag & ADS_FLAG_SUMMARY_COLLAPSED)
return 0;
}
-
+
/* the other channels beneath this can be shown */
return 1;
-}
+}
/* ......................... */
@@ -3073,18 +3073,18 @@ static short animdata_filter_dopesheet_summary(bAnimContext *ac, ListBase *anim_
static size_t animdata_filter_animchan(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAnimListElem *channel, int filter_mode)
{
size_t items = 0;
-
+
/* data to filter depends on channel type */
/* NOTE: only common channel-types have been handled for now. More can be added as necessary */
switch (channel->type) {
case ANIMTYPE_SUMMARY:
items += animdata_filter_dopesheet(ac, anim_data, ads, filter_mode);
break;
-
+
case ANIMTYPE_SCENE:
items += animdata_filter_dopesheet_scene(ac, anim_data, ads, channel->data, filter_mode);
break;
-
+
case ANIMTYPE_OBJECT:
items += animdata_filter_dopesheet_ob(ac, anim_data, ads, channel->data, filter_mode);
break;
@@ -3096,12 +3096,12 @@ static size_t animdata_filter_animchan(bAnimContext *ac, ListBase *anim_data, bD
case ANIMTYPE_ANIMDATA:
items += animfilter_block_data(ac, anim_data, ads, channel->id, filter_mode);
break;
-
+
default:
printf("ERROR: Unsupported channel type (%d) in animdata_filter_animchan()\n", channel->type);
break;
}
-
+
return items;
}
@@ -3112,17 +3112,17 @@ 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;
-
+
if (ale->type == ANIMTYPE_NONE)
BLI_freelinkN(anim_data, ale);
else
items++;
}
-
+
return items;
}
@@ -3132,18 +3132,18 @@ static size_t animdata_filter_remove_duplis(ListBase *anim_data)
bAnimListElem *ale, *next;
GSet *gs;
size_t items = 0;
-
- /* build new hashtable to efficiently store and retrieve which entries have been
+
+ /* build new hashtable to efficiently store and retrieve which entries have been
* encountered already while searching
*/
gs = BLI_gset_ptr_new(__func__);
-
+
/* loop through items, removing them from the list if a similar item occurs already */
for (ale = anim_data->first; ale; ale = next) {
next = ale->next;
-
- /* check if hash has any record of an entry like this
- * - just use ale->data for now, though it would be nicer to involve
+
+ /* check if hash has any record of an entry like this
+ * - just use ale->data for now, though it would be nicer to involve
* ale->type in combination too to capture corner cases (where same data performs differently)
*/
if (BLI_gset_add(gs, ale->data)) {
@@ -3155,10 +3155,10 @@ static size_t animdata_filter_remove_duplis(ListBase *anim_data)
BLI_freelinkN(anim_data, ale);
}
}
-
+
/* free the hash... */
BLI_gset_free(gs, NULL);
-
+
/* return the number of items still in the list */
return items;
}
@@ -3175,7 +3175,7 @@ static size_t animdata_filter_remove_duplis(ListBase *anim_data)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_Flags filter_mode, void *data, eAnimCont_Types datatype)
{
size_t items = 0;
-
+
/* only filter data if there's somewhere to put it */
if (data && anim_data) {
/* firstly filter the data */
@@ -3186,7 +3186,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
Object *obact = ac->obact;
SpaceAction *saction = (SpaceAction *)ac->sl;
bDopeSheet *ads = (saction) ? &saction->ads : NULL;
-
+
/* specially check for AnimData filter... [#36687] */
if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* all channels here are within the same AnimData block, hence this special case */
@@ -3199,13 +3199,13 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
items += animfilter_action(ac, anim_data, ads, data, filter_mode, (ID *)obact);
}
-
+
break;
}
case ANIMCONT_SHAPEKEY: /* 'ShapeKey Editor' */
{
Key *key = (Key *)data;
-
+
/* specially check for AnimData filter... [#36687] */
if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* all channels here are within the same AnimData block, hence this special case */
@@ -3218,11 +3218,11 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
items = animdata_filter_shapekey(ac, anim_data, key, filter_mode);
}
-
+
break;
}
-
-
+
+
/* Modes for Specialty Data Types (i.e. not keyframes) */
case ANIMCONT_GPENCIL:
{
@@ -3236,8 +3236,8 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
items = animdata_filter_mask(anim_data, data, filter_mode);
break;
}
-
-
+
+
/* DopeSheet Based Modes */
case ANIMCONT_DOPESHEET: /* 'DopeSheet Editor' */
{
@@ -3254,18 +3254,18 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
items = animdata_filter_dopesheet(ac, anim_data, data, filter_mode);
break;
}
-
-
+
+
/* Special/Internal Use */
case ANIMCONT_CHANNEL: /* animation channel */
{
bDopeSheet *ads = ac->ads;
-
+
/* based on the channel type, filter relevant data for this */
items = animdata_filter_animchan(ac, anim_data, ads, data, filter_mode);
break;
}
-
+
/* unhandled */
default:
{
@@ -3276,12 +3276,12 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
/* remove any 'weedy' entries */
items = animdata_filter_remove_invalid(anim_data);
-
+
/* remove duplicates (if required) */
if (filter_mode & ANIMFILTER_NODUPLIS)
items = animdata_filter_remove_duplis(anim_data);
}
-
+
/* return the number of items in the list */
return items;
}
diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h
index d8c629bc143..8c4e2acd48d 100644
--- a/source/blender/editors/animation/anim_intern.h
+++ b/source/blender/editors/animation/anim_intern.h
@@ -27,7 +27,7 @@
* \ingroup edanimation
*/
-
+
#ifndef __ANIM_INTERN_H__
#define __ANIM_INTERN_H__
@@ -38,14 +38,14 @@ extern ListBase builtin_keyingsets;
/* Operator Define Prototypes ------------------- */
-/* Main Keyframe Management operators:
+/* Main Keyframe Management operators:
* These handle keyframes management from various spaces. They only make use of
* Keying Sets.
*/
void ANIM_OT_keyframe_insert(struct wmOperatorType *ot);
void ANIM_OT_keyframe_delete(struct wmOperatorType *ot);
-/* Main Keyframe Management operators:
+/* Main Keyframe Management operators:
* These handle keyframes management from various spaces. They will handle the menus
* required for each space.
*/
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 6b219a4f13a..4e0993152f7 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -59,7 +59,7 @@
int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
{
int icon = 0;
-
+
/* sanity checks */
if (name == NULL)
return icon;
@@ -74,17 +74,17 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
else {
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
-
+
/* get RNA pointer, and resolve the path */
RNA_id_pointer_create(id, &id_ptr);
-
+
/* try to resolve the path */
if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &ptr, &prop)) {
const char *structname = NULL, *propname = NULL;
char arrayindbuf[16];
const char *arrayname = NULL;
short free_structname = 0;
-
+
/* For now, name will consist of 3 parts: struct-name, property name, array index
* There are several options possible:
* 1) <struct-name>.<property-name>.<array-index>
@@ -93,12 +93,12 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
* i.e. X Location (Bone1), or X Location (Object)
*
* Currently, option 2 is in use, to try and make it easier to quickly identify F-Curves (it does have
- * problems with looking rather odd though). Option 1 is better in terms of revealing a consistent sense of
+ * problems with looking rather odd though). Option 1 is better in terms of revealing a consistent sense of
* hierarchy though, which isn't so clear with option 2.
*/
-
+
/* for structname
- * - as base, we use a custom name from the structs if one is available
+ * - as base, we use a custom name from the structs if one is available
* - however, if we're showing subdata of bones (probably there will be other exceptions later)
* need to include that info too since it gets confusing otherwise
* - if a pointer just refers to the ID-block, then don't repeat this info
@@ -108,11 +108,11 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
/* perform string 'chopping' to get "Bone Name : Constraint Name" */
char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
char *constName = BLI_str_quoted_substrN(fcu->rna_path, "constraints[");
-
+
/* assemble the string to display in the UI... */
structname = BLI_sprintfN("%s : %s", pchanName, constName);
free_structname = 1;
-
+
/* free the temp names */
if (pchanName) MEM_freeN(pchanName);
if (constName) MEM_freeN(constName);
@@ -127,25 +127,25 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
else
structname = RNA_struct_ui_name(ptr.type);
}
-
+
/* Property Name is straightforward */
propname = RNA_property_ui_name(prop);
-
+
/* Array Index - only if applicable */
if (RNA_property_array_check(prop)) {
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];
}
else {
/* no array index */
arrayname = "";
}
-
+
/* putting this all together into the buffer */
/* XXX we need to check for invalid names...
* XXX the name length limit needs to be passed in or as some define */
@@ -153,17 +153,17 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
BLI_snprintf(name, 256, "%s%s (%s)", arrayname, propname, structname);
else
BLI_snprintf(name, 256, "%s%s", arrayname, propname);
-
+
/* free temp name if nameprop is set */
if (free_structname)
MEM_freeN((void *)structname);
-
-
+
+
/* Icon for this property's owner:
* use the struct's icon if it is set
*/
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]
*/
@@ -172,16 +172,16 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
else {
/* invalid path */
BLI_snprintf(name, 256, "\"%s[%d]\"", fcu->rna_path, fcu->array_index);
-
+
/* 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);
-
+
/* tag F-Curve as disabled - as not usable path */
fcu->flag |= FCURVE_DISABLED;
}
}
-
+
/* return the icon that the active data had */
return icon;
}
@@ -197,7 +197,7 @@ void getcolor_fcurve_rainbow(int cur, int tot, float out[3])
{
float hsv[3], fac;
int grouping;
-
+
/* we try to divide the color into groupings of n colors,
* where n is:
* 3 - for 'odd' numbers of curves - there should be a majority of triplets of curves
@@ -206,24 +206,24 @@ void getcolor_fcurve_rainbow(int cur, int tot, float out[3])
*/
grouping = (4 - (tot % 2));
hsv[0] = HSV_BANDWIDTH * (float)(cur % grouping);
-
- /* 'Value' (i.e. darkness) needs to vary so that larger sets of three will be
+
+ /* '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.
* However, only a range of 0.3 to 1.0 is really usable to avoid clashing
- * with some other stuff
+ * with some other stuff
*/
fac = ((float)cur / (float)tot) * 0.7f;
-
+
/* the base color can get offset a bit so that the colors aren't so identical */
hsv[0] += fac * HSV_BANDWIDTH;
if (hsv[0] > 1.0f) hsv[0] = fmod(hsv[0], 1.0f);
-
+
/* saturation adjustments for more visible range */
hsv[1] = ((hsv[0] > 0.5f) && (hsv[0] < 0.8f)) ? 0.5f : 0.6f;
-
+
/* value is fixed at 1.0f, otherwise we cannot clearly see the curves... */
hsv[2] = 1.0f;
-
+
/* finally, conver this to RGB colors */
hsv_to_rgb_v(hsv, out);
}
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index c6a97186bbc..2450d0740f2 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -82,8 +82,8 @@ static ListBase *context_get_markers(Scene *scene, ScrArea *sa)
if (sa) {
if (sa->spacetype == SPACE_ACTION) {
SpaceAction *saction = (SpaceAction *)sa->spacedata.first;
-
- /* local markers can only be shown when there's only a single active action to grab them from
+
+ /* 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?
*/
if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) && (saction->action)) {
@@ -93,7 +93,7 @@ static ListBase *context_get_markers(Scene *scene, ScrArea *sa)
}
}
}
-
+
/* default to using the scene's markers */
return &scene->markers;
}
@@ -132,7 +132,7 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
TimeMarker *marker;
float cfra = (float)CFRA;
int changed_tot = 0;
-
+
/* sanity check - no markers, or locked markers */
if ((scene->toolsettings->lock_markers) ||
(markers == NULL))
@@ -167,7 +167,7 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
}
}
}
-
+
return changed_tot;
}
@@ -179,18 +179,18 @@ TimeMarker *ED_markers_find_nearest_marker(ListBase *markers, float x)
{
TimeMarker *marker, *nearest = NULL;
float dist, min_dist = 1000000;
-
+
if (markers) {
for (marker = markers->first; marker; marker = marker->next) {
dist = fabsf((float)marker->frame - x);
-
+
if (dist < min_dist) {
min_dist = dist;
nearest = marker;
}
}
}
-
+
return nearest;
}
@@ -206,7 +206,7 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
{
TimeMarker *marker;
float min, max;
-
+
/* sanity check */
//printf("markers = %p - %p, %p\n", markers, markers->first, markers->last);
if (ELEM(NULL, markers, markers->first, markers->last)) {
@@ -225,7 +225,7 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
max = (float)marker->frame;
}
}
-
+
/* set the min/max values */
*first = min;
*last = max;
@@ -237,16 +237,16 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel)
{
CfraElem *ce, *cen;
-
+
/* should this one only be considered if it is selected? */
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) {
if (ce->cfra == marker->frame) {
/* do because of double keys */
- if (marker->flag & SELECT)
+ if (marker->flag & SELECT)
ce->sel = marker->flag;
return;
}
@@ -254,7 +254,7 @@ static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only
break;
}
}
-
+
cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
if (ce) BLI_insertlinkbefore(lb, ce, cen);
else BLI_addtail(lb, cen);
@@ -270,7 +270,7 @@ static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only
void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
{
TimeMarker *marker;
-
+
if (lb) {
/* Clear the list first, since callers have no way of knowing
* whether this terminated early otherwise. This may lead
@@ -281,11 +281,11 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
else {
return;
}
-
+
if (markers == NULL) {
return;
}
-
+
for (marker = markers->first; marker; marker = marker->next)
add_marker_to_cfra_elem(lb, marker, only_sel);
}
@@ -296,37 +296,37 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
TimeMarker *ED_markers_get_first_selected(ListBase *markers)
{
TimeMarker *marker;
-
+
if (markers) {
for (marker = markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT)
return marker;
}
}
-
+
return NULL;
}
/* --------------------------------- */
-/* Print debugging prints of list of markers
+/* Print debugging prints of list of markers
* BSI's: do NOT make static or put in if-defs as "unused code". That's too much trouble when we need to use for quick debugging!
*/
void debug_markers_print_list(ListBase *markers)
{
TimeMarker *marker;
-
+
if (markers == NULL) {
printf("No markers list to print debug for\n");
return;
}
-
+
printf("List of markers follows: -----\n");
-
+
for (marker = markers->first; marker; marker = marker->next) {
printf("\t'%s' on %d at %p with %u\n", marker->name, marker->frame, (void *)marker, marker->flag);
}
-
+
printf("End of list ------------------\n");
}
@@ -343,7 +343,7 @@ static void draw_marker(
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
+
/* vertical line - dotted */
#ifdef DURIAN_CAMERA_SWITCH
if ((marker->camera) || (flag & DRAW_MARKERS_LINES))
@@ -352,20 +352,20 @@ static void draw_marker(
#endif
{
setlinestyle(3);
-
+
if (marker->flag & SELECT)
glColor4ub(255, 255, 255, 96);
else
glColor4ub(0, 0, 0, 96);
-
+
glBegin(GL_LINES);
glVertex2f(xpos + 0.5f, 12.0f);
glVertex2f(xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
glEnd();
-
+
setlinestyle(0);
}
-
+
/* 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 :
@@ -376,18 +376,18 @@ static void draw_marker(
icon_id = (marker->flag & SELECT) ? ICON_MARKER_HLT :
ICON_MARKER;
}
-
+
UI_icon_draw(xpos - 0.45f * UI_DPI_ICON_SIZE, UI_DPI_ICON_SIZE, icon_id);
-
+
glDisable(GL_BLEND);
-
+
/* and the marker name too, shifted slightly to the top-right */
if (marker->name[0]) {
float x, y;
/* minimal y coordinate which wouldn't be occluded by scroll */
int min_y = 17.0f * UI_DPI_FAC;
-
+
if (marker->flag & SELECT) {
UI_ThemeColor(TH_TEXT_HI);
x = xpos + 4.0f * UI_DPI_FAC;
@@ -484,7 +484,7 @@ void ED_markers_draw(const bContext *C, int flag)
}
/* ************************ Marker Wrappers API ********************* */
-/* These wrappers allow marker operators to function within the confines
+/* These wrappers allow marker operators to function within the confines
* of standard animation editors, such that they can coexist with the
* primary operations of those editors.
*/
@@ -495,11 +495,11 @@ void ED_markers_draw(const bContext *C, int flag)
static int ed_markers_poll_selected_markers(bContext *C)
{
ListBase *markers = ED_context_get_markers(C);
-
+
/* first things first: markers can only exist in timeline views */
if (ED_operator_animview_active(C) == 0)
return 0;
-
+
/* check if some marker is selected */
return ED_markers_get_first_selected(markers) != NULL;
}
@@ -526,19 +526,19 @@ static int ed_markers_poll_markers_exist(bContext *C)
{
ListBase *markers = ED_context_get_markers(C);
ToolSettings *ts = CTX_data_tool_settings(C);
-
+
if (ts->lock_markers)
return 0;
/* first things first: markers can only exist in timeline views */
if (ED_operator_animview_active(C) == 0)
return 0;
-
+
/* list of markers must exist, as well as some markers in it! */
return (markers && markers->first);
}
-
-/* ------------------------ */
+
+/* ------------------------ */
/**
* Second-tier invoke() callback that performs context validation before running the
@@ -554,9 +554,9 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, const wm
{
ScrArea *sa = CTX_wm_area(C);
int retval = OPERATOR_PASS_THROUGH;
-
+
/* removed check for Y coord of event, keymap has bounbox now */
-
+
/* allow operator to run now */
if (invoke_func)
retval = invoke_func(C, op, event);
@@ -564,7 +564,7 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, const wm
retval = op->type->exec(C, op);
else
BKE_report(op->reports, RPT_ERROR, "Programming error: operator does not actually have code to do anything!");
-
+
/* return status modifications - for now, make this spacetype dependent as above */
if (sa->spacetype != SPACE_TIME) {
/* unless successful, must add "pass-through" to let normal operator's have a chance at tackling this event */
@@ -572,7 +572,7 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, const wm
retval |= OPERATOR_PASS_THROUGH;
}
}
-
+
return retval;
}
@@ -594,30 +594,30 @@ static int ed_marker_add_exec(bContext *C, wmOperator *UNUSED(op))
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker;
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) {
- if (marker->frame == frame)
+ if (marker->frame == frame)
return OPERATOR_CANCELLED;
}
-
+
/* deselect all */
for (marker = markers->first; marker; marker = marker->next)
marker->flag &= ~SELECT;
-
+
marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
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);
-
+
return OPERATOR_FINISHED;
}
@@ -627,19 +627,19 @@ static void MARKER_OT_add(wmOperatorType *ot)
ot->name = "Add Time Marker";
ot->description = "Add a new time marker";
ot->idname = "MARKER_OT_add";
-
+
/* api callbacks */
ot->exec = ed_marker_add_exec;
ot->invoke = ed_markers_opwrap_invoke;
ot->poll = ED_operator_animview_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************** transform markers *************************** */
-/* operator state vars used:
+/* operator state vars used:
* frs: delta movement
*
* functions:
@@ -778,12 +778,12 @@ static bool ed_marker_move_init(bContext *C, wmOperator *op)
static void ed_marker_move_exit(bContext *C, wmOperator *op)
{
MarkerMove *mm = op->customdata;
-
+
/* free data */
MEM_freeN(mm->oldframe);
MEM_freeN(op->customdata);
op->customdata = NULL;
-
+
/* clear custom header prints */
ED_area_headerprint(CTX_wm_area(C), NULL);
}
@@ -792,14 +792,14 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *eve
{
if (ed_marker_move_init(C, op)) {
MarkerMove *mm = op->customdata;
-
+
mm->evtx = event->x;
mm->firstx = event->x;
mm->event_type = event->type;
-
+
/* add temp handler */
WM_event_add_modal_handler(C, op);
-
+
/* reset frs delta */
RNA_int_set(op->ptr, "frames", 0);
@@ -807,7 +807,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *eve
return OPERATOR_RUNNING_MODAL;
}
-
+
return OPERATOR_CANCELLED;
}
@@ -827,7 +827,7 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op)
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) {
if (marker->flag & SELECT) {
@@ -838,7 +838,7 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
-
+
#ifdef DURIAN_CAMERA_SWITCH
/* so we get view3d redraws */
BKE_scene_camera_switch_update(scene);
@@ -963,17 +963,17 @@ static void MARKER_OT_move(wmOperatorType *ot)
ot->name = "Move Time Marker";
ot->description = "Move selected time marker(s)";
ot->idname = "MARKER_OT_move";
-
+
/* api callbacks */
ot->exec = ed_marker_move_exec;
ot->invoke = ed_marker_move_invoke_wrapper;
ot->modal = ed_marker_move_modal;
ot->poll = ed_markers_poll_selected_no_locked_markers;
ot->cancel = ed_marker_move_cancel;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR;
-
+
/* rna storage */
RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
}
@@ -1001,8 +1001,8 @@ static void ed_marker_duplicate_apply(bContext *C)
{
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker, *newmarker;
-
- if (markers == NULL)
+
+ if (markers == NULL)
return;
/* go through the list of markers, duplicate selected markers and add duplicated copies
@@ -1012,13 +1012,13 @@ static void ed_marker_duplicate_apply(bContext *C)
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;
BLI_strncpy(newmarker->name, marker->name, sizeof(marker->name));
-
+
#ifdef DURIAN_CAMERA_SWITCH
newmarker->camera = marker->camera;
#endif
@@ -1034,9 +1034,9 @@ 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 */
-
+
return OPERATOR_FINISHED;
-
+
}
static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1056,17 +1056,17 @@ static void MARKER_OT_duplicate(wmOperatorType *ot)
ot->name = "Duplicate Time Marker";
ot->description = "Duplicate selected time marker(s)";
ot->idname = "MARKER_OT_duplicate";
-
+
/* api callbacks */
ot->exec = ed_marker_duplicate_exec;
ot->invoke = ed_marker_duplicate_invoke_wrapper;
ot->modal = ed_marker_move_modal;
ot->poll = ed_markers_poll_selected_no_locked_markers;
ot->cancel = ed_marker_move_cancel;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* rna storage */
RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
}
@@ -1113,18 +1113,18 @@ static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool
View2D *v2d = UI_view2d_fromcontext(C);
float viewx;
int x, cfra;
-
+
if (markers == NULL)
return OPERATOR_PASS_THROUGH;
x = event->x - ar->winrct.xmin;
-
+
viewx = UI_view2d_region_to_view_x(v2d, x);
-
+
cfra = ED_markers_find_nearest_marker_time(markers, viewx);
-
+
select_timeline_marker_frame(markers, cfra, extend);
-
+
#ifdef DURIAN_CAMERA_SWITCH
if (camera) {
@@ -1132,17 +1132,17 @@ static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool
Base *base;
TimeMarker *marker;
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);
break;
}
}
-
+
for (marker = markers->first; marker; marker = marker->next) {
if (marker->camera) {
if (marker->frame == cfra) {
@@ -1155,7 +1155,7 @@ static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool
}
}
}
-
+
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
#else
@@ -1192,11 +1192,11 @@ static void MARKER_OT_select(wmOperatorType *ot)
ot->name = "Select Time Marker";
ot->description = "Select time marker(s)";
ot->idname = "MARKER_OT_select";
-
+
/* api callbacks */
ot->invoke = ed_marker_select_invoke_wrapper;
ot->poll = ed_markers_poll_markers_exist;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1210,7 +1210,7 @@ static void MARKER_OT_select(wmOperatorType *ot)
/* *************************** border select markers **************** */
-/* operator state vars used: (added by default WM callbacks)
+/* operator state vars used: (added by default WM callbacks)
* xmin, ymin
* xmax, ymax
*
@@ -1237,13 +1237,13 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
bool select = !RNA_boolean_get(op->ptr, "deselect");
bool extend = RNA_boolean_get(op->ptr, "extend");
rctf rect;
-
+
WM_operator_properties_border_to_rctf(op, &rect);
UI_view2d_region_to_view_rctf(v2d, &rect, &rect);
-
+
if (markers == NULL)
return 0;
-
+
/* XXX marker context */
for (marker = markers->first; marker; marker = marker->next) {
if (BLI_rctf_isect_x(&rect, marker->frame)) {
@@ -1258,7 +1258,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
marker->flag &= ~SELECT;
}
}
-
+
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
@@ -1276,18 +1276,18 @@ static void MARKER_OT_select_border(wmOperatorType *ot)
ot->name = "Marker Border Select";
ot->description = "Select all time markers using border selection";
ot->idname = "MARKER_OT_select_border";
-
+
/* api callbacks */
ot->exec = ed_marker_border_select_exec;
ot->invoke = ed_marker_select_border_invoke_wrapper;
ot->modal = WM_gesture_border_modal;
ot->cancel = WM_gesture_border_cancel;
-
+
ot->poll = ed_markers_poll_markers_exist;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* rna */
WM_operator_properties_gesture_border_select(ot);
}
@@ -1306,7 +1306,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
if (action == SEL_TOGGLE) {
action = (ED_markers_get_first_selected(markers) != NULL) ? SEL_DESELECT : SEL_SELECT;
}
-
+
for (marker = markers->first; marker; marker = marker->next) {
switch (action) {
case SEL_SELECT:
@@ -1320,7 +1320,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
break;
}
}
-
+
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
@@ -1333,15 +1333,15 @@ static void MARKER_OT_select_all(wmOperatorType *ot)
ot->name = "(De)select all Markers";
ot->description = "Change selection of all time markers";
ot->idname = "MARKER_OT_select_all";
-
+
/* api callbacks */
ot->exec = ed_marker_select_all_exec;
ot->invoke = ed_markers_opwrap_invoke;
ot->poll = ed_markers_poll_markers_exist;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* rna */
WM_operator_properties_select_all(ot);
}
@@ -1354,10 +1354,10 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker, *nmarker;
bool changed = false;
-
+
if (markers == NULL)
return OPERATOR_CANCELLED;
-
+
for (marker = markers->first; marker; marker = nmarker) {
nmarker = marker->next;
if (marker->flag & SELECT) {
@@ -1365,12 +1365,12 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
changed = true;
}
}
-
+
if (changed) {
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
}
-
+
return OPERATOR_FINISHED;
}
@@ -1386,12 +1386,12 @@ static void MARKER_OT_delete(wmOperatorType *ot)
ot->name = "Delete Markers";
ot->description = "Delete selected time marker(s)";
ot->idname = "MARKER_OT_delete";
-
+
/* api callbacks */
ot->invoke = ed_marker_delete_invoke_wrapper;
ot->exec = ed_marker_delete_exec;
ot->poll = ed_markers_poll_selected_no_locked_markers;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1406,10 +1406,10 @@ static int ed_marker_rename_exec(bContext *C, wmOperator *op)
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);
-
+
return OPERATOR_FINISHED;
}
else {
@@ -1423,7 +1423,7 @@ static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, const wm
TimeMarker *marker = ED_markers_get_first_selected(ED_context_get_markers(C));
if (marker)
RNA_string_set(op->ptr, "name", marker->name);
-
+
/* now see if the operator is usable */
return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_props_popup_confirm);
}
@@ -1434,15 +1434,15 @@ static void MARKER_OT_rename(wmOperatorType *ot)
ot->name = "Rename Marker";
ot->description = "Rename first selected time marker";
ot->idname = "MARKER_OT_rename";
-
+
/* api callbacks */
ot->invoke = ed_marker_rename_invoke_wrapper;
ot->exec = ed_marker_rename_exec;
ot->poll = ed_markers_poll_selected_no_locked_markers;
-
+
/* flags */
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");
//RNA_def_boolean(ot->srna, "ensure_unique", 0, "Ensure Unique", "Ensure that new name is unique within collection of markers");
@@ -1476,7 +1476,7 @@ static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
if (marker->flag & SELECT) {
marker_new = MEM_dupallocN(marker);
marker_new->prev = marker_new->next = NULL;
-
+
BLI_addtail(&scene_to->markers, marker_new);
}
}
@@ -1583,7 +1583,7 @@ void ED_keymap_marker(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_find(keyconf, "Markers", 0, 0);
wmKeyMapItem *kmi;
-
+
WM_keymap_verify_item(keymap, "MARKER_OT_add", MKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_move", EVT_TWEAK_S, KM_ANY, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
@@ -1602,13 +1602,13 @@ void ED_keymap_marker(wmKeyConfig *keyconf)
#else
(void)kmi;
#endif
-
+
WM_keymap_verify_item(keymap, "MARKER_OT_select_border", BKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MARKER_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MARKER_OT_delete", DELKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_rename", MKEY, KM_PRESS, KM_CTRL, 0);
-
+
WM_keymap_add_item(keymap, "MARKER_OT_move", GKEY, KM_PRESS, 0, 0);
#ifdef DURIAN_CAMERA_SWITCH
WM_keymap_add_item(keymap, "MARKER_OT_camera_bind", BKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index b0630175f93..d817433bcb1 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -67,10 +67,10 @@
static int change_frame_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
-
+
/* XXX temp? prevent changes during render */
if (G.is_rendering) return false;
-
+
/* although it's only included in keymaps for regions using ED_KEYMAP_ANIMATION,
* this shouldn't show up in 3D editor (or others without 2D timeline view) via search
*/
@@ -85,7 +85,7 @@ static int change_frame_poll(bContext *C)
return false;
}
}
-
+
CTX_wm_operator_poll_msg_set(C, "Expected an timeline/animation area to be active");
return false;
}
@@ -139,12 +139,12 @@ static float frame_from_event(bContext *C, const wmEvent *event)
/* convert from region coordinates to View2D 'tot' space */
frame = UI_view2d_region_to_view_x(&region->v2d, event->mval[0]);
-
+
/* respect preview range restrictions (if only allowed to move around within that range) */
if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) {
CLAMP(frame, PSFRA, PEFRA);
}
-
+
return frame;
}
@@ -195,7 +195,7 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event
change_frame_seq_preview_begin(C, event);
change_frame_apply(C, op);
-
+
/* add temp handler */
WM_event_add_modal_handler(C, op);
@@ -221,11 +221,11 @@ static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
RNA_float_set(op->ptr, "frame", frame_from_event(C, event));
change_frame_apply(C, op);
break;
-
- case LEFTMOUSE:
+
+ case LEFTMOUSE:
case RIGHTMOUSE:
case MIDDLEMOUSE:
- /* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init
+ /* 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)
@@ -258,14 +258,14 @@ static void ANIM_OT_change_frame(wmOperatorType *ot)
ot->name = "Change Frame";
ot->idname = "ANIM_OT_change_frame";
ot->description = "Interactively change the current frame number";
-
+
/* api callbacks */
ot->exec = change_frame_exec;
ot->invoke = change_frame_invoke;
ot->cancel = change_frame_cancel;
ot->modal = change_frame_modal;
ot->poll = change_frame_poll;
-
+
/* flags */
ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR | OPTYPE_UNDO_GROUPED;
ot->undo_group = "FRAME_CHANGE";
@@ -284,31 +284,31 @@ static int previewrange_define_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
float sfra, efra;
rcti rect;
-
+
/* get min/max values from border select rect (already in region coordinates, not screen) */
WM_operator_properties_border_to_rcti(op, &rect);
-
+
/* convert min/max values to frames (i.e. region to 'tot' rect) */
sfra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmin);
efra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmax);
-
- /* set start/end frames for preview-range
+
+ /* set start/end frames for preview-range
* - must clamp within allowable limits
* - end must not be before start (though this won't occur most of the time)
*/
FRAMENUMBER_MIN_CLAMP(sfra);
FRAMENUMBER_MIN_CLAMP(efra);
if (efra < sfra) efra = sfra;
-
+
scene->r.flag |= SCER_PRV_RANGE;
scene->r.psfra = round_fl_to_int(sfra);
scene->r.pefra = round_fl_to_int(efra);
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
-
+
return OPERATOR_FINISHED;
-}
+}
static void ANIM_OT_previewrange_set(wmOperatorType *ot)
{
@@ -316,18 +316,18 @@ static void ANIM_OT_previewrange_set(wmOperatorType *ot)
ot->name = "Set Preview Range";
ot->idname = "ANIM_OT_previewrange_set";
ot->description = "Interactively define frame range used for playback";
-
+
/* api callbacks */
ot->invoke = WM_gesture_border_invoke;
ot->exec = previewrange_define_exec;
ot->modal = WM_gesture_border_modal;
ot->cancel = WM_gesture_border_cancel;
-
+
ot->poll = ED_operator_animview_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* rna */
/* used to define frame range.
*
@@ -342,23 +342,23 @@ static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
ScrArea *curarea = CTX_wm_area(C);
-
+
/* sanity checks */
if (ELEM(NULL, scene, curarea))
return OPERATOR_CANCELLED;
-
+
/* simply clear values */
scene->r.flag &= ~SCER_PRV_RANGE;
scene->r.psfra = 0;
scene->r.pefra = 0;
-
+
ED_area_tag_redraw(curarea);
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
-
+
return OPERATOR_FINISHED;
-}
+}
static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
{
@@ -366,12 +366,12 @@ static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
ot->name = "Clear Preview Range";
ot->idname = "ANIM_OT_previewrange_clear";
ot->description = "Clear Preview Range";
-
+
/* api callbacks */
ot->exec = previewrange_clear_exec;
-
+
ot->poll = ED_operator_animview_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -382,10 +382,10 @@ void ED_operatortypes_anim(void)
{
/* Animation Editors only -------------------------- */
WM_operatortype_append(ANIM_OT_change_frame);
-
+
WM_operatortype_append(ANIM_OT_previewrange_set);
WM_operatortype_append(ANIM_OT_previewrange_clear);
-
+
/* Entire UI --------------------------------------- */
WM_operatortype_append(ANIM_OT_keyframe_insert);
WM_operatortype_append(ANIM_OT_keyframe_delete);
@@ -395,22 +395,22 @@ void ED_operatortypes_anim(void)
WM_operatortype_append(ANIM_OT_keyframe_insert_button);
WM_operatortype_append(ANIM_OT_keyframe_delete_button);
WM_operatortype_append(ANIM_OT_keyframe_clear_button);
-
-
+
+
WM_operatortype_append(ANIM_OT_driver_button_add);
WM_operatortype_append(ANIM_OT_driver_button_remove);
WM_operatortype_append(ANIM_OT_copy_driver_button);
WM_operatortype_append(ANIM_OT_paste_driver_button);
-
+
WM_operatortype_append(ANIM_OT_keyingset_button_add);
WM_operatortype_append(ANIM_OT_keyingset_button_remove);
-
+
WM_operatortype_append(ANIM_OT_keying_set_add);
WM_operatortype_append(ANIM_OT_keying_set_remove);
WM_operatortype_append(ANIM_OT_keying_set_path_add);
WM_operatortype_append(ANIM_OT_keying_set_path_remove);
-
+
WM_operatortype_append(ANIM_OT_keying_set_active_set);
}
@@ -418,14 +418,14 @@ void ED_keymap_anim(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation", 0, 0);
wmKeyMapItem *kmi;
-
+
/* frame management */
/* 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);
RNA_string_set(kmi->ptr, "data_path", "space_data.show_seconds");
-
+
/* preview range */
WM_keymap_verify_item(keymap, "ANIM_OT_previewrange_set", PKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "ANIM_OT_previewrange_clear", PKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 7dae825c92f..be9875ef95a 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -29,7 +29,7 @@
* \ingroup edanimation
*/
-
+
#include <stdio.h>
#include <string.h>
@@ -65,7 +65,7 @@
/* ************************************************** */
/* Animation Data Validation */
-/* Get (or add relevant data to be able to do so) F-Curve from the driver stack,
+/* Get (or add relevant data to be able to do so) F-Curve from the driver stack,
* for the given Animation Data block. This assumes that all the destinations are valid.
*
* - add: 0 - don't add anything if not found,
@@ -77,11 +77,11 @@ FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_inde
{
AnimData *adt;
FCurve *fcu;
-
+
/* sanity checks */
if (ELEM(NULL, id, rna_path))
return NULL;
-
+
/* init animdata if none available yet */
adt = BKE_animdata_from_id(id);
if ((adt == NULL) && (add))
@@ -90,33 +90,33 @@ FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_inde
/* if still none (as not allowed to add, or ID doesn't have animdata for some reason) */
return NULL;
}
-
- /* try to find f-curve matching for this setting
+
+ /* try to find f-curve matching for this setting
* - 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);
-
+
if ((fcu == NULL) && (add)) {
/* use default settings to make a F-Curve */
fcu = MEM_callocN(sizeof(FCurve), "FCurve");
-
+
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
-
+
/* store path - make copy, and store that */
fcu->rna_path = BLI_strdup(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) {
BezTriple *bezt;
size_t i;
-
+
/* add some new driver data */
fcu->driver = MEM_callocN(sizeof(ChannelDriver), "ChannelDriver");
fcu->driver->flag |= DRIVER_FLAG_SHOWDEBUG;
-
+
/* F-Modifier or Keyframes? */
// FIXME: replace these magic numbers with defines
if (add == 2) {
@@ -127,27 +127,27 @@ FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_inde
add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR, fcu);
}
else {
- /* add 2 keyframes so that user has something to work with
+ /* add 2 keyframes so that user has something to work with
* - These are configured to 0,0 and 1,1 to give a 1-1 mapping
* which can be easily tweaked from there.
*/
insert_vert_fcurve(fcu, 0.0f, 0.0f, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_FAST);
insert_vert_fcurve(fcu, 1.0f, 1.0f, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_FAST);
-
+
/* configure this curve to extrapolate */
for (i = 0, bezt = fcu->bezt; (i < fcu->totvert) && bezt; i++, bezt++) {
bezt->h1 = bezt->h2 = HD_VECT;
}
-
+
fcu->extend = FCURVE_EXTRAPOLATE_LINEAR;
calchandles_fcurve(fcu);
}
}
-
+
/* just add F-Curve to end of driver list */
BLI_addtail(&adt->drivers, fcu);
}
-
+
/* return the F-Curve */
return fcu;
}
@@ -167,17 +167,17 @@ static int add_driver_with_target(
FCurve *fcu;
short add_mode = (flag & CREATEDRIVER_WITH_FMODIFIER) ? 2 : 1;
const char *prop_name = RNA_property_identifier(src_prop);
-
+
/* Create F-Curve with Driver */
fcu = verify_driver_fcurve(dst_id, dst_path, dst_index, add_mode);
-
+
if (fcu && fcu->driver) {
ChannelDriver *driver = fcu->driver;
DriverVar *dvar;
-
+
/* Set the type of the driver */
driver->type = driver_type;
-
+
/* Set driver expression, so that the driver works out of the box
*
* The following checks define a bit of "autodetection magic" we use
@@ -185,7 +185,7 @@ static int add_driver_with_target(
* when faced with properties with different units.
*/
/* XXX: if we have N-1 mapping, should we include all those in the expression? */
- if ((RNA_property_unit(dst_prop) == PROP_UNIT_ROTATION) &&
+ if ((RNA_property_unit(dst_prop) == PROP_UNIT_ROTATION) &&
(RNA_property_unit(src_prop) != PROP_UNIT_ROTATION))
{
/* Rotation Destination: normal -> radians, so convert src to radians
@@ -205,7 +205,7 @@ static int add_driver_with_target(
/* Just a normal property without any unit problems */
BLI_strncpy(driver->expression, "var", sizeof(driver->expression));
}
-
+
/* Create a driver variable for the target
* - For transform properties, we want to automatically use "transform channel" instead
* (The only issue is with quat rotations vs euler channels...)
@@ -214,25 +214,25 @@ static int add_driver_with_target(
* when both the source and destinations are in same places.
*/
dvar = driver_add_new_variable(driver);
-
- if (ELEM(src_ptr->type, &RNA_Object, &RNA_PoseBone) &&
+
+ if (ELEM(src_ptr->type, &RNA_Object, &RNA_PoseBone) &&
(STREQ(prop_name, "location") || STREQ(prop_name, "scale") || STRPREFIX(prop_name, "rotation_")) &&
(src_ptr->data != dst_ptr->data))
{
/* Transform Channel */
DriverTarget *dtar;
-
+
driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN);
dtar = &dvar->targets[0];
-
+
/* Bone or Object target? */
dtar->id = src_id;
dtar->idtype = GS(src_id->name);
-
+
if (src_ptr->type == &RNA_PoseBone) {
RNA_string_get(src_ptr, "name", dtar->pchan_name);
}
-
+
/* Transform channel depends on type */
if (STREQ(prop_name, "location")) {
if (src_index == 2)
@@ -265,11 +265,11 @@ static int add_driver_with_target(
else {
/* Single RNA Property */
DriverTarget *dtar = &dvar->targets[0];
-
+
/* ID is as-is */
dtar->id = src_id;
dtar->idtype = GS(src_id->name);
-
+
/* Need to make a copy of the path (or build one with array index built in) */
if (RNA_property_array_check(src_prop)) {
dtar->rna_path = BLI_sprintfN("%s[%d]", src_path, src_index);
@@ -279,7 +279,7 @@ static int add_driver_with_target(
}
}
}
-
+
/* set the done status */
return (fcu != NULL);
}
@@ -296,35 +296,35 @@ static int add_driver_with_target(
* - mapping_type: eCreateDriver_MappingTypes
*/
int ANIM_add_driver_with_target(
- ReportList *reports,
+ ReportList *reports,
ID *dst_id, const char dst_path[], int dst_index,
ID *src_id, const char src_path[], int src_index,
short flag, int driver_type, short mapping_type)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
-
+
PointerRNA id_ptr2, ptr2;
PropertyRNA *prop2;
int done_tot = 0;
-
+
/* validate pointers first - exit if failure */
RNA_id_pointer_create(dst_id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, dst_path, &ptr, &prop) == false) {
- BKE_reportf(reports, RPT_ERROR,
+ BKE_reportf(reports, RPT_ERROR,
"Could not add driver, as RNA path is invalid for the given ID (ID = %s, path = %s)",
dst_id->name, dst_path);
return 0;
}
-
+
RNA_id_pointer_create(src_id, &id_ptr2);
- if ((RNA_path_resolve_property(&id_ptr2, src_path, &ptr2, &prop2) == false) ||
+ if ((RNA_path_resolve_property(&id_ptr2, src_path, &ptr2, &prop2) == false) ||
(mapping_type == CREATEDRIVER_MAPPING_NONE))
{
/* No target - So, fall back to default method for adding a "simple" driver normally */
return ANIM_add_driver(reports, dst_id, dst_path, dst_index, flag | CREATEDRIVER_WITH_DEFAULT_DVAR, driver_type);
}
-
+
/* handle curve-property mappings based on mapping_type */
switch (mapping_type) {
case CREATEDRIVER_MAPPING_N_N: /* N-N - Try to match as much as possible, then use the first one */
@@ -332,35 +332,35 @@ int ANIM_add_driver_with_target(
/* Use the shorter of the two (to avoid out of bounds access) */
int dst_len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr, prop) : 1;
int src_len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr2, prop2) : 1;
-
+
int len = MIN2(dst_len, src_len);
int i;
-
+
for (i = 0; i < len; i++) {
done_tot += add_driver_with_target(reports, dst_id, dst_path, i, src_id, src_path, i, &ptr, prop, &ptr2, prop2, flag, driver_type);
}
break;
}
-
+
case CREATEDRIVER_MAPPING_1_N: /* 1-N - Specified target index for all */
default:
{
int len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr, prop) : 1;
int i;
-
+
for (i = 0; i < len; i++) {
done_tot += add_driver_with_target(reports, dst_id, dst_path, i, src_id, src_path, src_index, &ptr, prop, &ptr2, prop2, flag, driver_type);
}
break;
}
-
+
case CREATEDRIVER_MAPPING_1_1: /* 1-1 - Use the specified index (unless -1) */
{
done_tot = add_driver_with_target(reports, dst_id, dst_path, dst_index, src_id, src_path, src_index, &ptr, prop, &ptr2, prop2, flag, driver_type);
break;
}
}
-
+
/* done */
return done_tot;
}
@@ -371,22 +371,22 @@ int ANIM_add_driver_with_target(
* Add a new driver for the specified property on the given ID block
*/
int ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type)
-{
+{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
FCurve *fcu;
int array_index_max;
int done_tot = 0;
-
+
/* validate pointer first - exit if failure */
RNA_id_pointer_create(id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, rna_path, &ptr, &prop) == false) {
- BKE_reportf(reports, RPT_ERROR,
+ 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);
return 0;
}
-
+
/* key entire array convenience method */
if (array_index == -1) {
array_index_max = RNA_property_array_length(&ptr, prop);
@@ -394,25 +394,25 @@ int ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int arra
}
else
array_index_max = array_index;
-
+
/* maximum index should be greater than the start index */
if (array_index == array_index_max)
array_index_max += 1;
-
+
/* will only loop once unless the array index was -1 */
for (; array_index < array_index_max; array_index++) {
short add_mode = (flag & CREATEDRIVER_WITH_FMODIFIER) ? 2 : 1;
-
+
/* create F-Curve with Driver */
fcu = verify_driver_fcurve(id, rna_path, array_index, add_mode);
-
+
if (fcu && fcu->driver) {
ChannelDriver *driver = fcu->driver;
-
+
/* set the type of the driver */
driver->type = type;
-
- /* creating drivers for buttons will create the driver(s) with 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
*/
@@ -422,28 +422,28 @@ int ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int arra
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);
-
+
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);
-
+
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);
-
+
BLI_snprintf(expression, maxlen, "%.3f", fval);
}
}
-
- /* for easier setup of drivers from UI, a driver variable should be
+
+ /* for easier setup of drivers from UI, a driver variable should be
* added if flag is set (UI calls only)
*/
if (flag & CREATEDRIVER_WITH_DEFAULT_DVAR) {
@@ -454,11 +454,11 @@ int ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int arra
driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN);
}
}
-
+
/* set the done status */
done_tot += (fcu != NULL);
}
-
+
/* done */
return done_tot;
}
@@ -471,29 +471,29 @@ bool ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_path
AnimData *adt;
FCurve *fcu;
bool success = false;
-
+
/* we don't check the validity of the path here yet, but it should be ok... */
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;
-
+
while ((fcu = iter_step_fcurve(fcu_iter, rna_path)) != NULL) {
/* store the next fcurve for looping */
fcu_iter = fcu->next;
-
+
/* remove F-Curve from driver stack, then free it */
BLI_remlink(&adt->drivers, fcu);
free_fcurve(fcu);
-
+
/* done successfully */
success = true;
}
}
else {
- /* find the matching driver and remove it only
+ /* 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
*/
@@ -501,7 +501,7 @@ bool ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_path
if (fcu) {
BLI_remlink(&adt->drivers, fcu);
free_fcurve(fcu);
-
+
success = true;
}
}
@@ -541,7 +541,7 @@ bool ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int ar
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
FCurve *fcu;
-
+
/* validate pointer first - exit if failure */
RNA_id_pointer_create(id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, rna_path, &ptr, &prop) == false) {
@@ -550,13 +550,13 @@ bool ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int ar
id->name, rna_path);
return 0;
}
-
+
/* try to get F-Curve with Driver */
fcu = verify_driver_fcurve(id, rna_path, array_index, 0);
-
+
/* clear copy/paste buffer first (for consistency with other copy/paste buffers) */
ANIM_drivers_copybuf_free();
-
+
/* copy this to the copy/paste buf if it exists */
if (fcu && fcu->driver) {
/* make copies of some info such as the rna_path, then clear this info from the F-Curve temporarily
@@ -564,17 +564,17 @@ bool ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int ar
*/
char *tmp_path = fcu->rna_path;
fcu->rna_path = NULL;
-
+
/* make a copy of the F-Curve with */
channeldriver_copypaste_buf = copy_fcurve(fcu);
-
+
/* restore the path */
fcu->rna_path = tmp_path;
-
+
/* copied... */
return 1;
}
-
+
/* done */
return 0;
}
@@ -584,11 +584,11 @@ bool ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int ar
* with the driver + driver-curve data from the buffer
*/
bool ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
-{
+{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
FCurve *fcu;
-
+
/* validate pointer first - exit if failure */
RNA_id_pointer_create(id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, rna_path, &ptr, &prop) == false) {
@@ -597,35 +597,35 @@ bool ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int a
id->name, rna_path);
return 0;
}
-
+
/* if the buffer is empty, cannot paste... */
if (channeldriver_copypaste_buf == NULL) {
BKE_report(reports, RPT_ERROR, "Paste driver: no driver to paste");
return 0;
}
-
+
/* create Driver F-Curve, but without data which will be copied across... */
fcu = verify_driver_fcurve(id, rna_path, array_index, -1);
-
+
if (fcu) {
- /* copy across the curve data from the buffer curve
+ /* 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;
-
+
/* modifiers */
copy_fmodifiers(&fcu->modifiers, &channeldriver_copypaste_buf->modifiers);
-
+
/* extrapolation mode */
fcu->extend = channeldriver_copypaste_buf->extend;
-
+
/* the 'juicy' stuff - the driver */
fcu->driver = fcurve_copy_driver(channeldriver_copypaste_buf->driver);
}
-
+
/* done */
return (fcu != NULL);
}
@@ -642,14 +642,14 @@ void ANIM_driver_vars_copybuf_free(void)
/* Free the driver variables kept in the buffer */
if (driver_vars_copybuf.first) {
DriverVar *dvar, *dvarn;
-
+
/* Free variables (and any data they use) */
for (dvar = driver_vars_copybuf.first; dvar; dvar = dvarn) {
dvarn = dvar->next;
driver_free_variable(&driver_vars_copybuf, dvar);
}
}
-
+
BLI_listbase_clear(&driver_vars_copybuf);
}
@@ -669,18 +669,18 @@ bool ANIM_driver_vars_copy(ReportList *reports, FCurve *fcu)
BKE_report(reports, RPT_ERROR, "No driver to copy variables from");
return false;
}
-
+
if (BLI_listbase_is_empty(&fcu->driver->variables)) {
BKE_report(reports, RPT_ERROR, "Driver has no variables to copy");
return false;
}
-
+
/* clear buffer */
ANIM_driver_vars_copybuf_free();
-
+
/* copy over the variables */
driver_variables_copy(&driver_vars_copybuf, &fcu->driver->variables);
-
+
return (BLI_listbase_is_empty(&driver_vars_copybuf) == false);
}
@@ -689,55 +689,55 @@ bool ANIM_driver_vars_paste(ReportList *reports, FCurve *fcu, bool replace)
{
ChannelDriver *driver = (fcu) ? fcu->driver : NULL;
ListBase tmp_list = {NULL, NULL};
-
+
/* sanity checks */
if (BLI_listbase_is_empty(&driver_vars_copybuf)) {
BKE_report(reports, RPT_ERROR, "No driver variables in clipboard to paste");
return false;
}
-
+
if (ELEM(NULL, fcu, fcu->driver)) {
BKE_report(reports, RPT_ERROR, "Cannot paste driver variables without a driver");
return false;
}
-
+
/* 1) Make a new copy of the variables in the buffer - these will get pasted later... */
driver_variables_copy(&tmp_list, &driver_vars_copybuf);
-
+
/* 2) Prepare destination array */
if (replace) {
DriverVar *dvar, *dvarn;
-
+
/* Free all existing vars first - We aren't retaining anything */
for (dvar = driver->variables.first; dvar; dvar = dvarn) {
dvarn = dvar->next;
driver_free_variable_ex(driver, dvar);
}
-
+
BLI_listbase_clear(&driver->variables);
}
-
+
/* 3) Add new vars */
if (driver->variables.last) {
DriverVar *last = driver->variables.last;
DriverVar *first = tmp_list.first;
-
+
last->next = first;
first->prev = last;
-
+
driver->variables.last = tmp_list.last;
}
else {
driver->variables.first = tmp_list.first;
driver->variables.last = tmp_list.last;
}
-
+
#ifdef WITH_PYTHON
/* since driver variables are cached, the expression needs re-compiling too */
if (driver->type == DRIVER_TYPE_PYTHON)
driver->flag |= DRIVER_FLAG_RENAMEVAR;
#endif
-
+
return true;
}
@@ -754,10 +754,10 @@ EnumPropertyItem prop_driver_create_mapping_types[] = {
"Drive all components of this property using the target picked"},
{CREATEDRIVER_MAPPING_1_1, "DIRECT", 0, "Single from Target",
"Drive this component of this property using the target picked"},
-
+
{CREATEDRIVER_MAPPING_N_N, "MATCH", ICON_COLOR, "Match Indices",
"Create drivers for each pair of corresponding elements"},
-
+
{CREATEDRIVER_MAPPING_NONE_ALL, "NONE_ALL", ICON_HAND, "Manually Create Later",
"Create drivers for all properties without assigning any targets yet"},
{CREATEDRIVER_MAPPING_NONE, "NONE_SINGLE", 0, "Manually Create Later (Single)",
@@ -770,21 +770,21 @@ static const EnumPropertyItem *driver_mapping_type_itemsf(bContext *C, PointerRN
{
EnumPropertyItem *input = prop_driver_create_mapping_types;
EnumPropertyItem *item = NULL;
-
+
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
int index;
-
+
int totitem = 0;
-
+
if (!C) /* needed for docs */
return prop_driver_create_mapping_types;
-
+
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
-
+
if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
const bool is_array = RNA_property_array_check(prop);
-
+
while (input->identifier) {
if (ELEM(input->value, CREATEDRIVER_MAPPING_1_1, CREATEDRIVER_MAPPING_NONE) || (is_array)) {
RNA_enum_item_add(&item, &totitem, input);
@@ -796,9 +796,9 @@ static const EnumPropertyItem *driver_mapping_type_itemsf(bContext *C, PointerRN
/* We need at least this one! */
RNA_enum_items_add_value(&item, &totitem, input, CREATEDRIVER_MAPPING_NONE);
}
-
+
RNA_enum_item_end(&item, &totitem);
-
+
*r_free = true;
return item;
}
@@ -811,7 +811,7 @@ static int add_driver_button_poll(bContext *C)
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
int index;
-
+
/* this operator can only run if there's a property button active, and it can be animated */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
return (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop));
@@ -824,28 +824,28 @@ static int add_driver_button_none(bContext *C, wmOperator *op, short mapping_typ
PropertyRNA *prop = NULL;
int index;
int success = 0;
-
+
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
-
+
if (mapping_type == CREATEDRIVER_MAPPING_NONE_ALL)
index = -1;
-
+
if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL);
short flags = CREATEDRIVER_WITH_DEFAULT_DVAR;
-
+
if (path) {
success += ANIM_add_driver(op->reports, ptr.id.data, path, index, flags, DRIVER_TYPE_PYTHON);
MEM_freeN(path);
}
}
-
+
if (success) {
/* send updates */
UI_context_update_anim_flag(C);
DAG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
-
+
return OPERATOR_FINISHED;
}
else {
@@ -863,10 +863,10 @@ static int add_driver_button_exec(bContext *C, wmOperator *op)
else {
/* Create Driver using Eyedropper */
wmOperatorType *ot = WM_operatortype_find("UI_OT_eyedropper_driver", true);
-
+
/* XXX: We assume that it's fine to use the same set of properties, since they're actually the same... */
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, op->ptr);
-
+
return OPERATOR_FINISHED;
}
}
@@ -875,7 +875,7 @@ static int add_driver_button_exec(bContext *C, wmOperator *op)
static int add_driver_button_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
PropertyRNA *prop;
-
+
if ((prop = RNA_struct_find_property(op->ptr, "mapping_type")) && RNA_property_is_set(op->ptr, prop)) {
/* Mapping Type is Set - Directly go into creating drivers */
return add_driver_button_exec(C, op);
@@ -894,18 +894,18 @@ void ANIM_OT_driver_button_add(wmOperatorType *ot)
ot->name = "Add Driver";
ot->idname = "ANIM_OT_driver_button_add";
ot->description = "Add driver(s) for the property(s) represented by the highlighted button";
-
+
/* callbacks */
/* NOTE: No exec, as we need all these to use the current context info
* (especially the eyedropper, which is interactive)
*/
ot->invoke = add_driver_button_invoke;
- ot->exec = add_driver_button_exec;
+ ot->exec = add_driver_button_exec;
ot->poll = add_driver_button_poll;
-
+
/* flags */
ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
-
+
/* properties */
ot->prop = RNA_def_enum(ot->srna, "mapping_type", prop_driver_create_mapping_types, 0,
"Mapping Type", "Method used to match target and driven properties");
@@ -921,30 +921,30 @@ static int remove_driver_button_exec(bContext *C, wmOperator *op)
short success = 0;
int index;
const bool all = RNA_boolean_get(op->ptr, "all");
-
+
/* try to find driver using property retrieved from UI */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
-
+
if (all)
index = -1;
-
+
if (ptr.id.data && ptr.data && prop) {
char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL);
-
+
if (path) {
success = ANIM_remove_driver(op->reports, ptr.id.data, path, index, 0);
MEM_freeN(path);
}
}
-
+
if (success) {
/* send updates */
UI_context_update_anim_flag(C);
DAG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
}
-
+
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -954,11 +954,11 @@ void ANIM_OT_driver_button_remove(wmOperatorType *ot)
ot->name = "Remove Driver";
ot->idname = "ANIM_OT_driver_button_remove";
ot->description = "Remove the driver(s) for the property(s) connected represented by the highlighted button";
-
+
/* callbacks */
- ot->exec = remove_driver_button_exec;
+ ot->exec = remove_driver_button_exec;
//op->poll = ??? // TODO: need to have some driver to be able to do this...
-
+
/* flags */
ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
@@ -974,23 +974,23 @@ static int copy_driver_button_exec(bContext *C, wmOperator *op)
PropertyRNA *prop = NULL;
short success = 0;
int index;
-
+
/* try to create driver using property retrieved from UI */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
-
+
if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL);
-
+
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);
-
+
UI_context_update_anim_flag(C);
-
+
MEM_freeN(path);
}
}
-
+
/* since we're just copying, we don't really need to do anything else...*/
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1001,11 +1001,11 @@ void ANIM_OT_copy_driver_button(wmOperatorType *ot)
ot->name = "Copy Driver";
ot->idname = "ANIM_OT_copy_driver_button";
ot->description = "Copy the driver for the highlighted button";
-
+
/* callbacks */
- ot->exec = copy_driver_button_exec;
+ ot->exec = copy_driver_button_exec;
//op->poll = ??? // TODO: need to have some driver to be able to do this...
-
+
/* flags */
ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
}
@@ -1018,28 +1018,28 @@ static int paste_driver_button_exec(bContext *C, wmOperator *op)
PropertyRNA *prop = NULL;
short success = 0;
int index;
-
+
/* try to create driver using property retrieved from UI */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
-
+
if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL);
-
+
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);
-
+
UI_context_update_anim_flag(C);
-
+
DAG_relations_tag_update(CTX_data_main(C));
DAG_id_tag_update(ptr.id.data, OB_RECALC_OB | OB_RECALC_DATA);
-
+
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL); // XXX
-
+
MEM_freeN(path);
}
}
-
+
/* since we're just copying, we don't really need to do anything else...*/
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1050,11 +1050,11 @@ void ANIM_OT_paste_driver_button(wmOperatorType *ot)
ot->name = "Paste Driver";
ot->idname = "ANIM_OT_paste_driver_button";
ot->description = "Paste the driver in the copy/paste buffer for the highlighted button";
-
+
/* callbacks */
- ot->exec = paste_driver_button_exec;
+ ot->exec = paste_driver_button_exec;
//op->poll = ??? // TODO: need to have some driver to be able to do this...
-
+
/* flags */
ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
}
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index fba18d148c8..951dcc2dddf 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -37,7 +37,7 @@
* Copy/Paste Buffer for F-Modifiers:
* For now, this is also defined in this file so that it can be shared between the
*/
-
+
#include <string.h>
#include "DNA_anim_types.h"
@@ -79,7 +79,7 @@ static void validate_fmodifier_cb(bContext *UNUSED(C), void *fcm_v, void *UNUSED
{
FModifier *fcm = (FModifier *)fcm_v;
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
-
+
/* call the verify callback on the modifier if applicable */
if (fmi && fmi->verify_data)
fmi->verify_data(fcm);
@@ -90,19 +90,19 @@ static void delete_fmodifier_cb(bContext *C, void *fmods_v, void *fcm_v)
{
ListBase *modifiers = (ListBase *)fmods_v;
FModifier *fcm = (FModifier *)fcm_v;
-
+
/* remove the given F-Modifier from the active modifier-stack */
remove_fmodifier(modifiers, fcm);
ED_undo_push(C, "Delete F-Curve Modifier");
-
+
/* send notifiers */
- // XXX for now, this is the only way to get updates in all the right places... but would be nice to have a special one in this case
+ // XXX for now, this is the only way to get updates in all the right places... but would be nice to have a special one in this case
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
/* --------------- */
-
+
/* draw settings for generator modifier */
static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width)
{
@@ -112,20 +112,20 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
uiBut *but;
PointerRNA ptr;
short bwidth = width - 1.5 * UI_UNIT_X; /* max button width */
-
+
/* init the RNA-pointer */
RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
-
+
/* basic settings (backdrop + mode selector + some padding) */
/* col = uiLayoutColumn(layout, true); */ /* UNUSED */
block = uiLayoutGetBlock(layout);
UI_block_align_begin(block);
but = uiDefButR(block, UI_BTYPE_MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL);
-
+
uiDefButR(block, UI_BTYPE_TOGGLE, B_FMODIFIER_REDRAW, NULL, 0, 0, bwidth, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL);
UI_block_align_end(block);
-
+
/* now add settings for individual modes */
switch (data->mode) {
case FCM_GENERATOR_POLYNOMIAL: /* polynomial expression */
@@ -135,7 +135,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
char xval[32];
unsigned int i;
int maxXWidth;
-
+
/* draw polynomial order selector */
row = uiLayoutRow(layout, false);
block = uiLayoutGetBlock(row);
@@ -143,8 +143,8 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
&data->poly_order, 1, 100, 0, 0,
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL);
-
-
+
+
/* calculate maximum width of label for "x^n" labels */
if (data->arraysize > 2) {
BLI_snprintf(xval, sizeof(xval), "x^%u", data->arraysize);
@@ -155,11 +155,11 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* basic size (just "x") */
maxXWidth = UI_fontstyle_string_width(fstyle, "x") + 0.5 * UI_UNIT_X;
}
-
+
/* draw controls for each coefficient and a + sign at end of row */
row = uiLayoutRow(layout, true);
block = uiLayoutGetBlock(row);
-
+
cp = data->coefficients;
for (i = 0; (i < data->arraysize) && (cp); i++, cp++) {
/* To align with first line... */
@@ -167,11 +167,11 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
uiDefBut(block, UI_BTYPE_LABEL, 1, " ", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
else
uiDefBut(block, UI_BTYPE_LABEL, 1, "y =", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-
+
/* coefficient */
uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, "", 0, 0, bwidth / 2, UI_UNIT_Y, cp, -UI_FLT_MAX, UI_FLT_MAX,
10, 3, TIP_("Coefficient for polynomial"));
-
+
/* 'x' param (and '+' if necessary) */
if (i == 0)
BLI_strncpy(xval, "", sizeof(xval));
@@ -180,10 +180,10 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
else
BLI_snprintf(xval, sizeof(xval), "x^%u", i);
uiDefBut(block, UI_BTYPE_LABEL, 1, xval, 0, 0, maxXWidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, TIP_("Power of x"));
-
+
if ( (i != (data->arraysize - 1)) || ((i == 0) && data->arraysize == 2) ) {
uiDefBut(block, UI_BTYPE_LABEL, 1, "+", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-
+
/* next coefficient on a new row */
row = uiLayoutRow(layout, true);
block = uiLayoutGetBlock(row);
@@ -195,12 +195,12 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
}
break;
}
-
+
case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* Factorized polynomial expression */
{
float *cp = NULL;
unsigned int i;
-
+
/* draw polynomial order selector */
row = uiLayoutRow(layout, false);
block = uiLayoutGetBlock(row);
@@ -208,12 +208,12 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
&data->poly_order, 1, 100, 0, 0,
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL);
-
-
+
+
/* draw controls for each pair of coefficients */
row = uiLayoutRow(layout, true);
block = uiLayoutGetBlock(row);
-
+
cp = data->coefficients;
for (i = 0; (i < data->poly_order) && (cp); i++, cp += 2) {
/* To align with first line */
@@ -223,25 +223,25 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
uiDefBut(block, UI_BTYPE_LABEL, 1, "y =", 0, 0, 2.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
/* opening bracket */
uiDefBut(block, UI_BTYPE_LABEL, 1, "(", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-
+
/* coefficients */
uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, "", 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, cp, -UI_FLT_MAX, UI_FLT_MAX,
10, 3, TIP_("Coefficient of x"));
-
+
uiDefBut(block, UI_BTYPE_LABEL, 1, "x +", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-
+
uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, "", 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, cp + 1, -UI_FLT_MAX, UI_FLT_MAX,
10, 3, TIP_("Second coefficient"));
-
+
/* closing bracket and multiplication sign */
if ( (i != (data->poly_order - 1)) || ((i == 0) && data->poly_order == 2) ) {
uiDefBut(block, UI_BTYPE_LABEL, 1, ") \xc3\x97", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-
+
/* set up new row for the next pair of coefficients */
row = uiLayoutRow(layout, true);
block = uiLayoutGetBlock(row);
}
- else
+ else
uiDefBut(block, UI_BTYPE_LABEL, 1, ") ", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
break;
@@ -256,10 +256,10 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm
{
uiLayout *col;
PointerRNA ptr;
-
+
/* init the RNA-pointer */
RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
-
+
/* add the settings */
col = uiLayoutColumn(layout, true);
uiItemR(col, &ptr, "function_type", 0, "", ICON_NONE);
@@ -279,21 +279,21 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor
{
uiLayout *split, *col;
PointerRNA ptr;
-
+
/* init the RNA-pointer */
RNA_pointer_create(id, &RNA_FModifierCycles, fcm, &ptr);
-
- /* split into 2 columns
+
+ /* split into 2 columns
* NOTE: the mode comboboxes shouldn't get labels, otherwise there isn't enough room
*/
split = uiLayoutSplit(layout, 0.5f, false);
-
+
/* before range */
col = uiLayoutColumn(split, true);
uiItemL(col, IFACE_("Before:"), ICON_NONE);
uiItemR(col, &ptr, "mode_before", 0, "", ICON_NONE);
uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NONE);
-
+
/* after range */
col = uiLayoutColumn(split, true);
uiItemL(col, IFACE_("After:"), ICON_NONE);
@@ -308,22 +308,22 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short
{
uiLayout *split, *col;
PointerRNA ptr;
-
+
/* init the RNA-pointer */
RNA_pointer_create(id, &RNA_FModifierNoise, fcm, &ptr);
-
+
/* blending mode */
uiItemR(layout, &ptr, "blend_type", 0, NULL, ICON_NONE);
-
+
/* split into 2 columns */
split = uiLayoutSplit(layout, 0.5f, false);
-
+
/* col 1 */
col = uiLayoutColumn(split, false);
uiItemR(col, &ptr, "scale", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "offset", 0, NULL, ICON_NONE);
-
+
/* col 2 */
col = uiLayoutColumn(split, false);
uiItemR(col, &ptr, "phase", 0, NULL, ICON_NONE);
@@ -337,46 +337,46 @@ static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(ar
FMod_Envelope *env = (FMod_Envelope *)fcm_dv;
FCM_EnvelopeData *fedn;
FCM_EnvelopeData fed;
-
+
/* init template data */
fed.min = -1.0f;
fed.max = 1.0f;
fed.time = (float)scene->r.cfra; // XXX make this int for ease of use?
fed.f1 = fed.f2 = 0;
-
+
/* check that no data exists for the current frame... */
if (env->data) {
bool exists;
int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
-
+
/* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */
if (exists)
return;
-
+
/* add new */
fedn = MEM_callocN((env->totvert + 1) * sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
-
+
/* add the points that should occur before the point to be pasted */
if (i > 0)
memcpy(fedn, env->data, i * sizeof(FCM_EnvelopeData));
-
+
/* add point to paste at index i */
*(fedn + i) = fed;
-
+
/* add the points that occur after the point to be pasted */
- if (i < env->totvert)
+ if (i < env->totvert)
memcpy(fedn + i + 1, env->data + i, (env->totvert - i) * sizeof(FCM_EnvelopeData));
-
+
/* replace (+ free) old with new */
MEM_freeN(env->data);
env->data = fedn;
-
+
env->totvert++;
}
else {
env->data = MEM_callocN(sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
*(env->data) = fed;
-
+
env->totvert = 1;
}
}
@@ -388,7 +388,7 @@ static void fmod_envelope_deletepoint_cb(bContext *UNUSED(C), void *fcm_dv, void
FMod_Envelope *env = (FMod_Envelope *)fcm_dv;
FCM_EnvelopeData *fedn;
int index = GET_INT_FROM_POINTER(ind_v);
-
+
/* check that no data exists for the current frame... */
if (env->totvert > 1) {
/* allocate a new smaller array */
@@ -396,7 +396,7 @@ static void fmod_envelope_deletepoint_cb(bContext *UNUSED(C), void *fcm_dv, void
memcpy(fedn, env->data, sizeof(FCM_EnvelopeData) * (index));
memcpy(fedn + index, env->data + (index + 1), sizeof(FCM_EnvelopeData) * ((env->totvert - index) - 1));
-
+
/* free old array, and set the new */
MEM_freeN(env->data);
env->data = fedn;
@@ -422,10 +422,10 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
uiBut *but;
PointerRNA ptr;
int i;
-
+
/* init the RNA-pointer */
RNA_pointer_create(id, &RNA_FModifierEnvelope, fcm, &ptr);
-
+
/* general settings */
col = uiLayoutColumn(layout, true);
uiItemL(col, IFACE_("Envelope:"), ICON_NONE);
@@ -440,24 +440,24 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
* the current way is far too cramped */
row = uiLayoutRow(layout, false);
block = uiLayoutGetBlock(row);
-
+
uiDefBut(block, UI_BTYPE_LABEL, 1, IFACE_("Control Points:"), 0, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-
+
but = uiDefBut(block, UI_BTYPE_BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y,
NULL, 0, 0, 0, 0, TIP_("Add a new control-point to the envelope on the current frame"));
UI_but_func_set(but, fmod_envelope_addpoint_cb, env, NULL);
-
+
/* control points list */
for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
/* get a new row to operate on */
row = uiLayoutRow(layout, true);
block = uiLayoutGetBlock(row);
-
+
UI_block_align_begin(block);
but = uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Fra:"), 0, 0, 4.5 * UI_UNIT_X, UI_UNIT_Y,
&fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, TIP_("Frame that envelope point occurs"));
UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL);
-
+
uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y,
&fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Minimum bound of envelope at this point"));
uiDefButF(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y,
@@ -477,40 +477,40 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
{
uiLayout *split, *col /* , *row */ /* UNUSED */;
PointerRNA ptr;
-
+
/* init the RNA-pointer */
RNA_pointer_create(id, &RNA_FModifierLimits, fcm, &ptr);
-
+
/* row 1: minimum */
{
/* row = uiLayoutRow(layout, false); */ /* UNUSED */
-
+
/* split into 2 columns */
split = uiLayoutSplit(layout, 0.5f, false);
-
+
/* x-minimum */
col = uiLayoutColumn(split, true);
uiItemR(col, &ptr, "use_min_x", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "min_x", 0, NULL, ICON_NONE);
-
+
/* y-minimum*/
col = uiLayoutColumn(split, true);
uiItemR(col, &ptr, "use_min_y", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "min_y", 0, NULL, ICON_NONE);
}
-
+
/* row 2: maximum */
{
/* row = uiLayoutRow(layout, false); */ /* UNUSED */
-
+
/* split into 2 columns */
split = uiLayoutSplit(layout, 0.5f, false);
-
+
/* x-minimum */
col = uiLayoutColumn(split, true);
uiItemR(col, &ptr, "use_max_x", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "max_x", 0, NULL, ICON_NONE);
-
+
/* y-minimum*/
col = uiLayoutColumn(split, true);
uiItemR(col, &ptr, "use_max_y", 0, NULL, ICON_NONE);
@@ -525,27 +525,27 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
{
uiLayout *col, *sub;
PointerRNA ptr;
-
+
/* init the RNA-pointer */
RNA_pointer_create(id, &RNA_FModifierStepped, fcm, &ptr);
-
+
/* block 1: "stepping" settings */
col = uiLayoutColumn(layout, false);
uiItemR(col, &ptr, "frame_step", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "frame_offset", 0, NULL, ICON_NONE);
-
+
/* block 2: start range settings */
col = uiLayoutColumn(layout, true);
uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE);
-
+
sub = uiLayoutColumn(col, true);
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start"));
uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE);
-
+
/* block 3: end range settings */
col = uiLayoutColumn(layout, true);
uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE);
-
+
sub = uiLayoutColumn(col, true);
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end"));
uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE);
@@ -561,125 +561,125 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
uiBut *but;
short width = 314;
PointerRNA ptr;
-
+
/* init the RNA-pointer */
RNA_pointer_create(id, &RNA_FModifier, fcm, &ptr);
-
+
/* draw header */
{
/* get layout-row + UI-block for this */
box = uiLayoutBox(layout);
-
+
row = uiLayoutRow(box, false);
block = uiLayoutGetBlock(row); // err...
-
+
/* left-align -------------------------------------------- */
sub = uiLayoutRow(row, true);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
-
+
/* expand */
uiItemR(sub, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-
+
/* checkbox for 'active' status (for now) */
uiItemR(sub, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-
+
/* name */
if (fmi)
uiItemL(sub, IFACE_(fmi->name), ICON_NONE);
else
uiItemL(sub, IFACE_("<Unknown Modifier>"), ICON_NONE);
-
+
/* right-align ------------------------------------------- */
sub = uiLayoutRow(row, true);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
-
-
+
+
/* 'mute' button */
uiItemR(sub, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
-
+
/* delete button */
but = uiDefIconBut(block, UI_BTYPE_BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete F-Curve Modifier"));
UI_but_func_set(but, delete_fmodifier_cb, modifiers, fcm);
-
+
UI_block_emboss_set(block, UI_EMBOSS);
}
-
+
/* when modifier is expanded, draw settings */
if (fcm->flag & FMODIFIER_FLAG_EXPANDED) {
/* set up the flexible-box layout which acts as the backdrop for the modifier settings */
box = uiLayoutBox(layout);
-
+
/* draw settings for individual modifiers */
switch (fcm->type) {
case FMODIFIER_TYPE_GENERATOR: /* Generator */
draw_modifier__generator(box, id, fcm, width);
break;
-
+
case FMODIFIER_TYPE_FN_GENERATOR: /* Built-In Function Generator */
draw_modifier__fn_generator(box, id, fcm, width);
break;
-
+
case FMODIFIER_TYPE_CYCLES: /* Cycles */
draw_modifier__cycles(box, id, fcm, width);
break;
-
+
case FMODIFIER_TYPE_ENVELOPE: /* Envelope */
draw_modifier__envelope(box, id, fcm, width);
break;
-
+
case FMODIFIER_TYPE_LIMITS: /* Limits */
draw_modifier__limits(box, id, fcm, width);
break;
-
+
case FMODIFIER_TYPE_NOISE: /* Noise */
draw_modifier__noise(box, id, fcm, width);
break;
-
+
case FMODIFIER_TYPE_STEPPED: /* Stepped */
draw_modifier__stepped(box, id, fcm, width);
break;
-
+
default: /* unknown type */
break;
}
-
+
/* one last panel below this: FModifier range */
// TODO: experiment with placement of this
{
box = uiLayoutBox(layout);
-
+
/* restricted range ----------------------------------------------------- */
col = uiLayoutColumn(box, true);
-
+
/* top row: use restricted range */
row = uiLayoutRow(col, true);
uiItemR(row, &ptr, "use_restricted_range", 0, NULL, ICON_NONE);
-
+
if (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) {
/* second row: settings */
row = uiLayoutRow(col, true);
-
+
uiItemR(row, &ptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
uiItemR(row, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
-
+
/* third row: blending influence */
row = uiLayoutRow(col, true);
-
+
uiItemR(row, &ptr, "blend_in", 0, IFACE_("In"), ICON_NONE);
uiItemR(row, &ptr, "blend_out", 0, IFACE_("Out"), ICON_NONE);
}
-
+
/* influence -------------------------------------------------------------- */
col = uiLayoutColumn(box, true);
-
+
/* top row: use influence */
uiItemR(col, &ptr, "use_influence", 0, NULL, ICON_NONE);
-
+
if (fcm->flag & FMODIFIER_FLAG_USEINFLUENCE) {
/* second row: influence value */
uiItemR(col, &ptr, "influence", 0, NULL, ICON_NONE);
@@ -710,15 +710,15 @@ void ANIM_fmodifiers_copybuf_free(void)
bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active)
{
bool ok = true;
-
+
/* sanity checks */
if (ELEM(NULL, modifiers, modifiers->first))
return 0;
-
+
/* copy the whole list, or just the active one? */
if (active) {
FModifier *fcm = find_active_fmodifier(modifiers);
-
+
if (fcm) {
FModifier *fcmN = copy_fmodifier(fcm);
BLI_addtail(&fmodifier_copypaste_buf, fcmN);
@@ -728,44 +728,44 @@ bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active)
}
else
copy_fmodifiers(&fmodifier_copypaste_buf, modifiers);
-
+
/* did we succeed? */
return ok;
}
-/* 'Paste' the F-Modifier(s) from the buffer to the specified list
+/* 'Paste' the F-Modifier(s) from the buffer to the specified list
* - replace: free all the existing modifiers to leave only the pasted ones
*/
bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace, FCurve *curve)
{
FModifier *fcm;
bool ok = false;
-
+
/* sanity checks */
if (modifiers == NULL)
return 0;
-
+
bool was_cyclic = curve && BKE_fcurve_is_cyclic(curve);
/* if replacing the list, free the existing modifiers */
if (replace)
free_fmodifiers(modifiers);
-
+
/* now copy over all the modifiers in the buffer to the end of the list */
for (fcm = fmodifier_copypaste_buf.first; fcm; fcm = fcm->next) {
/* make a copy of it */
FModifier *fcmN = copy_fmodifier(fcm);
fcmN->curve = curve;
-
+
/* make sure the new one isn't active, otherwise the list may get several actives */
fcmN->flag &= ~FMODIFIER_FLAG_ACTIVE;
-
+
/* now add it to the end of the list */
BLI_addtail(modifiers, fcmN);
ok = 1;
}
-
+
/* adding or removing the Cycles modifier requires an update to handles */
if (curve && BKE_fcurve_is_cyclic(curve) != was_cyclic)
calchandles_fcurve(curve);
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index f25dbf2381c..6e786873950 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -71,10 +71,10 @@ short compare_ak_cfraPtr(void *node, void *data)
ActKeyColumn *ak = (ActKeyColumn *)node;
const float *cframe = data;
float val = *cframe;
-
+
if (IS_EQT(val, ak->cfra, BEZT_BINARYSEARCH_THRESH))
return 0;
-
+
if (val < ak->cfra)
return -1;
else if (val > ak->cfra)
@@ -90,7 +90,7 @@ static short compare_ak_bezt(void *node, void *data)
{
ActKeyColumn *ak = (ActKeyColumn *)node;
BezTriple *bezt = (BezTriple *)data;
-
+
if (bezt->vec[1][0] < ak->cfra)
return -1;
else if (bezt->vec[1][0] > ak->cfra)
@@ -104,15 +104,15 @@ static DLRBT_Node *nalloc_ak_bezt(void *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 = BEZT_ISSEL_ANY(bezt) ? SELECT : 0;
ak->key_type = BEZKEYTYPE(bezt);
-
+
/* set 'modified', since this is used to identify long keyframes */
ak->modified = 1;
-
+
return (DLRBT_Node *)ak;
}
@@ -121,11 +121,11 @@ static void nupdate_ak_bezt(void *node, void *data)
{
ActKeyColumn *ak = (ActKeyColumn *)node;
BezTriple *bezt = (BezTriple *)data;
-
+
/* set selection status and 'touched' status */
if (BEZT_ISSEL_ANY(bezt)) ak->sel = SELECT;
ak->modified += 1;
-
+
/* 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;
@@ -138,7 +138,7 @@ static short compare_ak_gpframe(void *node, void *data)
{
ActKeyColumn *ak = (ActKeyColumn *)node;
bGPDframe *gpf = (bGPDframe *)data;
-
+
if (gpf->framenum < ak->cfra)
return -1;
else if (gpf->framenum > ak->cfra)
@@ -152,15 +152,15 @@ static DLRBT_Node *nalloc_ak_gpframe(void *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->key_type = gpf->key_type;
-
+
/* set 'modified', since this is used to identify long keyframes */
ak->modified = 1;
-
+
return (DLRBT_Node *)ak;
}
@@ -169,11 +169,11 @@ static void nupdate_ak_gpframe(void *node, void *data)
{
ActKeyColumn *ak = (ActKeyColumn *)node;
bGPDframe *gpf = (bGPDframe *)data;
-
+
/* set selection status and 'touched' status */
if (gpf->flag & GP_FRAME_SELECT) ak->sel = SELECT;
ak->modified += 1;
-
+
/* for keyframe type, 'proper' keyframes have priority over breakdowns (and other types for now) */
if (gpf->key_type == BEZT_KEYTYPE_KEYFRAME)
ak->key_type = BEZT_KEYTYPE_KEYFRAME;
@@ -261,7 +261,7 @@ short compare_ab_cfraPtr(void *node, void *data)
ActKeyBlock *ab = (ActKeyBlock *)node;
const float *cframe = data;
float val = *cframe;
-
+
if (val < ab->start)
return -1;
else if (val > ab->start)
@@ -276,17 +276,17 @@ short compare_ab_cfraPtr(void *node, void *data)
static ActKeyBlock *bezts_to_new_actkeyblock(BezTriple *prev, BezTriple *beztn)
{
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->sel = (BEZT_ISSEL_ANY(prev) || BEZT_ISSEL_ANY(beztn)) ? SELECT : 0;
ab->modified = 1;
-
+
if (BEZKEYTYPE(beztn) == BEZT_KEYTYPE_MOVEHOLD)
ab->flag |= ACTKEYBLOCK_FLAG_MOVING_HOLD;
-
+
return ab;
}
@@ -294,25 +294,25 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, BezTriple *first_bezt
{
ActKeyBlock *new_ab = NULL;
BezTriple *prev = NULL;
-
+
/* get the BezTriple immediately before the given one which has the same value */
if (beztn != first_bezt) {
- /* XXX: Unless I'm overlooking some details from the past, this should be sufficient?
+ /* XXX: Unless I'm overlooking some details from the past, this should be sufficient?
* The old code did some elaborate stuff trying to find keyframe columns for
* the given BezTriple, then step backwards to the column before that, and find
* an appropriate BezTriple with matching values there. Maybe that was warranted
- * in the past, but now, that list is only ever filled with keyframes from the
+ * in the past, but now, that list is only ever filled with keyframes from the
* current FCurve.
*
* -- Aligorith (20140415)
*/
prev = beztn - 1;
}
-
-
+
+
/* check if block needed */
if (prev == NULL) return;
-
+
if (BEZKEYTYPE(beztn) == BEZT_KEYTYPE_MOVEHOLD) {
/* Animator tagged a "moving hold"
* - Previous key must also be tagged as a moving hold, otherwise
@@ -328,11 +328,11 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, BezTriple *first_bezt
* - Handles which control that section of the curve must be constant
*/
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 */
@@ -341,7 +341,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, BezTriple *first_bezt
}
else {
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 perform a tree traversal here NOT a standard linked-list traversal...
* Note: we can't search from end to try to optimize this as it causes errors there's
@@ -352,32 +352,32 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, BezTriple *first_bezt
// A|------------------------------------------------|A
// A|----|A|---|A|-----------------------------------|A
for (ab = blocks->root; ab; ab = abn) {
- /* check if this is a match, or whether we go left or right
+ /* check if this is a match, or whether we go left or right
* NOTE: we now use a float threshold to prevent precision errors causing problems with summaries
*/
if (IS_EQT(ab->start, prev->vec[1][0], BEZT_BINARYSEARCH_THRESH)) {
/* set selection status and 'touched' status */
if (BEZT_ISSEL_ANY(beztn))
ab->sel = SELECT;
-
+
/* XXX: only when the first one was a moving hold? */
if (BEZKEYTYPE(beztn) == BEZT_KEYTYPE_MOVEHOLD)
ab->flag |= ACTKEYBLOCK_FLAG_MOVING_HOLD;
-
+
ab->modified++;
-
+
/* done... no need to insert */
return;
}
else {
ActKeyBlock **abnp = NULL; /* branch to go down - used to hook new blocks to parents */
-
+
/* check if go left or right, but if not available, add new node */
- if (ab->start < prev->vec[1][0])
+ if (ab->start < prev->vec[1][0])
abnp = &ab->right;
else
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 */
@@ -391,7 +391,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, BezTriple *first_bezt
}
}
}
-
+
/* now, balance the tree taking into account this newly added node */
BLI_dlrbTree_insert(blocks, (DLRBT_Node *)new_ab);
}
@@ -404,13 +404,13 @@ static void set_touched_actkeycolumn(ActKeyColumn *ak)
/* sanity check */
if (ak == NULL)
return;
-
+
/* deal with self first */
if (ak->modified) {
ak->modified = 0;
ak->totcurve++;
}
-
+
/* children */
set_touched_actkeycolumn(ak->left);
set_touched_actkeycolumn(ak->right);
@@ -422,13 +422,13 @@ static void set_touched_actkeyblock(ActKeyBlock *ab)
/* sanity check */
if (ab == NULL)
return;
-
+
/* deal with self first */
if (ab->modified) {
ab->modified = 0;
ab->totcurve++;
}
-
+
/* children */
set_touched_actkeyblock(ab->left);
set_touched_actkeyblock(ab->right);
@@ -441,22 +441,22 @@ bool actkeyblock_is_valid(ActKeyBlock *ab, DLRBT_Tree *keys)
{
ActKeyColumn *ak;
short startCurves, endCurves, totCurves;
-
+
/* check that block is valid */
if (ab == NULL)
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->end);
endCurves = (ak) ? ak->totcurve : 0;
-
+
/* only draw keyblock if it appears in at all of the keyframes at lowest end */
- if (!startCurves && !endCurves)
+ if (!startCurves && !endCurves)
return 0;
-
+
totCurves = (startCurves > endCurves) ? endCurves : startCurves;
return (ab->totcurve >= totCurves);
}
@@ -469,19 +469,19 @@ static const float _unit_diamond_shape[4][2] = {
{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;
-
+
/* initialize 2 display lists for diamond shape - one empty, one filled */
if (displist1 == 0) {
displist1 = glGenLists(1);
glNewList(displist1, GL_COMPILE);
-
+
glBegin(GL_LINE_LOOP);
glVertex2fv(_unit_diamond_shape[0]);
glVertex2fv(_unit_diamond_shape[1]);
@@ -494,7 +494,7 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
if (displist2 == 0) {
displist2 = glGenLists(1);
glNewList(displist2, GL_COMPILE);
-
+
glBegin(GL_QUADS);
glVertex2fv(_unit_diamond_shape[0]);
glVertex2fv(_unit_diamond_shape[1]);
@@ -504,43 +504,43 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
glEndList();
}
-
- /* tweak size of keyframe shape according to type of keyframe
+
+ /* tweak size of keyframe shape according to type of keyframe
* - 'proper' keyframes have key_type = 0, so get drawn at full size
*/
switch (key_type) {
case BEZT_KEYTYPE_KEYFRAME: /* must be full size */
break;
-
+
case BEZT_KEYTYPE_BREAKDOWN: /* slightly smaller than normal keyframe */
hsize *= 0.85f;
break;
-
+
case BEZT_KEYTYPE_MOVEHOLD: /* slightly smaller than normal keyframes (but by less than for breakdowns) */
//hsize *= 0.72f;
hsize *= 0.95f;
break;
-
+
case BEZT_KEYTYPE_EXTREME: /* slightly larger */
hsize *= 1.2f;
break;
-
+
default:
hsize -= 0.5f * key_type;
break;
}
-
+
/* adjust view transform before starting */
glTranslatef(x, y, 0.0f);
glScalef(1.0f / xscale * hsize, hsize, 1.0f);
-
+
/* anti-aliased lines for more consistent appearance */
glEnable(GL_LINE_SMOOTH);
-
+
/* draw! */
if (ELEM(mode, KEYFRAME_SHAPE_INSIDE, KEYFRAME_SHAPE_BOTH)) {
float inner_col[4];
-
+
/* get interior colors from theme (for selected and unselected only) */
switch (key_type) {
case BEZT_KEYTYPE_BREAKDOWN: /* bluish frames (default theme) */
@@ -566,7 +566,7 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
/* XXX: Should these get their own theme options instead? */
if (sel) UI_GetThemeColorShade4fv(TH_STRIP_SELECT, 35, inner_col);
else UI_GetThemeColorShade4fv(TH_STRIP, 50, inner_col);
-
+
inner_col[3] = 1.0f; /* full opacity, to avoid problems with visual glitches */
break;
}
@@ -578,32 +578,32 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
break;
}
}
-
- /* NOTE: we don't use the straight alpha from the theme, or else effects such as
+
+ /* NOTE: we don't use the straight alpha from the theme, or else effects such as
* graying out protected/muted channels doesn't work correctly!
*/
inner_col[3] *= alpha;
glColor4fv(inner_col);
-
+
/* draw the "filled in" interior poly now */
glCallList(displist2);
}
-
+
if (ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH)) {
float border_col[4];
-
+
/* exterior - black frame */
if (sel) UI_GetThemeColor4fv(TH_KEYBORDER_SELECT, border_col);
else UI_GetThemeColor4fv(TH_KEYBORDER, border_col);
-
+
border_col[3] *= alpha;
glColor4fv(border_col);
-
+
glCallList(displist1);
}
-
+
glDisable(GL_LINE_SMOOTH);
-
+
/* restore view transform */
glScalef(xscale / hsize, 1.0f / hsize, 1.0f);
glTranslatef(-x, -y, 0.0f);
@@ -615,36 +615,36 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
ActKeyBlock *ab;
float alpha;
float xscale;
-
+
const float iconsize = (U.widget_unit / 4.0f) * yscale_fac;
const float mhsize = iconsize * 0.7f;
-
+
glEnable(GL_BLEND);
-
+
/* get View2D scaling factor */
UI_view2d_scale_get(v2d, &xscale, NULL);
-
+
/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
/* TODO: allow this opacity factor to be themed? */
alpha = (channelLocked) ? 0.25f : 1.0f;
-
+
/* draw keyblocks */
if (blocks) {
float sel_color[4], unsel_color[4];
float sel_mhcol[4], unsel_mhcol[4];
-
+
/* cache colours first */
UI_GetThemeColor4fv(TH_STRIP_SELECT, sel_color);
UI_GetThemeColor4fv(TH_STRIP, unsel_color);
-
+
sel_color[3] *= alpha;
unsel_color[3] *= alpha;
-
+
copy_v4_v4(sel_mhcol, sel_color);
sel_mhcol[3] *= 0.8f;
copy_v4_v4(unsel_mhcol, unsel_color);
unsel_mhcol[3] *= 0.8f;
-
+
/* NOTE: the tradeoff for changing colors between each draw is dwarfed by the cost of checking validity */
for (ab = blocks->first; ab; ab = ab->next) {
if (actkeyblock_is_valid(ab, keys)) {
@@ -654,7 +654,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
glColor4fv(sel_mhcol);
else
glColor4fv(unsel_mhcol);
-
+
glRectf(ab->start, ypos - mhsize, ab->end, ypos + mhsize);
}
else {
@@ -663,13 +663,13 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
glColor4fv(sel_color);
else
glColor4fv(unsel_color);
-
+
glRectf(ab->start, ypos - iconsize, ab->end, ypos + iconsize);
}
}
}
}
-
+
/* draw keys */
if (keys) {
for (ak = keys->first; ak; ak = ak->next) {
@@ -678,7 +678,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
*/
if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax) == 0)
continue;
-
+
/* draw using OpenGL - uglier but faster */
/* NOTE1: a previous version of this didn't work nice for some intel cards
* NOTE2: if we wanted to go back to icons, these are icon = (ak->sel & SELECT) ? ICON_SPACE2 : ICON_SPACE3; */
@@ -694,17 +694,17 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
void draw_summary_channel(View2D *v2d, bAnimContext *ac, float ypos, float yscale_fac)
{
DLRBT_Tree keys, blocks;
-
+
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
-
+
summary_to_keylist(ac, &keys, &blocks);
-
+
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
-
+
draw_keylist(v2d, &keys, &blocks, ypos, yscale_fac, false);
-
+
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
}
@@ -712,17 +712,17 @@ void draw_summary_channel(View2D *v2d, bAnimContext *ac, float ypos, float yscal
void draw_scene_channel(View2D *v2d, bDopeSheet *ads, Scene *sce, float ypos, float yscale_fac)
{
DLRBT_Tree keys, blocks;
-
+
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
-
+
scene_to_keylist(ads, sce, &keys, &blocks);
-
+
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
-
+
draw_keylist(v2d, &keys, &blocks, ypos, yscale_fac, false);
-
+
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
}
@@ -730,17 +730,17 @@ void draw_scene_channel(View2D *v2d, bDopeSheet *ads, Scene *sce, float ypos, fl
void draw_object_channel(View2D *v2d, bDopeSheet *ads, Object *ob, float ypos, float yscale_fac)
{
DLRBT_Tree keys, blocks;
-
+
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
-
+
ob_to_keylist(ads, ob, &keys, &blocks);
-
+
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
-
+
draw_keylist(v2d, &keys, &blocks, ypos, yscale_fac, false);
-
+
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
}
@@ -748,21 +748,21 @@ void draw_object_channel(View2D *v2d, bDopeSheet *ads, Object *ob, float ypos, f
void draw_fcurve_channel(View2D *v2d, AnimData *adt, FCurve *fcu, float ypos, float yscale_fac)
{
DLRBT_Tree keys, blocks;
-
+
bool locked = (fcu->flag & FCURVE_PROTECTED) ||
((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ||
((adt && adt->action) && ID_IS_LINKED(adt->action));
-
+
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
-
+
fcurve_to_keylist(adt, fcu, &keys, &blocks);
-
+
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
-
+
draw_keylist(v2d, &keys, &blocks, ypos, yscale_fac, locked);
-
+
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
}
@@ -770,20 +770,20 @@ void draw_fcurve_channel(View2D *v2d, AnimData *adt, FCurve *fcu, float ypos, fl
void draw_agroup_channel(View2D *v2d, AnimData *adt, bActionGroup *agrp, float ypos, float yscale_fac)
{
DLRBT_Tree keys, blocks;
-
+
bool locked = (agrp->flag & AGRP_PROTECTED) ||
((adt && adt->action) && ID_IS_LINKED(adt->action));
-
+
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
-
+
agroup_to_keylist(adt, agrp, &keys, &blocks);
-
+
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
-
+
draw_keylist(v2d, &keys, &blocks, ypos, yscale_fac, locked);
-
+
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
}
@@ -791,19 +791,19 @@ void draw_agroup_channel(View2D *v2d, AnimData *adt, bActionGroup *agrp, float y
void draw_action_channel(View2D *v2d, AnimData *adt, bAction *act, float ypos, float yscale_fac)
{
DLRBT_Tree keys, blocks;
-
+
bool locked = (act && ID_IS_LINKED(act));
-
+
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
-
+
action_to_keylist(adt, act, &keys, &blocks);
-
+
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
-
+
draw_keylist(v2d, &keys, &blocks, ypos, yscale_fac, locked);
-
+
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
}
@@ -811,49 +811,49 @@ void draw_action_channel(View2D *v2d, AnimData *adt, bAction *act, float ypos, f
void draw_gpencil_channel(View2D *v2d, bDopeSheet *ads, bGPdata *gpd, float ypos, float yscale_fac)
{
DLRBT_Tree keys;
-
+
BLI_dlrbTree_init(&keys);
-
+
gpencil_to_keylist(ads, gpd, &keys);
-
+
BLI_dlrbTree_linkedlist_sync(&keys);
-
+
draw_keylist(v2d, &keys, NULL, ypos, yscale_fac, false);
-
+
BLI_dlrbTree_free(&keys);
}
void draw_gpl_channel(View2D *v2d, bDopeSheet *ads, bGPDlayer *gpl, float ypos, float yscale_fac)
{
DLRBT_Tree keys;
-
+
bool locked = (gpl->flag & GP_LAYER_LOCKED) != 0;
-
+
BLI_dlrbTree_init(&keys);
-
+
gpl_to_keylist(ads, gpl, &keys);
-
+
BLI_dlrbTree_linkedlist_sync(&keys);
-
+
draw_keylist(v2d, &keys, NULL, ypos, yscale_fac, locked);
-
+
BLI_dlrbTree_free(&keys);
}
void draw_masklay_channel(View2D *v2d, bDopeSheet *ads, MaskLayer *masklay, float ypos, float yscale_fac)
{
DLRBT_Tree keys;
-
+
bool locked = (masklay->flag & MASK_LAYERFLAG_LOCKED) != 0;
-
+
BLI_dlrbTree_init(&keys);
-
+
mask_to_keylist(ads, masklay, &keys);
-
+
BLI_dlrbTree_linkedlist_sync(&keys);
-
+
draw_keylist(v2d, &keys, NULL, ypos, yscale_fac, locked);
-
+
BLI_dlrbTree_free(&keys);
}
@@ -865,11 +865,11 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, DLRBT_Tree *blocks)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* get F-Curves to take keyframes from */
filter = ANIMFILTER_DATA_VISIBLE;
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) {
/* Why not use all #eAnim_KeyType here?
@@ -892,7 +892,7 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, DLRBT_Tree *blocks)
break;
}
}
-
+
ANIM_animdata_freelist(&anim_data);
}
}
@@ -903,66 +903,66 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, DLRBT_Tree *keys, DLRBT_Tree
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
bAnimListElem dummychan = {NULL};
-
+
if (sce == NULL)
return;
-
+
/* create a dummy wrapper data to work with */
dummychan.type = ANIMTYPE_SCENE;
dummychan.data = sce;
dummychan.id = &sce->id;
dummychan.adt = sce->adt;
-
+
ac.ads = ads;
ac.data = &dummychan;
ac.datatype = ANIMCONT_CHANNEL;
-
+
/* get F-Curves to take keyframes from */
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)
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
-
+
ANIM_animdata_freelist(&anim_data);
}
void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *blocks)
-{
+{
bAnimContext ac = {NULL};
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
bAnimListElem dummychan = {NULL};
Base dummybase = {NULL};
-
+
if (ob == NULL)
return;
-
+
/* create a dummy wrapper data to work with */
dummybase.object = ob;
-
+
dummychan.type = ANIMTYPE_OBJECT;
dummychan.data = &dummybase;
dummychan.id = &ob->id;
dummychan.adt = ob->adt;
-
+
ac.ads = ads;
ac.data = &dummychan;
ac.datatype = ANIMCONT_CHANNEL;
-
+
/* get F-Curves to take keyframes from */
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)
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
-
+
ANIM_animdata_freelist(&anim_data);
}
@@ -1006,19 +1006,19 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree
/* apply NLA-mapping (if applicable) */
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0);
-
+
/* loop through beztriples, making ActKeysColumns and ActKeyBlocks */
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, fcu->bezt, bezt);
}
-
+
/* update the number of curves that elements have appeared in */
if (keys)
set_touched_actkeycolumn(keys->root);
if (blocks)
set_touched_actkeyblock(blocks->root);
-
+
/* unapply NLA-mapping if applicable */
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0);
@@ -1053,7 +1053,7 @@ void action_to_keylist(AnimData *adt, bAction *act, DLRBT_Tree *keys, DLRBT_Tree
void gpencil_to_keylist(bDopeSheet *ads, bGPdata *gpd, DLRBT_Tree *keys)
{
bGPDlayer *gpl;
-
+
if (gpd && keys) {
/* for now, just aggregate out all the frames, but only for visible layers */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
@@ -1067,7 +1067,7 @@ void gpencil_to_keylist(bDopeSheet *ads, bGPdata *gpd, DLRBT_Tree *keys)
void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys)
{
bGPDframe *gpf;
-
+
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)
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 4e42229e50d..6b24008c4d8 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -73,11 +73,11 @@
/* --------------------------- Base Functions ------------------------------------ */
-/* This function is used to loop over BezTriples in the given F-Curve, applying a given
+/* This function is used to loop over BezTriples in the given F-Curve, applying a given
* operation on them, and optionally applies an F-Curve validation function afterwards.
*/
// TODO: make this function work on samples too...
-short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
+short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
{
BezTriple *bezt;
short ok = 0;
@@ -96,7 +96,7 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
/* if function to apply to bezier curves is set, then loop through executing it on beztriples */
if (key_cb) {
- /* if there's a validation func, include that check in the loop
+ /* if there's a validation func, include that check in the loop
* (this is should be more efficient than checking for it in every loop)
*/
if (key_ok) {
@@ -106,11 +106,11 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
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;
-
+
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
@@ -121,7 +121,7 @@ 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;
-
+
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
@@ -129,7 +129,7 @@ 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;
@@ -140,7 +140,7 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
/* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
if (fcu_cb)
fcu_cb(fcu);
-
+
/* done */
return 0;
}
@@ -151,17 +151,17 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
static short agrp_keyframes_loop(KeyframeEditData *ked, bActionGroup *agrp, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
{
FCurve *fcu;
-
+
/* sanity check */
if (agrp == NULL)
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) {
if (ANIM_fcurve_keyframes_loop(ked, fcu, key_ok, key_cb, fcu_cb))
return 1;
}
-
+
return 0;
}
@@ -169,17 +169,17 @@ static short agrp_keyframes_loop(KeyframeEditData *ked, bActionGroup *agrp, Keyf
static short act_keyframes_loop(KeyframeEditData *ked, bAction *act, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
{
FCurve *fcu;
-
+
/* sanity check */
if (act == NULL)
return 0;
-
+
/* just loop through all F-Curves */
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
if (ANIM_fcurve_keyframes_loop(ked, fcu, key_ok, key_cb, fcu_cb))
return 1;
}
-
+
return 0;
}
@@ -191,29 +191,29 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o
bAnimListElem *ale;
int filter;
int ret = 0;
-
+
bAnimListElem dummychan = {NULL};
Base dummybase = {NULL};
-
+
if (ob == NULL)
return 0;
-
+
/* create a dummy wrapper data to work with */
dummybase.object = ob;
-
+
dummychan.type = ANIMTYPE_OBJECT;
dummychan.data = &dummybase;
dummychan.id = &ob->id;
dummychan.adt = ob->adt;
-
+
ac.ads = ads;
ac.data = &dummychan;
ac.datatype = ANIMCONT_CHANNEL;
-
+
/* get F-Curves to take keyframes from */
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)) {
@@ -221,9 +221,9 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o
break;
}
}
-
+
ANIM_animdata_freelist(&anim_data);
-
+
/* return return code - defaults to zero if nothing happened */
return ret;
}
@@ -236,26 +236,26 @@ static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene
bAnimListElem *ale;
int filter;
int ret = 0;
-
+
bAnimListElem dummychan = {NULL};
-
+
if (sce == NULL)
return 0;
-
+
/* create a dummy wrapper data to work with */
dummychan.type = ANIMTYPE_SCENE;
dummychan.data = sce;
dummychan.id = &sce->id;
dummychan.adt = sce->adt;
-
+
ac.ads = ads;
ac.data = &dummychan;
ac.datatype = ANIMCONT_CHANNEL;
-
+
/* get F-Curves to take keyframes from */
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)) {
@@ -263,9 +263,9 @@ static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene
break;
}
}
-
+
ANIM_animdata_freelist(&anim_data);
-
+
/* return return code - defaults to zero if nothing happened */
return ret;
}
@@ -276,22 +276,22 @@ static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, Key
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter, ret_code = 0;
-
+
/* sanity check */
if (ac == NULL)
return 0;
-
+
/* get F-Curves to take keyframes from */
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) {
switch (ale->datatype) {
case ALE_MASKLAY:
case ALE_GPFRAME:
break;
-
+
case ALE_FCURVE:
default:
{
@@ -301,19 +301,19 @@ static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, Key
*/
float f1 = ked->f1;
float f2 = ked->f2;
-
+
if (ked->iterflags & (KED_F1_NLA_UNMAP | KED_F2_NLA_UNMAP)) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
+
if (ked->iterflags & KED_F1_NLA_UNMAP)
ked->f1 = BKE_nla_tweakedit_remap(adt, f1, NLATIME_CONVERT_UNMAP);
if (ked->iterflags & KED_F2_NLA_UNMAP)
ked->f2 = BKE_nla_tweakedit_remap(adt, f2, NLATIME_CONVERT_UNMAP);
}
-
+
/* now operate on the channel as per normal */
ret_code = ANIM_fcurve_keyframes_loop(ked, ale->data, key_ok, key_cb, fcu_cb);
-
+
/* reset */
ked->f1 = f1;
ked->f2 = f2;
@@ -325,13 +325,13 @@ static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, Key
break;
}
}
-
+
if (ret_code)
break;
}
-
+
ANIM_animdata_freelist(&anim_data);
-
+
return ret_code;
}
@@ -343,21 +343,21 @@ short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, bA
/* sanity checks */
if (ale == NULL)
return 0;
-
+
/* method to use depends on the type of keyframe data */
switch (ale->datatype) {
/* direct keyframe data (these loops are exposed) */
case ALE_FCURVE: /* F-Curve */
return ANIM_fcurve_keyframes_loop(ked, ale->key_data, key_ok, key_cb, fcu_cb);
-
- /* indirect 'summaries' (these are not exposed directly)
+
+ /* indirect 'summaries' (these are not exposed directly)
* NOTE: must keep this code in sync with the drawing code and also the filtering code!
*/
case ALE_GROUP: /* action group */
return agrp_keyframes_loop(ked, (bActionGroup *)ale->data, key_ok, key_cb, fcu_cb);
case ALE_ACT: /* action */
return act_keyframes_loop(ked, (bAction *)ale->key_data, key_ok, key_cb, fcu_cb);
-
+
case ALE_OB: /* object */
return ob_keyframes_loop(ked, ads, (Object *)ale->key_data, key_ok, key_cb, fcu_cb);
case ALE_SCE: /* scene */
@@ -365,7 +365,7 @@ short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, bA
case ALE_ALL: /* 'all' (DopeSheet summary) */
return summary_keyframes_loop(ked, (bAnimContext *)ale->data, key_ok, key_cb, fcu_cb);
}
-
+
return 0;
}
@@ -375,21 +375,21 @@ short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads
/* sanity checks */
if (data == NULL)
return 0;
-
+
/* method to use depends on the type of keyframe data */
switch (keytype) {
/* direct keyframe data (these loops are exposed) */
case ALE_FCURVE: /* F-Curve */
return ANIM_fcurve_keyframes_loop(ked, data, key_ok, key_cb, fcu_cb);
-
- /* indirect 'summaries' (these are not exposed directly)
+
+ /* indirect 'summaries' (these are not exposed directly)
* NOTE: must keep this code in sync with the drawing code and also the filtering code!
*/
case ALE_GROUP: /* action group */
return agrp_keyframes_loop(ked, (bActionGroup *)data, key_ok, key_cb, fcu_cb);
case ALE_ACT: /* action */
return act_keyframes_loop(ked, (bAction *)data, key_ok, key_cb, fcu_cb);
-
+
case ALE_OB: /* object */
return ob_keyframes_loop(ked, ads, (Object *)data, key_ok, key_cb, fcu_cb);
case ALE_SCE: /* scene */
@@ -397,7 +397,7 @@ short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads
case ALE_ALL: /* 'all' (DopeSheet summary) */
return summary_keyframes_loop(ked, (bAnimContext *)data, key_ok, key_cb, fcu_cb);
}
-
+
return 0;
}
@@ -411,20 +411,20 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac)
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
-
+
/* filter animation data */
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;
-
+
/* make sure keyframes in F-Curve are all in order, and handles are in valid positions */
sort_time_fcurve(fcu);
calchandles_fcurve(fcu);
}
-
+
/* free temp data */
ANIM_animdata_freelist(&anim_data);
}
@@ -435,7 +435,7 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac)
/* ------------------------ */
/* Some macros to make this easier... */
-/* run the given check on the 3 handles
+/* run the given check on the 3 handles
* - check should be a macro, which takes the handle index as its single arg, which it substitutes later
* - requires that a var, of type short, is named 'ok', and has been initialized to 0
*/
@@ -454,16 +454,16 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac)
} (void)0
/* ------------------------ */
-
+
static short ok_bezier_frame(KeyframeEditData *ked, BezTriple *bezt)
{
short ok = 0;
-
+
/* 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);
#undef KEY_CHECK_OK
-
+
/* return ok flags */
return ok;
}
@@ -471,19 +471,19 @@ static short ok_bezier_frame(KeyframeEditData *ked, BezTriple *bezt)
static short ok_bezier_framerange(KeyframeEditData *ked, BezTriple *bezt)
{
short ok = 0;
-
+
/* 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);
#undef KEY_CHECK_OK
-
+
/* return ok flags */
return ok;
}
static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
- /* this macro checks all beztriple handles for selection...
+ /* this macro checks all beztriple handles for selection...
* only one of the verts has to be selected for this to be ok...
*/
if (BEZT_ISSEL_ANY(bezt))
@@ -493,17 +493,17 @@ static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
}
static short ok_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
-{
+{
short ok = 0;
-
- /* value is stored in f1 property
+
+ /* value is stored in f1 property
* - this float accuracy check may need to be dropped?
* - 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);
#undef KEY_CHECK_OK
-
+
/* return ok flags */
return ok;
}
@@ -511,12 +511,12 @@ static short ok_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
static short ok_bezier_valuerange(KeyframeEditData *ked, BezTriple *bezt)
{
short ok = 0;
-
+
/* 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);
#undef KEY_CHECK_OK
-
+
/* return ok flags */
return ok;
}
@@ -526,15 +526,15 @@ static short ok_bezier_region(KeyframeEditData *ked, BezTriple *bezt)
/* rect is stored in data property (it's of type rectf, but may not be set) */
if (ked->data) {
short ok = 0;
-
+
#define KEY_CHECK_OK(_index) BLI_rctf_isect_pt_v(ked->data, bezt->vec[_index])
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
#undef KEY_CHECK_OK
-
+
/* return ok flags */
return ok;
}
- else
+ else
return 0;
}
@@ -547,9 +547,9 @@ bool keyframe_region_lasso_test(
{
if (BLI_rctf_isect_pt_v(data_lasso->rectf_scaled, xy)) {
float xy_view[2];
-
+
BLI_rctf_transform_pt_v(data_lasso->rectf_view, data_lasso->rectf_scaled, xy_view, xy);
-
+
if (BLI_lasso_is_point_inside(data_lasso->mcords, data_lasso->mcords_tot, xy_view[0], xy_view[1], INT_MAX)) {
return true;
}
@@ -563,11 +563,11 @@ static short ok_bezier_region_lasso(KeyframeEditData *ked, BezTriple *bezt)
/* check for lasso customdata (KeyframeEdit_LassoData) */
if (ked->data) {
short ok = 0;
-
+
#define KEY_CHECK_OK(_index) keyframe_region_lasso_test(ked->data, bezt->vec[_index])
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
#undef KEY_CHECK_OK
-
+
/* return ok flags */
return ok;
}
@@ -581,7 +581,7 @@ static short ok_bezier_channel_lasso(KeyframeEditData *ked, BezTriple *bezt)
if (ked->data) {
KeyframeEdit_LassoData *data = ked->data;
float pt[2];
-
+
/* late-binding remap of the x values (for summary channels) */
/* XXX: Ideally we reset, but it should be fine just leaving it as-is
* as the next channel will reset it properly, while the next summary-channel
@@ -591,11 +591,11 @@ static short ok_bezier_channel_lasso(KeyframeEditData *ked, BezTriple *bezt)
data->rectf_scaled->xmin = ked->f1;
data->rectf_scaled->xmax = ked->f2;
}
-
+
/* only use the x-coordinate of the point; the y is the channel range... */
pt[0] = bezt->vec[1][0];
pt[1] = ked->channel_y;
-
+
if (keyframe_region_lasso_test(data, pt))
return KEYFRAME_OK_KEY;
}
@@ -611,14 +611,14 @@ bool keyframe_region_circle_test(
{
if (BLI_rctf_isect_pt_v(data_circle->rectf_scaled, xy)) {
float xy_view[2];
-
+
BLI_rctf_transform_pt_v(data_circle->rectf_view, data_circle->rectf_scaled, xy_view, xy);
-
+
xy_view[0] = xy_view[0] - data_circle->mval[0];
xy_view[1] = xy_view[1] - data_circle->mval[1];
return len_squared_v2(xy_view) < data_circle->radius_squared;
}
-
+
return false;
}
@@ -628,11 +628,11 @@ static short ok_bezier_region_circle(KeyframeEditData *ked, BezTriple *bezt)
/* check for circle select customdata (KeyframeEdit_CircleData) */
if (ked->data) {
short ok = 0;
-
+
#define KEY_CHECK_OK(_index) keyframe_region_circle_test(ked->data, bezt->vec[_index])
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
#undef KEY_CHECK_OK
-
+
/* return ok flags */
return ok;
}
@@ -646,7 +646,7 @@ static short ok_bezier_channel_circle(KeyframeEditData *ked, BezTriple *bezt)
if (ked->data) {
KeyframeEdit_CircleData *data = ked->data;
float pt[2];
-
+
/* late-binding remap of the x values (for summary channels) */
/* XXX: Ideally we reset, but it should be fine just leaving it as-is
* as the next channel will reset it properly, while the next summary-channel
@@ -656,11 +656,11 @@ static short ok_bezier_channel_circle(KeyframeEditData *ked, BezTriple *bezt)
data->rectf_scaled->xmin = ked->f1;
data->rectf_scaled->xmax = ked->f2;
}
-
+
/* only use the x-coordinate of the point; the y is the channel range... */
pt[0] = bezt->vec[1][0];
pt[1] = ked->channel_y;
-
+
if (keyframe_region_circle_test(data, pt))
return KEYFRAME_OK_KEY;
}
@@ -707,16 +707,16 @@ short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
if (bezt->f2 & SELECT) {
/* store average time in float 1 (only do rounding at last step) */
ked->f1 += bezt->vec[1][0];
-
- /* store average value in float 2 (only do rounding at last step)
+
+ /* store average value in float 2 (only do rounding at last step)
* - this isn't always needed, but some operators may also require this
*/
ked->f2 += bezt->vec[1][1];
-
+
/* increment number of items */
ked->i1++;
}
-
+
return 0;
}
@@ -727,10 +727,10 @@ short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
if (bezt->f2 & SELECT) {
CfraElem *ce = MEM_callocN(sizeof(CfraElem), "cfraElem");
BLI_addtail(&ked->list, ce);
-
+
ce->cfra = bezt->vec[1][0];
}
-
+
return 0;
}
@@ -741,10 +741,10 @@ void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt)
{
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;
@@ -766,7 +766,7 @@ static short snap_bezier_nearestsec(KeyframeEditData *ked, BezTriple *bezt)
{
const Scene *scene = ked->scene;
const float secf = (float)FPS;
-
+
if (bezt->f2 & SELECT)
bezt->vec[1][0] = (floorf(bezt->vec[1][0] / secf + 0.5f) * secf);
return 0;
@@ -794,7 +794,7 @@ static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *be
{
if (bezt->f2 & SELECT) {
bezt->vec[0][1] = bezt->vec[2][1] = bezt->vec[1][1];
-
+
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h1 = HD_ALIGN;
if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h2 = HD_ALIGN;
}
@@ -871,11 +871,11 @@ static void mirror_bezier_yaxis_ex(BezTriple *bezt, const float center)
static short mirror_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt)
{
const Scene *scene = ked->scene;
-
+
if (bezt->f2 & SELECT) {
mirror_bezier_xaxis_ex(bezt, CFRA);
}
-
+
return 0;
}
@@ -885,7 +885,7 @@ static short mirror_bezier_yaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
/* Yes, names are inverted, we are mirroring accross y axis, hence along x axis... */
mirror_bezier_xaxis_ex(bezt, 0.0f);
}
-
+
return 0;
}
@@ -895,7 +895,7 @@ static short mirror_bezier_xaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
/* Yes, names are inverted, we are mirroring accross x axis, hence along y axis... */
mirror_bezier_yaxis_ex(bezt, 0.0f);
}
-
+
return 0;
}
@@ -905,7 +905,7 @@ static short mirror_bezier_marker(KeyframeEditData *ked, BezTriple *bezt)
if (bezt->f2 & SELECT) {
mirror_bezier_xaxis_ex(bezt, ked->f1);
}
-
+
return 0;
}
@@ -915,7 +915,7 @@ static short mirror_bezier_time(KeyframeEditData *ked, BezTriple *bezt)
if (bezt->f2 & SELECT) {
mirror_bezier_xaxis_ex(bezt, ked->f1);
}
-
+
return 0;
}
@@ -925,7 +925,7 @@ static short mirror_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
if (bezt->f2 & SELECT) {
mirror_bezier_yaxis_ex(bezt, ked->f1);
}
-
+
return 0;
}
@@ -941,7 +941,7 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
case MIRROR_KEYS_XAXIS: /* mirror over value 0 */
return mirror_bezier_xaxis;
case MIRROR_KEYS_MARKER: /* mirror over marker */
- return mirror_bezier_marker;
+ return mirror_bezier_marker;
case MIRROR_KEYS_TIME: /* mirror over frame/time */
return mirror_bezier_time;
case MIRROR_KEYS_VALUE: /* mirror over given value */
@@ -966,12 +966,12 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
} (void)0
/* Sets the selected bezier handles to type 'auto' */
-static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+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;
-
+
ENSURE_HANDLES_MATCH(bezt);
}
return 0;
@@ -980,19 +980,19 @@ static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
/* Sets the selected bezier handles to type 'auto-clamped'
* NOTE: this is like auto above, but they're handled a bit different
*/
-static short set_bezier_auto_clamped(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;
-
+
ENSURE_HANDLES_MATCH(bezt);
}
return 0;
}
/* Sets the selected bezier handles to type 'vector' */
-static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+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;
@@ -1002,7 +1002,7 @@ static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
/* Queries if the handle should be set to 'free' or 'align' */
// NOTE: this was used for the 'toggle free/align' option
// currently this isn't used, but may be restored later
-static short bezier_isfree(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short bezier_isfree(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if ((bezt->f1 & SELECT) && (bezt->h1)) return 1;
if ((bezt->f3 & SELECT) && (bezt->h2)) return 1;
@@ -1010,15 +1010,15 @@ 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)
-{
+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;
return 0;
}
/* Sets selected bezier handles to type 'free' */
-static short set_bezier_free(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+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;
@@ -1034,14 +1034,14 @@ KeyframeEditFunc ANIM_editkeyframes_handles(short code)
return set_bezier_auto;
case HD_AUTO_ANIM: /* auto clamped */
return set_bezier_auto_clamped;
-
+
case HD_VECT: /* vector */
return set_bezier_vector;
case HD_FREE: /* free */
return set_bezier_free;
case HD_ALIGN: /* align */
return set_bezier_align;
-
+
default: /* check for toggle free or align? */
return bezier_isfree;
}
@@ -1049,23 +1049,23 @@ KeyframeEditFunc ANIM_editkeyframes_handles(short code)
/* ------- */
-static short set_bezt_constant(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short set_bezt_constant(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
- if (bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
bezt->ipo = BEZT_IPO_CONST;
return 0;
}
-static short set_bezt_linear(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short set_bezt_linear(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
- if (bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
bezt->ipo = BEZT_IPO_LIN;
return 0;
}
-static short set_bezt_bezier(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short set_bezt_bezier(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
- if (bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
bezt->ipo = BEZT_IPO_BEZ;
return 0;
}
@@ -1150,7 +1150,7 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code)
return set_bezt_constant;
case BEZT_IPO_LIN: /* linear */
return set_bezt_linear;
-
+
/* easing */
case BEZT_IPO_BACK:
return set_bezt_back;
@@ -1172,7 +1172,7 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code)
return set_bezt_quint;
case BEZT_IPO_SINE:
return set_bezt_sine;
-
+
default: /* bezier */
return set_bezt_bezier;
}
@@ -1180,37 +1180,37 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code)
/* ------- */
-static short set_keytype_keyframe(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short set_keytype_keyframe(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
- if (bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt) = BEZT_KEYTYPE_KEYFRAME;
return 0;
}
-static short set_keytype_breakdown(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short set_keytype_breakdown(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
- if (bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt) = BEZT_KEYTYPE_BREAKDOWN;
return 0;
}
-static short set_keytype_extreme(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short set_keytype_extreme(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
- if (bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt) = BEZT_KEYTYPE_EXTREME;
return 0;
}
-static short set_keytype_jitter(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short set_keytype_jitter(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
- if (bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt) = BEZT_KEYTYPE_JITTER;
return 0;
}
-static short set_keytype_moving_hold(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short set_keytype_moving_hold(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
- if (bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt) = BEZT_KEYTYPE_MOVEHOLD;
return 0;
}
@@ -1221,16 +1221,16 @@ KeyframeEditFunc ANIM_editkeyframes_keytype(short code)
switch (code) {
case BEZT_KEYTYPE_BREAKDOWN: /* breakdown */
return set_keytype_breakdown;
-
+
case BEZT_KEYTYPE_EXTREME: /* extreme keyframe */
return set_keytype_extreme;
-
+
case BEZT_KEYTYPE_JITTER: /* jitter keyframe */
return set_keytype_jitter;
-
+
case BEZT_KEYTYPE_MOVEHOLD: /* moving hold */
return set_keytype_moving_hold;
-
+
case BEZT_KEYTYPE_KEYFRAME: /* proper keyframe */
default:
return set_keytype_keyframe;
@@ -1273,13 +1273,13 @@ KeyframeEditFunc ANIM_editkeyframes_easing(short mode)
switch (mode) {
case BEZT_IPO_EASE_IN: /* ease in */
return set_easingtype_easein;
-
+
case BEZT_IPO_EASE_OUT: /* ease out */
return set_easingtype_easeout;
-
+
case BEZT_IPO_EASE_IN_OUT: /* both */
return set_easingtype_easeinout;
-
+
default: /* auto */
return set_easingtype_easeauto;
}
@@ -1288,7 +1288,7 @@ KeyframeEditFunc ANIM_editkeyframes_easing(short mode)
/* ******************************************* */
/* Selection */
-static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt)
+static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt)
{
/* if we've got info on what to select, use it, otherwise select all */
if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) {
@@ -1302,11 +1302,11 @@ static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt)
else {
BEZT_SEL_ALL(bezt);
}
-
+
return 0;
}
-static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt)
+static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt)
{
/* if we've got info on what to deselect, use it, otherwise deselect all */
if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) {
@@ -1320,11 +1320,11 @@ static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt)
else {
BEZT_DESEL_ALL(bezt);
}
-
+
return 0;
}
-static short select_bezier_invert(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+static short select_bezier_invert(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
/* Invert the selection for the whole bezier triple */
bezt->f2 ^= SELECT;
@@ -1369,33 +1369,33 @@ static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt)
FCurve *fcu = ked->fcu;
char *map = ked->data;
int i = ked->curIndex;
-
+
/* if current is selected, just make sure it stays this way */
if (BEZT_ISSEL_ANY(bezt)) {
map[i] = 1;
return 0;
}
-
+
/* if previous is selected, that means that selection should extend across */
if (i > 0) {
BezTriple *prev = bezt - 1;
-
+
if (BEZT_ISSEL_ANY(prev)) {
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 (BEZT_ISSEL_ANY(next)) {
map[i] = 1;
return 0;
}
}
-
+
return 0;
}
@@ -1404,7 +1404,7 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
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)
*/
@@ -1412,7 +1412,7 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
/* if previous is not selected, we're on the tip of an iceberg */
if (i > 0) {
BezTriple *prev = bezt - 1;
-
+
if (BEZT_ISSEL_ANY(prev) == 0)
return 0;
}
@@ -1420,11 +1420,11 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
/* current keyframe is selected at an endpoint, so should get deselected */
return 0;
}
-
+
/* if next is not selected, we're on the tip of an iceberg */
if (i < (fcu->totvert - 1)) {
BezTriple *next = bezt + 1;
-
+
if (BEZT_ISSEL_ANY(next) == 0)
return 0;
}
@@ -1432,11 +1432,11 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
/* 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;
}
-
+
return 0;
}
@@ -1446,7 +1446,7 @@ KeyframeEditFunc ANIM_editkeyframes_buildselmap(short mode)
switch (mode) {
case SELMAP_LESS: /* less */
return selmap_build_bezier_less;
-
+
case SELMAP_MORE: /* more */
default:
return selmap_build_bezier_more;
@@ -1460,7 +1460,7 @@ short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt)
{
const char *map = ked->data;
short on = map[ked->curIndex];
-
+
/* select or deselect based on whether the map allows it or not */
if (on) {
BEZT_SEL_ALL(bezt);
@@ -1468,7 +1468,7 @@ short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt)
else {
BEZT_DESEL_ALL(bezt);
}
-
+
return 0;
}
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 7d5fbeb7e3b..f8af504f1ed 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -68,19 +68,19 @@
*
* - Joshua Leung, Dec 2008
*/
-
+
/* **************************************************** */
-/* Only delete the nominated keyframe from provided F-Curve.
+/* Only delete the nominated keyframe from provided F-Curve.
* Not recommended to be used many times successively. For that
* there is delete_fcurve_keys().
*/
void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc)
{
/* sanity check */
- if (fcu == NULL)
+ if (fcu == NULL)
return;
-
+
/* verify the index:
* 1) cannot be greater than the number of available keyframes
* 2) negative indices are for specifying a value from the end of the array
@@ -89,7 +89,7 @@ void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc)
return;
else if (index < 0)
index += fcu->totvert;
-
+
/* Delete this keyframe */
memmove(&fcu->bezt[index], &fcu->bezt[index + 1], sizeof(BezTriple) * (fcu->totvert - index - 1));
fcu->totvert--;
@@ -99,7 +99,7 @@ void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc)
MEM_freeN(fcu->bezt);
fcu->bezt = NULL;
}
-
+
/* recalc handles - only if it won't cause problems */
if (do_recalc)
calchandles_fcurve(fcu);
@@ -110,7 +110,7 @@ bool delete_fcurve_keys(FCurve *fcu)
{
int i;
bool changed = false;
-
+
if (fcu->bezt == NULL) /* ignore baked curves */
return false;
@@ -123,7 +123,7 @@ bool delete_fcurve_keys(FCurve *fcu)
changed = true;
}
}
-
+
/* Free the array of BezTriples if there are not keyframes */
if (fcu->totvert == 0)
clear_fcurve_keys(fcu);
@@ -148,30 +148,30 @@ void duplicate_fcurve_keys(FCurve *fcu)
{
BezTriple *newbezt;
int i;
-
+
/* this can only work when there is an F-Curve, and also when there are some BezTriples */
if (ELEM(NULL, fcu, fcu->bezt))
return;
-
+
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");
-
+
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;
-
+
/* Unselect the current key */
BEZT_DESEL_ALL(&fcu->bezt[i]);
i++;
-
+
/* Select the copied key */
BEZT_SEL_ALL(&fcu->bezt[i]);
}
@@ -189,7 +189,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo
BezTriple *old_bezts, *bezt, *beztn;
BezTriple *lastb;
int totCount, i;
-
+
/* check if any points */
if ((fcu == NULL) || (fcu->bezt == NULL) || (fcu->totvert == 0) ||
(!cleardefault && fcu->totvert == 1))
@@ -202,7 +202,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo
totCount = fcu->totvert;
fcu->bezt = NULL;
fcu->totvert = 0;
-
+
/* now insert first keyframe, as it should be ok */
bezt = old_bezts;
insert_vert_fcurve(fcu, bezt->vec[1][0], bezt->vec[1][1], BEZKEYTYPE(bezt), 0);
@@ -210,8 +210,8 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo
lastb = fcu->bezt;
lastb->f1 = lastb->f2 = lastb->f3 = 0;
}
-
- /* Loop through BezTriples, comparing them. Skip any that do
+
+ /* Loop through BezTriples, comparing them. Skip any that do
* not fit the criteria for "ok" points.
*/
for (i = 1; i < totCount; i++) {
@@ -228,22 +228,22 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo
}
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];
cur[0] = bezt->vec[1][0]; cur[1] = bezt->vec[1][1];
-
+
if (!(bezt->f2 & SELECT)) {
insert_vert_fcurve(fcu, cur[0], cur[1], BEZKEYTYPE(bezt), 0);
lastb = (fcu->bezt + (fcu->totvert - 1));
lastb->f1 = lastb->f2 = lastb->f3 = 0;
continue;
}
-
+
/* check if current bezt occurs at same time as last ok */
if (IS_EQT(cur[0], prev[0], thresh)) {
- /* If there is a next beztriple, and if occurs at the same time, only insert
- * if there is a considerable distance between the points, and also if the
+ /* If there is a next beztriple, and if occurs at the same time, only insert
+ * if there is a considerable distance between the points, and also if the
* current is further away than the next one is to the previous.
*/
if (beztn && (IS_EQT(cur[0], next[0], thresh)) &&
@@ -287,7 +287,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo
}
}
}
-
+
/* now free the memory used by the old BezTriples */
if (old_bezts)
MEM_freeN(old_bezts);
@@ -346,14 +346,14 @@ void smooth_fcurve(FCurve *fcu)
if (BEZT_ISSEL_ANY(bezt))
totSel++;
}
-
+
/* if any points were selected, allocate tSmooth_Bezt points to work on */
if (totSel >= 3) {
tSmooth_Bezt *tarray, *tsb;
-
+
/* allocate memory in one go */
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++) {
@@ -362,7 +362,7 @@ void smooth_fcurve(FCurve *fcu)
tsb->h1 = &bezt->vec[0][1];
tsb->h2 = &bezt->vec[1][1];
tsb->h3 = &bezt->vec[2][1];
-
+
/* advance to the next tsb to populate */
if (x < totSel - 1)
tsb++;
@@ -370,15 +370,15 @@ void smooth_fcurve(FCurve *fcu)
break;
}
}
-
+
/* 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
*/
-
- /* round 1: calculate smoothing deltas and new values */
+
+ /* round 1: calculate smoothing deltas and new values */
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) */
@@ -387,21 +387,21 @@ void smooth_fcurve(FCurve *fcu)
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 float p1 = *tP1->h2;
const float p2 = (tP2) ? (*tP2->h2) : (*tP1->h2);
const float c1 = *tsb->h2;
const float n1 = *tN1->h2;
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->y2 = (tsb->y1 + tsb->y3) / 2;
}
}
-
+
/* round 2: apply new values */
tsb = tarray;
for (i = 0; i < totSel; i++, tsb++) {
@@ -409,17 +409,17 @@ void smooth_fcurve(FCurve *fcu)
if (ELEM(i, 0, (totSel - 1)) == 0) {
/* y2 takes the average of the 2 points */
*tsb->h2 = tsb->y2;
-
+
/* handles are weighted between their original values and the averaged values */
- *tsb->h1 = ((*tsb->h1) * 0.7f) + (tsb->y1 * 0.3f);
+ *tsb->h1 = ((*tsb->h1) * 0.7f) + (tsb->y1 * 0.3f);
*tsb->h3 = ((*tsb->h3) * 0.7f) + (tsb->y3 * 0.3f);
}
}
-
+
/* free memory required for tarray */
MEM_freeN(tarray);
}
-
+
/* recalculate handles */
calchandles_fcurve(fcu);
}
@@ -442,7 +442,7 @@ void sample_fcurve(FCurve *fcu)
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++) {
/* check if selected, and which end this is */
@@ -459,39 +459,39 @@ void sample_fcurve(FCurve *fcu)
continue;
}
}
-
+
/* set end */
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]));
-
+
if (range) {
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);
}
-
+
/* add keyframes with these, tagging as 'breakdowns' */
for (n = 1, fp = value_cache; n < range && fp; n++, fp++) {
insert_vert_fcurve(fcu, fp->frame, fp->val, BEZT_KEYTYPE_BREAKDOWN, 1);
}
-
+
/* free temp cache */
MEM_freeN(value_cache);
-
+
/* as we added keyframes, we need to compensate so that bezt is at the right place */
bezt = fcu->bezt + i + range - 1;
i += (range - 1);
}
-
+
/* the current selection island has ended, so start again from scratch */
start = NULL;
end = NULL;
@@ -503,14 +503,14 @@ void sample_fcurve(FCurve *fcu)
}
}
}
-
+
/* recalculate channel's handles? */
calchandles_fcurve(fcu);
}
/* **************************************************** */
/* Copy/Paste Tools */
-/* - The copy/paste buffer currently stores a set of temporary F-Curves containing only the keyframes
+/* - The copy/paste buffer currently stores a set of temporary F-Curves containing only the keyframes
* that were selected in each of the original F-Curves
* - All pasted frames are offset by the same amount. This is calculated as the difference in the times of
* the current frame and the 'first keyframe' (i.e. the earliest one in all channels).
@@ -526,12 +526,12 @@ 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 */
-
+
int totvert; /* number of keyframes stored for this channel */
BezTriple *bezt; /* keyframes in buffer */
@@ -544,23 +544,23 @@ typedef struct tAnimCopybufItem {
void ANIM_fcurves_copybuf_free(void)
{
tAnimCopybufItem *aci, *acn;
-
+
/* free each buffer element */
for (aci = animcopybuf.first; aci; aci = acn) {
acn = aci->next;
-
+
/* free keyframes */
- if (aci->bezt)
+ if (aci->bezt)
MEM_freeN(aci->bezt);
-
+
/* free RNA-path */
if (aci->rna_path)
MEM_freeN(aci->rna_path);
-
+
/* free ourself */
BLI_freelinkN(&animcopybuf, aci);
}
-
+
/* restore initial state */
BLI_listbase_clear(&animcopybuf);
animcopy_firstframe = 999999999.0f;
@@ -571,27 +571,27 @@ void ANIM_fcurves_copybuf_free(void)
/* This function adds data to the keyframes copy/paste buffer, freeing existing data first */
short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
-{
+{
bAnimListElem *ale;
Scene *scene = ac->scene;
-
+
/* clear buffer first */
ANIM_fcurves_copybuf_free();
-
+
/* assume that each of these is an F-Curve */
for (ale = anim_data->first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
tAnimCopybufItem *aci;
BezTriple *bezt, *nbezt, *newbuf;
int i;
-
+
/* firstly, check if F-Curve has any selected keyframes
* - skip if no selected keyframes found (so no need to create unnecessary copy-buffer data)
* - this check should also eliminate any problems associated with using sample-data
*/
if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, ANIM_editkeyframes_ok(BEZT_OK_SELECTED), NULL) == 0)
continue;
-
+
/* init copybuf item info */
aci = MEM_callocN(sizeof(tAnimCopybufItem), "AnimCopybufItem");
aci->id = ale->id;
@@ -599,7 +599,7 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
aci->grp = fcu->grp;
aci->rna_path = MEM_dupallocN(fcu->rna_path);
aci->array_index = fcu->array_index;
-
+
/* detect if this is a bone. We do that here rather than during pasting because ID pointers will get invalidated if we undo.
* storing the relevant information here helps avoiding crashes if we undo-repaste */
if ((aci->id_type == ID_OB) && (((Object *)aci->id)->type == OB_ARMATURE) && aci->rna_path) {
@@ -614,9 +614,9 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
}
if (bone_name) MEM_freeN(bone_name);
}
-
+
BLI_addtail(&animcopybuf, aci);
-
+
/* add selected keyframes to buffer */
/* TODO: currently, we resize array every time we add a new vert -
* this works ok as long as it is assumed only a few keys are copied */
@@ -624,23 +624,23 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
if (BEZT_ISSEL_ANY(bezt)) {
/* add to buffer */
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));
-
+
/* copy current beztriple across too */
nbezt = &newbuf[aci->totvert];
*nbezt = *bezt;
-
+
/* ensure copy buffer is selected so pasted keys are selected */
BEZT_SEL_ALL(nbezt);
-
+
/* free old array and set the new */
if (aci->bezt) MEM_freeN(aci->bezt);
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];
@@ -648,9 +648,9 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
animcopy_lastframe = bezt->vec[1][0];
}
}
-
+
}
-
+
/* check if anything ended up in the buffer */
if (ELEM(NULL, animcopybuf.first, animcopybuf.last))
return -1;
@@ -740,7 +740,7 @@ static tAnimCopybufItem *pastebuf_match_path_property(FCurve *fcu, const short f
* more involved since it needs to to path lookups.
* This is not 100% reliable since the user could be editing the curves on a path that wont
* resolve, or a bone could be renamed after copying for eg. but in normal copy & paste
- * this should work out ok.
+ * this should work out ok.
*/
if (BLI_findindex(which_libbase(G.main, aci->id_type), aci->id) == -1) {
/* pedantic but the ID could have been removed, and beats crashing! */
@@ -749,9 +749,9 @@ static tAnimCopybufItem *pastebuf_match_path_property(FCurve *fcu, const short f
else {
PointerRNA id_ptr, rptr;
PropertyRNA *prop;
-
+
RNA_id_pointer_create(aci->id, &id_ptr);
-
+
if (RNA_path_resolve_property(&id_ptr, aci->rna_path, &rptr, &prop)) {
const char *identifier = RNA_property_identifier(prop);
int len_id = strlen(identifier);
@@ -804,7 +804,7 @@ static void do_curve_mirror_flippping(tAnimCopybufItem *aci, BezTriple *bezt)
flip = true;
else if (BLI_strn_endswith(aci->rna_path, "rotation_axis_angle", slength) && ELEM(aci->array_index, 2, 3))
flip = true;
-
+
if (flip) {
bezt->vec[0][1] = -bezt->vec[0][1];
bezt->vec[1][1] = -bezt->vec[1][1];
@@ -829,18 +829,18 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float
case KEYFRAME_PASTE_MERGE_MIX:
/* do-nothing */
break;
-
+
case KEYFRAME_PASTE_MERGE_OVER:
/* remove all keys */
clear_fcurve_keys(fcu);
break;
-
+
case KEYFRAME_PASTE_MERGE_OVER_RANGE:
case KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL:
{
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;
@@ -849,7 +849,7 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float
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 */
@@ -858,39 +858,39 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float
bezt->f2 |= SELECT;
}
}
-
+
/* remove frames in the range */
delete_fcurve_keys(fcu);
}
break;
}
}
-
+
/* just start pasting, with the first keyframe on the current frame, and so on */
for (i = 0, bezt = aci->bezt; i < aci->totvert; i++, bezt++) {
/* temporarily apply offset to src beztriple while copying */
if (flip)
do_curve_mirror_flippping(aci, bezt);
-
+
bezt->vec[0][0] += offset;
bezt->vec[1][0] += offset;
bezt->vec[2][0] += offset;
-
+
/* insert the keyframe
* NOTE: we do not want to inherit handles from existing keyframes in this case!
*/
-
+
insert_bezt_fcurve(fcu, bezt, INSERTKEY_OVERWRITE_FULL);
-
+
/* un-apply offset from src beztriple after copying */
bezt->vec[0][0] -= offset;
bezt->vec[1][0] -= offset;
bezt->vec[2][0] -= offset;
-
+
if (flip)
do_curve_mirror_flippping(aci, bezt);
}
-
+
/* recalculate F-Curve's handles? */
calchandles_fcurve(fcu);
}
@@ -921,12 +921,12 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode, bool flip)
{
bAnimListElem *ale;
-
+
const Scene *scene = (ac->scene);
-
+
const bool from_single = BLI_listbase_is_single(&animcopybuf);
const bool to_simple = BLI_listbase_is_single(anim_data);
-
+
float offset = 0.0f;
int pass;
@@ -940,7 +940,7 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
BKE_report(ac->reports, RPT_ERROR, "No selected F-Curves to paste into");
return -1;
}
-
+
/* methods of offset */
switch (offset_mode) {
case KEYFRAME_PASTE_OFFSET_CFRA_START:
@@ -961,25 +961,25 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
/* 1:1 match, no tricky checking, just paste */
FCurve *fcu;
tAnimCopybufItem *aci;
-
+
ale = anim_data->first;
fcu = (FCurve *)ale->data; /* destination F-Curve */
aci = animcopybuf.first;
-
+
paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode, false);
ale->update |= ANIM_UPDATE_DEFAULT;
}
else {
- /* from selected channels
+ /* 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.
*/
for (pass = 0; pass < 3; pass++) {
unsigned int totmatch = 0;
-
+
for (ale = anim_data->first; ale; ale = ale->next) {
- /* find buffer item to paste from
+ /* 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)
@@ -987,28 +987,28 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
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, flip);
break;
-
+
case 1:
/* less strict, just compare property names */
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);
break;
}
-
+
/* copy the relevant data from the matching buffer curve */
if (aci) {
totmatch++;
-
+
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode, flip);
@@ -1018,16 +1018,16 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
paste_animedit_keys_fcurve(fcu, aci, offset, merge_mode, flip);
}
}
-
+
ale->update |= ANIM_UPDATE_DEFAULT;
}
-
+
/* don't continue if some fcurves were pasted */
if (totmatch)
break;
}
}
-
+
ANIM_animdata_update(ac, anim_data);
return 0;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 7fb540e2c1b..0bb35dcbf3e 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -29,7 +29,7 @@
* \ingroup edanimation
*/
-
+
#include <stdio.h>
#include <stddef.h>
#include <string.h>
@@ -91,42 +91,42 @@
short ANIM_get_keyframing_flags(Scene *scene, short incl_mode)
{
eInsertKeyFlags flag = INSERTKEY_NOFLAGS;
-
+
/* standard flags */
{
/* visual keying */
- if (IS_AUTOKEY_FLAG(scene, AUTOMATKEY))
+ if (IS_AUTOKEY_FLAG(scene, AUTOMATKEY))
flag |= INSERTKEY_MATRIX;
-
+
/* only needed */
- if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED))
+ if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED))
flag |= INSERTKEY_NEEDED;
-
+
/* default F-Curve color mode - RGB from XYZ indices */
- if (IS_AUTOKEY_FLAG(scene, XYZ2RGB))
+ if (IS_AUTOKEY_FLAG(scene, XYZ2RGB))
flag |= INSERTKEY_XYZ2RGB;
}
-
+
/* only if including settings from the autokeying mode... */
if (incl_mode) {
/* keyframing mode - only replace existing keyframes */
- if (IS_AUTOKEY_MODE(scene, EDITKEYS))
+ if (IS_AUTOKEY_MODE(scene, EDITKEYS))
flag |= INSERTKEY_REPLACE;
}
-
+
return flag;
}
/* ******************************************* */
/* Animation Data Validation */
-/* Get (or add relevant data to be able to do so) the Active Action for the given
+/* Get (or add relevant data to be able to do so) the Active Action for the given
* Animation Data block, given an ID block where the Animation Data should reside.
*/
bAction *verify_adt_action(ID *id, short add)
{
AnimData *adt;
-
+
/* init animdata if none available yet */
adt = BKE_animdata_from_id(id);
if ((adt == NULL) && (add))
@@ -143,10 +143,10 @@ bAction *verify_adt_action(ID *id, short add)
/* init action name from name of ID block */
char actname[sizeof(id->name) - 2];
BLI_snprintf(actname, sizeof(actname), "%sAction", id->name + 2);
-
+
/* create action */
adt->action = BKE_action_add(G.main, actname);
-
+
/* set ID-type from ID-block that this is going to be assigned to
* so that users can't accidentally break actions by assigning them
* to the wrong places
@@ -157,59 +157,59 @@ bAction *verify_adt_action(ID *id, short add)
/* XXX: we probably should have bmain passed down, but that involves altering too many API's */
DAG_relations_tag_update(G.main);
}
-
+
/* return the action */
return adt->action;
}
-/* Get (or add relevant data to be able to do so) F-Curve from the Active Action,
+/* Get (or add relevant data to be able to do so) F-Curve from the Active Action,
* for the given Animation Data block. This assumes that all the destinations are valid.
*/
-FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr,
+FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr,
const char rna_path[], const int array_index, short add)
{
bActionGroup *agrp;
FCurve *fcu;
-
+
/* sanity checks */
if (ELEM(NULL, act, rna_path))
return NULL;
-
- /* try to find f-curve matching for this setting
+
+ /* try to find f-curve matching for this setting
* - 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(&act->curves, rna_path, array_index);
-
+
if ((fcu == NULL) && (add)) {
/* use default settings to make a F-Curve */
fcu = MEM_callocN(sizeof(FCurve), "FCurve");
-
+
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
if (BLI_listbase_is_empty(&act->curves))
fcu->flag |= FCURVE_ACTIVE; /* first one added active */
-
+
/* store path - make copy, and store that */
fcu->rna_path = BLI_strdup(rna_path);
fcu->array_index = array_index;
-
+
/* if a group name has been provided, try to add or find a group, then add F-Curve to it */
if (group) {
/* try to find group */
agrp = BKE_action_group_find_name(act, group);
-
+
/* no matching groups, so add one */
if (agrp == NULL) {
agrp = action_groups_add_new(act, group);
-
+
/* sync bone group colors if applicable */
if (ptr && (ptr->type == &RNA_PoseBone)) {
Object *ob = (Object *)ptr->id.data;
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
bPose *pose = ob->pose;
bActionGroup *grp;
-
+
/* find bone group (if present), and use the color from that */
grp = (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1));
if (grp) {
@@ -218,7 +218,7 @@ FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr,
}
}
}
-
+
/* add F-Curve to group */
action_groups_add_channel(act, agrp, fcu);
}
@@ -227,7 +227,7 @@ FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr,
BLI_addtail(&act->curves, fcu);
}
}
-
+
/* return the F-Curve */
return fcu;
}
@@ -280,10 +280,10 @@ void update_autoflags_fcurve(FCurve *fcu, bContext *C, ReportList *reports, Poin
idname, fcu->rna_path);
return;
}
-
+
/* update F-Curve flags */
update_autoflags_fcurve_direct(fcu, prop);
-
+
if (old_flag != fcu->flag) {
/* Same as if keyframes had been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
@@ -295,7 +295,7 @@ void update_autoflags_fcurve(FCurve *fcu, bContext *C, ReportList *reports, Poin
/* -------------- BezTriple Insertion -------------------- */
-/* This function adds a given BezTriple to an F-Curve. It will allocate
+/* This function adds a given BezTriple to an F-Curve. It will allocate
* memory for the array if needed, and will insert the BezTriple into a
* suitable place in chronological order.
*
@@ -305,12 +305,12 @@ void update_autoflags_fcurve(FCurve *fcu, bContext *C, ReportList *reports, Poin
int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
{
int i = 0;
-
+
/* are there already keyframes? */
if (fcu->bezt) {
bool replace;
i = binarysearch_bezt_index(fcu->bezt, bezt->vec[1][0], fcu->totvert, &replace);
-
+
/* replace an existing keyframe? */
if (replace) {
/* sanity check: 'i' may in rare cases exceed arraylen */
@@ -322,16 +322,16 @@ int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
/* just change the values when replacing, so as to not overwrite handles */
BezTriple *dst = (fcu->bezt + i);
float dy = bezt->vec[1][1] - dst->vec[1][1];
-
+
/* just apply delta value change to the handle values */
dst->vec[0][1] += dy;
dst->vec[1][1] += dy;
dst->vec[2][1] += dy;
-
+
dst->f1 = bezt->f1;
dst->f2 = bezt->f2;
dst->f3 = bezt->f3;
-
+
/* TODO: perform some other operations? */
}
}
@@ -340,29 +340,29 @@ int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
else if ((flag & INSERTKEY_REPLACE) == 0) {
/* insert new - if we're not restricted to replacing keyframes only */
BezTriple *newb = MEM_callocN((fcu->totvert + 1) * sizeof(BezTriple), "beztriple");
-
+
/* add the beztriples that should occur before the beztriple to be pasted (originally in fcu) */
if (i > 0)
memcpy(newb, fcu->bezt, i * sizeof(BezTriple));
-
+
/* add beztriple to paste at index i */
*(newb + i) = *bezt;
-
+
/* add the beztriples that occur after the beztriple to be pasted (originally in fcu) */
- if (i < fcu->totvert)
+ if (i < fcu->totvert)
memcpy(newb + i + 1, fcu->bezt + i, (fcu->totvert - i) * sizeof(BezTriple));
-
+
/* replace (+ free) old with new, only if necessary to do so */
MEM_freeN(fcu->bezt);
fcu->bezt = newb;
-
+
fcu->totvert++;
}
}
/* no keyframes already, but can only add if...
* 1) keyframing modes say that keyframes can only be replaced, so adding new ones won't know
* 2) there are no samples on the curve
- * // NOTE: maybe we may want to allow this later when doing samples -> bezt conversions,
+ * // NOTE: maybe we may want to allow this later when doing samples -> bezt conversions,
* // but for now, having both is asking for trouble
*/
else if ((flag & INSERTKEY_REPLACE) == 0 && (fcu->fpt == NULL)) {
@@ -376,9 +376,9 @@ int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
/* return error code -1 to prevent any misunderstandings */
return -1;
}
-
-
- /* we need to return the index, so that some tools which do post-processing can
+
+
+ /* we need to return the index, so that some tools which do post-processing can
* detect where we added the BezTriple in the array
*/
return i;
@@ -398,8 +398,8 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType ke
BezTriple beztr = {{{0}}};
unsigned int oldTot = fcu->totvert;
int a;
-
- /* set all three points, for nicer start position
+
+ /* set all three points, for nicer start position
* NOTE: +/- 1 on vec.x for left and right handles is so that 'free' handles work ok...
*/
beztr.vec[0][0] = x - 1.0f;
@@ -409,7 +409,7 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType ke
beztr.vec[2][0] = x + 1.0f;
beztr.vec[2][1] = y;
beztr.f1 = beztr.f2 = beztr.f3 = SELECT;
-
+
/* set default handle types and interpolation mode */
if (flag & INSERTKEY_NO_USERPREF) {
/* for Py-API, we want scripts to have predictable behaviour,
@@ -421,11 +421,11 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType ke
else {
/* for UI usage - defaults should come from the userprefs and/or toolsettings */
beztr.h1 = beztr.h2 = U.keyhandles_new; /* use default handle type here */
-
+
/* use default interpolation mode, with exceptions for int/discrete values */
beztr.ipo = U.ipo_new;
}
-
+
/* interpolation type used is constrained by the type of values the curve can take */
if (fcu->flag & FCURVE_DISCRETE_VALUES) {
beztr.ipo = BEZT_IPO_CONST;
@@ -433,10 +433,10 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType ke
else if ((beztr.ipo == BEZT_IPO_BEZ) && (fcu->flag & FCURVE_INT_VALUES)) {
beztr.ipo = BEZT_IPO_LIN;
}
-
+
/* set keyframe type value (supplied), which should come from the scene settings in most cases */
BEZKEYTYPE(&beztr) = keyframe_type;
-
+
/* set default values for "easing" interpolation mode settings
* NOTE: Even if these modes aren't currently used, if users switch
* to these later, we want these to work in a sane way out of
@@ -444,48 +444,48 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType ke
*/
beztr.back = 1.70158f; /* "back" easing - this value used to be used when overshoot=0, but that */
/* introduced discontinuities in how the param worked */
-
+
beztr.amplitude = 0.8f; /* "elastic" easing - values here were hand-optimised for a default duration of */
beztr.period = 4.1f; /* ~10 frames (typical mograph motion length) */
-
+
/* add temp beztriple to keyframes */
a = insert_bezt_fcurve(fcu, &beztr, flag);
-
- /* what if 'a' is a negative index?
+
+ /* what if 'a' is a negative index?
* for now, just exit to prevent any segfaults
*/
if (a < 0) return -1;
-
+
/* don't recalculate handles if fast is set
* - this is a hack to make importers faster
* - we may calculate twice (due to autohandle needing to be calculated twice)
*/
- if ((flag & INSERTKEY_FAST) == 0)
+ if ((flag & INSERTKEY_FAST) == 0)
calchandles_fcurve(fcu);
-
+
/* set handletype and interpolation */
if ((fcu->totvert > 2) && (flag & INSERTKEY_REPLACE) == 0) {
BezTriple *bezt = (fcu->bezt + a);
-
- /* set interpolation from previous (if available), but only if we didn't just replace some keyframe
+
+ /* set interpolation from previous (if available), but only if we didn't just replace some keyframe
* - replacement is indicated by no-change in number of verts
* - when replacing, the user may have specified some interpolation that should be kept
*/
if (fcu->totvert > oldTot) {
- if (a > 0)
+ if (a > 0)
bezt->ipo = (bezt - 1)->ipo;
else if (a < fcu->totvert - 1)
bezt->ipo = (bezt + 1)->ipo;
}
-
+
/* don't recalculate handles if fast is set
* - this is a hack to make importers faster
* - we may calculate twice (due to autohandle needing to be calculated twice)
*/
- if ((flag & INSERTKEY_FAST) == 0)
+ if ((flag & INSERTKEY_FAST) == 0)
calchandles_fcurve(fcu);
}
-
+
/* return the index at which the keyframe was added */
return a;
}
@@ -510,34 +510,34 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
BezTriple *bezt = NULL, *prev = NULL;
int totCount, i;
float valA = 0.0f, valB = 0.0f;
-
+
/* safety checking */
if (fcu == NULL) return KEYNEEDED_JUSTADD;
totCount = fcu->totvert;
if (totCount == 0) return KEYNEEDED_JUSTADD;
-
+
/* loop through checking if any are the same */
bezt = fcu->bezt;
for (i = 0; i < totCount; i++) {
float prevPosi = 0.0f, prevVal = 0.0f;
float beztPosi = 0.0f, beztVal = 0.0f;
-
+
/* get current time+value */
beztPosi = bezt->vec[1][0];
beztVal = bezt->vec[1][1];
-
+
if (prev) {
/* there is a keyframe before the one currently being examined */
-
+
/* get previous time+value */
prevPosi = prev->vec[1][0];
prevVal = prev->vec[1][1];
-
+
/* keyframe to be added at point where there are already two similar points? */
if (IS_EQF(prevPosi, cFrame) && IS_EQF(beztPosi, cFrame) && IS_EQF(beztPosi, prevPosi)) {
return KEYNEEDED_DONTADD;
}
-
+
/* keyframe between prev+current points ? */
if ((prevPosi <= cFrame) && (cFrame <= beztPosi)) {
/* is the value of keyframe to be added the same as keyframes on either side ? */
@@ -546,18 +546,18 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
}
else {
float realVal;
-
+
/* get real value of curve at that point */
realVal = evaluate_fcurve(fcu, cFrame);
-
+
/* compare whether it's the same as proposed */
if (IS_EQF(realVal, nValue))
return KEYNEEDED_DONTADD;
- else
+ else
return KEYNEEDED_JUSTADD;
}
}
-
+
/* new keyframe before prev beztriple? */
if (cFrame < prevPosi) {
/* A new keyframe will be added. However, whether the previous beztriple
@@ -566,18 +566,18 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
*/
if (IS_EQF(prevVal, nValue) && IS_EQF(beztVal, nValue) && IS_EQF(prevVal, beztVal))
return KEYNEEDED_DELNEXT;
- else
+ else
return KEYNEEDED_JUSTADD;
}
}
else {
- /* just add a keyframe if there's only one keyframe
+ /* just add a keyframe if there's only one keyframe
* and the new one occurs before the existing one does.
*/
if ((cFrame < beztPosi) && (totCount == 1))
return KEYNEEDED_JUSTADD;
}
-
+
/* continue. frame to do not yet passed (or other conditions not met) */
if (i < (totCount - 1)) {
prev = bezt;
@@ -586,7 +586,7 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
else
break;
}
-
+
/* Frame in which to add a new-keyframe occurs after all other keys
* -> If there are at least two existing keyframes, then if the values of the
* last two keyframes and the new-keyframe match, the last existing keyframe
@@ -596,15 +596,15 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
*/
bezt = (fcu->bezt + (fcu->totvert - 1));
valA = bezt->vec[1][1];
-
+
if (prev)
valB = prev->vec[1][1];
- else
+ else
valB = bezt->vec[1][1] + 1.0f;
-
+
if (IS_EQF(valA, nValue) && IS_EQF(valA, valB))
return KEYNEEDED_DELPREV;
- else
+ else
return KEYNEEDED_JUSTADD;
}
@@ -614,7 +614,7 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
static float setting_get_rna_value(PointerRNA *ptr, PropertyRNA *prop, int index)
{
float value = 0.0f;
-
+
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
if (RNA_property_array_check(prop))
@@ -640,7 +640,7 @@ static float setting_get_rna_value(PointerRNA *ptr, PropertyRNA *prop, int index
default:
break;
}
-
+
return value;
}
@@ -654,7 +654,7 @@ enum {
VISUALKEY_SCA,
};
-/* This helper function determines if visual-keyframing should be used when
+/* This helper function determines if visual-keyframing should be used when
* inserting keyframes for the given channel. As visual-keyframing only works
* on Object and Pose-Channel blocks, this should only get called for those
* blocktypes, when using "standard" keying but 'Visual Keying' option in Auto-Keying
@@ -667,12 +667,12 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
bool has_rigidbody = false;
bool has_parent = false;
const char *identifier = NULL;
-
+
/* validate data */
if (ELEM(NULL, ptr, ptr->data, prop))
return false;
-
- /* get first constraint and determine type of keyframe constraints to check for
+
+ /* get first constraint and determine type of keyframe constraints to check for
* - constraints can be on either Objects or PoseChannels, so we only check if the
* ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for
* those structs, allowing us to identify the owner of the data
@@ -681,27 +681,27 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
/* Object */
Object *ob = (Object *)ptr->data;
RigidBodyOb *rbo = ob->rigidbody_object;
-
+
con = ob->constraints.first;
identifier = RNA_property_identifier(prop);
has_parent = (ob->parent != NULL);
-
+
/* active rigidbody objects only, as only those are affected by sim */
has_rigidbody = ((rbo) && (rbo->type == RBO_TYPE_ACTIVE));
}
else if (ptr->type == &RNA_PoseBone) {
/* Pose Channel */
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
-
+
con = pchan->constraints.first;
identifier = RNA_property_identifier(prop);
has_parent = (pchan->parent != NULL);
}
-
+
/* check if any data to search using */
if (ELEM(NULL, con, identifier) && (has_parent == false) && (has_rigidbody == false))
return false;
-
+
/* location or rotation identifiers only... */
if (identifier == NULL) {
printf("%s failed: NULL identifier\n", __func__);
@@ -720,20 +720,20 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
printf("%s failed: identifier - '%s'\n", __func__, identifier);
return false;
}
-
-
+
+
/* only search if a searchtype and initial constraint are available */
if (searchtype) {
/* parent or rigidbody are always matching */
if (has_parent || has_rigidbody)
return true;
-
+
/* constraints */
for (; con; con = con->next) {
/* only consider constraint if it is not disabled, and has influence */
if (con->flag & CONSTRAINT_DISABLE) continue;
if (con->enforce == 0.0f) continue;
-
+
/* some constraints may alter these transforms */
switch (con->type) {
/* multi-transform constraints */
@@ -746,7 +746,7 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
return true;
case CONSTRAINT_TYPE_KINEMATIC:
return true;
-
+
/* single-transform constraits */
case CONSTRAINT_TYPE_TRACKTO:
if (searchtype == VISUALKEY_ROT) return true;
@@ -781,18 +781,18 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
case CONSTRAINT_TYPE_MINMAX:
if (searchtype == VISUALKEY_LOC) return true;
break;
-
+
default:
break;
}
}
}
-
+
/* when some condition is met, this function returns, so that means we've got nothing */
return false;
}
-/* This helper function extracts the value to use for visual-keyframing
+/* This helper function extracts the value to use for visual-keyframing
* In the event that it is not possible to perform visual keying, try to fall-back
* to using the default method. Assumes that all data it has been passed is valid.
*/
@@ -801,8 +801,8 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i
const char *identifier = RNA_property_identifier(prop);
float tmat[4][4];
int rotmode;
-
- /* handle for Objects or PoseChannels only
+
+ /* handle for Objects or PoseChannels only
* - only Location, Rotation or Scale keyframes are supported currently
* - constraints can be on either Objects or PoseChannels, so we only check if the
* ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for
@@ -811,21 +811,21 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i
*/
if (ptr->type == &RNA_Object) {
Object *ob = (Object *)ptr->data;
-
+
/* Loc code is specific... */
if (strstr(identifier, "location")) {
return ob->obmat[3][array_index];
}
-
+
copy_m4_m4(tmat, ob->obmat);
rotmode = ob->rotmode;
}
else if (ptr->type == &RNA_PoseBone) {
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
-
+
BKE_armature_mat_pose_to_bone(pchan, pchan->pose_mat, tmat);
rotmode = pchan->rotmode;
-
+
/* Loc code is specific... */
if (strstr(identifier, "location")) {
/* only use for non-connected bones */
@@ -836,27 +836,27 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i
else {
return setting_get_rna_value(ptr, prop, array_index);
}
-
+
/* Rot/Scale code are common! */
if (strstr(identifier, "rotation_euler")) {
float eul[3];
-
+
mat4_to_eulO(eul, rotmode, tmat);
return eul[array_index];
}
else if (strstr(identifier, "rotation_quaternion")) {
float mat3[3][3], quat[4];
-
+
copy_m3_m4(mat3, tmat);
mat3_to_quat_is_ok(quat, mat3);
-
+
return quat[array_index];
}
else if (strstr(identifier, "rotation_axis_angle")) {
float axis[3], angle;
-
+
mat4_to_axis_angle(axis, &angle, tmat);
-
+
/* w = 0, x,y,z = 1,2,3 */
if (array_index == 0)
return angle;
@@ -865,19 +865,19 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i
}
else if (strstr(identifier, "scale")) {
float scale[3];
-
+
mat4_to_size(scale, tmat);
-
+
return scale[array_index];
}
-
+
/* as the function hasn't returned yet, read value from system in the default way */
return setting_get_rna_value(ptr, prop, array_index);
}
/* ------------------------- Insert Key API ------------------------- */
-/* Secondary Keyframing API call:
+/* Secondary Keyframing API call:
* Use this when validation of necessary animation data is not necessary, since an RNA-pointer to the necessary
* data being keyframed, and a pointer to the F-Curve to use have both been provided.
*
@@ -890,7 +890,7 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i
bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
{
float curval = 0.0f;
-
+
/* no F-Curve to add keyframe to? */
if (fcu == NULL) {
BKE_report(reports, RPT_ERROR, "No F-Curve to add keyframes to");
@@ -898,13 +898,13 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
}
/* F-Curve not editable? */
if (fcurve_is_keyframable(fcu) == 0) {
- BKE_reportf(reports, RPT_ERROR,
+ BKE_reportf(reports, RPT_ERROR,
"F-Curve with path '%s[%d]' cannot be keyframed, ensure that it is not locked or sampled, "
"and try removing F-Modifiers",
fcu->rna_path, fcu->array_index);
return false;
}
-
+
/* if no property given yet, try to validate from F-Curve info */
if ((ptr.id.data == NULL) && (ptr.data == NULL)) {
BKE_report(reports, RPT_ERROR, "No RNA pointer available to retrieve values for keyframing from");
@@ -912,12 +912,12 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
}
if (prop == NULL) {
PointerRNA tmp_ptr;
-
+
/* try to get property we should be affecting */
if (RNA_path_resolve_property(&ptr, fcu->rna_path, &tmp_ptr, &prop) == false) {
/* property not found... */
const char *idname = (ptr.id.data) ? ((ID *)ptr.id.data)->name : TIP_("<No ID pointer>");
-
+
BKE_reportf(reports, RPT_ERROR,
"Could not insert keyframe, as RNA path is invalid for the given ID (ID = %s, path = %s)",
idname, fcu->rna_path);
@@ -928,7 +928,7 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
ptr = tmp_ptr;
}
}
-
+
/* update F-Curve flags to ensure proper behaviour for property type */
update_autoflags_fcurve_direct(fcu, prop);
@@ -944,13 +944,13 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
cfra = 0.0f;
}
}
-
+
/* obtain value to give keyframe */
- if ( (flag & INSERTKEY_MATRIX) &&
+ if ( (flag & INSERTKEY_MATRIX) &&
(visualkey_can_use(&ptr, prop)) )
{
- /* visual-keying is only available for object and pchan datablocks, as
- * it works by keyframing using a value extracted from the final matrix
+ /* visual-keying is only available for object and pchan datablocks, as
+ * it works by keyframing using a value extracted from the final matrix
* instead of using the kt system to extract a value.
*/
curval = visualkey_get_value(&ptr, prop, fcu->array_index);
@@ -959,18 +959,18 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
/* read value from system */
curval = setting_get_rna_value(&ptr, prop, fcu->array_index);
}
-
+
/* only insert keyframes where they are needed */
if (flag & INSERTKEY_NEEDED) {
short insert_mode;
-
+
/* check whether this curve really needs a new keyframe */
insert_mode = new_key_needed(fcu, cfra, curval);
-
+
/* insert new keyframe at current frame */
if (insert_mode)
insert_vert_fcurve(fcu, cfra, curval, keytype, flag);
-
+
/* delete keyframe immediately before/after newly added */
switch (insert_mode) {
case KEYNEEDED_DELPREV:
@@ -980,7 +980,7 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
delete_fcurve_key(fcu, 1, 1);
break;
}
-
+
/* only return success if keyframe added */
if (insert_mode)
return true;
@@ -988,11 +988,11 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
else {
/* just insert keyframe */
insert_vert_fcurve(fcu, cfra, curval, keytype, flag);
-
+
/* return success */
return true;
}
-
+
/* failed */
return false;
}
@@ -1007,20 +1007,20 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
* index of -1 keys all array indices
*/
short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
-{
+{
PointerRNA id_ptr, ptr;
PropertyRNA *prop = NULL;
AnimData *adt;
FCurve *fcu;
int array_index_max = array_index + 1;
int ret = 0;
-
+
/* validate pointer first - exit if failure */
if (id == NULL) {
BKE_reportf(reports, RPT_ERROR, "No ID block to insert keyframe in (path = %s)", rna_path);
return 0;
}
-
+
RNA_id_pointer_create(id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, rna_path, &ptr, &prop) == false) {
BKE_reportf(reports, RPT_ERROR,
@@ -1028,45 +1028,45 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
(id) ? id->name : TIP_("<Missing ID block>"), rna_path);
return 0;
}
-
+
/* if no action is provided, keyframe to the default one attached to this ID-block */
if (act == NULL) {
/* get action to add F-Curve+keyframe to */
act = verify_adt_action(id, 1);
-
+
if (act == NULL) {
- BKE_reportf(reports, RPT_ERROR,
+ BKE_reportf(reports, RPT_ERROR,
"Could not insert keyframe, as this type does not support animation data (ID = %s, path = %s)",
id->name, rna_path);
return 0;
}
}
-
+
/* apply NLA-mapping to frame to use (if applicable) */
adt = BKE_animdata_from_id(id);
cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
-
+
/* key entire array convenience method */
if (array_index == -1) {
array_index = 0;
array_index_max = RNA_property_array_length(&ptr, prop);
-
+
/* for single properties, increase max_index so that the property itself gets included,
- * but don't do this for standard arrays since that can cause corruption issues
+ * but don't do this for standard arrays since that can cause corruption issues
* (extra unused curves)
*/
if (array_index_max == array_index)
array_index_max++;
}
-
+
/* will only loop once unless the array index was -1 */
for (; array_index < array_index_max; array_index++) {
- /* make sure the F-Curve exists
+ /* make sure the F-Curve exists
* - if we're replacing keyframes only, DO NOT create new F-Curves if they do not exist yet
* but still try to get the F-Curve if it exists...
*/
fcu = verify_fcurve(act, group, &ptr, rna_path, array_index, (flag & INSERTKEY_REPLACE) == 0);
-
+
/* we may not have a F-Curve when we're replacing only... */
if (fcu) {
/* set color mode if the F-Curve is new (i.e. without any keyframes) */
@@ -1082,12 +1082,12 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
fcu->color_mode = FCURVE_COLOR_AUTO_YRGB;
}
}
-
+
/* insert keyframe */
ret += insert_keyframe_direct(reports, ptr, prop, fcu, cfra, keytype, flag);
}
}
-
+
return ret;
}
@@ -1136,13 +1136,13 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
PropertyRNA *prop;
int array_index_max = array_index + 1;
int ret = 0;
-
+
/* sanity checks */
if (ELEM(NULL, id, adt)) {
BKE_report(reports, RPT_ERROR, "No ID block and/or AnimData to delete keyframe from");
return 0;
}
-
+
/* validate pointer first - exit if failure */
RNA_id_pointer_create(id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, rna_path, &ptr, &prop) == false) {
@@ -1151,18 +1151,18 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
id->name, rna_path);
return 0;
}
-
+
/* get F-Curve
* Note: here is one of the places where we don't want new Action + F-Curve added!
* so 'add' var must be 0
*/
if (act == NULL) {
- /* if no action is provided, use the default one attached to this ID-block
+ /* if no action is provided, use the default one attached to this ID-block
* - if it doesn't exist, then we're out of options...
*/
if (adt->action) {
act = adt->action;
-
+
/* apply NLA-mapping to frame to use (if applicable) */
cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
}
@@ -1171,20 +1171,20 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
return 0;
}
}
-
+
/* key entire array convenience method */
if (array_index == -1) {
array_index = 0;
array_index_max = RNA_property_array_length(&ptr, prop);
-
+
/* for single properties, increase max_index so that the property itself gets included,
- * but don't do this for standard arrays since that can cause corruption issues
+ * but don't do this for standard arrays since that can cause corruption issues
* (extra unused curves)
*/
if (array_index_max == array_index)
array_index_max++;
}
-
+
/* will only loop once unless the array index was -1 */
for (; array_index < array_index_max; array_index++) {
FCurve *fcu = verify_fcurve(act, group, &ptr, rna_path, array_index, 0);
@@ -1203,7 +1203,7 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
ret += delete_keyframe_fcurve(adt, fcu, cfra);
}
-
+
/* return success/failure */
return ret;
}
@@ -1313,11 +1313,11 @@ static int modify_key_op_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
Scene *scene = CTX_data_scene(C);
-
+
/* if no area or active scene */
- if (ELEM(NULL, sa, scene))
+ if (ELEM(NULL, sa, scene))
return false;
-
+
/* should be fine */
return true;
}
@@ -1333,19 +1333,19 @@ static int insert_key_exec(bContext *C, wmOperator *op)
int type = RNA_enum_get(op->ptr, "type");
float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
-
+
/* type is the Keying Set the user specified to use when calling the operator:
* - type == 0: use scene's active Keying Set
* - type > 0: use a user-defined Keying Set from the active scene
* - type < 0: use a builtin Keying Set
*/
- if (type == 0)
+ if (type == 0)
type = scene->active_keyingset;
if (type > 0)
ks = BLI_findlink(&scene->keyingsets, type - 1);
else
ks = BLI_findlink(&builtin_keyingsets, -type - 1);
-
+
/* report failures */
if (ks == NULL) {
BKE_report(op->reports, RPT_ERROR, "No active keying set");
@@ -1359,12 +1359,12 @@ static int insert_key_exec(bContext *C, wmOperator *op)
ED_object_mode_toggle(C, OB_MODE_EDIT);
ob_edit_mode = true;
}
-
+
/* try to insert keyframes for the channels specified by KeyingSet */
success = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
if (G.debug & G_DEBUG)
BKE_reportf(op->reports, RPT_INFO, "Keying set '%s' - successfully added %d keyframes", ks->name, success);
-
+
/* restore the edit mode if necessary */
if (ob_edit_mode) {
ED_object_mode_toggle(C, OB_MODE_EDIT);
@@ -1379,39 +1379,39 @@ static int insert_key_exec(bContext *C, wmOperator *op)
/* if the appropriate properties have been set, make a note that we've inserted something */
if (RNA_boolean_get(op->ptr, "confirm_success"))
BKE_reportf(op->reports, RPT_INFO, "Successfully added %d keyframes for keying set '%s'", success, ks->name);
-
+
/* send notifiers that keyframes have been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
}
else
BKE_report(op->reports, RPT_WARNING, "Keying set failed to insert any keyframes");
-
+
return OPERATOR_FINISHED;
}
void ANIM_OT_keyframe_insert(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Insert Keyframe";
ot->idname = "ANIM_OT_keyframe_insert";
ot->description = "Insert keyframes on the current frame for all properties in the specified Keying Set";
-
+
/* callbacks */
- ot->exec = insert_key_exec;
+ ot->exec = insert_key_exec;
ot->poll = modify_key_op_poll;
-
+
/* flags */
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");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
-
- /* confirm whether a keyframe was added by showing a popup
+
+ /* confirm whether a keyframe was added by showing a popup
* - by default, this is enabled, since this operator is assumed to be called independently
*/
prop = RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Insert",
@@ -1420,68 +1420,68 @@ void ANIM_OT_keyframe_insert(wmOperatorType *ot)
}
/* Insert Key Operator (With Menu) ------------------------ */
-/* This operator checks if a menu should be shown for choosing the KeyingSet to use,
+/* This operator checks if a menu should be shown for choosing the KeyingSet to use,
* then calls the menu if necessary before
*/
static int insert_key_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
Scene *scene = CTX_data_scene(C);
-
+
/* if prompting or no active Keying Set, show the menu */
if ((scene->active_keyingset == 0) || RNA_boolean_get(op->ptr, "always_prompt")) {
uiPopupMenu *pup;
uiLayout *layout;
-
+
/* call the menu, which will call this operator again, hence the canceled */
pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
layout = UI_popup_menu_layout(pup);
uiItemsEnumO(layout, "ANIM_OT_keyframe_insert_menu", "type");
UI_popup_menu_end(C, pup);
-
+
return OPERATOR_INTERFACE;
}
else {
/* just call the exec() on the active keyingset */
RNA_enum_set(op->ptr, "type", 0);
RNA_boolean_set(op->ptr, "confirm_success", true);
-
+
return op->type->exec(C, op);
}
}
-
+
void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Insert Keyframe Menu";
ot->idname = "ANIM_OT_keyframe_insert_menu";
ot->description = "Insert Keyframes for specified Keying Set, with menu of available Keying Sets if undefined";
-
+
/* callbacks */
ot->invoke = insert_key_menu_invoke;
- ot->exec = insert_key_exec;
+ ot->exec = insert_key_exec;
ot->poll = ED_operator_areaactive;
-
+
/* flags */
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");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
-
- /* confirm whether a keyframe was added by showing a popup
+
+ /* confirm whether a keyframe was added by showing a popup
* - by default, this is disabled so that if a menu is shown, this doesn't come up too
*/
// XXX should this just be always on?
prop = RNA_def_boolean(ot->srna, "confirm_success", 0, "Confirm Successful Insert",
"Show a popup when the keyframes get successfully added");
RNA_def_property_flag(prop, PROP_HIDDEN);
-
- /* whether the menu should always be shown
+
+ /* whether the menu should always be shown
* - by default, the menu should only be shown when there is no active Keying Set (2.5 behavior),
* although in some cases it might be useful to always shown (pre 2.5 behavior)
*/
@@ -1498,30 +1498,30 @@ static int delete_key_exec(bContext *C, wmOperator *op)
int type = RNA_enum_get(op->ptr, "type");
float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
-
+
/* type is the Keying Set the user specified to use when calling the operator:
* - type == 0: use scene's active Keying Set
* - type > 0: use a user-defined Keying Set from the active scene
* - type < 0: use a builtin Keying Set
*/
- if (type == 0)
+ if (type == 0)
type = scene->active_keyingset;
if (type > 0)
ks = BLI_findlink(&scene->keyingsets, type - 1);
else
ks = BLI_findlink(&builtin_keyingsets, -type - 1);
-
+
/* report failure */
if (ks == NULL) {
BKE_report(op->reports, RPT_ERROR, "No active Keying Set");
return OPERATOR_CANCELLED;
}
-
+
/* try to delete keyframes for the channels specified by KeyingSet */
success = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_DELETE, cfra);
if (G.debug & G_DEBUG)
printf("KeyingSet '%s' - Successfully removed %d Keyframes\n", ks->name, success);
-
+
/* report failure or do updates? */
if (success == MODIFYKEY_INVALID_CONTEXT) {
BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set");
@@ -1531,39 +1531,39 @@ static int delete_key_exec(bContext *C, wmOperator *op)
/* if the appropriate properties have been set, make a note that we've inserted something */
if (RNA_boolean_get(op->ptr, "confirm_success"))
BKE_reportf(op->reports, RPT_INFO, "Successfully removed %d keyframes for keying set '%s'", success, ks->name);
-
+
/* send notifiers that keyframes have been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
}
else
BKE_report(op->reports, RPT_WARNING, "Keying set failed to remove any keyframes");
-
+
return OPERATOR_FINISHED;
}
void ANIM_OT_keyframe_delete(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Delete Keying-Set Keyframe";
ot->idname = "ANIM_OT_keyframe_delete";
ot->description = "Delete keyframes on the current frame for all properties in the specified Keying Set";
-
+
/* callbacks */
- ot->exec = delete_key_exec;
+ ot->exec = delete_key_exec;
ot->poll = modify_key_op_poll;
-
+
/* flags */
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");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
-
- /* confirm whether a keyframe was added by showing a popup
+
+ /* confirm whether a keyframe was added by showing a popup
* - by default, this is enabled, since this operator is assumed to be called independently
*/
RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Delete",
@@ -1574,7 +1574,7 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot)
/* NOTE: Although this version is simpler than the more generic version for KeyingSets,
* it is more useful for animators working in the 3D view.
*/
-
+
static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
{
bool changed = false;
@@ -1586,23 +1586,23 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
AnimData *adt = ob->adt;
bAction *act = adt->action;
FCurve *fcu, *fcn;
-
+
for (fcu = act->curves.first; fcu; fcu = fcn) {
bool can_delete = false;
-
+
fcn = fcu->next;
-
+
/* in pose mode, only delete the F-Curve if it belongs to a selected bone */
if (ob->mode & OB_MODE_POSE) {
if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones[")) {
bPoseChannel *pchan;
char *bone_name;
-
+
/* get bone-name, and check if this bone is selected */
bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
if (bone_name) MEM_freeN(bone_name);
-
+
/* delete if bone is selected*/
if ((pchan) && (pchan->bone)) {
if (pchan->bone->flag & BONE_SELECTED)
@@ -1614,7 +1614,7 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
/* object mode - all of Object's F-Curves are affected */
can_delete = true;
}
-
+
/* delete F-Curve completely */
if (can_delete) {
ANIM_fcurve_delete_from_animdata(NULL, adt, fcu);
@@ -1632,7 +1632,7 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1642,13 +1642,13 @@ void ANIM_OT_keyframe_clear_v3d(wmOperatorType *ot)
ot->name = "Remove Animation";
ot->description = "Remove all keyframe animation for selected objects";
ot->idname = "ANIM_OT_keyframe_clear_v3d";
-
+
/* callbacks */
ot->invoke = WM_operator_confirm;
- ot->exec = clear_anim_v3d_exec;
-
+ ot->exec = clear_anim_v3d_exec;
+
ot->poll = ED_operator_areaactive;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1658,22 +1658,22 @@ static int delete_key_v3d_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
float cfra = (float)CFRA;
-
+
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
ID *id = &ob->id;
int success = 0;
-
+
/* just those in active action... */
if ((ob->adt) && (ob->adt->action)) {
AnimData *adt = ob->adt;
bAction *act = adt->action;
FCurve *fcu, *fcn;
const float cfra_unmap = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
-
+
for (fcu = act->curves.first; fcu; fcu = fcn) {
fcn = fcu->next;
-
+
/* don't touch protected F-Curves */
if (BKE_fcurve_is_protected(fcu)) {
BKE_reportf(op->reports, RPT_WARNING,
@@ -1681,57 +1681,57 @@ static int delete_key_v3d_exec(bContext *C, wmOperator *op)
fcu->rna_path, id->name + 2);
continue;
}
-
+
/* special exception for bones, as this makes this operator more convenient to use
* NOTE: This is only done in pose mode. In object mode, we're dealign with the entire object.
*/
if ((ob->mode & OB_MODE_POSE) && strstr(fcu->rna_path, "pose.bones[\"")) {
bPoseChannel *pchan;
char *bone_name;
-
+
/* get bone-name, and check if this bone is selected */
bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
if (bone_name) MEM_freeN(bone_name);
-
+
/* skip if bone is not selected */
if ((pchan) && (pchan->bone)) {
/* bones are only selected/editable if visible... */
bArmature *arm = (bArmature *)ob->data;
-
+
/* skipping - not visible on currently visible layers */
if ((arm->layer & pchan->bone->layer) == 0)
continue;
/* skipping - is currently hidden */
if (pchan->bone->flag & BONE_HIDDEN_P)
continue;
-
+
/* selection flag... */
if ((pchan->bone->flag & BONE_SELECTED) == 0)
continue;
}
}
-
- /* delete keyframes on current frame
+
+ /* delete keyframes on current frame
* WARNING: this can delete the next F-Curve, hence the "fcn" copying
*/
success += delete_keyframe_fcurve(adt, fcu, cfra_unmap);
}
}
-
+
/* report success (or failure) */
if (success)
BKE_reportf(op->reports, RPT_INFO, "Object '%s' successfully had %d keyframes removed", id->name + 2, success);
else
BKE_reportf(op->reports, RPT_ERROR, "No keyframes removed from Object '%s'", id->name + 2);
-
+
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
CTX_DATA_END;
-
+
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1741,13 +1741,13 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
ot->name = "Delete Keyframe";
ot->description = "Remove keyframes on current frame for selected objects and bones";
ot->idname = "ANIM_OT_keyframe_delete_v3d";
-
+
/* callbacks */
ot->invoke = WM_operator_confirm;
- ot->exec = delete_key_v3d_exec;
-
+ ot->exec = delete_key_v3d_exec;
+
ot->poll = ED_operator_areaactive;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1769,16 +1769,16 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
const bool all = RNA_boolean_get(op->ptr, "all");
eInsertKeyFlags flag = INSERTKEY_NOFLAGS;
-
+
/* flags for inserting keyframes */
flag = ANIM_get_keyframing_flags(scene, 1);
-
+
/* try to insert keyframe using property retrieved from UI */
if (!(but = UI_context_active_but_prop_get(C, &ptr, &prop, &index))) {
/* pass event on if no active button found */
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
-
+
if ((ptr.id.data && ptr.data && prop) && RNA_property_animateable(&ptr, prop)) {
if (ptr.type == &RNA_NlaStrip) {
/* Handle special properties for NLA Strips, whose F-Curves are stored on the
@@ -1787,7 +1787,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
*/
NlaStrip *strip = (NlaStrip *)ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index);
-
+
if (fcu) {
success = insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, ts->keyframe_type, 0);
}
@@ -1800,9 +1800,9 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
/* Driven property - Find driver */
FCurve *fcu;
bool driven, special;
-
+
fcu = rna_get_fcurve_context_ui(C, &ptr, prop, index, NULL, NULL, &driven, &special);
-
+
if (fcu && driven) {
success = insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, ts->keyframe_type, INSERTKEY_DRIVER);
}
@@ -1810,19 +1810,19 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
else {
/* standard properties */
path = RNA_path_from_ID_to_property(&ptr, prop);
-
+
if (path) {
if (all) {
/* -1 indicates operating on the entire array (or the property itself otherwise) */
index = -1;
}
-
+
success = insert_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index, cfra, ts->keyframe_type, flag);
-
+
MEM_freeN(path);
}
else {
- BKE_report(op->reports, RPT_WARNING,
+ BKE_report(op->reports, RPT_WARNING,
"Failed to resolve path to property, "
"try manually specifying this using a Keying Set instead");
}
@@ -1830,7 +1830,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
}
else {
if (prop && !RNA_property_animateable(&ptr, prop)) {
- BKE_reportf(op->reports, RPT_WARNING,
+ BKE_reportf(op->reports, RPT_WARNING,
"\"%s\" property cannot be animated",
RNA_property_identifier(prop));
}
@@ -1840,15 +1840,15 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
(void *)ptr.data, (void *)prop);
}
}
-
+
if (success) {
/* send updates */
UI_context_update_anim_flag(C);
-
+
/* send notifiers that keyframes have been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
}
-
+
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1858,11 +1858,11 @@ void ANIM_OT_keyframe_insert_button(wmOperatorType *ot)
ot->name = "Insert Keyframe (Buttons)";
ot->idname = "ANIM_OT_keyframe_insert_button";
ot->description = "Insert a keyframe for current UI-active property";
-
+
/* callbacks */
- ot->exec = insert_key_button_exec;
+ ot->exec = insert_key_button_exec;
ot->poll = modify_key_op_poll;
-
+
/* flags */
ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
@@ -1882,7 +1882,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
short success = 0;
int index;
const bool all = RNA_boolean_get(op->ptr, "all");
-
+
/* try to insert keyframe using property retrieved from UI */
if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) {
/* pass event on if no active button found */
@@ -1898,7 +1898,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
ID *id = ptr.id.data;
NlaStrip *strip = (NlaStrip *)ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), 0);
-
+
if (fcu) {
if (BKE_fcurve_is_protected(fcu)) {
BKE_reportf(op->reports, RPT_WARNING,
@@ -1912,7 +1912,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
*/
bool found = false;
int i;
-
+
/* try to find index of beztriple to get rid of */
i = binarysearch_bezt_index(fcu->bezt, cfra, fcu->totvert, &found);
if (found) {
@@ -1926,13 +1926,13 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
else {
/* standard properties */
path = RNA_path_from_ID_to_property(&ptr, prop);
-
+
if (path) {
if (all) {
/* -1 indicates operating on the entire array (or the property itself otherwise) */
index = -1;
}
-
+
success = delete_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index, cfra, 0);
MEM_freeN(path);
}
@@ -1943,16 +1943,16 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
else if (G.debug & G_DEBUG) {
printf("ptr.data = %p, prop = %p\n", (void *)ptr.data, (void *)prop);
}
-
-
+
+
if (success) {
/* send updates */
UI_context_update_anim_flag(C);
-
+
/* send notifiers that keyframes have been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
}
-
+
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1962,11 +1962,11 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
ot->name = "Delete Keyframe (Buttons)";
ot->idname = "ANIM_OT_keyframe_delete_button";
ot->description = "Delete current keyframe of current UI-active property";
-
+
/* callbacks */
- ot->exec = delete_key_button_exec;
+ ot->exec = delete_key_button_exec;
ot->poll = modify_key_op_poll;
-
+
/* flags */
ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
@@ -1994,13 +1994,13 @@ static int clear_key_button_exec(bContext *C, wmOperator *op)
if (ptr.id.data && ptr.data && prop) {
path = RNA_path_from_ID_to_property(&ptr, prop);
-
+
if (path) {
if (all) {
/* -1 indicates operating on the entire array (or the property itself otherwise) */
index = -1;
}
-
+
success += clear_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index, 0);
MEM_freeN(path);
}
@@ -2015,7 +2015,7 @@ static int clear_key_button_exec(bContext *C, wmOperator *op)
if (success) {
/* send updates */
UI_context_update_anim_flag(C);
-
+
/* send notifiers that keyframes have been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
}
@@ -2047,11 +2047,11 @@ void ANIM_OT_keyframe_clear_button(wmOperatorType *ot)
bool autokeyframe_cfra_can_key(Scene *scene, ID *id)
{
float cfra = (float)CFRA; // XXX for now, this will do
-
+
/* only filter if auto-key mode requires this */
if (IS_AUTOKEY_ON(scene) == 0)
return false;
-
+
if (IS_AUTOKEY_MODE(scene, EDITKEYS)) {
/* Replace Mode:
* For whole block, only key if there's a keyframe on that frame already
@@ -2066,7 +2066,7 @@ bool autokeyframe_cfra_can_key(Scene *scene, ID *id)
* let's set the "normal" flag too, so that it will all be sane everywhere...
*/
scene->toolsettings->autokey_mode = AUTOKEY_MODE_NORMAL;
-
+
/* Can insert anytime we like... */
return true;
}
@@ -2083,12 +2083,12 @@ bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
/* quick sanity check */
if (ELEM(NULL, fcu, fcu->bezt))
return false;
-
+
/* we either include all regardless of muting, or only non-muted */
if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED) == 0) {
bool replace;
int i = binarysearch_bezt_index(fcu->bezt, frame, fcu->totvert, &replace);
-
+
/* binarysearch_bezt_index will set replace to be 0 or 1
* - obviously, 1 represents a match
*/
@@ -2098,26 +2098,26 @@ bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
return true;
}
}
-
+
return false;
}
-/* Checks whether an Action has a keyframe for a given frame
+/* Checks whether an Action has a keyframe for a given frame
* Since we're only concerned whether a keyframe exists, we can simply loop until a match is found...
*/
static bool action_frame_has_keyframe(bAction *act, float frame, short filter)
{
FCurve *fcu;
-
+
/* can only find if there is data */
if (act == NULL)
return false;
-
+
/* if only check non-muted, check if muted */
if ((filter & ANIMFILTER_KEYS_MUTED) || (act->flag & ACT_MUTED))
return false;
-
- /* loop over F-Curves, using binary-search to try to find matches
+
+ /* loop over F-Curves, using binary-search to try to find matches
* - this assumes that keyframes are only beztriples
*/
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
@@ -2127,7 +2127,7 @@ static bool action_frame_has_keyframe(bAction *act, float frame, short filter)
return true;
}
}
-
+
/* nothing found */
return false;
}
@@ -2138,27 +2138,27 @@ static bool object_frame_has_keyframe(Object *ob, float frame, short filter)
/* error checking */
if (ob == NULL)
return false;
-
+
/* check own animation data - specifically, the action it contains */
if ((ob->adt) && (ob->adt->action)) {
- /* T41525 - When the active action is a NLA strip being edited,
+ /* T41525 - When the active action is a NLA strip being edited,
* we need to correct the frame number to "look inside" the
* remapped action
*/
float ob_frame = BKE_nla_tweakedit_remap(ob->adt, frame, NLATIME_CONVERT_UNMAP);
-
+
if (action_frame_has_keyframe(ob->adt->action, ob_frame, filter))
return true;
}
-
+
/* try shapekey keyframes (if available, and allowed by filter) */
if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOSKEY)) {
Key *key = BKE_key_from_object(ob);
-
- /* shapekeys can have keyframes ('Relative Shape Keys')
- * or depend on time (old 'Absolute Shape Keys')
+
+ /* shapekeys can have keyframes ('Relative Shape Keys')
+ * or depend on time (old 'Absolute Shape Keys')
*/
-
+
/* 1. test for relative (with keyframes) */
if (id_frame_has_keyframe((ID *)key, frame, filter))
return true;
@@ -2172,24 +2172,24 @@ static bool object_frame_has_keyframe(Object *ob, float frame, short filter)
/* if only active, then we can skip a lot of looping */
if (filter & ANIMFILTER_KEYS_ACTIVE) {
Material *ma = give_current_material(ob, (ob->actcol + 1));
-
+
/* we only retrieve the active material... */
if (id_frame_has_keyframe((ID *)ma, frame, filter))
return true;
}
else {
int a;
-
+
/* loop over materials */
for (a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a + 1);
-
+
if (id_frame_has_keyframe((ID *)ma, frame, filter))
return true;
}
}
}
-
+
/* nothing found */
return false;
}
@@ -2202,7 +2202,7 @@ bool id_frame_has_keyframe(ID *id, float frame, short filter)
/* sanity checks */
if (id == NULL)
return false;
-
+
/* perform special checks for 'macro' types */
switch (GS(id->name)) {
case ID_OB: /* object */
@@ -2215,15 +2215,15 @@ bool id_frame_has_keyframe(ID *id, float frame, short filter)
default: /* 'normal type' */
{
AnimData *adt = BKE_animdata_from_id(id);
-
+
/* only check keyframes in active action */
if (adt)
return action_frame_has_keyframe(adt->action, frame, filter);
break;
}
}
-
-
+
+
/* no keyframe found */
return false;
}
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index cfab41944eb..3e491ce3ade 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -29,7 +29,7 @@
* \ingroup edanimation
*/
-
+
#include <stdio.h>
#include <stddef.h>
#include <string.h>
@@ -83,10 +83,10 @@ static int keyingset_poll_default_add(bContext *C)
static int keyingset_poll_active_edit(bContext *C)
{
Scene *scene = CTX_data_scene(C);
-
+
if (scene == NULL)
return 0;
-
+
/* there must be an active KeyingSet (and KeyingSets) */
return ((scene->active_keyingset > 0) && (scene->keyingsets.first));
}
@@ -96,42 +96,42 @@ static int keyingset_poll_activePath_edit(bContext *C)
{
Scene *scene = CTX_data_scene(C);
KeyingSet *ks;
-
+
if (scene == NULL)
return 0;
if (scene->active_keyingset <= 0)
return 0;
else
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));
}
-
+
/* Add a Default (Empty) Keying Set ------------------------- */
static int add_default_keyingset_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
short flag = 0, keyingflag = 0;
-
- /* validate flags
+
+ /* validate flags
* - absolute KeyingSets should be created by default
*/
flag |= KEYINGSET_ABSOLUTE;
-
+
/* 2nd arg is 0 to indicate that we don't want to include autokeying mode related settings */
keyingflag = ANIM_get_keyframing_flags(scene, 0);
-
+
/* call the API func, and set the active keyingset index */
BKE_keyingset_add(&scene->keyingsets, NULL, NULL, flag, keyingflag);
-
+
scene->active_keyingset = BLI_listbase_count(&scene->keyingsets);
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -141,7 +141,7 @@ void ANIM_OT_keying_set_add(wmOperatorType *ot)
ot->name = "Add Empty Keying Set";
ot->idname = "ANIM_OT_keying_set_add";
ot->description = "Add a new (empty) Keying Set to the active Scene";
-
+
/* callbacks */
ot->exec = add_default_keyingset_exec;
ot->poll = keyingset_poll_default_add;
@@ -153,7 +153,7 @@ static int remove_active_keyingset_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
KeyingSet *ks;
-
+
/* verify the Keying Set to use:
* - use the active one
* - return error if it doesn't exist
@@ -168,17 +168,17 @@ static int remove_active_keyingset_exec(bContext *C, wmOperator *op)
}
else
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
-
+
/* free KeyingSet's data, then remove it from the scene */
BKE_keyingset_free(ks);
BLI_freelinkN(&scene->keyingsets, ks);
-
+
/* the active one should now be the previously second-to-last one */
scene->active_keyingset--;
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -188,7 +188,7 @@ void ANIM_OT_keying_set_remove(wmOperatorType *ot)
ot->name = "Remove Active Keying Set";
ot->idname = "ANIM_OT_keying_set_remove";
ot->description = "Remove the active Keying Set";
-
+
/* callbacks */
ot->exec = remove_active_keyingset_exec;
ot->poll = keyingset_poll_active_edit;
@@ -201,7 +201,7 @@ static int add_empty_ks_path_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
KeyingSet *ks;
KS_Path *ksp;
-
+
/* verify the Keying Set to use:
* - use the active one
* - return error if it doesn't exist
@@ -212,16 +212,16 @@ static int add_empty_ks_path_exec(bContext *C, wmOperator *op)
}
else
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");
BLI_addtail(&ks->paths, ksp);
ks->active_path = BLI_listbase_count(&ks->paths);
-
+
ksp->groupmode = KSP_GROUP_KSNAME; // XXX?
ksp->idtype = ID_OB;
ksp->flag = KSP_FLAG_WHOLE_ARRAY;
-
+
return OPERATOR_FINISHED;
}
@@ -231,7 +231,7 @@ void ANIM_OT_keying_set_path_add(wmOperatorType *ot)
ot->name = "Add Empty Keying Set Path";
ot->idname = "ANIM_OT_keying_set_path_add";
ot->description = "Add empty path to active Keying Set";
-
+
/* callbacks */
ot->exec = add_empty_ks_path_exec;
ot->poll = keyingset_poll_active_edit;
@@ -243,15 +243,15 @@ 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);
-
+
/* if there is a KeyingSet, find the nominated path to remove */
if (ks) {
KS_Path *ksp = BLI_findlink(&ks->paths, ks->active_path - 1);
-
+
if (ksp) {
/* remove the active path from the KeyingSet */
BKE_keyingset_free_path(ks, ksp);
-
+
/* the active path should now be the previously second-to-last active one */
ks->active_path--;
}
@@ -264,7 +264,7 @@ static int remove_active_ks_path_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active keying set to remove a path from");
return OPERATOR_CANCELLED;
}
-
+
return OPERATOR_FINISHED;
}
@@ -274,7 +274,7 @@ void ANIM_OT_keying_set_path_remove(wmOperatorType *ot)
ot->name = "Remove Active Keying Set Path";
ot->idname = "ANIM_OT_keying_set_path_remove";
ot->description = "Remove active Path from active Keying Set";
-
+
/* callbacks */
ot->exec = remove_active_ks_path_exec;
ot->poll = keyingset_poll_activePath_edit;
@@ -295,33 +295,33 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op)
short success = 0;
int index = 0, pflag = 0;
const bool all = RNA_boolean_get(op->ptr, "all");
-
+
/* try to add to keyingset using property retrieved from UI */
if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) {
/* pass event on if no active button found */
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
-
+
/* 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
+ * - add a new one if it doesn't exist
*/
if (scene->active_keyingset == 0) {
short flag = 0, keyingflag = 0;
-
- /* validate flags
+
+ /* validate flags
* - absolute KeyingSets should be created by default
*/
flag |= KEYINGSET_ABSOLUTE;
-
+
keyingflag |= ANIM_get_keyframing_flags(scene, 0);
-
- if (IS_AUTOKEY_FLAG(scene, XYZ2RGB))
+
+ if (IS_AUTOKEY_FLAG(scene, XYZ2RGB))
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);
-
+
scene->active_keyingset = BLI_listbase_count(&scene->keyingsets);
}
else if (scene->active_keyingset < 0) {
@@ -331,41 +331,41 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op)
else {
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
}
-
+
/* 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);
-
+
if (path) {
/* set flags */
if (all) {
pflag |= KSP_FLAG_WHOLE_ARRAY;
-
- /* we need to set the index for this to 0, even though it may break in some cases, this is
+
+ /* we need to set the index for this to 0, even though it may break in some cases, this is
* 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;
}
-
+
/* add path to this setting */
BKE_keyingset_add_path(ks, ptr.id.data, NULL, path, index, pflag, KSP_GROUP_KSNAME);
ks->active_path = BLI_listbase_count(&ks->paths);
success = 1;
-
+
/* free the temp path created */
MEM_freeN(path);
}
}
-
+
if (success) {
/* send updates */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
-
+
/* show notification/report header, so that users notice that something changed */
BKE_reportf(op->reports, RPT_INFO, "Property added to Keying Set: '%s'", ks->name);
}
-
+
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -375,11 +375,11 @@ void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
ot->name = "Add to Keying Set";
ot->idname = "ANIM_OT_keyingset_button_add";
ot->description = "Add current UI-active property to current keying set";
-
+
/* callbacks */
- ot->exec = add_keyingset_button_exec;
+ ot->exec = add_keyingset_button_exec;
//op->poll = ???
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -398,13 +398,13 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
char *path = NULL;
short success = 0;
int index = 0;
-
+
/* try to add to keyingset using property retrieved from UI */
if (UI_context_active_but_prop_get(C, &ptr, &prop, &index)) {
/* pass event on if no active button found */
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
-
+
/* verify the Keying Set to use:
* - use the active one for now (more control over this can be added later)
* - return error if it doesn't exist
@@ -420,35 +420,35 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
else {
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
}
-
+
if (ptr.id.data && ptr.data && 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);
-
+
if (ksp) {
BKE_keyingset_free_path(ks, ksp);
success = 1;
}
-
+
/* free temp path used */
MEM_freeN(path);
}
}
-
-
+
+
if (success) {
/* send updates */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
-
+
/* show warning */
BKE_report(op->reports, RPT_INFO, "Property removed from Keying Set");
}
-
+
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -458,11 +458,11 @@ void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
ot->name = "Remove from Keying Set";
ot->idname = "ANIM_OT_keyingset_button_remove";
ot->description = "Remove current UI-active property from current keying set";
-
+
/* callbacks */
- ot->exec = remove_keyingset_button_exec;
+ ot->exec = remove_keyingset_button_exec;
//op->poll = ???
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -476,13 +476,13 @@ static int keyingset_active_menu_invoke(bContext *C, wmOperator *op, const wmEve
{
uiPopupMenu *pup;
uiLayout *layout;
-
+
/* call the menu, which will call this operator again, hence the canceled */
pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE);
layout = UI_popup_menu_layout(pup);
uiItemsEnumO(layout, "ANIM_OT_keying_set_active_set", "type");
UI_popup_menu_end(C, pup);
-
+
return OPERATOR_INTERFACE;
}
@@ -490,33 +490,33 @@ static int keyingset_active_menu_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
int type = RNA_enum_get(op->ptr, "type");
-
+
/* If type == 0, it will deselect any active keying set. */
scene->active_keyingset = type;
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
-
+
return OPERATOR_FINISHED;
}
-
+
void ANIM_OT_keying_set_active_set(wmOperatorType *ot)
{
PropertyRNA *prop;
-
+
/* identifiers */
ot->name = "Set Active Keying Set";
ot->idname = "ANIM_OT_keying_set_active_set";
ot->description = "Select a new keying set as the active one";
-
+
/* callbacks */
ot->invoke = keyingset_active_menu_invoke;
- ot->exec = keyingset_active_menu_exec;
+ ot->exec = keyingset_active_menu_exec;
ot->poll = ED_operator_areaactive;
-
+
/* flags */
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");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
@@ -540,7 +540,7 @@ KeyingSetInfo *ANIM_keyingset_info_find_name(const char name[])
/* sanity checks */
if ((name == NULL) || (name[0] == 0))
return NULL;
-
+
/* search by comparing names */
return BLI_findstring(&keyingset_type_infos, name, offsetof(KeyingSetInfo, idname));
}
@@ -549,17 +549,17 @@ KeyingSetInfo *ANIM_keyingset_info_find_name(const char name[])
KeyingSet *ANIM_builtin_keyingset_get_named(KeyingSet *prevKS, const char name[])
{
KeyingSet *ks, *first = NULL;
-
+
/* sanity checks any name to check? */
if (name[0] == 0)
return NULL;
-
+
/* get first KeyingSet to use */
if (prevKS && prevKS->next)
first = prevKS->next;
else
first = builtin_keyingsets.first;
-
+
/* loop over KeyingSets checking names */
for (ks = first; ks; ks = ks->next) {
if (STREQ(name, ks->idname))
@@ -581,18 +581,18 @@ KeyingSet *ANIM_builtin_keyingset_get_named(KeyingSet *prevKS, const char name[]
void ANIM_keyingset_info_register(KeyingSetInfo *ksi)
{
KeyingSet *ks;
-
- /* create a new KeyingSet
+
+ /* create a new KeyingSet
* - inherit name and keyframing settings from the typeinfo
*/
ks = BKE_keyingset_add(&builtin_keyingsets, ksi->idname, ksi->name, 1, ksi->keyingflag);
-
+
/* link this KeyingSet with its typeinfo */
memcpy(&ks->typeinfo, ksi->idname, sizeof(ks->typeinfo));
-
+
/* Copy description... */
BLI_strncpy(ks->description, ksi->description, sizeof(ks->description));
-
+
/* add type-info to the list */
BLI_addtail(&keyingset_type_infos, ksi);
}
@@ -620,7 +620,7 @@ void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *ksi)
MEM_freeN(ks);
}
}
-
+
/* free the type info */
BLI_freelinkN(&keyingset_type_infos, ksi);
}
@@ -630,17 +630,17 @@ void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *ksi)
void ANIM_keyingset_infos_exit(void)
{
KeyingSetInfo *ksi, *next;
-
+
/* free type infos */
for (ksi = keyingset_type_infos.first; ksi; ksi = next) {
next = ksi->next;
-
+
/* free extra RNA data, and remove from list */
if (ksi->ext.free)
ksi->ext.free(ksi->ext.data);
BLI_freelinkN(&keyingset_type_infos, ksi);
}
-
+
/* free builtin sets */
BKE_keyingsets_free(&builtin_keyingsets);
}
@@ -666,7 +666,7 @@ KeyingSet *ANIM_scene_get_active_keyingset(Scene *scene)
/* if no scene, we've got no hope of finding the Keying Set */
if (scene == NULL)
return NULL;
-
+
/* currently, there are several possibilities here:
* - 0: no active keying set
* - > 0: one of the user-defined Keying Sets, but indices start from 0 (hence the -1)
@@ -682,22 +682,22 @@ KeyingSet *ANIM_scene_get_active_keyingset(Scene *scene)
int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *ks)
{
int index;
-
+
/* if no KeyingSet provided, have none */
if (ks == NULL)
return 0;
-
+
/* check if the KeyingSet exists in scene list */
if (scene) {
- /* get index and if valid, return
+ /* get index and if valid, return
* - (absolute) Scene KeyingSets are from (>= 1)
*/
index = BLI_findindex(&scene->keyingsets, ks);
if (index != -1)
return (index + 1);
}
-
- /* still here, so try builtins list too
+
+ /* still here, so try builtins list too
* - builtins are from (<= -1)
* - none/invalid is (= 0)
*/
@@ -711,15 +711,15 @@ int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *ks)
/* Get Keying Set to use for Auto-Keyframing some transforms */
KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformKSName)
{
- /* get KeyingSet to use
- * - use the active KeyingSet if defined (and user wants to use it for all autokeying),
+ /* get KeyingSet to use
+ * - use the active KeyingSet if defined (and user wants to use it for all autokeying),
* or otherwise key transforms only
*/
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (scene->active_keyingset))
return ANIM_scene_get_active_keyingset(scene);
else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL))
return ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_AVAILABLE_ID);
- else
+ else
return ANIM_builtin_keyingset_get_named(NULL, tranformKSName);
}
@@ -737,8 +737,8 @@ const EnumPropertyItem *ANIM_keying_sets_enum_itemf(bContext *C, PointerRNA *UNU
if (C == NULL) {
return DummyRNA_DEFAULT_items;
}
-
- /* active Keying Set
+
+ /* active Keying Set
* - only include entry if it exists
*/
if (scene->active_keyingset) {
@@ -747,14 +747,14 @@ const EnumPropertyItem *ANIM_keying_sets_enum_itemf(bContext *C, PointerRNA *UNU
item_tmp.name = "Active Keying Set";
item_tmp.value = i;
RNA_enum_item_add(&item, &totitem, &item_tmp);
-
+
/* separator */
RNA_enum_item_add_separator(&item, &totitem);
}
-
+
i++;
-
- /* user-defined Keying Sets
+
+ /* user-defined Keying Sets
* - these are listed in the order in which they were defined for the active scene
*/
if (scene->keyingsets.first) {
@@ -767,11 +767,11 @@ const EnumPropertyItem *ANIM_keying_sets_enum_itemf(bContext *C, PointerRNA *UNU
RNA_enum_item_add(&item, &totitem, &item_tmp);
}
}
-
+
/* separator */
RNA_enum_item_add_separator(&item, &totitem);
}
-
+
/* builtin Keying Sets */
i = -1;
for (ks = builtin_keyingsets.first; ks; ks = ks->next, i--) {
@@ -801,7 +801,7 @@ bool ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *ks)
{
if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) {
KeyingSetInfo *ksi = ANIM_keyingset_info_find_name(ks->typeinfo);
-
+
/* get the associated 'type info' for this KeyingSet */
if (ksi == NULL)
return 0;
@@ -810,13 +810,13 @@ bool ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *ks)
/* check if it can be used in the current context */
return (ksi->poll(ksi, C));
}
-
+
return true;
}
/* Special 'Overrides' Iterator for Relative KeyingSets ------ */
-/* 'Data Sources' for relative Keying Set 'overrides'
+/* 'Data Sources' for relative Keying Set 'overrides'
* - this is basically a wrapper for PointerRNA's in a linked list
* - do not allow this to be accessed from outside for now
*/
@@ -826,14 +826,14 @@ typedef struct tRKS_DSource {
} tRKS_DSource;
-/* Iterator used for overriding the behavior of iterators defined for
+/* Iterator used for overriding the behavior of iterators defined for
* 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)
{
tRKS_DSource *ds;
-
+
for (ds = dsources->first; ds; ds = ds->next) {
/* run generate callback on this data */
ksi->generate(ksi, C, ks, &ds->ptr);
@@ -844,8 +844,8 @@ static void RKS_ITER_overrides_list(KeyingSetInfo *ksi, bContext *C, KeyingSet *
void ANIM_relative_keyingset_add_source(ListBase *dsources, ID *id, StructRNA *srna, void *data)
{
tRKS_DSource *ds;
-
- /* sanity checks
+
+ /* sanity checks
* - we must have somewhere to output the data
* - we must have both srna+data (and with id too optionally), or id by itself only
*/
@@ -853,11 +853,11 @@ void ANIM_relative_keyingset_add_source(ListBase *dsources, ID *id, StructRNA *s
return;
if (ELEM(NULL, srna, data) && (id == NULL))
return;
-
+
/* allocate new elem, and add to the list */
ds = MEM_callocN(sizeof(tRKS_DSource), "tRKS_DSource");
BLI_addtail(dsources, ds);
-
+
/* depending on what data we have, create using ID or full pointer call */
if (srna && data)
RNA_pointer_create(id, srna, data, &ds->ptr);
@@ -879,31 +879,31 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
/* sanity check */
if (ks == NULL)
return 0;
-
+
/* if relative Keying Sets, poll and build up the paths */
if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) {
KeyingSetInfo *ksi = ANIM_keyingset_info_find_name(ks->typeinfo);
-
- /* clear all existing paths
+
+ /* clear all existing paths
* NOTE: BKE_keyingset_free() frees all of the paths for the KeyingSet, but not the set itself
*/
BKE_keyingset_free(ks);
-
+
/* get the associated 'type info' for this KeyingSet */
if (ksi == NULL)
return MODIFYKEY_MISSING_TYPEINFO;
/* TODO: check for missing callbacks! */
-
+
/* check if it can be used in the current context */
if (ksi->poll(ksi, C)) {
/* if a list of data sources are provided, run a special iterator over them,
* otherwise, just continue per normal
*/
- if (dsources)
+ if (dsources)
RKS_ITER_overrides_list(ksi, C, ks, dsources);
else
ksi->iter(ksi, C, ks);
-
+
/* if we don't have any paths now, then this still qualifies as invalid context */
// FIXME: we need some error conditions (to be retrieved from the iterator why this failed!)
if (BLI_listbase_is_empty(&ks->paths))
@@ -915,16 +915,16 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
return MODIFYKEY_INVALID_CONTEXT;
}
}
-
+
/* succeeded; return 0 to tag error free */
return 0;
-}
+}
/* Determine which keying flags apply based on the override flags */
static short keyingset_apply_keying_flags(const short base_flags, const short overrides, const short own_flags)
{
short result = 0;
-
+
/* The logic for whether a keying flag applies is as follows:
* - If the flag in question is set in "overrides", that means that the
* status of that flag in "own_flags" is used
@@ -938,14 +938,14 @@ static short keyingset_apply_keying_flags(const short base_flags, const short ov
else { \
result |= (base_flags & kflag); \
}
-
- /* Apply the flags one by one...
+
+ /* Apply the flags one by one...
* (See rna_def_common_keying_flags() for the supported flags)
*/
APPLY_KEYINGFLAG_OVERRIDE(INSERTKEY_NEEDED)
APPLY_KEYINGFLAG_OVERRIDE(INSERTKEY_MATRIX)
APPLY_KEYINGFLAG_OVERRIDE(INSERTKEY_XYZ2RGB)
-
+
#undef APPLY_KEYINGFLAG_OVERRIDE
return result;
@@ -964,11 +964,11 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
const char *groupname = NULL;
short kflag = 0, success = 0;
char keytype = scene->toolsettings->keyframe_type;
-
+
/* sanity checks */
if (ks == NULL)
return 0;
-
+
/* get flags to use */
if (mode == MODIFYKEY_MODE_INSERT) {
/* use context settings as base */
@@ -976,20 +976,20 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
}
else if (mode == MODIFYKEY_MODE_DELETE)
kflag = 0;
-
+
/* if relative Keying Sets, poll and build up the paths */
success = ANIM_validate_keyingset(C, dsources, ks);
-
+
if (success != 0) {
/* return error code if failed */
return success;
}
-
+
/* apply the paths as specified in the KeyingSet now */
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,
@@ -997,10 +997,10 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
ks->name, ksp->rna_path, ksp->array_index);
continue;
}
-
+
/* since keying settings can be defined on the paths too, apply the settings for this path first */
kflag2 = keyingset_apply_keying_flags(kflag, ksp->keyingoverride, ksp->keyingflag);
-
+
/* get pointer to name of group to add channels to */
if (ksp->groupmode == KSP_GROUP_NONE)
groupname = NULL;
@@ -1008,30 +1008,30 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
groupname = ks->name;
else
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;
-
+
/* get length of array if whole array option is enabled */
if (ksp->flag & KSP_FLAG_WHOLE_ARRAY) {
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
-
+
RNA_id_pointer_create(ksp->id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, ksp->rna_path, &ptr, &prop)) {
arraylen = RNA_property_array_length(&ptr, prop);
i = 0; /* start from start of array, instead of the previously specified index - T48020 */
}
}
-
+
/* we should do at least one step */
if (arraylen == i)
arraylen++;
-
- /* for each possible index, perform operation
+
+ /* for each possible index, perform operation
* - assume that arraylen is greater than index
*/
for (; i < arraylen; i++) {
@@ -1041,13 +1041,13 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
else if (mode == MODIFYKEY_MODE_DELETE)
success += delete_keyframe(reports, ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag2);
}
-
+
/* set recalc-flags */
switch (GS(ksp->id->name)) {
case ID_OB: /* Object (or Object-Related) Keyframes */
{
Object *ob = (Object *)ksp->id;
-
+
// XXX: only object transforms?
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
break;
@@ -1055,11 +1055,11 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
default:
break;
}
-
+
/* send notifiers for updates (this doesn't require context to work!) */
WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
}
-
+
/* return the number of channels successfully affected */
return success;
}