|
|
|
@ -21,6 +21,8 @@
|
|
|
|
|
#include <components/resource/resourcesystem.hpp>
|
|
|
|
|
#include <components/resource/scenemanager.hpp>
|
|
|
|
|
|
|
|
|
|
#include <components/sceneutil/positionattitudetransform.hpp>
|
|
|
|
|
|
|
|
|
|
#include <components/esm3/loadacti.hpp>
|
|
|
|
|
#include <components/esm3/loadalch.hpp>
|
|
|
|
|
#include <components/esm3/loadappa.hpp>
|
|
|
|
@ -75,6 +77,41 @@
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
struct TextureFetchVisitor : osg::NodeVisitor
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::pair<std::string, std::string>> mTextures;
|
|
|
|
|
|
|
|
|
|
TextureFetchVisitor(osg::NodeVisitor::TraversalMode mode = TRAVERSE_ALL_CHILDREN)
|
|
|
|
|
: osg::NodeVisitor(mode)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void apply(osg::Node& node) override
|
|
|
|
|
{
|
|
|
|
|
const osg::StateSet* stateset = node.getStateSet();
|
|
|
|
|
if (stateset)
|
|
|
|
|
{
|
|
|
|
|
const osg::StateSet::TextureAttributeList& texAttributes = stateset->getTextureAttributeList();
|
|
|
|
|
for (size_t i = 0; i < texAttributes.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
const osg::StateAttribute* attr = stateset->getTextureAttribute(i, osg::StateAttribute::TEXTURE);
|
|
|
|
|
if (!attr)
|
|
|
|
|
continue;
|
|
|
|
|
const osg::Texture* texture = attr->asTexture();
|
|
|
|
|
if (!texture)
|
|
|
|
|
continue;
|
|
|
|
|
const osg::Image* image = texture->getImage(0);
|
|
|
|
|
std::string fileName;
|
|
|
|
|
if (image)
|
|
|
|
|
fileName = image->getFileName();
|
|
|
|
|
mTextures.emplace_back(texture->getName(), fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
traverse(node);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void addToLevList(ESM::LevelledListBase* list, const ESM::RefId& itemId, int level)
|
|
|
|
|
{
|
|
|
|
|
for (auto& levelItem : list->mList)
|
|
|
|
@ -1384,6 +1421,38 @@ namespace MWScript
|
|
|
|
|
const std::string archive = vfs->getArchive(model);
|
|
|
|
|
if (!archive.empty())
|
|
|
|
|
msg << "(" << archive << ")" << std::endl;
|
|
|
|
|
TextureFetchVisitor visitor;
|
|
|
|
|
SceneUtil::PositionAttitudeTransform* baseNode = ptr.getRefData().getBaseNode();
|
|
|
|
|
if (baseNode)
|
|
|
|
|
baseNode->accept(visitor);
|
|
|
|
|
msg << "Bound textures: ";
|
|
|
|
|
if (!visitor.mTextures.empty())
|
|
|
|
|
{
|
|
|
|
|
msg << std::endl;
|
|
|
|
|
std::string lastTextureSrc;
|
|
|
|
|
for (auto& [textureName, fileName] : visitor.mTextures)
|
|
|
|
|
{
|
|
|
|
|
std::string textureSrc;
|
|
|
|
|
if (!fileName.empty())
|
|
|
|
|
textureSrc = vfs->getArchive(fileName);
|
|
|
|
|
|
|
|
|
|
if (lastTextureSrc.empty() || textureSrc != lastTextureSrc)
|
|
|
|
|
{
|
|
|
|
|
lastTextureSrc = textureSrc;
|
|
|
|
|
if (lastTextureSrc.empty())
|
|
|
|
|
lastTextureSrc = "[No Source]";
|
|
|
|
|
|
|
|
|
|
msg << " " << lastTextureSrc << std::endl;
|
|
|
|
|
}
|
|
|
|
|
msg << " ";
|
|
|
|
|
msg << (textureName.empty() ? "[Anonymous]: " : textureName) << ": ";
|
|
|
|
|
msg << (fileName.empty() ? "[No File]" : fileName) << std::endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
msg << "[None]" << std::endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!ptr.getClass().getScript(ptr).empty())
|
|
|
|
|
msg << "Script: " << ptr.getClass().getScript(ptr) << std::endl;
|
|
|
|
|