Minion Beta! - Help us test our new AddOn updater. Get it now!
Download
(6 Kb)
Download
Updated: 03-08-14 11:48 AM
Pictures
File Info
Compatibility:
Siege of Orgrimmar (5.4)
Escalation (5.3)
Updated:03-08-14 11:48 AM
Created:07-12-13 01:58 PM
Downloads:384
Favorites:6
MD5:
WatchIt Debug Tool
Version: 1.03
by: Malsomnus [More]
This is a little utility for developers, that allows you to conveniently view complex variables.

To view a global variable named myTable, simply run the command:
Code:
WatchVar ('myTable')
The function returns the frame it creates so you can reposition it from your code. You can also move it freely from the GUI, and scale it by pressing ctrl and using the mouse wheel.
As of v1.02, there is also a slash command so you can simple write /watch myTable right there in your chat box.
Note: You can use also use the above methods to watch subtables like so: /watch myTable[idx1].subtable[3].

At the moment this only works on global variables, but since you'll probably be using it to view tables it's easy enough to create a global reference.


To create a little frame where you can easily watch a changing value:
Lua Code:
  1. frmWatch = CreateWatchFrame ('window_title')
  2. frmWatch:AdjustWidth (150)
  3. ...
  4.     -- somewhere, presumably in an event function
  5.     frmWatch:LoadValue (value)


Planned features:
-----------------
* More improvements to both the display and the functionality of complex variables.
* Hopefully, something involving debug prints for other add-ons.
* Make it possible to show something by value instead of by name.
* Maybe add automatic throttling to the watch frame, because nobody actually wants to watch a value change 60 times per second.

Feature ideas and bug reports are, as usual, extremely welcome!


_________________________________________

Have you seen my other add-ons yet?
SanityCheck - Of course you know how to play your class, but there is just so much to remember!
Raidbot - The right way to raid!
Flaskaholic - Flasks are expensive, stop wasting them!
Surprise - What does this add-on do? There is only one way to find out!
MooTrack - The simple, lightweight way to keep track of buffs and debuffs!
MagicMarker - One configurable tool for all your automatic marking needs!
Version 1.03
------------
* Visual redesign. Many thanks to Pelf and Phanx for feedback!

Version 1.02
------------
* Added slash command
* Added the ability to directly watch subtables
* Seriously improved display of tables and stuff

Version 1.01
------------
* Added watch frames
Optional Files (0)


Archived Files (3)
File Name
Version
Size
Author
Date
1.02
5kB
Malsomnus
02-11-14 03:45 AM
1.01
5kB
Malsomnus
08-05-13 03:09 PM
1.00
5kB
Malsomnus
07-12-13 01:58 PM


Post A Reply Comment Options
Unread 02-19-14, 11:02 PM  
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member

Forum posts: 128
File comments: 74
Uploads: 0
Well, whenever you're inspired, all of this will be here for you .

I'm closing the tab I was holding open for this. PM me if you need me!
pelf is offline Report comment to moderator  
Reply With Quote
Unread 02-17-14, 01:25 PM  
Malsomnus
A Chromatic Dragonspawn
AddOn Author - Click to view AddOns

Forum posts: 170
File comments: 58
Uploads: 18
Well, I've got a new job so I have a bit less time now, but this is around the top of the to-do pile
__________________
SanityCheck - Never again find yourself tanking Garrosh Hellscream in a wedding dress and a fishing rod!

Remember, every time you post a comment on an add-on, a kitten gets its wings!
Malsomnus is offline Report comment to moderator  
Reply With Quote
Unread 02-15-14, 09:55 PM  
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member

Forum posts: 128
File comments: 74
Uploads: 0
Here's the project page:
http://www.wowace.com/addons/libsharedmedia-3-0/

Here's the API documentation:
http://www.wowace.com/addons/libshar...documentation/

Many users also have...
http://www.wowace.com/addons/sharedmedia/
...for a starting set of media.
(I mention this just so you have a lot of examples of media registrations.)
Last edited by pelf : 02-16-14 at 02:32 PM.
pelf is offline Report comment to moderator  
Reply With Quote
Unread 02-15-14, 05:11 PM  
Malsomnus
A Chromatic Dragonspawn
AddOn Author - Click to view AddOns

