From aa7e548102d1352aa7131f39e678fb32e0638d2d Mon Sep 17 00:00:00 2001 From: fallenoak Date: Mon, 27 Oct 2025 23:10:49 -0500 Subject: [PATCH] feat(model): add CM2Model::DetachAllChildrenById --- src/model/CM2Model.cpp | 8 ++++++++ src/model/CM2Model.hpp | 1 + 2 files changed, 9 insertions(+) diff --git a/src/model/CM2Model.cpp b/src/model/CM2Model.cpp index 7526f0d..b229474 100644 --- a/src/model/CM2Model.cpp +++ b/src/model/CM2Model.cpp @@ -777,6 +777,14 @@ void CM2Model::CancelDeferredSequences(uint32_t boneIndex, bool a3) { // TODO } +void CM2Model::DetachAllChildrenById(uint32_t id) { + for (auto model = this->m_attachList; model; model = model->m_attachNext) { + if (model->m_attachId == id) { + model->DetachFromParent(); + } + } +} + void CM2Model::DetachFromParent() { // TODO } diff --git a/src/model/CM2Model.hpp b/src/model/CM2Model.hpp index 2dd47aa..0132509 100644 --- a/src/model/CM2Model.hpp +++ b/src/model/CM2Model.hpp @@ -154,6 +154,7 @@ class CM2Model { void AttachToParent(CM2Model* parent, uint32_t id, const C3Vector* position, int32_t a5); void AttachToScene(CM2Scene* scene); void CancelDeferredSequences(uint32_t boneIndex, bool a3); + void DetachAllChildrenById(uint32_t id); void DetachFromParent(); void DetachFromScene(); void FindKey(M2ModelBoneSeq* sequence, const M2TrackBase& track, uint32_t& currentKey, uint32_t& nextKey, float& ratio);