mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 00:17:35 +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();
|
file.close();
|
||||||
return success;
|
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 writeOBJToTextStream(QTextStream& out, QList<MeshPointer> meshes);
|
||||||
bool writeOBJToFile(QString path, QList<MeshPointer> meshes);
|
bool writeOBJToFile(QString path, QList<MeshPointer> meshes);
|
||||||
|
QString writeOBJToString(QList<MeshPointer> meshes);
|
||||||
|
|
||||||
#endif // hifi_objwriter_h
|
#endif // hifi_objwriter_h
|
||||||
|
|
|
@ -44,17 +44,10 @@ void meshesFromScriptValue(const QScriptValue& value, MeshProxyList &out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ModelScriptingInterface::meshToOBJ(MeshProxyList in) {
|
QString ModelScriptingInterface::meshToOBJ(MeshProxyList in) {
|
||||||
bool success;
|
|
||||||
QString filename = "/tmp/okokok.obj";
|
|
||||||
|
|
||||||
QList<MeshPointer> meshes;
|
QList<MeshPointer> meshes;
|
||||||
foreach (const MeshProxy* meshProxy, in) {
|
foreach (const MeshProxy* meshProxy, in) {
|
||||||
meshes.append(meshProxy->getMeshPointer());
|
meshes.append(meshProxy->getMeshPointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
success = writeOBJToFile(filename, meshes);
|
return writeOBJToString(meshes);
|
||||||
if (!success) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return filename;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue