Merge pull request #191 from OpenMW/master

Add OpenMW commits up to 31 Mar 2017
This commit is contained in:
David Cernat 2017-04-01 03:27:44 +03:00 committed by GitHub
commit dff52d8fbe
13 changed files with 138 additions and 26 deletions

View File

@ -70,6 +70,7 @@ opencs_units (view/world
cellcreator pathgridcreator referenceablecreator startscriptcreator referencecreator scenesubview cellcreator pathgridcreator referenceablecreator startscriptcreator referencecreator scenesubview
infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable nestedtable infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable nestedtable
dialoguespinbox recordbuttonbar tableeditidaction scripterrortable extendedcommandconfigurator dialoguespinbox recordbuttonbar tableeditidaction scripterrortable extendedcommandconfigurator
bodypartcreator
) )
opencs_units_noqt (view/world opencs_units_noqt (view/world

View File

@ -3,6 +3,7 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <osg/AutoTransform> #include <osg/AutoTransform>
#include <osg/Material>
#include <osg/Geode> #include <osg/Geode>
#include <osg/Group> #include <osg/Group>
#include <osgText/Text> #include <osgText/Text>
@ -75,7 +76,10 @@ CSVRender::CellMarker::CellMarker(
mMarkerNode->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN); mMarkerNode->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);
mMarkerNode->setAutoScaleToScreen(true); mMarkerNode->setAutoScaleToScreen(true);
mMarkerNode->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); mMarkerNode->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
mMarkerNode->getOrCreateStateSet()->setRenderBinDetails(osg::StateSet::TRANSPARENT_BIN + 1, "RenderBin"); mMarkerNode->getOrCreateStateSet()->setRenderBinDetails(11, "RenderBin");
osg::ref_ptr<osg::Material> mat = new osg::Material;
mat->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);
mMarkerNode->getOrCreateStateSet()->setAttribute(mat);
mMarkerNode->setUserData(new CellMarkerTag(this)); mMarkerNode->setUserData(new CellMarkerTag(this));
mMarkerNode->setNodeMask(Mask_CellMarker); mMarkerNode->setNodeMask(Mask_CellMarker);

View File

@ -0,0 +1,54 @@
#include "bodypartcreator.hpp"
#include <QCheckBox>
#include "../../model/world/data.hpp"
#include "../../model/world/universalid.hpp"
std::string CSVWorld::BodyPartCreator::getId() const
{
std::string id = CSVWorld::GenericCreator::getId();
if (mFirstPerson->isChecked())
{
id += ".1st";
}
return id;
}
CSVWorld::BodyPartCreator::BodyPartCreator(
CSMWorld::Data& data,
QUndoStack& undoStack,
const CSMWorld::UniversalId& id
) : GenericCreator(data, undoStack, id)
{
mFirstPerson = new QCheckBox("First Person", this);
insertBeforeButtons(mFirstPerson, false);
connect(mFirstPerson, SIGNAL(clicked(bool)), this, SLOT(checkboxClicked()));
}
std::string CSVWorld::BodyPartCreator::getErrors() const
{
std::string errors;
std::string id = getId();
if (getData().hasId(id))
{
errors = "ID is already in use";
}
return errors;
}
void CSVWorld::BodyPartCreator::reset()
{
CSVWorld::GenericCreator::reset();
mFirstPerson->setChecked(false);
}
void CSVWorld::BodyPartCreator::checkboxClicked()
{
update();
}

View File

@ -0,0 +1,47 @@
#ifndef BODYPARTCREATOR_HPP
#define BODYPARTCREATOR_HPP
class QCheckBox;
#include "genericcreator.hpp"
namespace CSMWorld
{
class Data;
class UniversalId;
}
namespace CSVWorld
{
/// \brief Record creator for body parts.
class BodyPartCreator : public GenericCreator
{
Q_OBJECT
QCheckBox *mFirstPerson;
private:
/// \return ID entered by user.
virtual std::string getId() const;
public:
BodyPartCreator(
CSMWorld::Data& data,
QUndoStack& undoStack,
const CSMWorld::UniversalId& id);
/// \return Error description for current user input.
virtual std::string getErrors() const;
/// \brief Clear ID and checkbox input widgets.
virtual void reset();
private slots:
void checkboxClicked();
};
}
#endif // BODYPARTCREATOR_HPP

View File

@ -45,14 +45,20 @@ CSVWorld::InfoCreator::InfoCreator (CSMWorld::Data& data, QUndoStack& undoStack,
const CSMWorld::UniversalId& id, CSMWorld::IdCompletionManager& completionManager) const CSMWorld::UniversalId& id, CSMWorld::IdCompletionManager& completionManager)
: GenericCreator (data, undoStack, id) : GenericCreator (data, undoStack, id)
{ {
QLabel *label = new QLabel ("Topic", this); // Determine if we're dealing with topics or journals.
insertBeforeButtons (label, false);
CSMWorld::ColumnBase::Display displayType = CSMWorld::ColumnBase::Display_Topic; CSMWorld::ColumnBase::Display displayType = CSMWorld::ColumnBase::Display_Topic;
QString labelText = "Topic";
if (getCollectionId().getType() == CSMWorld::UniversalId::Type_JournalInfos) if (getCollectionId().getType() == CSMWorld::UniversalId::Type_JournalInfos)
{ {
displayType = CSMWorld::ColumnBase::Display_Journal; displayType = CSMWorld::ColumnBase::Display_Journal;
labelText = "Journal";
} }
QLabel *label = new QLabel (labelText, this);
insertBeforeButtons (label, false);
// Add topic/journal ID input with auto-completion.
// Only existing topic/journal IDs are accepted so no ID validation is performed.
mTopic = new CSVWidget::DropLineEdit(displayType, this); mTopic = new CSVWidget::DropLineEdit(displayType, this);
mTopic->setCompleter(completionManager.getCompleter(displayType).get()); mTopic->setCompleter(completionManager.getCompleter(displayType).get());
insertBeforeButtons (mTopic, true); insertBeforeButtons (mTopic, true);

View File

@ -10,7 +10,6 @@
#include "../../model/world/idtable.hpp" #include "../../model/world/idtable.hpp"
#include "../widget/droplineedit.hpp" #include "../widget/droplineedit.hpp"
#include "idvalidator.hpp"
std::string CSVWorld::PathgridCreator::getId() const std::string CSVWorld::PathgridCreator::getId() const
{ {
@ -28,20 +27,19 @@ CSVWorld::PathgridCreator::PathgridCreator(
CSMWorld::Data& data, CSMWorld::Data& data,
QUndoStack& undoStack, QUndoStack& undoStack,
const CSMWorld::UniversalId& id, const CSMWorld::UniversalId& id,
CSMWorld::IdCompletionManager& completionManager, CSMWorld::IdCompletionManager& completionManager
bool relaxedIdRules ) : GenericCreator(data, undoStack, id)
) : GenericCreator(data, undoStack, id, relaxedIdRules)
{ {
setManualEditing(false); setManualEditing(false);
QLabel *label = new QLabel("Cell ID", this); QLabel *label = new QLabel("Cell", this);
insertBeforeButtons(label, false); insertBeforeButtons(label, false);
// Add cell ID input with auto-completion. // Add cell ID input with auto-completion.
// Only existing cell IDs are accepted so no ID validation is performed.
CSMWorld::ColumnBase::Display displayType = CSMWorld::ColumnBase::Display_Cell; CSMWorld::ColumnBase::Display displayType = CSMWorld::ColumnBase::Display_Cell;
mCell = new CSVWidget::DropLineEdit(displayType, this); mCell = new CSVWidget::DropLineEdit(displayType, this);
mCell->setCompleter(completionManager.getCompleter(displayType).get()); mCell->setCompleter(completionManager.getCompleter(displayType).get());
mCell->setValidator(new IdValidator(relaxedIdRules, this));
insertBeforeButtons(mCell, true); insertBeforeButtons(mCell, true);
connect(mCell, SIGNAL (textChanged(const QString&)), this, SLOT (cellChanged())); connect(mCell, SIGNAL (textChanged(const QString&)), this, SLOT (cellChanged()));
@ -65,8 +63,6 @@ std::string CSVWorld::PathgridCreator::getErrors() const
std::string cellId = getId(); std::string cellId = getId();
// Check user input for any errors. // Check user input for any errors.
// The last two checks, cell with existing pathgrid and non-existent cell,
// shouldn't be needed but we absolutely want to make sure they never happen.
std::string errors; std::string errors;
if (cellId.empty()) if (cellId.empty())
{ {

View File

@ -44,8 +44,7 @@ namespace CSVWorld
CSMWorld::Data& data, CSMWorld::Data& data,
QUndoStack& undoStack, QUndoStack& undoStack,
const CSMWorld::UniversalId& id, const CSMWorld::UniversalId& id,
CSMWorld::IdCompletionManager& completionManager, CSMWorld::IdCompletionManager& completionManager);
bool relaxedIdRules = false);
/// \brief Set cell ID input widget to ID of record to be cloned. /// \brief Set cell ID input widget to ID of record to be cloned.
/// \param originId Cell ID to be cloned. /// \param originId Cell ID to be cloned.

View File

@ -35,6 +35,8 @@ CSVWorld::ReferenceCreator::ReferenceCreator (CSMWorld::Data& data, QUndoStack&
QLabel *label = new QLabel ("Cell", this); QLabel *label = new QLabel ("Cell", this);
insertBeforeButtons (label, false); insertBeforeButtons (label, false);
// Add cell ID input with auto-completion.
// Only existing cell IDs are accepted so no ID validation is performed.
mCell = new CSVWidget::DropLineEdit(CSMWorld::ColumnBase::Display_Cell, this); mCell = new CSVWidget::DropLineEdit(CSMWorld::ColumnBase::Display_Cell, this);
mCell->setCompleter(completionManager.getCompleter(CSMWorld::ColumnBase::Display_Cell).get()); mCell->setCompleter(completionManager.getCompleter(CSMWorld::ColumnBase::Display_Cell).get());
insertBeforeButtons (mCell, true); insertBeforeButtons (mCell, true);

View File

@ -29,15 +29,16 @@ CSVWorld::StartScriptCreator::StartScriptCreator(
QUndoStack &undoStack, QUndoStack &undoStack,
const CSMWorld::UniversalId &id, const CSMWorld::UniversalId &id,
CSMWorld::IdCompletionManager& completionManager CSMWorld::IdCompletionManager& completionManager
) : GenericCreator(data, undoStack, id, true) ) : GenericCreator(data, undoStack, id)
{ {
setManualEditing(false); setManualEditing(false);
// Add script ID input label. // Add script ID input label.
QLabel *label = new QLabel("Script ID", this); QLabel *label = new QLabel("Script", this);
insertBeforeButtons(label, false); insertBeforeButtons(label, false);
// Add script ID input with auto-completion. // Add script ID input with auto-completion.
// Only existing script IDs are accepted so no ID validation is performed.
CSMWorld::ColumnBase::Display displayType = CSMWorld::ColumnBase::Display_Script; CSMWorld::ColumnBase::Display displayType = CSMWorld::ColumnBase::Display_Script;
mScript = new CSVWidget::DropLineEdit(displayType, this); mScript = new CSVWidget::DropLineEdit(displayType, this);
mScript->setCompleter(completionManager.getCompleter(displayType).get()); mScript->setCompleter(completionManager.getCompleter(displayType).get());

View File

@ -17,6 +17,7 @@
#include "infocreator.hpp" #include "infocreator.hpp"
#include "pathgridcreator.hpp" #include "pathgridcreator.hpp"
#include "previewsubview.hpp" #include "previewsubview.hpp"
#include "bodypartcreator.hpp"
void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager) void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
{ {
@ -41,7 +42,6 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
CSMWorld::UniversalId::Type_Birthsigns, CSMWorld::UniversalId::Type_Birthsigns,
CSMWorld::UniversalId::Type_Spells, CSMWorld::UniversalId::Type_Spells,
CSMWorld::UniversalId::Type_Enchantments, CSMWorld::UniversalId::Type_Enchantments,
CSMWorld::UniversalId::Type_BodyParts,
CSMWorld::UniversalId::Type_SoundGens, CSMWorld::UniversalId::Type_SoundGens,
CSMWorld::UniversalId::Type_None // end marker CSMWorld::UniversalId::Type_None // end marker
@ -51,6 +51,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
manager.add (sTableTypes[i], manager.add (sTableTypes[i],
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<GenericCreator> >); new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<GenericCreator> >);
manager.add (CSMWorld::UniversalId::Type_BodyParts,
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<BodyPartCreator> >);
manager.add (CSMWorld::UniversalId::Type_StartScripts, manager.add (CSMWorld::UniversalId::Type_StartScripts,
new CSVDoc::SubViewFactoryWithCreator<TableSubView, StartScriptCreatorFactory>); new CSVDoc::SubViewFactoryWithCreator<TableSubView, StartScriptCreatorFactory>);
@ -129,7 +132,6 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
CSMWorld::UniversalId::Type_Sound, CSMWorld::UniversalId::Type_Sound,
CSMWorld::UniversalId::Type_Faction, CSMWorld::UniversalId::Type_Faction,
CSMWorld::UniversalId::Type_Enchantment, CSMWorld::UniversalId::Type_Enchantment,
CSMWorld::UniversalId::Type_BodyPart,
CSMWorld::UniversalId::Type_SoundGen, CSMWorld::UniversalId::Type_SoundGen,
CSMWorld::UniversalId::Type_None // end marker CSMWorld::UniversalId::Type_None // end marker
@ -140,6 +142,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, new CSVDoc::SubViewFactoryWithCreator<DialogueSubView,
CreatorFactory<GenericCreator> > (false)); CreatorFactory<GenericCreator> > (false));
manager.add (CSMWorld::UniversalId::Type_BodyPart,
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, CreatorFactory<BodyPartCreator> > (false));
manager.add (CSMWorld::UniversalId::Type_StartScript, manager.add (CSMWorld::UniversalId::Type_StartScript,
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, StartScriptCreatorFactory>(false)); new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, StartScriptCreatorFactory>(false));

View File

@ -149,9 +149,9 @@ void Objects::removeCell(const MWWorld::CellStore* store)
if (ptr.getClass().isNpc() && ptr.getRefData().getCustomData()) if (ptr.getClass().isNpc() && ptr.getRefData().getCustomData())
{ {
MWWorld::InventoryStore& store = ptr.getClass().getInventoryStore(ptr); MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore(ptr);
store.setInvListener(NULL, ptr); invStore.setInvListener(NULL, ptr);
store.setContListener(NULL); invStore.setContListener(NULL);
} }
mObjects.erase(iter++); mObjects.erase(iter++);

View File

@ -335,7 +335,4 @@ namespace ESM
} }
} }
} }
const int Land::LAND_SIZE;
} }

