Permalink
Browse files

Feature Request: Option to focus on avatar from instant message with …

…them

Will be in the dropdown in IM at the bottom, only if they're in the sim...
Actually, this feature works pretty well as an in-sim indicator (if it works as intended!)
  • Loading branch information...
Lirusaito committed May 2, 2016
1 parent a8062d7 commit e50899dc68789ac29c2a71301c1d55e54b78f047
@@ -35,6 +35,7 @@
#include "ascentkeyword.h"
#include "llagent.h"
+#include "llagentcamera.h"
#include "llautoreplace.h"
#include "llavataractions.h"
#include "llavatarnamecache.h"
@@ -523,6 +524,8 @@ BOOL LLFloaterIMPanel::postBuild()
if (is_agent_mappable(mOtherParticipantUUID))
flyout->add(getString("find on map"), -2);
addDynamics(flyout);
+ if (gObjectList.findAvatar(mOtherParticipantUUID))
+ flyout->add(getString("focus"), -3);
}
if (LLUICtrl* ctrl = findChild<LLUICtrl>("tp_btn"))
ctrl->setCommitCallback(boost::bind(static_cast<void(*)(const LLUUID&)>(LLAvatarActions::offerTeleport), mOtherParticipantUUID));
@@ -991,6 +994,16 @@ void LLFloaterIMPanel::addDynamics(LLComboBox* flyout)
flyout->add(LLAvatarActions::isBlocked(mOtherParticipantUUID) ? getString("unmute") : getString("mute"), 9);
}
+void LLFloaterIMPanel::addDynamicFocus()
+{
+ findChild<LLComboBox>("instant_message_flyout")->add(getString("focus"), -3);
+}
+
+void LLFloaterIMPanel::removeDynamicFocus()
+{
+ findChild<LLComboBox>("instant_message_flyout")->remove(getString("focus"));
+}
+
void copy_profile_uri(const LLUUID& id, bool group = false);
void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value)
@@ -1009,8 +1022,10 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value)
else if (option == 5) LLAvatarActions::inviteToGroup(mOtherParticipantUUID);
else if (option == -1) copy_profile_uri(mOtherParticipantUUID);
else if (option == -2) LLAvatarActions::showOnMap(mOtherParticipantUUID);
+ else if (option == -3) gAgentCamera.lookAtObject(mOtherParticipantUUID);
else if (option >= 6) // Options that use dynamic items
{
+
// First remove them all
removeDynamics(flyout);
@@ -1022,6 +1037,10 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value)
// Last add them back
addDynamics(flyout);
+ // Always have Focus last
+ const std::string focus(getString("focus"));
+ if (flyout->remove(focus)) // If present, reorder to bottom.
+ flyout->add(focus, -3);
}
}
@@ -141,6 +141,11 @@ class LLFloaterIMPanel : public LLFloater, public LLFriendObserver, public LLMut
bool getSessionInitialized() const { return mSessionInitialized; }
bool mStartCallOnInitialize;
+protected:
+ friend class LLViewerObjectList;
+ void addDynamicFocus();
+ void removeDynamicFocus();
+
private:
// Called by UI methods.
void onSendMsg();
@@ -101,6 +101,15 @@ class AIHTTPTimeoutPolicy;
extern AIHTTPTimeoutPolicy objectCostResponder_timeout;
extern AIHTTPTimeoutPolicy physicsFlagsResponder_timeout;
+// <singu>
+#include "llimpanel.h"
+#include "llimview.h"
+LLFloaterIMPanel* find_im_floater(const LLUUID& id)
+{
+ return gIMMgr->findFloaterBySession(id ^ gAgentID);
+}
+// </singu>
+
#define CULL_VIS
//#define ORPHAN_SPAM
//#define IGNORE_DEAD
@@ -1256,7 +1265,11 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)
// Remove from object map so noone can look it up.
mUUIDObjectMap.erase(objectp->mID);
- mUUIDAvatarMap.erase(objectp->mID);//No need to be careful here.
+ // <singu> Use the return value (number of erased elements) to determine if we were an avatar.
+ if (mUUIDAvatarMap.erase(objectp->mID)) //No need to be careful here.
+ if (LLFloaterIMPanel* im = find_im_floater(objectp->mID))
+ im->removeDynamicFocus();
+ // </singu>
//if (objectp->getRegion())
//{
@@ -1978,7 +1991,13 @@ LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLVi
{
LLVOAvatar *pAvatar = dynamic_cast<LLVOAvatar*>(objectp);
if(pAvatar)
+ {
mUUIDAvatarMap[fullid] = pAvatar;
+ // <singu>
+ if (LLFloaterIMPanel* im = find_im_floater(fullid))
+ im->addDynamicFocus();
+ // </singu>
+ }
}
mObjects.push_back(objectp);
@@ -2018,7 +2037,13 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe
{
LLVOAvatar *pAvatar = dynamic_cast<LLVOAvatar*>(objectp);
if(pAvatar)
+ {
mUUIDAvatarMap[fullid] = pAvatar;
+ // <singu>
+ if (LLFloaterIMPanel* im = find_im_floater(fullid))
+ im->addDynamicFocus();
+ // </singu>
+ }
}
setUUIDAndLocal(fullid,
local_id,
@@ -25,6 +25,7 @@
<string name="remove friend" value="Remove Friend"/>
<string name="mute" value="Mute"/>
<string name="unmute" value="Unmute"/>
+ <string name="focus" value="Focus"/>
<button bottom_delta="0" follows="left|top" height="20" left_delta="81" width="50" name="tp_btn" label="TP"/>
<button bottom_delta="0" follows="left|top" height="20" left_delta="50" width="50" name="pay_btn" label="Pay"/>
<button bottom_delta="0" follows="left|top" height="20" left_delta="50" width="50" name="history_btn" label="Log"/>
@@ -29,6 +29,7 @@
<string name="remove friend" value="Remove Friend"/>
<string name="mute" value="Mute"/>
<string name="unmute" value="Unmute"/>
+ <string name="focus" value="Focus"/>
<button bottom="-20" follows="right|top" height="20" image_overlay="icn_voice-call-start.tga" image_overlay_alignment="left" label="Call" left_delta="81" name="start_call_btn" width="60"/>
<button bottom="-20" follows="right|top" height="20" image_overlay="icn_voice-call-end.tga" image_overlay_alignment="left" scale_image="true" label="End" name="end_call_btn" width="24"/>
<panel mouse_opaque="false" border="false" bottom="-20" follows="right|top" height="20" left_delta="16" name="speaker_controls" width="60">

0 comments on commit e50899d

Please sign in to comment.