Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
07-20-2009 15:18
Let me explain what I'm trying to do, and maybe someone suggest the best way to do it.
I want to make a one-prim button-bar, using textures and llDetectedTouch(UV); this clever function lets the script know where in the texture I've touched something, so if I apply a texture showing five buttons to the face of a prim and give the script the coordinates of each button on the texture, the script knows which button I've touched and reacts accordingly.
Obviously, precise lay-out is very important when I'm preparing the texture to do this.
And, I want to go one further, by having a grid of buttons, each row identical except that, in the first row, none of the buttons are highlighted, in the second row, button 1 is highlighted, in the third row, button 2 is highlighted and so on..
This way, I can visually simulate no buttons being activated (i.e. none highlighted), or a particular button being activated (i.e.highlighted) by having the script change the texture offset when the appropriate button area is touched.
I understand the scripting side of this; that's not a problem. However, at the moment, because I don't know any other way to do it, I'm spending ages making small individual button textures and then aligning them all by hand and with the align tools in the main toolbox.
I suspect there may be easier ways to do this -- it would lovely if, for example, I could lay out a grid and have the button textures snap to it, or specify the coordinates on the main background layer where I want them to go.. can anyone please advise me?
On work-round I've considered is importing my button textures, making up the grid on prims in world and then taking a picture of the results, downloading that, touching it up a bit, and then re-uploading it, but I hope there's a less convoluted solution.
As I said, precise positioning is essential here.
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
07-20-2009 15:59
You could try: Start with new 1000x1000 image, (math might be a bit easier) Setup the grid in relation to button sizes (Image menu>Configure Grid) View menu> "Snap to grid/guides" Place guides where edges of buttons would be, (drag 'em out from the rulers on the sides)' Or Image menu>Guides (options there might help) ------ To size a layer: Layer menu> Scale Layer. Move it: Select layer, m key (move) hold Shift while moving , keeps layer selected for move. Very annoying to accidentally move the shadow layers above! Could go to Filters>Render>Grid and make some for edge overlays. ------ Dupe the image, Ctl + D, Image menu > Flatten. Scale image at 256x or 512x if needed. ----- Use texture offsets to slide the tex around on the prim when buttons are clicked. (It's possible to make a prim with 5 faces facing the user also (not good for a hud though), and use DetectedTouchFace) -----
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
Peggy Paperdoll
A Brat
Join date: 15 Apr 2006
Posts: 4,383
|
07-20-2009 18:13
What Kornscope said. But I'd do the grid layout a little differently. On your main main image (backgroud) I'd figure the size according to how many buttons I want across and up and down......something evenly divisable by the button arrangement. For instance if I wanted 5 buttons across and 4 rows of those button top to bottom. I'd use a size that is easy to work with for each button (you're going to resize the final texture for upload to something that SL will handle efficiently anyway so at this point I'd only worry about what's easy to work with). Say you want your buttons square and a good size to work with is 200 pixels. you want 5 across......that makes the width 1000 pixels. But you only want 4 rows. to keep your buttons square they must also be 200 pixels but if you only make the height deminsion 800 pixels the final texture would be distorted on upload (it's not a power of two relationship width/height). So you know you will have to adjust. You could leave a "bottom" row out and have your buttons more to the top of the texture and adjust using the offset in the texture editing tool in SL or you can "center" the rows top to bottom in the texture itself and not have to play with the offset at all.
Once you have that in mind you can set up your grid in GIMP two ways Using the "Grid by percent" or "New grid". Both are in the drop down in the main image window under "Image"......down near the bottom of the menu a sub menu "Grids). Percentage is easy......20%. So starting with vertical the grids would be 20%, 40%, 60%, and 80%. Or the "new grid" you simply put the first grid at 200, second at 400, etc. Do the same for the rows. Except if you are going to center them on the final texture you need to start with the first horizontal grid at either 10% (if using percent) or 100 (if using new grid). Make sure you have "snap to grid" enabled and just scoot your buttons around to line them up. Merge or flatten, resize to what you want for upload (256 by 256 or 512 by 512). You're done.
If you don't want the buttons to be right at the edge of the texture just add one phantom button more to the rows and columns and increase your image background accordingly. Put your first grid 1/2 that the button size is then go back to your percentage or pixel placement numbers.....ending with your buttons being indented from the edges of your texture. The secret is "snap to grid".
That's the way I'd do it. Keep it simple and convenient.
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
07-21-2009 07:00
Thank you so much, both.. that really simplifies things! I thought there had to a be a snap to grid option somewhere, but finding it and then creating the grid correctly... well...
Does anyone have any links to tutorials on cool ways of making appropriate images of activated and deactivated buttons they could share?
|
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
|
07-21-2009 12:36
From: Innula Zenovka Thank you so much, both.. that really simplifies things! I thought there had to a be a snap to grid option somewhere, but finding it and then creating the grid correctly... well...
Does anyone have any links to tutorials on cool ways of making appropriate images of activated and deactivated buttons they could share? I did this exact same thing not long ago for a device I made. I didn't save any links, but when I searched the web for "3D Button Tutorial" I got hundreds of hits. Most were for making buttons for web pages, but the techniques transfered readily to my project.
_____________________
Visit ChereeMotion - Life's Best Pinup Poses http://slurl.com/secondlife/Wild%20Rice/38/230/51
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
07-21-2009 12:47
Yeah.. I did that and was just a bit overwhelmed by the number of possibilities! This one, which is for Photoshop but it looks pretty straightforward to do it in Gimp, seems quite fun http://home.zonnet.nl/epragt/tutorials/photoshop/shapesandobjects/rolloverbuttons/index.jsp.htm
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
07-21-2009 16:57
You could also toggle "Full Bright" (and a tiny bit of "Glow"  to highlight the buttons then you only need one set of buttons.
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
|
09-12-2009 10:53
I made some buttons for a RL project recently. As far as making them look activated or deactivated, this is what I did....
Up - white gradient on the top-left, black gradient on the bottom-right Down - black gradient on the top-left, white gradient on the bottom-right, text offset 1 pixel down and right.
Looks pretty convincing for me.
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
09-12-2009 11:25
I don't know how I missed this thread when it was started, but it seems to me that there's a much easier answer. The OP intended to use llDetectedTouchUV to figure out which part of a texture had been touched. What he should have used was llDetectedTouchST, which takes its coordinates from the prim, not the texture. The coordinates returned by llDetectedTouchST don't care where the texture is. If he did that, he could draw his various versions of the button row on the same texture and move them around using llSetPrimitiveParams ([PRIM_TEXTURE...... ]) as necessary.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|