mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
add Q_PROPERTY macro for position QVariantMap
This commit is contained in:
parent
f3d6f1edd8
commit
b0783e4cce
2 changed files with 18 additions and 1 deletions
|
@ -51,6 +51,20 @@ AvatarData::~AvatarData() {
|
|||
delete _handData;
|
||||
}
|
||||
|
||||
void AvatarData::setPositionFromVariantMap(QVariantMap positionMap) {
|
||||
_position = glm::vec3(positionMap.value("x"), positionMap.value("y"), positionMap.value("z"));
|
||||
}
|
||||
|
||||
QVariantMap AvatarData::getPositionVariantMap() {
|
||||
QVariantMap positionMap;
|
||||
|
||||
positionMap.insert("x", _position.x);
|
||||
positionMap.insert("y", _position.y);
|
||||
positionMap.insert("z", _position.z);
|
||||
|
||||
return positionMap;
|
||||
}
|
||||
|
||||
void AvatarData::sendData() {
|
||||
|
||||
// called from Agent visual loop to send data
|
||||
|
|
|
@ -43,6 +43,7 @@ class JointData;
|
|||
class AvatarData : public NodeData {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QVariantMap position READ getPositionVariantMap WRITE setPositionFromVariantMap)
|
||||
Q_PROPERTY(float bodyYaw READ getBodyYaw WRITE setBodyYaw)
|
||||
Q_PROPERTY(float bodyPitch READ getBodyPitch WRITE setBodyPitch)
|
||||
Q_PROPERTY(float bodyRoll READ getBodyRoll WRITE setBodyRoll)
|
||||
|
@ -56,6 +57,9 @@ public:
|
|||
void setPosition (const glm::vec3 position ) { _position = position; }
|
||||
void setHandPosition (const glm::vec3 handPosition ) { _handPosition = handPosition; }
|
||||
|
||||
void setPositionFromVariantMap(QVariantMap positionMap);
|
||||
QVariantMap getPositionVariantMap();
|
||||
|
||||
int getBroadcastData(unsigned char* destinationBuffer);
|
||||
int parseData(unsigned char* sourceBuffer, int numBytes);
|
||||
|
||||
|
@ -115,7 +119,6 @@ public:
|
|||
void setHandData(HandData* handData) { _handData = handData; }
|
||||
|
||||
public slots:
|
||||
void setPosition(float x, float y, float z) { _position = glm::vec3(x, y, z); }
|
||||
void setHandPosition(float x, float y, float z) { _position = glm::vec3(x, y, z); }
|
||||
void sendData();
|
||||
|
||||
|
|
Loading…
Reference in a new issue