Forum posts: 170
File comments: 58
Uploads: 18
Well, it's time for me to sleep, but I'll have a look at this SharedMedia tomorrow, whatever it is.
Meanwhile, I'm glad someone's taking an interest in this add-on
__________________
SanityCheck - Never again find yourself tanking Garrosh Hellscream in a wedding dress and a fishing rod!

Remember, every time you post a comment on an add-on, a kitten gets its wings!
Malsomnus is offline Report comment to moderator  
Reply With Quote
Unread 02-15-14, 04:45 PM  
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member

Forum posts: 128
File comments: 74
Uploads: 0
Well, the simplest route there would be to just support LibSharedMedia. There are a ton of addons that pull sounds, textures, fonts from SharedMedia. Should be easy to find an example.
pelf is offline Report comment to moderator  
Reply With Quote
Unread 02-15-14, 04:12 PM  
Malsomnus
A Chromatic Dragonspawn
AddOn Author - Click to view AddOns

Forum posts: 170
File comments: 58
Uploads: 18
Huh. I had no idea you could use tables and functions as keys. Plus my head was slightly in Javascript mode, where everything that's used as a key is stringified first.
I better do something about it, since my code currently isn't ready for that sort of scenario at all.

About the fonts, I'm afraid this touches a few subjects that I don't know. And this includes the question of "What is the correct design here".
The more I think of it, the more it seems to me like the fonts should be selected from a list in some configuration menu. I'd appreciate it if you could help me with the code to figure out what fonts go in that list
__________________
SanityCheck - Never again find yourself tanking Garrosh Hellscream in a wedding dress and a fishing rod!

Remember, every time you post a comment on an add-on, a kitten gets its wings!
Malsomnus is offline Report comment to moderator  
Reply With Quote
Unread 02-15-14, 12:04 PM  
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member

Forum posts: 128
File comments: 74
Uploads: 0
Table keys can actually be any data type (except maybe "userdata"). So, you might end up displaying a table with a key of another table. Same with functions. So you'll need a way to display that. I actually did that image in Photoshop, but that font is Calibri.

Check out this file in my font replacement addon tekticles: tekticles.lua

The addon has to modify all of those global font objects that are used across the UI to initialize the FontStrings for frames and to derive from when creating other Fonts. I'd imagine most font replacements will work like this, somehow. For example, Tooltip_Med is first defined in Fonts.xml:
Code:
<Font name="Tooltip_Med" font="Fonts\FRIZQT__.TTF" virtual="true">
	<FontHeight>
		<AbsValue val="12"/>
	</FontHeight>
</Font>
Other font definitions rely on these basic ones to derive from like in FontStyles.xml:
Code:
<Font name="GameTooltipText" inherits="Tooltip_Med" justifyH="LEFT" virtual="true">
	<Color r="1.0" g="1.0" b="1.0"/>
</Font>
Then, finally, over in GameTooltipTemplate.xml, GameTooltipText is used as the base for the final FontString objects created for use with the game tooltip.

----

EDIT: I made a table with odd keys and then used LuaBrowser to look at it. Here's how they deal with this. The code to make the table is on the left. Then I just ran /lb code TestTableKeys.
Last edited by pelf : 02-15-14 at 12:18 PM.
pelf is offline Report comment to moderator  
Reply With Quote
Unread 02-15-14, 10:57 AM  
Malsomnus
A Chromatic Dragonspawn
AddOn Author - Click to view AddOns

Forum posts: 170
File comments: 58
Uploads: 18
Well, some of these ideas are definitely good and I'll probably implement them, but I'm not sure I'll be doing a full redesign for this add-on just yet

I'm not sure I understood the mock-up image you made. Are those keys named "(function)" and "(table)"?

I like the idea of using the divider line as a resizing grip. If I do enough redesign to have that line at all, I'm definitely going to use this one.

I don't know about the font thing. Whatever fonts you picked for your system, you picked them because they're good for floating combat text or for tooltips or for quest text, which says nothing about how good these fonts might be for the add-on's purpose. I picked the current font specifically because the others looked wrong for this purpose. Either I don't understand what you mean, or I just disagree with the idea that this should use the same font you've chosen for something else.

I haven't thought about the implementation in detail yet, but I do think that the key sorting will be part of the next version.

And last, but not least, I'm glad you like MagicMarker
__________________
SanityCheck - Never again find yourself tanking Garrosh Hellscream in a wedding dress and a fishing rod!

Remember, every time you post a comment on an add-on, a kitten gets its wings!
Malsomnus is offline Report comment to moderator  
Reply With Quote
Unread 02-14-14, 04:46 PM  
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member

Forum posts: 128
File comments: 74
Uploads: 0
This is a different idea, so I'm just going to make a new post instead of putting more edits into that one.

Instead of having the big scroll buttons on the top and bottom, integrate them into the right-hand-side interior of the table frame. Make two small arrows for up/down that do the same job as the big buttons did.

Here's the flair: using NUMBER_OF_CHILDREN, MAX_ENTRIES and the number of vertical pixels between the up button and the down button (VERTICAL_GAP) to construct a scroll grip that is sized vertically using (MAX_ENTRIES / NUMBER_OF_CHILDREN) * VERTICAL_GAP. Then calculate VERTICAL_GAP / NUMBER_OF_CHILDREN and when scrolling happens, move the bar in the right direction by that number of pixels.

Extra credit flair: allow scrolling by grabbing and dragging the grip .
pelf is offline Report comment to moderator  
Reply With Quote
Unread 02-14-14, 04:02 PM  
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member

Forum posts: 128
File comments: 74
Uploads: 0
I was thinking you might ask me what I meant. Let me see if I can mock it up ... here:


This is pretty rough, but the idea should come across. In a way, reminiscent of this. I've scaled the frame to fit the contents as prepared. I'm not sure if I would or wouldn't prefer a border line between rows. I didn't want to get stuck polishing a mockup so I just left that question unanswered.

----

Check out the truncations on the screenshot on the addon page: screenshot. I had been testing it on UI frames, and as you know the names of subordinate frames and textures often get pretty obscenely long.

Check down with sorting for why the width check isn't a big deal.

For how to deal with dumb stuff with really, really big keys... perhaps twofold:
  1. Establish a more-generous maximum that sits a few steps inside of ridiculous.

  2. Truncate overflow past that, but code in a little toggle button like this:





    When that is pressed, it expands all the keys to their full width (or, maximally, to the width of the screen, I guess).

Whatever you do, don't make it look like that ugly button I just drew in Photoshop.

EDIT2: Oooh, or! Make the vertical divider actually a grip that can be clicked and dragged. It would increase and reduce the size of the left pane and stop at the width of the longest item being displayed. That's much cleaner/more integrated.

----

I have long since replaced all five game fonts with another of my choosing which is then being applied more broadly by tekticles. I guess my point is that calling out a game font specifically, by name, in a font-modified UI is probably not going to accomplish what was expected. You might as well pick one of the standard templates for continuity and supporting the pattern.

----

With regard to the ordering, I agree and would further have both (function) and (table) last, numbers first, booleans and strings second.

I could imagine the sort working like this:
  1. A table is clicked; expand code runs.
  2. Inspect the table and find all of its keys.
  3. Process the keys by their type into a string representation that can be cached with the other child data/metadata so that the type evaluations only have to happen once.
  4. Write your sort comparison function to sort by the processed key text.
  5. Sort the list of child tuples.
  6. Load the initial page of MAX_ENTRIES children into the frame. As you're doing that, make note of how wide the widest left-side and right-side FontStrings are for just that page of children.
When scrolling happens, you just run the same width-check code again on the new set of child rows to establish a new maximum.

