History

change Model api in anticipation of more than just PolyVox being able to give meshes to javascript

Seth Alves committed 9 years ago

Commit ce9bb431 parent b5786be10 files · +52 −59Browse files

Showing the changes to libraries/script-engine/src/ModelScriptingInterface.cpp (1 of 10 files). Show all

Unified · Split

libraries/script-engine/src/ModelScriptingInterface.cpp+1−23
@@ -18,30 +18,8 @@ · 17 unmodified lines
1818
1919 ModelScriptingInterface::ModelScriptingInterface(QObject* parent) : QObject(parent) {
2020 _modelScriptEngine = qobject_cast<ScriptEngine*>(parent);
21−}
22−
23−QScriptValue meshToScriptValue(QScriptEngine* engine, MeshProxy* const &in) {
24− return engine->newQObject(in, QScriptEngine::QtOwnership,
25− QScriptEngine::ExcludeDeleteLater | QScriptEngine::ExcludeChildObjects);
26−}
27−
28−void meshFromScriptValue(const QScriptValue& value, MeshProxy* &out) {
29− out = qobject_cast<MeshProxy*>(value.toQObject());
30−}
31−
32−QScriptValue meshesToScriptValue(QScriptEngine* engine, const MeshProxyList &in) {
33− return engine->toScriptValue(in);
34−}
3521
36−void meshesFromScriptValue(const QScriptValue& value, MeshProxyList &out) {
37− QScriptValueIterator itr(value);
38− while(itr.hasNext()) {
39− itr.next();
40− MeshProxy* meshProxy = qscriptvalue_cast<MeshProxyList::value_type>(itr.value());
41− if (meshProxy) {
42− out.append(meshProxy);
43− }
44− }
22+ qScriptRegisterSequenceMetaType<QList<MeshProxy*>>(_modelScriptEngine);
4523 }
4624
4725 QString ModelScriptingInterface::meshToOBJ(MeshProxyList in) {