Skip to content

SkinPartition: compare Bones lists by content, not reference#23

Merged
ousnius merged 2 commits intoousnius:mainfrom
MANOLOV02:fix/updatepartitionflags-sequenceequal
Apr 25, 2026
Merged

SkinPartition: compare Bones lists by content, not reference#23
ousnius merged 2 commits intoousnius:mainfrom
MANOLOV02:fix/updatepartitionflags-sequenceequal

Conversation

@MANOLOV02
Copy link
Copy Markdown
Contributor

UpdatePartitionFlags checks Partitions[i].Bones != Partitions[i-1].Bones to decide whether to emit a "start net boneset" flag. In C# != on List<> is reference equality, so two partitions that happen to share contents but are distinct list instances will always be flagged as different — the flag becomes meaningless.

C++ reference: nifly/NifFile.cpp:4458 — comparison uses std::vector<uint16_t>::operator!=, which is element-wise.

Fix: use !SequenceEqual(...) for the C# equivalent.

Maps to issue #15 item B6.

MANOLOV02 and others added 2 commits April 25, 2026 17:46
`skinPart.Partitions[i].Bones != skinPart.Partitions[i - 1].Bones`
compared the List<ushort> references. Two partitions with identical
bone palettes held in separate lists always compared "different",
which set PF_START_NET_BONESET on every subsequent partition —
wasteful boneset restarts during render.

Matches C++ nifly NifFile.cpp:4458 where the same expression uses
std::vector<uint16_t>::operator!= (element-by-element comparison).
Use SequenceEqual for the C# equivalent.
@ousnius ousnius merged commit f662c91 into ousnius:main Apr 25, 2026
1 check passed
@MANOLOV02 MANOLOV02 deleted the fix/updatepartitionflags-sequenceequal branch April 25, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants