removed useless _ folders

This commit is contained in:
Fred Beckhusen
2015-08-09 16:54:31 -05:00
parent fde850293c
commit 948a44dfba
5204 changed files with 2425579 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
<Solution name="Prim_Animation_Compiler">
<Project name="Prim_Animation_Compiler" path="Prim_Animation_Compiler\Prim_Animation_Compiler.prj" active="true"/>
</Solution>

View File

@@ -0,0 +1,36 @@
// :SHOW:
// :CATEGORY:Prim
// :NAME:Prim_Animation_Compiler
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Animation, Puppeteer
// :CREATED:2013-02-25 10:47:09.853
// :EDITED:2015-08-07 14:27:52
// :ID:648
// :NUM:1821
// :REV:1.1
// :WORLD:Second Life, Opensim
// :DESCRIPTION:
// This script starts a timer each one second.
// Each second, it changes a -1 to a zero, or a zero to a -1. (x= ~x)
// So each second, this will be TRUE ( -1) or FALSE (0)
// It then sends a link message with the required Number 1 and an UP or a DOWN.
// :CODE:
integer x = -1; // this toggles between -1 and 0
default
{
state_entry()
{
llSetTimerEvent(1); // once a second
}
timer()
{
if (x = ~x)
llMessageLinked(LINK_SET,1,"UP","");
else
llMessageLinked(LINK_SET,1,"DOWN","");
}
}

View File

@@ -0,0 +1,32 @@
// :SHOW:
// :CATEGORY:Prim
// :NAME:Prim_Animation_Compiler
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Animation, Puppeteer
// :CREATED:2013-02-25 10:47:09.853
// :EDITED:2015-08-07 14:27:52
// :ID:648
// :NUM:880
// :REV:1.1
// :WORLD:Second Life, Opensim
// :DESCRIPTION:
// Simple trigger script example. Alternates playing animation named sit and wag when you touch a prim.
// It uses a different way to alternate the action than the Aternating Up and Down example
// It divides an ever-increasing number (flag++) by 2, ( flag++ % 2) and looks at the remainder (%). For example, 2/2 = 1 with 0 remaining, 3/2 = 1 with a remainder of 0.5.
// so this means it detects ODD or EVEN numbers, which occur ever other touch. Its dioes the same as (x = ~x) in a more general way. You could have it do this every fifth touch with (flag++ % 5), as another example.
// :CODE:
integer flag; // this increments forever,sort of, well, for all practical purposes.
default
{
touch_start(integer total_number)
{
if (flag++ %2 == 0)
{
llMessageLinked(LINK_SET,1,"wag",""); // wag tail
}
else
llMessageLinked(LINK_SET,1,"sit",""); // sit on rear
}
}

View File

@@ -0,0 +1,29 @@
// :CATEGORY:Prim
// :NAME:Prim_Animation_Compiler
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2014-07-15 10:23:29
// :EDITED:2014-07-15
// :ID:648
// :NUM:1618
// :REV:1.0
// :WORLD:Second Life
// :DESCRIPTION:
// simple owner-only chat to animator script.
// :CODE:
default
{
on_rez(integer param) {
llResetScript();
}
state_entry() {
llListen(0,"","","");
}
listen(integer channel, string name, key id, string message)
{
if (llGetOwner() == id)
llMessageLinked(LINK_SET,1,message,"");
}
}

View File

