mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 05:52:31 +02:00
I believe this should fix the "Joint/model not in model list" errors.
This commit is contained in:
parent
88232f320c
commit
131af0cf16
1 changed files with 12 additions and 7 deletions
|
@ -548,17 +548,18 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void appendModelIDs(const QString& parentID, const QMultiHash<QString, QString>& childMap,
|
void appendModelIDs(const QString& parentID, const QMultiHash<QString, QString>& childMap,
|
||||||
QHash<QString, FBXModel>& models, QVector<QString>& modelIDs) {
|
QHash<QString, FBXModel>& models, QSet<QString>& remainingModels, QVector<QString>& modelIDs) {
|
||||||
if (models.contains(parentID)) {
|
if (remainingModels.contains(parentID)) {
|
||||||
modelIDs.append(parentID);
|
modelIDs.append(parentID);
|
||||||
|
remainingModels.remove(parentID);
|
||||||
}
|
}
|
||||||
int parentIndex = modelIDs.size() - 1;
|
int parentIndex = modelIDs.size() - 1;
|
||||||
foreach (const QString& childID, childMap.values(parentID)) {
|
foreach (const QString& childID, childMap.values(parentID)) {
|
||||||
if (models.contains(childID)) {
|
if (remainingModels.contains(childID)) {
|
||||||
FBXModel& model = models[childID];
|
FBXModel& model = models[childID];
|
||||||
if (model.parentIndex == -1) {
|
if (model.parentIndex == -1) {
|
||||||
model.parentIndex = parentIndex;
|
model.parentIndex = parentIndex;
|
||||||
appendModelIDs(childID, childMap, models, modelIDs);
|
appendModelIDs(childID, childMap, models, remainingModels, modelIDs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1101,8 +1102,12 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
||||||
|
|
||||||
// get the list of models in depth-first traversal order
|
// get the list of models in depth-first traversal order
|
||||||
QVector<QString> modelIDs;
|
QVector<QString> modelIDs;
|
||||||
if (!models.isEmpty()) {
|
QSet<QString> remainingModels;
|
||||||
QString top = models.constBegin().key();
|
for (QHash<QString, FBXModel>::const_iterator model = models.constBegin(); model != models.constEnd(); model++) {
|
||||||
|
remainingModels.insert(model.key());
|
||||||
|
}
|
||||||
|
while (!remainingModels.isEmpty()) {
|
||||||
|
QString top = *remainingModels.constBegin();
|
||||||
forever {
|
forever {
|
||||||
foreach (const QString& name, parentMap.values(top)) {
|
foreach (const QString& name, parentMap.values(top)) {
|
||||||
if (models.contains(name)) {
|
if (models.contains(name)) {
|
||||||
|
@ -1115,7 +1120,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
||||||
|
|
||||||
outerContinue: ;
|
outerContinue: ;
|
||||||
}
|
}
|
||||||
appendModelIDs(top, childMap, models, modelIDs);
|
appendModelIDs(top, childMap, models, remainingModels, modelIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert the models to joints
|
// convert the models to joints
|
||||||
|
|
Loading…
Reference in a new issue