In terms of cost, we've got: (1) one pass through the keys list to produce a string for each; (2) pulling a row out of the pool and set the text of its two FontStrings; (3) finding out the widest FontString for the left and the right sides after the rows have been put together. For the latter, you could even cache the widths with the row so that if it doesn't get scrolled off, it can use the cached value. I didn't read your pool code in super detail ... I have a vague memory that there's a way to get a scrolled-off row back from the pool; that is, they don't just get wiped when they return to the pool. If not, adding something like that might be another nice optimization.

EDIT: Ha, I just noticed you're the author of MagicMarker. While I never actually used it, I have, since I first read about it, thought that was the coolest idea with such a fun and practical way to apply the marks.
Last edited by pelf : 02-14-14 at 04:38 PM.
pelf is offline Report comment to moderator  
Reply With Quote
Unread 02-14-14, 01:49 PM  
Malsomnus
A Chromatic Dragonspawn
AddOn Author - Click to view AddOns

Forum posts: 170
File comments: 58
Uploads: 18
Thank you for the long comment

* I haven't given much thought to wasted space, but I gradually realize that I should. Optimally this should get a pretty big redesign, but losing the borders is probably a good start. Could you explain though what you mean by two-column tooltip?

* Fair point about truncated keys. Finding the longest key for the current table might lead to pretty severe waste of space though, I wonder if there's another option. As it is, I personally don't get many keys truncated, though it sounds like your experience is quite different... maybe I should start by making the default width configurable?

* Well, that's 2 people telling me it should be left-aligned... alright, I'm convinced

* Not sure about the fonts. Possibly this should be configurable as well. My original thought was that most fonts just aren't very convenient for this.

* The whole re-rooting thing is the top feature for the next version already.

* I admit that sorting hasn't occurred to me at all, but it's probably a good idea. I should probably take your idea and implement as is (though personally I'd want functions to appear last - it's the least informative type of data). This idea feels like there's even more improvements that could apply to it, if only I can figure out what they are.
__________________
SanityCheck - Never again find yourself tanking Garrosh Hellscream in a wedding dress and a fishing rod!

Remember, every time you post a comment on an add-on, a kitten gets its wings!
Malsomnus is offline Report comment to moderator  
Reply With Quote
Unread 02-14-14, 02:23 AM  
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member

Forum posts: 128
File comments: 74
Uploads: 0
I just noticed that you posted an update to this and it reminded me of when I was playing around with it. Here's my feedback based on my experience interacting with it:
  • There's a lot of space being wasted with the border box drawn around each item. I think it would be better if it looked like a two-column tooltip; the denser the information is, the easier it is to look at it all at once and the more than can be fit on screen.

  • I would want the key names to only be truncated as a last resort. I see that you have a tooltip set up to spell out truncated key names, but there's nothing better than just having the data right there. Perhaps the width of each tier block can be calculated by finding the longest key value string in the current page and setting the size accordingly?

    That said, we probably can't escape having a maximum width, though, so that the functionality isn't diminished just because the table had long key names. However, if the size is calculated, some tier blocks may be narrower than others; that could recoup some lost space.

    At an absolute minimum, a width greater than 84 would be a start .

  • I would much prefer the keys be left-aligned so that it is easier to visually scan through them. If they were in a tabular display (like I was talking about, above), this would be even more important.

  • You should use one of the global font objects instead of defining the font explicitly so that it will follow the rest of the UI's fonts.

  • It might be neat to be able to modified-click a value and have it replace the current root item with that item. Could make it easier to deal with very deep tables.
    • If the re-rooting thing is added, it would be nice to be able to go "back" to a previous root item. e.g. I've Ctrl-clicked a child of my originally watched table and looked through it and now I want to go back to the table I was previously watching.

  • Performing an intelligent sort on the children would make it easier to find what one is looking for. The sort could be based on type(key):
    1. All table keys.
    2. All function keys.
    3. All number keys in ascending order.
    4. All boolean and string keys in ascending order, using "true" and "false" for the boolean keys.

That's all I can think of for now. This method of visualizing tables definitely has some advantages and disadvantages over an implementation like Lua Browser. I'm not sure which is better, but I do know that having the choice available at all is good.
pelf is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: