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="PrimSkirt Builder">
<Project name="PrimSkirt Builder" path="PrimSkirt Builder\PrimSkirt Builder.prj" active="true"/>
</Solution>

View File

@@ -0,0 +1,35 @@
// :SHOW:
// :CATEGORY:Clothing
// :NAME:PrimSkirt Builder
// :AUTHOR:Daltonic Gin
// :KEYWORDS:
// :CREATED:2015-03-17 10:30:53
// :EDITED:2015-03-17 09:30:53
// :ID:1075
// :NUM:1735
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// Nice Prim Skirt builder for flexible prims
// :CODE:
END-USER LICENSE AGREEMENT
I. Terms and Conditions:
Per the terms and conditions under the GNU General Public License, you may:
1) Freely modify the source code of this script, so long as those modifications are properly documented within the body of the source code up to and including derivative works based upon this script under the understanding that such works fall under the GPL license. Stand-alone works (animations, sounds, textures, prims, or precompiled modules) designed to operate in conjunction with this script do not fall under this agreement and are not subject to the GPL.
2) Freely distribute this script to any third party as deemed appropriate for public or private use so long as this notice and a copy of the GNU GPL are included.
Per the agreement, you may NOT:
1) Sell modified versions of this script without the express written permission of the original author unless the derivative work uses less than 20% of the original source code.
II. Warranty Information
This product comes "as-is" with no express or implied warranty. You may not hold the original author or any authors of derived work accountable for damages associated with the use or modification of this script unless those authors provide a statement of warranty in writing.
III. Retroactive License.
The terms and conditions of this script, upon entering into public domain, affect all prior versions of this script that carry the same name. All previous versions of this script, whether written by the original author or others who claim association with said author, now fall under the jurisdiction of the GPL and are subject to the terms and conditions contained therein.
Please refer to the included GNU GPL license notecard for additional information.

View File

@@ -0,0 +1,354 @@
// :SHOW:
// :CATEGORY:Clothing
// :NAME:PrimSkirt Builder
// :AUTHOR:Daltonic Gin
// :KEYWORDS:
// :CREATED:2015-03-17 10:31:31
// :EDITED:2015-03-17 09:31:31
// :ID:1075
// :NUM:1738
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
//
// :CODE:
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,44 @@
// :SHOW:
// :CATEGORY:Clothing
// :NAME:PrimSkirt Builder
// :AUTHOR:Daltonic Gin
// :KEYWORDS:
// :CREATED:2015-03-17 10:31:06
// :EDITED:2015-03-17 09:31:06
// :ID:1075
// :NUM:1736
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
//
// :CODE:
Glad that you've got your copy of the prim skirt builder. First a couple of words why it appeared.
There's a person who makes my SL the most enjoyable experience, and her name is Vint Falken.
She is a great SL photo-artist (if you can afford the price for the services of a professional - then she's the right person to talk to), and a great person overall.
Looking at the LoopRez script which is used for these things, I said "what a boring work it must be!" and told her I can make something better than that.
And then I've decided to release this as full-mod under GPL license, for a few reasons:
1) I think it is a nice way to express myself to her
2) I am curious if anyone likes the tool enough that they would tip me without being required to do so :-)
3) other people (you!) can save some time not spent on boring things and spend it more productively.
4) Last but not least... I depend a lot on the GPL code IRL - and I wanted to contribute back, even in such a small extent.
Now that you've read the story and you know why - grab the manual (you can find a copy of it inside the posing stand) and look through it - and then... have fun!! :-)
Take also your time to read the EULA and the GPL license - before asking any questions or tweaking any of the permissions :-)
I will post the relevant news regarding this tool on my blog http://daltonic.blogspot.com/ under the tag "primskirtbuilder"
cheers,
Dalien
P.S. Be sure also to visit Vint's blog at http://www.vintfalken.com/ - she has quite a few nice tutorials
P.P.S. if someone sold you this build for anything other than L$0, or if you can not view the source of the scripts - please go and report them, they've been doing so in violation of GPL.

View File

@@ -0,0 +1,162 @@
// :SHOW:1
// :CATEGORY:Clothing
// :NAME:PrimSkirt Builder
// :AUTHOR:Daltonic Gin
// :KEYWORDS:
// :CREATED:2015-03-17 10:31:19
// :EDITED:2015-03-17 09:37:33
// :ID:1075
// :NUM:1737
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
//
// :CODE:
0. Before you IM me.
I think it is important to mention it again in the very beginning - if you think this tool is useful, I would be interested to see how much,
and indeed the tips are much more appreciated than random IMs :-) I also do live music - and similar to live music, it is not *required* to tip the performer/author. However, your desire to share some of your cash does express the extent of your satisfaction with the product, so I am making this experiment to see if this works.
Once again - this tool is and has to be free as in beer and free as in speech. If someone charged you for getting it, they violated the GPL - please file an AR and get the
free copy from my location. Where - it is mentioned in the http://daltonic.blogspot.com/ in the entries with the tag "primskirtbuilder".
IMPORTANT: REQUESTS FOR HELP.
I do not have much time at all, and I prefer not to spend it on answering questions. if you have something specific to ask - drop me an email at dalienta@gmail.com - if the question/bug report is valid, it will be acted upon and answered on my blog - http://daltonic.blogspot.com, in an entry with the tag "primskirtbuilder". For those impatient that require the help "right now" - I probably can help, take a look at the last section of the manual for my consulting fees before IMing me to ensure that we are in full understanding. If you want an alternative form of licensing or want unrelated consulting help - drop me an email with the description of what you want, and I will reply as my time permits. Please do not consider it as any form of hostility - it is just to ensure my personal time is spent in the most efficient manner. Thanks for your understanding :-)
1. The contents of the package
The builder, which looks like a posing stand, contains:
- EULA
- GNU License (GPL) - read this before making any mods
- Introduction - first time read for the new owners
- pose stand script
- prim (used to create the skirts and control elements)
- Vint's prim skirt builder manual - the manual you are reading
- waist - the texture for the geometry control prim
Pay attention, that all the skirts it creates, have the same creator as the creator of the "prim" - that is, me,
Dalien Talbot (or the previous owner, if you grabbed a copy from someone). It may be ok if you build the clothes for yourself, but if you want to resell your creations,
you might want to change the creator to be you. How this is done is described in the section "Changing the creator".
At first feel free to practice, so you are familiar with how the tool works.
2. Getting started
Rez the stand onto the ground, and either click it or stand on it. If you stand on it, you will get into the "edit appearance" pose, which can be convenient if you want to see how the skirt looks on yourself. If you do not want that, clicking is exactly the same.
You will get a dialog, which will say how many prims will the skirt have, and three buttons: "More", "Less", and "Rez...".
The "More" and "Less" will increase or decrease the number of prims, and "Rez..." will create the skirt and control elements. You can go up to 60 prims in the skirt, but this is not very sim-friendly - some of the calculations are rather intensive, and it may make the things slow. (Also, wearing such a monster will create a lag for the others - so think twice before creating it).
Once you have hit "Rez...", wait until the rezzing finishes, it takes some time.
In the end, you will see the prims in the skirt shape above the platform, a green ball in the center of it, and two control prims - one on the left, which looks the same as the the prims making up the skirt - "appearance control" prim, and one on the right, with the circle and the "Waist size" written on it - "geometry control" prim.
IMPORTANT: never change the skirt prims directly! All the manipulations are to be done via the left and right control prims.
Also, be sure to not do the changes too fast - and especially do not touch anything while the skirt is being linked - this may have unpredictable effects!
Both of the control prims have a quick reference in the text above them, but below is a more verbose description.
3. Changing the appearance of the skirt prims (using the appearance control prim)
Simply edit the appearance control prim on the left, and most of the changes will be automatically replicated to all the skirt prims at once. The changes get replicated in 1-2 seconds - to speed up the editing, only the last state of the object is transferred.
"Most of the changes" includes:
- prim type (box/circle/cylinder/etc. - sculpted prims would NOT work.)
- prim scale (X/Y/Z size)
- flex characteristics - note that e.g. sphere can not be "flex"
- textures/colors/transparency on each of the sides or all of them - same as for "normal" editing.
One note about the flex objects and size replication - I have noticed that for the flex objects, changing the sizes on axis other than Z results in no visible effect - it may be a bug in the script, or, more probably the bug in SL (since when you click those prims subsequently, they get the correct sizes).
Another thing is that the flex parameters do not seem to take effect immediately if you change them - you might want to flip the "flex" setting off, wait for it to replicate, and then turn it on again. It may be a bug in SL or in the script - maybe I take a look at this later on.
Note, that also changing the position for the appearance control prim affects the position of the skirt - by moving it, you will move the whole set of the prims for the to-be skirt at the same distance. I tried to be smart about changing the size of the prim - since when you change it in the GUI, the center of the prim also drifts - these changes should not normally cause any movements of the skirt.
NOTE: the textures that you use, have to have the "copy" permission set!
4. Changing the waist size / flare / bend (using the geometry control prim)
The shape of the circle (or ellipse, in most cases :) with the text "waist size" is exactly the same as the shape of the imaginary ellipse on the waist line, from which the prims are hanging. The sizes are proportional - except the geometry control prim is a few times bigger for your convenience.
So, editing the Y-size or Z-size will allow you to change the shape of the ellipse along which the prims are positioned.
The Y-angle represents the flare - how much do the skirt prims ... umm... well... how much do they "flare" :) the angle is relative the vertical - i.e. "0" would mean they are vertical, "90" degrees would mean they "grow out" horizontally. Turning off the flex will make the things look more vivid.
When you rotate the geometry control prim using the "green" circle, you can go only up to angle of 90 degrees. If you manually stick in the bigger values into the editor box, you can get the skirts looking *upwards* :-) (Not sure why anyone would want to do that, but still thought I'd let you know.)
NOTE: the original LoopRez had both the coordinates and the radius and the rotation relative the center of the prims. I found it inconvenient, so in my scenario all of these are done relative to the waist line.
The X-size of the geometry control prim represents the "bend coefficient" - it changes the Z-position of the prims depending on their place on the virtual ellipse. Allosw for a fancier-looking skirts, I suppose :-)
5. Changing the number of prims
Midway through your work, you might realize that you have taken too few or too many prims - no problem! click on the stand or the skirt itself, and the menu will popup.
Use the already familiar "More" and "Less" buttons to set the number of prims you need, and then click "Rez..." - the current skirt will get wiped, and the one with the new number of prims will re-rez. Again, give it some time, do not hurry !
6. Finalizing your work
Once you are happy with how your skirt looks like, you will want to link it. While it can be done manually, I do think it is a boring exercise. So, I made the script such that it links it for you!
Click on the stand (or on the skirt itself) to get the menu. In the menu, click "Link...". You will see a popup asking you for a permission to link the objects - answer "Yes" (otherwise it would not work), and wait. When the linking process is finished, the resulting skirt will be moved to the left and front from the posing stand by 1 meter,
feel free to rename it as you like, take into the inventory and try wearing! :-)
The only thing you might want to adjust then is its position on your body - you can do it while hitting "edit" on the skirt itself while wearing it, and moving it up/down.
Since the green ball is the root prim of the linked set, besides the vertical adjustment, normally there should be no other quirks needed.
7. Cleaning up
You can delete all the rezzed prims by clicking the stand, and hitting the "Wipe all..." button. this will leave only the posing stand, which you can take back into the inventory.
Also, if you take away the posing stand, and leave the control prims hanging in the air - they will self-destruct in approximately 1 hour.
Have fun and enjoy your skirts!! :-)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Advanced/Commercial: Changing the creator for the skirt prims
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Okay, this may be a difficult operation for some... read very very very carefully, and then follow step by step - PRECISELY.
If it does not work - then repeat it again. If it still does not work - you are probably doing something wrong. Reread and retry again.
DISCLAIMER (read carefully before IMing me for help with this part): You can hire me for help if I am online (no guarantees I will do it though - depends on my availability) - but since this is a boring activity (and since you will probably be making the money after it), be prepared that I will charge for this consulting.
L$1500 is the disturbance compensation which includes also 15 minutes of consulting time (it should not take more than that), all the time spent on top of that that it is L$900 for every other full 15 minutes spent. (Yeah, I am not cheap, but still it is way cheaper than I would cost IRL :) You can indeed also ask for the help of your friendly scripter - this operation is not complex at all for someone who has done it, I just want to avoid spending all the time in SL moving the scripts between the objects :-)
So, now that you have read the above scary passage, and are determined to save some money by doing it yourself, here is how to do it:
1) rez the posing stand from your inventory (since it is full-mod, you now have 2 objects - one in the inventory which will be the "backup copy", and one rezzed - which will be your working copy). If you have only one copy - means someone has reset the permissions on the objects - hence violating the GPL. Go and complain back to them! :)
2) Right-click on the stand and choose "Edit..." from the pie menu.
3) in the dialog with "General | Object | Features | Texture | Content" tabs, click on the tab named "Content"
4) drag the prim object named "prim" onto the ground.
5) you will see the dialog change, and in the "Content" tab there will be now the content of this prim - a single script called "positioning/control"
6) drag this script into your inventory
7) create a new prim, which would have the desired characteristics as a starting prim for the skirt (flex/textures/etc).
NOTE: any textures that you use in this prim HAVE to be copyable, as anyone who will grab a copy of the tool from you will be using them as a starting point for building.
Also - this prim has to have the full permissions!!!
8) right-click this prim, select "Edit...", then "Content" tab, and drop the script "positioning/control" from your inventory into the contents area of the new "prim" prim.
9) click on the "General" tab, and ensure that your prim is named "prim"
10) right-click your prim and select "Take" from the pie menu - this will take this new prim into your inventory
11) right-click the posing stand, choose "Edit...", then "Contents" tab to display the contents of the package again
12) select the "prim" object within the posing stand contents, and hit the "delete" key once (or right-click that piece, and choose the "Delete" menu item). The prim should disappear from the posing stand's contents.
13) find back the new "prim" prim that you have just created and taken into the inventory, drag it into the contents area of the posing stand, and drop there.
14) You are done! Close the edit box and test that everything is working.

