Satisfy Issue 1916: Local Gesture Preview/Play

Adds a dropdown option to gesture preview button to preview locally.
Note that any chat commands in gestures will still work as they normally would!

Translators: do your thing or hold your peace. (floater_preview_gesture.xml)

These code changes will look nicer viewer without space changes~
This commit is contained in:
Inusaito Sayori
2015-05-14 23:55:20 -04:00
parent 8e05524027
commit 4e4dbd4012
8 changed files with 91 additions and 34 deletions

View File

@@ -667,3 +667,30 @@ void cmdline_printchat(const std::string& message)
LLFloaterChat::addChat(chat);
}
static void fake_local_chat(LLChat chat, const std::string& name)
{
chat.mFromName = name;
chat.mText = name + chat.mText;
LLFloaterChat::addChat(chat);
}
void fake_local_chat(std::string msg)
{
bool action(LLStringUtil::startsWith(msg, "/me") && (msg[3] == ' ' || msg[3] == '\''));
if (action) msg.erase(0, 4);
LLChat chat((action ? " " : ": ") + msg);
chat.mFromID = gAgentID;
chat.mSourceType = CHAT_SOURCE_SYSTEM;
if (rlv_handler_t::isEnabled()) chat.mRlvLocFiltered = chat.mRlvNamesFiltered = true;
chat.mPosAgent = gAgent.getPositionAgent();
chat.mURL = "secondlife:///app/agent/" + gAgentID.asString() + "/about";
if (action) chat.mChatStyle = CHAT_STYLE_IRC;
if (!LLAvatarNameCache::getNSName(gAgentID, chat.mFromName))
{
LLAvatarNameCache::get(gAgentID, boost::bind(fake_local_chat, chat, boost::bind(&LLAvatarName::getNSName, _2, main_name_system())));
}
else
{
chat.mText = chat.mFromName + chat.mText;
LLFloaterChat::addChat(chat);
}
}