Hide Nif nodes with name "EditorMarker".

macos_ci
Petr Mikheev 2 years ago
parent 1b669db017
commit fd90a8c9b4

@ -182,8 +182,8 @@ namespace NifBullet
if (hasCollisionNode && !hasCollisionShape) if (hasCollisionNode && !hasCollisionShape)
mShape->mVisualCollisionType = Resource::VisualCollisionType::Camera; mShape->mVisualCollisionType = Resource::VisualCollisionType::Camera;
bool generateCollisionShape = !hasCollisionShape; bool generateCollisionShape = !hasCollisionShape;
handleNode(filename, *node, nullptr, 0, generateCollisionShape, isAnimated, generateCollisionShape, false, handleNode(filename, nif.getVersion(), *node, nullptr, 0, generateCollisionShape, isAnimated,
mShape->mVisualCollisionType); generateCollisionShape, false, mShape->mVisualCollisionType);
} }
if (mCompoundShape) if (mCompoundShape)
@ -268,8 +268,8 @@ namespace NifBullet
return true; return true;
} }
void BulletNifLoader::handleNode(const std::string& fileName, const Nif::Node& node, const Nif::Parent* parent, void BulletNifLoader::handleNode(const std::string& fileName, unsigned int nifVersion, const Nif::Node& node,
int flags, bool isCollisionNode, bool isAnimated, bool autogenerated, bool avoid, const Nif::Parent* parent, int flags, bool isCollisionNode, bool isAnimated, bool autogenerated, bool avoid,
Resource::VisualCollisionType& visualCollisionType) Resource::VisualCollisionType& visualCollisionType)
{ {
// TODO: allow on-the fly collision switching via toggling this flag // TODO: allow on-the fly collision switching via toggling this flag
@ -328,6 +328,9 @@ namespace NifBullet
} }
} }
if (nifVersion > Nif::NIFFile::NIFVersion::VER_MW && Misc::StringUtils::ciEqual(node.name, "EditorMarker"))
return;
if (isCollisionNode) if (isCollisionNode)
{ {
// NOTE: a trishape with hasBounds=true, but no BBoxCollision flag should NOT go through handleNiTriShape! // NOTE: a trishape with hasBounds=true, but no BBoxCollision flag should NOT go through handleNiTriShape!
@ -352,8 +355,8 @@ namespace NifBullet
continue; continue;
assert(std::find(child->parents.begin(), child->parents.end(), ninode) != child->parents.end()); assert(std::find(child->parents.begin(), child->parents.end(), ninode) != child->parents.end());
handleNode(fileName, child.get(), &currentParent, flags, isCollisionNode, isAnimated, autogenerated, handleNode(fileName, nifVersion, child.get(), &currentParent, flags, isCollisionNode, isAnimated,
avoid, visualCollisionType); autogenerated, avoid, visualCollisionType);
} }
} }
} }

@ -52,8 +52,8 @@ namespace NifBullet
private: private:
bool findBoundingBox(const Nif::Node& node, const std::string& filename); bool findBoundingBox(const Nif::Node& node, const std::string& filename);
void handleNode(const std::string& fileName, const Nif::Node& node, const Nif::Parent* parent, int flags, void handleNode(const std::string& fileName, unsigned int nifVersion, const Nif::Node& node,
bool isCollisionNode, bool isAnimated, bool autogenerated, bool avoid, const Nif::Parent* parent, int flags, bool isCollisionNode, bool isAnimated, bool autogenerated, bool avoid,
Resource::VisualCollisionType& visualCollisionType); Resource::VisualCollisionType& visualCollisionType);
bool hasRootCollisionNode(const Nif::Node& rootNode) const; bool hasRootCollisionNode(const Nif::Node& rootNode) const;

@ -45,6 +45,7 @@
#include <components/nif/effect.hpp> #include <components/nif/effect.hpp>
#include <components/nif/exception.hpp> #include <components/nif/exception.hpp>
#include <components/nif/extra.hpp> #include <components/nif/extra.hpp>
#include <components/nif/niffile.hpp>
#include <components/nif/node.hpp> #include <components/nif/node.hpp>
#include <components/nif/property.hpp> #include <components/nif/property.hpp>
#include <components/sceneutil/morphgeometry.hpp> #include <components/sceneutil/morphgeometry.hpp>
@ -340,8 +341,8 @@ namespace NifOsg
created->setDataVariance(osg::Object::STATIC); created->setDataVariance(osg::Object::STATIC);
for (const Nif::Node* root : roots) for (const Nif::Node* root : roots)
{ {
auto node = handleNode(root, nullptr, nullptr, imageManager, std::vector<unsigned int>(), 0, false, auto node = handleNode(nif.getVersion(), root, nullptr, nullptr, imageManager,
false, false, &textkeys->mTextKeys); std::vector<unsigned int>(), 0, false, false, false, &textkeys->mTextKeys);
created->addChild(node); created->addChild(node);
} }
if (mHasNightDayLabel) if (mHasNightDayLabel)
@ -597,13 +598,19 @@ namespace NifOsg
return node; return node;
} }
osg::ref_ptr<osg::Node> handleNode(const Nif::Node* nifNode, const Nif::Parent* parent, osg::Group* parentNode, osg::ref_ptr<osg::Node> handleNode(unsigned int nifVersion, const Nif::Node* nifNode, const Nif::Parent* parent,
Resource::ImageManager* imageManager, std::vector<unsigned int> boundTextures, int animflags, osg::Group* parentNode, Resource::ImageManager* imageManager, std::vector<unsigned int> boundTextures,
bool skipMeshes, bool hasMarkers, bool hasAnimatedParents, SceneUtil::TextKeyMap* textKeys, int animflags, bool skipMeshes, bool hasMarkers, bool hasAnimatedParents, SceneUtil::TextKeyMap* textKeys,
osg::Node* rootNode = nullptr) osg::Node* rootNode = nullptr)
{ {
if (rootNode != nullptr && Misc::StringUtils::ciEqual(nifNode->name, "Bounding Box")) if (rootNode)
return nullptr; {
if (Misc::StringUtils::ciEqual(nifNode->name, "Bounding Box"))
return nullptr;
if (nifVersion > Nif::NIFFile::NIFVersion::VER_MW && !Loader::getShowMarkers()
&& Misc::StringUtils::ciEqual(nifNode->name, "EditorMarker"))
return nullptr;
}
osg::ref_ptr<osg::Group> node = createNode(nifNode); osg::ref_ptr<osg::Group> node = createNode(nifNode);
@ -802,8 +809,8 @@ namespace NifOsg
const Nif::Parent currentParent{ *ninode, parent }; const Nif::Parent currentParent{ *ninode, parent };
for (const auto& child : children) for (const auto& child : children)
if (!child.empty()) if (!child.empty())
handleNode(child.getPtr(), &currentParent, currentNode, imageManager, boundTextures, animflags, handleNode(nifVersion, child.getPtr(), &currentParent, currentNode, imageManager, boundTextures,
skipMeshes, hasMarkers, hasAnimatedParents, textKeys, rootNode); animflags, skipMeshes, hasMarkers, hasAnimatedParents, textKeys, rootNode);
// Propagate effects to the the direct subgraph instead of the node itself // Propagate effects to the the direct subgraph instead of the node itself
// This simulates their "affected node list" which Morrowind appears to replace with the subgraph (?) // This simulates their "affected node list" which Morrowind appears to replace with the subgraph (?)

Loading…
Cancel
Save