diff options
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 83 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 135 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 62 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ipo_utils.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 20 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/drivers.c | 10 | ||||
-rw-r--r-- | source/blender/editors/animation/fmodifier_ui.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 12 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_general.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 36 | ||||
-rw-r--r-- | source/blender/editors/animation/keyingsets.c | 8 |
16 files changed, 288 insertions, 98 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 84be7049f7b..696a3553a46 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung * All rights reserved. @@ -386,7 +386,10 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle static void acf_summary_color(bAnimContext *ac, bAnimListElem *ale, float *color) { // FIXME: hardcoded color - same as the 'action' line in NLA - glColor3f(0.8f, 0.2f, 0.0f); // reddish color + // reddish color + color[0] = 0.8f; + color[1] = 0.2f; + color[2] = 0.0f; } /* backdrop for summary widget */ @@ -468,6 +471,8 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *typ /* all animation summary (DopeSheet only) type define */ static bAnimChannelType ACF_SUMMARY = { + "Summary", /* type name */ + acf_summary_color, /* backdrop color */ acf_summary_backdrop, /* backdrop */ acf_generic_indention_0, /* indent level */ @@ -567,6 +572,8 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type) /* scene type define */ static bAnimChannelType ACF_SCENE = { + "Scene", /* type name */ + acf_generic_root_color, /* backdrop color */ acf_generic_root_backdrop, /* backdrop */ acf_generic_indention_0, /* indent level */ @@ -687,6 +694,8 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type /* object type define */ static bAnimChannelType ACF_OBJECT = { + "Object", /* type name */ + acf_generic_root_color, /* backdrop color */ acf_generic_root_backdrop, /* backdrop */ acf_generic_indention_0, /* indent level */ @@ -802,6 +811,8 @@ static void *acf_group_setting_ptr(bAnimListElem *ale, int setting, short *type) /* group type define */ static bAnimChannelType ACF_GROUP = { + "Group", /* type name */ + acf_group_color, /* backdrop color */ acf_group_backdrop, /* backdrop */ acf_generic_indention_0, /* indent level */ @@ -886,6 +897,8 @@ static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int setting, short *type /* fcurve type define */ static bAnimChannelType ACF_FCURVE = { + "F-Curve", /* type name */ + acf_generic_channel_color, /* backdrop color */ acf_generic_channel_backdrop, /* backdrop */ acf_generic_indention_flexible, /* indent level */ // xxx rename this to f-curves only? @@ -968,6 +981,8 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *ty /* object action expander type define */ static bAnimChannelType ACF_FILLACTD = { + "Ob-Action Filler", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1044,6 +1059,8 @@ static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, int setting, short /* drivers expander type define */ static bAnimChannelType ACF_FILLDRIVERS = { + "Drivers Filler", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1088,6 +1105,8 @@ static int acf_fillmatd_setting_flag(bAnimContext *ac, int setting, short *neg) /* materials expander type define */ static bAnimChannelType ACF_FILLMATD= { + "Materials Filler", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1132,6 +1151,8 @@ static int acf_fillpartd_setting_flag(bAnimContext *ac, int setting, short *neg) /* particles expander type define */ static bAnimChannelType ACF_FILLPARTD= { + "Particles Filler", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1212,6 +1233,8 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type) /* material expander type define */ static bAnimChannelType ACF_DSMAT= { + "Material Data Expander", /* type name */ + acf_generic_channel_color, /* backdrop color */ acf_generic_channel_backdrop, /* backdrop */ acf_generic_indention_0, /* indent level */ @@ -1286,6 +1309,8 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type) /* lamp expander type define */ static bAnimChannelType ACF_DSLAM= { + "Lamp Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1360,6 +1385,8 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type) /* camera expander type define */ static bAnimChannelType ACF_DSCAM= { + "Camera Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1444,6 +1471,8 @@ static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type) /* curve expander type define */ static bAnimChannelType ACF_DSCUR= { + "Curve Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1518,6 +1547,8 @@ static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type /* shapekey expander type define */ static bAnimChannelType ACF_DSSKEY= { + "Shape Key Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1592,6 +1623,8 @@ static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type) /* world expander type define */ static bAnimChannelType ACF_DSWOR= { + "World Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1666,6 +1699,8 @@ static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type /* particle expander type define */ static bAnimChannelType ACF_DSPART= { + "Particle Data Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1740,6 +1775,8 @@ static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *typ /* metaball expander type define */ static bAnimChannelType ACF_DSMBALL= { + "Metaball Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1814,6 +1851,8 @@ static void *acf_dsarm_setting_ptr(bAnimListElem *ale, int setting, short *type) /* metaball expander type define */ static bAnimChannelType ACF_DSARM= { + "Armature Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ @@ -1888,6 +1927,8 @@ static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *typ /* node tree expander type define */ static bAnimChannelType ACF_DSNTREE= { + "Node Tree Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ // XXX this only works for compositing @@ -1962,6 +2003,8 @@ static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type /* node tree expander type define */ static bAnimChannelType ACF_DSMESH= { + "Mesh Expander", /* type name */ + acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ acf_generic_indention_1, /* indent level */ // XXX this only works for compositing @@ -2050,6 +2093,8 @@ static void *acf_shapekey_setting_ptr(bAnimListElem *ale, int setting, short *ty /* shapekey expander type define */ static bAnimChannelType ACF_SHAPEKEY= { + "Shape Key", /* type name */ + acf_generic_channel_color, /* backdrop color */ acf_generic_channel_backdrop, /* backdrop */ acf_generic_indention_0, /* indent level */ @@ -2260,6 +2305,36 @@ bAnimChannelType *ANIM_channel_get_typeinfo (bAnimListElem *ale) /* --------------------------- */ +/* Print debug info string for the given channel */ +void ANIM_channel_debug_print_info (bAnimListElem *ale, short indent_level) +{ + bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale); + + /* print indents */ + for (; indent_level > 0; indent_level--) + printf(" "); + + /* print info */ + if (acf) { + char name[256]; /* hopefully this will be enough! */ + + /* get UI name */ + if (acf->name) + acf->name(ale, name); + else + sprintf(name, "<No name>"); + + /* print type name + ui name */ + printf("ChanType: <%s> Name: \"%s\"\n", acf->channel_type_name, name); + } + else if (ale) + printf("ChanType: <Unknown - %d>\n", ale->type); + else + printf("<Invalid channel - NULL>\n"); +} + +/* --------------------------- */ + /* Check if some setting for a channel is enabled * Returns: 1 = On, 0 = Off, -1 = Invalid */ @@ -2326,12 +2401,12 @@ short ANIM_channel_setting_get (bAnimContext *ac, bAnimListElem *ale, int settin #define ACF_SETTING_SET(sval, sflag, smode) \ {\ if (negflag) {\ - if (smode == ACHANNEL_SETFLAG_TOGGLE) (sval) ^= (sflag); \ + if (smode == ACHANNEL_SETFLAG_INVERT) (sval) ^= (sflag); \ else if (smode == ACHANNEL_SETFLAG_ADD) (sval) &= ~(sflag); \ else (sval) |= (sflag); \ } \ else {\ - if (smode == ACHANNEL_SETFLAG_TOGGLE) (sval) ^= (sflag); \ + if (smode == ACHANNEL_SETFLAG_INVERT) (sval) ^= (sflag); \ else if (smode == ACHANNEL_SETFLAG_ADD) (sval) |= (sflag); \ else (sval) &= ~(sflag); \ }\ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index fba6d56fcc6..8c9495ac61e 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung * All rights reserved. @@ -1039,7 +1039,7 @@ 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."; + ot->description= "Delete all selected animation channels"; /* api callbacks */ ot->exec= animchannels_delete_exec; @@ -1064,21 +1064,26 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; + /* get list of all channels that selection may need to be flushed to */ + filter= ANIMFILTER_CHANNELS; + ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype); /* hide all channels not selected */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_UNSEL); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); - for (ale= anim_data.first; ale; ale= ale->next) + for (ale= anim_data.first; ale; ale= ale->next) { + /* clear setting first */ ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_CLEAR); + + /* now also flush selection status as appropriate + * NOTE: in some cases, this may result in repeat flushing being performed + */ + ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, 0); + } BLI_freelistN(&anim_data); - - /* get list of all channels that selection may need to be flushed to */ - filter= ANIMFILTER_CHANNELS; - ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype); - /* make all the selected channels visible */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); @@ -1111,7 +1116,7 @@ void ANIM_OT_channels_visibility_set (wmOperatorType *ot) /* identifiers */ ot->name= "Set Visibility"; ot->idname= "ANIM_OT_channels_visibility_set"; - ot->description= "Make only the selected animation channels visible in the Graph Editor."; + ot->description= "Make only the selected animation channels visible in the Graph Editor"; /* api callbacks */ ot->exec= animchannels_visibility_set_exec; @@ -1148,12 +1153,11 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *op) /* See if we should be making showing all selected or hiding */ for (ale= anim_data.first; ale; ale= ale->next) { - if (vis == ACHANNEL_SETFLAG_CLEAR) - break; - /* set the setting in the appropriate way (if available) */ - if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE)) + if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE)) { vis= ACHANNEL_SETFLAG_CLEAR; + break; + } } /* Now set the flags */ @@ -1179,13 +1183,13 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - + void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot) { /* identifiers */ ot->name= "Toggle Visibility"; ot->idname= "ANIM_OT_channels_visibility_toggle"; - ot->description= "Toggle visibility in Graph Editor of all selected animation channels."; + ot->description= "Toggle visibility in Graph Editor of all selected animation channels"; /* api callbacks */ ot->exec= animchannels_visibility_toggle_exec; @@ -1199,9 +1203,10 @@ void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot) /* defines for setting animation-channel flags */ EnumPropertyItem prop_animchannel_setflag_types[] = { + {ACHANNEL_SETFLAG_TOGGLE, "TOGGLE", 0, "Toggle", ""}, {ACHANNEL_SETFLAG_CLEAR, "DISABLE", 0, "Disable", ""}, {ACHANNEL_SETFLAG_ADD, "ENABLE", 0, "Enable", ""}, - {ACHANNEL_SETFLAG_TOGGLE, "TOGGLE", 0, "Toggle", ""}, + {ACHANNEL_SETFLAG_INVERT, "INVERT", 0, "Invert", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1225,24 +1230,57 @@ EnumPropertyItem prop_animchannel_settings_types[] = { * mode: eAnimChannels_SetFlag * onlysel: only selected channels get the flag set */ -static void setflag_anim_channels (bAnimContext *ac, short setting, short mode, short onlysel) +// TODO: enable a setting which turns flushing on/off? +static void setflag_anim_channels (bAnimContext *ac, short setting, short mode, short onlysel, short flush) { ListBase anim_data = {NULL, NULL}; + ListBase all_data = {NULL, NULL}; bAnimListElem *ale; int filter; - /* filter data */ + /* filter data that we need if flush is on */ + if (flush) { + /* get list of all channels that selection may need to be flushed to */ + filter= ANIMFILTER_CHANNELS; + ANIM_animdata_filter(ac, &all_data, filter, ac->data, ac->datatype); + } + + /* filter data that we're working on */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); if (onlysel) filter |= ANIMFILTER_SEL; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* affect selected channels */ + /* 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) */ + if (ANIM_channel_setting_get(ac, ale, setting) > 0) { + mode= ACHANNEL_SETFLAG_CLEAR; + break; + } + } + } + + /* apply the setting */ for (ale= anim_data.first; ale; ale= ale->next) { - /* set the setting in the appropriate way (if available) */ + /* 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); } BLI_freelistN(&anim_data); + BLI_freelistN(&all_data); } /* ------------------- */ @@ -1251,6 +1289,7 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op) { bAnimContext ac; short mode, setting; + short flush=1; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -1260,8 +1299,14 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op) mode= RNA_enum_get(op->ptr, "mode"); setting= RNA_enum_get(op->ptr, "type"); - /* modify setting */ - setflag_anim_channels(&ac, setting, mode, 1); + /* check if setting is flushable */ + if (setting == ACHANNEL_SETTING_EXPAND) + flush= 0; + + /* modify setting + * - only selected channels are affected + */ + setflag_anim_channels(&ac, setting, mode, 1, flush); /* send notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL); @@ -1275,7 +1320,7 @@ void ANIM_OT_channels_setting_enable (wmOperatorType *ot) /* identifiers */ ot->name= "Enable Channel Setting"; ot->idname= "ANIM_OT_channels_setting_enable"; - ot->description= "Enable specified setting on all selected animation channels."; + ot->description= "Enable specified setting on all selected animation channels"; /* api callbacks */ ot->invoke= WM_menu_invoke; @@ -1297,7 +1342,7 @@ void ANIM_OT_channels_setting_disable (wmOperatorType *ot) /* identifiers */ ot->name= "Disable Channel Setting"; ot->idname= "ANIM_OT_channels_setting_disable"; - ot->description= "Disable specified setting on all selected animation channels."; + ot->description= "Disable specified setting on all selected animation channels"; /* api callbacks */ ot->invoke= WM_menu_invoke; @@ -1314,12 +1359,34 @@ void ANIM_OT_channels_setting_disable (wmOperatorType *ot) ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); } +void ANIM_OT_channels_setting_invert (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Invert Channel Setting"; + ot->idname= "ANIM_OT_channels_setting_toggle"; + ot->description= "Invert 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 */ + RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_INVERT, "Mode", ""); + /* setting to set */ + ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); +} + void ANIM_OT_channels_setting_toggle (wmOperatorType *ot) { /* identifiers */ ot->name= "Toggle Channel Setting"; ot->idname= "ANIM_OT_channels_setting_toggle"; - ot->description= "Toggle specified setting on all selected animation channels."; + ot->description= "Toggle specified setting on all selected animation channels"; /* api callbacks */ ot->invoke= WM_menu_invoke; @@ -1336,13 +1403,12 @@ void ANIM_OT_channels_setting_toggle (wmOperatorType *ot) ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); } -// XXX currently, this is a separate operator, but perhaps we could in future specify in keymaps whether to call invoke or exec? void ANIM_OT_channels_editable_toggle (wmOperatorType *ot) { /* identifiers */ ot->name= "Toggle Channel Editability"; ot->idname= "ANIM_OT_channels_editable_toggle"; - ot->description= "Toggle editability of selected channels."; + ot->description= "Toggle editability of selected channels"; /* api callbacks */ ot->exec= animchannels_setflag_exec; @@ -1374,7 +1440,7 @@ static int animchannels_expand_exec (bContext *C, wmOperator *op) onlysel= 0; /* modify setting */ - setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, ACHANNEL_SETFLAG_ADD, onlysel); + setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, ACHANNEL_SETFLAG_ADD, onlysel, 0); /* send notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL); @@ -1387,7 +1453,7 @@ void ANIM_OT_channels_expand (wmOperatorType *ot) /* identifiers */ ot->name= "Expand Channels"; ot->idname= "ANIM_OT_channels_expand"; - ot->description= "Expand (i.e. open) all selected expandable animation channels."; + ot->description= "Expand (i.e. open) all selected expandable animation channels"; /* api callbacks */ ot->exec= animchannels_expand_exec; @@ -1416,7 +1482,7 @@ static int animchannels_collapse_exec (bContext *C, wmOperator *op) onlysel= 0; /* modify setting */ - setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, ACHANNEL_SETFLAG_CLEAR, onlysel); + setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, ACHANNEL_SETFLAG_CLEAR, onlysel, 0); /* send notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL); @@ -1429,7 +1495,7 @@ void ANIM_OT_channels_collapse (wmOperatorType *ot) /* identifiers */ ot->name= "Collapse Channels"; ot->idname= "ANIM_OT_channels_collapse"; - ot->description= "Collapse (i.e. close) all selected expandable animation channels."; + ot->description= "Collapse (i.e. close) all selected expandable animation channels"; /* api callbacks */ ot->exec= animchannels_collapse_exec; @@ -1469,7 +1535,7 @@ 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."; + ot->description= "Toggle selection of all animation channels"; /* api callbacks */ ot->exec= animchannels_deselectall_exec; @@ -1571,7 +1637,7 @@ void ANIM_OT_channels_select_border(wmOperatorType *ot) /* identifiers */ ot->name= "Border Select"; ot->idname= "ANIM_OT_channels_select_border"; - ot->description= "Select all animation channels within the specified region."; + ot->description= "Select all animation channels within the specified region"; /* api callbacks */ ot->invoke= WM_border_select_invoke; @@ -1900,7 +1966,7 @@ void ANIM_OT_channels_click (wmOperatorType *ot) /* identifiers */ ot->name= "Mouse Click on Channels"; ot->idname= "ANIM_OT_channels_click"; - ot->description= "Handle mouse-clicks over animation channels."; + ot->description= "Handle mouse-clicks over animation channels"; /* api callbacks */ ot->invoke= animchannels_mouseclick_invoke; @@ -1925,6 +1991,7 @@ void ED_operatortypes_animchannels(void) WM_operatortype_append(ANIM_OT_channels_setting_enable); WM_operatortype_append(ANIM_OT_channels_setting_disable); + WM_operatortype_append(ANIM_OT_channels_setting_invert); WM_operatortype_append(ANIM_OT_channels_setting_toggle); WM_operatortype_append(ANIM_OT_channels_delete); diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 1d7483d661f..3f461889485 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2008 Blender Foundation. * All rights reserved. diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 2b7bccd6059..9d723c1b8f5 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2008 Blender Foundation. * All rights reserved. diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 193794cea0c..b519be88595 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2008 Blender Foundation, Joshua Leung * All rights reserved. @@ -471,6 +471,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->data= data; ale->type= datatype; // XXX what is the point of the owner data? + // xxx try and use this to simplify the problem of finding whether parent channels are working... ale->owner= owner; ale->ownertype= ownertype; @@ -875,7 +876,6 @@ static FCurve *animdata_filter_fcurve_next (bDopeSheet *ads, FCurve *first, bAct /* only work with this channel and its subchannels if it is editable */ if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) { /* only include this curve if selected in a way consistent with the filtering requirements */ - // FIXME: the first selection test is buggered, and works wrong for sel+curvesonly filtering if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu)) ) { /* only include if this curve is active */ if (!(filter_mode & ANIMFILTER_ACTIVE) || (fcu->flag & FCURVE_ACTIVE)) { @@ -930,27 +930,59 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS // TODO: in future, should we expect to need nested groups? for (agrp= act->groups.first; agrp; agrp= agrp->next) { FCurve *first_fcu; + int filter_gmode; /* store reference to last channel of group */ if (agrp->channels.last) lastchan= agrp->channels.last; - /* get the first F-Curve in this group we can start to use, - * and if there isn't any F-Curve to start from, then don't - * this group at all... + + /* make a copy of filtering flags for use by the sub-channels of this group */ + filter_gmode= filter_mode; + + /* if we care about the selection status of the channels, + * but the group isn't expanded... + */ + if ( (filter_mode & (ANIMFILTER_SEL|ANIMFILTER_UNSEL)) && /* care about selection status */ + (EXPANDED_AGRP(agrp)==0) ) /* group isn't expanded */ + { + /* if the group itself isn't selected appropriately, we shouldn't consider it's children either */ + if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0) + continue; + + /* 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) + * + * Tools affected by this at time of coding (2010 Feb 09): + * - inserting keyframes on selected channels only + * - pasting keyframes + * - creating ghost curves in Graph Editor + */ + filter_gmode &= ~(ANIMFILTER_SEL|ANIMFILTER_UNSEL); + } + + + /* get the first F-Curve in this group we can start to use, and if there isn't any F-Curve to start from, + * then don't use this group at all... * - * exceptions for when we might not care whether there's anything inside this group or not - * - if we're interested in channels and their selections, in which case group channel should get considered too - * even if all its sub channels are hidden... + * NOTE: use filter_gmode here not filter_mode, since there may be some flags we shouldn't consider under certain circumstances */ - first_fcu = animdata_filter_fcurve_next(ads, agrp->channels.first, agrp, filter_mode, owner_id); + first_fcu = animdata_filter_fcurve_next(ads, agrp->channels.first, agrp, filter_gmode, owner_id); - if ( (filter_mode & (ANIMFILTER_SEL|ANIMFILTER_UNSEL)) || - (first_fcu) ) - { + /* Bug note: + * Selecting open group to toggle visbility of the group, where the F-Curves of the group are not suitable + * for inclusion due to their selection status (vs visibility status of bones/etc., as is usually the case), + * will not work, since the group gets skipped. However, fixing this can easily reintroduce the bugs whereby + * hidden groups (due to visibility status of bones/etc.) that were selected before becoming invisible, can + * easily get deleted accidentally as they'd be included in the list filtered for that purpose. + * + * So, for now, best solution is to just leave this note here, and hope to find a solution at a later date. + * -- Joshua Leung, 2010 Feb 10 + */ + if (first_fcu) { /* add this group as a channel first */ if ((filter_mode & ANIMFILTER_CHANNELS) || !(filter_mode & ANIMFILTER_CURVESONLY)) { - /* check if filtering by selection */ + /* filter selection of channel specially here again, since may be open and not subject to previous test */ if ( ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) ) { ale= make_new_animlistelem(agrp, ANIMTYPE_GROUP, NULL, ANIMTYPE_NONE, owner_id); if (ale) { @@ -971,7 +1003,6 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS * - group is expanded * - we just need the F-Curves present */ - // FIXME: checking if groups are expanded is only valid if in one or other modes if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) ) { /* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter, @@ -981,7 +1012,8 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS if ( !(filter_mode & ANIMFILTER_CURVEVISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE) ) { if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) { - items += animdata_filter_fcurves(anim_data, ads, first_fcu, agrp, owner, ownertype, filter_mode, owner_id); + /* NOTE: filter_gmode is used here, not standard filter_mode, since there may be some flags that shouldn't apply */ + items += animdata_filter_fcurves(anim_data, ads, first_fcu, agrp, owner, ownertype, filter_gmode, owner_id); } } } diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h index 2d363a52248..5602bff77ce 100644 --- a/source/blender/editors/animation/anim_intern.h +++ b/source/blender/editors/animation/anim_intern.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place * Suite 330, Boston, MA 02111*1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung * This is a new part of Blender (with some old code) diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 9e698d18105..0f29c274535 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 38dcdd0c405..1d4773b0202 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2008 Blender Foundation. * All rights reserved. @@ -365,7 +365,7 @@ static void MARKER_OT_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Time Marker"; - ot->description= "Add a new time marker."; + ot->description= "Add a new time marker"; ot->idname= "MARKER_OT_add"; /* api callbacks */ @@ -619,7 +619,7 @@ static void MARKER_OT_move(wmOperatorType *ot) { /* identifiers */ ot->name= "Move Time Marker"; - ot->description= "Move selected time marker(s)."; + ot->description= "Move selected time marker(s)"; ot->idname= "MARKER_OT_move"; /* api callbacks */ @@ -707,7 +707,7 @@ static void MARKER_OT_duplicate(wmOperatorType *ot) { /* identifiers */ ot->name= "Duplicate Time Marker"; - ot->description= "Duplicate selected time marker(s)."; + ot->description= "Duplicate selected time marker(s)"; ot->idname= "MARKER_OT_duplicate"; /* api callbacks */ @@ -784,7 +784,7 @@ static void MARKER_OT_select(wmOperatorType *ot) { /* identifiers */ ot->name= "Select Time Marker"; - ot->description= "Select time marker(s)."; + ot->description= "Select time marker(s)"; ot->idname= "MARKER_OT_select"; /* api callbacks */ @@ -865,7 +865,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot) { /* identifiers */ ot->name= "Marker Border select"; - ot->description= "Select all time markers using border selection."; + ot->description= "Select all time markers using border selection"; ot->idname= "MARKER_OT_select_border"; /* api callbacks */ @@ -930,7 +930,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot) { /* identifiers */ ot->name= "(De)select all markers"; - ot->description= "Change selection of all time markers."; + ot->description= "Change selection of all time markers"; ot->idname= "MARKER_OT_select_all"; /* api callbacks */ @@ -975,7 +975,7 @@ static void MARKER_OT_delete(wmOperatorType *ot) { /* identifiers */ ot->name= "Delete Markers"; - ot->description= "Delete selected time marker(s)."; + ot->description= "Delete selected time marker(s)"; ot->idname= "MARKER_OT_delete"; /* api callbacks */ @@ -1021,7 +1021,7 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot) /* identifiers */ ot->name= "Make Links to Scene"; - ot->description= "Link markers to another scene."; + ot->description= "Link markers to another scene"; ot->idname= "MARKER_OT_make_links_scene"; /* api callbacks */ @@ -1067,7 +1067,7 @@ static void MARKER_OT_camera_bind(wmOperatorType *ot) { /* identifiers */ ot->name= "Bind Camera to Markers"; - ot->description= "Bind the active camera to selected markers(s)."; + ot->description= "Bind the active camera to selected markers(s)"; ot->idname= "MARKER_OT_camera_bind"; /* api callbacks */ diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 8ac2bd5753a..090df504b83 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2008 Blender Foundation. * All rights reserved. @@ -165,7 +165,7 @@ void ANIM_OT_change_frame(wmOperatorType *ot) /* identifiers */ ot->name= "Change frame"; ot->idname= "ANIM_OT_change_frame"; - ot->description= "Interactively change the current frame number."; + ot->description= "Interactively change the current frame number"; /* api callbacks */ ot->exec= change_frame_exec; diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index a993c4e238b..ababa25917a 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung * All rights reserved. @@ -415,7 +415,7 @@ void ANIM_OT_driver_button_add (wmOperatorType *ot) /* identifiers */ ot->name= "Add Driver"; ot->idname= "ANIM_OT_driver_button_add"; - ot->description= "Add driver(s) for the property(s) connected represented by the highlighted button."; + ot->description= "Add driver(s) for the property(s) connected represented by the highlighted button"; /* callbacks */ ot->exec= add_driver_button_exec; @@ -478,7 +478,7 @@ void ANIM_OT_driver_button_remove (wmOperatorType *ot) /* identifiers */ 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."; + ot->description= "Remove the driver(s) for the property(s) connected represented by the highlighted button"; /* callbacks */ ot->exec= remove_driver_button_exec; @@ -525,7 +525,7 @@ void ANIM_OT_copy_driver_button (wmOperatorType *ot) /* identifiers */ ot->name= "Copy Driver"; ot->idname= "ANIM_OT_copy_driver_button"; - ot->description= "Copy the driver for the highlighted button."; + ot->description= "Copy the driver for the highlighted button"; /* callbacks */ ot->exec= copy_driver_button_exec; @@ -569,7 +569,7 @@ void ANIM_OT_paste_driver_button (wmOperatorType *ot) /* identifiers */ 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."; + ot->description= "Paste the driver in the copy/paste buffer for the highlighted button"; /* callbacks */ ot->exec= paste_driver_button_exec; diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 3ba20ca3e88..651ce34a2f2 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Blender Foundation. * All rights reserved. @@ -594,7 +594,7 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie PointerRNA ptr; /* init the RNA-pointer */ - RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr); + RNA_pointer_create(id, &RNA_FModifier, fcm, &ptr); /* draw header */ { diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 3b91e9153de..011422eb65c 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung * All rights reserved. diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 718286b4ba4..6511a022718 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2008 Blender Foundation * @@ -97,7 +97,7 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc return 0; /* set the F-Curve into the editdata so that it can be accessed */ - if(bed) { + if (bed) { bed->fcu= fcu; bed->curIndex= 0; } @@ -109,8 +109,9 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc */ if (bezt_ok) { for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) { + if (bed) bed->curIndex= i; + /* Only operate on this BezTriple if it fullfills the criteria of the validation func */ - if(bed) bed->curIndex= i; if (bezt_ok(bed, bezt)) { /* Exit with return-code '1' if function returns positive * This is useful if finding if some BezTriple satisfies a condition. @@ -121,17 +122,18 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc } else { for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) { + if (bed) bed->curIndex= i; + /* Exit with return-code '1' if function returns positive * This is useful if finding if some BezTriple satisfies a condition. */ - if(bed) bed->curIndex= i; if (bezt_cb(bed, bezt)) return 1; } } } /* unset the F-Curve from the editdata now that it's done */ - if(bed) { + if (bed) { bed->fcu= NULL; bed->curIndex= 0; } diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index a1ff940e8b9..c0d91ab7af8 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2008 Blender Foundation * All rights reserved. diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 7a3e6dc5814..58db9cade04 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung * All rights reserved. @@ -222,10 +222,12 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag) { int i= 0; + /* are there already keyframes? */ if (fcu->bezt) { short replace = -1; 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 */ if ((i >= 0) && (i < fcu->totvert)) { @@ -252,6 +254,7 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag) } } } + /* keyframing modes allow to not replace keyframe */ 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"); @@ -270,16 +273,27 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag) /* replace (+ free) old with new, only if necessary to do so */ MEM_freeN(fcu->bezt); fcu->bezt= newb; - + fcu->totvert++; } } - else { - // TODO: need to check for old sample-data now... + /* 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, + * // but for now, having both is asking for trouble + */ + else if ((flag & INSERTKEY_REPLACE)==0 && (fcu->fpt==NULL)) { + /* create new keyframes array */ fcu->bezt= MEM_callocN(sizeof(BezTriple), "beztriple"); *(fcu->bezt)= *bezt; fcu->totvert= 1; } + /* cannot add anything */ + else { + /* 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 @@ -1096,7 +1110,7 @@ void ANIM_OT_keyframe_insert (wmOperatorType *ot) /* 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."; + ot->description= "Insert keyframes on the current frame for all properties in the specified Keying Set"; /* callbacks */ ot->exec= insert_key_exec; @@ -1283,7 +1297,7 @@ void ANIM_OT_keyframe_delete (wmOperatorType *ot) /* identifiers */ ot->name= "Delete Keyframe"; ot->idname= "ANIM_OT_keyframe_delete"; - ot->description= "Delete keyframes on the current frame for all properties in the specified Keying Set."; + ot->description= "Delete keyframes on the current frame for all properties in the specified Keying Set"; /* callbacks */ ot->exec= delete_key_exec; @@ -1427,8 +1441,8 @@ static int insert_key_button_exec (bContext *C, wmOperator *op) /* send updates */ DAG_ids_flush_update(0); - /* for now, only send ND_KEYS for KeyingSets */ - WM_event_add_notifier(C, ND_KEYS, NULL); + /* send notifiers that keyframes have been changed */ + WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); } return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED; @@ -1493,12 +1507,12 @@ static int delete_key_button_exec (bContext *C, wmOperator *op) } - if(success) { + if (success) { /* send updates */ DAG_ids_flush_update(0); - /* for now, only send ND_KEYS for KeyingSets */ - WM_event_add_notifier(C, ND_KEYS, NULL); + /* send notifiers that keyframes have been changed */ + WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); } return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED; diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 07a072d533d..f1d84fb1066 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung * All rights reserved. @@ -152,7 +152,7 @@ void ANIM_OT_keying_set_add (wmOperatorType *ot) /* identifiers */ 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."; + ot->description= "Add a new (empty) Keying Set to the active Scene"; /* callbacks */ ot->exec= add_default_keyingset_exec; @@ -195,7 +195,7 @@ void ANIM_OT_keying_set_remove (wmOperatorType *ot) /* identifiers */ ot->name= "Removed Active Keying Set"; ot->idname= "ANIM_OT_keying_set_remove"; - ot->description= "Remove the active Keying Set."; + ot->description= "Remove the active Keying Set"; /* callbacks */ ot->exec= remove_active_keyingset_exec; @@ -286,7 +286,7 @@ void ANIM_OT_keying_set_path_remove (wmOperatorType *ot) /* identifiers */ ot->name= "Remove Active Keying Set Path"; ot->idname= "ANIM_OT_keying_set_path_remove"; - ot->description= "Remove active Path from active Keying Set."; + ot->description= "Remove active Path from active Keying Set"; /* callbacks */ ot->exec= remove_active_ks_path_exec; |