Anim: Outliner, show bone collections in their hierarchy
The Outliner now shows an Armature's bone collections as a hierarchy instead of a flat list.
This commit is contained in:
@@ -198,7 +198,9 @@ std::unique_ptr<AbstractTreeElement> AbstractTreeElement::create_from_type(const
|
||||
legacy_te, *reinterpret_cast<bArmature *>(owner_id));
|
||||
case TSE_BONE_COLLECTION:
|
||||
return std::make_unique<TreeElementBoneCollection>(
|
||||
legacy_te, *static_cast<BoneCollection *>(create_data));
|
||||
legacy_te,
|
||||
*reinterpret_cast<bArmature *>(owner_id),
|
||||
*static_cast<BoneCollection *>(create_data));
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -30,19 +30,32 @@ TreeElementBoneCollectionBase::TreeElementBoneCollectionBase(TreeElement &legacy
|
||||
|
||||
void TreeElementBoneCollectionBase::expand(SpaceOutliner & /*space_outliner*/) const
|
||||
{
|
||||
for (int index = 0; index < armature_.collection_array_num; index++) {
|
||||
BoneCollection *bcoll = armature_.collection_array[index];
|
||||
int index = 0;
|
||||
for (BoneCollection *bcoll : armature_.collections_roots()) {
|
||||
add_element(
|
||||
&legacy_te_.subtree, &armature_.id, bcoll, &legacy_te_, TSE_BONE_COLLECTION, index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
TreeElementBoneCollection::TreeElementBoneCollection(TreeElement &legacy_te, BoneCollection &bcoll)
|
||||
: AbstractTreeElement(legacy_te), bcoll_(bcoll)
|
||||
TreeElementBoneCollection::TreeElementBoneCollection(TreeElement &legacy_te,
|
||||
bArmature &armature,
|
||||
BoneCollection &bcoll)
|
||||
: AbstractTreeElement(legacy_te), armature_(armature), bcoll_(bcoll)
|
||||
{
|
||||
BLI_assert(legacy_te.store_elem->type == TSE_BONE_COLLECTION);
|
||||
legacy_te.name = bcoll_.name;
|
||||
legacy_te.directdata = &bcoll_;
|
||||
}
|
||||
|
||||
void TreeElementBoneCollection::expand(SpaceOutliner & /*space_outliner*/) const
|
||||
{
|
||||
int index = 0;
|
||||
for (BoneCollection *child_bcoll : armature_.collection_children(&bcoll_)) {
|
||||
add_element(
|
||||
&legacy_te_.subtree, &armature_.id, child_bcoll, &legacy_te_, TSE_BONE_COLLECTION, index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace blender::ed::outliner
|
||||
|
||||
@@ -24,10 +24,12 @@ class TreeElementBoneCollectionBase final : public AbstractTreeElement {
|
||||
};
|
||||
|
||||
class TreeElementBoneCollection final : public AbstractTreeElement {
|
||||
bArmature &armature_;
|
||||
BoneCollection &bcoll_;
|
||||
|
||||
public:
|
||||
TreeElementBoneCollection(TreeElement &legacy_te, BoneCollection &bcoll);
|
||||
TreeElementBoneCollection(TreeElement &legacy_te, bArmature &armature, BoneCollection &bcoll);
|
||||
void expand(SpaceOutliner &) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::ed::outliner
|
||||
|
||||
Reference in New Issue
Block a user