refactor: extract shared attachment lookup logic into helper function

Consolidated duplicate attachment point resolution code used by both
attachWeapon() and getAttachmentTransform(). New findAttachmentBone()
helper encapsulates the complete lookup chain: attachment by ID, fallback
scan, key-bone fallback, and validation. Eliminates ~55 lines of duplicate
code while improving maintainability and consistency.
This commit is contained in:
Kelsi 2026-03-11 11:15:06 -07:00
parent bc6cd6e5f2
commit 3202c1392d
2 changed files with 67 additions and 98 deletions

View file

@ -217,6 +217,10 @@ private:
static glm::quat interpolateQuat(const pipeline::M2AnimationTrack& track,
int seqIdx, float time);
// Attachment point lookup helper — shared by attachWeapon() and getAttachmentTransform()
bool findAttachmentBone(uint32_t modelId, uint32_t attachmentId,
uint16_t& outBoneIndex, glm::vec3& outOffset) const;
public:
/**
* Build a composited character skin texture by alpha-blending overlay