summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llluamanager.cpp50
-rw-r--r--scripts/lua/demo.lua59
2 files changed, 85 insertions, 24 deletions
diff --git a/indra/newview/llluamanager.cpp b/indra/newview/llluamanager.cpp
index 2244fa32f6..61c0ecf1ed 100644
--- a/indra/newview/llluamanager.cpp
+++ b/indra/newview/llluamanager.cpp
@@ -654,16 +654,50 @@ lua_function(add_branch)
// 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);
+ 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
+ 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);
- LLVector3 obj_pos = gAgent.getPositionAgent() + LLVector3(x, y, -0.5);
+ LL_INFOS() << "Rezing a prim: type " << LLPrimitive::pCodeToString(type) << ", coordinates: " << obj_pos << " Success: " << res << LL_ENDL;
+
+ lua_pop(L, lua_gettop(L));
+ return 0;
+}
+
+// rez_prim2({x, y,z}, prim_type)
+// avatar is the reference point
+lua_function(rez_prim2)
+{
+ luaL_checktype(L, 1, LUA_TTABLE);
+ S32 type(lua_tonumber(L,2));
+ lua_pop(L,1);
+
+ lua_pushinteger(L, 1);
+ lua_gettable(L, -2);
+ F32 x = lua_tonumber(L,-1);
+ lua_pop(L,1);
+
+ lua_pushinteger(L, 2);
+ lua_gettable(L, -2);
+ F32 y = lua_tonumber(L,-1);
+ lua_pop(L,1);
+
+ lua_pushinteger(L, 3);
+ lua_gettable(L, -2);
+ F32 z = lua_tonumber(L,-1);
+ lua_pop(L,1);
+
+ LL_INFOS() << "x " << x << " y " << y << " z " << z << " type " << type << LL_ENDL;
+
+ LLVector3 obj_pos = gAgent.getPositionAgent() + LLVector3(x, y, z);
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;
diff --git a/scripts/lua/demo.lua b/scripts/lua/demo.lua
index dc2d9ef669..3442c18b0d 100644
--- a/scripts/lua/demo.lua
+++ b/scripts/lua/demo.lua
@@ -1,5 +1,5 @@
function popup_and_wait_ok(message)
- args = {{"MESSAGE", message}}
+ args = {MESSAGE=message}
notif_response = nil
show_notification("GenericAlertOK", args, "notif_response")
while not notif_response do
@@ -20,8 +20,31 @@ function demo_environment()
sleep(2)
end
+function demo_rez()
+ for x=-1,1,1 do
+ for y=-1,1,1 do
+ rez_prim2({x,y,-1},1)
+ end
+ end
+end
+
function demo_avatar()
popup_and_wait_ok("Change Avatar")
+
+ local dest = {10,10,0}
+ move_by(dest, "autopilot_response")
+ while not autopilot_response do
+ sleep(0.2)
+ end
+
+ local response = autopilot_response
+
+ if response == 1 then
+ sleep(1)
+ demo_rez()
+ sleep(2)
+ end
+
wear_by_name("Greg")
run_ui_command("Avatar.ResetSelfSkeletonAndAnimations")
sleep(8)
@@ -34,8 +57,7 @@ function demo_avatar()
run_ui_command("Self.ToggleSitStand")
sleep(2)
- run_ui_command("View.ZoomOut")
- run_ui_command("View.ZoomOut")
+ --run_ui_command("View.ZoomOut")
run_ui_command("EditShape")
sleep(6)
close_floater("appearance")
@@ -59,7 +81,7 @@ function demo_ui()
notif_response = nil
- args = {{"MESSAGE", "Customize the UI now?"}}
+ args = {MESSAGE="Customize the UI now?"}
show_notification("GenericAlertYesCancel", args, "notif_response")
while not notif_response do
sleep(0.2)
@@ -72,40 +94,45 @@ function demo_ui()
menu_name = "BuildTools"
add_menu_separator(menu_name)
- params = {{"name", "user_sit"}, {"label", "Sit!"},
- {"function", "Self.ToggleSitStand"}}
+ params = {name="user_sit",
+ label="Sit!"}
+ params["function"]="Self.ToggleSitStand"
add_menu_item(menu_name, params)
- params = {{"name", "user_midnight"}, {"label", "Set night"},
- {"function", "World.EnvSettings"}, {"parameter", "midnight"}}
+ params = {name="user_midnight",label="Set night",parameter="midnight"}
+ params["function"] = "World.EnvSettings"
add_menu_item(menu_name, params)
-- adding new custom menu
new_menu_name = "user_menu"
- params = {{"name", new_menu_name}, {"label", "My Secret Menu"}, {"tear_off", "true"}}
+ params = {name=new_menu_name,label="My Secret Menu",tear_off="true"}
add_menu(params)
-- adding new item to the new menu
- params = {{"name", "user_debug"}, {"label", "Console"},
- {"function", "Advanced.ToggleConsole"}, {"parameter", "debug"}}
+ params = {name="user_debug",label="Console",
+ parameter="debug"}
+ params["function"] = "Advanced.ToggleConsole"
add_menu_item(new_menu_name, params)
-- adding new branch
new_branch = "user_floaters"
- params = {{"name", new_branch}, {"label", "Open Floater"}, {"tear_off", "true"}}
+ params = {name=new_branch, label="Open Floater",tear_off="true"}
add_branch(new_menu_name, params)
-- adding items to the branch
- params = {{"name", "user_permissions"}, {"label", "Default permissions"},
- {"function", "Floater.ToggleOrBringToFront"}, {"parameter", "perms_default"}}
+ params = {name="user_permissions",label="Default permissions",
+ parameter="perms_default"}
+ params["function"] = "Floater.ToggleOrBringToFront"
+
add_menu_item(new_branch, params)
- params = {{"name", "user_beacons"}, {"label", "Beacons"},
- {"function", "Floater.ToggleOrBringToFront"}, {"parameter", "beacons"}}
+ params = {name="user_beacons",label="Beacons",
+ parameter="beacons"}
+ params["function"] = "Floater.ToggleOrBringToFront"
add_menu_item(new_branch, params)
sleep(5)