|
|
@ -1,4 +1,4 @@
|
|
|
|
#include "worldview.hpp"
|
|
|
|
#include "objectlists.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
#include <components/esm3/esmreader.hpp>
|
|
|
|
#include <components/esm3/esmreader.hpp>
|
|
|
|
#include <components/esm3/esmwriter.hpp>
|
|
|
|
#include <components/esm3/esmwriter.hpp>
|
|
|
@ -17,7 +17,7 @@
|
|
|
|
namespace MWLua
|
|
|
|
namespace MWLua
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
void WorldView::update()
|
|
|
|
void ObjectLists::update()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mActivatorsInScene.updateList();
|
|
|
|
mActivatorsInScene.updateList();
|
|
|
|
mActorsInScene.updateList();
|
|
|
|
mActorsInScene.updateList();
|
|
|
@ -26,7 +26,7 @@ namespace MWLua
|
|
|
|
mItemsInScene.updateList();
|
|
|
|
mItemsInScene.updateList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WorldView::clear()
|
|
|
|
void ObjectLists::clear()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mActivatorsInScene.clear();
|
|
|
|
mActivatorsInScene.clear();
|
|
|
|
mActorsInScene.clear();
|
|
|
|
mActorsInScene.clear();
|
|
|
@ -35,7 +35,7 @@ namespace MWLua
|
|
|
|
mItemsInScene.clear();
|
|
|
|
mItemsInScene.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
WorldView::ObjectGroup* WorldView::chooseGroup(const MWWorld::Ptr& ptr)
|
|
|
|
ObjectLists::ObjectGroup* ObjectLists::chooseGroup(const MWWorld::Ptr& ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// It is important to check `isMarker` first.
|
|
|
|
// It is important to check `isMarker` first.
|
|
|
|
// For example "prisonmarker" has class "Door" despite that it is only an invisible marker.
|
|
|
|
// For example "prisonmarker" has class "Door" despite that it is only an invisible marker.
|
|
|
@ -55,7 +55,7 @@ namespace MWLua
|
|
|
|
return nullptr;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WorldView::objectAddedToScene(const MWWorld::Ptr& ptr)
|
|
|
|
void ObjectLists::objectAddedToScene(const MWWorld::Ptr& ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorldModel()->registerPtr(ptr);
|
|
|
|
MWBase::Environment::get().getWorldModel()->registerPtr(ptr);
|
|
|
|
ObjectGroup* group = chooseGroup(ptr);
|
|
|
|
ObjectGroup* group = chooseGroup(ptr);
|
|
|
@ -63,14 +63,14 @@ namespace MWLua
|
|
|
|
addToGroup(*group, ptr);
|
|
|
|
addToGroup(*group, ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WorldView::objectRemovedFromScene(const MWWorld::Ptr& ptr)
|
|
|
|
void ObjectLists::objectRemovedFromScene(const MWWorld::Ptr& ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ObjectGroup* group = chooseGroup(ptr);
|
|
|
|
ObjectGroup* group = chooseGroup(ptr);
|
|
|
|
if (group)
|
|
|
|
if (group)
|
|
|
|
removeFromGroup(*group, ptr);
|
|
|
|
removeFromGroup(*group, ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WorldView::ObjectGroup::updateList()
|
|
|
|
void ObjectLists::ObjectGroup::updateList()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mChanged)
|
|
|
|
if (mChanged)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -81,20 +81,20 @@ namespace MWLua
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WorldView::ObjectGroup::clear()
|
|
|
|
void ObjectLists::ObjectGroup::clear()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mChanged = false;
|
|
|
|
mChanged = false;
|
|
|
|
mList->clear();
|
|
|
|
mList->clear();
|
|
|
|
mSet.clear();
|
|
|
|
mSet.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WorldView::addToGroup(ObjectGroup& group, const MWWorld::Ptr& ptr)
|
|
|
|
void ObjectLists::addToGroup(ObjectGroup& group, const MWWorld::Ptr& ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
group.mSet.insert(getId(ptr));
|
|
|
|
group.mSet.insert(getId(ptr));
|
|
|
|
group.mChanged = true;
|
|
|
|
group.mChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WorldView::removeFromGroup(ObjectGroup& group, const MWWorld::Ptr& ptr)
|
|
|
|
void ObjectLists::removeFromGroup(ObjectGroup& group, const MWWorld::Ptr& ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
group.mSet.erase(getId(ptr));
|
|
|
|
group.mSet.erase(getId(ptr));
|
|
|
|
group.mChanged = true;
|
|
|
|
group.mChanged = true;
|