@@ -0,0 +1,212 @@
// :SHOW:
// :CATEGORY:Prim
// :NAME:Prim_Animation_Compiler
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Animation, Puppeteer
// :CREATED:2013-02-25 10:47:09.853
// :EDITED:2015-08-07 14:27:52
// :ID:648
// :NUM:879
// :REV:1.1
// :WORLD:Second Life, Opensim
// :DESCRIPTION:
// This script produces optimized LSL code that can be triggered by link messages.
// For more details on how this script works, see <a href="http://www.outworldz.com/secondlife/posts/prim-compiler/">http://www.outworldz.com/secondlife/posts/prim-compiler/</a>
// :CODE:
// fred@mitsi.com
// 3-7-2012
// Rev 1.1, added a missing } at the end of multiple recordings.
// Author: Ferd Frederix
// Based on an excellent script by Allen Firethorn
// This is free software, it is not for sale at any price. Yu can use it and sell the object.
// Tunable stuff:
integer OpenSim = FALSE; // Set to FALSE for Second Life to save memory
string fast="Fast"; // Set this to an empty string if you don't want to use the fast animation
integer debug = FALSE; // set to TRUE to see stuff inside as it runs
list animations; // holds a list of all animation names
list receivedData; // the data from the main program
integer STRIDE = 5; // size of the data packets in receivedData
integer currentLine; // the line we are processing
// Link messages
integer CLEAR = -234756;
integer DATA = -234757;
integer COMPILE = -234758;
integer DIE = -234759;
DEBUG(string msg)
{
if (debug) llOwnerSay("// " + msg);
}
// speak without the name of the prim in the way
SayCode (string story){
llOwnerSay (story);
llSleep(0.1);
}
default {
link_message(integer sender_num,integer num, string msg, key id) {
if (num == DIE && msg =="die") // clear
{
llOwnerSay("Compiler has been removed");
if (! debug) {
llRemoveInventory(llGetScriptName());
}
}
if (num == CLEAR) // clear
{
animations = [];
receivedData = [];
currentLine = 0;
llOwnerSay("Compiler Ready");
}
else if (num == DATA) // data
{
// data formatted like this:
// name|primnum|vector Pos|rotation rot|vector size
// test1|2|<0.026306,-0.150208,0.191069>|<-0.000008,0.956309,-0.292356,0.000000>|<0.074010,0.074010,0.074010>
list primList = llParseString2List(msg,["|"],[]);
string name = llList2String(primList,0);
receivedData += name;
receivedData += (float) llList2String(primList,1); // prim Number or ms to sleep
receivedData += (vector) llList2String(primList,2); // pos
receivedData += (rotation) llList2String(primList,3); // rot
receivedData += (vector) llList2String(primList,4); // size
// Store the name of the animation if it is not already stored
integer i = llListFindList(animations, [name]);
if( i < 0 ){
DEBUG("Adding Animation named " + name);
animations += name;
}
currentLine++;
}
else if (num == COMPILE) // finish, compile it
{
//DEBUG("Animations:" + llDumpList2String(animations,":"));
//DEBUG("Length:" + ((string) llGetListLength(animations)));
//DEBUG("history:" + llDumpList2String(receivedData,":"));
//DEBUG("Length:" + ((string) llGetListLength(receivedData)));
string code;
integer i;
llOwnerSay("Compiler processing " + (string)currentLine + " prim movements and " + (string) llGetListLength(animations) + " animations");
llOwnerSay("Copy everything below this line and paste it into a new script\n");
string oldname = llGetObjectName ();
llSetObjectName ("Compiler");
vector scale = llGetScale();
SayCode("// Prim animation compiler //\n"
+ "// Ferd Frederix - http://www.outworldz.com\n"
+ "integer playbackchannel = 1; // The default llMessageLinked number\n"
+ "rotation calcChildRot(rotation rdeltaRot){\n"
+ "\tif (llGetAttached())\n"
+ "\t\treturn rdeltaRot/llGetLocalRot();\n"
+ "\telse\n"
+ "\t\treturn rdeltaRot/llGetRootRotation();\n"
+ "}\n"
+ "vector originalScale = "
+ (string) scale
+ ";"
);
// Go through each animation and create a function for each one
for(i = 0; i < llGetListLength(animations); i++){
integer j;
string animationName = llList2String(animations, i);
//DEBUG("Processing " + animationName);
SayCode(animationName
+ "(){\n"
+ "\tvector currentSize = llGetScale();\n"
+ "\tfloat scaleby = currentSize.x/originalScale.x;\n"
);
//Read through the list and print out the instructions for this animation
integer count = llGetListLength(receivedData);
for(j=0; j < count; j += STRIDE)
{
string name = llList2String(receivedData,j);
float primNum = (float) llList2String(receivedData,j+1);
//DEBUG("name: " + name + " Prim Num: " + primNum);
if( name == animationName){
if(primNum > 1){ // not a root prim or sleep
SayCode( "\tllSetLinkPrimitiveParams"
+ fast
+ "("
+ (string) ((integer)primNum)
+ ", [PRIM_POSITION, "
+ (string) llList2Vector(receivedData,j+2)
+ "*scaleby, "
+ "PRIM_ROTATION,calcChildRot("
+ (string) llList2Rot(receivedData,j+3)
+ "), "
+ "PRIM_SIZE, "
+ (string) llList2Vector(receivedData,j+4)
+ "*scaleby]);"
);
} else {
SayCode("\tllSleep("
+(string)(primNum*-1) // negative numbers are sleep times
+");"
);
}
} // if name
} // for j
SayCode ("\n}");
} // for animations
SayCode (
"\n\n"
+ "default{\n"
);
if (!OpenSim)
SayCode("\tstate_entry(){\n"
+"\t\tllSetMemoryLimit(llGetUsedMemory() + 512);\n"
+ "\t\t}");
code = "\n\tlink_message(integer sender_num, integer num, string message, key id){\n"+
"\t\tif(num == playbackchannel){\n";
for(i=0; i<llGetListLength(animations);i++){
code+="\t\t\tif(message == \""+llList2String(animations,i)+"\"){\n"+
"\t\t\t\t"+llList2String(animations,i)+"();\n"+
"\t\t\t}\n";
}
code += "\t\t}\n"+
"\t}\n}";
SayCode(code);
SayCode("// Done! Copy everything above to a new script, and Search/Replace the time stamp and Compiler: on the left to be blank");
llSetObjectName (oldname);
}
}
}

