Author Topic: UIPanel inside a UIDraggablePanel  (Read 5586 times)

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
UIPanel inside a UIDraggablePanel
« on: November 16, 2012, 08:21:21 AM »
Hi !

I'm facing an issue, I have al ist of rows inside a UIDraggablePanel (containing a UITable of rows).
If every rows of the UITable is a UIPanel, it does not get clipped by the clipping of the UIDraggablePanel, is there a reason for that ?

In fact, it's not each of my rows that are like that, but I need to display :
- a background image,
- a UITexture (over the background image)
- another final small image (over the Texture)

But it's impossible to do that without putting the small image inside a UIPanel (because the background image and the small image uses the same atlas).
So, is there a way to do that ?

Thanks !

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UIPanel inside a UIDraggablePanel
« Reply #1 on: November 16, 2012, 08:51:41 AM »
It's obvious really.

A clipping panel only clips what it draws itself. That means that any panels inside it, is drawn by that panel instead and thus does not clip.

The fix is: Don't do that. :/

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: UIPanel inside a UIDraggablePanel
« Reply #2 on: November 16, 2012, 08:54:32 AM »
xD yeah it's obvious, but didn't think of that lol.

So how can I take in sandwich a UITexture between 2 sprites of the same atlas ? lol

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Re: UIPanel inside a UIDraggablePanel
« Reply #3 on: November 16, 2012, 04:54:29 PM »
I struggled with the sprite atlas sandwich as well. The best solution is to tweak the design around it and add a couple draw calls here or there with additional panels/materials. Could you embed the small image into the UITexture resource or make another material specifically for the overlay you need to put on top of the image? Otherwise the sprite atlas rendering order will be based on Z-Depth of the combined draw call which is very hard to manage if you sandwich a draw call between sprites that use the same atlas.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel inside a UIDraggablePanel
« Reply #4 on: November 16, 2012, 05:29:27 PM »
All this talk about sandwiches... anyone else hungry?

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: UIPanel inside a UIDraggablePanel
« Reply #5 on: November 17, 2012, 05:03:20 PM »
Ahah Aren, bon appétit :-)

And t:-) hx ferazel, I didn't want to do that but yes, I'll put the small sprite in a UITexture!