From 7319eda54e7fae1d2f36065c5f4d3288da99cdb3 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Mon, 23 Mar 2020 20:38:19 +0300 Subject: [PATCH] Correct drawable property apply order (bug #5313) --- CHANGELOG.md | 1 + components/nifosg/nifloader.cpp | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ad1091604..9f4b16348d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -205,6 +205,7 @@ Bug #5278: Console command Show doesn't fall back to global variable after local var not found Bug #5300: NPCs don't switch from torch to shield when starting combat Bug #5308: World map copying makes save loading much slower + Bug #5313: Node properties of identical type are not applied in the correct order Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI Feature #3025: Analogue gamepad movement controls diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 644e824842..ea43fc9c65 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -63,6 +63,8 @@ namespace // Collect all properties affecting the given drawable that should be handled on drawable basis rather than on the node hierarchy above it. void collectDrawableProperties(const Nif::Node* nifNode, std::vector& out) { + if (nifNode->parent) + collectDrawableProperties(nifNode->parent, out); const Nif::PropertyList& props = nifNode->props; for (size_t i = 0; i parent) - collectDrawableProperties(nifNode->parent, out); } // NodeCallback used to have a node always oriented towards the camera. The node can have translation and scale @@ -1719,9 +1719,8 @@ namespace NifOsg int lightmode = 1; - for (std::vector::const_reverse_iterator it = properties.rbegin(); it != properties.rend(); ++it) + for (const Nif::Property* property : properties) { - const Nif::Property* property = *it; switch (property->recType) { case Nif::RC_NiSpecularProperty: