mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Show race only when mesh type is Skin (in BodyParts table)
This commit is contained in:
parent
6d81ca07b5
commit
4d24eff859
4 changed files with 50 additions and 6 deletions
|
@ -23,7 +23,7 @@ opencs_units (model/world
|
|||
|
||||
|
||||
opencs_units_noqt (model/world
|
||||
universalid record commands columnbase scriptcontext cell refidcollection
|
||||
universalid record commands columnbase columnimp scriptcontext cell refidcollection
|
||||
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager scope
|
||||
pathgrid landtexture land nestedtablewrapper nestedcollection nestedcoladapterimp nestedinfocollection
|
||||
idcompletionmanager metadata
|
||||
|
|
28
apps/opencs/model/world/columnimp.cpp
Normal file
28
apps/opencs/model/world/columnimp.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include "columnimp.hpp"
|
||||
|
||||
CSMWorld::BodyPartRaceColumn::BodyPartRaceColumn(const MeshTypeColumn<ESM::BodyPart> *meshType)
|
||||
: mMeshType(meshType)
|
||||
{}
|
||||
|
||||
QVariant CSMWorld::BodyPartRaceColumn::get(const Record<ESM::BodyPart> &record) const
|
||||
{
|
||||
if (mMeshType != NULL && mMeshType->get(record) == ESM::BodyPart::MT_Skin)
|
||||
{
|
||||
return QString::fromUtf8(record.get().mRace.c_str());
|
||||
}
|
||||
return QVariant(QVariant::UserType);
|
||||
}
|
||||
|
||||
void CSMWorld::BodyPartRaceColumn::set(Record<ESM::BodyPart> &record, const QVariant &data)
|
||||
{
|
||||
ESM::BodyPart record2 = record.get();
|
||||
|
||||
record2.mRace = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
|
||||
bool CSMWorld::BodyPartRaceColumn::isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <QColor>
|
||||
|
||||
#include <components/esm/loadbody.hpp>
|
||||
|
||||
#include "columnbase.hpp"
|
||||
#include "columns.hpp"
|
||||
#include "info.hpp"
|
||||
|
@ -1911,8 +1913,8 @@ namespace CSMWorld
|
|||
template<typename ESXRecordT>
|
||||
struct MeshTypeColumn : public Column<ESXRecordT>
|
||||
{
|
||||
MeshTypeColumn()
|
||||
: Column<ESXRecordT> (Columns::ColumnId_MeshType, ColumnBase::Display_MeshType)
|
||||
MeshTypeColumn(int flags = ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue)
|
||||
: Column<ESXRecordT> (Columns::ColumnId_MeshType, ColumnBase::Display_MeshType, flags)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
|
@ -2379,7 +2381,18 @@ namespace CSMWorld
|
|||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
struct BodyPartRaceColumn : public RaceColumn<ESM::BodyPart>
|
||||
{
|
||||
const MeshTypeColumn<ESM::BodyPart> *mMeshType;
|
||||
|
||||
BodyPartRaceColumn(const MeshTypeColumn<ESM::BodyPart> *meshType);
|
||||
|
||||
virtual QVariant get(const Record<ESM::BodyPart> &record) const;
|
||||
virtual void set(Record<ESM::BodyPart> &record, const QVariant &data);
|
||||
virtual bool isEditable() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -351,9 +351,12 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
|||
mBodyParts.addColumn (new FlagColumn<ESM::BodyPart> (Columns::ColumnId_Female, ESM::BodyPart::BPF_Female));
|
||||
mBodyParts.addColumn (new FlagColumn<ESM::BodyPart> (Columns::ColumnId_Playable,
|
||||
ESM::BodyPart::BPF_NotPlayable, ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, true));
|
||||
mBodyParts.addColumn (new MeshTypeColumn<ESM::BodyPart>);
|
||||
|
||||
int meshTypeFlags = ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh;
|
||||
MeshTypeColumn<ESM::BodyPart> *meshTypeColumn = new MeshTypeColumn<ESM::BodyPart>(meshTypeFlags);
|
||||
mBodyParts.addColumn (meshTypeColumn);
|
||||
mBodyParts.addColumn (new ModelColumn<ESM::BodyPart>);
|
||||
mBodyParts.addColumn (new RaceColumn<ESM::BodyPart>);
|
||||
mBodyParts.addColumn (new BodyPartRaceColumn(meshTypeColumn));
|
||||
|
||||
mSoundGens.addColumn (new StringIdColumn<ESM::SoundGenerator>);
|
||||
mSoundGens.addColumn (new RecordStateColumn<ESM::SoundGenerator>);
|
||||
|
|
Loading…
Reference in a new issue