mirror of
https://github.com/redstrate/Novus.git
synced 2025-06-15 16:57:46 +00:00
Update to latest libphysis and it's API changes
This commit is contained in:
parent
f10beec178
commit
a86ef69bdb
14 changed files with 80 additions and 80 deletions
|
@ -39,7 +39,7 @@ private:
|
||||||
void updateHeightScaling(float scale);
|
void updateHeightScaling(float scale);
|
||||||
void updateBustScaling(float scale);
|
void updateBustScaling(float scale);
|
||||||
void updateCharacterParameters();
|
void updateCharacterParameters();
|
||||||
void updateSupportedSubraces();
|
void updateSupportedTribes();
|
||||||
void updateRaceData();
|
void updateRaceData();
|
||||||
|
|
||||||
QGroupBox *addFaceGroup();
|
QGroupBox *addFaceGroup();
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
explicit GearView(GameData *data, FileCache &cache, QWidget *parent = nullptr);
|
explicit GearView(GameData *data, FileCache &cache, QWidget *parent = nullptr);
|
||||||
|
|
||||||
/// Returns an inclusive list of races supported by the current gearset.
|
/// Returns an inclusive list of races supported by the current gearset.
|
||||||
std::vector<std::pair<Race, Subrace>> supportedRaces() const;
|
std::vector<std::pair<Race, Tribe>> supportedRaces() const;
|
||||||
|
|
||||||
/// Returns an inclusive list of genders supported by the current gearset.
|
/// Returns an inclusive list of genders supported by the current gearset.
|
||||||
std::vector<Gender> supportedGenders() const;
|
std::vector<Gender> supportedGenders() const;
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
MDLPart &part() const;
|
MDLPart &part() const;
|
||||||
|
|
||||||
Race currentRace = Race::Hyur;
|
Race currentRace = Race::Hyur;
|
||||||
Subrace currentSubrace = Subrace::Midlander;
|
Tribe currentTribe = Tribe::Midlander;
|
||||||
Gender currentGender = Gender::Male;
|
Gender currentGender = Gender::Male;
|
||||||
|
|
||||||
QString getLoadedGearPath() const;
|
QString getLoadedGearPath() const;
|
||||||
|
@ -79,7 +79,7 @@ public Q_SLOTS:
|
||||||
void removeGear(GearInfo &gear);
|
void removeGear(GearInfo &gear);
|
||||||
|
|
||||||
void setRace(Race race);
|
void setRace(Race race);
|
||||||
void setSubrace(Subrace subrace);
|
void setTribe(Tribe subrace);
|
||||||
void setGender(Gender gender);
|
void setGender(Gender gender);
|
||||||
void setLevelOfDetail(int lod);
|
void setLevelOfDetail(int lod);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public Q_SLOTS:
|
||||||
void setGear(const GearInfo &info);
|
void setGear(const GearInfo &info);
|
||||||
|
|
||||||
void setRace(Race race);
|
void setRace(Race race);
|
||||||
void setSubrace(Subrace subrace);
|
void setTribe(Tribe subrace);
|
||||||
void setGender(Gender gender);
|
void setGender(Gender gender);
|
||||||
void setLevelOfDetail(int lod);
|
void setLevelOfDetail(int lod);
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ private:
|
||||||
std::optional<GearInfo> currentGear;
|
std::optional<GearInfo> currentGear;
|
||||||
|
|
||||||
Race currentRace = Race::Hyur;
|
Race currentRace = Race::Hyur;
|
||||||
Subrace currentSubrace = Subrace::Midlander;
|
Tribe currentTribe = Tribe::Midlander;
|
||||||
Gender currentGender = Gender::Male;
|
Gender currentGender = Gender::Male;
|
||||||
int currentLod = 0;
|
int currentLod = 0;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ FullModelViewer::FullModelViewer(GameData *data, FileCache &cache, QWidget *pare
|
||||||
|
|
||||||
gearView->setRace(charDat.race);
|
gearView->setRace(charDat.race);
|
||||||
gearView->setGender(charDat.gender);
|
gearView->setGender(charDat.gender);
|
||||||
// gearView->setSubrace(charDat.subrace);
|
// gearView->setTribe(charDat.subrace);
|
||||||
gearView->setFace(charDat.head);
|
gearView->setFace(charDat.head);
|
||||||
gearView->setHair(charDat.hair);
|
gearView->setHair(charDat.hair);
|
||||||
updateBustScaling((float)charDat.bust / 100.0f);
|
updateBustScaling((float)charDat.bust / 100.0f);
|
||||||
|
@ -128,16 +128,16 @@ FullModelViewer::FullModelViewer(GameData *data, FileCache &cache, QWidget *pare
|
||||||
|
|
||||||
subraceCombo = new QComboBox();
|
subraceCombo = new QComboBox();
|
||||||
connect(subraceCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) {
|
connect(subraceCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) {
|
||||||
gearView->setSubrace((Subrace)subraceCombo->itemData(index).toInt());
|
gearView->setTribe((Tribe)subraceCombo->itemData(index).toInt());
|
||||||
});
|
});
|
||||||
controlLayout->addWidget(subraceCombo);
|
controlLayout->addWidget(subraceCombo);
|
||||||
|
|
||||||
connect(raceCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) {
|
connect(raceCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) {
|
||||||
gearView->setRace((Race)raceCombo->itemData(index).toInt());
|
gearView->setRace((Race)raceCombo->itemData(index).toInt());
|
||||||
|
|
||||||
updateSupportedSubraces();
|
updateSupportedTribes();
|
||||||
});
|
});
|
||||||
updateSupportedSubraces();
|
updateSupportedTribes();
|
||||||
|
|
||||||
genderCombo = new QComboBox();
|
genderCombo = new QComboBox();
|
||||||
connect(genderCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) {
|
connect(genderCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) {
|
||||||
|
@ -259,7 +259,7 @@ void FullModelViewer::updateHeightScaling(float scale)
|
||||||
for (uint32_t i = 0; i < boneData.num_bones; i++) {
|
for (uint32_t i = 0; i < boneData.num_bones; i++) {
|
||||||
const std::string_view name{boneData.bones[i].name};
|
const std::string_view name{boneData.bones[i].name};
|
||||||
if (name == "n_root") {
|
if (name == "n_root") {
|
||||||
auto racialScaling = physis_cmp_get_racial_scaling_parameters(cmp, gearView->currentRace, gearView->currentSubrace);
|
auto racialScaling = physis_cmp_get_racial_scaling_parameters(cmp, gearView->currentRace, gearView->currentTribe);
|
||||||
|
|
||||||
const float minSize = gearView->currentGender == Gender::Male ? racialScaling.male_min_size : racialScaling.female_min_size;
|
const float minSize = gearView->currentGender == Gender::Male ? racialScaling.male_min_size : racialScaling.female_min_size;
|
||||||
const float maxSize = gearView->currentGender == Gender::Male ? racialScaling.male_max_size : racialScaling.female_max_size;
|
const float maxSize = gearView->currentGender == Gender::Male ? racialScaling.male_max_size : racialScaling.female_max_size;
|
||||||
|
@ -283,7 +283,7 @@ void FullModelViewer::updateBustScaling(float scale)
|
||||||
for (uint32_t i = 0; i < boneData.num_bones; i++) {
|
for (uint32_t i = 0; i < boneData.num_bones; i++) {
|
||||||
const std::string_view name{boneData.bones[i].name};
|
const std::string_view name{boneData.bones[i].name};
|
||||||
if (name == "j_mune_l" || name == "j_mune_r") {
|
if (name == "j_mune_l" || name == "j_mune_r") {
|
||||||
auto racialScaling = physis_cmp_get_racial_scaling_parameters(cmp, gearView->currentRace, gearView->currentSubrace);
|
auto racialScaling = physis_cmp_get_racial_scaling_parameters(cmp, gearView->currentRace, gearView->currentTribe);
|
||||||
|
|
||||||
const float rangeX = glm::mix(racialScaling.bust_min_x, racialScaling.bust_max_x, scale);
|
const float rangeX = glm::mix(racialScaling.bust_min_x, racialScaling.bust_max_x, scale);
|
||||||
const float rangeY = glm::mix(racialScaling.bust_min_y, racialScaling.bust_max_y, scale);
|
const float rangeY = glm::mix(racialScaling.bust_min_y, racialScaling.bust_max_y, scale);
|
||||||
|
@ -306,10 +306,10 @@ void FullModelViewer::updateCharacterParameters()
|
||||||
updateBustScaling(bustScale);
|
updateBustScaling(bustScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullModelViewer::updateSupportedSubraces()
|
void FullModelViewer::updateSupportedTribes()
|
||||||
{
|
{
|
||||||
subraceCombo->clear();
|
subraceCombo->clear();
|
||||||
for (auto subrace : physis_get_supported_subraces(gearView->currentRace).subraces) {
|
for (auto subrace : physis_get_supported_tribes(gearView->currentRace).subraces) {
|
||||||
subraceCombo->addItem(QLatin1String(magic_enum::enum_name(subrace).data()), (int)subrace);
|
subraceCombo->addItem(QLatin1String(magic_enum::enum_name(subrace).data()), (int)subrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,8 +317,8 @@ void FullModelViewer::updateSupportedSubraces()
|
||||||
void FullModelViewer::updateRaceData()
|
void FullModelViewer::updateRaceData()
|
||||||
{
|
{
|
||||||
m_boneEditor->load_pbd(gearView->part().pbd,
|
m_boneEditor->load_pbd(gearView->part().pbd,
|
||||||
physis_get_race_code(Race::Hyur, Subrace::Midlander, gearView->currentGender),
|
physis_get_race_code(Race::Hyur, Tribe::Midlander, gearView->currentGender),
|
||||||
physis_get_race_code(gearView->currentRace, gearView->currentSubrace, gearView->currentGender));
|
physis_get_race_code(gearView->currentRace, gearView->currentTribe, gearView->currentGender));
|
||||||
}
|
}
|
||||||
|
|
||||||
QGroupBox *FullModelViewer::addFaceGroup()
|
QGroupBox *FullModelViewer::addFaceGroup()
|
||||||
|
|
|
@ -175,7 +175,7 @@ void GearListModel::exdFinished(int index)
|
||||||
auto exd = exdFuture->resultAt(index);
|
auto exd = exdFuture->resultAt(index);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < exh->row_count; i++) {
|
for (unsigned int i = 0; i < exh->row_count; i++) {
|
||||||
const auto row = physis_exd_read_row(&exd, exh, i); // TODO: use all rows, free
|
const auto row = physis_exd_read_row(&exd, i); // TODO: use all rows, free
|
||||||
|
|
||||||
auto primaryModel = row.row_data[0].column_data[47].u_int64._0;
|
auto primaryModel = row.row_data[0].column_data[47].u_int64._0;
|
||||||
// auto secondaryModel = row.column_data[48].u_int64._0;
|
// auto secondaryModel = row.column_data[48].u_int64._0;
|
||||||
|
|
|
@ -60,12 +60,12 @@ GearView::GearView(GameData *data, FileCache &cache, QWidget *parent)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::pair<Race, Subrace>> GearView::supportedRaces() const
|
std::vector<std::pair<Race, Tribe>> GearView::supportedRaces() const
|
||||||
{
|
{
|
||||||
std::vector<std::pair<Race, Subrace>> races;
|
std::vector<std::pair<Race, Tribe>> races;
|
||||||
for (const auto &gear : loadedGears) {
|
for (const auto &gear : loadedGears) {
|
||||||
for (const auto &[race, race_name] : magic_enum::enum_entries<Race>()) {
|
for (const auto &[race, race_name] : magic_enum::enum_entries<Race>()) {
|
||||||
for (const auto subrace : physis_get_supported_subraces(race).subraces) {
|
for (const auto subrace : physis_get_supported_tribes(race).subraces) {
|
||||||
auto equip_path = physis_build_equipment_path(gear.info.modelInfo.primaryID, race, subrace, currentGender, gear.info.slot);
|
auto equip_path = physis_build_equipment_path(gear.info.modelInfo.primaryID, race, subrace, currentGender, gear.info.slot);
|
||||||
|
|
||||||
if (cache.fileExists(QLatin1String(equip_path)))
|
if (cache.fileExists(QLatin1String(equip_path)))
|
||||||
|
@ -82,7 +82,7 @@ std::vector<Gender> GearView::supportedGenders() const
|
||||||
std::vector<Gender> genders;
|
std::vector<Gender> genders;
|
||||||
for (const auto &gear : loadedGears) {
|
for (const auto &gear : loadedGears) {
|
||||||
for (auto [gender, gender_name] : magic_enum::enum_entries<Gender>()) {
|
for (auto [gender, gender_name] : magic_enum::enum_entries<Gender>()) {
|
||||||
auto equip_path = physis_build_equipment_path(gear.info.modelInfo.primaryID, currentRace, Subrace::Midlander, currentGender, gear.info.slot);
|
auto equip_path = physis_build_equipment_path(gear.info.modelInfo.primaryID, currentRace, Tribe::Midlander, currentGender, gear.info.slot);
|
||||||
|
|
||||||
if (cache.fileExists(QLatin1String(equip_path)))
|
if (cache.fileExists(QLatin1String(equip_path)))
|
||||||
genders.push_back(gender);
|
genders.push_back(gender);
|
||||||
|
@ -137,9 +137,9 @@ void GearView::setRace(Race race)
|
||||||
|
|
||||||
currentRace = race;
|
currentRace = race;
|
||||||
|
|
||||||
const auto supportedSubraces = physis_get_supported_subraces(race);
|
const auto supportedTribes = physis_get_supported_tribes(race);
|
||||||
if (supportedSubraces.subraces[0] != currentSubrace && supportedSubraces.subraces[1] != currentSubrace) {
|
if (supportedTribes.subraces[0] != currentTribe && supportedTribes.subraces[1] != currentTribe) {
|
||||||
setSubrace(supportedSubraces.subraces[0]);
|
setTribe(supportedTribes.subraces[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (race == Race::AuRa || race == Race::Miqote) {
|
if (race == Race::AuRa || race == Race::Miqote) {
|
||||||
|
@ -153,13 +153,13 @@ void GearView::setRace(Race race)
|
||||||
Q_EMIT raceChanged();
|
Q_EMIT raceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GearView::setSubrace(Subrace subrace)
|
void GearView::setTribe(Tribe subrace)
|
||||||
{
|
{
|
||||||
if (currentSubrace == subrace) {
|
if (currentTribe == subrace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSubrace = subrace;
|
currentTribe = subrace;
|
||||||
|
|
||||||
// Hyur is the only race that has two different subraces
|
// Hyur is the only race that has two different subraces
|
||||||
if (currentRace == Race::Hyur) {
|
if (currentRace == Race::Hyur) {
|
||||||
|
@ -262,9 +262,9 @@ void GearView::setTail(const int tailCode)
|
||||||
|
|
||||||
void GearView::reloadRaceDeforms()
|
void GearView::reloadRaceDeforms()
|
||||||
{
|
{
|
||||||
qDebug() << "Loading race deform matrices for " << magic_enum::enum_name(currentRace).data() << magic_enum::enum_name(currentSubrace).data()
|
qDebug() << "Loading race deform matrices for " << magic_enum::enum_name(currentRace).data() << magic_enum::enum_name(currentTribe).data()
|
||||||
<< magic_enum::enum_name(currentGender).data();
|
<< magic_enum::enum_name(currentGender).data();
|
||||||
const int raceCode = physis_get_race_code(currentRace, currentSubrace, currentGender);
|
const int raceCode = physis_get_race_code(currentRace, currentTribe, currentGender);
|
||||||
|
|
||||||
QString skelName = QStringLiteral("chara/human/c%1/skeleton/base/b0001/skl_c%1b0001.sklb").arg(raceCode, 4, 10, QLatin1Char{'0'});
|
QString skelName = QStringLiteral("chara/human/c%1/skeleton/base/b0001/skl_c%1b0001.sklb").arg(raceCode, 4, 10, QLatin1Char{'0'});
|
||||||
std::string skelNameStd = skelName.toStdString();
|
std::string skelNameStd = skelName.toStdString();
|
||||||
|
@ -294,27 +294,27 @@ void GearView::updatePart()
|
||||||
if (gearDirty) {
|
if (gearDirty) {
|
||||||
for (auto &gearAddition : queuedGearAdditions) {
|
for (auto &gearAddition : queuedGearAdditions) {
|
||||||
auto mdlPath = QLatin1String(
|
auto mdlPath = QLatin1String(
|
||||||
physis_build_equipment_path(gearAddition.info.modelInfo.primaryID, currentRace, currentSubrace, currentGender, gearAddition.info.slot));
|
physis_build_equipment_path(gearAddition.info.modelInfo.primaryID, currentRace, currentTribe, currentGender, gearAddition.info.slot));
|
||||||
|
|
||||||
auto mdl_data = cache.lookupFile(mdlPath);
|
auto mdl_data = cache.lookupFile(mdlPath);
|
||||||
|
|
||||||
// attempt to load the next best race
|
// attempt to load the next best race
|
||||||
// currently hardcoded to hyur midlander
|
// currently hardcoded to hyur midlander
|
||||||
Race fallbackRace = currentRace;
|
Race fallbackRace = currentRace;
|
||||||
Subrace fallbackSubrace = currentSubrace;
|
Tribe fallbackTribe = currentTribe;
|
||||||
if (mdl_data.size == 0) {
|
if (mdl_data.size == 0) {
|
||||||
mdlPath = QLatin1String(
|
mdlPath = QLatin1String(
|
||||||
physis_build_equipment_path(gearAddition.info.modelInfo.primaryID, Race::Hyur, Subrace::Midlander, currentGender, gearAddition.info.slot));
|
physis_build_equipment_path(gearAddition.info.modelInfo.primaryID, Race::Hyur, Tribe::Midlander, currentGender, gearAddition.info.slot));
|
||||||
mdl_data = cache.lookupFile(mdlPath);
|
mdl_data = cache.lookupFile(mdlPath);
|
||||||
fallbackRace = Race::Hyur;
|
fallbackRace = Race::Hyur;
|
||||||
fallbackSubrace = Subrace::Midlander;
|
fallbackTribe = Tribe::Midlander;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fallbackRace != currentRace) {
|
if (fallbackRace != currentRace) {
|
||||||
qDebug() << "Fell back to hyur race for" << mdlPath;
|
qDebug() << "Fell back to hyur race for" << mdlPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fallbackSubrace != currentSubrace) {
|
if (fallbackTribe != currentTribe) {
|
||||||
qDebug() << "Fell back to midlander subrace for" << mdlPath;
|
qDebug() << "Fell back to midlander subrace for" << mdlPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ void GearView::updatePart()
|
||||||
|
|
||||||
const std::string mtrl_path = gearAddition.info.getMtrlPath(material_name);
|
const std::string mtrl_path = gearAddition.info.getMtrlPath(material_name);
|
||||||
const std::string skinmtrl_path =
|
const std::string skinmtrl_path =
|
||||||
physis_build_skin_material_path(physis_get_race_code(fallbackRace, fallbackSubrace, currentGender), 1, material_name);
|
physis_build_skin_material_path(physis_get_race_code(fallbackRace, fallbackTribe, currentGender), 1, material_name);
|
||||||
|
|
||||||
if (cache.fileExists(QLatin1String(mtrl_path.c_str()))) {
|
if (cache.fileExists(QLatin1String(mtrl_path.c_str()))) {
|
||||||
auto mat = physis_material_parse(cache.lookupFile(QLatin1String(mtrl_path.c_str())));
|
auto mat = physis_material_parse(cache.lookupFile(QLatin1String(mtrl_path.c_str())));
|
||||||
|
@ -342,14 +342,14 @@ void GearView::updatePart()
|
||||||
|
|
||||||
maxLod = std::max(mdl.num_lod, maxLod);
|
maxLod = std::max(mdl.num_lod, maxLod);
|
||||||
|
|
||||||
gearAddition.bodyId = physis_get_race_code(fallbackRace, fallbackSubrace, currentGender);
|
gearAddition.bodyId = physis_get_race_code(fallbackRace, fallbackTribe, currentGender);
|
||||||
mdlPart->addModel(mdl,
|
mdlPart->addModel(mdl,
|
||||||
true,
|
true,
|
||||||
glm::vec3(),
|
glm::vec3(),
|
||||||
sanitizeMdlPath(mdlPath),
|
sanitizeMdlPath(mdlPath),
|
||||||
materials,
|
materials,
|
||||||
currentLod,
|
currentLod,
|
||||||
physis_get_race_code(currentRace, currentSubrace, currentGender),
|
physis_get_race_code(currentRace, currentTribe, currentGender),
|
||||||
gearAddition.bodyId);
|
gearAddition.bodyId);
|
||||||
gearAddition.mdl = mdl;
|
gearAddition.mdl = mdl;
|
||||||
gearAddition.path = mdlPath;
|
gearAddition.path = mdlPath;
|
||||||
|
@ -379,7 +379,7 @@ void GearView::updatePart()
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto loadBodyPart = [this, &sanitizeMdlPath](int index, CharacterCategory category, auto build_material_path_func) {
|
const auto loadBodyPart = [this, &sanitizeMdlPath](int index, CharacterCategory category, auto build_material_path_func) {
|
||||||
const auto mdlPath = QLatin1String(physis_build_character_path(category, index, currentRace, currentSubrace, currentGender));
|
const auto mdlPath = QLatin1String(physis_build_character_path(category, index, currentRace, currentTribe, currentGender));
|
||||||
auto mdl_data = cache.lookupFile(mdlPath);
|
auto mdl_data = cache.lookupFile(mdlPath);
|
||||||
|
|
||||||
if (mdl_data.size > 0) {
|
if (mdl_data.size > 0) {
|
||||||
|
@ -389,7 +389,7 @@ void GearView::updatePart()
|
||||||
for (uint32_t i = 0; i < mdl.num_material_names; i++) {
|
for (uint32_t i = 0; i < mdl.num_material_names; i++) {
|
||||||
const char *material_name = mdl.material_names[i];
|
const char *material_name = mdl.material_names[i];
|
||||||
const std::string skinmtrl_path =
|
const std::string skinmtrl_path =
|
||||||
build_material_path_func(physis_get_race_code(currentRace, currentSubrace, currentGender), index, material_name);
|
build_material_path_func(physis_get_race_code(currentRace, currentTribe, currentGender), index, material_name);
|
||||||
|
|
||||||
if (cache.fileExists(QLatin1String(skinmtrl_path.c_str()))) {
|
if (cache.fileExists(QLatin1String(skinmtrl_path.c_str()))) {
|
||||||
auto mat = physis_material_parse(cache.lookupFile(QLatin1String(skinmtrl_path.c_str())));
|
auto mat = physis_material_parse(cache.lookupFile(QLatin1String(skinmtrl_path.c_str())));
|
||||||
|
|
|
@ -59,7 +59,7 @@ SingleGearView::SingleGearView(GameData *data, FileCache &cache, QWidget *parent
|
||||||
subraceCombo = new QComboBox();
|
subraceCombo = new QComboBox();
|
||||||
subraceCombo->setWhatsThis(i18n("The subrace used in the gear model preview. Note that this only shows subraces that have unique models for this gear."));
|
subraceCombo->setWhatsThis(i18n("The subrace used in the gear model preview. Note that this only shows subraces that have unique models for this gear."));
|
||||||
connect(subraceCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) {
|
connect(subraceCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) {
|
||||||
setSubrace(static_cast<Subrace>(subraceCombo->itemData(index).toInt()));
|
setTribe(static_cast<Tribe>(subraceCombo->itemData(index).toInt()));
|
||||||
});
|
});
|
||||||
controlLayout->addWidget(subraceCombo);
|
controlLayout->addWidget(subraceCombo);
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ SingleGearView::SingleGearView(GameData *data, FileCache &cache, QWidget *parent
|
||||||
gearView->setRace(currentRace);
|
gearView->setRace(currentRace);
|
||||||
});
|
});
|
||||||
connect(this, &SingleGearView::subraceChanged, this, [this] {
|
connect(this, &SingleGearView::subraceChanged, this, [this] {
|
||||||
gearView->setSubrace(currentSubrace);
|
gearView->setTribe(currentTribe);
|
||||||
});
|
});
|
||||||
connect(this, &SingleGearView::genderChanged, this, [this] {
|
connect(this, &SingleGearView::genderChanged, this, [this] {
|
||||||
gearView->setGender(currentGender);
|
gearView->setGender(currentGender);
|
||||||
|
@ -272,13 +272,13 @@ void SingleGearView::setRace(Race race)
|
||||||
Q_EMIT raceChanged();
|
Q_EMIT raceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleGearView::setSubrace(Subrace subrace)
|
void SingleGearView::setTribe(Tribe subrace)
|
||||||
{
|
{
|
||||||
if (currentSubrace == subrace) {
|
if (currentTribe == subrace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSubrace = subrace;
|
currentTribe = subrace;
|
||||||
Q_EMIT subraceChanged();
|
Q_EMIT subraceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ void SingleGearView::reloadGear()
|
||||||
QSignalBlocker lodBlocker(lodCombo);
|
QSignalBlocker lodBlocker(lodCombo);
|
||||||
|
|
||||||
const auto oldRace = static_cast<Race>(raceCombo->itemData(raceCombo->currentIndex()).toInt());
|
const auto oldRace = static_cast<Race>(raceCombo->itemData(raceCombo->currentIndex()).toInt());
|
||||||
const auto oldSubrace = static_cast<Subrace>(subraceCombo->itemData(subraceCombo->currentIndex()).toInt());
|
const auto oldTribe = static_cast<Tribe>(subraceCombo->itemData(subraceCombo->currentIndex()).toInt());
|
||||||
const auto oldGender = static_cast<Gender>(genderCombo->itemData(genderCombo->currentIndex()).toInt());
|
const auto oldGender = static_cast<Gender>(genderCombo->itemData(genderCombo->currentIndex()).toInt());
|
||||||
const auto oldLod = lodCombo->itemData(lodCombo->currentIndex()).toInt();
|
const auto oldLod = lodCombo->itemData(lodCombo->currentIndex()).toInt();
|
||||||
|
|
||||||
|
@ -358,8 +358,8 @@ void SingleGearView::reloadGear()
|
||||||
|
|
||||||
if (auto it = std::find_if(supportedRaces.begin(),
|
if (auto it = std::find_if(supportedRaces.begin(),
|
||||||
supportedRaces.end(),
|
supportedRaces.end(),
|
||||||
[oldSubrace](auto p) {
|
[oldTribe](auto p) {
|
||||||
return std::get<1>(p) == oldSubrace;
|
return std::get<1>(p) == oldTribe;
|
||||||
});
|
});
|
||||||
it != supportedRaces.end()) {
|
it != supportedRaces.end()) {
|
||||||
subraceCombo->setCurrentIndex(std::distance(supportedRaces.begin(), it));
|
subraceCombo->setCurrentIndex(std::distance(supportedRaces.begin(), it));
|
||||||
|
|
|
@ -44,26 +44,26 @@ MapListWidget::MapListWidget(GameData *data, QWidget *parent)
|
||||||
auto territoryExd = physis_gamedata_read_excel_sheet(data, "TerritoryType", territoryExh, Language::None, 0);
|
auto territoryExd = physis_gamedata_read_excel_sheet(data, "TerritoryType", territoryExh, Language::None, 0);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < exh->row_count; i++) {
|
for (uint32_t i = 0; i < exh->row_count; i++) {
|
||||||
auto rows = physis_exd_read_row(&exd, exh, i); // TODO: free, use all rows
|
auto rows = physis_exd_read_row(&exd, i); // TODO: free, use all rows
|
||||||
|
|
||||||
const char *id = rows.row_data[0].column_data[6].string._0;
|
const char *id = rows.row_data[0].column_data[6].string._0;
|
||||||
|
|
||||||
const uint16_t territoryTypeKey = rows.row_data[0].column_data[15].u_int16._0;
|
const uint16_t territoryTypeKey = rows.row_data[0].column_data[15].u_int16._0;
|
||||||
if (territoryTypeKey > 0 && territoryTypeKey < territoryExh->row_count) {
|
if (territoryTypeKey > 0 && territoryTypeKey < territoryExh->row_count) {
|
||||||
auto territoryExdRow = physis_exd_read_row(&territoryExd, territoryExh, territoryTypeKey); // TODO: free, use all rows
|
auto territoryExdRow = physis_exd_read_row(&territoryExd, territoryTypeKey); // TODO: free, use all rows
|
||||||
|
|
||||||
const char *bg = territoryExdRow.row_data[0].column_data[1].string._0;
|
const char *bg = territoryExdRow.row_data[0].column_data[1].string._0;
|
||||||
|
|
||||||
int placeRegionKey = territoryExdRow.row_data[0].column_data[3].u_int16._0;
|
int placeRegionKey = territoryExdRow.row_data[0].column_data[3].u_int16._0;
|
||||||
auto regionExdRow = physis_exd_read_row(&nameExd, nameExh, placeRegionKey); // TODO: free, use all rows
|
auto regionExdRow = physis_exd_read_row(&nameExd, placeRegionKey); // TODO: free, use all rows
|
||||||
const char *placeRegion = regionExdRow.row_data[0].column_data[0].string._0;
|
const char *placeRegion = regionExdRow.row_data[0].column_data[0].string._0;
|
||||||
|
|
||||||
int placeZoneKey = territoryExdRow.row_data[0].column_data[4].u_int16._0;
|
int placeZoneKey = territoryExdRow.row_data[0].column_data[4].u_int16._0;
|
||||||
auto zoneExdRow = physis_exd_read_row(&nameExd, nameExh, placeRegionKey); // TODO: free, use all rows
|
auto zoneExdRow = physis_exd_read_row(&nameExd, placeRegionKey); // TODO: free, use all rows
|
||||||
const char *placeZone = zoneExdRow.row_data[0].column_data[0].string._0;
|
const char *placeZone = zoneExdRow.row_data[0].column_data[0].string._0;
|
||||||
|
|
||||||
int placeNameKey = territoryExdRow.row_data[0].column_data[5].u_int16._0;
|
int placeNameKey = territoryExdRow.row_data[0].column_data[5].u_int16._0;
|
||||||
auto nameExdRow = physis_exd_read_row(&nameExd, nameExh, placeRegionKey); // TODO: free, use all rows
|
auto nameExdRow = physis_exd_read_row(&nameExd, placeRegionKey); // TODO: free, use all rows
|
||||||
const char *placeName = nameExdRow.row_data[0].column_data[0].string._0;
|
const char *placeName = nameExdRow.row_data[0].column_data[0].string._0;
|
||||||
|
|
||||||
QStandardItem *item = new QStandardItem();
|
QStandardItem *item = new QStandardItem();
|
||||||
|
|
|
@ -33,7 +33,7 @@ void MaterialView::addSphere(physis_Material material)
|
||||||
{
|
{
|
||||||
mdlPart->clear();
|
mdlPart->clear();
|
||||||
|
|
||||||
const int raceCode = physis_get_race_code(Race::Hyur, Subrace::Midlander, Gender::Male);
|
const int raceCode = physis_get_race_code(Race::Hyur, Tribe::Midlander, Gender::Male);
|
||||||
|
|
||||||
QString skelName = QStringLiteral("chara/human/c%1/skeleton/base/b0001/skl_c%1b0001.sklb").arg(raceCode, 4, 10, QLatin1Char{'0'});
|
QString skelName = QStringLiteral("chara/human/c%1/skeleton/base/b0001/skl_c%1b0001.sklb").arg(raceCode, 4, 10, QLatin1Char{'0'});
|
||||||
std::string skelNameStd = skelName.toStdString();
|
std::string skelNameStd = skelName.toStdString();
|
||||||
|
|
|
@ -36,7 +36,7 @@ MainWindow::MainWindow(GameData *data)
|
||||||
part = new MDLPart(data, cache);
|
part = new MDLPart(data, cache);
|
||||||
part->minimumCameraDistance = 0.05f;
|
part->minimumCameraDistance = 0.05f;
|
||||||
|
|
||||||
const int raceCode = physis_get_race_code(Race::Hyur, Subrace::Midlander, Gender::Male);
|
const int raceCode = physis_get_race_code(Race::Hyur, Tribe::Midlander, Gender::Male);
|
||||||
|
|
||||||
QString skelName = QStringLiteral("chara/human/c%1/skeleton/base/b0001/skl_c%1b0001.sklb").arg(raceCode, 4, 10, QLatin1Char{'0'});
|
QString skelName = QStringLiteral("chara/human/c%1/skeleton/base/b0001/skl_c%1b0001.sklb").arg(raceCode, 4, 10, QLatin1Char{'0'});
|
||||||
std::string skelNameStd = skelName.toStdString();
|
std::string skelNameStd = skelName.toStdString();
|
||||||
|
|
2
extern/libphysis
vendored
2
extern/libphysis
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 464fe20833554e80cfb052b40393245faac6e5cb
|
Subproject commit 9dd165e47da97d81776068dd584a3a24fa656d10
|
|
@ -14,17 +14,17 @@
|
||||||
// TODO: move this to physis
|
// TODO: move this to physis
|
||||||
struct RaceTree {
|
struct RaceTree {
|
||||||
Race baseRace;
|
Race baseRace;
|
||||||
std::vector<Subrace> subRaces;
|
std::vector<Tribe> subRaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<RaceTree> raceTree = {{Race::Hyur, {Subrace::Midlander, Subrace::Highlander}},
|
const std::vector<RaceTree> raceTree = {{Race::Hyur, {Tribe::Midlander, Tribe::Highlander}},
|
||||||
{Race::Elezen, {Subrace::Wildwood, Subrace::Duskwight}},
|
{Race::Elezen, {Tribe::Wildwood, Tribe::Duskwight}},
|
||||||
{Race::Miqote, {Subrace::Seeker, Subrace::Keeper}},
|
{Race::Miqote, {Tribe::Seeker, Tribe::Keeper}},
|
||||||
{Race::Roegadyn, {Subrace::SeaWolf, Subrace::Hellion}},
|
{Race::Roegadyn, {Tribe::SeaWolf, Tribe::Hellion}},
|
||||||
{Race::Lalafell, {Subrace::Plainsfolk, Subrace::Dunesfolk}},
|
{Race::Lalafell, {Tribe::Plainsfolk, Tribe::Dunesfolk}},
|
||||||
{Race::AuRa, {Subrace::Raen, Subrace::Xaela}},
|
{Race::AuRa, {Tribe::Raen, Tribe::Xaela}},
|
||||||
{Race::Hrothgar, {Subrace::Hellion, Subrace::Lost}},
|
{Race::Hrothgar, {Tribe::Hellion, Tribe::Lost}},
|
||||||
{Race::Viera, {Subrace::Rava, Subrace::Veena}}};
|
{Race::Viera, {Tribe::Rava, Tribe::Veena}}};
|
||||||
|
|
||||||
CmpPart::CmpPart(GameData *data, QWidget *parent)
|
CmpPart::CmpPart(GameData *data, QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
@ -112,10 +112,10 @@ void CmpPart::load(physis_Buffer file)
|
||||||
bustMaxZ = new QDoubleSpinBox();
|
bustMaxZ = new QDoubleSpinBox();
|
||||||
detailBoxLayout->addRow(i18n("Bust Max Z"), bustMaxZ);
|
detailBoxLayout->addRow(i18n("Bust Max Z"), bustMaxZ);
|
||||||
|
|
||||||
loadRaceData(Race::Hyur, Subrace::Midlander);
|
loadRaceData(Race::Hyur, Tribe::Midlander);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CmpPart::loadRaceData(Race race, Subrace subrace)
|
void CmpPart::loadRaceData(Race race, Tribe subrace)
|
||||||
{
|
{
|
||||||
auto raceData = physis_cmp_get_racial_scaling_parameters(cmp, race, subrace);
|
auto raceData = physis_cmp_get_racial_scaling_parameters(cmp, race, subrace);
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,14 @@ class RaceTreeData : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RaceTreeData(Race race, Subrace subrace)
|
RaceTreeData(Race race, Tribe subrace)
|
||||||
: race(race)
|
: race(race)
|
||||||
, subrace(subrace)
|
, subrace(subrace)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Race race;
|
Race race;
|
||||||
Subrace subrace;
|
Tribe subrace;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CmpPart : public QWidget
|
class CmpPart : public QWidget
|
||||||
|
@ -33,7 +33,7 @@ public:
|
||||||
void load(physis_Buffer file);
|
void load(physis_Buffer file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadRaceData(Race race, Subrace subrace);
|
void loadRaceData(Race race, Tribe subrace);
|
||||||
|
|
||||||
GameData *data = nullptr;
|
GameData *data = nullptr;
|
||||||
physis_CMP cmp{};
|
physis_CMP cmp{};
|
||||||
|
|
|
@ -148,7 +148,7 @@ void EXDPart::loadTables()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int j = 0; j < exh->row_count; j++) {
|
for (unsigned int j = 0; j < exh->row_count; j++) {
|
||||||
auto rows = physis_exd_read_row(&exd, exh, j); // TODO: free, use other rows
|
auto rows = physis_exd_read_row(&exd, j); // TODO: free, use other rows
|
||||||
|
|
||||||
for (unsigned int z = 0; z < exd.column_count; z++) {
|
for (unsigned int z = 0; z < exd.column_count; z++) {
|
||||||
auto columnData = rows.row_data[0].column_data[z];
|
auto columnData = rows.row_data[0].column_data[z];
|
||||||
|
|
Loading…
Add table
Reference in a new issue