add support for tagging meshes with displayName

This commit is contained in:
humbletim 2017-12-15 13:36:48 -05:00
parent 15fcf66d0e
commit 61711f34cc
2 changed files with 19 additions and 2 deletions

View file

@ -1759,6 +1759,9 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
geometry.meshes.append(extracted.mesh);
int meshIndex = geometry.meshes.size() - 1;
if (extracted.mesh._mesh) {
extracted.mesh._mesh->displayName = QString("%1#/mesh/%2").arg(url).arg(meshIndex);
}
meshIDsToMeshIndices.insert(it.key(), meshIndex);
}
@ -1827,7 +1830,19 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
}
}
}
{
int i=0;
for (const auto& mesh : geometry.meshes) {
auto name = geometry.getModelNameOfMesh(i++);
if (!name.isEmpty()) {
if (mesh._mesh) {
mesh._mesh->displayName += "#" + name;
} else {
qDebug() << "modelName but no mesh._mesh" << name;
}
}
}
}
return geometryPtr;
}
@ -1843,7 +1858,7 @@ FBXGeometry* readFBX(QIODevice* device, const QVariantHash& mapping, const QStri
reader._loadLightmaps = loadLightmaps;
reader._lightmapLevel = lightmapLevel;
qDebug() << "Reading FBX: " << url;
qCDebug(modelformat) << "Reading FBX: " << url;
return reader.extractFBXGeometry(mapping, url);
}

View file

@ -135,6 +135,8 @@ public:
static MeshPointer createIndexedTriangles_P3F(uint32_t numVertices, uint32_t numTriangles, const glm::vec3* vertices = nullptr, const uint32_t* indices = nullptr);
QString displayName;
protected:
gpu::Stream::FormatPointer _vertexFormat;