diff options
author | Julian Eisel <julian@blender.org> | 2021-03-11 15:14:22 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-03-11 15:18:17 +0300 |
commit | f59ff9e03a633f64f9587eb67eee7913fed685a8 (patch) | |
tree | 3540ae6e0b9e36b3fb4c4337d74ad153edb635d2 | |
parent | 018fffbe77414e2d6b80dc50d5f3d2d5bbf71169 (diff) |
Fix crash when showing NLA actions in the Outliner
Caused by 2e221de4ceee in combination with 4292bb060d59.
In the former I forgot to set the name for NLA actions in the new code design,
in the latter I made it an assumtion that tree element types using the new
design set the name.
The following commit will make this assumption explicit with an assert.
3 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc index 25bd9a53cf8..116a2e4d3c3 100644 --- a/source/blender/editors/space_outliner/tree/tree_element.cc +++ b/source/blender/editors/space_outliner/tree/tree_element.cc @@ -52,7 +52,7 @@ static AbstractTreeElement *tree_element_create(int type, TreeElement &legacy_te case TSE_NLA_TRACK: return new TreeElementNLATrack(legacy_te, *static_cast<NlaTrack *>(idv)); case TSE_NLA_ACTION: - return new TreeElementNLAAction(legacy_te); + return new TreeElementNLAAction(legacy_te, *static_cast<bAction *>(idv)); case TSE_GP_LAYER: return new TreeElementGPencilLayer(legacy_te, *static_cast<bGPDlayer *>(idv)); case TSE_R_LAYER_BASE: diff --git a/source/blender/editors/space_outliner/tree/tree_element_nla.cc b/source/blender/editors/space_outliner/tree/tree_element_nla.cc index 5d4ec53e60c..65832e8f981 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_nla.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_nla.cc @@ -70,9 +70,11 @@ void TreeElementNLATrack::expand(SpaceOutliner &space_outliner) const /* -------------------------------------------------------------------- */ -TreeElementNLAAction::TreeElementNLAAction(TreeElement &legacy_te) : AbstractTreeElement(legacy_te) +TreeElementNLAAction::TreeElementNLAAction(TreeElement &legacy_te, const bAction &action) + : AbstractTreeElement(legacy_te) { BLI_assert(legacy_te.store_elem->type == TSE_NLA_ACTION); + legacy_te.name = action.id.name + 2; } } // namespace blender::ed::outliner diff --git a/source/blender/editors/space_outliner/tree/tree_element_nla.hh b/source/blender/editors/space_outliner/tree/tree_element_nla.hh index c94287ce576..7cbc8689483 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_nla.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_nla.hh @@ -46,7 +46,7 @@ class TreeElementNLATrack final : public AbstractTreeElement { class TreeElementNLAAction final : public AbstractTreeElement { public: - TreeElementNLAAction(TreeElement &legacy_te); + TreeElementNLAAction(TreeElement &legacy_te, const bAction &action); }; } // namespace blender::ed::outliner |