diff options
author | Julian Eisel <julian@blender.org> | 2021-03-11 15:39:06 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-03-11 15:49:16 +0300 |
commit | 0f60dbe4bf5227c2f8f21026f11ffd9703101687 (patch) | |
tree | 94e104e58fb66ca8238842b79238bc55819f1280 /source/blender | |
parent | d4d03f736b85f9db0d738428cf9521b2084232db (diff) |
Cleanup: Pass anim-data directly to Outliner anim-data tree element constructor
Rather than letting the `TreeElementAnimData` constructor take an ID from which
we get the animation-data based on an assumption on how it's stored, let the
constructor take the animation-data directly. That way we further centralize
the assumptions on the data passed to the element creation to
`tree_element_create()`.
The following commit will add a comment explaining the plan to entirely get rid
of those assumptions in the future.
Diffstat (limited to 'source/blender')
3 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc index 116a2e4d3c3..d537bdfc99c 100644 --- a/source/blender/editors/space_outliner/tree/tree_element.cc +++ b/source/blender/editors/space_outliner/tree/tree_element.cc @@ -18,6 +18,7 @@ * \ingroup spoutliner */ +#include "DNA_anim_types.h" #include "DNA_listBase.h" #include "tree_element_anim_data.hh" @@ -44,7 +45,7 @@ static AbstractTreeElement *tree_element_create(int type, TreeElement &legacy_te case TSE_SOME_ID: return TreeElementID::createFromID(legacy_te, id); case TSE_ANIM_DATA: - return new TreeElementAnimData(legacy_te, id); + return new TreeElementAnimData(legacy_te, *reinterpret_cast<IdAdtTemplate &>(id).adt); case TSE_DRIVER_BASE: return new TreeElementDriverBase(legacy_te, *static_cast<AnimData *>(idv)); case TSE_NLA: diff --git a/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc b/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc index 5a9568ea906..c0fef7c98e2 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc @@ -32,8 +32,8 @@ namespace blender::ed::outliner { -TreeElementAnimData::TreeElementAnimData(TreeElement &legacy_te, ID &id) - : AbstractTreeElement(legacy_te), anim_data_(*reinterpret_cast<IdAdtTemplate &>(id).adt) +TreeElementAnimData::TreeElementAnimData(TreeElement &legacy_te, AnimData &anim_data) + : AbstractTreeElement(legacy_te), anim_data_(anim_data) { BLI_assert(legacy_te.store_elem->type == TSE_ANIM_DATA); /* this element's info */ diff --git a/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh b/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh index 8114277b6d6..95d08cd20b7 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh @@ -30,7 +30,7 @@ class TreeElementAnimData final : public AbstractTreeElement { AnimData &anim_data_; public: - TreeElementAnimData(TreeElement &legacy_te, ID &id); + TreeElementAnimData(TreeElement &legacy_te, AnimData &anim_data); void expand(SpaceOutliner &space_outliner) const override; |