diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt index 7467de90295..cfd10ec134c 100644 --- a/source/blender/editors/space_outliner/CMakeLists.txt +++ b/source/blender/editors/space_outliner/CMakeLists.txt @@ -56,6 +56,7 @@ set(SRC tree/tree_element_bone.cc tree/tree_element_collection.cc tree/tree_element_driver.cc + tree/tree_element_edit_bone.cc tree/tree_element_gpencil_layer.cc tree/tree_element_id.cc tree/tree_element_id_armature.cc @@ -86,6 +87,7 @@ set(SRC tree/tree_element_bone.hh tree/tree_element_collection.hh tree/tree_element_driver.hh + tree/tree_element_edit_bone.hh tree/tree_element_gpencil_layer.hh tree/tree_element_id.hh tree/tree_element_id_armature.hh diff --git a/source/blender/editors/space_outliner/outliner_intern.hh b/source/blender/editors/space_outliner/outliner_intern.hh index 0c81fa90ba0..5ab885e524d 100644 --- a/source/blender/editors/space_outliner/outliner_intern.hh +++ b/source/blender/editors/space_outliner/outliner_intern.hh @@ -292,6 +292,11 @@ struct BoneElementCreateData { Bone *bone; }; +struct EditBoneElementCreateData { + ID *armature_id; + EditBone *ebone; +}; + TreeTraversalAction outliner_collect_selected_collections(TreeElement *te, void *customdata); TreeTraversalAction outliner_collect_selected_objects(TreeElement *te, void *customdata); diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc index 80db1324507..f52df941f53 100644 --- a/source/blender/editors/space_outliner/outliner_tree.cc +++ b/source/blender/editors/space_outliner/outliner_tree.cc @@ -242,6 +242,9 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, else if (type == TSE_BONE) { id = static_cast(idv)->armature_id; } + else if (type == TSE_EBONE) { + id = static_cast(idv)->armature_id; + } /* exceptions */ if (ELEM(type, TSE_ID_BASE, TSE_GENERIC_LABEL)) { @@ -297,7 +300,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, else if (ELEM(type, TSE_ID_BASE, TSE_GENERIC_LABEL)) { /* pass */ } - else if (type == TSE_BONE) { + else if (ELEM(type, TSE_BONE, TSE_EBONE)) { /* pass */ } else if (type == TSE_SOME_ID) { @@ -337,6 +340,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, TSE_ANIM_DATA, TSE_BONE, TSE_DRIVER_BASE, + TSE_EBONE, TSE_NLA, TSE_NLA_ACTION, TSE_NLA_TRACK, diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc index 083e27d57c7..c7cb80f520d 100644 --- a/source/blender/editors/space_outliner/tree/tree_element.cc +++ b/source/blender/editors/space_outliner/tree/tree_element.cc @@ -21,6 +21,7 @@ #include "tree_element_bone.hh" #include "tree_element_collection.hh" #include "tree_element_driver.hh" +#include "tree_element_edit_bone.hh" #include "tree_element_gpencil_layer.hh" #include "tree_element_id.hh" #include "tree_element_label.hh" @@ -108,6 +109,11 @@ std::unique_ptr AbstractTreeElement::createFromType(const i return std::make_unique( legacy_te, *bone_data->armature_id, *bone_data->bone); } + case TSE_EBONE: { + EditBoneElementCreateData *ebone_data = static_cast(idv); + return std::make_unique( + legacy_te, *ebone_data->armature_id, *ebone_data->ebone); + } default: break; } diff --git a/source/blender/editors/space_outliner/tree/tree_element_edit_bone.cc b/source/blender/editors/space_outliner/tree/tree_element_edit_bone.cc new file mode 100644 index 00000000000..28e8e200759 --- /dev/null +++ b/source/blender/editors/space_outliner/tree/tree_element_edit_bone.cc @@ -0,0 +1,24 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup spoutliner + */ + +#include "BKE_armature.h" + +#include "../outliner_intern.hh" + +#include "tree_element_edit_bone.hh" + +namespace blender::ed::outliner { + +TreeElementEditBone::TreeElementEditBone(TreeElement &legacy_te, ID &armature_id, EditBone &ebone) + : AbstractTreeElement(legacy_te), armature_id_(armature_id), ebone_(ebone) +{ + legacy_te.directdata = &ebone; + legacy_te.name = ebone.name; +} + +} // namespace blender::ed::outliner diff --git a/source/blender/editors/space_outliner/tree/tree_element_edit_bone.hh b/source/blender/editors/space_outliner/tree/tree_element_edit_bone.hh new file mode 100644 index 00000000000..abf9f539824 --- /dev/null +++ b/source/blender/editors/space_outliner/tree/tree_element_edit_bone.hh @@ -0,0 +1,25 @@ +/* SPDX-FileCopyrightText: 2023 Blender Foundation + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup spoutliner + */ + +#pragma once + +#include "tree_element.hh" + +struct EditBone; + +namespace blender::ed::outliner { + +class TreeElementEditBone final : public AbstractTreeElement { + ID &armature_id_; + EditBone &ebone_; + + public: + TreeElementEditBone(TreeElement &legacy_te, ID &armature_id, EditBone &ebone); +}; + +} // namespace blender::ed::outliner diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_armature.cc b/source/blender/editors/space_outliner/tree/tree_element_id_armature.cc index 5974961bde0..86c2c81e8f6 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_id_armature.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_id_armature.cc @@ -52,10 +52,9 @@ void TreeElementIDArmature::expand_edit_bones(SpaceOutliner &space_outiner) cons { int a = 0; LISTBASE_FOREACH_INDEX (EditBone *, ebone, arm_.edbo, a) { + EditBoneElementCreateData ebone_data = {&arm_.id, ebone}; TreeElement *ten = outliner_add_element( - &space_outiner, &legacy_te_.subtree, &arm_.id, &legacy_te_, TSE_EBONE, a); - ten->directdata = ebone; - ten->name = ebone->name; + &space_outiner, &legacy_te_.subtree, &ebone_data, &legacy_te_, TSE_EBONE, a); ebone->temp.p = ten; } /* make hierarchy */