diff --git a/source/blender/editors/space_outliner/outliner_intern.hh b/source/blender/editors/space_outliner/outliner_intern.hh index 1133aa97c1a..39cd23345d1 100644 --- a/source/blender/editors/space_outliner/outliner_intern.hh +++ b/source/blender/editors/space_outliner/outliner_intern.hh @@ -330,6 +330,11 @@ struct ParticleSystemElementCreateData { ParticleSystem *psys; }; +struct PoseChannelElementCreateData { + Object *object; + bPoseChannel *pchan; +}; + struct PoseGroupElementCreateData { Object *object; bActionGroup *agrp; diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc index 3d849164521..a5e1e736bc3 100644 --- a/source/blender/editors/space_outliner/outliner_tree.cc +++ b/source/blender/editors/space_outliner/outliner_tree.cc @@ -271,6 +271,9 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, else if (type == TSE_R_LAYER) { id = &static_cast(idv)->scene->id; } + else if (type == TSE_POSE_CHANNEL) { + id = &static_cast(idv)->object->id; + } else if (type == TSE_LAYER_COLLECTION) { id = &static_cast(idv)->collection->id; } @@ -347,7 +350,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, else if (ELEM(type, TSE_CONSTRAINT, TSE_CONSTRAINT_BASE)) { /* pass */ } - else if (type == TSE_POSE_BASE) { + else if (ELEM(type, TSE_POSE_BASE, TSE_POSE_CHANNEL)) { /* pass */ } else if (ELEM(type, TSE_POSEGRP, TSE_POSEGRP_BASE)) { @@ -420,6 +423,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, TSE_CONSTRAINT, TSE_CONSTRAINT_BASE, TSE_POSE_BASE, + TSE_POSE_CHANNEL, TSE_POSEGRP, TSE_POSEGRP_BASE, TSE_R_LAYER, @@ -427,9 +431,8 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, TSE_MODIFIER, TSE_MODIFIER_BASE, TSE_GREASE_PENCIL_NODE, - TSE_LINKED_OB, - TSE_VIEW_COLLECTION_BASE) || - ELEM(type, TSE_LAYER_COLLECTION)) + TSE_LINKED_OB) || + ELEM(type, TSE_LAYER_COLLECTION, TSE_VIEW_COLLECTION_BASE)) { BLI_assert_msg(false, "Element type should already use new AbstractTreeElement design"); } diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc index fb77fe3cb0f..d19244d81aa 100644 --- a/source/blender/editors/space_outliner/tree/tree_element.cc +++ b/source/blender/editors/space_outliner/tree/tree_element.cc @@ -165,6 +165,11 @@ std::unique_ptr AbstractTreeElement::createFromType(const i } case TSE_POSE_BASE: return std::make_unique(legacy_te, *static_cast(idv)); + case TSE_POSE_CHANNEL: { + PoseChannelElementCreateData *pchan_data = static_cast(idv); + return std::make_unique( + legacy_te, *pchan_data->object, *pchan_data->pchan); + } case TSE_POSEGRP_BASE: return std::make_unique(legacy_te, *static_cast(idv)); case TSE_POSEGRP: { diff --git a/source/blender/editors/space_outliner/tree/tree_element_pose.cc b/source/blender/editors/space_outliner/tree/tree_element_pose.cc index 1e376525516..6b42dd2347a 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_pose.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_pose.cc @@ -37,10 +37,10 @@ void TreeElementPoseBase::expand(SpaceOutliner &space_outliner) const int const_index = 1000; /* ensure unique id for bone constraints */ int a; LISTBASE_FOREACH_INDEX (bPoseChannel *, pchan, &object_.pose->chanbase, a) { + PoseChannelElementCreateData pchan_data = {&object_, pchan}; + TreeElement *ten = outliner_add_element( - &space_outliner, &legacy_te_.subtree, &object_, &legacy_te_, TSE_POSE_CHANNEL, a); - ten->name = pchan->name; - ten->directdata = pchan; + &space_outliner, &legacy_te_.subtree, &pchan_data, &legacy_te_, TSE_POSE_CHANNEL, a); pchan->temp = (void *)ten; if (!BLI_listbase_is_empty(&pchan->constraints)) { @@ -78,4 +78,16 @@ void TreeElementPoseBase::expand(SpaceOutliner &space_outliner) const } } +/* -------------------------------------------------------------------- */ + +TreeElementPoseChannel::TreeElementPoseChannel(TreeElement &legacy_te, + Object & /* object */, + bPoseChannel &pchan) + : AbstractTreeElement(legacy_te), /* object_(object), */ pchan_(pchan) +{ + BLI_assert(legacy_te.store_elem->type == TSE_POSE_CHANNEL); + legacy_te.name = pchan_.name; + legacy_te.directdata = &pchan_; +} + } // namespace blender::ed::outliner diff --git a/source/blender/editors/space_outliner/tree/tree_element_pose.hh b/source/blender/editors/space_outliner/tree/tree_element_pose.hh index acde9ae7fe8..a1a8f4826dd 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_pose.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_pose.hh @@ -22,4 +22,13 @@ class TreeElementPoseBase final : public AbstractTreeElement { void expand(SpaceOutliner &) const override; }; +class TreeElementPoseChannel final : public AbstractTreeElement { + /* Not needed right now, avoid unused member variable warning. */ + // Object &object_; + bPoseChannel &pchan_; + + public: + TreeElementPoseChannel(TreeElement &legacy_te, Object &object, bPoseChannel &pchan); +}; + } // namespace blender::ed::outliner