texture obj gets cleared but set attributes stay in table
Hi there!
I have a perplexing problem. I have a local table, textures, which is indexed by the texture object/widget. The value at a given index is true if the texture is in use, and false if not. (to store previously created textures to save work) Now the perplexing part is that somewhere the texture is losing it's classification or whatever as a widget. However, any manually set values inside the widgets table stay. I have absolutely no clue what's causing this to happen and I was wondering if anyone else has had this happen to them. Below is my get and free texture functions. Code:
local numTexs = 0 Code:
textures = { Code:
textures = { Thoughts? Thanks! |
Post your entire code. Attach files to your post, or use a paste site.
|
1 Attachment(s)
The whole file is attached.
Whole addon with problem: https://github.com/Brusalk/EventHorizon-2.0 The problem specifically happens when the following 2 commands are run allowing time for the bar to fall off the left side of the spellbar before calling the 2nd one. /run EH:addTimedBar("core", EH.spellbars.active[1], 9, 1, "cooldown", 3, "debuff") and then /run EH:addTimedBar("core", EH.spellbars.active[1], 9, 1, "cooldown", 3, "debuff") after 12 seconds. The second /run will error the following: Code:
3x EventHorizon\EventHorizon-2.0.0.lua:585: Attempt to find "this" in non-framescript object |
Well, that error is certainly interesting, because it names line 585, which is a blank line in the file you posted...
Anyway, I don't see anything immediately obvious, and don't have time right now to comb through everything to figure out what's going wrong, but I'd suggest using a more robust recycling system for your textures. Code:
local textures = {} -- textures in use Also, when you clear the texture, don't forget to nil out the reference to it, eg: Code:
bar.segments[firstVisible].tick = ns:freeTempTexture(bar.segments[firstVisible].tick) |
Looks like it was a problem with the getTempTexture function.
Your code works perfectly. Thanks! |
I edited my previous code slightly to set the parent in the GetTexture function, so it's consistent between the pooled and newly created textures returned.
|
I have a somewhat related problem I think.
I'm getting the textures and everything is fine and dandy. The first time that I call EH:addTimedBar() the tick indicators are shown above the background texture correctly, however from then on the tick indicators show behind it, even though I've used tick:SetDrawLayer() and set them on completely different levels. I've been trying to figure out why the ticks are showing behind textures that they should be in front of, but it's been a few hours now with no luck. Do you have much experience with trying to draw stuff on different layers to ensure something is always right where it should be? I thought the problem might be related to not sharing the same parent with the other textures, but even if they share it I still have the same issue. Thanks. -Brusalk |
https://github.com/Brusalk/EventHori...r/EventHorizon
link to current branch with most up-to-date code. |
All times are GMT -6. The time now is 12:41 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI