summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-11-14 11:19:33 -0800
committerRider Linden <rider@lindenlab.com>2018-11-14 11:19:33 -0800
commit1d022e86c84039f88c531e91ce857666acd224a1 (patch)
tree9a8ba45529cb125a2ae5cd4672b3fd093af9b45c /scripts
parent18eb4b497fd890118e7da78dcc2eda4bd84c4ede (diff)
parent34770cbf2ef34b7901552057a0823e502d42be1d (diff)
Merge
Diffstat (limited to 'scripts')
-rw-r--r--scripts/content_tools/anim_tool.py17
-rwxr-xr-xscripts/messages/message_template.msg26
-rwxr-xr-xscripts/messages/message_template.msg.sha12
-rw-r--r--scripts/testing/lsl/axon_test_region_driver.lsl54
-rw-r--r--scripts/testing/lsl/cycle_object_animations.lsl118
-rw-r--r--scripts/testing/lsl/cycle_object_animations_v2.lsl133
-rw-r--r--scripts/testing/lsl/move_in_circle_using_llSetRegionPos.lsl90
7 files changed, 435 insertions, 5 deletions
diff --git a/scripts/content_tools/anim_tool.py b/scripts/content_tools/anim_tool.py
index 3496617b21..3aef8cd5ab 100644
--- a/scripts/content_tools/anim_tool.py
+++ b/scripts/content_tools/anim_tool.py
@@ -610,12 +610,16 @@ def main(*argv):
parser = argparse.ArgumentParser(description="process SL animations")
parser.add_argument("--verbose", help="verbose flag", action="store_true")
- parser.add_argument("--dump", metavar="FILEPATH", help="dump to specified file")
+ parser.add_argument("--dump", help="dump to stdout", action="store_true")
parser.add_argument("--rot", help="specify sequence of rotations", type=float_triple, nargs="+")
parser.add_argument("--rand_pos", help="request NUM random positions (default %(default)s)",
metavar="NUM", type=int, default=2)
parser.add_argument("--reset_pos", help="request original positions", action="store_true")
parser.add_argument("--pos", help="specify sequence of positions", type=float_triple, nargs="+")
+ parser.add_argument("--duration", help="specify duration", type=float)
+ parser.add_argument("--loop_in", help="specify loop in time", type=float)
+ parser.add_argument("--loop_out", help="specify loop out time", type=float)
+ parser.add_argument("--num_pos", help="number of positions to create", type=int, default=2)
parser.add_argument("--delete_joints", help="specify joints to be deleted", nargs="+",
metavar="JOINT")
parser.add_argument("--joints", help="specify joints to be added or modified", nargs="+",
@@ -696,8 +700,17 @@ def main(*argv):
print "set joint priority",args.joint_priority
for joint in anim.joints:
joint.joint_priority = args.joint_priority
+ if args.duration is not None:
+ print "set duration",args.duration
+ anim.duration = args.duration
+ if args.loop_in is not None:
+ print "set loop_in",args.loop_in
+ anim.loop_in_point = args.loop_in
+ if args.loop_out is not None:
+ print "set loop_out",args.loop_out
+ anim.loop_out_point = args.loop_out
if args.dump:
- anim.dump(args.dump)
+ anim.dump("-")
if args.summary:
anim.summary()
if args.outfilename:
diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg
index 01397181e4..ed32804bef 100755
--- a/scripts/messages/message_template.msg
+++ b/scripts/messages/message_template.msg
@@ -8,7 +8,7 @@ version 2.0
// for each type is listed below:
// Low: 423
// Medium: 18
-// High: 29
+// High: 30
// PLEASE UPDATE THIS WHEN YOU ADD A NEW MESSAGE!
@@ -3571,7 +3571,6 @@ version 2.0
}
}
-
// AvatarAppearance - Update visual params
{
AvatarAppearance Low 158 Trusted Zerocoded
@@ -7291,6 +7290,29 @@ version 2.0
// *************************************************************************
+// Object animation messages
+// *************************************************************************
+
+// Note this is basically identical to AvatarAnimation.
+// Needs to be a different message because existing viewers
+// have insufficiently smart handler functions.
+
+// ObjectAnimation - Update animation state
+// simulator --> viewer
+{
+ ObjectAnimation High 30 Trusted Unencoded
+ {
+ Sender Single
+ { ID LLUUID }
+ }
+ {
+ AnimationList Variable
+ { AnimID LLUUID }
+ { AnimSequenceID S32 }
+ }
+}
+
+// *************************************************************************
// Asset storage messages
// *************************************************************************
diff --git a/scripts/messages/message_template.msg.sha1 b/scripts/messages/message_template.msg.sha1
index ae8937f461..db87ad5e77 100755
--- a/scripts/messages/message_template.msg.sha1
+++ b/scripts/messages/message_template.msg.sha1
@@ -1 +1 @@
-4c5ec7187d1af05b52b5c1bbac68d46fbc65da05 \ No newline at end of file
+55df2c7135733c5da64ef8f01859b83a433a3a09 \ No newline at end of file
diff --git a/scripts/testing/lsl/axon_test_region_driver.lsl b/scripts/testing/lsl/axon_test_region_driver.lsl
new file mode 100644
index 0000000000..dcf146a9cf
--- /dev/null
+++ b/scripts/testing/lsl/axon_test_region_driver.lsl
@@ -0,0 +1,54 @@
+list buttons = ["anim start", "anim stop", "step", "verbose on", "verbose off", " "];
+string dialogInfo = "\nPlease make a choice.";
+
+key ToucherID;
+integer dialogChannel;
+integer listenHandle;
+integer commandChannel;
+
+default
+{
+ state_entry()
+ {
+ dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
+ commandChannel = -2001;
+ }
+
+ touch_start(integer num_detected)
+ {
+ ToucherID = llDetectedKey(0);
+ llListenRemove(listenHandle);
+ listenHandle = llListen(dialogChannel, "", ToucherID, "");
+ llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
+ //llSetTimerEvent(60.0); // Here we set a time limit for responses
+ }
+
+ listen(integer channel, string name, key id, string message)
+ {
+ if (message == "-")
+ {
+ llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
+ return;
+ }
+
+ llListenRemove(listenHandle);
+ // stop timer since the menu was clicked
+ llSetTimerEvent(0);
+
+ //llOwnerSay("Sending message " + message + " on channel " + (string)commandChannel);
+ llRegionSay(commandChannel, message);
+ }
+
+ timer()
+ {
+ // stop timer
+ llSetTimerEvent(0);
+
+ llListenRemove(listenHandle);
+ //llWhisper(0, "Sorry. You snooze; you lose.");
+ }
+}
+
+// Local Variables:
+// shadow-file-name: "$SW_HOME/axon/scripts/testing/lsl/axon_test_region_driver.lsl"
+// End:
diff --git a/scripts/testing/lsl/cycle_object_animations.lsl b/scripts/testing/lsl/cycle_object_animations.lsl
new file mode 100644
index 0000000000..46910e3656
--- /dev/null
+++ b/scripts/testing/lsl/cycle_object_animations.lsl
@@ -0,0 +1,118 @@
+integer listenHandle;
+integer verbose;
+integer current_animation_number;
+string NowPlaying;
+
+say_if_verbose(integer channel, string message)
+{
+ if (verbose)
+ {
+ llSay(channel, message);
+ }
+}
+
+stop_all_animations()
+{
+ integer count = llGetInventoryNumber(INVENTORY_ANIMATION);
+ string ItemName;
+ string NowPlaying;
+ while (count--)
+ {
+ ItemName = llGetInventoryName(INVENTORY_ANIMATION, count);
+ say_if_verbose(0, "Stopping " + ItemName);
+ llStopObjectAnimation(ItemName);
+ }
+}
+
+start_cycle_animations()
+{
+ current_animation_number = llGetInventoryNumber(INVENTORY_ANIMATION);
+ next_animation(); // Do first iteration without waiting for timer
+ llSetTimerEvent(5.0);
+}
+
+next_animation()
+{
+ string ItemName;
+ if (NowPlaying != "")
+ {
+ say_if_verbose(0, "Stopping " + NowPlaying);
+ llStopObjectAnimation(NowPlaying);
+ }
+ if (current_animation_number--)
+ {
+ ItemName = llGetInventoryName(INVENTORY_ANIMATION, current_animation_number);
+ say_if_verbose(0, "Starting " + ItemName);
+ llStartObjectAnimation(ItemName);
+ NowPlaying = ItemName;
+ }
+ else
+ {
+ // Start again at the top
+ current_animation_number = llGetInventoryNumber(INVENTORY_ANIMATION);
+ }
+}
+
+stop_cycle_animations()
+{
+ llSetTimerEvent(0);
+}
+
+default
+{
+ state_entry()
+ {
+ say_if_verbose(0, "Animated Object here");
+ listenHandle = llListen(-2001,"","","");
+ verbose = 0;
+
+ stop_all_animations();
+ }
+
+ listen(integer channel, string name, key id, string message)
+ {
+ //llOwnerSay("got message " + name + " " + (string) id + " " + message);
+ list words = llParseString2List(message,[" "],[]);
+ string command = llList2String(words,0);
+ string option = llList2String(words,1);
+ if (command=="anim")
+ {
+ stop_all_animations();
+ if (option=="start")
+ {
+ start_cycle_animations();
+ }
+ else if (option=="stop")
+ {
+ stop_cycle_animations();
+ }
+ }
+ if (command=="verbose")
+ {
+ if (option=="on")
+ {
+ verbose = 1;
+ }
+ else if (option=="off")
+ {
+ verbose = 0;
+ }
+ }
+ }
+
+ timer()
+ {
+ say_if_verbose(0, "timer triggered");
+ next_animation();
+ }
+
+ touch_start(integer total_number)
+ {
+ say_if_verbose(0, "Touch started.");
+ start_cycle_animations();
+ }
+}
+
+// Local Variables:
+// shadow-file-name: "$SW_HOME/axon/scripts/testing/lsl/cycle_object_animations.lsl"
+// End:
diff --git a/scripts/testing/lsl/cycle_object_animations_v2.lsl b/scripts/testing/lsl/cycle_object_animations_v2.lsl
new file mode 100644
index 0000000000..60879fcce2
--- /dev/null
+++ b/scripts/testing/lsl/cycle_object_animations_v2.lsl
@@ -0,0 +1,133 @@
+integer listenHandle;
+integer verbose;
+integer current_animation_number;
+string NowPlaying;
+
+say_if_verbose(integer channel, string message)
+{
+ if (verbose)
+ {
+ llSay(channel, message);
+ }
+}
+
+stop_all_animations()
+{
+ list curr_anims = llGetObjectAnimationNames();
+ say_if_verbose(0,"stopping all, curr_anims are " + (string) curr_anims);
+ integer length = llGetListLength(curr_anims);
+ integer index = 0;
+ while (index < length)
+ {
+ string anim = llList2String(curr_anims, index);
+ say_if_verbose(0, "Stopping " + anim);
+ llStopObjectAnimation(anim);
+ // This check isn't really needed, just included to demonstrate is_animation_running()
+ if (is_animation_running(anim))
+ {
+ say_if_verbose(0, "ERROR - failed to stop " + anim + "!");
+ }
+ ++index;
+ }
+}
+
+integer is_animation_running(string anim)
+{
+ list curr_anims = llGetObjectAnimationNames();
+ return ~llListFindList(curr_anims, (list)anim);
+}
+
+start_cycle_animations()
+{
+ current_animation_number = llGetInventoryNumber(INVENTORY_ANIMATION);
+ next_animation(); // Do first iteration without waiting for timer
+ llSetTimerEvent(5.0);
+}
+
+next_animation()
+{
+ string ItemName;
+ if (NowPlaying != "")
+ {
+ say_if_verbose(0, "Stopping " + NowPlaying);
+ llStopObjectAnimation(NowPlaying);
+ }
+ if (current_animation_number--)
+ {
+ ItemName = llGetInventoryName(INVENTORY_ANIMATION, current_animation_number);
+ say_if_verbose(0, "Starting " + ItemName);
+ llStartObjectAnimation(ItemName);
+ key anim_id = llGetInventoryKey(ItemName);
+ say_if_verbose(0, "Started item " + ItemName + " inv key " + (string) anim_id);
+ NowPlaying = ItemName;
+ }
+ else
+ {
+ // Start again at the top
+ current_animation_number = llGetInventoryNumber(INVENTORY_ANIMATION);
+ }
+}
+
+stop_cycle_animations()
+{
+ llSetTimerEvent(0);
+}
+
+default
+{
+ state_entry()
+ {
+ say_if_verbose(0, "Animated Object here");
+ listenHandle = llListen(-2001,"","","");
+ verbose = 0;
+
+ stop_all_animations();
+ }
+
+ listen(integer channel, string name, key id, string message)
+ {
+ //llOwnerSay("got message " + name + " " + (string) id + " " + message);
+ list words = llParseString2List(message,[" "],[]);
+ string command = llList2String(words,0);
+ string option = llList2String(words,1);
+ if (command=="anim")
+ {
+ stop_all_animations();
+ if (option=="start")
+ {
+ start_cycle_animations();
+ }
+ else if (option=="stop")
+ {
+ stop_cycle_animations();
+ }
+ }
+ if (command=="verbose")
+ {
+ if (option=="on")
+ {
+ verbose = 1;
+ }
+ else if (option=="off")
+ {
+ verbose = 0;
+ }
+ }
+ }
+
+ timer()
+ {
+ say_if_verbose(0, "timer triggered");
+ next_animation();
+ }
+
+ touch_start(integer total_number)
+ {
+ say_if_verbose(0, "Touch started.");
+ start_cycle_animations();
+ }
+}
+
+// Local Variables:
+// shadow-file-name: "$SW_HOME/axon/scripts/testing/lsl/cycle_object_animations_v2.lsl"
+// End:
diff --git a/scripts/testing/lsl/move_in_circle_using_llSetRegionPos.lsl b/scripts/testing/lsl/move_in_circle_using_llSetRegionPos.lsl
new file mode 100644
index 0000000000..cc5b899b67
--- /dev/null
+++ b/scripts/testing/lsl/move_in_circle_using_llSetRegionPos.lsl
@@ -0,0 +1,90 @@
+integer listenHandle;
+integer verbose;
+integer num_steps = 12;
+float circle_time = 5.0;
+integer circle_step;
+vector circle_pos;
+vector circle_center;
+float circle_radius;
+
+start_circle(vector center, float radius)
+{
+ vector currentPosition = llGetPos();
+ circle_center = center;
+ circle_radius = radius;
+ circle_step = 0;
+ llSetTimerEvent(circle_time/num_steps);
+ llTargetOmega(<0.0, 0.0, 1.0>, TWO_PI/circle_time, 1.0);
+}
+
+stop_circle()
+{
+ llSetTimerEvent(0);
+ llTargetOmega(<0.0, 0.0, 1.0>, TWO_PI/circle_time, 0.0);
+ llSetRegionPos(circle_center);
+}
+
+next_circle()
+{
+ float rad = (circle_step * TWO_PI)/num_steps;
+ float x = circle_center.x + llCos(rad)*circle_radius;
+ float y = circle_center.y + llSin(rad)*circle_radius;
+ float z = circle_center.z;
+ llSetRegionPos(<x,y,z>);
+ circle_step = (circle_step+1)%num_steps;
+}
+
+default
+{
+ state_entry()
+ {
+ //llSay(0, "Hello, Avatar!");
+ listenHandle = llListen(-2001,"","","");
+ verbose = 0;
+ circle_center = llGetPos();
+ }
+
+ listen(integer channel, string name, key id, string message)
+ {
+ //llOwnerSay("got message " + name + " " + (string) id + " " + message);
+ list words = llParseString2List(message,[" "],[]);
+ string command = llList2String(words,0);
+ string option = llList2String(words,1);
+ if (command=="anim")
+ {
+ if (option=="start")
+ {
+ start_circle(llGetPos(), 3.0);
+ }
+ else if (option=="stop")
+ {
+ stop_circle();
+ }
+ }
+ if (command=="verbose")
+ {
+ if (option=="on")
+ {
+ verbose = 1;
+ }
+ else if (option=="off")
+ {
+ verbose = 0;
+ }
+ }
+ if (command=="step")
+ {
+ llSetTimerEvent(0);
+ next_circle();
+ }
+ }
+
+ timer()
+ {
+ next_circle();
+ }
+}
+
+// Local Variables:
+// shadow-file-name: "$SW_HOME/axon/scripts/testing/lsl/move_in_circle_using_llSetRegionPos.lsl"
+// End: