1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-04 23:45:37 +00:00

clean up + toggle function for the billboard

This commit is contained in:
gus 2014-07-21 18:57:35 +02:00
parent f8019b4a97
commit a5058625b3
2 changed files with 24 additions and 3 deletions

View file

@ -190,6 +190,18 @@ stop:
free(buffer); buffer = 0;
}
void CSVRender::PagedWorldspaceWidget::displayCellCoord(bool display)
{
mDisplayCellCoord = display;
std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter(mCells.begin());
while (iter != mCells.end())
{
getSceneManager()->getBillboardSet("CellBillboardSet" + iter->first.getId(mWorldspace))->setVisible(display);
iter++;
}
}
bool CSVRender::PagedWorldspaceWidget::adjustCells()
{
bool modified = false;
@ -210,6 +222,12 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
{
delete iter->second;
mCells.erase (iter++);
getSceneManager()->getSceneNode("CellBillboardNode" + iter->first.getId(mWorldspace))->detachAllObjects();
getSceneManager()->getBillboardSet("CellBillboardSet" + iter->first.getId(mWorldspace))->removeBillboard(
getSceneManager()->getBillboardSet("CellBillboardSet" + iter->first.getId(mWorldspace))->getBillboard(0));
getSceneManager()->destroyBillboardSet("CellBillboardSet" + iter->first.getId(mWorldspace));
modified = true;
}
else
@ -256,8 +274,6 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
{
font = Ogre::FontManager::getSingletonPtr()->getByName("CellBillboardFont" + iter->getId(mWorldspace)).getPointer();
}
//std::
Ogre::TexturePtr texture;
if (Ogre::TextureManager::getSingleton().resourceExists("CellBillboardTexture" + iter->getId(mWorldspace)))
@ -294,6 +310,8 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
mySet->setRenderQueueGroup(mySet->getRenderQueueGroup() + 1); // render the bilboard on top
billboardNode->attachObject(mySet);
mySet->setVisible(mDisplayCellCoord);
modified = true;
}
}
@ -365,7 +383,7 @@ void CSVRender::PagedWorldspaceWidget::referenceAdded (const QModelIndex& parent
}
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document)
: WorldspaceWidget (document, parent), mDocument (document), mWorldspace ("std::default")
: WorldspaceWidget(document, parent), mDocument(document), mWorldspace("std::default"), mDisplayCellCoord(true)
{
QAbstractItemModel *cells =
document.getData().getTableModel (CSMWorld::UniversalId::Type_Cells);

View file

@ -18,6 +18,7 @@ namespace CSVRender
CSMWorld::CellSelection mSelection;
std::map<CSMWorld::CellCoordinates, Cell *> mCells;
std::string mWorldspace;
bool mDisplayCellCoord;
private:
@ -54,6 +55,8 @@ namespace CSVRender
void setCellSelection (const CSMWorld::CellSelection& selection);
void displayCellCoord(bool display);
virtual void handleDrop(const std::vector<CSMWorld::UniversalId>& data);
virtual dropRequirments getDropRequirements(dropType type) const;