View File

@@ -0,0 +1,342 @@
// :SHOW:1
// :CATEGORY:Prim
// :NAME:Prim_Animation_Compiler
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Animation, Puppeteer
// :CREATED:2013-02-25 10:47:09.853
// :EDITED:2015-08-07 14:27:52
// :ID:648
// :NUM:878
// :REV:2.0
// :WORLD:Second Life, Opensim
// :DESCRIPTION:
// For more details on how this script works, see <a href="http://www.outworldz.com/secondlife/posts/prim-compiler/">http://www.outworldz.com/secondlife/posts/prim-compiler/</a>
// This is the Animator menu system. You will also need the compiler script
// :CODE:
// Rev 2: allow anyone to use it - just click Finish and others can get an animation menu.
// fred@mitsi.com
// 2-19-2012
// Animator front-end for Compiler Script
// This is free software, it is not for sale at any price. Yu can use it and sell the object.
integer playchannel = 1; // the playback channel, this is the channel you use in LinkMessages
integer debug = FALSE; // if set to TRUE, debug info appears
integer dialogchannel ; // dialog boxes
integer nPrims; // total number of prims
integer wantname; // flag indicating we are waiting for a name to be chatted
integer wantnum; // flag asking for numbers to be chatted.
integer finished = FALSE; // flag to only show the recorded animations
// Link messages
integer CLEAR = -234756;
integer DATA = -234757;
integer COMPILE = -234758;
integer DIE = -234759;
// the list of coords
list masterlist; // master list of all positions
list llastPrimList; // storage of the last prim position we learned
string curranimation; // what we are playing
integer STRIDE = 5; // size of the master list
integer lastSTRIDE = 3; // size of the last prim list
integer listener; // temp listener when we are waiting for them to give us a name
vector InitSize; // the initial size when the prims were recorded
list LoadedAnims; // animations added to the Menu display
DEBUG(string msg)
{
if (debug) llOwnerSay("// " + msg);
}
Record()
{
if (llStringLength(curranimation) > 0)
{
integer foundmovement = 0; // will be set if any child moved
integer PrimCounter ; // skip past the root prim
for (PrimCounter =2; PrimCounter <= nPrims; PrimCounter++ )
{
//DEBUG("Checking Prim " + (string) PrimCounter);
list my_list = llGetLinkPrimitiveParams(PrimCounter,[PRIM_POSITION,PRIM_ROTATION, PRIM_SIZE ]);
// position is always in region coordinates, even if the prim is a child or the root prim of an attachment.
// rot is always the global rotation, even if the prim is a child or the root prim of an attachment.
// get current prim pos, rot and size
vector vrealPrimPos = llList2Vector (my_list,0) - llGetPos(); // position subtract Global Pos
vrealPrimPos /= llGetRot();
rotation rrealPrimRot = llList2Rot (my_list,1) / llGetRot(); // rotation subtract Global Rot
vector vrealPrimSize = llList2Vector (my_list,2); // size
// compare it to the last one we had
integer iindex = (PrimCounter - 2) * lastSTRIDE; // zeroth position is PrimCounter - start, or 2
// get the last thing we remembered about this prim
vector vlastPrimPos = llList2Vector (llastPrimList, iindex);
rotation rlastPrimRot = llList2Rot (llastPrimList, iindex+1);
vector vlastPrimSize = llList2Vector (llastPrimList, iindex+2);
//if (debug)
//{
// vrealPrimPos = <1,2,llFrand(1)>; // make a small change for debugging in LSL Editor
//}
// if anything changed on this prim, we must record it.
if (vlastPrimPos != vrealPrimPos ||
rlastPrimRot != rrealPrimRot ||
vlastPrimSize!= vrealPrimSize
)
{
foundmovement++;
//Save changes in the master list of all animations
masterlist += curranimation;
masterlist += (float) PrimCounter;
masterlist += vrealPrimPos;
masterlist += rrealPrimRot;
masterlist += vrealPrimSize;
string msg = curranimation + "|" + (string) PrimCounter + "|" + (string) vrealPrimPos + "|" + (string) rrealPrimRot + "|" + (string) vrealPrimSize ;
llMessageLinked(LINK_ROOT,DATA,msg,"");
// update the last movement list
llastPrimList = llListReplaceList(llastPrimList,[vrealPrimPos],iindex,iindex);
llastPrimList = llListReplaceList(llastPrimList,[rrealPrimRot],iindex+1,iindex+1);
llastPrimList = llListReplaceList(llastPrimList,[vrealPrimSize],iindex+2,iindex+2);
} // if
else
{
//DEBUG( (string) PrimCounter);
}
} // for
//DEBUG("history:" + llDumpList2String(llastPrimList,":"));
if (foundmovement)
{
llOwnerSay("Recorded " + (string) foundmovement + " prims" );
}
else
{
llOwnerSay("You must move at least one child prim.");
}
}
else
{
llOwnerSay("You must name your animation.");
llOwnerSay("Type the new animation name on channel /" + (string) dialogchannel);
wantname++;
}
}
// on reset, record the base position in history so we can see changes
Clear()
{
llMessageLinked(LINK_ROOT,CLEAR,"","");
LoadedAnims = []; // wipe out Menu
masterlist = []; // wipe all recordings
llastPrimList = []; // wipe last animations
integer PrimCounter ; // skip 1, which is the root prim
integer counter = 0;
// save all the current settings in memory
for (PrimCounter=2; PrimCounter <= nPrims; PrimCounter++ )
{
list my_list = llGetLinkPrimitiveParams(PrimCounter,[PRIM_POSITION,PRIM_ROTATION, PRIM_SIZE ]);
// save the local pos and rot, since llGetLinkPrimitiveParams returns global pos and rot
vector primpos = llList2Vector (my_list,0) - llGetPos();
primpos /= llGetRot();
rotation primrot = llList2Rot (my_list,1) / llGetRot();
vector primsize = llList2Vector (my_list,2) ;
llastPrimList += primpos;
llastPrimList += primrot;
llastPrimList += primsize;
counter++;
}
llOwnerSay("There are " + (string) counter + " animatable prims");
}
DumpBack ()
{
integer imax = llGetListLength(masterlist);
integer howmany = imax / STRIDE ;
llOwnerSay("Preprocessing " + (string) howmany + " movements. " );
llMessageLinked(LINK_ROOT,COMPILE,"","");
}
rotation calcChildRot(rotation rdeltaRot)
{
if (llGetAttached())
return rdeltaRot/llGetLocalRot();
else
return rdeltaRot/llGetRootRotation();
}
PlayBack (string name)
{
integer i;
integer imax = llGetListLength(masterlist);
integer linknum = 0;
for (i = 0; i < imax; i+= STRIDE)
{
string saniName = llList2String(masterlist,i);
vector scale = llGetScale();
float delta = scale.x / InitSize.x ; // see if the root prim has grown or shrunk as a percentage
if (saniName == name)
{
float fprimNum = llList2Float(masterlist,i+1);
vector vPos = llList2Vector(masterlist,i+2);
rotation rRot = llList2Rot(masterlist,i+3) ;
vector vprimSize = llList2Vector(masterlist,i+4) ;
vPos *= delta; // add any difference in size to it positions there
vprimSize *= delta; // grow the child prim, too
// support negative prim numbers as a delay
if (fprimNum < 0)
{
// DEBUG("Sleeping " + (string) (fprimNum * -1));
llSleep((float) fprimNum * -1);
}
else
{
// set the local pos and locat rot to the prims orientation and position
rRot = calcChildRot(rRot);
list actions = [PRIM_POSITION,vPos,PRIM_ROTATION,rRot,PRIM_SIZE,vprimSize];
//DEBUG("Moving prim :" + (string) fprimNum + ":" + llDumpList2String(actions,":"));
llSetLinkPrimitiveParamsFast((integer) fprimNum,actions);
}
}
}
}
MakeMenu()
{
list amenu ;
if (finished)
amenu = LoadedAnims;
else
amenu = ["Reset","Record","Help","Name","Compile","Pause", "Finish"] + LoadedAnims;
llListenRemove(listener);
listener = llListen(dialogchannel,"","","");
amenu = llDeleteSubList(amenu,12,99);
llDialog(llGetOwner(), "Pick a command",amenu,dialogchannel);
}
default
{
state_entry()
{
InitSize = llGetScale(); // save the size when we recorded the prims
nPrims = llGetNumberOfPrims(); // how many we are recording
llOwnerSay("Prim count = " + (string) nPrims);
Clear();
dialogchannel = (integer) (llFrand(100) +600);
MakeMenu();
}
touch_start(integer total_number)
{
MakeMenu();
}
listen( integer channel, string name, key id, string message )
{
if (message == "Finish")
{
finished =TRUE;
MakeMenu();
}
else if (message == "Reset")
{
llResetScript();
}
else if (wantnum)
{
float num = (float) message;
if (num > 0.0)
{
num = -1 * (num /1000);
masterlist += curranimation;
masterlist += num;
masterlist += <0,0,0>; // pos
masterlist += <0,0,0,1>;// rot
masterlist += <0,0,0>; // size
string msg = curranimation + "|" + (string) num + "|<0,0,0>|<0,0,0,1>|<0,0,0>" ;
llMessageLinked(LINK_ROOT,DATA,msg,"");
}
else
{
llOwnerSay("Please enter numbers in milliseconds. 1000=1000ms = 1 second. 500=500ms = 1/2 a second.");
llOwnerSay("What is a milliHelen? A milliHelen is a face that can launch one ship!");
}
wantnum = FALSE;
MakeMenu();
}
else if (message =="Pause")
{
wantnum= TRUE;
llListenRemove(listener);
listener = llListen(dialogchannel,"","","");
llTextBox(llGetOwner(), "Enter a delay in milliseconds:\n1000 = 1 second\n500 = 1/2 second",dialogchannel);
}
else if (message == "Record")
{
Record();
MakeMenu();
}
else if (message == "Name")
{
llOwnerSay("Enter a new name, or type the animation name on channel /" + (string) dialogchannel);
wantname = TRUE;
MakeMenu();
llTextBox(llGetOwner(),"Enter an Animation Name",dialogchannel);
}
else if (message == "Compile")
{
DumpBack();
MakeMenu();
}
else if (message == "Help")
{
llLoadURL(llGetOwner(),"View online help", "http://secondlife.mitsi.com/secondlife/Posts/Prim-Compiler");
}
else if (wantname)
{
curranimation = message;
LoadedAnims += message;
MakeMenu();
llOwnerSay("Recording is ready for animation '" + curranimation + "'");
llOwnerSay("Position any child prims, then select the menu item 'Record', and repeat as necessary. When finished, click 'Compile' to save the animation, or click the animation name to play it back. Click 'Name' to start a new animation sequence");
wantname = 0;
}
else
{
if (llListFindList(LoadedAnims,[message]) != -1)
{
PlayBack(message);
MakeMenu();
}
}
}
}

View File

@@ -0,0 +1,14 @@
<Project name="Prim_Animation_Compiler" guid="d8e2c242-6c00-1014-b904-200204c60a89">
<Object name="Object" guid="d8e2c34e-6c00-1014-b904-200204c60a89">
<Script name="Alternating Up and Down example trigger.lsl" guid="71169092-28d6-41c5-a7e9-50e602a779a2">
</Script>
<Script name="Another way to alternate on touch example.lsl" guid="ed943fe2-4273-457f-95e1-9f0e8a6cdb6e">
</Script>
<Script name="Example listen script.lsl" guid="4b631d18-b841-45c9-aafb-47e61cbf5957">
</Script>
<Script name="Prim_Animation_Compiler.lsl" guid="d8e3644b-6c00-1014-b904-200204c60a89">
</Script>
<Script name="Prim_Animation_Recorder.lsl" guid="d8e33212-6c00-1014-b904-200204c60a89">
</Script>
</Object>
</Project>