No “mini-tutorial” this time, but a rather lengthy one. So get comfy, shut down your mobile, set your avie in “busy” state, grab something to drink and enjoy this tutorial!
(read more below the line!)
Damien Fate released his mesh clothing templates earlier today and since I love playing with meshes, I downloaded all his templates and started playing with them.
I uploaded a mini skirt, fabricated some textures for it and such.
After an hour photoshopping I had a couple of textures for this skirt, and I thought it might be a plan to find some sort of menu driven texture changer for the skirt. Clicking on the skirt and changing textures is easier then finding a skirt with another texture in my inventory:-)
So I start searching the internet for open-source scripts, and finally found one. Easy script, just put the script in the skirt, drop the textures in the skirt and voilà!
Seems that if you wear a mesh item, you can’t “touch” it, and activate the script. I had to right-click the skirt and select “touch” from the pie menu.
That sucks, so I did some more googling, and found an easy HUD system.
And now I’m going to tell you guys exactly how I did things.
Download and unzip stuff.
First you’ll need to download a *.zip file. You can un-zip this file using the evaluation version of winzip (Download here) or any other program that can handle *.zip files.
In this *.zip file you will find everything you need to create a tanktop and a HUD to change the texture of the skirt.
Un-zip the file on a convenient place on your computer.
You will see something like this on you PC:
The “textures” folder contains some textures we will use in-world for this tutorial. You have to upload them at some point in this tutorial.
The “psd files” folder has 2 psd files in it. You can use them to make your own textures for the skirt and HUD. Some knowledge with GIMP or Photoshop is needed to use these files!
The “scripts” folder contains the scripts we are going to use.
And finally the “FemAvg_TankTop_Opt.dae” file is the actual mesh we are going to import in to your virtual world of choice.
Importing the tanktop mesh.
Did I mention you will need a mesh capable viewer for this tutorial to work? Ye olde impy will not work, get a decent viewer.
I’m using the latest Firestorm viewer for this tutorial. (I actually used Kirstens viewer to upload the mesh because the open-sim version of Firestorm does not support the physics part of the upload. This has to do with some silly Linden Lab rule or something.)
Your viewer of choice may have other buttons etc, but if you can upload a texture, you should know where to find the “upload Model” button.
Let’s upload the mesh tanktop!
-Find the “Upload Model” button in your viewer.
-Browse to the folder on your PC where you un-zipped the zip file and select the “FemAvg_TankTop_Opt.dae” file.
-A new window pops up. Set things as shown in the pic below. (Choose Avatar attachment in the “This model represents” dropbox, and in the Physics tab, set “Level of Detail” to lowest.)
-Open the “Upload Options” tab and change the following: Make sure the option “include skin weight” is ticked. You can set the “scale” to 50 if you like, this is useful for editing the skirt, but won’t change the size of the skirt when you wear it.
(Don’t worry about uploading textures this time, it won’t work.)
-Click on the “Calculate weights & fee” button, and when it changes to “Upload”, click upload. (duh!)
While your tanktop is uploading, you might get a fresh glass of wine or something.
Your tanktop should be in your inventory now. And it’s tiny! If you didn’t change the scale to 50 before uploading, the skirt is something like 0.004 x 0.006 x x0.003 meters! If your rezz it to the floor, it can be hard to find
Here’s a little trick: Right-click on any prim and go in to edit mode. While in edit mode, drag the skirt from your inventory to the ground.
Now you have your skirt selected and can make it bigger if you hold the CTRL and Shift keys on your keyboard and drag on of the white dots up a bit.
Leave it rezzed in-world for now, we need to add a script to it later in this tutorial.
I have created some simple textures for this tutorial. I am sharing my *’psd files so you can make your own textures for this tanktop and the HUD if you like.
Again: find the upload button in your viewer and choose the “bulk upload” option.
Upload everything that is in the “texture” folder on you PC. There are some textures for the skirt in it, some HUD textures and a texture for an “Alpha” layer. Upload them all.
This was the easy part of this tutorial! Now things go nasty! You have to make alpha’s, copy UUID’s and shit! You have to do some scripting too! Oh! You might have to edit your shape!
But first we are going to copy the scripts from your PC to your virtual world.
Create two empty scripts in your inventory. One script should be named “Texture change main”, the other script should be named “Texture change slave”.
Open “Texture change main.lsl” on your PC with Notepad and copy the contents to the “Texture change main” script you have created in your inventory. Do the same for the “Texture change slave” script.
Here comes the scripting part!
First thing you need to change in both scripts is the channel the scripts use to communicate. The channel is a number both scripts use to communicate. Find the following line in both scripts:
I used 1982, this is the channel the HUD and the tanktop use to communicate. Change this in a unique number.
Here is how these two scripts work:
The “Texture change main” script, is the script that changes the texture of the tanktop. This script goes in the tanktop.
The “Texture change slave” script is the script that tells the “Texture change main” what texture to use. The slave script goes in a button on the HUD. Each button in the HUD needs the slave script in it with a different texture UUID.
First we are going to put the “Texture change main” script in the tanktop.
- Open your inventory and find the main script.
- Right-click on the tanktop and choose “edit” from the menu.
- Open the “content” tab.
- Drag the “Texture change main” script from your inventory to the content tab.
The tanktop is scripted! Whoohoo \o/!!!
Give the tanktop a decent name, and take it back into your inventory. There is no need to resize the tanktop.
The HUD is just a bunch of prims linked together. In this tutorial I have created 6 textures for the tanktop, so the HUD is a simple linkset of 6 prims with 6 “Texture change slave” scripts in it.
Stack those 6 prims on top of each other, link them, wear it and KABOOM!!! You has a HUD!
Here is a little tip to get those 6 prims nicely aligned (I use this trick all the time while I’m building!)
Create a prim on the floor.
Make it 0.5 meters high and 1 meter wide. (we are going to scale it down later)
Depending on what viewer you are using, there is a button to change “Grid Options”. In Firestorm it a little arrow behind the “snap” option. (See pic below)
Set “Units (meters)” to 0.250 and hit the little x to close the grid options window.
If you move the prim up or down by dragging the blue arrow, you will see some sort of ruler just beside the prim.
Now here is the trick: Click and hold the blue arrow and move the mouse to the left or right so it is on the ruler you see in-world. The prim should move up or down by 0.250 meters and snaps to a round figure every time you move your mouse up or down.
“Snap” this prim to 22m.
Hold down the “Shift” key on your keyboard and click and hold the blue arrow again. Move the prim up a bit.
HUH? I have 2 prims now?
Use the “snapping” method to place this new prim on 22.5m.
Next prim snaps on 23m, then 23.5m etc, etc.
When you have 6 prims nicely stacked on top of each other, stop snapping prims!
No more snapping! Time to add scripts and textures to these prims.
First we are going to put the same “Texture change slave” script in the 6 prims. Don’t worry about the texture UUID’s for now, we’ll do that later.
- Right-click on the bottom prim.
- Open the content tab.
- Drag the “Texture change slave” script from your inventory to the content tab.
- Right-click on the next prim.
- Open the content tab.
- Drag the “Texture change slave” script….etc, etc.
In the end you should have 6 prims with the same scripts in it.
As mentioned earlier: I have made 6 textures for this tanktop. 4 “plain” ones (White, green, blue and red) and 2 textures with a “fabric” texture (Fabric_blue and Fabric_purple). I also made 6 button textures. (Button_plain_white.jpg, Button_plain_blue.jpg, Button_fabric_blue.jpg, etc)
We are going to put textures on the buttons, and change the UUID’s in the scripts so that the “plain white button” changes the texture of the tanktop in “plain white”.
Right-click on the bottom prim, open the “Texture” tab, and drag the “button-plain-white” texture from your inventory to the texture window. (See pic below.)
Locate the “tanktop_white” texture in your inventory, and right-click on it. I am not sure about older viewers, but most viewers should show an option that says: Copy Asset UUID. Click that!
This copies the UUID of the texture to your clipboard so it can be pasted in the script.
Back to the prim; Open the content tab, double click on the script inside so it opens the script window.
There is a line in the script we need to change.
Replace the bunch of letters and numbers between the ” ” in the pic above with the UUID we copied earlier.
Save the script.
Repeat this with the other textures and buttons.
When you are done, you should have something like this:
6 buttons with 6 textures and 6 scripts (with 6 different UUID’s) in them.
Next thing to do is linking the buttons together.
- Right-click on one of the prims, and open the edit window.
- Hold down the Shift-key on your keyboard.
- Click on the other buttons. All prims should be highlighted yellow.
- Hit CTRL-L on your keyboard, or click the “Link” button in the edit window.
Rename the HUD to something useful.
If you should wear this HUD as it is now, you’ll probably have a HUD that is HUGE!
We need to scale the HUD down a bit, so press CTRL-SHIFT on your keyboard.
You’ll see white dots on the corners of the HUD. Drag one of the dots to the center of the HUD to scale it down.
Scale it all the way down until the HUD is approximately 0.1 meters wide.
Take the HUD in your inventory.
The Alpha Layer.
To hide some parts of your body, you need an alpha layer.
Create a new alpha layer in your inventory, wear it and edit it.
An edit window opens. Drag the “Female_Tank_Alpha” from your inventory to the “Upper Alpha” window. (See pic)
Save the layer.
All the parts are ready to wear now.
First lets wear the tanktop.
- Find the Tanktop in your inventory.
- Right-click on your tanktop.
- Choose “Attach to…” and pick a attachment point that is never used by other attachments. (I usually use one of the hips)
- Detach the tanktop, count to 15 to save the new attachment point.
- Double-click on the tanktop in your inventory to wear it again.
You should be wearing the alpha layer. If not: wear it.
Final part to wear is the HUD.
- Find the HUD in your inventory.
- Right-click on the HUD.
- Choose “Attach to HUD”.
- Pick a spot.
- You can right-click on the HUD and move it around, scale it, rotate it, etc until you are satisfied with the result.
- Detach the HUD, count to 15 to save the new attachment point.
- Double-click on the HUD to wear it again.
Have fun folks!