Author Topic: Label following clipping for two different panels  (Read 2777 times)

DL_Alex

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Label following clipping for two different panels
« on: March 19, 2014, 03:09:33 PM »
Hello,

I know I'm probably trying to get more than I can out of NGUI by trying to do this but I thought I'd ask before I attempt a different method.

Here is how my hierarchy is setup:

UIRoot
    Camera
        GameObject (just a holder to help organize)
            GameObject (same as above)
                GameObject (I like to organize, without seeing everything it seems unlikely)
                    UIScrollView/UIPanel (with Clipping)
                        UIGrid
                            Collider/ScrollView/Button
                                UILabel (name)
                                UIPanel (with Clipping)
                                    UILabel (long description)

To explain, I have a scroll view of a bunch of prefabs (the button level), each of these prefabs have two labels (one is hidden at start) and when you click on the 'short description' label, the long description tweens down. I'd like to have the second panel there so I can clip the second label to make it look like I'm having the second label drop down from behind it but also keep it so that the labels don't overlap (looks ugly). However when I have enough of these prefabs in the grid, and I scroll up or down with these descriptions open, the second panel overrides the clipping of the first (as intended I know), and the longer description is being shown outside of the bounds of the first clipping region.

Is there a way to have the second description apply to both clipping regions so that when I scroll far enough the description disappears as intended? Or will I have to figure out the logic on my own?

To try and make it simpler, can I have a child panel have it's children clipped by it's region and the region of all of it's parents?
                               
                               

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Label following clipping for two different panels
« Reply #1 on: March 20, 2014, 01:19:47 AM »
Two problems with your layout. First -- you can't nest clipped panels. You have a clipped panel inside a scroll view. This won't work. Only one panel can clip its widgets. This is just how NGUI's hardware-based clipping works.

Second problem is with "Collider/ScrollView/Button". Why is there a scroll view there? Do you mean UIDragScrollView?

DL_Alex

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Label following clipping for two different panels
« Reply #2 on: March 20, 2014, 08:19:48 AM »
Thanks for the response.

As suspected. I figured I was trying to do too much, any ideas on how I would do what I'm trying to do without nesting the clipped panel?

For your second comment, yes I meant the DragScrollView.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Label following clipping for two different panels
« Reply #3 on: March 20, 2014, 12:52:48 PM »
I don't know what the purpose of the second clip area is, so I can't suggest you much.

DL_Alex

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Label following clipping for two different panels
« Reply #4 on: March 20, 2014, 01:43:07 PM »
From the original post.

I'd like to have the second panel there so I can clip the second label to make it look like I'm having the second label drop down from behind it but also keep it so that the labels don't overlap (looks ugly).

I tried explaining as best as I could, but if there is something that doesn't make sense to you let me know so I can clear it up. What my final goal was intended to be would have a long list of news messages that the player receives. Some of these messages will have additional information where they can click on the message in the scroll view and have it expand down to show the expanded explanation of the message.

I didn't want the labels to overlap while the expanded message is tweening down so I thought I'd put a clip range just below the first message once clicked so that the second message would tween into the clipping range and appear as if it was coming from behind the first message. Hope this helps clear things up.

I have since given up seeing as I don't think it is possible. I had a method working where I checked the bounds of the secondary label and then modified the clip range of the second panel based on the first panel if it was going to go outside of the first clipping panel. However once I got it working, it caused an awful flicker for the label on the second panel so it wouldn't work. I've resorted to just tweening the alpha of the second label as it tweens down, it works but not what I initially intended.

Thanks again for the response.

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: Label following clipping for two different panels
« Reply #5 on: March 30, 2014, 05:28:45 AM »
I'm also need to clip a second panel in a clipping area.

For example I have a ScrollView with vertical scroll, where I add information of a item, and some of the information is a slide of images (uitextures) where this is a second panel clipped with scroll view horizontal, with a bunch of images(textures) of the item, I have something like this hierarchy:

ScrollViewDetail (Vertical movement)
  -label title
  -ScrollViewImages (Horizontal movement)
    -Grid (horizontal arrangement and sorting)
      -Image1(uitexture)
      -Image2(uitexture)
      -Image3(uitexture)
  -label text description

I need to clip all items inside ScrollViewDetail
I hope I make myself clear

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Label following clipping for two different panels
« Reply #6 on: March 30, 2014, 07:43:06 AM »
NGUI has never supported nested clipping. It's something I will likely implement at some point, but right now there is nothing I can suggest other than the obvious: don't nest scroll views.