Add some Quat and Uuid JavaScript helper properties

This commit is contained in:
David Rowe 2017-10-14 07:17:23 +13:00
parent 8a331e29a2
commit 949ed3b33d
2 changed files with 14 additions and 0 deletions

View file

@ -33,6 +33,7 @@
/// Scriptable interface a Quaternion helper class object. Used exclusively in the JavaScript API
class Quat : public QObject, protected QScriptable {
Q_OBJECT
Q_PROPERTY(glm::quat ZERO READ ZERO CONSTANT)
public slots:
glm::quat multiply(const glm::quat& q1, const glm::quat& q2);
@ -63,6 +64,10 @@ public slots:
bool equal(const glm::quat& q1, const glm::quat& q2);
glm::quat cancelOutRollAndPitch(const glm::quat& q);
glm::quat cancelOutRoll(const glm::quat& q);
private:
const glm::quat& ZERO() { return Quaternions::IDENTITY; }
};
#endif // hifi_Quat_h

View file

@ -20,6 +20,8 @@
/// Scriptable interface for a UUID helper class object. Used exclusively in the JavaScript API
class ScriptUUID : public QObject, protected QScriptable {
Q_OBJECT
Q_PROPERTY(QString NULL READ NULL_UUID CONSTANT) // String for use in scripts.
Q_PROPERTY(QString SELF READ SELF_UUID CONSTANT)
public slots:
QUuid fromString(const QString& string);
@ -28,6 +30,13 @@ public slots:
bool isEqual(const QUuid& idA, const QUuid& idB);
bool isNull(const QUuid& id);
void print(const QString& label, const QUuid& id);
private:
const QString NULL_UUID() { return NULL_ID; }
const QString SELF_UUID() { return SELF_ID; }
const QString NULL_ID{ "{00000000-0000-0000-0000-000000000000}" };
const QString SELF_ID{ AVATAR_SELF_ID.toString() };
};
#endif // hifi_ScriptUUID_h