1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 11:06:39 +00:00

Use model template as a fallback in BetaComment

This commit is contained in:
Alexei Kotov 2023-02-10 15:17:48 +03:00
parent de2bd6d802
commit e96448d66f

View file

@ -1425,7 +1425,21 @@ namespace MWScript
SceneUtil::PositionAttitudeTransform* baseNode = ptr.getRefData().getBaseNode();
if (baseNode)
baseNode->accept(visitor);
msg << "Bound textures: ";
// The instance might not have a physical model due to paging or scripting.
// If this is the case, fall back to the template
if (visitor.mTextures.empty())
{
Resource::SceneManager* sceneManager
= MWBase::Environment::get().getResourceSystem()->getSceneManager();
const_cast<osg::Node*>(sceneManager->getTemplate(model).get())->accept(visitor);
msg << "Bound textures: [None]" << std::endl;
if (!visitor.mTextures.empty())
msg << "Model textures: ";
}
else
{
msg << "Bound textures: ";
}
if (!visitor.mTextures.empty())
{
msg << std::endl;