diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2011-02-21 11:58:57 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2011-02-21 11:58:57 -0500 |
commit | 25d754c26b8ee749b805d5fa0d1b0d7971756a4b (patch) | |
tree | ed94e12b14c303d2b4b7ec67dbc2429851b5e714 /indra | |
parent | 96cac7c82fcb189a61d514a244b62970e943e4ad (diff) | |
parent | 18bf5f09b22a2c36ccf543104b1115a7b0b9db71 (diff) |
Automated merge with ssh://hg.lindenlab.com/josh/vea2-uiauto
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llagentlistener.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llagentlistener.h | 2 |
2 files changed, 38 insertions, 0 deletions
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index d520debc31..c453fe91f4 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -37,6 +37,8 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" +#include "llsdutil.h" +#include "llsdutil_math.h" LLAgentListener::LLAgentListener(LLAgent &agent) : LLEventAPI("LLAgent", @@ -53,6 +55,15 @@ LLAgentListener::LLAgentListener(LLAgent &agent) add("requestStand", "Ask to stand up", &LLAgentListener::requestStand); + add("resetAxes", + "Set the agent to a fixed orientation (optionally specify [\"lookat\"] = array of [x, y, z])", + &LLAgentListener::resetAxes); + add("getAxes", + "Send information about the agent's orientation on [\"reply\"]:\n" + "[\"euler\"]: map of {roll, pitch, yaw}\n" + "[\"quat\"]: array of [x, y, z, w] quaternion values", + &LLAgentListener::getAxes, + LLSDMap("reply", LLSD())); } void LLAgentListener::requestTeleport(LLSD const & event_data) const @@ -104,3 +115,28 @@ void LLAgentListener::requestStand(LLSD const & event_data) const mAgent.setControlFlags(AGENT_CONTROL_STAND_UP); } +void LLAgentListener::resetAxes(const LLSD& event) const +{ + if (event.has("lookat")) + { + mAgent.resetAxes(ll_vector3_from_sd(event["lookat"])); + } + else + { + // no "lookat", default call + mAgent.resetAxes(); + } +} + +void LLAgentListener::getAxes(const LLSD& event) const +{ + LLQuaternion quat(mAgent.getQuat()); + F32 roll, pitch, yaw; + quat.getEulerAngles(&roll, &pitch, &yaw); + // The official query API for LLQuaternion's [x, y, z, w] values is its + // public member mQ... + sendReply(LLSDMap + ("quat", llsd_copy_array(boost::begin(quat.mQ), boost::end(quat.mQ))) + ("euler", LLSDMap("roll", roll)("pitch", pitch)("yaw", yaw)), + event); +} diff --git a/indra/newview/llagentlistener.h b/indra/newview/llagentlistener.h index 9b585152f4..0aa58d0b16 100644 --- a/indra/newview/llagentlistener.h +++ b/indra/newview/llagentlistener.h @@ -44,6 +44,8 @@ private: void requestTeleport(LLSD const & event_data) const; void requestSit(LLSD const & event_data) const; void requestStand(LLSD const & event_data) const; + void resetAxes(const LLSD& event) const; + void getAxes(const LLSD& event) const; private: LLAgent & mAgent; |