forked from mirror/openmw-tes3mp
Move workaround for hiding markers from NIF loader to Scene
This commit is contained in:
parent
7cc1ebc05b
commit
883f7ec7ce
4 changed files with 20 additions and 26 deletions
|
@ -21,6 +21,18 @@
|
|||
|
||||
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,
|
||||
MWRender::RenderingManager& rendering)
|
||||
{
|
||||
|
@ -80,10 +92,7 @@ namespace
|
|||
{
|
||||
try
|
||||
{
|
||||
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
||||
mRendering.addObject(ptr, model);
|
||||
ptr.getClass().insertObject (ptr, model, mPhysics);
|
||||
|
||||
addObject(ptr, mPhysics, mRendering);
|
||||
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
||||
if (ptr.getRefData().getBaseNode())
|
||||
{
|
||||
|
@ -530,9 +539,7 @@ namespace MWWorld
|
|||
|
||||
void Scene::addObjectToScene (const Ptr& ptr)
|
||||
{
|
||||
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
||||
mRendering.addObject(ptr, model);
|
||||
ptr.getClass().insertObject (ptr, model, *mPhysics);
|
||||
addObject(ptr, *mPhysics, mRendering);
|
||||
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true);
|
||||
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().getScale());
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||
mShape->mAutogenerated = hasAutoGeneratedCollision(node);
|
||||
|
||||
//do a first pass
|
||||
handleNode(node,0,false,false,false);
|
||||
handleNode(node,0,false,false);
|
||||
|
||||
if(mBoundingBox != NULL)
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ bool ManualBulletShapeLoader::hasAutoGeneratedCollision(Nif::Node const * rootNo
|
|||
|
||||
void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
||||
bool isCollisionNode,
|
||||
bool raycasting, bool isMarker, bool isAnimated)
|
||||
bool raycasting, bool isAnimated)
|
||||
{
|
||||
// Accumulate the flags from all the child nodes. This works for all
|
||||
// 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)
|
||||
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
|
||||
Nif::Extra const *e = node;
|
||||
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
|
||||
// editor. Until and unless we add an editor component to
|
||||
// the engine, just skip this entire node.
|
||||
isMarker = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (isCollisionNode || (mShape->mAutogenerated && !raycasting))
|
||||
&& (!isMarker || (!mShape->mAutogenerated && !raycasting)))
|
||||
if (isCollisionNode || (mShape->mAutogenerated && !raycasting))
|
||||
{
|
||||
// NOTE: a trishape with hasBounds=true, but no BBoxCollision flag should NOT go through handleNiTriShape!
|
||||
// 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++)
|
||||
{
|
||||
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.
|
||||
*/
|
||||
void handleNode(Nif::Node const *node, int flags, bool isCollisionNode,
|
||||
bool raycasting, bool isMarker, bool isAnimated=false);
|
||||
bool raycasting, bool isAnimated=false);
|
||||
|
||||
/**
|
||||
*Helper function
|
||||
|
|
|
@ -1176,11 +1176,6 @@ class NIFObjectLoader
|
|||
if(node->recType == Nif::RC_RootCollisionNode)
|
||||
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)
|
||||
animflags |= node->flags;
|
||||
else if(node->recType == Nif::RC_NiBSParticleNode)
|
||||
|
|
Loading…
Reference in a new issue