08/17/14, 07:44 AM | #1 |
Grid
It would be great if someone could make an addon with keybind for toggle to show an grid all over the screen to align addon ui's.
Like this |
|
08/23/14, 10:34 AM | #2 |
|
I'm going to try to do something like this as a way to learn a little bit about textures and photo editing. I would assume it would encompass things like:
As I said, the hard part for me will be actually getting a texture made right and put into the addon correctly. Most of the rest I shouldn't have as much problem on. It's a project at least! |
08/23/14, 12:04 PM | #3 |
I know you want to learn about textures, but I imagine you could also use LineControl elements to achieve this.
|
|
08/23/14, 12:09 PM | #4 |
|
Texture is actually the easy part, since you don't need any. Just make a texture control template:
xml Code:
|
08/23/14, 01:20 PM | #5 | ||
|
|
||
08/28/14, 09:11 AM | #6 |
|
Gah. I understand the concept of ControlPool, but I cannot seem to wrap my head around implementation. I see it called in different addons different ways and that gets confusing. I think what is getting me is what parameters it takes. Two examples from two addons:
Lua Code:
Lua Code:
So obviously self is the object the pool will be in. The first string object is the control (so in my case "GridLine"). The third parameter seems to be some container reference, though I cannot understand how that would apply to mine. The last parameter is the prefix for the ID of each object. I guess that means I'm stuck on what container object I should use. Any thoughts? |
08/28/14, 09:34 AM | #7 |
|
To follow on with seeing if I understand ControlPool:
So once I have to Pool I essentially want to maintain a table of created objects that are in use and a table of objects that have been released. I use AcquireObject() to get/create a new control, place it in the table I created, modify it to what want and display it. When the grid is 'disabled', I release all the objects back to the pool for the next use. |
08/28/14, 10:47 AM | #8 |
|
Lua Code:
templateName ... is the name of a virtual control in XML parentControl ... optional parent to all controls created by the pool; if it's nil, GuiRoot will be their parent namePrefix ... optional "prefix" to created controls' names For example, if parentControl:GetName() == "GridContainer" and namePrefix == "Line", created child controls will be named "GridContainerLine1", "GridContainerLine2", etc. If namePrefix == nil, templateName will be used instead (which makes ugly long names, so I rather use prefix ). You don't have to maintain a table of active objects unless you want to release them selectively. In this case I think you could just hide the parent control, and only rebuild the grid (ReleaseAllObjects and re-create) when settings change (screen resolution, grid spacing). Last edited by merlight : 08/28/14 at 10:52 AM. Reason: added custom reset comment |
08/28/14, 11:07 AM | #9 | |
As I did't want to use XML (you have to use XML to define control template), I have used just object pool instead of control pool in my Bloody Screen addon (v0.1). Here is how it works:
Warning: Spoiler
Lua Code:
In your case you will have to do the same as me - create top level window of the same size as GuiRoot, set draw layer to overlay as you want to display grid on the top of other windows and then create lines. top level window: Lua Code:
simple object pool for lines: Lua Code:
And then create lots of lines: Lua Code:
Last edited by Garkin : 08/28/14 at 11:15 AM. |
||
08/29/14, 02:09 PM | #10 |
|
Thanks Garkin. You really made that easy to understand.
Though I found something odd in my first implementation. With a line thickness of 2+, everything looks like nice, even squares (except on the bottom and right which is expected with screen dimensions). Thickness 2 With one thickness, you can tell that it doesn't seem to make nice squares. I looked and made sure that the line data is correct. Thickness 1 Sorry about using links. I'm not very proficient at uploading images to these posts. Last edited by skyraker : 08/29/14 at 02:12 PM. |
08/29/14, 03:13 PM | #11 |
You guys are awsome.
i can't wait to use this when it is finished. |
|
08/29/14, 03:48 PM | #12 |
|
Yeah, almost done with a early version.
Still incorporating settings and saved variables. Then will probably have to work out bugs. |
08/29/14, 04:31 PM | #13 | |
|
Textures have methods IsPixelRoundingEnabled(), SetPixelRoundingEnabled(bool). Not sure what's the default, try setting the opposite Also, there's GetUIGlobalScale(). In Map control they use it to compute mapPixels = mapUnits * GetUIGlobalScale(). So I'd try hline:SetHeight(1 / GetUIGlobalScale()) and see how it looks. |
|
08/29/14, 05:34 PM | #14 |
|
I was wondering if it was the UI Scale, but with the other thicknesses working right it would seem odd that a thickness of 1 would be the only issue. I may give it a try later.
It isn't missing lines in the second image, that is the problem. It just seems to be displaying every so many lines off, despite having the correct anchor point value. |
08/29/14, 06:11 PM | #15 |
|
|
09/01/14, 09:11 PM | #16 |
|
Tried it, at first I didn't see any issues with line width. Normally I'm playing in windowed fullscreen in native resolution (1920x1080), so GetUIGlobalScale() was 1. When I switched to windowed, GetUIGlobalScale() changed to 0.6something and the grid looked really bad.
I also rewrote grid creation so that line width and grid size settings are in pixels. That is, I divided them by UI scale. But even so, some lines appeared thicker probably due to accumulation of rounding errors. Finally I disabled pixel rounding and it looks ok now. Here's my modified code: https://gist.github.com/merlight/25e02368a1e6187f989c In addition to the pixel changes described above, there are some more: - I'm anchoring lines to TOP/LEFT (center), so the red lines have zero offsets and thus they're in the true center - only every 10th line has full opacity from settings; in-between lines have 40% or 70% opacity (this doesn't work with changing the setting on the fly) - I wanted to force the red lines to be drawn last, so they're not overlapped by the black ones; but I doubt showing them last will ensure that; perhaps we should SetDrawLevel? |
09/02/14, 04:26 PM | #17 | |
|
Setting the two red lines as being last to be drawn made sure they were over all others. At least on my screen they are. |
|
09/02/14, 05:04 PM | #18 | |
|
I modified the gist a bit more, finally anchoring all lines to screen center (another too-late-to-be-obvious casee ) and I set draw levels just to be sure. Maybe I'll ask ZOS for some more interesting blending modes next. |
|
09/02/14, 05:16 PM | #19 | |
|
For the record, here's some info about pixel rounding from http://forums.elderscrollsonline.com...tes-change-log
|
|
ESOUI » AddOns » AddOn Search/Requests » Grid |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|