Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_nla/nla_edit.c
| Show First 20 Lines • Show All 687 Lines • ▼ Show 20 Lines | static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| /* refresh auto strip properties */ | /* refresh auto strip properties */ | ||||
| ED_nla_postop_refresh(&ac); | ED_nla_postop_refresh(&ac); | ||||
| DEG_relations_tag_update(ac.bmain); | DEG_relations_tag_update(ac.bmain); | ||||
| /* set notifier that things have changed */ | /* set notifier that things have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL); | ||||
| /* done */ | /* done */ | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void NLA_OT_actionclip_add(wmOperatorType *ot) | void NLA_OT_actionclip_add(wmOperatorType *ot) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| ▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | static int nlaedit_add_transition_exec(bContext *C, wmOperator *op) | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| /* was anything added? */ | /* was anything added? */ | ||||
| if (done) { | if (done) { | ||||
| /* refresh auto strip properties */ | /* refresh auto strip properties */ | ||||
| ED_nla_postop_refresh(&ac); | ED_nla_postop_refresh(&ac); | ||||
| /* set notifier that things have changed */ | /* set notifier that things have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL); | ||||
| /* done */ | /* done */ | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| BKE_report(op->reports, | BKE_report(op->reports, | ||||
| RPT_ERROR, | RPT_ERROR, | ||||
| "Needs at least a pair of adjacent selected strips with a gap between them"); | "Needs at least a pair of adjacent selected strips with a gap between them"); | ||||
| ▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | static int nlaedit_add_sound_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| /* free temp data */ | /* free temp data */ | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| /* refresh auto strip properties */ | /* refresh auto strip properties */ | ||||
| ED_nla_postop_refresh(&ac); | ED_nla_postop_refresh(&ac); | ||||
| /* set notifier that things have changed */ | /* set notifier that things have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL); | ||||
| /* done */ | /* done */ | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void NLA_OT_soundclip_add(wmOperatorType *ot) | void NLA_OT_soundclip_add(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| ale->update |= ANIM_UPDATE_DEPS; | ale->update |= ANIM_UPDATE_DEPS; | ||||
| } | } | ||||
| /* free temp data */ | /* free temp data */ | ||||
| ANIM_animdata_update(&ac, &anim_data); | ANIM_animdata_update(&ac, &anim_data); | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| /* set notifier that things have changed */ | /* set notifier that things have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL); | ||||
| /* done */ | /* done */ | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void NLA_OT_meta_add(wmOperatorType *ot) | void NLA_OT_meta_add(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| ale->update |= ANIM_UPDATE_DEPS; | ale->update |= ANIM_UPDATE_DEPS; | ||||
| } | } | ||||
| /* free temp data */ | /* free temp data */ | ||||
| ANIM_animdata_update(&ac, &anim_data); | ANIM_animdata_update(&ac, &anim_data); | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| /* set notifier that things have changed */ | /* set notifier that things have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL); | ||||
| /* done */ | /* done */ | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void NLA_OT_meta_remove(wmOperatorType *ot) | void NLA_OT_meta_remove(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | if (done) { | ||||
| /* refresh auto strip properties */ | /* refresh auto strip properties */ | ||||
| ED_nla_postop_refresh(&ac); | ED_nla_postop_refresh(&ac); | ||||
| if (!linked) { | if (!linked) { | ||||
| DEG_relations_tag_update(ac.bmain); | DEG_relations_tag_update(ac.bmain); | ||||
| } | } | ||||
| /* set notifier that things have changed */ | /* set notifier that things have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL); | ||||
| /* done */ | /* done */ | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | static int nlaedit_delete_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| /* refresh auto strip properties */ | /* refresh auto strip properties */ | ||||
| ED_nla_postop_refresh(&ac); | ED_nla_postop_refresh(&ac); | ||||
| DEG_relations_tag_update(ac.bmain); | DEG_relations_tag_update(ac.bmain); | ||||
| /* set notifier that things have changed */ | /* set notifier that things have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL); | ||||
| /* done */ | /* done */ | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void NLA_OT_delete(wmOperatorType *ot) | void NLA_OT_delete(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | static int nlaedit_split_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| /* free temp data */ | /* free temp data */ | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| /* refresh auto strip properties */ | /* refresh auto strip properties */ | ||||
| ED_nla_postop_refresh(&ac); | ED_nla_postop_refresh(&ac); | ||||
| /* set notifier that things have changed */ | /* set notifier that things have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL); | ||||
| /* done */ | /* done */ | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void NLA_OT_split(wmOperatorType *ot) | void NLA_OT_split(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ▲ Show 20 Lines • Show All 570 Lines • ▼ Show 20 Lines | static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| ANIM_animdata_update(&ac, &anim_data); | ANIM_animdata_update(&ac, &anim_data); | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| if (copied) { | if (copied) { | ||||
| DEG_relations_tag_update(ac.bmain); | DEG_relations_tag_update(ac.bmain); | ||||
| } | } | ||||
| /* set notifier that things have changed */ | /* set notifier that things have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL); | ||||
| /* done */ | /* done */ | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void NLA_OT_make_single_user(wmOperatorType *ot) | void NLA_OT_make_single_user(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | for (strip = tmp_strips.first; strip; strip = stripn) { | ||||
| /* need to add a new track above the current one */ | /* need to add a new track above the current one */ | ||||
| track = BKE_nlatrack_add(adt, nlt, is_liboverride); | track = BKE_nlatrack_add(adt, nlt, is_liboverride); | ||||
| BKE_nlatrack_add_strip(track, strip, is_liboverride); | BKE_nlatrack_add_strip(track, strip, is_liboverride); | ||||
| /* clear temp meta-strips on this new track, | /* clear temp meta-strips on this new track, | ||||
| * as we may not be able to get back to it */ | * as we may not be able to get back to it */ | ||||
| BKE_nlastrips_clear_metas(&track->strips, 0, 1); | BKE_nlastrips_clear_metas(&track->strips, 0, 1); | ||||
| } | } | ||||
| } | } | ||||
Severin: Better don't do this in a loop, but at the end of the function. You can always send it, or use… | |||||
| /* remove the meta-strips now that we're done */ | /* remove the meta-strips now that we're done */ | ||||
| BKE_nlastrips_clear_metas(&nlt->strips, 0, 1); | BKE_nlastrips_clear_metas(&nlt->strips, 0, 1); | ||||
| /* tag for recalculating the animation */ | /* tag for recalculating the animation */ | ||||
| ale->update |= ANIM_UPDATE_DEPS; | ale->update |= ANIM_UPDATE_DEPS; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 350 Lines • Show Last 20 Lines | |||||
Better don't do this in a loop, but at the end of the function. You can always send it, or use a any_added boolean.