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:
authorPhilipp Oeser <info@graphics-engineer.com>2021-01-11 15:56:15 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-01-18 15:58:31 +0300
commitb4530deec478e1982156a2a76bd4bdadaf651fb3 (patch)
treecc771351425a8ac4b957616676d0692c082e28e1
parentdfdf79fb03a8eec6e6cd2a098405ae13b00a05ae (diff)
Fix T84586: missing Outliner redraws for certain NLA operators
Outliner display under 'Animation' > 'NLA Tracks' was not updating in the following cases: - adding strips - removing strips - duplicating strips (possibly to different track) - swapping strips - reordering tracks - changing strip order by translating - translating strips between tracks - renaming tracks In the case of deleting strips/tracks, this was also resulting in a use- after-free error in Outliner drawing code (this was reported specifically in T84586). Most of these operators already sent a ND_NLA|NA_EDITED notifier, but the Outliner is not listening to these. Listening to NA_EDITED is also not what we want since this also happens a lot in cases irrelevant to the Outliner. Now be a bit more specific and send ND_NLA|NA_ADDED / ND_NLA| NA_REMOVED or a new ND_NLA_ORDER (to distinguish from NA_EDITED 'only' - where a redraw is not neccessary) and listen to these from the Outliner. (note: places that were listening to ND_NLA|NA_EDITED before are also listening to NA_ADDED or NA_REMOVED, so changing NA_EDITED should not be a problem here) (note 2: for cases like swapping tracks/strips order, NA_ADDED or NA_REMOVED does not make sense, neither can we use NA_EDITED [since we dont want to listen to this], so in this case an additional ND_NLA_ORDER is now sent) (note 3: in nla transform code, this is now always sent on confirm. There are cases were the notifier would not be needed, but checking exactly all cases were it actually would be needed seems overkill [history of D10073 has example code to check if strips moved between tracks]) Maniphest Tasks: T84586 Differential Revision: https://developer.blender.org/D10073
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c2
-rw-r--r--source/blender/editors/object/object_add.c2
-rw-r--r--source/blender/editors/space_nla/nla_channels.c4
-rw-r--r--source/blender/editors/space_nla/nla_edit.c28
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c10
-rw-r--r--source/blender/editors/transform/transform_convert_nla.c7
-rw-r--r--source/blender/windowmanager/WM_types.h1
7 files changed, 41 insertions, 13 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index ac226b36e21..a7d02c0e6fb 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -1580,6 +1580,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ORDER, NULL);
return OPERATOR_FINISHED;
}
@@ -2900,6 +2901,7 @@ static int animchannels_rename_invoke(bContext *C, wmOperator *UNUSED(op), const
/* handle click */
if (rename_anim_channels(&ac, channel_index)) {
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_RENAME, NULL);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 24157ad34a1..c6d6b8b16b9 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1730,7 +1730,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
BLI_strncpy(nlt->name, DATA_("SoundTrack"), sizeof(nlt->name));
BKE_nlastrip_validate_name(adt, strip);
- WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL);
}
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 763a3fd63e6..20a330492a4 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -735,7 +735,7 @@ static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(CTX_data_main(C));
/* 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 */
return OPERATOR_FINISHED;
@@ -823,7 +823,7 @@ static int nlaedit_delete_tracks_exec(bContext *C, wmOperator *UNUSED(op))
DEG_relations_tag_update(ac.bmain);
/* 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 */
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 3fa1b614a03..d7bf6c324ac 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -693,7 +693,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(ac.bmain);
/* 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 */
return OPERATOR_FINISHED;
@@ -823,7 +823,7 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op)
ED_nla_postop_refresh(&ac);
/* 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 */
return OPERATOR_FINISHED;
@@ -920,7 +920,7 @@ static int nlaedit_add_sound_exec(bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* 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 */
return OPERATOR_FINISHED;
@@ -992,7 +992,7 @@ static int nlaedit_add_meta_exec(bContext *C, wmOperator *UNUSED(op))
ANIM_animdata_freelist(&anim_data);
/* 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 */
return OPERATOR_FINISHED;
@@ -1053,7 +1053,7 @@ static int nlaedit_remove_meta_exec(bContext *C, wmOperator *UNUSED(op))
ANIM_animdata_freelist(&anim_data);
/* 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 */
return OPERATOR_FINISHED;
@@ -1155,7 +1155,7 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op)
}
/* 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 */
return OPERATOR_FINISHED;
@@ -1260,7 +1260,7 @@ static int nlaedit_delete_exec(bContext *C, wmOperator *UNUSED(op))
DEG_relations_tag_update(ac.bmain);
/* 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 */
return OPERATOR_FINISHED;
@@ -1415,7 +1415,7 @@ static int nlaedit_split_exec(bContext *C, wmOperator *UNUSED(op))
ED_nla_postop_refresh(&ac);
/* 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 */
return OPERATOR_FINISHED;
@@ -1659,6 +1659,7 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
/* 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_ORDER, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1744,6 +1745,7 @@ static int nlaedit_move_up_exec(bContext *C, wmOperator *UNUSED(op))
/* 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_ORDER, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -1829,6 +1831,7 @@ static int nlaedit_move_down_exec(bContext *C, wmOperator *UNUSED(op))
/* 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_ORDER, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -2002,7 +2005,7 @@ static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op))
}
/* 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 */
return OPERATOR_FINISHED;
@@ -2241,6 +2244,8 @@ static int nlaedit_snap_exec(bContext *C, wmOperator *op)
scene = ac.scene;
secf = (float)FPS;
+ bool any_added = false;
+
/* since we may add tracks, perform this in reverse order */
for (ale = anim_data.last; ale; ale = ale->prev) {
ListBase tmp_strips = {NULL, NULL};
@@ -2314,6 +2319,8 @@ static int nlaedit_snap_exec(bContext *C, wmOperator *op)
/* clear temp meta-strips on this new track,
* as we may not be able to get back to it */
BKE_nlastrips_clear_metas(&track->strips, 0, 1);
+
+ any_added = true;
}
}
@@ -2333,6 +2340,9 @@ static int nlaedit_snap_exec(bContext *C, wmOperator *op)
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
+ if (any_added) {
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL);
+ }
/* done */
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index f207b6193be..6c9d4433abd 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -222,10 +222,18 @@ static void outliner_main_region_listener(wmWindow *UNUSED(win),
ED_region_tag_redraw(region);
break;
case ND_ANIMCHAN:
- if (wmn->action == NA_SELECTED) {
+ if (ELEM(wmn->action, NA_SELECTED, NA_RENAME)) {
ED_region_tag_redraw(region);
}
break;
+ case ND_NLA:
+ if (ELEM(wmn->action, NA_ADDED, NA_REMOVED)) {
+ ED_region_tag_redraw(region);
+ }
+ break;
+ case ND_NLA_ORDER:
+ ED_region_tag_redraw(region);
+ break;
}
break;
case NC_GPENCIL:
diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c
index ada668bcd04..adc2d03e2dc 100644
--- a/source/blender/editors/transform/transform_convert_nla.c
+++ b/source/blender/editors/transform/transform_convert_nla.c
@@ -36,6 +36,7 @@
#include "ED_markers.h"
#include "WM_api.h"
+#include "WM_types.h"
#include "RNA_access.h"
@@ -554,6 +555,12 @@ void special_aftertrans_update__nla(bContext *C, TransInfo *UNUSED(t))
BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
}
+ /* General refresh for the outliner because the following might have happened:
+ * - strips moved between tracks
+ * - strips swapped order
+ * - duplicate-move moves to different track. */
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL);
+
/* free temp memory */
ANIM_animdata_freelist(&anim_data);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 448166170a9..0a32d2f0405 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -392,6 +392,7 @@ typedef struct wmNotifier {
#define ND_NLA (73 << 16)
#define ND_NLA_ACTCHANGE (74 << 16)
#define ND_FCURVES_ORDER (75 << 16)
+#define ND_NLA_ORDER (76 << 16)
/* NC_GPENCIL */
#define ND_GPENCIL_EDITMODE (85 << 16)