444 - Provide an API to add new indicators

What is the feature you'd like to see added to Grid?

ATM, there is a nifty API to easily add new status plugin but there is no way to add new indicators. Couldn't some kind of API be added to easily add new indicators to Grid unit frames ? They could be submodule of GridFrame.

Why do you think this feature should be added to the Grid core instead of a plugin?

Right now, there are several indicators plugins around there. Looking at their code, they are all "shoehorning" themselves into GridFrame, using hooksecurefunc and messing with/using its internal variables and methods, which makes them very dependent on GridFrame internals (hence the breakage when it was ported from Ace2 to Ace3). Having an API for those plugins would also help to:

  1. ease the writing of those plugins,
  2. limit the impact of internal changes on these plugins (and conversely),
  3. and possibly make them more efficient.
User When Change
Phanx Nov 11, 2014 at 03:19 UTC Changed status from Declined to Fixed
Phanx Jan 06, 2011 at 06:29 UTC Changed status from Accepted to Declined
Phanx Nov 17, 2010 at 06:05 UTC Changed status from New to Accepted
Phanx Nov 16, 2010 at 21:01 UTC Changed assigned to from Pastamancer to Phanx
Adirelle Nov 15, 2010 at 14:03 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of Phanx Phanx Jan 06, 2011 at 06:28 UTC - 0 likes

    Marking this as declined for now, since I have no ETA on when I may have the time and/or motivation to work on it, and I'm tired of getting email notifications for people voting on the ticket.

    Voting on tickets accomplishes NOTHING aside from annoying everyone who is subscribed to a project's ticket updates, people. Please don't do it.

  • Avatar of Adirelle Adirelle Nov 17, 2010 at 10:50 UTC - 0 likes

    Actually I think there are more methods hooked. In my own indicator plugin (gridindicatoriconbar), I'm at least hooking SetIndicator, ClearIndicator, SetIconSize and SetFrameFont. After taking a look at another one (GridManaBar, that also modifies the internal layout), it seems other methods are also hooked, like SetFrameHeight. This could also be handled by Ace3 messaging or CBH callbacks.

    Note that right now, for oUF, you have to provide 3 callbacks (Enable, Disable and Update) to create the element (e.g. the status in Grid terminology) itself. And for the display, this element often looks for method overrides in the indicator frame. E.g. if you add a frame.Health statusbar, the Enable callback of the Health element will be called and then the Update callback. This callbacks will in turn search for frame.Health.Update or frame.Health.PreUpdate and frame.Health.PostUpdate overrides.

    Back to Grid, the solution could be to have something like :

    GridFrame:RegisterCustomIndicator(indicatorId, label, createCallback) Where indicatorId is the internal name of the indicator, the label is used for the GUI and the createCallback is used as "frame[indicatorId] = createCallback(frame, indicatorId)" in GridFrame.

    The resulting frame[indicatorId] could be then searched for callbacks like "SetIndicator(frame, indicator, ...)", "ClearIndicator(frame, indicatorid)", "SetFrameWidth(frame)", etc...

  • Avatar of Phanx Phanx Nov 17, 2010 at 06:04 UTC - 0 likes

    I was thinking it'd be more like an oUF element, where the registration call passes a function to call when a new frame is created, and a function to call when a status assigned to the indicator is gained/lost.

  • Avatar of Adirelle Adirelle Nov 16, 2010 at 22:48 UTC - 0 likes

    That would probably work halfway, e.g. every indicators wouldn't be its own module, but a module could register several indicators. I think you cannot avoid having a submodule because you need to have some methods to handle the indicators somewhere.

    Last edited Nov 16, 2010 by Adirelle
  • Avatar of Phanx Phanx Nov 16, 2010 at 21:04 UTC - 0 likes

    It's something I definitely want to do, but I don't have time to work on it right now. Most likely, it would work more like GridLayout, where individual layouts aren't modules, but are just registered with the GridLayout module.



Last updated
Nov 11, 2014
Nov 15, 2010
Fixed - Developer made requested changes. QA should verify.
Enhancement - A change which is intended to better the project in some way
Medium - Normal priority.

Reported by

Possible assignees