|
02-13-12, 06:33 PM | #1 |
Sorting auras in oUF 1.6.0
Hello,
I'm porting my layout to oUF 1.6.0 and have some issues with sorting auras by remaining duration. Auras are not sorted correctly and gaps appear between them. My code works with the stable oUF version. Here is a stripped down code snippet from what I use for buffs: lua Code:
Full code can be found at https://github.com/Rainrider/oUF_Rai..._functions.lua Here a screen of what happens: Green area is for buffs, red for debuffs. The upper part is the result of buffing myself with Mark of the Wild and Thorns and switching to bear form. The lower part is after Thorns ticked out. The standart buff display is showing the buffs sorted by index. Is this an error on my part or is it a bug in oUF? |
|
02-14-12, 02:02 AM | #2 |
Looks like the issue on oUF's side. I'll going to push a fix for this and a small API change when I get home later today.
The change will be that :PreSetPosition() can return two values, which tell oUF what range of auras it needs to re-position. It currently attempts to re-position them on every try, but it uses the default range.
__________________
「貴方は1人じゃないよ」 |
|
02-14-12, 08:38 PM | #3 |
It works now. I return 0 and #auras. Haven't been able to test whether there is any difference between say #buffs and buffs.visibleBuffs, but there is a problem if the layout returns toRange greater than the current number of auras (tested this with returning the max number of auras that you pass to PreSetPosition. Maybe you could safe guard this by breaking the loop in SetPosition if not button). You also forgot to make the change for buffs and debuffs.
And another one I wasn't able to understand: Your range in SetPosition is from 0 (anchoredIcons) to the number of created icons. In Update you call SetPosition with a range form 1 to createdIcons. SetPosition would then start to anchor from the second aura and leave a gap of 1 button at the start, wouldn't it? Last edited by Rainrider : 02-14-12 at 08:46 PM. |
|
02-17-12, 02:47 PM | #4 | |||
__________________
「貴方は1人じゃないよ」 |
||||
02-18-12, 10:53 AM | #5 |
I want to return the lowest possible range in order to spare table traversion and reanchoring, which means I would only want to sort and reanchor what's visible. If I read this right, you increment createdIcons in createAuraIcon before calling customFilter, meaning createdIcons >= visible{Auras|Buffs|Debuffs}. If #{auras|buffs|debuffs} == createdIcons, then I return a higher range than I need to and thus do SetPosition on icons I don't see. So I don't quite get it why we run SetPosition up to createdIcons and not visible{Auras|Buffs|Debuffs}. And because there are no gaps after SetPosition I believe the function only does this for the visible icons and not the created ones (I have to admit I haven't tested this with CustomFilter yet). Or I just messed the whole thing up and don't understand your code properly.
|
|
02-19-12, 05:52 AM | #6 |
I changed the default :SetPosition() to only anchor icons that it hasn't anchored before. This works great as long as you don't sort the auras, which is why :PreSetPosition() needs to return ranges to :SetPosition().
This does mean that visible{Auras,{B,Deb}uffs is equal to createdIcons when oUF runs :SetPosition() for a certain range, which also is equal to #icons. If we have two units, one with 1 buff and one with 5 buffs. If I target the one with 1 buff first, oUF will run :SetPosition() for the range 1 to 1. If I then target the unit with 5 buffs, oUF will run :SetPostion() for the range 2 to 5. If I target the unit with 1 buff again, oUF won't run :SetPosition(). The above is true as long as :PreSetPosition() doesn't return a range. :SetPosition() is currently 0-based, which it really shouldn't be. I honestly don't know why I ended up writing it that way, but it's something I'd like to fix.
__________________
「貴方は1人じゃないよ」 |
|
WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Sorting auras in oUF 1.6.0 |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|