View File

@@ -0,0 +1,507 @@
// :SHOW:
// :CATEGORY:Clothing
// :NAME:PrimSkirt Builder
// :AUTHOR:Dalien Talbot
// :KEYWORDS:
// :CREATED:2015-03-17 10:43:59
// :EDITED:2015-03-17 09:43:59
// :ID:1075
// :NUM:1739
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// Prim Skirt Builder
// :CODE:
//
// Copyright (c) 2007 Dalien Talbot and few other folks thanks to whom this exists:
//
// Vint Falken, of course - the inspiration, pushing me to the idea, testing, and finding the software bugs :-)
// LSL wiki - the function reference
// Posing stand code - unknown author
// LoopRez v0.6, by Ged Larsen, 20 December 2006 - the math for placement of the skirt prims
//
// This work is distributed "as-is" with no warranty whatsoever.
//
//
// It is distributed under GPL license. Please have a look at the "EULA" and the "GNU License" notecards in the inventory
// to get familiar with the terms and conditions.
//
// All the derivatives of this work obviously have to comply with the GPL as well. Contact me (Dalien Talbot) if you require alternative licensing.
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// NOTE:
// Unless you know what you are doing, do NOT change anything below !
//
// The standard consulting fees mentioned in the manual will apply for the works on fixing the breakages :-)
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
key mkLoungingAgentKey = NULL_KEY;
integer miPermissionsAcquired = FALSE;
vector vLoungeTarget = <0.00, 0.00, 1.50>;
vector myPos;
// prim constants
integer PRIM_FIRSTMISC = -10;
integer PRIM_CONTROL = -10;
integer PRIM_LINKCENTER = -11;
integer PRIM_GEOMETRY = -12;
// pseudo constant - this is the last misc prim number
integer PRIM_LASTMISC = -12;
////////////////////////////////////////////////////////////////////////////////
// CONFIGURATION PARAMETERS for the looprez, these will be changed by the gui editor elements
string objectName = "prim"; // object to use; will need to be in the inventory of the prim containing this script
integer numObjects = 12; // how many objects
float xRadius = .05; // waist ellipse x-axis radius in meters
float yRadius = .07; // waist ellipse y-axis radius in meters
float flareAngle = 45.0; // how many DEGREES the bottom of object will flare outwards, the "poof" factor
float bendCoefficient = 0.0; // makes a "saddle shape", bends DOWN this number of meters at extremes of X-axis
vector rotOffset = <0.0, 180.0, 0.0>; // rotation offset in DEGREES -- fixes the rotation of ALL objects; for flexi prims, often you will want <180.0, 0.0, 0.0>
vector posOffset = <0.0, 0.0, 1.0>; // position offset
// channel to talk to the prims
integer commChannelBase = 0;
integer CHANNEL = 77; // dialog channel
list MENU_MAIN = ["More", "Less", "Rez...", "News..."]; // the main menu
// 0: default state, selecting the number of prims/allowing to rez
// 1: objects are rezzing
// 2: objects have rezzed, tweaking
integer script_state = 0;
// iterator - runs while rezzing through the whole range, to make the process sequential
integer current_rez_prim_num = 0;
// string with all the init parameters that are same for all the prims
string init_string = "";
show_main_dialog()
{
list menu = MENU_MAIN;
if (script_state == 2) {
menu = menu + [ "Wipe all...", "Link..." ];
}
llDialog(llGetOwner(), "Number of prims: " + (string)numObjects, menu, CHANNEL);
}
rez_one_prim()
{
vector pos = llGetPos() + posOffset;
// the master prim
if (current_rez_prim_num == PRIM_CONTROL) {
// control prim
pos = pos + <0., 1.5, 0.5>;
} else if (current_rez_prim_num == PRIM_LINKCENTER) {
// linkage prim
} else if (current_rez_prim_num == PRIM_GEOMETRY) {
// radius/tilt control prim - on the right
pos = pos + <0., -1.5, 0.5>;
}
llRezObject(objectName, pos, ZERO_VECTOR, ZERO_ROTATION, commChannelBase);
}
make_init_string()
{
init_string = llDumpList2String([myPos, numObjects, xRadius, yRadius, flareAngle, bendCoefficient, rotOffset, posOffset], ":");
}
reposition_all()
{
integer i;
make_init_string();
//for(i=0; i<numObjects; i++) {
// llSay(commChannelBase + 1 + i, "bulk:" + init_string);
//}
llSay(commChannelBase - 1, "bulk:" + init_string);
}
// tell something unicast to a rezzed prim on its channel
unicast(integer child, string message)
{
llSay(commChannelBase + 1 + child, message);
}
// try to ping the prim, and set up the watchdog
check_or_rez_next_misc_prim()
{
unicast(current_rez_prim_num, "echo");
llSetTimerEvent(1);
}
// rez a next misc prim
make_next_misc_prim()
{
current_rez_prim_num = current_rez_prim_num - 1;
if (current_rez_prim_num >= PRIM_LASTMISC) {
check_or_rez_next_misc_prim();
} else {
// done with rezzing all the prims
llSetTimerEvent(0);
llOwnerSay("Rezzed all " + (string)numObjects + " prims, please edit the prims on the left and right to edit the skirt, when done, click the stand and hit 'Link...'");
script_state = 2;
// ask the control prims to push their config - in case they were already there...
llSay(commChannelBase - 1, "repost");
// start sending the keepalives every minute, so the control prims do not die
llSetTimerEvent(60);
}
}
wipe_all() {
llSay(commChannelBase - 1, "die");
script_state = 0;
llOwnerSay("Wiped all elements... touch the platform to get the menu again.");
}
// check the replies from the dialog
integer check_dialog_replies(string message)
{
if (message == "More") {
if (numObjects < 30) {
numObjects = numObjects + 2;
}
show_main_dialog();
return 1;
} else if (message == "Less") {
if (numObjects > 2) {
numObjects = numObjects - 2;
}
show_main_dialog();
return 1;
} else if (message == "Rez...") {
script_state = 1;
myPos = llGetPos();
// wipe all the skirt prims
llSay(commChannelBase - 1, "die_skirt");
llOwnerSay("Rezzing " + (string)numObjects + " prims...");
llListen(commChannelBase, "", "", "");
// start with the first prim - the rest will go in a loop
current_rez_prim_num = 0;
make_init_string();
rez_one_prim();
return 1;
} else if (message == "Wipe all...") {
wipe_all();
llOwnerSay("Resetting the script...");
llResetScript();
return 1;
} else if (message == "Link...") {
unicast(PRIM_LINKCENTER, "link");
} else if (message == "News...") {
llLoadURL(llGetOwner(),"Prim skirt builder news @Daltonic blog", "http://daltonic.blogspot.com/search/label/primskirtbuilder");
}
return 0;
}
// we use the description as a "one time run" flag
// it stores the hash of the key of the last owner that ran the script
// if the owner changes - the hash changes too.
run_once()
{
string hash = llMD5String((string)llGetOwner(), 777);
if (llGetObjectDesc() != hash) {
llOwnerSay("Please read through the Introduction, the license, and the manual before asking any questions.");
llOwnerSay("The author is available for consulting help, the rates are mentioned in the manual.");
llSetObjectDesc(hash);
llGiveInventory(llGetOwner(), "Introduction");
}
}
default
{
state_entry()
{
//overriden sit target
//lower them a bit
rotation rX;
rotation rY;
rotation rZ;
rotation r;
vector size;
size = llGetAgentSize(llGetOwner());
// approximation.. but still better than nothing
vLoungeTarget.z = size.z / 2.0;
//build rotations
//Note: this is broken out like this to simplify the
// process of finding the correct sit angle. I
// use the following form until I have the rotation
// that I want perfect, and then I simply
// hardcode the perfected quaterion and remove
// this mess.
//
rX = llAxisAngle2Rot( <1,0,0>, 0 * DEG_TO_RAD); //cartwheel
rY = llAxisAngle2Rot( <0,1,0>, 0 * DEG_TO_RAD); //sumersault
rZ = llAxisAngle2Rot( <0,0,1>, 0 * DEG_TO_RAD); //turn in place
//combine rotations
r = rX * rY * rZ;
//override 'sit' on pie menu
llSetSitText( "Stand" );
//override default sit target and rotation on prim
llSitTarget( vLoungeTarget, r );
llSetRot(ZERO_ROTATION); // align to global coordinates
llListen(CHANNEL, "", llGetOwner(), "");
commChannelBase = 100000 + (integer)llFrand(100000000);
// run the stuff that needs to be run once...
run_once();
// testing
//mkLoungingAgentKey = llGetOwner();
//commChannelBase = 123456;
}
on_rez(integer n)
{
llResetScript();
}
timer()
{
if (script_state == 1) {
// rezzing on timeout - no echo reply
llSetTimerEvent(0);
rez_one_prim();
}
// send a keepalive so the others know we are still here
llSay(commChannelBase - 1, "keepalive");
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if ( mkLoungingAgentKey == NULL_KEY && agent != NULL_KEY )
{
//changed user
//cache new user key and request their permissions
mkLoungingAgentKey = agent;
llRequestPermissions(mkLoungingAgentKey, PERMISSION_TRIGGER_ANIMATION);
// show the dialog
if (agent == llGetOwner()) {
show_main_dialog();
} else {
llInstantMessage(agent, "The owner now should rez/edit the skirt. You can take your own copy by buying it for L$0.");
}
}
else if ( mkLoungingAgentKey != NULL_KEY && agent == NULL_KEY)
{
//user is getting up
if ( miPermissionsAcquired )
{
//restore anims
llStopAnimation("turn_180");
}
mkLoungingAgentKey = NULL_KEY;
//reset the script to release permissions
//llResetScript();
}
}
}
run_time_permissions(integer parm)
{
if(parm == PERMISSION_TRIGGER_ANIMATION)
{
//set permission flag
miPermissionsAcquired = TRUE;
//cancel the sit anim
llStopAnimation("sit");
llStartAnimation("turn_180");
}
}
touch_start(integer total_number)
{
key who = llDetectedKey(0);
if (who == llGetOwner())
{
show_main_dialog();
} else {
llInstantMessage(who, "Only the owner can edit the skirt. Right-click and buy your copy for L$0 to try it yourself");
}
}
listen(integer channel, string name, key id, string message)
{
integer i;
if (script_state == 0) {
if (channel == CHANNEL) {
check_dialog_replies(message);
}
} else if (script_state == 1) {
if (channel == commChannelBase) {
// newly awaken child comes back to us
if (message == "boot") {
string msg = "init:" + (string)current_rez_prim_num + ":" + init_string;
// need to supply this little boy with his parameters, once it replies - we rez a new one
llSay(commChannelBase, msg);
// debug to see what exactly is in bootmsg
//llOwnerSay("bootmsg: " + msg);
} else if (message == "echo_reply") {
// one of the control prims we have pinged already exists - so we can just decrement
// to the next one
//llOwnerSay("echo reply!");
make_next_misc_prim();
} else if (message == "init_ok") {
// this guy has acked our parameters, has stopped listening on the base channel,
// renamed itself into its number
// and is listening on the commChannelBase + 1 + childNumber
if (current_rez_prim_num >= 0) {
// rezzing normal prims
current_rez_prim_num = current_rez_prim_num + 1;
if (current_rez_prim_num < numObjects) {
rez_one_prim();
} else {
// start rezzing misc prims
current_rez_prim_num = PRIM_FIRSTMISC;
check_or_rez_next_misc_prim();
}
} else {
// supply misc parameters to control prims...
if (current_rez_prim_num == PRIM_LINKCENTER) {
// turn it into a small ball...
// set shape
unicast(PRIM_LINKCENTER, "lc_prim_params:9:3:0:<0.000000, 1.000000, 0.000000>:0.000000:<0.000000, 0.000000, 0.000000>:<0.000000, 1.000000, 0.000000>");
// reset flex and set size
unicast(PRIM_LINKCENTER, "lc_prim_params:21:0:2:0.300000:2.000000:0.000000:1.000000:<0.000000, 0.000000, 0.000000>:7:<0.050000, 0.050000, 0.050000>");
// set texture (none)
unicast(PRIM_LINKCENTER, "lc_prim_params:17:0:5748decc-f629-461c-9a36-a35a221fe21f:<1.000000, 1.000000, 0.000000>:<0.000000, 0.000000, 0.000000>:0.000000");
}
if (current_rez_prim_num == PRIM_GEOMETRY) {
string cmds = "";
integer i;
// set shape
unicast(PRIM_GEOMETRY, "gc_prim_params:9:0:0:<0.000000, 1.000000, 0.000000>:0.000000:<0.000000, 0.000000, 0.000000>:<1.000000, 1.000000, 0.000000>:<0.000000, 0.000000, 0.000000>");
// reset flex
unicast(PRIM_GEOMETRY, "gc_prim_params:21:0:2:0.300000:2.000000:0.000000:1.000000:<0.000000, 0.000000, 0.000000>");
// size is set at boot...
// :7:<0.010000, 0.600000, 0.400000>");
// all textures to white
unicast(PRIM_GEOMETRY, "gc_prim_params:17:-1:5748decc-f629-461c-9a36-a35a221fe21f:<1.000000, 1.000000, 0.000000>:<0.000000, 0.000000, 0.000000>:0.000000");
// waist size texture
unicast(PRIM_GEOMETRY, "gc_prim_params:17:4:3515e3e5-f7c3-ffbe-8eb1-f7ede3bbc831:<1.000000, 1.000000, 0.000000>:<0.000000, 0.000000, 0.000000>:0.000000");
}
// rezzing misc prims - descending
make_next_misc_prim();
}
} else {
llOwnerSay("Unknown message '" + message + "'");
}
}
} else if (script_state == 2) {
if (channel == commChannelBase) {
list aList = llParseString2List(message, [":"], []);
string command = llList2String(aList, 0);
if (command == "move") {
posOffset = posOffset + (vector)llList2String(aList, 1);
//llOwnerSay("moving by " + llList2String(aList, 1));
reposition_all();
} else if (command == "geometry") {
// waist size / bend coeff
vector v = (vector)llList2String(aList, 1);
bendCoefficient = v.x;
yRadius = v.y;
xRadius = v.z;
reposition_all();
} else if (command == "flare") {
//llOwnerSay("flare set: " + message);
flareAngle = (float)llList2String(aList, 1);
reposition_all();
} else if (command == "menu") {
show_main_dialog();
}
} else if (channel == CHANNEL) {
list aList = llParseString2List(message, [" "], []);
string command = llList2String(aList, 0);
if (check_dialog_replies(message)) {
// already done all
//llOwnerSay("dialog reply!");
// the below commands are for debug via the command line
} else if (command == "reset") {
wipe_all();
} else if (command == "dz") {
posOffset.z = posOffset.z + (float)llList2String(aList, 1);
reposition_all();
} else if (command == "dx") {
posOffset.x = posOffset.x + (float)llList2String(aList, 1);
reposition_all();
} else if (command == "dy") {
posOffset.y = posOffset.y + (float)llList2String(aList, 1);
reposition_all();
} else if (command == "z") {
posOffset.z = (float)llList2String(aList, 1);
reposition_all();
} else if (command == "x") {
posOffset.x = (float)llList2String(aList, 1);
reposition_all();
} else if (command == "y") {
posOffset.y = (float)llList2String(aList, 1);
reposition_all();
} else if (command == "flare") {
flareAngle = (float)llList2String(aList, 1);
reposition_all();
} else if (command == "xradius") {
xRadius = (float)llList2String(aList, 1);
reposition_all();
} else if (command == "yradius") {
yRadius = (float)llList2String(aList, 1);
reposition_all();
} else if (command == "bend") {
bendCoefficient = (float)llList2String(aList, 1);
reposition_all();
}
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,26 @@
<Project name="PrimSkirt Builder" guid="5bfc1b95-76e5-4983-bc59-0b9e602d8950">
<Object name="Pose Stand Base" guid="34042f08-dcc1-439f-b812-2ba34de70315" active="true">
<Notecard name="EULA.txt" guid="851564ec-7229-452c-b75b-a963eba870f6">
</Notecard>
<Notecard name="GNU License.txt" guid="b4f5712b-fcad-4788-b07c-5a95c831665d">
</Notecard>
<Notecard name="Intro" guid="939f1aad-abc5-4a9e-a1cc-09ef605f60d2">
</Notecard>
<Notecard name="Manual" guid="8b410c5d-d3dd-446b-bb90-a99aad6feb76">
</Notecard>
<Script name="Pose Stand Script.lsl" guid="271fb8d6-cd75-4416-8b03-aae7b71ea44c">
</Script>
<Object name="Prim" guid="d3163f53-e261-4765-8d01-c36baf26d04f">
</Object>
<Snapshot name="waist.png" guid="c6c33567-7ff4-4897-9c4b-4b22e6730422">
</Snapshot>
</Object>
<Object name="Primskirt builder control prim" guid="9e6cc9db-a50d-4500-9f07-e083ded3f717">
<Script name="positioning-control panel" guid="b3ea881a-e0e4-4d74-84e3-f325b450ba52">
</Script>
</Object>
<Object name="Waist size7-flare-bend control prim" guid="f51c2bbb-d4b0-4dbc-a25d-75179e0b5fe0">
<Script name="positioning-control square" guid="1b362759-70fe-4d26-91dc-b5119101f96d">
</Script>
</Object>
</Project>

View File

@@ -0,0 +1,767 @@
// :SHOW:
// :CATEGORY:Clothing
// :NAME:PrimSkirt Builder
// :AUTHOR:Dalien Talbot
// :KEYWORDS:
// :CREATED:2015-03-17 10:44:16
// :EDITED:2015-03-17 09:44:16
// :ID:1075
// :NUM:1740
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// PrimSkirt Builder
// :CODE:
//
// Copyright (c) 2007 Dalien Talbot and few other folks thanks to whom this exists:
//
// Vint Falken, of course - the inspiration, pushing me to the idea, testing, and finding the software bugs :-)
// LSL wiki - the function reference
// Posing stand code - unknown author
// LoopRez v0.6, by Ged Larsen, 20 December 2006 - the math for placement of the skirt prims
//
// This work is distributed "as-is" with no warranty whatsoever.
//
//
// It is distributed under GPL license. Please have a look at the "EULA" and the "GNU License" notecards in the inventory
// to get familiar with the terms and conditions.
//
// All the derivatives of this work obviously have to comply with the GPL as well. Contact me (Dalien Talbot) if you require alternative licensing.
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// NOTE:
// Unless you know what you are doing, do NOT change anything below !
//
// The standard consulting fees mentioned in the manual will apply for the works on fixing the breakages :-)
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CONFIGURATION PARAMETERS, they get reset from the main script!!!
integer myNumber = 0; // number of the prim
vector standPos; // position of the mothership
integer numObjects = 12; // how many objects
float xRadius = .16; // ellipse x-axis radius in meters
float yRadius = .22; // ellipse y-axis radius in meters
float flareAngle = 45.0; // how many DEGREES the bottom of object will flare outwards, the "poof" factor
float bendCoefficient = 0.0; // makes a "saddle shape", bends DOWN this number of meters at extremes of X-axis
vector rotOffset = <0.0, 180.0, 0.0>; // rotation offset in DEGREES -- fixes the rotation of ALL objects; for flexi prims, often you will want <180.0, 0.0, 0.0>
vector posOffset = <0.0, 0.0, 1.0>; // position offset
string prompt = "Edit/move this prim\nto edit/move the skirt";
// linking permission acquired
integer miPermissionsAcquired = FALSE;
// current object being linked, when linked...
integer currObject = 0;
// idle counter - when it increments to 1000, we clean up the control prims.
integer idleCounter = 0;
////////////////////////////////////////////////////////////////////////////////
// No need to mess with anything below here
adjust_flare (vector currentPos, rotation currentRot, float flareAngle) {
float rotateAngle = flareAngle; // how much to rotate per iteration (in degrees)
rotation rot = currentRot;
vector scale = llGetScale(); // return the size of the object
vector offset = <0, 0, -scale.z/2>; // rotate the object around the center of its top
vector offsetPosition = <0, 0, -scale.z/2>; // the position should be that of the top
// the two values being the same is a bit coincidental..
vector euler = <0, -1*rotateAngle*DEG_TO_RAD, 0>; // delta rotation expressed as a vector in radians
rotation deltarot = llEuler2Rot(euler); // delta rotation expressed as a rotation
rotation newrot = deltarot * rot; // new rotation for the object
vector vvv = offset * rot; // current offset of the rotation point vs. the prim center
vector vvv2 = offset * newrot; // new offset of the rotation point vs. the prim center
//vector currentPos = llGetPos(); // current position
//vector rotPoint = llGetPos() + vvv; // current rotation point, not needed except for visualization
vector newPos; // new position for the prim
newPos = currentPos + (vvv - vvv2); // is a current position offsetted by a difference between the rotation point offsets
//llRezObject("ball", rotPoint, ZERO_VECTOR, ZERO_ROTATION, 0); // visualize the rotation point
// now we also need to adjust the position - so that the top is always at the same place..
// the position that we have got is calculated for the center of the prim.
newPos = newPos + offsetPosition;
llSetPos(newPos); // set the new position
llSetRot(newrot); // and the new rotation
}
makeLoop(integer n, vector standPos, integer numObjects, float xRadius, float yRadius,
float flareAngle, float bendCoefficient, vector rotOffset, vector posOffset)
{
//integer n; // which object is being placed
float theta; // angle in radians
vector pos; // position
rotation rot; // rotation in quaternion format
//for(n = 0; n < numObjects; n++) {
theta = TWO_PI * ( (float)n / (float)numObjects );
pos.x = xRadius * llCos(theta); // ellipse: 2x xRadius meters wide
pos.y = yRadius * llSin(theta); // ellipse: 2x yRadius meters wide
pos.z = -bendCoefficient*llCos(theta)*llCos(theta); // saddle shape, bending downwards on X-axis
pos = pos + standPos + posOffset;
rot = llEuler2Rot(<rotOffset.x*DEG_TO_RAD, rotOffset.y*DEG_TO_RAD, rotOffset.z*DEG_TO_RAD>); // user-chosen rotation offset correction
// the following make the objects face outwards properly for an ellipse; using theta alone is only correct for a circle
// the scary formula calculates a unit vector TANGENTIAL to the ellipse, and llRotBetween is used to figure out how much the object needs to rotate to lie parallel to the tangent
rot = rot * llRotBetween(<0.0,1.0,0.0>, <-1.0 * xRadius * llSin(theta) / ( llSqrt ( (yRadius*yRadius * llCos(theta) * llCos(theta)) + (xRadius*xRadius * llSin(theta) * llSin(theta))) ),yRadius * llCos(theta) / ( llSqrt ( (yRadius*yRadius * llCos(theta) * llCos(theta)) + (xRadius*xRadius * llSin(theta) * llSin(theta))) ),0.0>);
if ( n== (numObjects/2) ) // LSL's implementation of llRotBetween at theta = pi radians is reversed at 180 degrees, so this manually corrects it
rot = rot * llEuler2Rot( <0,PI,0> );
//rot = rot * llEuler2Rot(<0, -1*flareAngle*DEG_TO_RAD, 0>); // flare generation (poof)
//llRezObject(objectName, pos, ZERO_VECTOR, rot, 0);
//llSetPos(pos);
//llSetRot(rot);
// it will rotate the pieces and set their positions...
adjust_flare(pos, rot, flareAngle);
//}
}
// are we a control prim (texture/shape/etc.) ?
integer isControlPrim = 0;
// a ball for skirt linkage
integer isLinkCenterPrim = 0;
// are we a geometry control prim (xradius/yradius/flare/z) ?
integer isGeomControlPrim = 0;
// how much the "real" waist size is different from the geometry control prim
float waistSizeDivizor = 5.0;
integer listenHandle = 0;
integer listenHandle2 = 0;
integer commChannelBase = 0;
position_geometry_prim()
{
rotation rot = llEuler2Rot(<0., flareAngle * DEG_TO_RAD, 0. >);
vector scale;
scale.x = 0.01 + bendCoefficient;
scale.y = yRadius * waistSizeDivizor;
scale.z = xRadius * waistSizeDivizor;
llSetRot(rot);
llSetScale(scale);
}
new_position()
{
// do the fancy math foobar only for the "normal" prims
if ( (isControlPrim + isLinkCenterPrim + isGeomControlPrim) == 0) {
makeLoop(myNumber, standPos, numObjects, xRadius, yRadius, flareAngle, bendCoefficient, rotOffset, posOffset);
}
if (isLinkCenterPrim) {
// link center prim will need to be in the center (surprise surprize!)
// since the Z is actually the top of the prims,
// nothing much more to be done here
// we position it here, since it needs to move with the "normal" prims.
vector linkerPos = standPos + posOffset;
llSetPos(linkerPos);
}
}
position_master_prim()
{
rotation rot;
vector rotOffset = <180.,0.,0.>;
rot = llEuler2Rot(<rotOffset.x*DEG_TO_RAD, rotOffset.y*DEG_TO_RAD, rotOffset.z*DEG_TO_RAD>);
// flare angle belongs to the flare control...
//rot = rot * llEuler2Rot(<0, -1*flareAngle*DEG_TO_RAD, 0>);
llSetRot(rot);
}
//------------------ prim mod slave
setParams(list alist)
{
list res = [ ];
integer i;
integer len = llGetListLength(alist);
//string aStart = elapsed("");
//string aElapsed;
string token;
integer slen;
float f;
integer int;
// skip the first token - so start from 1
for(i=1; i<len; i++) {
token = llList2String(alist, i);
slen = llStringLength(token);
//llOwnerSay("i:" + (string)i + ", slen: " + (string)slen + ", '" + token + "'");
if (slen == 36) {
// for length of 36 we assume key
res = res + [ token ];
} else if (slen >= 30 && slen <= 33) {
// assume vector
res = res + (vector)token;
} else {
// assume integer or float
int = (integer)token;
if (token == (string) int) {
res = res + [ int ];
} else {
res = res + [ (float) token ];
}
}
}
//aElapsed = elapsed(aStart);
//llOwnerSay("result:" + llDumpList2String(res, ":"));
//llOwnerSay("Time taken: " + aElapsed);
llSetPrimitiveParams(res);
}
// ------------------------- prim mod master
list sideTextures = [ ];
list sideTexgen = [ ];
list sideColors = [ ];
list sideAlphas = [ ];
list tokens = [ ];
// saved position/rotation for the timer events
vector myLastPos;
vector myLastRot;
// the mask for the delayed update processing
// the values are similar to "mask" in the change event
integer mask = 0;
sendCommand(string cmd)
{
//llOwnerSay(cmd);
llSay(commChannelBase - 1, cmd);
}
resetSideCaches()
{
sideTextures = [ ];
sideTexgen = [ ];
sideColors = [ ];
sideAlphas = [ ];
}
checkTextures()
{
integer i;
integer num = llGetNumberOfSides();
list result = llGetPrimitiveParams( [ PRIM_TEXGEN, ALL_SIDES, PRIM_TEXTURE, ALL_SIDES ] );
list newTextures = [ ];
for(i=0;i<num; i++) {
list param = llList2List(result, num + i*4, num + i*4+3);
list currparam = llList2List(sideTextures, i*4, i*4+3);
integer currparam_len = llGetListLength(currparam);
if (currparam_len == 0 || llListFindList(param, currparam) == -1) {
tokens = tokens + [ PRIM_TEXTURE, i ] + param;
}
if (llList2Integer(result, i) != llList2Integer(sideTexgen, i)) {
tokens = tokens + [ PRIM_TEXGEN, i, llList2Integer(result, i) ];
}
}
sideTexgen = llList2List(result, 0, num - 1);
sideTextures = llList2List(result, num, -1);
//llOwnerSay("!checkTextures end");
}
checkColor()
{
integer i;
integer num = llGetNumberOfSides();
list newColors;
string cmd = "color";
for(i=0;i<num; i++) {
vector color = llGetColor(i);
newColors = newColors + [ color ];
if ((vector)llList2String(sideColors, i) != color) {
cmd = cmd + ":" + (string)i + ":" + (string)color;
}
}
sideColors = newColors;
sendCommand(cmd);
}
checkAlpha()
{
integer i;
integer num = llGetNumberOfSides();
list newAlphas;
string cmd = "alpha";
for(i=0;i<num; i++) {
float alpha = llGetAlpha(i);
newAlphas = newAlphas + [ alpha ];
if ((float)llList2String(sideAlphas, i) != alpha) {
cmd = cmd + ":" + (string)i + ":" + (string)alpha;
}
}
sideAlphas = newAlphas;
sendCommand(cmd);
}
checkShape()
{
list result = llGetPrimitiveParams([ PRIM_FLEXIBLE, PRIM_TYPE ]);
sendCommand("prim_params:" + llDumpList2String([ PRIM_TYPE ] + llList2List(result, 7, -1), ":"));
//tokens = tokens + [ PRIM_TYPE ] + llList2List(result, 7, -1) + [ PRIM_FLEXIBLE ] + llList2List(result, 0, 6);
tokens = tokens + [ PRIM_FLEXIBLE ] + llList2List(result, 0, 6);
}
checkScale()
{
vector scale = llGetScale();
vector scale0 = scale;
scale0.z = scale0.z - 0.01;
// workaround against the flex objects not rendering if z size not changed...
sendCommand("prim_params:" + llDumpList2String([ PRIM_SIZE, scale0 ], ":"));
tokens = tokens + [ PRIM_SIZE, scale ];
return;
}
// this function gets called from the timer, and fires up the commands to the
// other prims to adjust themselves
// the reason for calling it from timer is to make the processing
// a little bit lighter... (LSL's string/list parsing is a pain in the butt and
// is a main reason for slowness...)
check_changed()
{
if (isControlPrim) {
// prim's characteristics replicate to others
tokens = [ ];
if(mask & CHANGED_SHAPE){
// changing the prim type can change everything
checkShape();
mask = mask | CHANGED_COLOR | CHANGED_SCALE | CHANGED_TEXTURE;
}
if(mask & CHANGED_COLOR){
checkColor();
checkAlpha();
}
if(mask & CHANGED_TEXTURE){
checkTextures();
}
if(mask & CHANGED_SCALE){
checkScale();
}
if (llGetListLength(tokens) > 0) {
sendCommand("prim_params:" + llDumpList2String(tokens, ":"));
if (mask & CHANGED_SHAPE || mask & CHANGED_SCALE) {
// changing shapes involves recalculation of the position
sendCommand("reposition");
}
}
}
if(isGeomControlPrim) {
// z scale = xradius
// y scale = yradius
// y axis tilt (handled elsewhere) = flare
// x scale - 0.01 = bend coefficient
vector scale = llGetScale();
scale.x = scale.x - 0.01;
scale.y = scale.y / waistSizeDivizor;
scale.z = scale.z / waistSizeDivizor;
if(mask & CHANGED_SCALE) {
llSay(commChannelBase, "geometry:" + (string)scale);
}
}
// reset all the changed notifications - we've done what we had to do...
mask = 0;
}
restart_timer()
{
// stop the timer and restart it
llSetTimerEvent(0.);
llSetTimerEvent(1.);
}
// ugggly hack - but since i am reusing the list of global vars...
set_globals_from_list(list aList, integer i)
{
standPos = (vector)llList2String(aList, i); i=i+1;
numObjects = llList2Integer(aList, i); i=i+1;
xRadius = llList2Float(aList, i); i=i+1;
yRadius = llList2Float(aList, i); i=i+1;
flareAngle = llList2Float(aList, i); i=i+1;
bendCoefficient = llList2Float(aList, i); i=i+1;
rotOffset = (vector)llList2String(aList, i); i=i+1;
posOffset = (vector)llList2String(aList, i); i=i+1;
}
// tell child to tell back its id so we could link it...
ask_child_to_link()
{
llSay(commChannelBase + 1 + currObject, "link");
}
default
{
touch_start(integer channel)
{
// ask the stand prim to show the menu, and avoid the spam in the chat
if (commChannelBase != 0) {
if (llDetectedKey(0) == llGetOwner()) {
llSay(commChannelBase, "menu");
} else {
llInstantMessage(llDetectedKey(0), "Only owner can modify the skirt - get your free copy - right-click the posing stand and buy it for L$0");
}
}
}
on_rez(integer channel) {
if (channel == 0) {
if (llGetNumberOfPrims() > 1) {
// need to check if we are linked and if yes - then delete the script...
llRemoveInventory(llGetScriptName());
}
// if channel = 0 means we have been rezzed by the user - so do not do anything...
return;
}
commChannelBase = channel;
listenHandle = llListen(channel, "", "", "");
// request the boot parameters
llSay(channel, "boot");
}
run_time_permissions(integer parm)
{
if (parm & PERMISSION_CHANGE_LINKS)
{
//set permission flag
miPermissionsAcquired = TRUE;
// reset any pending events...
llSetTimerEvent(0);
// start the linking...
currObject = 0;
llOwnerSay("Linking will take some time, please be patient...");
ask_child_to_link();
} else {
llOwnerSay("ERROR: permission was not acquired, can not link...");
}
}
changed(integer changed_mask)
{
if ((changed_mask & CHANGED_LINK) && (!isLinkCenterPrim) && (!isControlPrim) && (!isGeomControlPrim) ) {
if (llGetNumberOfPrims() > 1) {
// need to check if we are linked and if yes - then delete the script...
// the link centre prim will remove the script from itself,
// either on next rez, or when it finishes linking us.
llRemoveInventory(llGetScriptName());
}
} else {
if (isControlPrim || isGeomControlPrim) {
// set the appropriate flags
// so that timer event would fix it.
restart_timer();
mask = mask | changed_mask;
}
}
}
timer() {
idleCounter = idleCounter + 1;
if (isControlPrim || isGeomControlPrim) {
if (idleCounter > 1000) {
// the stand is gone and did not remind about itself... go away then.
llOwnerSay("Did not hear from the stand - so it must have been taken away - self-destroying...");
llDie();
}
} else {
if (idleCounter > 20) {
// the stand is gone and did not remind about itself... go away then.
llOwnerSay("Did not hear from the stand - so it must have been taken away - self-destroying...");
llDie();
}
}
if (isControlPrim) {
// control prim
vector myCurrentPos = llGetPos();
vector delta = myCurrentPos - myLastPos;
if ( (mask & CHANGED_SCALE) == 0) {
// if both the scale AND position is changed - do not move
// since when the scale changes via the mouse, the center drifts away...
if (llVecDist(myLastPos, myCurrentPos) > 0) {
llSay(commChannelBase, "move:" + (string)delta);
//llOwnerSay("moved!");
}
}
myLastPos = myCurrentPos;
}
if (isGeomControlPrim) {
// geometry control prim - check the tilt, the scale is checked elsewhere
vector myCurrentRot = llRot2Euler(llGetRot());
if (llVecDist(myLastRot, myCurrentRot) > 0) {
llSay(commChannelBase, "flare:" + (string)(myCurrentRot.y / DEG_TO_RAD));
}
myLastRot = myCurrentRot;
}
if (mask != 0) {
// naive attempt at optimization...
check_changed();
}
}
listen(integer channel, string name, key id, string message)
{
integer i = 1; // first parameter;
//llOwnerSay("message: '" + message + "'");
if (channel == commChannelBase) {
// init string
// init:myNumber:boot_string
// where boot string is:
// [myPos, numObjects, xRadius, yRadius, flareAngle, bendCoefficient, rotOffset, posOffset]
list aList = llParseString2List(message, [":"], []);
if (llList2String(aList, 0) == "init") {
llListenRemove(listenHandle);
myNumber = llList2Integer(aList, i); i=i+1;
llSetObjectName((string)myNumber);
// object number ranges from 0 to numObjects-1
// if we have got the number "numObjects" then we are the "control" prim - should not react to position change requests.
// start listening for mothership only
listenHandle = llListen(commChannelBase + 1 + myNumber, "", "", "");
listenHandle = llListen(commChannelBase - 1, "", "", "");
// report back to mothership that we are ok to fly on our own so it continues to generate the prims
llSay(commChannelBase, "init_ok");
// set the global parameters from the list
set_globals_from_list(aList, i);
isControlPrim = 0;
isLinkCenterPrim = 0;
isGeomControlPrim = 0;
// set the keepalive timer for the precaution self-destruction
// in the skirt prims - for the special prims the timer will be faster...
llSetTimerEvent(120);
if (myNumber == -10) {
// control prim - change its appearance and it replicates...
isControlPrim = 1;
llSetObjectName("Primskirt builder control prim");
llSetText(prompt, <0., 1., 0.>, 1.0);
position_master_prim();
myLastPos = llGetPos();
// for move/rotate and delayed prim replication
restart_timer();
} else if (myNumber == -11) {
// link center prim - a ball to use as a root for the skirt
isLinkCenterPrim = 1;
llSetObjectName("Prim Skirt");
} else if (myNumber == -12) {
// geometry control prim
isGeomControlPrim = 1;
llSetObjectName("Waist size/flare/bend control prim");
llSetText("X size: bend\nY size: yradius\nZ size: xradius\nY rotate: flare", <0., 1., 0.>, 1.0);
// the new position
position_geometry_prim();
}
// notify the owner (debug)
//llOwnerSay("got:" + llDumpList2String([myNumber, standPos, numObjects, xRadius, yRadius, flareAngle, bendCoefficient, rotOffset, posOffset], ":"));
// and position ourselves properly
new_position();
} else {
llOwnerSay("Unknown init message:'" + message + "'");
}
} else {
// control messages from the mothership or the control prim
list aList = llParseString2List(message, [":"], []);
string command = llList2String(aList, 0);
integer len = llGetListLength(aList);
integer i = 1;
// reset the idle counter
idleCounter = 0;
if (command == "echo") {
// reply to those that care
llSay(commChannelBase, "echo_reply");
} else if (command == "die") {
llDie();
} else if (isControlPrim == 1) {
// do not respond to change position and all
if (command == "repost") {
// we need to push the prim characteristics
mask = mask | CHANGED_SHAPE | CHANGED_COLOR | CHANGED_SCALE | CHANGED_TEXTURE;
resetSideCaches();
restart_timer();
}
} else if (isGeomControlPrim == 1) {
// only allow to modify the shape
// special kind of prim_params
if (command == "gc_prim_params") {
setParams(aList);
} else if (command == "bulk") {
// "bulk" is essentially the same as init, except "myNumber" is not sent.
set_globals_from_list(aList, i);
// position sets the box according to current parameters
new_position();
} else if (command == "repost") {
// we need to push the prim characteristics
mask = mask | CHANGED_SHAPE | CHANGED_COLOR | CHANGED_SCALE | CHANGED_TEXTURE;
myLastRot = myLastRot * <1.,1.,1.,0.5>; // just to "touch" the rotation so timer updates the things
restart_timer();
}
} else if (isLinkCenterPrim == 1) {
if (command == "die_skirt") {
// only the ball and the skirt prims obey this
llDie();
} else if (command == "bulk") {
// bulk works for linkcenter too, but most of it is ignored in processing...
set_globals_from_list(aList, i);
// and position ourselves properly
new_position();
} else if (command == "lc_prim_params") {
// special kind of prim_params
setParams(aList);
} else if (command == "link") {
llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS);
} else if (command == "linkme") {
// someone wants to be linked...
//llOwnerSay("linkme rcvd!");
if (miPermissionsAcquired) {
integer num = currObject + 1;
llOwnerSay("Linking prim " + (string)num + " of " + (string)numObjects + ", please wait...");
llCreateLink(id, TRUE);
currObject = currObject + 1;
if (currObject < numObjects) {
ask_child_to_link();
} else {
vector pos = llGetPos() + <-1.0, 1.0, 0.0>;
llSetPos(pos);
llOwnerSay("Finished linking, please pick up your skirt!");
llOwnerSay("If you enjoy using this tool, feel free to tip the creator Dalien Talbot according to the level of your enjoyment :-)");
// clean up the script...
llRemoveInventory(llGetScriptName());
}
} else {
llOwnerSay("ERROR: permissions not acquired, can not link...");
}
}
} else {
if (command == "die_skirt") {
// only the ball and the skirt prims obey this
llDie();
} else if (command == "link") {
// kind of echo, but for linking...
llSay(commChannelBase + 1 - 11, "linkme");
//llOwnerSay("linkme!");
} else if (command == "bulk") {
// "bulk" is essentially the same as init, except "myNumber" is not sent.
set_globals_from_list(aList, i);
// notify the owner (debug)
//llOwnerSay("got:" + llDumpList2String([myNumber, standPos, numObjects, xRadius, yRadius, flareAngle, bendCoefficient, rotOffset, posOffset], ":"));
// and position ourselves properly
new_position();
} else if (command == "prim_params") {
setParams(aList);
} else if (command == "reposition") {
new_position();
} else if (command == "scale") {
vector scale = (vector)llList2String(aList, 1);
llSetScale(scale);
} else if (command == "color") {
while(i < len) {
integer side = (integer)llList2String(aList, i);
vector color = (vector)llList2String(aList, i+1);
llSetColor(color, side);
i = i+2;
}
} else if (command == "alpha") {
while(i < len) {
integer side = (integer)llList2String(aList, i);
float alpha = (float)llList2String(aList, i+1);
llSetAlpha(alpha, side);
i = i+2;
}
}
}
}
}
}

View File

@@ -0,0 +1,768 @@
// :SHOW:
// :CATEGORY:Clothing
// :NAME:PrimSkirt Builder
// :AUTHOR:Dalien Talbot
// :KEYWORDS:
// :CREATED:2015-03-17 10:44:29
// :EDITED:2015-03-17 09:44:29
// :ID:1075
// :NUM:1741
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// PrimSkirt Builder
// :CODE:
// Prim size .010 X .350 X .250
// add textures with circle
//
// Copyright (c) 2007 Dalien Talbot and few other folks thanks to whom this exists:
//
// Vint Falken, of course - the inspiration, pushing me to the idea, testing, and finding the software bugs :-)
// LSL wiki - the function reference
// Posing stand code - unknown author
// LoopRez v0.6, by Ged Larsen, 20 December 2006 - the math for placement of the skirt prims
//
// This work is distributed "as-is" with no warranty whatsoever.
//
//
// It is distributed under GPL license. Please have a look at the "EULA" and the "GNU License" notecards in the inventory
// to get familiar with the terms and conditions.
//
// All the derivatives of this work obviously have to comply with the GPL as well. Contact me (Dalien Talbot) if you require alternative licensing.
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// NOTE:
// Unless you know what you are doing, do NOT change anything below !
//
// The standard consulting fees mentioned in the manual will apply for the works on fixing the breakages :-)
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CONFIGURATION PARAMETERS, they get reset from the main script!!!
integer myNumber = 0; // number of the prim
vector standPos; // position of the mothership
integer numObjects = 12; // how many objects
float xRadius = .16; // ellipse x-axis radius in meters
float yRadius = .22; // ellipse y-axis radius in meters
float flareAngle = 45.0; // how many DEGREES the bottom of object will flare outwards, the "poof" factor
float bendCoefficient = 0.0; // makes a "saddle shape", bends DOWN this number of meters at extremes of X-axis
vector rotOffset = <0.0, 180.0, 0.0>; // rotation offset in DEGREES -- fixes the rotation of ALL objects; for flexi prims, often you will want <180.0, 0.0, 0.0>
vector posOffset = <0.0, 0.0, 1.0>; // position offset
string prompt = "Edit/move this prim\nto edit/move the skirt";
// linking permission acquired
integer miPermissionsAcquired = FALSE;
// current object being linked, when linked...
integer currObject = 0;
// idle counter - when it increments to 1000, we clean up the control prims.
integer idleCounter = 0;
////////////////////////////////////////////////////////////////////////////////
// No need to mess with anything below here
adjust_flare (vector currentPos, rotation currentRot, float flareAngle) {
float rotateAngle = flareAngle; // how much to rotate per iteration (in degrees)
rotation rot = currentRot;
vector scale = llGetScale(); // return the size of the object
vector offset = <0, 0, -scale.z/2>; // rotate the object around the center of its top
vector offsetPosition = <0, 0, -scale.z/2>; // the position should be that of the top
// the two values being the same is a bit coincidental..
vector euler = <0, -1*rotateAngle*DEG_TO_RAD, 0>; // delta rotation expressed as a vector in radians
rotation deltarot = llEuler2Rot(euler); // delta rotation expressed as a rotation
rotation newrot = deltarot * rot; // new rotation for the object
vector vvv = offset * rot; // current offset of the rotation point vs. the prim center
vector vvv2 = offset * newrot; // new offset of the rotation point vs. the prim center
//vector currentPos = llGetPos(); // current position
//vector rotPoint = llGetPos() + vvv; // current rotation point, not needed except for visualization
vector newPos; // new position for the prim
newPos = currentPos + (vvv - vvv2); // is a current position offsetted by a difference between the rotation point offsets
//llRezObject("ball", rotPoint, ZERO_VECTOR, ZERO_ROTATION, 0); // visualize the rotation point
// now we also need to adjust the position - so that the top is always at the same place..
// the position that we have got is calculated for the center of the prim.
newPos = newPos + offsetPosition;
llSetPos(newPos); // set the new position
llSetRot(newrot); // and the new rotation
}
makeLoop(integer n, vector standPos, integer numObjects, float xRadius, float yRadius,
float flareAngle, float bendCoefficient, vector rotOffset, vector posOffset)
{
//integer n; // which object is being placed
float theta; // angle in radians
vector pos; // position
rotation rot; // rotation in quaternion format
//for(n = 0; n < numObjects; n++) {
theta = TWO_PI * ( (float)n / (float)numObjects );
pos.x = xRadius * llCos(theta); // ellipse: 2x xRadius meters wide
pos.y = yRadius * llSin(theta); // ellipse: 2x yRadius meters wide
pos.z = -bendCoefficient*llCos(theta)*llCos(theta); // saddle shape, bending downwards on X-axis
pos = pos + standPos + posOffset;
rot = llEuler2Rot(<rotOffset.x*DEG_TO_RAD, rotOffset.y*DEG_TO_RAD, rotOffset.z*DEG_TO_RAD>); // user-chosen rotation offset correction
// the following make the objects face outwards properly for an ellipse; using theta alone is only correct for a circle
// the scary formula calculates a unit vector TANGENTIAL to the ellipse, and llRotBetween is used to figure out how much the object needs to rotate to lie parallel to the tangent
rot = rot * llRotBetween(<0.0,1.0,0.0>, <-1.0 * xRadius * llSin(theta) / ( llSqrt ( (yRadius*yRadius * llCos(theta) * llCos(theta)) + (xRadius*xRadius * llSin(theta) * llSin(theta))) ),yRadius * llCos(theta) / ( llSqrt ( (yRadius*yRadius * llCos(theta) * llCos(theta)) + (xRadius*xRadius * llSin(theta) * llSin(theta))) ),0.0>);
if ( n== (numObjects/2) ) // LSL's implementation of llRotBetween at theta = pi radians is reversed at 180 degrees, so this manually corrects it
rot = rot * llEuler2Rot( <0,PI,0> );
//rot = rot * llEuler2Rot(<0, -1*flareAngle*DEG_TO_RAD, 0>); // flare generation (poof)
//llRezObject(objectName, pos, ZERO_VECTOR, rot, 0);
//llSetPos(pos);
//llSetRot(rot);
// it will rotate the pieces and set their positions...
adjust_flare(pos, rot, flareAngle);
//}
}
// are we a control prim (texture/shape/etc.) ?
integer isControlPrim = 0;
// a ball for skirt linkage
integer isLinkCenterPrim = 0;
// are we a geometry control prim (xradius/yradius/flare/z) ?
integer isGeomControlPrim = 0;
// how much the "real" waist size is different from the geometry control prim
float waistSizeDivizor = 5.0;
integer listenHandle = 0;
integer listenHandle2 = 0;
integer commChannelBase = 0;
position_geometry_prim()
{
rotation rot = llEuler2Rot(<0., flareAngle * DEG_TO_RAD, 0. >);
vector scale;
scale.x = 0.01 + bendCoefficient;
scale.y = yRadius * waistSizeDivizor;
scale.z = xRadius * waistSizeDivizor;
llSetRot(rot);
llSetScale(scale);
}
new_position()
{
// do the fancy math foobar only for the "normal" prims
if ( (isControlPrim + isLinkCenterPrim + isGeomControlPrim) == 0) {
makeLoop(myNumber, standPos, numObjects, xRadius, yRadius, flareAngle, bendCoefficient, rotOffset, posOffset);
}
if (isLinkCenterPrim) {
// link center prim will need to be in the center (surprise surprize!)
// since the Z is actually the top of the prims,
// nothing much more to be done here
// we position it here, since it needs to move with the "normal" prims.
vector linkerPos = standPos + posOffset;
llSetPos(linkerPos);
}
}
position_master_prim()
{
rotation rot;
vector rotOffset = <180.,0.,0.>;
rot = llEuler2Rot(<rotOffset.x*DEG_TO_RAD, rotOffset.y*DEG_TO_RAD, rotOffset.z*DEG_TO_RAD>);
// flare angle belongs to the flare control...
//rot = rot * llEuler2Rot(<0, -1*flareAngle*DEG_TO_RAD, 0>);
llSetRot(rot);
}
//------------------ prim mod slave
setParams(list alist)
{
list res = [ ];
integer i;
integer len = llGetListLength(alist);
//string aStart = elapsed("");
//string aElapsed;
string token;
integer slen;
float f;
integer int;
// skip the first token - so start from 1
for(i=1; i<len; i++) {
token = llList2String(alist, i);
slen = llStringLength(token);
//llOwnerSay("i:" + (string)i + ", slen: " + (string)slen + ", '" + token + "'");
if (slen == 36) {
// for length of 36 we assume key
res = res + [ token ];
} else if (slen >= 30 && slen <= 33) {
// assume vector
res = res + (vector)token;
} else {
// assume integer or float
int = (integer)token;
if (token == (string) int) {
res = res + [ int ];
} else {
res = res + [ (float) token ];
}
}
}
//aElapsed = elapsed(aStart);
//llOwnerSay("result:" + llDumpList2String(res, ":"));
//llOwnerSay("Time taken: " + aElapsed);
llSetPrimitiveParams(res);
}
// ------------------------- prim mod master
list sideTextures = [ ];
list sideTexgen = [ ];
list sideColors = [ ];
list sideAlphas = [ ];
list tokens = [ ];
// saved position/rotation for the timer events
vector myLastPos;
vector myLastRot;
// the mask for the delayed update processing
// the values are similar to "mask" in the change event
integer mask = 0;
sendCommand(string cmd)
{
//llOwnerSay(cmd);
llSay(commChannelBase - 1, cmd);
}
resetSideCaches()
{
sideTextures = [ ];
sideTexgen = [ ];
sideColors = [ ];
sideAlphas = [ ];
}
checkTextures()
{
integer i;
integer num = llGetNumberOfSides();
list result = llGetPrimitiveParams( [ PRIM_TEXGEN, ALL_SIDES, PRIM_TEXTURE, ALL_SIDES ] );
list newTextures = [ ];
for(i=0;i<num; i++) {
list param = llList2List(result, num + i*4, num + i*4+3);
list currparam = llList2List(sideTextures, i*4, i*4+3);
integer currparam_len = llGetListLength(currparam);
if (currparam_len == 0 || llListFindList(param, currparam) == -1) {
tokens = tokens + [ PRIM_TEXTURE, i ] + param;
}
if (llList2Integer(result, i) != llList2Integer(sideTexgen, i)) {
tokens = tokens + [ PRIM_TEXGEN, i, llList2Integer(result, i) ];
}
}
sideTexgen = llList2List(result, 0, num - 1);
sideTextures = llList2List(result, num, -1);
//llOwnerSay("!checkTextures end");
}
checkColor()
{
integer i;
integer num = llGetNumberOfSides();
list newColors;
string cmd = "color";
for(i=0;i<num; i++) {
vector color = llGetColor(i);
newColors = newColors + [ color ];
if ((vector)llList2String(sideColors, i) != color) {
cmd = cmd + ":" + (string)i + ":" + (string)color;
}
}
sideColors = newColors;
sendCommand(cmd);
}
checkAlpha()
{
integer i;
integer num = llGetNumberOfSides();
list newAlphas;
string cmd = "alpha";
for(i=0;i<num; i++) {
float alpha = llGetAlpha(i);
newAlphas = newAlphas + [ alpha ];
if ((float)llList2String(sideAlphas, i) != alpha) {
cmd = cmd + ":" + (string)i + ":" + (string)alpha;
}
}
sideAlphas = newAlphas;
sendCommand(cmd);
}
checkShape()
{
list result = llGetPrimitiveParams([ PRIM_FLEXIBLE, PRIM_TYPE ]);
sendCommand("prim_params:" + llDumpList2String([ PRIM_TYPE ] + llList2List(result, 7, -1), ":"));
//tokens = tokens + [ PRIM_TYPE ] + llList2List(result, 7, -1) + [ PRIM_FLEXIBLE ] + llList2List(result, 0, 6);
tokens = tokens + [ PRIM_FLEXIBLE ] + llList2List(result, 0, 6);
}
checkScale()
{
vector scale = llGetScale();
vector scale0 = scale;
scale0.z = scale0.z - 0.01;
// workaround against the flex objects not rendering if z size not changed...
sendCommand("prim_params:" + llDumpList2String([ PRIM_SIZE, scale0 ], ":"));
tokens = tokens + [ PRIM_SIZE, scale ];
return;
}
// this function gets called from the timer, and fires up the commands to the
// other prims to adjust themselves
// the reason for calling it from timer is to make the processing
// a little bit lighter... (LSL's string/list parsing is a pain in the butt and
// is a main reason for slowness...)
check_changed()
{
if (isControlPrim) {
// prim's characteristics replicate to others
tokens = [ ];
if(mask & CHANGED_SHAPE){
// changing the prim type can change everything
checkShape();
mask = mask | CHANGED_COLOR | CHANGED_SCALE | CHANGED_TEXTURE;
}
if(mask & CHANGED_COLOR){
checkColor();
checkAlpha();
}
if(mask & CHANGED_TEXTURE){
checkTextures();
}
if(mask & CHANGED_SCALE){
checkScale();
}
if (llGetListLength(tokens) > 0) {
sendCommand("prim_params:" + llDumpList2String(tokens, ":"));
if (mask & CHANGED_SHAPE || mask & CHANGED_SCALE) {
// changing shapes involves recalculation of the position
sendCommand("reposition");
}
}
}
if(isGeomControlPrim) {
// z scale = xradius
// y scale = yradius
// y axis tilt (handled elsewhere) = flare
// x scale - 0.01 = bend coefficient
vector scale = llGetScale();
scale.x = scale.x - 0.01;
scale.y = scale.y / waistSizeDivizor;
scale.z = scale.z / waistSizeDivizor;
if(mask & CHANGED_SCALE) {
llSay(commChannelBase, "geometry:" + (string)scale);
}
}
// reset all the changed notifications - we've done what we had to do...
mask = 0;
}
restart_timer()
{
// stop the timer and restart it
llSetTimerEvent(0.);
llSetTimerEvent(1.);
}
// ugggly hack - but since i am reusing the list of global vars...
set_globals_from_list(list aList, integer i)
{
standPos = (vector)llList2String(aList, i); i=i+1;
numObjects = llList2Integer(aList, i); i=i+1;
xRadius = llList2Float(aList, i); i=i+1;
yRadius = llList2Float(aList, i); i=i+1;
flareAngle = llList2Float(aList, i); i=i+1;
bendCoefficient = llList2Float(aList, i); i=i+1;
rotOffset = (vector)llList2String(aList, i); i=i+1;
posOffset = (vector)llList2String(aList, i); i=i+1;
}
// tell child to tell back its id so we could link it...
ask_child_to_link()
{
llSay(commChannelBase + 1 + currObject, "link");
}
default
{
touch_start(integer channel)
{
// ask the stand prim to show the menu, and avoid the spam in the chat
if (commChannelBase != 0) {
if (llDetectedKey(0) == llGetOwner()) {
llSay(commChannelBase, "menu");
} else {
llInstantMessage(llDetectedKey(0), "Only owner can modify the skirt - get your free copy - right-click the posing stand and buy it for L$0");
}
}
}
on_rez(integer channel) {
if (channel == 0) {
if (llGetNumberOfPrims() > 1) {
// need to check if we are linked and if yes - then delete the script...
llRemoveInventory(llGetScriptName());
}
// if channel = 0 means we have been rezzed by the user - so do not do anything...
return;
}
commChannelBase = channel;
listenHandle = llListen(channel, "", "", "");
// request the boot parameters
llSay(channel, "boot");
}
run_time_permissions(integer parm)
{
if (parm & PERMISSION_CHANGE_LINKS)
{
//set permission flag
miPermissionsAcquired = TRUE;
// reset any pending events...
llSetTimerEvent(0);
// start the linking...
currObject = 0;
llOwnerSay("Linking will take some time, please be patient...");
ask_child_to_link();
} else {
llOwnerSay("ERROR: permission was not acquired, can not link...");
}
}
changed(integer changed_mask)
{
if ((changed_mask & CHANGED_LINK) && (!isLinkCenterPrim) && (!isControlPrim) && (!isGeomControlPrim) ) {
if (llGetNumberOfPrims() > 1) {
// need to check if we are linked and if yes - then delete the script...
// the link centre prim will remove the script from itself,
// either on next rez, or when it finishes linking us.
llRemoveInventory(llGetScriptName());
}
} else {
if (isControlPrim || isGeomControlPrim) {
// set the appropriate flags
// so that timer event would fix it.
restart_timer();
mask = mask | changed_mask;
}
}
}
timer() {
idleCounter = idleCounter + 1;
if (isControlPrim || isGeomControlPrim) {
if (idleCounter > 1000) {
// the stand is gone and did not remind about itself... go away then.
llOwnerSay("Did not hear from the stand - so it must have been taken away - self-destroying...");
llDie();
}
} else {
if (idleCounter > 20) {
// the stand is gone and did not remind about itself... go away then.
llOwnerSay("Did not hear from the stand - so it must have been taken away - self-destroying...");
llDie();
}
}
if (isControlPrim) {
// control prim
vector myCurrentPos = llGetPos();
vector delta = myCurrentPos - myLastPos;
if ( (mask & CHANGED_SCALE) == 0) {
// if both the scale AND position is changed - do not move
// since when the scale changes via the mouse, the center drifts away...
if (llVecDist(myLastPos, myCurrentPos) > 0) {
llSay(commChannelBase, "move:" + (string)delta);
//llOwnerSay("moved!");
}
}
myLastPos = myCurrentPos;
}
if (isGeomControlPrim) {
// geometry control prim - check the tilt, the scale is checked elsewhere
vector myCurrentRot = llRot2Euler(llGetRot());
if (llVecDist(myLastRot, myCurrentRot) > 0) {
llSay(commChannelBase, "flare:" + (string)(myCurrentRot.y / DEG_TO_RAD));
}
myLastRot = myCurrentRot;
}
if (mask != 0) {
// naive attempt at optimization...
check_changed();
}
}
listen(integer channel, string name, key id, string message)
{
integer i = 1; // first parameter;
//llOwnerSay("message: '" + message + "'");
if (channel == commChannelBase) {
// init string
// init:myNumber:boot_string
// where boot string is:
// [myPos, numObjects, xRadius, yRadius, flareAngle, bendCoefficient, rotOffset, posOffset]
list aList = llParseString2List(message, [":"], []);
if (llList2String(aList, 0) == "init") {
llListenRemove(listenHandle);
myNumber = llList2Integer(aList, i); i=i+1;
llSetObjectName((string)myNumber);
// object number ranges from 0 to numObjects-1
// if we have got the number "numObjects" then we are the "control" prim - should not react to position change requests.
// start listening for mothership only
listenHandle = llListen(commChannelBase + 1 + myNumber, "", "", "");
listenHandle = llListen(commChannelBase - 1, "", "", "");
// report back to mothership that we are ok to fly on our own so it continues to generate the prims
llSay(commChannelBase, "init_ok");
// set the global parameters from the list
set_globals_from_list(aList, i);
isControlPrim = 0;
isLinkCenterPrim = 0;
isGeomControlPrim = 0;
// set the keepalive timer for the precaution self-destruction
// in the skirt prims - for the special prims the timer will be faster...
llSetTimerEvent(120);
if (myNumber == -10) {
// control prim - change its appearance and it replicates...
isControlPrim = 1;
llSetObjectName("Primskirt builder control prim");
llSetText(prompt, <0., 1., 0.>, 1.0);
position_master_prim();
myLastPos = llGetPos();
// for move/rotate and delayed prim replication
restart_timer();
} else if (myNumber == -11) {
// link center prim - a ball to use as a root for the skirt
isLinkCenterPrim = 1;
llSetObjectName("Prim Skirt");
} else if (myNumber == -12) {
// geometry control prim
isGeomControlPrim = 1;
llSetObjectName("Waist size/flare/bend control prim");
llSetText("X size: bend\nY size: yradius\nZ size: xradius\nY rotate: flare", <0., 1., 0.>, 1.0);
// the new position
position_geometry_prim();
}
// notify the owner (debug)
//llOwnerSay("got:" + llDumpList2String([myNumber, standPos, numObjects, xRadius, yRadius, flareAngle, bendCoefficient, rotOffset, posOffset], ":"));
// and position ourselves properly
new_position();
} else {
llOwnerSay("Unknown init message:'" + message + "'");
}
} else {
// control messages from the mothership or the control prim
list aList = llParseString2List(message, [":"], []);
string command = llList2String(aList, 0);
integer len = llGetListLength(aList);
integer i = 1;
// reset the idle counter
idleCounter = 0;
if (command == "echo") {
// reply to those that care
llSay(commChannelBase, "echo_reply");
} else if (command == "die") {
llDie();
} else if (isControlPrim == 1) {
// do not respond to change position and all
if (command == "repost") {
// we need to push the prim characteristics
mask = mask | CHANGED_SHAPE | CHANGED_COLOR | CHANGED_SCALE | CHANGED_TEXTURE;
resetSideCaches();
restart_timer();
}
} else if (isGeomControlPrim == 1) {
// only allow to modify the shape
// special kind of prim_params
if (command == "gc_prim_params") {
setParams(aList);
} else if (command == "bulk") {
// "bulk" is essentially the same as init, except "myNumber" is not sent.
set_globals_from_list(aList, i);
// position sets the box according to current parameters
new_position();
} else if (command == "repost") {
// we need to push the prim characteristics
mask = mask | CHANGED_SHAPE | CHANGED_COLOR | CHANGED_SCALE | CHANGED_TEXTURE;
myLastRot = myLastRot * <1.,1.,1.,0.5>; // just to "touch" the rotation so timer updates the things
restart_timer();
}
} else if (isLinkCenterPrim == 1) {
if (command == "die_skirt") {
// only the ball and the skirt prims obey this
llDie();
} else if (command == "bulk") {
// bulk works for linkcenter too, but most of it is ignored in processing...
set_globals_from_list(aList, i);
// and position ourselves properly
new_position();
} else if (command == "lc_prim_params") {
// special kind of prim_params
setParams(aList);
} else if (command == "link") {
llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS);
} else if (command == "linkme") {
// someone wants to be linked...
//llOwnerSay("linkme rcvd!");
if (miPermissionsAcquired) {
integer num = currObject + 1;
llOwnerSay("Linking prim " + (string)num + " of " + (string)numObjects + ", please wait...");
llCreateLink(id, TRUE);
currObject = currObject + 1;
if (currObject < numObjects) {
ask_child_to_link();
} else {
vector pos = llGetPos() + <-1.0, 1.0, 0.0>;
llSetPos(pos);
llOwnerSay("Finished linking, please pick up your skirt!");
llOwnerSay("If you enjoy using this tool, feel free to tip the creator Dalien Talbot according to the level of your enjoyment :-)");
// clean up the script...
llRemoveInventory(llGetScriptName());
}
} else {
llOwnerSay("ERROR: permissions not acquired, can not link...");
}
}
} else {
if (command == "die_skirt") {
// only the ball and the skirt prims obey this
llDie();
} else if (command == "link") {
// kind of echo, but for linking...
llSay(commChannelBase + 1 - 11, "linkme");
//llOwnerSay("linkme!");
} else if (command == "bulk") {
// "bulk" is essentially the same as init, except "myNumber" is not sent.
set_globals_from_list(aList, i);
// notify the owner (debug)
//llOwnerSay("got:" + llDumpList2String([myNumber, standPos, numObjects, xRadius, yRadius, flareAngle, bendCoefficient, rotOffset, posOffset], ":"));
// and position ourselves properly
new_position();
} else if (command == "prim_params") {
setParams(aList);
} else if (command == "reposition") {
new_position();
} else if (command == "scale") {
vector scale = (vector)llList2String(aList, 1);
llSetScale(scale);
} else if (command == "color") {
while(i < len) {
integer side = (integer)llList2String(aList, i);
vector color = (vector)llList2String(aList, i+1);
llSetColor(color, side);
i = i+2;
}
} else if (command == "alpha") {
while(i < len) {
integer side = (integer)llList2String(aList, i);
float alpha = (float)llList2String(aList, i+1);
llSetAlpha(alpha, side);
i = i+2;
}
}
}
}
}
}