mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 11:29:50 +02:00
Add QMetaObject for AvatarEntityMap
This commit is contained in:
parent
de84e07281
commit
99e51e88ae
3 changed files with 26 additions and 0 deletions
|
@ -2309,3 +2309,22 @@ void RayToAvatarIntersectionResultFromScriptValue(const QScriptValue& object, Ra
|
||||||
vec3FromScriptValue(intersection, value.intersection);
|
vec3FromScriptValue(intersection, value.intersection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QScriptValue AvatarEntityMapToScriptValue(QScriptEngine* engine, const AvatarEntityMap& value) {
|
||||||
|
QScriptValue obj = engine->newObject();
|
||||||
|
for (auto entityID : value.keys()) {
|
||||||
|
QScriptValue EntityProperties = engine->newVariant(QVariant::fromValue(value.value(entityID)));
|
||||||
|
QString key = entityID.toString();
|
||||||
|
obj.setProperty(key, EntityProperties);
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvatarEntityMapFromScriptValue(const QScriptValue& object, AvatarEntityMap& value) {
|
||||||
|
QScriptValueIterator itr(object);
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
itr.next();
|
||||||
|
QUuid EntityID = QUuid(itr.name());
|
||||||
|
value[EntityID] = qvariant_cast<QByteArray>(itr.value().data().toVariant());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ typedef unsigned long long quint64;
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QtScript/QScriptable>
|
#include <QtScript/QScriptable>
|
||||||
|
#include <QtScript/QScriptValueIterator>
|
||||||
#include <QReadWriteLock>
|
#include <QReadWriteLock>
|
||||||
|
|
||||||
#include <JointData.h>
|
#include <JointData.h>
|
||||||
|
@ -816,6 +817,11 @@ Q_DECLARE_METATYPE(RayToAvatarIntersectionResult)
|
||||||
QScriptValue RayToAvatarIntersectionResultToScriptValue(QScriptEngine* engine, const RayToAvatarIntersectionResult& results);
|
QScriptValue RayToAvatarIntersectionResultToScriptValue(QScriptEngine* engine, const RayToAvatarIntersectionResult& results);
|
||||||
void RayToAvatarIntersectionResultFromScriptValue(const QScriptValue& object, RayToAvatarIntersectionResult& results);
|
void RayToAvatarIntersectionResultFromScriptValue(const QScriptValue& object, RayToAvatarIntersectionResult& results);
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(AvatarEntityMap)
|
||||||
|
|
||||||
|
QScriptValue AvatarEntityMapToScriptValue(QScriptEngine* engine, const AvatarEntityMap& value);
|
||||||
|
void AvatarEntityMapFromScriptValue(const QScriptValue& object, AvatarEntityMap& value);
|
||||||
|
|
||||||
// faux joint indexes (-1 means invalid)
|
// faux joint indexes (-1 means invalid)
|
||||||
const int SENSOR_TO_WORLD_MATRIX_INDEX = 65534; // -2
|
const int SENSOR_TO_WORLD_MATRIX_INDEX = 65534; // -2
|
||||||
const int CONTROLLER_RIGHTHAND_INDEX = 65533; // -3
|
const int CONTROLLER_RIGHTHAND_INDEX = 65533; // -3
|
||||||
|
|
|
@ -576,6 +576,7 @@ void ScriptEngine::init() {
|
||||||
qScriptRegisterMetaType(this, EntityItemIDtoScriptValue, EntityItemIDfromScriptValue);
|
qScriptRegisterMetaType(this, EntityItemIDtoScriptValue, EntityItemIDfromScriptValue);
|
||||||
qScriptRegisterMetaType(this, RayToEntityIntersectionResultToScriptValue, RayToEntityIntersectionResultFromScriptValue);
|
qScriptRegisterMetaType(this, RayToEntityIntersectionResultToScriptValue, RayToEntityIntersectionResultFromScriptValue);
|
||||||
qScriptRegisterMetaType(this, RayToAvatarIntersectionResultToScriptValue, RayToAvatarIntersectionResultFromScriptValue);
|
qScriptRegisterMetaType(this, RayToAvatarIntersectionResultToScriptValue, RayToAvatarIntersectionResultFromScriptValue);
|
||||||
|
qScriptRegisterMetaType(this, AvatarEntityMapToScriptValue, AvatarEntityMapFromScriptValue);
|
||||||
qScriptRegisterSequenceMetaType<QVector<QUuid>>(this);
|
qScriptRegisterSequenceMetaType<QVector<QUuid>>(this);
|
||||||
qScriptRegisterSequenceMetaType<QVector<EntityItemID>>(this);
|
qScriptRegisterSequenceMetaType<QVector<EntityItemID>>(this);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue