summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-10-16 23:34:25 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-10-16 23:34:25 +0300
commit3ed29a74f734a2b790814970df71a83c6cb47303 (patch)
treebe1423a9e883bb1153764c44258171a29ff6a0e0
parent64ecc38c841ae0cb0c3d0ccb9b1bf543ecf4230e (diff)
Add a response with result when taking snapshot; and other clean up
-rw-r--r--indra/newview/llagentlistener.cpp14
-rw-r--r--indra/newview/llfloaterluadebug.cpp2
-rw-r--r--indra/newview/llviewerwindowlistener.cpp15
-rw-r--r--indra/newview/scripts/lua/require/LLAgent.lua6
-rw-r--r--indra/newview/scripts/lua/require/UI.lua2
-rw-r--r--indra/newview/scripts/lua/test_LLChatListener.lua4
6 files changed, 23 insertions, 20 deletions
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index 9255a850e5..6c539ade9b 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -189,14 +189,14 @@ LLAgentListener::LLAgentListener(LLAgent &agent)
add("getNearbyAvatarsList",
"Return result set key [\"result\"] for nearby avatars in a range of [\"dist\"]\n"
"if [\"dist\"] is not specified, 'RenderFarClip' setting is used\n"
- "reply contains \"result\" table with \"id\", \"name\", \"global_pos\", \"region_pos\" fields",
+ "reply contains \"result\" table with \"id\", \"name\", \"global_pos\", \"region_pos\", \"region_id\" fields",
&LLAgentListener::getNearbyAvatarsList,
llsd::map("reply", LLSD()));
add("getNearbyObjectsList",
"Return result set key [\"result\"] for nearby objects in a range of [\"dist\"]\n"
"if [\"dist\"] is not specified, 'RenderFarClip' setting is used\n"
- "reply contains \"result\" table with \"id\", \"global_pos\", \"region_pos\" fields",
+ "reply contains \"result\" table with \"id\", \"global_pos\", \"region_pos\", \"region_id\" fields",
&LLAgentListener::getNearbyObjectsList,
llsd::map("reply", LLSD()));
@@ -732,7 +732,7 @@ void LLAgentListener::getID(LLSD const& event_data)
struct AvResultSet : public LL::ResultSet
{
AvResultSet() : LL::ResultSet("nearby_avatars") {}
- std::vector<LLCharacter*> mAvatars;
+ std::vector<LLVOAvatar*> mAvatars;
int getLength() const override { return narrow(mAvatars.size()); }
LLSD getSingle(int index) const override
@@ -744,7 +744,8 @@ struct AvResultSet : public LL::ResultSet
return llsd::map("id", av->getID(),
"global_pos", ll_sd_from_vector3d(av->getPosGlobalFromAgent(region_pos)),
"region_pos", ll_sd_from_vector3(region_pos),
- "name", av_name.getUserName());
+ "name", av_name.getUserName(),
+ "region_id", av->getRegion()->getRegionID());
}
};
@@ -759,7 +760,8 @@ struct ObjResultSet : public LL::ResultSet
auto obj = mObjects[index];
return llsd::map("id", obj->getID(),
"global_pos", ll_sd_from_vector3d(obj->getPositionGlobal()),
- "region_pos", ll_sd_from_vector3(obj->getPositionRegion()));
+ "region_pos", ll_sd_from_vector3(obj->getPositionRegion()),
+ "region_id", obj->getRegion()->getRegionID());
}
};
@@ -822,7 +824,7 @@ void LLAgentListener::getAgentScreenPos(LLSD const& event_data)
{
Response response(LLSD(), event_data);
LLVector3 render_pos;
- if (event_data.has("avatar_id"))
+ if (event_data.has("avatar_id") && (event_data["avatar_id"] != gAgentID))
{
LLUUID avatar_id(event_data["avatar_id"]);
for (LLCharacter* character : LLCharacter::sInstances)
diff --git a/indra/newview/llfloaterluadebug.cpp b/indra/newview/llfloaterluadebug.cpp
index f7f3b8d588..7a7824c7e6 100644
--- a/indra/newview/llfloaterluadebug.cpp
+++ b/indra/newview/llfloaterluadebug.cpp
@@ -60,7 +60,7 @@ bool LLFloaterLUADebug::postBuild()
{
LLCachedControl<bool> show_source_info(gSavedSettings, "LuaDebugShowSource", false);
std::string source_info = show_source_info ? data["source_info"].asString() : "";
- mResultOutput->pasteTextWithLinebreaks(data["level"].asString() + source_info + data["msg"].asString());
+ mResultOutput->pasteTextWithLinebreaks(stringize(data["level"].asString(), source_info, data["msg"].asString()));
mResultOutput->addLineBreakChar(true);
return false;
});
diff --git a/indra/newview/llviewerwindowlistener.cpp b/indra/newview/llviewerwindowlistener.cpp
index 6ce5e68642..45b4da0aac 100644
--- a/indra/newview/llviewerwindowlistener.cpp
+++ b/indra/newview/llviewerwindowlistener.cpp
@@ -57,8 +57,6 @@ LLViewerWindowListener::LLViewerWindowListener(LLViewerWindow* llviewerwindow):
void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
{
- Response response(LLSD(), event);
-
typedef std::map<LLSD::String, LLSnapshotModel::ESnapshotLayerType> TypeMap;
TypeMap types;
#define tp(name) types[#name] = LLSnapshotModel::SNAPSHOT_TYPE_##name
@@ -88,7 +86,8 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
TypeMap::const_iterator found = types.find(event["type"]);
if (found == types.end())
{
- return response.error(stringize("Unrecognized type ", std::quoted(event["type"].asString()), " [\"COLOR\"] or [\"DEPTH\"] is expected."));
+ sendReply(llsd::map("error", stringize("Unrecognized type ", std::quoted(event["type"].asString()), " [\"COLOR\"] or [\"DEPTH\"] is expected.")), event);
+ return;
}
type = found->second;
}
@@ -96,7 +95,8 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
std::string filename(event["filename"]);
if (filename.empty())
{
- return response.error(stringize("File path is empty."));
+ sendReply(llsd::map("error", stringize("File path is empty.")), event);
+ return;
}
LLSnapshotModel::ESnapshotFormat format(LLSnapshotModel::SNAPSHOT_FORMAT_BMP);
@@ -115,11 +115,12 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
}
else if (ext != "bmp")
{
- return response.error(stringize("Unrecognized format. [\"png\"], [\"jpeg\"] or [\"bmp\"] is expected."));
+ sendReply(llsd::map("error", stringize("Unrecognized format. [\"png\"], [\"jpeg\"] or [\"bmp\"] is expected.")), event);
+ return;
}
// take snapshot on the main coro
- doOnIdleOneTime([this, filename, width, height, showui, showhud, rebuild, type, format]()
- { mViewerWindow->saveSnapshot(filename, width, height, showui, showhud, rebuild, type, format); });
+ doOnIdleOneTime([this, event, filename, width, height, showui, showhud, rebuild, type, format]()
+ { sendReply(llsd::map("result", mViewerWindow->saveSnapshot(filename, width, height, showui, showhud, rebuild, type, format)), event); });
}
diff --git a/indra/newview/scripts/lua/require/LLAgent.lua b/indra/newview/scripts/lua/require/LLAgent.lua
index b2be69dcdf..6068a916ed 100644
--- a/indra/newview/scripts/lua/require/LLAgent.lua
+++ b/indra/newview/scripts/lua/require/LLAgent.lua
@@ -116,7 +116,7 @@ end
-- Get the nearby avatars in a range of provided "dist",
-- if "dist" is not specified, "RenderFarClip" setting is used
-- reply will contain "result" table with following fields:
--- "id", "global_pos", "region_pos", "name"
+-- "id", "global_pos", "region_pos", "name", "region_id"
function LLAgent.getNearbyAvatarsList(...)
local args = mapargs('dist', ...)
args.op = 'getNearbyAvatarsList'
@@ -124,14 +124,14 @@ function LLAgent.getNearbyAvatarsList(...)
end
-- reply will contain "result" table with following fields:
--- "id", "global_pos", "region_pos"
+-- "id", "global_pos", "region_pos", "region_id"
function LLAgent.getNearbyObjectsList(...)
local args = mapargs('dist', ...)
args.op = 'getNearbyObjectsList'
return result(leap.request('LLAgent', args))
end
--- Get screen position of your own avatar or any other (if "avatar_id is specified)
+-- Get screen position of your own avatar or any other (if "avatar_id" is specified)
-- reply contains "x", "y" coordinates and "onscreen" flag to indicate if it's actually in within the current window
-- avatar render position is used as the point
function LLAgent.getAgentScreenPos(...)
diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua
index 86aa4095e0..34f3fb75eb 100644
--- a/indra/newview/scripts/lua/require/UI.lua
+++ b/indra/newview/scripts/lua/require/UI.lua
@@ -141,7 +141,7 @@ end
function UI.snapshot(...)
local args = mapargs('filename,width,height,showui,showhud,rebuild,type', ...)
args.op = 'saveSnapshot'
- return leap.request('LLViewerWindow', args)
+ return leap.request('LLViewerWindow', args).result
end
-- ***************************************************************************
diff --git a/indra/newview/scripts/lua/test_LLChatListener.lua b/indra/newview/scripts/lua/test_LLChatListener.lua
index 5679e9f98a..fa00b048b2 100644
--- a/indra/newview/scripts/lua/test_LLChatListener.lua
+++ b/indra/newview/scripts/lua/test_LLChatListener.lua
@@ -24,11 +24,11 @@ function openOrEcho(message)
end
local listener = LLListener(LLChat.nearbyChatPump)
-local ageint_id = LLAgent.getID()
+local agent_id = LLAgent.getID()
function listener:handleMessages(event_data)
-- ignore messages and commands from other avatars
- if event_data.from_id ~= ageint_id then
+ if event_data.from_id ~= agent_id then
return true
elseif string.find(event_data.message, '[LUA]') then
return true