mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-16 17:42:31 +00:00
Move workaround for hiding markers from NIF loader to Scene
This commit is contained in:
parent
7cc1ebc05b
commit
883f7ec7ce
@ -21,6 +21,18 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
|
void addObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics,
|
||||||
|
MWRender::RenderingManager& rendering)
|
||||||
|
{
|
||||||
|
std::string model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
||||||
|
std::string id = ptr.getClass().getId(ptr);
|
||||||
|
if (id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker")
|
||||||
|
model = "";
|
||||||
|
rendering.addObject(ptr, model);
|
||||||
|
ptr.getClass().insertObject (ptr, model, physics);
|
||||||
|
}
|
||||||
|
|
||||||
void updateObjectLocalRotation (const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics,
|
void updateObjectLocalRotation (const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics,
|
||||||
MWRender::RenderingManager& rendering)
|
MWRender::RenderingManager& rendering)
|
||||||
{
|
{
|
||||||
@ -80,10 +92,7 @@ namespace
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
addObject(ptr, mPhysics, mRendering);
|
||||||
mRendering.addObject(ptr, model);
|
|
||||||
ptr.getClass().insertObject (ptr, model, mPhysics);
|
|
||||||
|
|
||||||
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
||||||
if (ptr.getRefData().getBaseNode())
|
if (ptr.getRefData().getBaseNode())
|
||||||
{
|
{
|
||||||
@ -530,9 +539,7 @@ namespace MWWorld
|
|||||||
|
|
||||||
void Scene::addObjectToScene (const Ptr& ptr)
|
void Scene::addObjectToScene (const Ptr& ptr)
|
||||||
{
|
{
|
||||||
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
addObject(ptr, *mPhysics, mRendering);
|
||||||
mRendering.addObject(ptr, model);
|
|
||||||
ptr.getClass().insertObject (ptr, model, *mPhysics);
|
|
||||||
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true);
|
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true);
|
||||||
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().getScale());
|
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().getScale());
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||||||
mShape->mAutogenerated = hasAutoGeneratedCollision(node);
|
mShape->mAutogenerated = hasAutoGeneratedCollision(node);
|
||||||
|
|
||||||
//do a first pass
|
//do a first pass
|
||||||
handleNode(node,0,false,false,false);
|
handleNode(node,0,false,false);
|
||||||
|
|
||||||
if(mBoundingBox != NULL)
|
if(mBoundingBox != NULL)
|
||||||
{
|
{
|
||||||
@ -232,7 +232,7 @@ bool ManualBulletShapeLoader::hasAutoGeneratedCollision(Nif::Node const * rootNo
|
|||||||
|
|
||||||
void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
||||||
bool isCollisionNode,
|
bool isCollisionNode,
|
||||||
bool raycasting, bool isMarker, bool isAnimated)
|
bool raycasting, bool isAnimated)
|
||||||
{
|
{
|
||||||
// Accumulate the flags from all the child nodes. This works for all
|
// Accumulate the flags from all the child nodes. This works for all
|
||||||
// the flags we currently use, at least.
|
// the flags we currently use, at least.
|
||||||
@ -254,13 +254,6 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
|||||||
if(node->recType == Nif::RC_AvoidNode)
|
if(node->recType == Nif::RC_AvoidNode)
|
||||||
flags |= 0x800;
|
flags |= 0x800;
|
||||||
|
|
||||||
// Marker objects
|
|
||||||
/// \todo don't do this in the editor
|
|
||||||
std::string nodename = node->name;
|
|
||||||
Misc::StringUtils::toLower(nodename);
|
|
||||||
if (nodename.find("marker") != std::string::npos)
|
|
||||||
isMarker = true;
|
|
||||||
|
|
||||||
// Check for extra data
|
// Check for extra data
|
||||||
Nif::Extra const *e = node;
|
Nif::Extra const *e = node;
|
||||||
while (!e->extra.empty())
|
while (!e->extra.empty())
|
||||||
@ -285,12 +278,11 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
|||||||
// Marker objects. These are only visible in the
|
// Marker objects. These are only visible in the
|
||||||
// editor. Until and unless we add an editor component to
|
// editor. Until and unless we add an editor component to
|
||||||
// the engine, just skip this entire node.
|
// the engine, just skip this entire node.
|
||||||
isMarker = true;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (isCollisionNode || (mShape->mAutogenerated && !raycasting))
|
if (isCollisionNode || (mShape->mAutogenerated && !raycasting))
|
||||||
&& (!isMarker || (!mShape->mAutogenerated && !raycasting)))
|
|
||||||
{
|
{
|
||||||
// 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!
|
||||||
// It must be ignored completely.
|
// It must be ignored completely.
|
||||||
@ -319,7 +311,7 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
|||||||
for(size_t i = 0;i < list.length();i++)
|
for(size_t i = 0;i < list.length();i++)
|
||||||
{
|
{
|
||||||
if(!list[i].empty())
|
if(!list[i].empty())
|
||||||
handleNode(list[i].getPtr(), flags, isCollisionNode, raycasting, isMarker, isAnimated);
|
handleNode(list[i].getPtr(), flags, isCollisionNode, raycasting, isAnimated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ private:
|
|||||||
*Parse a node.
|
*Parse a node.
|
||||||
*/
|
*/
|
||||||
void handleNode(Nif::Node const *node, int flags, bool isCollisionNode,
|
void handleNode(Nif::Node const *node, int flags, bool isCollisionNode,
|
||||||
bool raycasting, bool isMarker, bool isAnimated=false);
|
bool raycasting, bool isAnimated=false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Helper function
|
*Helper function
|
||||||
|
@ -1176,11 +1176,6 @@ class NIFObjectLoader
|
|||||||
if(node->recType == Nif::RC_RootCollisionNode)
|
if(node->recType == Nif::RC_RootCollisionNode)
|
||||||
isRootCollisionNode = true;
|
isRootCollisionNode = true;
|
||||||
|
|
||||||
// Marker objects: just skip the entire node branch
|
|
||||||
/// \todo don't do this in the editor
|
|
||||||
if (node->name.find("marker") != std::string::npos)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(node->recType == Nif::RC_NiBSAnimationNode)
|
if(node->recType == Nif::RC_NiBSAnimationNode)
|
||||||
animflags |= node->flags;
|
animflags |= node->flags;
|
||||||
else if(node->recType == Nif::RC_NiBSParticleNode)
|
else if(node->recType == Nif::RC_NiBSParticleNode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user