Jump to content

Best way to minimize a UI?


MSTRPLN
 Share

You are about to reply to a thread that has been inactive for 2442 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello, i've made a visual example but im not sure how to code this. basically i have 2 main functions that are clueless to me.

1. Minimizing UI/HUD
2. Have different "tabs" appear and dissapear when clicked on the buttons (setting transparency or display wouldn't work i think, yes they would be invisible but still interactable with)
Maybe havign one "Main" hud (the tab buttons) and attaching/detaching different objects based on what button is pressed? But wouldn't that ask for PERMISSION_ATTACH every single time?

I've got an example of the background working although the resizing has a kind of a "ease out" thing happening and im not sure if this is the right way to do it.

integer toggle;
default
{
    state_entry()
    {
    }

    touch_start(integer total_number)
    {
        toggle = !toggle;
        if(llDetectedLinkNumber(0) == 1)
        {
            if(toggle)
            {
                llSetLinkPrimitiveParamsFast(2, [PRIM_SIZE, <0.5, 0.15, 0.999>]);
                llSetLinkPrimitiveParamsFast(2, [PRIM_POSITION, <0.0, -0.888, 0.0>]);
            }
            else
            {
                llSetLinkPrimitiveParamsFast(2, [PRIM_SIZE, <0.5, 0.5, 0.999>]);
                llSetLinkPrimitiveParamsFast(2, [PRIM_POSITION, <0.0, -0.712, 0.0>]);
            }
        }
    }
}

Basically i have a root prim with a linked prim to the right of it (because when attaching to HUD Center the root will be centered and the actual "background" prim would be on the right side) this because the hud is going to be called from a item where you dont have an option "hud center right" so i'd still need to come up with a solution to hide the center cube & stop it from blocking clicks (maybe size it down to almost 0)

Any help would be much apreciated!

Pleae note these images are made in Photoshop and are not yet coded, they are a example of what i'm aiming for

HUD1.png

 

HUD2.png

Edited by MSTRPLN
Link to comment
Share on other sites

If you attach the HUD from your inventory, position it, detach, and put that into the rezzer, it will attach at that position when attached to the same attachment point. If you have done that on the Center HUD attach point,  llAttachToAvatarTemp( ATTACH_HUD_CENTER_1 ) ; will attach it at the previous position.

My prefered method with mesh HUDs is rotating them by 90°, to make them show/hide.
Here is one way of how to tackle it, according to the images you have shown. The texture display buttons will show a different set of textures according to which Tab button is clicked. The unused buttons will rotate -90° so they are hidden, and unclickable. This requires a bit of coding indeed, but it's pretty straight forward.

MultiTabsMeshHUDExample02.thumb.jpg.109145ce4f7ed8a7b6a6ecba8a432331.jpg

 

Edited by arton Rotaru
  • Like 2
  • Thanks 2
Link to comment
Share on other sites

Some questions appeared again:

I've got the start of the hud done:

HUD.png

 

now my first question: how would i show/hide different tabs? (if you could create linksets inside linksets this wouldn't be an issue)
because these would be the different tabs (more or less):

tabs.png

The title is the easiest part. Just 4 instances under each other in one image file, clicking on each tab menu button would change the texture position then.
You could say put them all over each other (in different X values) but that would bring it up to so many meshes (not sure if this would become an issue. Example shown below)
tabs2.png

 

Question 2: previewer with selectable parts:
 

Preview selectors.png

I hope this makes sense, the selectors are constructed the same as the mesh (layers) as shown below:

mesh layer.png

 

For the selectors i was thinking this (any better ideas?)
Coding wise let's say selector 1 is linknumber 8 & selector 2 is linknumber 9
i could do an if statement on the texture changer like: (If linknumber 8 & face 1 (left side) is toggled put texture only to left face on the road mesh)
using this solution given by arton Rotaru

 

selectors.png

Edited by MSTRPLN
Link to comment
Share on other sites

The idea behind the many display buttons is that it's independent of the number of the textures shown in each tab (And I just tried to be as close as possible to your initial images. B|) It would be only this one set of display button objects (18 * 0.5 = 9 land impact. The full HUD came in at 12 LI), and the textures would be set on each display button according to the tab chosen. The texture UUIDs would be stored in lists. And the display buttons linknumbers will be stored in a list as well. Same with the tab title field.

This is done by naming the display buttons, and looping through the linkset on script start up. Doing some sorting on that list to make them left to right, top to bottom (Or linking them by hand in order).  Then looping only through that list of button linknumbers, and setting the textures from the list according to the chosen tab. This is pretty flexible, and can cycle through hundreds of textures for each tab with pages.
Indeed, textures will take a few to load for each tab, until they are all cached locally. Though, it keeps the overall texture memory of the HUD low, by displaying only the textures which are currently set.

Of course, you can do this with single multi material display buttons as well. It's not as flexible possibly, but if you have fixed sets of textures, probably a preferable way to go. Makes it even easier to code as well. The example shown is basically just a method of how to show/hide various pieces of a HUD.

If I had fixed texture sets, I would put the textures for each tab on a single atlas map, display them on a single material and select them with llDetectedTouchST (the function can do rows and columns easily). Sending just the corresponding full texture to the previewer.

The Previewer should work as you have described it I think. Although, I'm not sure I understood precisely what it is supposed to do in it's entirety.^_^

Edited by arton Rotaru
Link to comment
Share on other sites

That might be a bit too advanced for me but ill try my best, although not every button is the same, for example the road decals has 2 pages but most of them are using the multiple texture faces so having these as you described up top and a few "extra" buttons shown/hidden by rotating isn't going to be a big problem i suppose

as for the previewer, it's workign the same as this the only difference is it won't be 2 cubes but 2 meshes with different faces to controll what part on the mesh can be changed

with the detectedtouchst i could do this which is 1 object:

Screenshot_1.png

 

and then put:

integer numberOfRows    = 5;
integer numberOfColumns = 2;

if im not mistaking, and for the extra buttons just make a seperate object. (would be easier to accomplish because im not super familiar with lists and how to call them in later, let alone do all the functions on the list as you described above).

Edited by MSTRPLN
Link to comment
Share on other sites

if you want to try a single prim with a texture - touch detect, here is a small example to play with?

 

 

 

integer numberOfColumns = 3;
integer numberOfRows = 3; 
default
{
    touch_start(integer num_detected)
    {
         key id = llDetectedKey(0);  
         integer face = llDetectedTouchFace(0); 
         vector touchST = llDetectedTouchST(0); 
         integer currentCellNumber = llFloor(touchST.x*numberOfColumns) +
         (numberOfRows -llCeil(touchST.y*numberOfRows))*numberOfColumns + 1;
         llOwnerSay((string)currentCellNumber);
         
         if(currentCellNumber == 1)
         {  
         }
         if(currentCellNumber == 2)
         { 
         }       
    }
}

 

9 screen mail.png

Edited by Xiija
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, MSTRPLN said:

That might be a bit too advanced for me but ill try my best

Making it work flawlessly, it is a rather advanced task indeed. Although the functions being used are rather basic. But that's easy to say if you have done this kind of stuff a couple of times already.

The good thing is, the possibilities are countless. Being creative to how to solve one problem after the other is the fun part of scripting.

Link to comment
Share on other sites

1 hour ago, arton Rotaru said:

Making it work flawlessly, it is a rather advanced task indeed. Although the functions being used are rather basic. But that's easy to say if you have done this kind of stuff a couple of times already.

The good thing is, the possibilities are countless. Being creative to how to solve one problem after the other is the fun part of scripting.

true with a bit of knowledge on hwo stuff works though, because sometimes you look at the wiki but think "okay i understand this demo, but how would i implement it in my situation?

i think im going with the DetectedTouchST (different outcomes on different tabs for example: when the decals tab is clicked clicking the touchst 1 will change the texture to tex1 of the decals etc.. and have the 3 extra buttons rotate 90 when not used, and the previewer like i said this would be basic but would work i suppose

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2442 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...