mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 09:04:33 +02:00
writeOBJToString
This commit is contained in:
parent
1eedce9825
commit
4a1be69be4
3 changed files with 13 additions and 9 deletions
|
@ -126,3 +126,14 @@ bool writeOBJToFile(QString path, QList<MeshPointer> meshes) {
|
|||
file.close();
|
||||
return success;
|
||||
}
|
||||
|
||||
QString writeOBJToString(QList<MeshPointer> meshes) {
|
||||
QString result;
|
||||
QTextStream outStream(&result, QIODevice::ReadWrite);
|
||||
bool success;
|
||||
success = writeOBJToTextStream(outStream, meshes);
|
||||
if (success) {
|
||||
return result;
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
|
|
@ -21,6 +21,6 @@ using MeshPointer = std::shared_ptr<model::Mesh>;
|
|||
|
||||
bool writeOBJToTextStream(QTextStream& out, QList<MeshPointer> meshes);
|
||||
bool writeOBJToFile(QString path, QList<MeshPointer> meshes);
|
||||
|
||||
QString writeOBJToString(QList<MeshPointer> meshes);
|
||||
|
||||
#endif // hifi_objwriter_h
|
||||
|
|
|
@ -44,17 +44,10 @@ void meshesFromScriptValue(const QScriptValue& value, MeshProxyList &out) {
|
|||
}
|
||||
|
||||
QString ModelScriptingInterface::meshToOBJ(MeshProxyList in) {
|
||||
bool success;
|
||||
QString filename = "/tmp/okokok.obj";
|
||||
|
||||
QList<MeshPointer> meshes;
|
||||
foreach (const MeshProxy* meshProxy, in) {
|
||||
meshes.append(meshProxy->getMeshPointer());
|
||||
}
|
||||
|
||||
success = writeOBJToFile(filename, meshes);
|
||||
if (!success) {
|
||||
return "";
|
||||
}
|
||||
return filename;
|
||||
return writeOBJToString(meshes);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue