Skip to content

Commit 3243f94

Browse files
committed
Multi-Layer Update
1 parent 789646e commit 3243f94

8 files changed

+436
-247
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ Following features are supported:
7070
Multiple layers can be provided by wearing another body thats just slightly bigger on top of it like onion layers. The script for those layers is body-layers.lsl. It has to get SetUp exactly like the main script of the body by setting gs\_ident, gs\_alphaFilterMask and the texture list gl\_textureSets, just that the names for the textures are different like "tattoo-upper".
7171
The link order of the layers are supposed to be exactly like the main body, but a few differences can be remapped in the gl\_faceMapping list by entering the prim/face of the main body as integer and then the corespondending prim/face of the layer as string, like [10, "21"], which maps prim 1 face 0 of main body to prim 2 face 1 of the layer.
7272

73-
7473
## Autohide
7574
It shouldn't be the responsibility of the user to set his alphas right, the clothes themself should tell what alphas they need.
7675
For this, check out the autohide.lsl script.
7776

7877
## Texture HUD
79-
The texture-hud.lsl script is for an HUD for selecting textures, it can store as many textures as you want. It has 12 buttons per page, a model that is showing the selected textures and arrow buttons to browse through the textures.
78+
The texture-hud.lsl script is for an HUD for selecting textures, it can store as many textures as you want. It has 12 buttons per page, a model that is showing the selected textures and arrow buttons to browse through the textures. It has three Tabs for Skin, Tattoo and Clothes.
79+
Textures just have to get added into the inventory of the HUD with the right names, the script doesn't need to get changed.

src/body-layers.lsl

+6-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,12 @@ default
406406
integer i_found = llListFindList(gl_textureSets, [s_cmd]) + 1;
407407
if (i_found)
408408
{
409-
setTextureBase64(llList2String(gl_textureSets, i_found), s_uuid);
409+
string s_base64 = llList2String(gl_textureSets, i_found);
410+
setTextureBase64(s_base64, s_uuid);
411+
if (llKey2Name((key)s_uuid) == "transparent")
412+
{
413+
readBase64AlphaString(s_base64, 1, FALSE);
414+
}
410415
}
411416
}
412417
return;

src/clothes-hud.lsl

+58-18
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,24 @@ integer gi_curPage;
1212
//faces of model
1313
integer gi_modelLink = 18;
1414
integer gi_headFace = 1;
15-
integer gi_upperFace = 7;
16-
integer gi_lowerFace = 0;
17-
integer gi_tattooUpperFace = 6;
18-
integer gi_tattooLowerFace = 5;
15+
integer gi_upperFace = 2;
16+
integer gi_lowerFace = 3;
17+
integer gi_tattooUpperFace = 5;
18+
integer gi_tattooLowerFace = 6;
19+
integer gi_clothesUpperFace = 7;
20+
integer gi_clothesLowerFace = 0;
1921
integer gi_curSel;
2022
//channels
2123
integer gi_SkinChannel = -60;
2224
integer gi_SkinHUDChannel = -61;
25+
//transparent texture name
26+
string gs_transparentTextureName = "transparent";
2327
//Skin texture lists
2428
list gl_ident;
2529
//tmp
2630
integer gi_listenerSkinHUDChannel;
31+
key gk_curUpper;
32+
key gk_curLower;
2733

2834
drawButtons()
2935
{
@@ -72,18 +78,33 @@ drawButtons()
7278
}
7379
else
7480
{
75-
llSetLinkPrimitiveParamsFast(a + gi_buttonOffset, [PRIM_COLOR, gi_frontFace, <1.0, 1.0, 1.0>, 0.0, PRIM_TEXT, "", ZERO_VECTOR, 0.0]);
81+
llSetLinkPrimitiveParamsFast(a + gi_buttonOffset, [PRIM_TEXTURE, gi_frontFace, TEXTURE_BLANK, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0, PRIM_COLOR, gi_frontFace, <0.28, 0.28, 0.28>, 1.0, PRIM_TEXT, "", ZERO_VECTOR, 0.0]);
7682
}
7783
++a;
7884
}
7985
}
8086

87+
updateLayers()
88+
{
89+
if (llGetInventoryType(gs_transparentTextureName) == INVENTORY_TEXTURE)
90+
{
91+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_clothesUpperFace, gs_transparentTextureName, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
92+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_clothesLowerFace, gs_transparentTextureName, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
93+
gk_curUpper = (key)gs_transparentTextureName;
94+
gk_curLower = (key)gs_transparentTextureName;
95+
}
96+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, 4, "73c54d8e-18bc-4c2e-9861-b63092bc30ed", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
97+
llRegionSayTo(llGetOwner(), gi_SkinChannel, "gettexture");
98+
gi_listenerSkinHUDChannel = llListen(gi_SkinHUDChannel, "", "", "");
99+
llSetTimerEvent(3.0);
100+
}
101+
81102
default
82103
{
83104
state_entry()
84105
{
85106
//rotate model
86-
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_OMEGA, <0.0, 0.0, 1.0>, PI / -4, 1.0]);
107+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_OMEGA, <0.0, 0.0, 1.0>, PI / -4, 1.0, PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0]);
87108
//check textures in inventory and populate lists
88109
integer i_itemCount = llGetInventoryNumber(INVENTORY_TEXTURE);
89110
integer a = 0;
@@ -111,13 +132,12 @@ default
111132
gi_itemCount = llGetListLength(gl_ident);
112133
//draw buttons
113134
drawButtons();
135+
updateLayers();
114136
}
115137

