Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ryan

Pages: 1 ... 4 5 [6]
76
NGUI 3 Support / Re: Soft clipping on a scaled panel
« on: July 16, 2012, 04:22:31 PM »
I circled back to this on Friday, and it turns out rotating my panel's not going to work.  I've just got too many components, so they end up fighting with each other or causing weird visual artifacts when rotation is involved.  So a co-worker and I were looking at the shader today trying to figure out exactly what was going on with clipping and scaling, and one strange thing that we've noticed is that the input vertex (v.vertex in the vert function) changes based on whether or not the panel is uniformly scaled.

I'm not sure if this is fully generalizable, but with a very simple test case (a 512x512 sprite), the vertices passed in to the shader were always +/-256 as long as the panel was uniformly scaled, regardless of what that scale actually was.  Once I started scaling X or Y independently of each other, those values were scaled based on the scale of the UIDrawCall.  So if my UIRoot was scaled down to 0.01, all of a sudden the vertices given to the shader would drop to +/-2.56, along with whatever further scaling I was doing to the panel.  Scaling the width of my panel to 0.9 would give me 2.304 instead of 230.4, etc.

Anyway, I was able to modify UIDrawCall to pass its local scale in as a shader property and have the vertex function, when the difference between x and y scales was greater than a very small value, pass a scaled value into TRANSFORM_TEX to get the soft clipping working the way I expected it to.  It's not the most elegant solution, but maybe some of the information above can help with getting a proper fix in place.

77
NGUI 3 Support / Positioning of UIScrollbar widgets and nine-slicing
« on: July 16, 2012, 04:01:45 PM »
Would it be possible to get some sort of option in UIScrollbar so that when it positions the foreground sprite, it ignores the sprites' borders?  I have a scrollbar with a sliced foreground and a non-sliced background, and the foreground ends up extending past the ends of the background.  I can also have an artist adjust my background sprite so I can specify matching borders, but the flexibility would be nice.

79
NGUI 3 Support / Re: Soft clipping on a scaled panel
« on: June 21, 2012, 02:07:00 PM »
Ah, I had tried a couple of rotations, but that caused some of the widgets to disappear, I guess because of Z positioning.  (I've got two or three atlases involved and a render texture.)  It looks like that only happens in one direction though, so rotating in the other direction might work if I'm careful.  Thanks for making me take a second look at that.

I'm curious about the clipping limitation.  Is it a limitation in the shader? A performance optimization in UIPanel?  I guess I'm wondering if it's something I might be able to get working if I end up really wanting it.

80
NGUI 3 Support / Soft clipping on a scaled panel
« on: June 20, 2012, 09:04:16 PM »
I have a group of widgets containing a couple of soft-clipped panels for things like a scrolling text area.  Everything's set up and working fine, but when I add a TweenScale to the parent of these widgets to simulate a flipping transition (tweening just the X scale from 1 to 0 and back), the clipping stops working.  This appears to be true for hard clipping and alpha clipping, as well, and also if I try scaling the clipped panel directly rather than a parent object.  Is this a known issue with clipping and non-uniformly scaled panels?

81
NGUI 3 Support / Re: Character Spacing on UILabel
« on: June 13, 2012, 12:01:34 PM »
The UIFont inspector also lets you adjust X and Y spacing, which may do what you want.  It will apply to all labels using that font, but you could create multiple font prefabs using the same bitmap to get different spacing for different labels.

82
NGUI 3 Support / Re: About UILabel font
« on: June 12, 2012, 12:02:52 PM »
I think that's not likely to work with line-wrapped text, but it might be good enough for his purposes.

83
NGUI 3 Support / Re: Mixing fonts and atlases
« on: June 07, 2012, 01:30:58 PM »
You can mix them, but the panel can't use the widget depths to sort them if they're in different atlases.  (The panel combines everything from one atlas into one draw call, everything from the next atlas into another draw call, etc.)  You'll need to give your label a smaller Z position than the button to bring it closer to the camera, to get the font draw call to render on top of the button draw call.

84
NGUI 3 Support / Re: Bug: 2.0.7c cannot set sprite padding manually
« on: June 06, 2012, 04:00:46 PM »
I've seen this behavior before when trying to remove padding, although I'm not sure I could reproduce it now.  It only happened for specific sprites.  I think my fix might have been to remove the sprite from the atlas and re-add it.

85
Even though they're using the same atlas, each panel is drawn separately.  (That's why clipping from one panel can't affect other panels.)  At that point the relative depths of widgets in different panels can't be honored, so you need to use different Z positions to fix the drawing order.  Higher Z values will be drawn behind lower Z values.  If everything currently has Z set to 1, then setting Z on your UIPanel_A and UIPanel_B to 0 should bring their contents in front of the tiled backgrounds.

86
The first thing I'd check is whether or not UIPanels are being added to your prefabs when you instantiate them.  That would prevent the panel on your grid from being able to clip them.

87
NGUI 3 Support / Alignment of widgets within a UITable
« on: May 30, 2012, 09:37:21 PM »
I'm using UITables in a bunch of places to lay out groups of widgets.  These might be labels or sprites, and some table cells may themselves contain nested tables or other groups of widgets.  I'd like to be able to control the alignment of cells within the table: for example, the first column might be right-aligned, or all rows might have their contents aligned at the bottom.  Have I missed an obvious way to do this?

I have a workable solution that I implemented locally by adding a component to my table contents, which I called UITableAlignment, that simply contains a UIWidget.Pivot field.  I then altered UITable to check for this component on each child when repositioning them, adjusting the X and Y offsets appropriately.  I'm not sure if I've covered all of the edge cases, but so far it has met my needs.  I wonder if something like this could be added to NGUI so I don't have to worry about it next time I upgrade?  (Michael, I can send you what I have if you're interested, but it's not terribly complicated.)

88
NGUI 3 Support / Re: sprite UV
« on: May 19, 2012, 06:38:26 PM »
Depending on how flexible you need to be with the UV coordinates, one compromise might be to set up multiple sprites in the atlas that point to overlapping rectangles and cycle through the sprites as needed.  Or if you only have a few instances of UISprite that you need to change, set up a separate entry in the atlas for each one so you can change the rectangle for one without affecting the others.

89
NGUI 3 Support / Re: UILabel and restricted strings...
« on: May 11, 2012, 01:24:03 PM »
I noticed StripSymbols, but then I'm not displaying the text entered by the user, am I.  :P  I would want to preserve the brackets and any other random junk entered by the user.

90
NGUI 3 Support / Re: UILabel and restricted strings...
« on: May 10, 2012, 01:20:31 PM »
Or if nothing else, provide some way to encode a left square bracket and a function to do just that on a given string.  I've had one or two cases where I wanted to embed some colors in a label, but also include text input by a user without allowing that portion of the text to change colors.  I put off actually dealing with it, but it would be convenient if NGUI supported that.

Pages: 1 ... 4 5 [6]