Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions include/Geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,20 @@ class BSGeometry : public NiCloneableStreamable<BSGeometry, NiShape> {
bool GetTriangles(std::vector<Triangle>& tris) const override;
void SetTriangles(const std::vector<Triangle>& tris) override;

bool IsSkinned() const override { return !skinInstanceRef.IsEmpty(); }

bool HasSkinInstance() const override { return !skinInstanceRef.IsEmpty(); }
NiBlockRef<NiBoneContainer>* SkinInstanceRef() override { return &skinInstanceRef; }
const NiBlockRef<NiBoneContainer>* SkinInstanceRef() const override { return &skinInstanceRef; }

bool HasShaderProperty() const override { return !shaderPropertyRef.IsEmpty(); }
NiBlockRef<NiShader>* ShaderPropertyRef() override { return &shaderPropertyRef; }
const NiBlockRef<NiShader>* ShaderPropertyRef() const override { return &shaderPropertyRef; }

bool HasAlphaProperty() const override { return !alphaPropertyRef.IsEmpty(); }
NiBlockRef<NiAlphaProperty>* AlphaPropertyRef() override { return &alphaPropertyRef; }
const NiBlockRef<NiAlphaProperty>* AlphaPropertyRef() const override { return &alphaPropertyRef; }

uint8_t MeshCount() { return (uint8_t) meshes.size(); }

// Flag 0x200 (512) on BSGeometry controls whether mesh data is embedded inline
Expand Down
23 changes: 17 additions & 6 deletions src/NifFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2445,13 +2445,24 @@ uint32_t NifFile::GetShapeBoneList(NiShape* shape, std::vector<std::string>& out
return 0;

auto skinInst = hdr.GetBlock<NiBoneContainer>(shape->SkinInstanceRef());
if (!skinInst)
return 0;
if (skinInst) {
for (auto& bone : skinInst->boneRefs) {
auto node = hdr.GetBlock(bone);
if (node)
outList.push_back(node->name.get());
}
}

for (auto& bone : skinInst->boneRefs) {
auto node = hdr.GetBlock(bone);
if (node)
outList.push_back(node->name.get());
// SF NIFs store bone names in SkinAttach extra data instead of NiNode refs
if (outList.empty()) {
for (auto& extraDataRef : shape->extraDataRefs) {
auto skinAttach = hdr.GetBlock<SkinAttach>(extraDataRef);
if (skinAttach) {
for (auto& bone : skinAttach->bones)
outList.push_back(bone.get());
break;
}
}
}

return static_cast<uint32_t>(outList.size());
Expand Down
Loading