• 0

    posted a message on LibDogTag-3.0 - evaluating to a callback instead of a FontString
    Hi. For a project I'm working on I'm trying to utilize dog tags in order to allow the user to specify all types of visual properties. However, LibDogTag seems to be designed only for dynamically setting the text and text format of FontStrings. While I'd like the user to be able to use dog tags for that purpose, I'd also like to be able to use dog tags for specifying other visual properties.

    Some examples are using dog tags to specify a frame color that varies with threat level, a frame position and size that varies with the hostility and type of the current target, and an addon property that signals to the addon on a high level how to change its overall appearance based on combat/resting/normal status. These could obviously all be hard coded, but I want an advanced user to be able to specify the behavior at run time using dog tags.

    I've poked through the code considerably, and while I think it would be possible to get something like this working, it would require some major hacks and is not really viable for two main reasons:
    • There are two ways to register with the library to get dog tag evaluation updates: (1) LibDogTag:AddFontString(), which is restricted to getting evaluation results sent directly to the FontString's :SetText, :SetAlpha, and :SetFont functions; and (2) LibDogTag:AddCallback(), which seems to only get notified when a dog tag code is reevaluated, but doesn't receive the results of that evaluation. AddCallback comes close to fitting the bill, but I would need the results of the dog tag evaluation as well. While I could use the code argument sent to the callback function to call LibDogTag:Evaluate directly, wouldn't this be inefficient and cause the codes to be compiled and evaluated redundantly?
    • Dog tag codes evaluate to a string, a number, or nil. For the above to work, dog tags would also need to evaluate to tables and functions (for iterators, mostly). This could be partially hacked by writing custom tag functions that flatten simple tables into a string and having the results from :Evaluate converted back to a table, but this is obviosuly ugly and inefficient.

    In an ideal world (for me), there would be a library that generically parses, compiles, and evaluates dogtag codes, where the results of each individual tag and the codes themselves are not restricted in any way. In that world, the tag Unit.ClassColor would not wrap text with "|cffffffff...|r" stuff, but would rather return a table like { r = 1, g = 1, b = 1, a = 1 }. And a font string's text could be specified by a tag like [Class:Colorize(ClassColor)] while also specifying a frame's color simply with [ClassColor], instead of setting the text with [Class:ClassColor] and not being able to do the second easilly because the frame color property/callback expects a table of rbga values.

    I am amazed at the amount and quality of work put into the parser and compiler. What I'm trying to do would essentially use 95% of what the library does, but I'm not sure it's possible for me to tie into the library. I guess I'm stuck.

    Anyone have any ideas? Am I looking at the library wrong and there is actually a way to do what I want without having to hack the usage of the library? Does anyone else agree that the parser and compiler in LibDogTag have uses outside evaluating FontString content, and could be more useful if generic?
    Posted in: Libraries
  • 0

    posted a message on Auracle - Official Thread
    Quote from taleden
    I suppose it's inevitable to just have the three text options (label, time, stacks) independently configurable. I'll put it on the list.

    Glad to hear you have this on your list. My main is a warrior tank and I consider your addon one of the most vital components of my UI. I monitor the target debuffs for Thunderclap, Demoralizing Shout, and Sunder Armor. With the Sunder Armor tracker it would be great to be able to have both time remaining and number of stacks displayed simultaneously. As is, I display the number of stacks and just try to pay attention to the cooldown spiral, but sometimes its tough to know when its about to expire. Just wanted to remind you of the interest in such a feature. Great work on the addon! Thanks.
    Posted in: General AddOns
  • 0

    posted a message on Layout library
    Thanks guys, for your thoughts. I definitely do not advocate libraries/standards that limit variety and creativity in addons. However, I guess where I see a layout library fitting in is that position and size are not really things that define an addon (other than maybe a HUD), but should be thought of in the context of the entire UI--where one addon is positioned matters to other addons.

    While currently a user simply positions addon frames using whatever method is provided by the addon developer, there are a number of problems that arise.

    The way in which position is stored for many addons makes it impossible to transfer complete UI layouts between computers without having to make serious adjustments (and sometimes having to deal with frames being offscreen). Most people would think of UI compilations first, but I'm sure others share my case where I am constantly transfering complete UIs back and forth between a desktop and laptop with different resolutions. More support for relative positioning in addons would make this less of a headache. UI compilation authors would probably love being able to create layouts that are resolution independent.

    It is impossible to make one addon's position depend on the position of another. I'm thinking of a situation where the size of an addon frame is dynamic, and you don't want two adjacent addons to overlap. For example, I'd like to be able to have the top edge of my quest tracker frame attach to the bottom edge of my buff bar stack frame; as the buff frame expands and contracts, the quest tracker moves along with it. No addons that I know of allow drag-and-drop snapping of one addon to an edge of another.

    There are a couple other issues as well, but those are the two I'm thinking of right now.

    Xinhuan and Elsia bring up a good point about addons having different visual characteristics that would make a unified layout engine overly complex. This only applies for snapping, but I don't think it would be too burdensome for an addon developer to specify non-default padding/snap-points etc. if its complex shape warrants it.

    I'm planning on working more on a prototype, but my basic plan is something along these lines:

    1) Create a basic library that allows for a "design mode" of all supporting frames. When design mode is toggled (provide a keybinding), all frames registered with the library will highlight slightly. Mousing over a frame brings up a set of resize handles alla Visual Studio Forms designer. Moving and resizing would work as expected. Only basic, non-snapping absolute positioning would be supported. Exiting design mode locks all frames.

    2) Add UIParent-relative positioning support. Right-clicking on a supporting frame while in design mode brings up a context menu that allows the user to specify one of the nine points on the screen to which to position relatively.

    3) Add basic snapping support that provides a toggleable grid mode while in design mode.

    4) Add relative snapping support that allows frames to snap to other frames.

    I'm curious as to what people think...
    Posted in: Addon Ideas
  • 0

    posted a message on Layout library
    Hi, I'm new here, but I have been poking around here for a few years. I once wrote some boss mods, raiding unit frames, and an addon that allowed things to dynamically dock like VS.Net, but that was a long time ago in Classic WoW. Anyways...

    One of my pet peeves about all the addons I use is that there is little uniformity in presentation to and interaction with the user. Yeah, almost all of them programmatically utilize the same set of libraries; however, to the user pretty much all that is similar is maybe the usage of the same option profile system and similarity in configuration panels.

    One thing that especially irks me is that it seems like every addon that allows the user to move interface elements using drag and drop does so in a different way. Examples include Recount and Omen differing visually and functionally in moving and resizing their frames, most addons having lock/unlock options tucked away within custom config panels, some addons providing snap-to-whatever capability while others don't, and some addons providing the ability to specify positions with relative offsets and points.

    To alleviate my headaches, I propose creating a library that provides much of this common functionality. It would be of benefit to both developers wishing to make addons that "play well" with other addons and to users that would find configuration of their addons more flexible and consistent. I've spent a fair amount of time thinking about the design of such a library, but I wanted to see what some of the other (more experienced) developers thought of the usefulness of such a library before I blabber on anymore...
    Posted in: Addon Ideas
  • To post a comment, please or register a new account.