View File

@ -240,8 +240,8 @@ namespace ESMTerrain
// Only relevant for chunks smaller than (contained in) one cell // Only relevant for chunks smaller than (contained in) one cell
rowStart += (origin.x() - startCellX) * ESM::Land::LAND_SIZE; rowStart += (origin.x() - startCellX) * ESM::Land::LAND_SIZE;
colStart += (origin.y() - startCellY) * ESM::Land::LAND_SIZE; colStart += (origin.y() - startCellY) * ESM::Land::LAND_SIZE;
int rowEnd = std::min(static_cast<int>(rowStart + std::min(1.f, size) * (ESM::Land::LAND_SIZE-1) + 1), ESM::Land::LAND_SIZE); int rowEnd = std::min(static_cast<int>(rowStart + std::min(1.f, size) * (ESM::Land::LAND_SIZE-1) + 1), static_cast<int>(ESM::Land::LAND_SIZE));
int colEnd = std::min(static_cast<int>(colStart + std::min(1.f, size) * (ESM::Land::LAND_SIZE-1) + 1), ESM::Land::LAND_SIZE); int colEnd = std::min(static_cast<int>(colStart + std::min(1.f, size) * (ESM::Land::LAND_SIZE-1) + 1), static_cast<int>(ESM::Land::LAND_SIZE));
vertY = vertY_; vertY = vertY_;
for (int col=colStart; col<colEnd; col += increment) for (int col=colStart; col<colEnd; col += increment)