Proposal: @getattachnames
There’s been some buzz about the extra attachment points that are now included in Emerald by default, particularly in how they relate to “force stripping”.
Personally I don’t think they’ll ever get all that much use since they’ll look wrong/silly to everyone who isn’t using Emerald and as soon as people figure that out the appeal of them drops significantly.
Whether or not people will end up using them doesn’t really matter though: at some point or another LL might officially add more attachment points (or clothing layers for that matter) and all the same problems will crop up then anyway so it would be better to try and figure out a way in which scripts can make themselves more “future-proof” now.
After peeking at several “force strip” dialogs most seem to fall into three categories:
- A list of all worn attachment point names spread across different dialogs
- A list of all worn attachment point names divided into categories
- A list of custom grouped attachment points (i.e. clicking “shoes” will force-detach l/r upper leg, l/r lower leg and l/r foot)
So a hypothetical @getattachnames[:<option>] would return a comma-separated list of attachment point names:
- Without an option it would return all worn attachment point names
- <option> could specify one of the pre-defined body areas (head, torso, arms, legs and HUD) and return all worn attachment point names on that area
- <option> could specify the joint name and return all worn attachment point names on that joint
(the “body areas” weren’t really chosen arbitrarily; they’re the same ones you see in the “Attach To” pie menu when you right-click on a rezzed linkset)
(<joint name> wouldn’t be particularly accurate in some cases – “r upper leg” is attached to the “mHipRight” joint along with “right hip” for instance – so it may or may not be a good idea to add that)
Practical example:
- @getattachnames=1
Skull,Left Foot,Right Foot,Spine,Left Ear,Right Ear,R Forearm,L Forearm,R Lower Leg,L Lower Leg,Top,Top Left,Center,Bottom Left,Bottom,Bottom Right - @getattachnames:head=1
Skull,Left Ear,Right Ear - @getattachnames:torso=1
Spine - @getattachnames:arms=1
R Forearm,L Forearm - @getattachnames:legs=1
Left Foot,Right Foot,R Lower Leg,L Lower Leg - @getattachnames:hud=1
Top,Top Left,Center,Bottom Left,Bottom,Bottom Right
—
Additionally @getattachnameswearable and @getattachnamesremovable could be added:
- @getattachnames returns the list of attachment point names that are worn
- @getattachnameswearable returns the list of attachment point names that can be attached to (which is any attachment point that doesn’t have a @remattach=n locked attachment *and* isn’t @addattach=n locked)
- @getattachnamesremovable returns the list of attachment point names that can be removed by the issuing prim (which is any worn attachment point that isn’t @remattach=n locked)
The reasoning for @getattachnamesremovable: it’s more intuitive for a “force strip” dialog to only show attachment points that can actually be force-detached by the script.
Practical examples (same as above – l/r forearm and l/r lower leg are @detach=n locked; Top and Bottom Right are “nostrip”):
- @getattachnamesremovable=1
Skull,Left Foot,Right Foot,Spine,Left Ear,Right Ear,Top Left,Center,Bottom Left,Bottom - @getattachnamesremovable:head=1
Skull,Left Ear,Right Ear
—
Finally: there’s the question of whether the script should be responsible for clearing its attachment locks or whether the viewer should just ignore them (the latter is how “Hide Locked Attachments” works).
Example:
- Collar executes: @detach=n,remattach=n
- Collar executes: @getattachnamesremovable=1
<empty response> since there isn’t a single attachment point that can be @detach[:<attachpt>]=force’d and actually end up detached - What the collar should have done was:
@remattach=y, getattachnamesremovable=1,remattach=n - And then later on:
@remattach=y, remattach:pelvis=force,remattach=n
It would be easy for the viewer to ignore any @detach[:<attachpt>] and @add/remattach[:<attachpt>] locks though which means it could just go:
- Collar executes: @detach=n,remattach=n
- Collar executes: @getattachnamesremovable=1
<full list of attachment points that be force-detached by the collar> - Collar executes: @remattach=y, remattach:pelvis=force,remattach=n
The collar script still needs to know that it should release its @remattach restriction when actually force-detaching but it’s a step in the right direction.
(Personally I think it would make the most sense for @remattach[:<attachpt>]=force to just only check *other* prims’ attachment locks which would mean that @remattach=n,remattach:pelvis=force would “just work” – on the condition that no other prim has “pelvis” locked obviously. It would certainly save scripts a whole lot of hassle)
—
In closing: this is a *proposal* rather than an announcement. Yes the code has already been written, but simply because it’s a lot easier for me to propose something when I know it’ll actually work
.
Even if LL decides to block non-standard attachment points with the next rolling restart there will still come a time when we either get new attachment points and/or get multiple attachments per attachment point index so it’s probably best to figure out a solution everyone is – relatively – happy with.
Even if we never get new attachment points it would relieve scripts from having to translate @getattach into a list of attachment point names (less code and no hard coded look-up list should free up some script memory)
Additionally the entire post can be done over for clothing layers: LL supposedly was/is working on extra tattoo layers so when/if we get those all existing scripts that rely on @getoutfit and their hard-coded list of layer names won’t be able to deal with those new layers without an update.
—
Additional thoughts:
- I personally prefer @getattachnames[:[<option>;][wearable|removable]=<channel> over three separate commands (basically making the suffix an additional and optional parameter)
- It might be preferable to fold attachment points together (i.e. Chest and Chest (2) and Chest 2 would all simply report as “Chest” one single time)
Wow, .. a big entry… so let me comment on what I can
I am 100% in favor of @getattachnames – while I, as a user, love the new attachment points I get with Emerald, I as a scripter have no good way of knowing what to do with those points. So, having the ability to get the names from the viewer and work with them is wonderful and solves a lot of my problems.
I’m also fully in favor of being able to get items by region of the body. This, too, will help me a lot as I already think in terms of regions. While I might have lobbied for different body areas, you’ve chosen the perfect solution in going for the names specified in the pie menu, which is a reasonable way to look at body areas and a perfect way to stop argument as to what should/should not be the body areas.
I *really* *really* *really* like the @getattachnameswearable and @getattachnamesremovable additions – shorter names would be nice, but.. OK! Will these also be by body area? E.g., @getattachnamesremovable:head=1 so that I can then have a list of removable attachments on the head? I hope so as that would be a really cool way to move forwards
This does leave me with another question, though! Can we have similar function for clothing layers? There are rumors of more clothing layers being offered and so it would be great if I can get those names (also by body area please) from the viewer. And… while I’m on the wishlist hunt… what about @getnonprimwearable and @getnonprimremovable (please come up with better names) that work like the @getattachnameswearable and @getattachnamesremovable commands.
On the additional thoughts… the option is fine – I don’t think it substantially changes anything I would do… and if it is easier to explain that way, then go for it. Though, if you do that it would be awkward if you satisfy my wishlist.. because then you’d have: @getattachnames:head:wearable which is fine, but unusual.
I’m in two minds about folding attachment points together. On the one hand, it would make my life *real* simple as I would just offer a menu item with respect to “chest” and then translate that into all appropriate points. So it would simplify things on the user menu side. On the other hand, I can see that through OOC means I could communicate which of the possible variations is the one to achieve a specific effect. E.g., “((Remove chest (2) to rip out my nipple rings))” or some such.
The final question, whether a prim should be responsible for clearing its own locks is really a matter of style. From a purist perspective, it should be. After all, the prim should know what it’s doing
. On the other hand, it would be really nice to be able to shortcut things (as space is tight and I can save a few bytes).
Thanks Kitty, I look forward to seeing this
Hugs
Chloe
The reason to go with the ones listed is that they’re already subdivided that way… more or less (each attachment point specifies a group index that it belongs to which ultimately determines where it will end up on the pie menu or what it will be grouped under).
As you noted it’s not ideal, but it certainly requires the least amount of effort viewer-side which is why I suggested it
.
Nothing is set in stone, least of all the names; but if I’m going to come up with a horrible name it might as well be descriptive
.
& The intent was to have any @getattachnames variant take the same kind of “body part” option, yesh
.
(Or additionally accept a joint name if there’s any desire for that)
I added it as a small comment since I didn’t want to double the post size but that was the idea: if there’s a consensus for attachment point names then it’s easy to just extend it to clothing layers as well
.
For consistency it’s probably best to use “getoutfitnames” (and derivatives) although I’d personally prefer “getlayernames” since “outfit” has a very different meaning in SL, especially when we’re getting a “My Outfits” folder in SL-2.0 (or whichever version of SL includes inventory shortcuts).
*nods* It’s primarily a “convenience” rather than something the viewer *has* to do, but in my personal experience very few scripts seem to bother or remember to unset/reset their restrictions which leads to a lot of user annoyance when things work counter-intuitively.
I.e. a lot of Dom(me)s restrict a sub from dressing/undressing but then don’t automatically realize that they also restricted their ability to strip/dress the sub as they please without first undoing the restriction (and remembering to re-set it afterwards).
My post will be fairly short, mostly because my work with the RLV api is limited at best. Reading through your post, Kitty, and Chloe’s response, I agree wholeheartedly. This will require lots of recoding of existing scripts to make things fully compatible, but it certainly is a small price to pay to save having to hard-code attachment points or clothing layers. The nice thing about this approach is it doesn’t break any existing scripts as is, though those scripts might also become less effective as the number of viewers on the grid which support multiple attachment points increases (especially if Linden would do us the honor of implementing this into the main tree).
I agree with the decision of having the viewer being the final word on clearing locks. Especially, since the viewer is in a better position to determine when something should be cleared (such as on a real detach) vs. not (like detach from an Enable Wear). Now if we could get folks to stop issuing a @clear on detach, we might solve the whole ‘collar doesn’t reattach itself on detach’ issue.