From 1564146fe801d9827cf21440058060a4a1c2cc63 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 28 Sep 2023 12:56:25 +0300 Subject: DRTVWR-589 - support for rezing prims --- indra/newview/llluamanager.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'indra/newview/llluamanager.cpp') diff --git a/indra/newview/llluamanager.cpp b/indra/newview/llluamanager.cpp index c1e111f0ac..bdf8fc0278 100644 --- a/indra/newview/llluamanager.cpp +++ b/indra/newview/llluamanager.cpp @@ -48,6 +48,7 @@ #include "llanimationstates.h" #include "llinventoryfunctions.h" #include "stringize.h" +#include "lltoolplacer.h" #include @@ -570,6 +571,28 @@ lua_function(add_branch) return 0; } +// rez_prim({x, y}, prim_type) +// avatar is the reference point +lua_function(rez_prim) +{ + lua_rawgeti(L, 1, 1); + F32 x = lua_tonumber(L, -1); + lua_pop(L, 1); + lua_rawgeti(L, 1, 2); + F32 y = lua_tonumber(L, -1); + lua_pop(L, 1); + + S32 type(lua_tonumber(L, 2)); // primitive shapes 1-8 + + LLVector3 obj_pos = gAgent.getPositionAgent() + LLVector3(x, y, -0.5); + bool res = LLToolPlacer::rezNewObject(type, NULL, 0, TRUE, gAgent.getPositionAgent(), obj_pos, gAgent.getRegion(), 0); + + LL_INFOS() << "Rezing a prim: type " << LLPrimitive::pCodeToString(type) << ", coordinates: " << obj_pos << " Success: " << res << LL_ENDL; + + lua_pop(L, lua_gettop(L)); + return 0; +} + lua_function(run_ui_command) { int top = lua_gettop(L); -- cgit v1.2.3