diff options
Diffstat (limited to 'source/blender/editors/animation/anim_deps.c')
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 129 |
1 files changed, 48 insertions, 81 deletions
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 4fb68b614ff..e552a321bca 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -44,12 +44,13 @@ #include "BKE_gpencil.h" #include "BKE_main.h" #include "BKE_node.h" -#include "BKE_sequencer.h" #include "DEG_depsgraph.h" #include "RNA_access.h" +#include "SEQ_sequencer.h" + #include "ED_anim_api.h" /* **************************** depsgraph tagging ******************************** */ @@ -108,7 +109,7 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale) * we'd be calling property update functions here too ... */ DEG_id_tag_update(id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | - ID_RECALC_ANIMATION); // XXX or do we want something more restrictive? + ID_RECALC_ANIMATION); /* XXX or do we want something more restrictive? */ } } @@ -121,7 +122,7 @@ void ANIM_id_update(Main *bmain, ID *id) bmain, id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | - ID_RECALC_ANIMATION); // XXX or do we want something more restrictive? + ID_RECALC_ANIMATION); /* XXX or do we want something more restrictive? */ } } @@ -199,97 +200,64 @@ static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGro } } -/* perform syncing updates for F-Curves */ -static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), - bAnimListElem *ale, - FCurve **active_fcurve) +static void animchan_sync_fcurve_scene(bAnimListElem *ale) { - FCurve *fcu = (FCurve *)ale->data; ID *owner_id = ale->id; + BLI_assert(GS(owner_id->name) == ID_SCE); + Scene *scene = (Scene *)owner_id; + FCurve *fcu = (FCurve *)ale->data; - /* 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)) { + /* only affect if F-Curve involves sequence_editor.sequences */ + if (!strstr(fcu->rna_path, "sequences_all")) { return; } - if (GS(owner_id->name) == ID_SCE) { - Scene *scene = (Scene *)owner_id; + Editing *ed = BKE_sequencer_editing_get(scene, false); - /* 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 */ + char *seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all["); + Sequence *seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, false); + if (seq_name) { + MEM_freeN(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); - } + if (seq == NULL) { + return; + } - /* update selection status */ - if (seq) { - if (seq->flag & SELECT) { - fcu->flag |= FCURVE_SELECTED; - } - else { - fcu->flag &= ~FCURVE_SELECTED; - } - } - } + /* update selection status */ + if (seq->flag & SELECT) { + fcu->flag |= FCURVE_SELECTED; } - 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); - } + else { + fcu->flag &= ~FCURVE_SELECTED; + } +} - /* update selection/active status */ - if (node) { - /* update selection status */ - if (node->flag & NODE_SELECT) { - fcu->flag |= FCURVE_SELECTED; - } - else { - fcu->flag &= ~FCURVE_SELECTED; - } +/* perform syncing updates for F-Curves */ +static void animchan_sync_fcurve(bAnimListElem *ale) +{ + FCurve *fcu = (FCurve *)ale->data; + ID *owner_id = ale->id; - /* 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 - * nodes while working with bones? - */ - if (node->flag & NODE_ACTIVE) { - if (*active_fcurve == NULL) { - fcu->flag |= FCURVE_ACTIVE; - *active_fcurve = fcu; - } - else { - fcu->flag &= ~FCURVE_ACTIVE; - } - } - else { - fcu->flag &= ~FCURVE_ACTIVE; - } - } - } + /* 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; + } + + switch (GS(owner_id->name)) { + case ID_SCE: + animchan_sync_fcurve_scene(ale); + break; + default: + break; } } /* perform syncing updates for GPencil Layers */ -static void animchan_sync_gplayer(bAnimContext *UNUSED(ac), bAnimListElem *ale) +static void animchan_sync_gplayer(bAnimListElem *ale) { bGPDlayer *gpl = (bGPDlayer *)ale->data; @@ -321,7 +289,6 @@ void ANIM_sync_animchannels_to_data(const bContext *C) 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) { @@ -345,11 +312,11 @@ void ANIM_sync_animchannels_to_data(const bContext *C) break; case ANIMTYPE_FCURVE: - animchan_sync_fcurve(&ac, ale, &active_fcurve); + animchan_sync_fcurve(ale); break; case ANIMTYPE_GPLAYER: - animchan_sync_gplayer(&ac, ale); + animchan_sync_gplayer(ale); break; } } |