Add setting for showing MRK nodes to NIF loaders

This makes marker objects show up in OpenCS.
openmw-35
scrawl 10 years ago
parent 883f7ec7ce
commit f11ec653d0

@ -15,7 +15,7 @@
#include <extern/shiny/Platforms/Ogre/OgrePlatform.hpp>
#include <components/ogreinit/ogreinit.hpp>
#include <components/nifogre/ogrenifloader.hpp>
#include <components/bsa/resources.hpp>
#include "model/doc/document.hpp"
@ -35,6 +35,8 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
ogreInit.init ((mCfgMgr.getUserConfigPath() / "opencsOgre.log").string());
NifOgre::Loader::setShowMarkers(true);
mOverlaySystem.reset (new CSVRender::OverlaySystem);
Bsa::registerResources (Files::Collections (config.first, !mFsStrict), config.second, true,

@ -16,7 +16,7 @@ namespace CSVWorld
PhysicsSystem::PhysicsSystem()
{
// Create physics. shapeLoader is deleted by the physic engine
NifBullet::ManualBulletShapeLoader* shapeLoader = new NifBullet::ManualBulletShapeLoader();
NifBullet::ManualBulletShapeLoader* shapeLoader = new NifBullet::ManualBulletShapeLoader(true);
mEngine = new OEngine::Physic::PhysicEngine(shapeLoader);
}

@ -274,10 +274,9 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
// No collision. Use an internal flag setting to mark this.
flags |= 0x800;
}
else if (sd->string == "MRK")
else if (sd->string == "MRK" && !mShowMarkers)
// 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.
// editor.
return;
}
}

@ -67,11 +67,12 @@ struct TriangleMeshShape : public btBvhTriangleMeshShape
class ManualBulletShapeLoader : public OEngine::Physic::BulletShapeLoader
{
public:
ManualBulletShapeLoader()
ManualBulletShapeLoader(bool showMarkers=false)
: mShape(NULL)
, mStaticMesh(NULL)
, mCompoundShape(NULL)
, mBoundingBox(NULL)
, mShowMarkers(showMarkers)
{
}
@ -130,6 +131,8 @@ private:
btBoxShape *mBoundingBox;
std::set<std::string> mControlledNodes;
bool mShowMarkers;
};

@ -689,6 +689,14 @@ public:
*/
class NIFObjectLoader
{
static bool sShowMarkers;
public:
static void setShowMarkers(bool show)
{
sShowMarkers = show;
}
private:
static void warn(const std::string &msg)
{
std::cerr << "NIFObjectLoader: Warn: " << msg << std::endl;
@ -1208,7 +1216,7 @@ class NIFObjectLoader
const Nif::NiStringExtraData *sd = static_cast<const Nif::NiStringExtraData*>(e.getPtr());
// String markers may contain important information
// affecting the entire subtree of this obj
if(sd->string == "MRK")
if(sd->string == "MRK" && !sShowMarkers)
{
// Marker objects. These meshes are only visible in the
// editor.
@ -1471,5 +1479,14 @@ void Loader::createKfControllers(Ogre::Entity *skelBase,
NIFObjectLoader::loadKf(skelBase->getSkeleton(), name, textKeys, ctrls);
}
bool Loader::sShowMarkers = false;
bool NIFObjectLoader::sShowMarkers = false;
void Loader::setShowMarkers(bool show)
{
sShowMarkers = show;
NIFObjectLoader::setShowMarkers(show);
}
} // namespace NifOgre

@ -110,10 +110,18 @@ public:
std::string name,
const std::string &group="General");
/// Set whether or not nodes marked as "MRK" should be shown.
/// These should be hidden ingame, but visible in the editior.
/// Default: false.
static void setShowMarkers(bool show);
static void createKfControllers(Ogre::Entity *skelBase,
const std::string &name,
TextKeyMap &textKeys,
std::vector<Ogre::Controller<Ogre::Real> > &ctrls);
private:
static bool sShowMarkers;
};
// FIXME: Should be with other general Ogre extensions.

Loading…
Cancel
Save