116138
on_rez(integer num)
117139
{
118-
llRegionSayTo(llGetOwner(), gi_SkinChannel, "gettexture");
119-
gi_listenerSkinHUDChannel = llListen(gi_SkinHUDChannel, "", "", "");
120-
llSetTimerEvent(3.0);
140+
updateLayers();
121141
}
122142

123143
timer()
@@ -134,7 +154,7 @@ default
134154
}
135155
list l_msgList = llParseString2List(message, [":"], []);
136156
string s_part = llList2String(l_msgList, 0);
137-
string s_texture = llList2String(l_msgList, 1);
157+
key s_texture = llList2Key(l_msgList, 1);
138158
if (s_part == "lower")
139159
{
140160
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_lowerFace, s_texture, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
@@ -147,6 +167,24 @@ default
147167
{
148168
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_headFace, s_texture, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
149169
}
170+
else if (s_part == "tattoo-upper")
171+
{
172+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_tattooUpperFace, s_texture, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
173+
}
174+
else if (s_part == "tattoo-lower")
175+
{
176+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_tattooLowerFace, s_texture, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
177+
}
178+
else if (s_part == "clothes-upper")
179+
{
180+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_clothesUpperFace, s_texture, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
181+
gk_curUpper = s_texture;
182+
}
183+
else if (s_part == "clothes-lower")
184+
{
185+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_clothesLowerFace, s_texture, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
186+
gk_curLower = s_texture;
187+
}
150188
}
151189

152190
touch_start(integer num)
@@ -182,20 +220,20 @@ default
182220
string s_part = s_ident + "-upper";
183221
if (llGetInventoryType(s_part) == INVENTORY_TEXTURE)
184222
{
185-
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_tattooUpperFace, s_part, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
223+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_clothesUpperFace, s_part, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
186224
}
187-
else if (llGetInventoryType("transparent") == INVENTORY_TEXTURE)
225+
else
188226
{
189-
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_tattooUpperFace, "transparent", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
227+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_clothesUpperFace, gk_curUpper, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
190228
}
191229
s_part = s_ident + "-lower";
192230
if (llGetInventoryType(s_part) == INVENTORY_TEXTURE)
193231
{
194-
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_tattooLowerFace, s_part, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
232+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_clothesLowerFace, s_part, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
195233
}
196-
else if (llGetInventoryType("transparent") == INVENTORY_TEXTURE)
234+
else
197235
{
198-
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_tattooLowerFace, "transparent", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
236+
llSetLinkPrimitiveParamsFast(gi_modelLink, [PRIM_TEXTURE, gi_clothesLowerFace, gk_curLower, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
199237
}
200238
}
201239
else if (link == gi_linkApply)
@@ -205,12 +243,14 @@ default
205243
string s_part = s_ident + "-upper";
206244
if (llGetInventoryType(s_part) == INVENTORY_TEXTURE)
207245
{
208-
llRegionSayTo(k_owner, gi_SkinChannel, "tattoo-upper:" + (string)llGetInventoryKey(s_part));
246+
gk_curUpper = llGetInventoryKey(s_part);
247+
llRegionSayTo(k_owner, gi_SkinChannel, "clothes-upper:" + (string)gk_curUpper);
209248
}
210249
s_part = s_ident + "-lower";
211250
if (llGetInventoryType(s_part) == INVENTORY_TEXTURE)
212251
{
213-
llRegionSayTo(k_owner, gi_SkinChannel, "tattoo-lower:" + (string)llGetInventoryKey(s_part));
252+
gk_curLower = llGetInventoryKey(s_part);
253+
llRegionSayTo(k_owner, gi_SkinChannel, "clothes-lower:" + (string)gk_curLower);
214254
}
215255
}
216256
}

src/finals/adonis5/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
Adonis5 HUD is using an alpha selection mesh where the faces of the prims match the alpha faces on the body. It is much faster and drops the prim usage from 120 of the previous version (every alpha face is one linked prim) to 20.
33

44
Adonis5 isn't set up for multiple layers.
5+
6+
At the same time a HUD just for selecting skins using the current API got released, it is skin-hud.lsl, it got replaced later by a HUD with tabs for skins, tattoos and clothes.
File renamed without changes.

src/hud.lsl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// script-version: 0.8
33
//
44
//manual mapping of buttons that can't be maped in their descriptions
5-
list gl_mapping = ["65", "L", "64", "S", "66", "R", "60", "A", "61", ">", "62", "<"];
5+
list gl_mapping = ["65", "L", "64", "S", "66", "R", "60", "A", "61", ">", "62", "<", "20", "ZP249"];
66
//color of the slots counter
77
vector gv_counterSaveColor = <0.8, 0.0, 0.0>;
88
vector gv_counterUnsavedColor = <0.0,0.0,0.0>;

0 commit comments

Comments
 (0)